ソースを参照

Temp-试衣间

LiuQilin 8 年 前
コミット
920d3a2314

+ 9 - 0
Assets/Extension.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: b948198483a8b93419206e81215060f3
+folderAsset: yes
+timeCreated: 1496150477
+licenseType: Pro
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 4 - 0
Assets/Resource/DragonBones/Unity/src/DragonBones/unity/UnityFactory.cs

@@ -20,6 +20,8 @@ namespace DragonBones
      */
     public class UnityFactory : BaseFactory
     {
+        public static Dictionary<string, Texture2D> AtlasDictionary = new Dictionary<string, Texture2D>();
+
         private static IEventDispatcher<EventObject> _eventManager = null;
         private static GameObject _gameObject = null;
         /**
@@ -229,6 +231,8 @@ namespace DragonBones
                 var shader = Shader.Find(defaultShaderName);
                 var material = new Material(shader);
                 material.mainTexture = textureAtlas;
+                
+                AtlasDictionary.Add(textureAtlas.name, textureAtlas);
 
                 textureAtlasData.texture = material;
                 textureAtlasData._disposeTexture = true;

BIN
Assets/Resource/Prefab/Object/DebugMode.prefab


BIN
Assets/Resource/Prefab/Object/DressRoom.prefab


BIN
Assets/Resource/Prefab/PrefabUI/CloseItem.prefab


+ 8 - 0
Assets/Resource/Prefab/PrefabUI/CloseItem.prefab.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: f9745d1e09b5acc47a0abe1eb100c9b8
+timeCreated: 1499763828
+licenseType: Pro
+NativeFormatImporter:
+  userData: 
+  assetBundleName: ui
+  assetBundleVariant: 

BIN
Assets/Resource/Prefab/PrefabUI/GroupE.prefab


+ 22 - 1
Assets/Resource/XML/Config/dressRoom_config.xml

@@ -1,5 +1,20 @@
 <data>
-  <item id="1" jump_frequency="5" name="" type="" level="" buy_currency="" buy_amt="" buy_advance_currency="" buy_advance_amt="" />
+  <item id="1" jump_frequency="5" name="" type="" index="" bodypart="" level="" buy_currency="" buy_amt="" buy_advance_currency="" buy_advance_amt="" />
+  <item id="2" jump_frequency="" name="脑壳1" type="1" index="0" bodypart="1" level="" buy_currency="" buy_amt="" buy_advance_currency="" buy_advance_amt="" />
+  <item id="3" jump_frequency="" name="脑壳2" type="1" index="1" bodypart="1" level="" buy_currency="" buy_amt="" buy_advance_currency="" buy_advance_amt="" />
+  <item id="4" jump_frequency="" name="脑壳3" type="1" index="2" bodypart="1" level="" buy_currency="" buy_amt="" buy_advance_currency="" buy_advance_amt="" />
+  <item id="5" jump_frequency="" name="裙子1" type="3" index="0" bodypart="2" level="" buy_currency="" buy_amt="" buy_advance_currency="" buy_advance_amt="" />
+  <item id="6" jump_frequency="" name="裙子2" type="3" index="1" bodypart="2" level="" buy_currency="" buy_amt="" buy_advance_currency="" buy_advance_amt="" />
+  <item id="7" jump_frequency="" name="裙子3" type="3" index="2" bodypart="2" level="" buy_currency="" buy_amt="" buy_advance_currency="" buy_advance_amt="" />
+  <item id="8" jump_frequency="" name="鞋子1" type="3" index="3" bodypart="3" level="" buy_currency="" buy_amt="" buy_advance_currency="" buy_advance_amt="" />
+  <item id="9" jump_frequency="" name="鞋子2" type="3" index="4" bodypart="3" level="" buy_currency="" buy_amt="" buy_advance_currency="" buy_advance_amt="" />
+  <item id="10" jump_frequency="" name="鞋子3" type="3" index="5" bodypart="3" level="" buy_currency="" buy_amt="" buy_advance_currency="" buy_advance_amt="" />
+  <item id="11" jump_frequency="" name="头饰品1" type="4" index="0" bodypart="4" level="" buy_currency="" buy_amt="" buy_advance_currency="" buy_advance_amt="" />
+  <item id="12" jump_frequency="" name="头饰品2" type="4" index="1" bodypart="4" level="" buy_currency="" buy_amt="" buy_advance_currency="" buy_advance_amt="" />
+  <item id="13" jump_frequency="" name="头饰品3" type="4" index="2" bodypart="4" level="" buy_currency="" buy_amt="" buy_advance_currency="" buy_advance_amt="" />
+  <item id="14" jump_frequency="" name="上衣1" type="2" index="0" bodypart="5" level="" buy_currency="" buy_amt="" buy_advance_currency="" buy_advance_amt="" />
+  <item id="15" jump_frequency="" name="上衣2" type="2" index="1" bodypart="5" level="" buy_currency="" buy_amt="" buy_advance_currency="" buy_advance_amt="" />
+  <item id="16" jump_frequency="" name="上衣3" type="2" index="2" bodypart="5" level="" buy_currency="" buy_amt="" buy_advance_currency="" buy_advance_amt="" />
   <comment>
     <id>
 id
@@ -13,6 +28,12 @@ id
     <type>
 类型
 </type>
+    <index>
+位置
+</index>
+    <bodypart>
+换装部位
+</bodypart>
     <level>
 可以购买等级
 </level>

BIN
Assets/Resource/Xlsx/dressRoom_config.xlsx


+ 23 - 13
Assets/Script/Manage/ManaData.cs

@@ -660,19 +660,6 @@ public class ManaData : Regist
         return xmlNode.Attributes;
     }
 
-    public static XmlAttributeCollection GetDressRoomConfig()
-    {
-        TextAsset textAsset = ManaReso.Load<TextAsset>("dressRoom_config", Folder.Config);
-
-        XmlDocument xmlDoc = new XmlDocument();
-
-        xmlDoc.LoadXml(textAsset.text);
-
-        XmlNode xmlNode = xmlDoc.SelectSingleNode("data").SelectSingleNode("item");
-
-        return xmlNode.Attributes;
-    }
-
     public static List<XmlAttributeCollection> GetSkillConfig()
     {
         TextAsset textAsset;
@@ -771,4 +758,27 @@ public class ManaData : Regist
 
         return attributeList;
     }
+
+    public static List<XmlAttributeCollection> GetDressRoomConfig()
+    {
+        TextAsset textAsset;
+        XmlNodeList xmlNodeList;
+
+        XmlDocument xmlDoc = new XmlDocument();
+        List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
+
+
+        textAsset = ManaReso.Load<TextAsset>("dressRoom_config", Folder.Config);
+
+        xmlDoc.LoadXml(textAsset.text);
+
+        xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
+
+        for (int i = 0; i < xmlNodeList.Count; i++)
+        {
+            attributeList.Add(xmlNodeList[i].Attributes);
+        }
+
+        return attributeList;
+    }
 }

+ 1 - 1
Assets/Script/Manage/ManaIAP.cs

@@ -118,7 +118,7 @@ public class ManaIAP : MonoBehaviour, IStoreListener
             }
         }
     }
-
+    
     public static void CallbackAD(ShowResult showResult)
     {
         if (showResult == ShowResult.Finished)

+ 38 - 2
Assets/Script/Manage/ManaPlayer.cs

@@ -6,6 +6,7 @@ using UnityEngine.UI;
 using System;
 using System.Xml;
 using System.Text;
+using System.Linq;
 using System.Collections;
 using System.Diagnostics;
 using System.Collections.Generic;
@@ -27,6 +28,8 @@ public class ManaPlayer : Regist
     public static Transform PlayerBrown;
     public static ManaPlayer Instance;
 
+    public static Dictionary<string, Sprite> CloseDic = new Dictionary<string, Sprite>();
+
     #endregion
 
     public override void Instantiate()
@@ -83,11 +86,44 @@ public class ManaPlayer : Regist
 
         #region DressRoom
 
+        #region Close
+
+        List<List<TextureAtlasData>> textureAtlasDatalist = UnityFactory.factory.GetAllTextureAtlasData().Values.ToList();
+
+        for (int i = 0; i < textureAtlasDatalist.Count; i++)
+        {
+            for (int j = 0; j < textureAtlasDatalist[i].Count; j++)
+            {
+                TextureAtlasData textureAtlasData = textureAtlasDatalist[i][j];
+
+                string textureName = textureAtlasData.imagePath.Split('.')[0] + "ture";
+
+                foreach (var kv in textureAtlasData.textures)
+                {
+                    Texture2D texture2D = UnityFactory.AtlasDictionary[textureName];
+
+                    Rect rect = new Rect(kv.Value.region.x, texture2D.height - kv.Value.region.y - kv.Value.region.height, kv.Value.region.width, kv.Value.region.height);
+
+                    Sprite sprite = Sprite.Create(texture2D, rect, new Vector2(0.5f, 0.5f));
+                    sprite.name = kv.Value.name;
+
+                    CloseDic.Add(sprite.name, sprite);
+                }
+            }
+        }
+
+        #endregion
+
         DressRoom = ManaReso.Get("DressRoom", Folder.Discard, true, null, true, ObjType.DressRoom);
 
-        XmlAttributeCollection attribute = ManaData.GetDressRoomConfig();
+        List<XmlAttributeCollection> attributeList = ManaData.GetDressRoomConfig();
+
+        Player.JumpFrequency = float.Parse(attributeList[0][1].Value);
 
-        Player.JumpFrequency = float.Parse(attribute[1].Value);
+        for (int i = 1; i < attributeList.Count; i++)
+        {
+            new CloseUnit(attributeList[i]);
+        }
 
         #endregion
     }

+ 1 - 0
Assets/Script/Manage/ManaReso.cs

@@ -39,6 +39,7 @@ public enum ObjType
     Flower,
     Garden,
     Tutorial,
+    CloseItem,
     DressRoom,
 
     Canvas,

+ 322 - 359
Assets/Script/Object/Player.cs

@@ -1,15 +1,195 @@
 using DragonBones;
 
 using UnityEngine;
+using UnityEngine.UI;
 using UnityEngine.EventSystems;
 
+using System;
+using System.Xml;
 using System.Linq;
 using System.Collections;
 using System.Collections.Generic;
 
 using Slot = DragonBones.Slot;
+using Random = UnityEngine.Random;
 using Transform = UnityEngine.Transform;
 
+public enum BodyPart
+{
+    Eye,
+    Top,
+    Shoe,
+    Head,
+    Dress,
+    Mouse,
+    Headwear,
+}
+
+public class CloseUnit
+{
+    public enum CloseType
+    {
+        Top,
+        Hair,
+        Wing,
+        Dress,
+        Decarator,
+    }
+
+    #region Var
+
+    public int Index;
+    public int BuyLevel;
+    public string CloseName;
+
+    public Text BtnLab;
+    public Sprite Sprite;
+    public Image Icon;
+    public Button BuyBtn;
+    public Button DressBtn;
+    public BodyPart BodyPart;
+    public Transform Transform;
+    public CloseType Type;
+
+    public double BuyAmt;
+    public double BuyAdvanceAmt;
+    public Current BuyCurrent;
+    public Current BuyAdvanceCurrent;
+
+    public Dictionary<string, Transform> ChildDic = new Dictionary<string, Transform>();
+
+    #endregion
+
+    public CloseUnit(XmlAttributeCollection attribute)
+    {
+        CloseName = attribute[2].Value;
+        Sprite = SpriteParse(attribute[2].Value);
+        Type = TypeParse(attribute[3].Value);
+        Index = Auxiliary.IntParse(attribute[4].Value, -1);
+        BodyPart = BodyPartParse(attribute[5].Value);
+        BuyLevel = Auxiliary.IntParse(attribute[6].Value, 0);
+        BuyCurrent = Auxiliary.CurrentParse(attribute[7].Value);
+        BuyAmt = Auxiliary.DoubleParse(attribute[8].Value, 0);
+        BuyAdvanceCurrent = Auxiliary.CurrentParse(attribute[9].Value);
+        BuyAdvanceAmt = Auxiliary.DoubleParse(attribute[10].Value, 0);
+
+        CreateItem();
+    }
+
+    protected void CreateItem()
+    {
+        Transform = ManaReso.Get("CloseItem", Folder.UI, false, ManaReso.Get("Canvas"), false);
+
+        if (Type == CloseType.Top)
+        {
+            Transform.SetParent(ManaReso.Get("Pb_TopGrid"));
+        }
+        else if (Type == CloseType.Hair)
+        {
+            Transform.SetParent(ManaReso.Get("Pa_HairGrid"));
+        }
+        else if (Type == CloseType.Dress)
+        {
+            Transform.SetParent(ManaReso.Get("Pc_DressGrid"));
+        }
+        else if (Type == CloseType.Wing)
+        {
+            Transform.SetParent(ManaReso.Get("Pe_WingGrid"));
+        }
+        else if (Type == CloseType.Decarator)
+        {
+            Transform.SetParent(ManaReso.Get("Pd_DecaratorGrid"));
+        }
+        else
+        {
+            throw new Exception();
+        }
+
+        Transform.SetSiblingIndex(Index);
+
+
+        Auxiliary.CompileDic(Transform, ChildDic);
+
+        Icon = ChildDic["Icon"].GetComponent<Image>();
+        DressBtn = ChildDic["CloseItem"].GetComponent<Button>();
+        BuyBtn = ChildDic["BuyBtn"].GetComponent<Button>();
+        BtnLab = ChildDic["BuyBtnLab"].GetComponent<Text>();
+
+
+        Icon.sprite = Sprite;
+
+        Icon.SetNativeSize();
+
+        float newSize = 100 / Icon.sprite.rect.width;
+        Icon.Resize(true, new Vector2(newSize, newSize)); //todo 把NewSize写到配置里
+    }
+
+    protected Sprite SpriteParse(string str)
+    {
+        return ManaPlayer.CloseDic[str];
+    }
+
+    protected BodyPart BodyPartParse(string str)
+    {
+        int type = Auxiliary.IntParse(str, -1);
+
+        if (type == 1)
+        {
+            return BodyPart.Head;
+        }
+        else if (type == 2)
+        {
+            return BodyPart.Dress;
+        }
+        else if (type == 3)
+        {
+            return BodyPart.Shoe;
+        }
+        else if (type == 4)
+        {
+            return BodyPart.Headwear;
+        }
+        else if (type == 5)
+        {
+            return BodyPart.Top;
+        }
+        else
+        {
+            throw new Exception();
+        }
+    }
+
+    protected CloseType TypeParse(string str)
+    {
+        int type = Auxiliary.IntParse(str, -1);
+
+        if (type == 1)
+        {
+            return CloseType.Hair; 
+        }
+        else if (type == 2)
+        {
+            return CloseType.Top;
+        }
+        else if (type == 3)
+        {
+            return CloseType.Dress;
+        }
+        else if (type == 4)
+        {
+            return CloseType.Decarator;
+        }
+        else if (type == 5)
+        {
+            return CloseType.Wing;
+        }
+        else
+        {
+            throw new Exception();
+        }
+    }
+}
+
 public class Player : Regist , IPointerClickHandler
 {
     #region 变量
@@ -17,12 +197,14 @@ public class Player : Regist , IPointerClickHandler
     public static bool InDressRoom;
     public static float JumpFrequency;
 
-
     public bool AnimLock1;
     public bool AnimLock2;
     public float JumpTime;
     public float JumpTimer;
 
+    public Dictionary<string, Transform> ChildDic = new Dictionary<string, Transform>();
+
+    #region 换装
 
     private string Eye;
     private string Top;
@@ -30,29 +212,21 @@ public class Player : Regist , IPointerClickHandler
     private string Head;
     private string Dress;
     private string Mouse;
-    private string RightShoe;
     private string HeadWear;
+    private string TempClose;
 
-    public UnityArmatureComponent EyeUac;
-    public UnityArmatureComponent TopUac;
-    public UnityArmatureComponent HeadUac;
-    public UnityArmatureComponent DressUac;
-    public UnityArmatureComponent MouseUac;
-    public UnityArmatureComponent LeftShoeUac;
-    public UnityArmatureComponent RightShoeUac;
-    public UnityArmatureComponent HeadWearUac;
-
-    private List<string> EyeList = new List<string>();
-    private List<string> TopList = new List<string>();
-    private List<string> ShoeList = new List<string>();
-    private List<string> HeadList = new List<string>();
-    private List<string> DressList = new List<string>();
-    private List<string> MouseList = new List<string>();
-    private List<string> HeadWearList = new List<string>();
+    public DragonBones.Slot EyeSlot;
+    public DragonBones.Slot TopSlot;
+    public DragonBones.Slot HeadSlot;
+    public DragonBones.Slot DressSlot;
+    public DragonBones.Slot MouseSlot;
+    public DragonBones.Slot LeftShoeSlot;
+    public DragonBones.Slot RightShoeSlot;
+    public DragonBones.Slot HeadWearSlot;
 
     public UnityArmatureComponent UAC;
 
-    public Dictionary<string, Transform> ChildDic = new Dictionary<string, Transform>();
+    #endregion
 
     #endregion
 
@@ -67,6 +241,7 @@ public class Player : Regist , IPointerClickHandler
 
         Auxiliary.CompileDic(transform, ChildDic);
 
+
         Vector3 bigShadowScale = new Vector3(1.820952f, 2.418199f, 1.820952f);
         Vector3 smallShadowScale = new Vector3(1.081191f, 1.435807f, 1.081191f);
 
@@ -123,6 +298,26 @@ public class Player : Regist , IPointerClickHandler
     }
 
 
+    public void OnStart(string str, EventObject eventObject)
+    {
+        if (eventObject.animationState.name == "newAnimation1")
+        {
+            ChildDic["Shadow"].StreamReForScale();
+
+            AnimLock1 = true;
+
+            TempClose = Eye;
+
+            ChangeClose(BodyPart.Eye, "眼睛表情1");
+        }
+        else if (eventObject.animationState.name == "newAnimation")
+        {
+            AnimLock1 = false;
+
+            ChangeClose(BodyPart.Eye, TempClose);
+        }
+    }
+
     public void PlayAnim(string animName)
     {
         if (AnimLock1)
@@ -209,7 +404,7 @@ public class Player : Regist , IPointerClickHandler
 
         InDressRoom = true;
 
-        JumpTime = Mathf.Lerp(0, JumpFrequency, Random.Range(0f, 1f));
+        JumpTime = Mathf.Lerp(0, JumpFrequency, Random.Range(0.5f, 1f));
 
         ManaCenter.SceneSwitchLock = true;
 
@@ -233,8 +428,8 @@ public class Player : Regist , IPointerClickHandler
 
                     ManaPlayer.Player.ChildDic["Shadow"].SetActive(true);
 
-                    ManaPlayer.Player.transform.position = ManaReso.Get("P_PlayerPos").position;
-                    ManaPlayer.Player.transform.localScale = ManaReso.Get("P_PlayerPos").lossyScale;
+                    ManaPlayer.Player.transform.position = ManaReso.Get("DressRoomPos").position;
+                    ManaPlayer.Player.transform.localScale = ManaReso.Get("DressRoomPos").lossyScale;
 
                     ManaReso.Get("Garden").TweenBacSr();
                     ManaReso.Get("DressRoom").TweenForSr();
@@ -279,92 +474,8 @@ public class Player : Regist , IPointerClickHandler
 
         UAC.anim.Play("newAnimation");
 
-
-        EyeList.Add("眼睛1");
-        TopList.Add("上衣1");
-        ShoeList.Add("鞋子1");
-        HeadList.Add("脑壳1");
-        DressList.Add("裙子1");
-        MouseList.Add("嘴巴1");
-        HeadWearList.Add("头饰品1");
-
-        EyeList.Add("眼睛2");
-        TopList.Add("上衣2");
-        ShoeList.Add("鞋子2");
-        HeadList.Add("脑壳2");
-        DressList.Add("裙子2");
-        MouseList.Add("嘴巴2");
-        HeadWearList.Add("头饰品2");
-
-        EyeList.Add("眼睛3");
-        TopList.Add("上衣3");
-        ShoeList.Add("鞋子3");
-        HeadList.Add("脑壳3");
-        DressList.Add("裙子3");
-        MouseList.Add("嘴巴3");
-        HeadWearList.Add("头饰品3");
-
-        Eye = EyeList[0];
-        Top = TopList[0];
-        Shoe = ShoeList[0];
-        Head = HeadList[0];
-        Dress = DressList[0];
-        Mouse = MouseList[0];
-        HeadWear = HeadWearList[0];
-
-
-        List<List<TextureAtlasData>> textureAtlasDatalist = UnityFactory.factory.GetAllTextureAtlasData().Values.ToList();
-
-        for (int i = 0; i < textureAtlasDatalist.Count; i++)
-        {
-            Debug.Log(textureAtlasDatalist[i][0].imagePath);
-        }
-        
-
-        return UAC;
-    }
-
-    public UnityArmatureComponent BuildPink()
-    {
-        Build();
-
-        Eye = "眼睛3";
-        Top = "上衣3";
-        Shoe = "鞋子3";
-        Head = "脑壳3";
-        Dress = "裙子3";
-        Mouse = "嘴巴3";
-        HeadWear = "头饰品3";
-
-        UAC.armature.GetSlot("眼睛").childArmature = UnityFactory.factory.BuildArmature(Eye);
-        UAC.armature.GetSlot("上衣").childArmature = UnityFactory.factory.BuildArmature(Top);
-        UAC.armature.GetSlot("脑壳").childArmature = UnityFactory.factory.BuildArmature(Head);
-        UAC.armature.GetSlot("裙子").childArmature = UnityFactory.factory.BuildArmature(Dress);
-        UAC.armature.GetSlot("嘴巴").childArmature = UnityFactory.factory.BuildArmature(Mouse);
-        UAC.armature.GetSlot("鞋子左").childArmature = UnityFactory.factory.BuildArmature(Shoe);
-        UAC.armature.GetSlot("鞋子右").childArmature = UnityFactory.factory.BuildArmature(Shoe);
-        UAC.armature.GetSlot("头饰品").childArmature = UnityFactory.factory.BuildArmature(HeadWear);
-
-        EyeUac = transform.FindChild("Armature/眼睛3").GetComponent<UnityArmatureComponent>();
-        TopUac = transform.FindChild("Armature/上衣3").GetComponent<UnityArmatureComponent>();
-        HeadUac = transform.FindChild("Armature/脑壳3").GetComponent<UnityArmatureComponent>();
-        DressUac = transform.FindChild("Armature/裙子3").GetComponent<UnityArmatureComponent>();
-        MouseUac = transform.FindChild("Armature/嘴巴3").GetComponent<UnityArmatureComponent>();
-        LeftShoeUac = transform.FindChild("Armature/鞋子3").GetComponent<UnityArmatureComponent>();
-        HeadWearUac = transform.FindChild("Armature/头饰品3").GetComponent<UnityArmatureComponent>();
-
-        RightShoeUac = transform.FindChild("Armature").GetChild(LeftShoeUac.transform.GetSiblingIndex() + 1).GetComponent<UnityArmatureComponent>();
-
-        ResetDepth();
-
         UAC.AddEventListener(EventObject.START, OnStart);
 
-        return UAC;
-    }
-
-    public UnityArmatureComponent BuildBlond()
-    {
-        Build();
 
         Eye = "眼睛1";
         Top = "上衣1";
@@ -374,266 +485,81 @@ public class Player : Regist , IPointerClickHandler
         Mouse = "嘴巴1";
         HeadWear = "头饰品1";
 
-        UAC.armature.GetSlot("眼睛").childArmature = UnityFactory.factory.BuildArmature(Eye);
-        UAC.armature.GetSlot("上衣").childArmature = UnityFactory.factory.BuildArmature(Top);
-        UAC.armature.GetSlot("脑壳").childArmature = UnityFactory.factory.BuildArmature(Head);
-        UAC.armature.GetSlot("裙子").childArmature = UnityFactory.factory.BuildArmature(Dress);
-        UAC.armature.GetSlot("嘴巴").childArmature = UnityFactory.factory.BuildArmature(Mouse);
-        UAC.armature.GetSlot("鞋子左").childArmature = UnityFactory.factory.BuildArmature(Shoe);
-        UAC.armature.GetSlot("鞋子右").childArmature = UnityFactory.factory.BuildArmature(Shoe);
-        UAC.armature.GetSlot("头饰品").childArmature = UnityFactory.factory.BuildArmature(HeadWear);
-        
-        EyeUac = transform.FindChild("Armature/眼睛1").GetComponent<UnityArmatureComponent>();
-        TopUac = transform.FindChild("Armature/上衣1").GetComponent<UnityArmatureComponent>();
-        HeadUac = transform.FindChild("Armature/脑壳1").GetComponent<UnityArmatureComponent>();
-        DressUac = transform.FindChild("Armature/裙子1").GetComponent<UnityArmatureComponent>();
-        MouseUac = transform.FindChild("Armature/嘴巴1").GetComponent<UnityArmatureComponent>();
-        LeftShoeUac = transform.FindChild("Armature/鞋子1").GetComponent<UnityArmatureComponent>();
-        HeadWearUac = transform.FindChild("Armature/头饰品1").GetComponent<UnityArmatureComponent>();
-
-        RightShoeUac = transform.FindChild("Armature").GetChild(LeftShoeUac.transform.GetSiblingIndex() + 1).GetComponent<UnityArmatureComponent>();
-
-        ResetDepth();
-
-        UAC.AddEventListener(EventObject.START, OnStart);
+        EyeSlot = UAC.armature.GetSlot("眼睛");
+        TopSlot = UAC.armature.GetSlot("上衣");
+        HeadSlot = UAC.armature.GetSlot("脑壳");
+        DressSlot = UAC.armature.GetSlot("裙子");
+        MouseSlot = UAC.armature.GetSlot("嘴巴");
+        LeftShoeSlot = UAC.armature.GetSlot("鞋子左");
+        RightShoeSlot = UAC.armature.GetSlot("鞋子右");
+        HeadWearSlot = UAC.armature.GetSlot("头饰品");
+
+        ChangeClose(BodyPart.Eye, "眼睛1", false);
+        ChangeClose(BodyPart.Top, "上衣1", false);
+        ChangeClose(BodyPart.Shoe, "鞋子1", false);
+        ChangeClose(BodyPart.Head, "脑壳1", false);
+        ChangeClose(BodyPart.Dress, "裙子1", false);
+        ChangeClose(BodyPart.Mouse, "嘴巴1", false);
+        ChangeClose(BodyPart.Headwear, "头饰品1", false);
 
         return UAC;
     }
 
-    public UnityArmatureComponent BuildBrown()
+    public UnityArmatureComponent BuildPink()
     {
         Build();
 
-        Eye = "眼睛2";
-        Top = "上衣2";
-        Shoe = "鞋子2";
-        Head = "脑壳2";
-        Dress = "裙子2";
-        Mouse = "嘴巴2";
-        HeadWear = "头饰品2";
-
-        UAC.armature.GetSlot("眼睛").childArmature = UnityFactory.factory.BuildArmature(Eye);
-        UAC.armature.GetSlot("上衣").childArmature = UnityFactory.factory.BuildArmature(Top);
-        UAC.armature.GetSlot("脑壳").childArmature = UnityFactory.factory.BuildArmature(Head);
-        UAC.armature.GetSlot("裙子").childArmature = UnityFactory.factory.BuildArmature(Dress);
-        UAC.armature.GetSlot("嘴巴").childArmature = UnityFactory.factory.BuildArmature(Mouse);
-        UAC.armature.GetSlot("鞋子左").childArmature = UnityFactory.factory.BuildArmature(Shoe);
-        UAC.armature.GetSlot("鞋子右").childArmature = UnityFactory.factory.BuildArmature(Shoe);
-        UAC.armature.GetSlot("头饰品").childArmature = UnityFactory.factory.BuildArmature(HeadWear);
-
-        EyeUac = transform.FindChild("Armature/眼睛2").GetComponent<UnityArmatureComponent>();
-        TopUac = transform.FindChild("Armature/上衣2").GetComponent<UnityArmatureComponent>();
-        HeadUac = transform.FindChild("Armature/脑壳2").GetComponent<UnityArmatureComponent>();
-        DressUac = transform.FindChild("Armature/裙子2").GetComponent<UnityArmatureComponent>();
-        MouseUac = transform.FindChild("Armature/嘴巴2").GetComponent<UnityArmatureComponent>();
-        LeftShoeUac = transform.FindChild("Armature/鞋子2").GetComponent<UnityArmatureComponent>();
-        HeadWearUac = transform.FindChild("Armature/头饰品2").GetComponent<UnityArmatureComponent>();
-
-        RightShoeUac = transform.FindChild("Armature").GetChild(LeftShoeUac.transform.GetSiblingIndex() + 1).GetComponent<UnityArmatureComponent>();
-
-        ResetDepth();
-
-        UAC.AddEventListener(EventObject.START, OnStart);
+        ChangeClose(BodyPart.Eye, "眼睛3");
+        ChangeClose(BodyPart.Top, "上衣3");
+        ChangeClose(BodyPart.Shoe, "脑壳3");
+        ChangeClose(BodyPart.Head, "裙子3");
+        ChangeClose(BodyPart.Dress, "嘴巴3");
+        ChangeClose(BodyPart.Mouse, "鞋子3");
+        ChangeClose(BodyPart.Headwear, "头饰品3");
 
         return UAC;
     }
 
-
-    public void OnStart(string str, EventObject eventObject)
-    {
-        if (eventObject.animationState.name == "newAnimation1")
-        {
-            ChildDic["Shadow"].StreamReForScale();
-
-            AnimLock1 = true;
-
-            UAC.armature.GetSlot("眼睛").childArmature = UnityFactory.factory.BuildArmature("眼睛表情1");
-
-            EyeUac = transform.FindChild("Armature/眼睛表情1").GetComponent<UnityArmatureComponent>();
-        }
-        else if (eventObject.animationState.name == "newAnimation")
-        {
-            AnimLock1 = false;
-
-            UAC.armature.GetSlot("眼睛").childArmature = UnityFactory.factory.BuildArmature(Eye);
-
-            EyeUac = transform.FindChild("Armature/" + Eye).GetComponent<UnityArmatureComponent>();
-        }
-
-        ResetDepth();
-    }
-
-
-    public void PrevEye()
-    {
-        int index = EyeList.IndexOf(Eye);
-
-        Eye = EyeList.Prev(index);
-
-        ChangeClose(EyeUac, Eye);
-
-        ResetDepth();
-    }
-
-    public void PrevTop()
-    {
-        int index = TopList.IndexOf(Top);
-
-        Top = TopList.Prev(index);
-
-        ChangeClose(TopUac, Top);
-
-        ResetDepth();
-    }
-
-    public void PrevShoe()
-    {
-        int index = ShoeList.IndexOf(Shoe);
-
-        Shoe = ShoeList.Prev(index);
-
-        ChangeClose(LeftShoeUac, Shoe);
-        ChangeClose(RightShoeUac, Shoe);
-
-        ResetDepth();
-    }
-
-    public void PrevHead()
-    {
-        int index = HeadList.IndexOf(Head);
-
-        Head = HeadList.Prev(index);
-
-        ChangeClose(HeadUac, Head);
-
-        ResetDepth();
-    }
-
-    public void PrevDress()
-    {
-        int index = DressList.IndexOf(Dress);
-
-        Dress = DressList.Prev(index);
-
-        ChangeClose(DressUac, Dress);
-
-        ResetDepth();
-    }
-
-    public void PrevMouse()
-    {
-        int index = MouseList.IndexOf(Mouse);
-
-        Mouse = MouseList.Prev(index);
-
-        ChangeClose(MouseUac, Mouse);
-
-        ResetDepth();
-    }
-
-    public void PrevHeadWear()
-    {
-        int index = HeadWearList.IndexOf(HeadWear);
-
-        HeadWear = HeadWearList.Prev(index);
-
-        ChangeClose(HeadWearUac, HeadWear);
-
-        ResetDepth();
-    }
-
-
-    public void NextEye()
-    {
-        int index = EyeList.IndexOf(Eye);
-
-        Eye = EyeList.Next(index);
-
-        ChangeClose(EyeUac, Eye);
-
-        ResetDepth();
-    }
-
-    public void NextTop()
-    {
-        int index = TopList.IndexOf(Top);
-
-        Top = TopList.Next(index);
-
-        ChangeClose(TopUac, Top);
-
-        ResetDepth();
-    }
-
-    public void NextShoe()
-    {
-        int index = ShoeList.IndexOf(Shoe);
-
-        Shoe = ShoeList.Next(index);
-
-        ChangeClose(LeftShoeUac, Shoe);
-        ChangeClose(RightShoeUac, Shoe);
-
-        ResetDepth();
-    }
-
-    public void NextHead()
-    {
-        int index = HeadList.IndexOf(Head);
-
-        Head = HeadList.Next(index);
-
-        ChangeClose(HeadUac, Head);
-
-        ResetDepth();
-    }
-
-    public void NextDress()
+    public UnityArmatureComponent BuildBlond()
     {
-        int index = DressList.IndexOf(Dress);
-
-        Dress = DressList.Next(index);
-
-        ChangeClose(DressUac, Dress);
+        Build();
 
         ResetDepth();
-    }
-
-    public void NextMouse()
-    {
-        int index = MouseList.IndexOf(Mouse);
 
-        Mouse = MouseList.Next(index);
-
-        ChangeClose(MouseUac, Mouse);
-
-        ResetDepth();
+        return UAC;
     }
 
-    public void NextHeadWear()
+    public UnityArmatureComponent BuildBrown()
     {
-        int index = HeadWearList.IndexOf(HeadWear);
-
-        HeadWear = HeadWearList.Next(index);
+        Build();
 
-        ChangeClose(HeadWearUac, HeadWear);
+        ChangeClose(BodyPart.Eye, "眼睛2");
+        ChangeClose(BodyPart.Top, "上衣2");
+        ChangeClose(BodyPart.Shoe, "脑壳2");
+        ChangeClose(BodyPart.Head, "裙子2");
+        ChangeClose(BodyPart.Dress, "嘴巴2");
+        ChangeClose(BodyPart.Mouse, "鞋子2");
+        ChangeClose(BodyPart.Headwear, "头饰品2");
 
-        ResetDepth();
+        return UAC;
     }
 
 
     public void ResetDepth()
     {
         UAC.transform.SetLZ(2);
+        
+        transform.FindChild("Armature/" + Eye).SetLZ(-0.001f);
+        transform.FindChild("Armature/" + Top).SetLZ(-0.003f);
+        transform.FindChild("Armature/" + Head).SetLZ(0);
+        transform.FindChild("Armature/" + Dress).SetLZ(-0.002f);
+        transform.FindChild("Armature/" + Mouse).SetLZ(-0.001f);
+        transform.FindChild("Armature/" + HeadWear).SetLZ(-0.001f);
+
+        Transform shoeTra = transform.FindChild("Armature/" + Shoe);
+        shoeTra.SetLZ(-0.001f);
 
-        HeadUac.transform.SetLZ(0);
-        EyeUac.transform.SetLZ(-0.001f);
-        TopUac.transform.SetLZ(-0.003f);
-        DressUac.transform.SetLZ(-0.002f);
-        MouseUac.transform.SetLZ(-0.001f);
-        LeftShoeUac.transform.SetLZ(-0.001f);
-        RightShoeUac.transform.SetLZ(-0.001f);
-        HeadWearUac.transform.SetLZ(-0.001f);
+        transform.FindChild("Armature").GetChild(shoeTra.GetSiblingIndex() + 1).SetLZ(-0.001f);
 
         transform.FindChild("Armature/左腿").SetLZ(0);
         transform.FindChild("Armature/右腿").SetLZ(0);
@@ -642,35 +568,72 @@ public class Player : Regist , IPointerClickHandler
         transform.FindChild("Armature/右手").SetLZ(-0.001f);
     }
 
-    public void ChangeClose(UnityArmatureComponent uac, string armatureName)
+    public void ChangeClose(BodyPart bodyPart, string armatureName, bool setDepth = true)
     {
-        //DragonBones.Slot slot = null;
-        //if (uac.armature != null)
-        //{
-        //    slot = uac.armature.parent;
-        //    uac.Dispose(false);
-        //}
+        List<DragonBones.Slot> slotList = new List<DragonBones.Slot>();
 
+        if (bodyPart == BodyPart.Eye)
+        {
+            Eye = armatureName;
 
-        //GameObject go = uac.gameObject;
+            slotList.Add(EyeSlot);
+        }
+        else if (bodyPart == BodyPart.Top)
+        {
+            Top = armatureName;
 
-        //uac = UnityFactory.factory.BuildArmatureComponent(armatureName, "Closet_ske", null, null, go);
+            slotList.Add(TopSlot);
+        }
+        else if (bodyPart == BodyPart.Shoe)
+        {
+            Shoe = armatureName;
 
-        //if (uac == null)
-        //{
-        //    uac = UnityFactory.factory.BuildArmatureComponent(armatureName, "stand_ske", null, null, go);
-        //}
+            slotList.Add(LeftShoeSlot);
+            slotList.Add(RightShoeSlot);
+        }
+        else if (bodyPart == BodyPart.Head)
+        {
+            Head = armatureName;
 
-        //uac.name = armatureName;
+            slotList.Add(HeadSlot);
+        }
+        else if (bodyPart == BodyPart.Dress)
+        {
+            Dress = armatureName;
 
+            slotList.Add(DressSlot);
+        }
+        else if (bodyPart == BodyPart.Mouse)
+        {
+            Mouse = armatureName;
+            
+            slotList.Add(MouseSlot);
+        }
+        else if (bodyPart == BodyPart.Headwear)
+        {
+            HeadWear = armatureName;
 
-        //if (slot != null)
-        //{
-        //    slot.childArmature = uac.armature;
-        //}
+            slotList.Add(HeadWearSlot);
+        }
+        else
+        {
+            throw new Exception();
+        }
 
-        //uac.sortingLayerName = uac.sortingLayerName;
-        //uac.sortingOrder = uac.sortingOrder;
+        ChangeClose(slotList, armatureName, setDepth);
+    }
+
+    public void ChangeClose(List<DragonBones.Slot> slotList, string armatureName, bool setDepth = true)
+    {
+        for (int i = 0; i < slotList.Count; i++)
+        {
+            slotList[i].childArmature = UnityFactory.factory.BuildArmature(armatureName);
+        }
+
+        if (setDepth)
+        {
+            ResetDepth();
+        }
     }
 
     #endregion

+ 2 - 2
Assets/Script/Tool/Auxiliary.cs

@@ -128,12 +128,12 @@ public class Auxiliary : Regist
 
         if (Input.GetKeyDown(KeyCode.Z))
         {
-
+            ManaPlayer.Player.ChangeClose(BodyPart.Head, "脑壳2");
         }
 
         if (Input.GetKeyDown(KeyCode.X))
         {
-            
+            ManaPlayer.Player.ChangeClose(BodyPart.Head, "脑壳3");
         }
 
         if (Input.GetKeyDown(KeyCode.C))

+ 6 - 2
ToList.txt

@@ -1,8 +1,12 @@
-P的语言文档
+P的语言文档(Btn)
 
 已购再打个绿颜色的勾
 
-DragoneBones的换装 动画事件 得到单个Sprite
+得到单个Sprite
+
+换装的存档 已拥有服装的存档 跳跃的时候眼睛不要存档
+
+存档覆盖问题
 
 
 还原PlayerConfig