Player.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792
  1. using DragonBones;
  2. using UnityEngine;
  3. using UnityEngine.UI;
  4. using UnityEngine.EventSystems;
  5. using System;
  6. using System.Xml;
  7. using System.Linq;
  8. using System.Collections;
  9. using System.Collections.Generic;
  10. using Slot = DragonBones.Slot;
  11. using Random = UnityEngine.Random;
  12. using Transform = UnityEngine.Transform;
  13. public enum BodyPart
  14. {
  15. Eye,
  16. Top,
  17. Shoe,
  18. Head,
  19. Dress,
  20. Mouse,
  21. Headwear,
  22. }
  23. public class CloseUnit
  24. {
  25. public enum CloseType
  26. {
  27. Top,
  28. Hair,
  29. Wing,
  30. Dress,
  31. Decarator,
  32. }
  33. #region Var
  34. public string Description
  35. {
  36. get { return Language.GetStr("DressRoom", CloseName); }
  37. }
  38. public int ID;
  39. public int Index;
  40. public int BuyLevel;
  41. public int PixelSize;
  42. public bool Bought;
  43. public string CloseName;
  44. public Text BuyBtnLab;
  45. public Sprite Sprite;
  46. public Image Icon;
  47. public Button BuyBtn;
  48. public Button DressBtn;
  49. public BodyPart BodyPart;
  50. public Transform Transform;
  51. public CloseType Type;
  52. public double BuyAmt;
  53. public double BuyAdvanceAmt;
  54. public Current BuyCurrent;
  55. public Current BuyAdvanceCurrent;
  56. public Dictionary<string, Transform> ChildDic = new Dictionary<string, Transform>();
  57. #endregion
  58. public CloseUnit(XmlAttributeCollection attribute)
  59. {
  60. ID = Auxiliary.IntParse(attribute[0].Value, -1);
  61. CloseName = attribute[2].Value;
  62. Sprite = SpriteParse(attribute[2].Value);
  63. Type = TypeParse(attribute[3].Value);
  64. Index = Auxiliary.IntParse(attribute[4].Value, -1);
  65. BodyPart = BodyPartParse(attribute[5].Value);
  66. BuyLevel = Auxiliary.IntParse(attribute[6].Value, 0);
  67. BuyCurrent = Auxiliary.CurrentParse(attribute[7].Value);
  68. BuyAmt = Auxiliary.DoubleParse(attribute[8].Value, 0);
  69. BuyAdvanceCurrent = Auxiliary.CurrentParse(attribute[9].Value);
  70. BuyAdvanceAmt = Auxiliary.DoubleParse(attribute[10].Value, 0);
  71. PixelSize = Auxiliary.IntParse(attribute[11].Value, 100);
  72. ManaPlayer.CloseIDDic.Add(CloseName, ID);
  73. ManaPlayer.CloseUnitDic.Add(ID, this);
  74. CreateItem();
  75. }
  76. protected void CreateItem()
  77. {
  78. Transform = ManaReso.Get("CloseItem", Folder.UI, false, ManaReso.Get("Canvas"), false);
  79. if (Type == CloseType.Top)
  80. {
  81. Transform.SetParent(ManaReso.Get("Pb_TopGrid"));
  82. }
  83. else if (Type == CloseType.Hair)
  84. {
  85. Transform.SetParent(ManaReso.Get("Pa_HairGrid"));
  86. }
  87. else if (Type == CloseType.Dress)
  88. {
  89. Transform.SetParent(ManaReso.Get("Pc_DressGrid"));
  90. }
  91. else if (Type == CloseType.Wing)
  92. {
  93. Transform.SetParent(ManaReso.Get("Pe_WingGrid"));
  94. }
  95. else if (Type == CloseType.Decarator)
  96. {
  97. Transform.SetParent(ManaReso.Get("Pd_DecaratorGrid"));
  98. }
  99. else
  100. {
  101. throw new Exception();
  102. }
  103. Transform.SetSiblingIndex(Index);
  104. Auxiliary.CompileDic(Transform, ChildDic);
  105. Icon = ChildDic["Icon"].GetComponent<Image>();
  106. DressBtn = ChildDic["CloseItem"].GetComponent<Button>();
  107. BuyBtn = ChildDic["BuyBtn"].GetComponent<Button>();
  108. BuyBtnLab = ChildDic["BuyBtnLab"].GetComponent<Text>();
  109. Icon.sprite = Sprite;
  110. Icon.SetNativeSize();
  111. float newSize = PixelSize / Icon.sprite.rect.width;
  112. Icon.Resize(true, new Vector2(newSize, newSize));
  113. BuyBtnLab.text = Language.GetStr("UI", "P_BtnLab1");
  114. BuyBtn.onClick.AddListener
  115. (
  116. () =>
  117. {
  118. ManaAudio.PlayClip(Clip.BtnClip);
  119. ManaReso.Get("Pa_Info").TweenForCG();
  120. Image image = ManaReso.Get<Image>("Pa_Icon");
  121. image.sprite = Sprite;
  122. image.Resize(true, new Vector2(newSize, newSize));
  123. ManaReso.SetText("Pa_Lab", Description);
  124. ManaReso.SetText("Pa_BtnLab", Language.GetStr("UI", "Pa_BtnLab") + Auxiliary.ImageParse(BuyCurrent) + BuyAmt.ToString("0"));
  125. ManaReso.SetButtonEvent
  126. (
  127. "Pa_Btn",
  128. OnBuy
  129. );
  130. }
  131. );
  132. DressBtn.onClick.AddListener
  133. (
  134. () =>
  135. {
  136. ManaAudio.PlayClip(Clip.BtnClip);
  137. ManaPlayer.Player.ChangeClose(BodyPart, CloseName);
  138. }
  139. );
  140. }
  141. protected Sprite SpriteParse(string str)
  142. {
  143. return ManaPlayer.CloseSpriteDic[str];
  144. }
  145. protected BodyPart BodyPartParse(string str)
  146. {
  147. int type = Auxiliary.IntParse(str, -1);
  148. if (type == 1)
  149. {
  150. return BodyPart.Head;
  151. }
  152. else if (type == 2)
  153. {
  154. return BodyPart.Dress;
  155. }
  156. else if (type == 3)
  157. {
  158. return BodyPart.Shoe;
  159. }
  160. else if (type == 4)
  161. {
  162. return BodyPart.Headwear;
  163. }
  164. else if (type == 5)
  165. {
  166. return BodyPart.Top;
  167. }
  168. else
  169. {
  170. throw new Exception();
  171. }
  172. }
  173. protected CloseType TypeParse(string str)
  174. {
  175. int type = Auxiliary.IntParse(str, -1);
  176. if (type == 1)
  177. {
  178. return CloseType.Hair;
  179. }
  180. else if (type == 2)
  181. {
  182. return CloseType.Top;
  183. }
  184. else if (type == 3)
  185. {
  186. return CloseType.Dress;
  187. }
  188. else if (type == 4)
  189. {
  190. return CloseType.Decarator;
  191. }
  192. else if (type == 5)
  193. {
  194. return CloseType.Wing;
  195. }
  196. else
  197. {
  198. throw new Exception();
  199. }
  200. }
  201. public void Unlock()
  202. {
  203. Bought = true;
  204. BuyBtn.interactable = false;
  205. BuyBtn.image.material = Lib.GrayMat;
  206. BuyBtnLab.text = Language.GetStr("UI", "P_BtnLab2");
  207. }
  208. public void OnBuy()
  209. {
  210. ManaCenter.Pay
  211. (
  212. "",
  213. BuyAmt,
  214. BuyCurrent,
  215. () =>
  216. {
  217. Unlock();
  218. ManaAudio.PlayClip(Clip.CurrentClip);
  219. ManaPlayer.BoughtCloseList.UniqueAdd(ID);
  220. ManaReso.Get("Pa_Info").TweenBacCG();
  221. },
  222. false
  223. );
  224. }
  225. public void OnLevelChange()
  226. {
  227. }
  228. }
  229. public class Player : Regist , IPointerClickHandler
  230. {
  231. #region 变量
  232. public static bool InDressRoom;
  233. public static float JumpFrequency;
  234. public bool AnimLock1;
  235. public bool AnimLock2;
  236. public float JumpTime;
  237. public float JumpTimer;
  238. public Dictionary<string, Transform> ChildDic = new Dictionary<string, Transform>();
  239. #region 换装
  240. private string Eye;
  241. private string Top;
  242. private string Shoe;
  243. private string Head;
  244. private string Dress;
  245. private string Mouse;
  246. private string HeadWear;
  247. private string TempClose;
  248. public DragonBones.Slot EyeSlot;
  249. public DragonBones.Slot TopSlot;
  250. public DragonBones.Slot HeadSlot;
  251. public DragonBones.Slot DressSlot;
  252. public DragonBones.Slot MouseSlot;
  253. public DragonBones.Slot LeftShoeSlot;
  254. public DragonBones.Slot RightShoeSlot;
  255. public DragonBones.Slot HeadWearSlot;
  256. public UnityArmatureComponent UAC;
  257. #endregion
  258. #endregion
  259. public override bool RegistImmed()
  260. {
  261. if (base.RegistImmed())
  262. {
  263. return true;
  264. }
  265. enabled = true;
  266. Auxiliary.CompileDic(transform, ChildDic);
  267. Vector3 bigShadowScale = new Vector3(1.820952f, 2.418199f, 1.820952f);
  268. Vector3 smallShadowScale = new Vector3(1.081191f, 1.435807f, 1.081191f);
  269. ChildDic["Shadow"].CreateStreamScale
  270. (
  271. new List<float>() {0, 0, 0},
  272. new List<float>() {0.33f, 0.33f, 0.33f, 0.33f},
  273. new List<VecPair>() {new VecPair(bigShadowScale, smallShadowScale), new VecPair(smallShadowScale, bigShadowScale), new VecPair(bigShadowScale, smallShadowScale), new VecPair(smallShadowScale, bigShadowScale)},
  274. true,
  275. true,
  276. Curve.EaseOutQuad
  277. );
  278. return false;
  279. }
  280. public void FixedUpdate()
  281. {
  282. if (InDressRoom)
  283. {
  284. JumpTimer += Time.fixedDeltaTime;
  285. if (JumpTimer > JumpTime)
  286. {
  287. if (!AnimLock1 && !AnimLock2)
  288. {
  289. PlayAnim("newAnimation1");
  290. }
  291. AnimLock2 = true;
  292. }
  293. if (JumpTimer > JumpFrequency)
  294. {
  295. AnimLock2 = false;
  296. JumpTime = Mathf.Lerp(0, JumpFrequency, Random.Range(0f, 1f));
  297. JumpTimer = 0;
  298. }
  299. }
  300. }
  301. public void OnStart(string str, EventObject eventObject)
  302. {
  303. if (eventObject.animationState.name == "newAnimation1")
  304. {
  305. ChildDic["Shadow"].StreamReForScale();
  306. AnimLock1 = true;
  307. TempClose = Eye;
  308. ChangeClose(BodyPart.Eye, "眼睛表情1");
  309. }
  310. else if (eventObject.animationState.name == "newAnimation")
  311. {
  312. AnimLock1 = false;
  313. if (TempClose != null)
  314. {
  315. ChangeClose(BodyPart.Eye, TempClose);
  316. }
  317. }
  318. }
  319. public void PlayAnim(string animName)
  320. {
  321. if (AnimLock1)
  322. {
  323. return;
  324. }
  325. UAC.anim.Play(animName);
  326. }
  327. public void SetAllCollider(bool enable)
  328. {
  329. BoxCollider2D[] colliders = GetComponentsInChildren<BoxCollider2D>();
  330. for (int i = 0; i < colliders.Length; i++)
  331. {
  332. colliders[i].enabled = enable;
  333. }
  334. }
  335. public void OnPointerClick(PointerEventData eventData)
  336. {
  337. if (ManaCenter.Level < 13)
  338. {
  339. return;
  340. }
  341. ManaReso.Get("I_BlackMask").GetTweenCG().Duration = 0.5f;
  342. ManaAudio.PlayClip(Clip.CurrentClip);
  343. EnterDressRoom();
  344. }
  345. public void Save()
  346. {
  347. ManaAudio.PlayClip(Clip.BtnClip);
  348. List<CloseUnit> closeUnitList = new List<CloseUnit>();
  349. closeUnitList.Add(ManaPlayer.CloseUnitDic[ManaPlayer.CloseIDDic[Head]]);
  350. closeUnitList.Add(ManaPlayer.CloseUnitDic[ManaPlayer.CloseIDDic[Dress]]);
  351. closeUnitList.Add(ManaPlayer.CloseUnitDic[ManaPlayer.CloseIDDic[Shoe]]);
  352. closeUnitList.Add(ManaPlayer.CloseUnitDic[ManaPlayer.CloseIDDic[HeadWear]]);
  353. closeUnitList.Add(ManaPlayer.CloseUnitDic[ManaPlayer.CloseIDDic[Top]]);
  354. for (int i = 0; i < closeUnitList.Count; i++)
  355. {
  356. if (!closeUnitList[i].Bought)
  357. {
  358. BuyNavigate(closeUnitList);
  359. return;
  360. }
  361. }
  362. ManaPlayer.DressData[0] = Head;
  363. ManaPlayer.DressData[1] = Dress;
  364. ManaPlayer.DressData[2] = Shoe;
  365. ManaPlayer.DressData[3] = HeadWear;
  366. ManaPlayer.DressData[4] = Top;
  367. ExitDressRoom();
  368. }
  369. public void Reset()
  370. {
  371. ManaAudio.PlayClip(Clip.BtnClip);
  372. List<string> dressData = new List<string>(ManaPlayer.DressData);
  373. dressData[5] = Eye;
  374. ManaPlayer.BuildPlayer(dressData);
  375. }
  376. public void BuyNavigate(List<CloseUnit> closeUnitList)
  377. {
  378. for (int i = 0; i < closeUnitList.Count; i++)
  379. {
  380. if (closeUnitList[i].Bought)
  381. {
  382. closeUnitList.RemoveAt(i--);
  383. }
  384. else
  385. {
  386. closeUnitList[i].BuyBtn.onClick.Invoke();
  387. closeUnitList.RemoveAt(i--);
  388. ManaReso.Get("Pa_Info").GetTweenCG().AddEventOnetime
  389. (
  390. EventType.BackwardFinish,
  391. () =>
  392. {
  393. BuyNavigate(closeUnitList);
  394. }
  395. );
  396. return;
  397. }
  398. }
  399. }
  400. public void ExitDressRoom()
  401. {
  402. ManaCenter.SceneSwitchLock = false;
  403. TweenRoot tweenRoot = ManaReso.Get("I_BlackMask").TweenBacCG();
  404. tweenRoot.AddEventOnetime
  405. (
  406. EventType.BackwardFinish,
  407. () =>
  408. {
  409. transform.position = ManaReso.Get("PlayerPosTra").position;
  410. transform.localScale = ManaReso.Get("PlayerPosTra").lossyScale;
  411. ManaReso.Get("Garden").TweenForSr();
  412. ManaReso.Get("DressRoom").TweenBacSr();
  413. ManaReso.Get("C_Main").TweenForCG();
  414. ManaReso.Get("P_DressRoom").TweenBacCG();
  415. }
  416. );
  417. tweenRoot = ManaReso.Get("P_DressRoom").GetTweenCG();
  418. tweenRoot.AddEventOnetime
  419. (
  420. EventType.BackwardFinish,
  421. () =>
  422. {
  423. SetAllCollider(true);
  424. InDressRoom = false;
  425. JumpTimer = 0;
  426. PlayAnim("newAnimation");
  427. ChildDic["Shadow"].GetStreamScale().Pause();
  428. ChildDic["Shadow"].GetStreamScale().InOrigin = true;
  429. ChildDic["Shadow"].SetActive(false);
  430. ManaReso.Get("I_BlackMask").TweenForCG();
  431. }
  432. );
  433. }
  434. public void EnterDressRoom()
  435. {
  436. if (ManaCenter.SceneSwitchLock)
  437. {
  438. return;
  439. }
  440. InDressRoom = true;
  441. JumpTime = Mathf.Lerp(0, JumpFrequency, Random.Range(0.5f, 1f));
  442. ManaCenter.SceneSwitchLock = true;
  443. ManaReso.Get("C_Main").TweenBacCG();
  444. SetAllCollider(false);
  445. TweenRoot tweenRoot = ManaReso.Get("I_BlackMask").TweenBacCG();
  446. tweenRoot.AddEventOnetime
  447. (
  448. EventType.BackwardFinish,
  449. () =>
  450. {
  451. for (int i = 0; i < ManaGarden.PlantList.Count; i++)
  452. {
  453. ManaGarden.PlantList[i].Flower.RetrieveElf();
  454. }
  455. ChildDic["Shadow"].SetActive(true);
  456. transform.position = ManaReso.Get("DressRoomPos").position;
  457. transform.localScale = ManaReso.Get("DressRoomPos").lossyScale;
  458. ManaReso.Get("Garden").TweenBacSr();
  459. ManaReso.Get("DressRoom").TweenForSr();
  460. ManaReso.Get("P_DressRoom").TweenForCG();
  461. }
  462. );
  463. tweenRoot = ManaReso.Get("P_DressRoom").GetTweenCG();
  464. tweenRoot.AddEventOnetime
  465. (
  466. EventType.ForwardFinish,
  467. () =>
  468. {
  469. ManaReso.Get("I_BlackMask").TweenForCG();
  470. }
  471. );
  472. }
  473. #region 换装
  474. public UnityArmatureComponent Build()
  475. {
  476. if (!ManaPlayer.Complete)
  477. {
  478. UnityFactory.factory.LoadDragonBonesData(ManaReso.Load<TextAsset>("stand_ske", Folder.Config));
  479. UnityFactory.factory.LoadDragonBonesData(ManaReso.Load<TextAsset>("Closet_ske", Folder.Config));
  480. UnityFactory.factory.LoadTextureAtlasData(ManaReso.Load<TextAsset>("stand_tex", Folder.Config), "stand_texture");
  481. UnityFactory.factory.LoadTextureAtlasData(ManaReso.Load<TextAsset>("Closet_tex", Folder.Config), "Closet_texture");
  482. ManaPlayer.Complete = true;
  483. }
  484. UAC = UnityFactory.factory.BuildArmatureComponent("Armature");
  485. UAC.transform.parent = transform;
  486. UAC.transform.localScale = new Vector3(1, 1, 1);
  487. UAC.transform.localPosition = new Vector3();
  488. UAC.anim.Play("newAnimation");
  489. UAC.AddEventListener(EventObject.START, OnStart);
  490. Eye = "眼睛1";
  491. Top = "上衣1";
  492. Shoe = "鞋子1";
  493. Head = "脑壳1";
  494. Dress = "裙子1";
  495. Mouse = "嘴巴1";
  496. HeadWear = "头饰品1";
  497. EyeSlot = UAC.armature.GetSlot("眼睛");
  498. TopSlot = UAC.armature.GetSlot("上衣");
  499. HeadSlot = UAC.armature.GetSlot("脑壳");
  500. DressSlot = UAC.armature.GetSlot("裙子");
  501. MouseSlot = UAC.armature.GetSlot("嘴巴");
  502. LeftShoeSlot = UAC.armature.GetSlot("鞋子左");
  503. RightShoeSlot = UAC.armature.GetSlot("鞋子右");
  504. HeadWearSlot = UAC.armature.GetSlot("头饰品");
  505. ChangeClose(BodyPart.Eye, "眼睛1", false);
  506. ChangeClose(BodyPart.Top, "上衣1", false);
  507. ChangeClose(BodyPart.Shoe, "鞋子1", false);
  508. ChangeClose(BodyPart.Head, "脑壳1", false);
  509. ChangeClose(BodyPart.Dress, "裙子1", false);
  510. ChangeClose(BodyPart.Mouse, "嘴巴1", false);
  511. ChangeClose(BodyPart.Headwear, "头饰品1", false);
  512. return UAC;
  513. }
  514. public UnityArmatureComponent BuildPink()
  515. {
  516. Build();
  517. ChangeClose(BodyPart.Eye, "眼睛3");
  518. ChangeClose(BodyPart.Top, "上衣3");
  519. ChangeClose(BodyPart.Shoe, "鞋子3");
  520. ChangeClose(BodyPart.Head, "脑壳3");
  521. ChangeClose(BodyPart.Dress, "裙子3");
  522. ChangeClose(BodyPart.Mouse, "嘴巴3");
  523. ChangeClose(BodyPart.Headwear, "头饰品3");
  524. return UAC;
  525. }
  526. public UnityArmatureComponent BuildBlond()
  527. {
  528. Build();
  529. ResetDepth();
  530. return UAC;
  531. }
  532. public UnityArmatureComponent BuildBrown()
  533. {
  534. Build();
  535. ChangeClose(BodyPart.Eye, "眼睛2");
  536. ChangeClose(BodyPart.Top, "上衣2");
  537. ChangeClose(BodyPart.Shoe, "鞋子2");
  538. ChangeClose(BodyPart.Head, "脑壳2");
  539. ChangeClose(BodyPart.Dress, "裙子2");
  540. ChangeClose(BodyPart.Mouse, "嘴巴2");
  541. ChangeClose(BodyPart.Headwear, "头饰品2");
  542. return UAC;
  543. }
  544. public void ResetDepth()
  545. {
  546. UAC.transform.SetLZ(2);
  547. transform.FindChild("Armature/" + Eye).SetLZ(-0.001f);
  548. transform.FindChild("Armature/" + Top).SetLZ(-0.003f);
  549. transform.FindChild("Armature/" + Head).SetLZ(0);
  550. transform.FindChild("Armature/" + Dress).SetLZ(-0.002f);
  551. transform.FindChild("Armature/" + Mouse).SetLZ(-0.001f);
  552. transform.FindChild("Armature/" + HeadWear).SetLZ(-0.001f);
  553. Transform shoeTra = transform.FindChild("Armature/" + Shoe);
  554. shoeTra.SetLZ(-0.001f);
  555. transform.FindChild("Armature").GetChild(shoeTra.GetSiblingIndex() + 1).SetLZ(-0.001f);
  556. transform.FindChild("Armature/左腿").SetLZ(0);
  557. transform.FindChild("Armature/右腿").SetLZ(0);
  558. transform.FindChild("Armature/脖子").SetLZ(0);
  559. transform.FindChild("Armature/左手").SetLZ(-0.001f);
  560. transform.FindChild("Armature/右手").SetLZ(-0.001f);
  561. }
  562. public void ChangeClose(BodyPart bodyPart, string armatureName, bool setDepth = true)
  563. {
  564. List<DragonBones.Slot> slotList = new List<DragonBones.Slot>();
  565. if (bodyPart == BodyPart.Eye)
  566. {
  567. Eye = armatureName;
  568. slotList.Add(EyeSlot);
  569. }
  570. else if (bodyPart == BodyPart.Top)
  571. {
  572. Top = armatureName;
  573. slotList.Add(TopSlot);
  574. }
  575. else if (bodyPart == BodyPart.Shoe)
  576. {
  577. Shoe = armatureName;
  578. slotList.Add(LeftShoeSlot);
  579. slotList.Add(RightShoeSlot);
  580. }
  581. else if (bodyPart == BodyPart.Head)
  582. {
  583. Head = armatureName;
  584. slotList.Add(HeadSlot);
  585. }
  586. else if (bodyPart == BodyPart.Dress)
  587. {
  588. Dress = armatureName;
  589. slotList.Add(DressSlot);
  590. }
  591. else if (bodyPart == BodyPart.Mouse)
  592. {
  593. Mouse = armatureName;
  594. slotList.Add(MouseSlot);
  595. }
  596. else if (bodyPart == BodyPart.Headwear)
  597. {
  598. HeadWear = armatureName;
  599. slotList.Add(HeadWearSlot);
  600. }
  601. else
  602. {
  603. throw new Exception();
  604. }
  605. ChangeClose(slotList, armatureName, setDepth);
  606. }
  607. public void ChangeClose(List<DragonBones.Slot> slotList, string armatureName, bool setDepth = true)
  608. {
  609. for (int i = 0; i < slotList.Count; i++)
  610. {
  611. slotList[i].childArmature = UnityFactory.factory.BuildArmature(armatureName);
  612. }
  613. if (setDepth)
  614. {
  615. ResetDepth();
  616. }
  617. }
  618. #endregion
  619. }