|
@@ -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
|