Player.cs 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427
  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 Animation = DragonBones.Animation;
  11. using Slot = DragonBones.Slot;
  12. using Random = UnityEngine.Random;
  13. using Transform = UnityEngine.Transform;
  14. public enum BodyPart
  15. {
  16. Leg = 0,
  17. LeftHand = 1,
  18. RightHand = 2,
  19. LeftLongSleeve = 3,
  20. LeftShortSleeve = 4,
  21. RightLongSleeve = 5,
  22. RightShortSleeve = 6,
  23. Neck = 7,
  24. Eye = 8,
  25. Top = 9,
  26. Shoe = 10,
  27. Head = 11,
  28. Wing = 12,
  29. Dress = 13,
  30. Mouse = 14,
  31. Headwear = 15,
  32. }
  33. public class CloseUnit
  34. {
  35. public enum CloseType
  36. {
  37. Top,
  38. Hair,
  39. Wing,
  40. Dress,
  41. Decarator,
  42. Shoe,
  43. }
  44. #region Var
  45. public string Name
  46. {
  47. get { return Language.GetStr("DressRoom", "Armature" + ID); }
  48. }
  49. public int ID;
  50. public int Index;
  51. public int BuyLevel;
  52. public int PixelSize;
  53. public bool Bought;
  54. public string ArmatureName;
  55. public string[] ExtraArmatureNames;
  56. public BodyPart[] ExtraBodyParts;
  57. public float SpriteAlpha;
  58. public float IconOffset;
  59. public Text BuyBtnLab;
  60. public Sprite[] Sprites;
  61. public Image Icon1;
  62. public Image Icon2;
  63. public Image Icon3;
  64. public Button BuyBtn;
  65. public Button DressBtn;
  66. public Vector2 IconOffset1;
  67. public Vector2 IconOffset2;
  68. public BodyPart BodyPart;
  69. public Transform Transform;
  70. public CloseType Type;
  71. public bool Ignore;
  72. public double BuyAmt;
  73. public double BuyAdvanceAmt;
  74. public Current BuyCurrent;
  75. public Current BuyAdvanceCurrent;
  76. public Dictionary<string, Transform> ChildDic = new Dictionary<string, Transform>();
  77. #endregion
  78. public CloseUnit(XmlAttributeCollection attribute)
  79. {
  80. Ignore = Auxiliary.BoolParse(attribute[19].Value, false);
  81. ID = Auxiliary.IntParse(attribute[0].Value, -1);
  82. BodyPart = BodyPartParse(attribute[4].Value);
  83. ArmatureName = attribute[16].Value;
  84. ManaPlayer.CloseIDDic.Add(ArmatureName, ID);
  85. ManaPlayer.CloseUnitDic.Add(ID, this);
  86. if (Ignore)
  87. {
  88. return;
  89. }
  90. Type = TypeParse(attribute[2].Value);
  91. Index = Auxiliary.IntParse(attribute[3].Value, -1);
  92. BuyLevel = Auxiliary.IntParse(attribute[5].Value, 0);
  93. BuyCurrent = Auxiliary.CurrentParse(attribute[6].Value);
  94. BuyAmt = Auxiliary.DoubleParse(attribute[7].Value, 0);
  95. BuyAdvanceCurrent = Auxiliary.CurrentParse(attribute[8].Value);
  96. BuyAdvanceAmt = Auxiliary.DoubleParse(attribute[9].Value, 0);
  97. PixelSize = Auxiliary.IntParse(attribute[10].Value, 100);
  98. IconOffset = Auxiliary.FloatParse(attribute[11].Value, 0);
  99. IconOffset1 = Auxiliary.VectorParse(',', attribute[12].Value, new Vector3());
  100. IconOffset2 = Auxiliary.VectorParse(',', attribute[13].Value, new Vector3());
  101. Sprites = SpriteParse(attribute[14].Value);
  102. SpriteAlpha = Auxiliary.FloatParse(attribute[15].Value, 1);
  103. ExtraBodyParts = BodyPartParses(attribute[17].Value);
  104. ExtraArmatureNames = Auxiliary.StringListParse(',', attribute[18].Value, new List<string>()).ToArray();
  105. CreateItem();
  106. }
  107. protected void CreateItem()
  108. {
  109. Transform = ManaReso.Get("CloseItem", Folder.UI, false, ManaReso.Get("Canvas"), false);
  110. if (Type == CloseType.Top)
  111. {
  112. Transform.SetParent(ManaReso.Get("Pb_TopGrid"));
  113. }
  114. else if (Type == CloseType.Hair)
  115. {
  116. Transform.SetParent(ManaReso.Get("Pa_HairGrid"));
  117. }
  118. else if (Type == CloseType.Dress)
  119. {
  120. Transform.SetParent(ManaReso.Get("Pc_DressGrid"));
  121. }
  122. else if (Type == CloseType.Wing)
  123. {
  124. Transform.SetParent(ManaReso.Get("Pe_WingGrid"));
  125. }
  126. else if (Type == CloseType.Decarator)
  127. {
  128. Transform.SetParent(ManaReso.Get("Pd_DecaratorGrid"));
  129. }
  130. else if (Type == CloseType.Shoe)
  131. {
  132. Transform.SetParent(ManaReso.Get("Pf_ShoeGrid"));
  133. }
  134. else
  135. {
  136. throw new Exception();
  137. }
  138. Transform.SetSiblingIndex(Index);
  139. Auxiliary.CompileDic(Transform, ChildDic);
  140. Icon1 = ChildDic["Icon1"].GetComponent<Image>();
  141. Icon2 = ChildDic["Icon2"].GetComponent<Image>();
  142. Icon3 = ChildDic["Icon3"].GetComponent<Image>();
  143. DressBtn = ChildDic["CloseItem"].GetComponent<Button>();
  144. BuyBtn = ChildDic["BuyBtn"].GetComponent<Button>();
  145. BuyBtnLab = ChildDic["BuyBtnLab"].GetComponent<Text>();
  146. BuyBtnLab.GetComponent<TextPlus>().SetY = true;
  147. float newSize = PixelSize / Sprites[0].rect.width;
  148. SetUpUI(newSize, new Vector2(), Icon1, Icon2, Icon3);
  149. if (BuyCurrent != Current.Free)
  150. {
  151. BuyBtnLab.text = Auxiliary.ImageParse(BuyCurrent) + Auxiliary.ShrinkNumberStr(BuyAmt);
  152. }
  153. if (BuyLevel > ManaCenter.Level)
  154. {
  155. BuyBtn.interactable = false;
  156. BuyBtn.image.material = Lib.GrayMat;
  157. }
  158. BuyBtn.onClick.AddListener
  159. (
  160. () =>
  161. {
  162. ManaAudio.PlayClip(Clip.BtnClip);
  163. ManaReso.Get("Pa_Info").TweenForCG();
  164. SetUpUI(newSize, new Vector2(0, 22), ManaReso.Get<Image>("Pa_Icon1"), ManaReso.Get<Image>("Pa_Icon3"), ManaReso.Get<Image>("Pa_Icon2"));
  165. ManaReso.SetText("Pa_Lab", Name);
  166. ManaReso.SetText("Pa_BtnLab", Language.GetStr("UI", "Pa_BtnLab") + Auxiliary.ImageParse(BuyCurrent) + BuyAmt);
  167. ManaReso.SetButtonEvent
  168. (
  169. "Pa_Btn",
  170. OnBuy
  171. );
  172. }
  173. );
  174. DressBtn.onClick.AddListener
  175. (
  176. () =>
  177. {
  178. ManaAudio.PlayClip(Clip.BtnClip);
  179. if (BuyLevel > ManaCenter.Level)
  180. {
  181. Bubble.Show(null, Language.GetStr("UI", "P_Unlock"));
  182. return;
  183. }
  184. ChangeDress(ManaPlayer.Player);
  185. }
  186. );
  187. }
  188. protected Sprite[] SpriteParse(string str)
  189. {
  190. string[] spriteNames = str.Split(',');
  191. Sprite[] sprites = new Sprite[spriteNames.Length];
  192. for (int i = 0; i < spriteNames.Length; i++)
  193. {
  194. if (!ManaPlayer.CloseSpriteDic.ContainsKey(spriteNames[i]))
  195. {
  196. Debug.Log(spriteNames[i]);
  197. }
  198. sprites[i] = ManaPlayer.CloseSpriteDic[spriteNames[i]];
  199. }
  200. return sprites;
  201. }
  202. protected BodyPart BodyPartParse(string str)
  203. {
  204. int type = Auxiliary.IntParse(str, -1);
  205. if (type == 1)
  206. {
  207. return BodyPart.Head;
  208. }
  209. else if (type == 2)
  210. {
  211. return BodyPart.Dress;
  212. }
  213. else if (type == 3)
  214. {
  215. return BodyPart.Shoe;
  216. }
  217. else if (type == 4)
  218. {
  219. return BodyPart.Headwear;
  220. }
  221. else if (type == 5)
  222. {
  223. return BodyPart.Top;
  224. }
  225. else if (type == 6)
  226. {
  227. return BodyPart.Wing;
  228. }
  229. else if (type == 7)
  230. {
  231. return BodyPart.LeftLongSleeve;
  232. }
  233. else if (type == 8)
  234. {
  235. return BodyPart.RightLongSleeve;
  236. }
  237. else if (type == 9)
  238. {
  239. return BodyPart.LeftShortSleeve;
  240. }
  241. else if (type == 10)
  242. {
  243. return BodyPart.RightShortSleeve;
  244. }
  245. else if (type == 11)
  246. {
  247. return BodyPart.Eye;
  248. }
  249. else if (type == 12)
  250. {
  251. return BodyPart.Mouse;
  252. }
  253. else
  254. {
  255. throw new Exception();
  256. }
  257. }
  258. protected BodyPart[] BodyPartParses(string str)
  259. {
  260. List<string> typeIDs = Auxiliary.StringListParse(',', str, new List<string>());
  261. BodyPart[] bodyParts = new BodyPart[typeIDs.Count];
  262. for (int i = 0; i < typeIDs.Count; i++)
  263. {
  264. bodyParts[i] = BodyPartParse(typeIDs[i]);
  265. }
  266. return bodyParts;
  267. }
  268. protected CloseType TypeParse(string str)
  269. {
  270. int type = Auxiliary.IntParse(str, -1);
  271. if (type == 1)
  272. {
  273. return CloseType.Hair;
  274. }
  275. else if (type == 2)
  276. {
  277. return CloseType.Top;
  278. }
  279. else if (type == 3)
  280. {
  281. return CloseType.Dress;
  282. }
  283. else if (type == 4)
  284. {
  285. return CloseType.Decarator;
  286. }
  287. else if (type == 5)
  288. {
  289. return CloseType.Wing;
  290. }
  291. else if (type == 6)
  292. {
  293. return CloseType.Shoe;
  294. }
  295. else
  296. {
  297. throw new Exception();
  298. }
  299. }
  300. public void SetUpUI(float newSize, Vector2 offset, Image icon1, Image icon2, Image icon3)
  301. {
  302. icon1.SetActive(false);
  303. icon3.SetActive(false);
  304. icon2.SetActive(true);
  305. icon2.sprite = Sprites[0];
  306. icon2.Resize(true, new Vector2(newSize, newSize));
  307. icon2.SetAlpha(SpriteAlpha);
  308. icon2.transform.localPosition = offset + new Vector2(0, IconOffset);
  309. if (Sprites.Length >= 2)
  310. {
  311. icon1.SetActive(true);
  312. icon1.sprite = Sprites[1];
  313. icon1.Resize(true, new Vector2(newSize, newSize));
  314. icon1.SetAlpha(SpriteAlpha);
  315. icon1.transform.localPosition = IconOffset1 * newSize + offset + new Vector2(0, IconOffset);
  316. }
  317. if (Sprites.Length >= 3)
  318. {
  319. icon3.SetActive(true);
  320. icon3.sprite = Sprites[2];
  321. icon3.Resize(true, new Vector2(newSize, newSize));
  322. icon3.SetAlpha(SpriteAlpha);
  323. icon3.transform.localPosition = IconOffset2 * newSize + offset + new Vector2(0, IconOffset);
  324. }
  325. }
  326. public void Unlock()
  327. {
  328. if (Ignore)
  329. {
  330. return;
  331. }
  332. Bought = true;
  333. BuyBtn.interactable = false;
  334. BuyBtn.image.material = Lib.GrayMat;
  335. BuyBtnLab.text = Language.GetStr("UI", "P_BtnLab2");
  336. ManaCenter.CloseAmt++;
  337. }
  338. public void OnBuy()
  339. {
  340. ManaCenter.Pay
  341. (
  342. "",
  343. BuyAmt,
  344. BuyCurrent,
  345. () =>
  346. {
  347. Unlock();
  348. ManaAudio.PlayClip(Clip.CurrentClip);
  349. ManaPlayer.BoughtCloseList.UniqueAdd(ID);
  350. ManaReso.Get("Pa_Info").TweenBacCG();
  351. ManaServer.Save();
  352. },
  353. StaticsManager.ItemID.解锁服装,
  354. StaticsManager.ConsumeModule.Shop,
  355. true,
  356. false,
  357. () =>
  358. {
  359. ManaPlayer.Player.Reset();
  360. TweenRoot tweenRoot = ManaReso.Get("Pa_Info").TweenBacCG();
  361. tweenRoot.AddEventOnetime
  362. (
  363. EventType.BackwardFinish,
  364. () =>
  365. {
  366. ManaPlayer.Player.Return();
  367. }
  368. );
  369. ManaReso.Get("B_SignIn0").GetTweenCG().AddEventOnetime
  370. (
  371. EventType.ForwardFinish,
  372. () =>
  373. {
  374. ManaReso.Get("F_Manage0").TweenForVec();
  375. }
  376. );
  377. }
  378. );
  379. }
  380. public void ChangeDress(Player player)
  381. {
  382. player.ChangeClose(BodyPart, ArmatureName);
  383. if (Ignore)
  384. {
  385. return;
  386. }
  387. if (ExtraBodyParts.Length > 0)
  388. {
  389. player.ChangeClose(BodyPart.LeftLongSleeve, "Empty");
  390. player.ChangeClose(BodyPart.LeftShortSleeve, "Empty");
  391. player.ChangeClose(BodyPart.RightLongSleeve, "Empty");
  392. player.ChangeClose(BodyPart.RightShortSleeve, "Empty");
  393. }
  394. for (int i = 0; i < ExtraArmatureNames.Length; i++)
  395. {
  396. player.ChangeClose(ExtraBodyParts[i], ExtraArmatureNames[i]);
  397. }
  398. }
  399. public void OnLevelChange()
  400. {
  401. if (Ignore)
  402. {
  403. return;
  404. }
  405. if (Bought)
  406. {
  407. return;
  408. }
  409. if (BuyLevel < ManaCenter.Level)
  410. {
  411. BuyBtn.interactable = true;
  412. BuyBtn.image.material = null;
  413. }
  414. }
  415. }
  416. public enum PlayerDirection
  417. {
  418. Left = 0,
  419. Right = 1,
  420. }
  421. public class Player : Regist , IPointerClickHandler
  422. {
  423. #region 变量
  424. public static string IdleAnimationName = "newAnimation";
  425. public static string JumpAnimationName = "newAnimation1";
  426. public static string WalkAnimationName = "newAnimation2";
  427. public static string RunAnimationName = "newAnimation3";
  428. public static bool InDressRoom;
  429. public static float JumpFrequency;
  430. public PlayerDirection PlayerDirection
  431. {
  432. get { return playerDirection; }
  433. set
  434. {
  435. playerDirection = value;
  436. Flip(playerDirection);
  437. }
  438. }
  439. private PlayerDirection playerDirection = PlayerDirection.Left;
  440. public bool AnimLock1;
  441. public bool AnimLock2;
  442. public float JumpTime;
  443. public float JumpTimer;
  444. public SpriteRenderer ExpressionSr;
  445. public Dictionary<string, Transform> ChildDic = new Dictionary<string, Transform>();
  446. public static Dictionary<string, Vector3> LeftExpressionPositionDictionary = new Dictionary<string, Vector3>
  447. {
  448. {"郁闷", new Vector3(0, -0.22f, -0.001f)},
  449. {"汗颜", new Vector3(0.35f, 0.91f, -0.001f)},
  450. {"惊讶", new Vector3(0.09f, -0.07f, -0.001f)},
  451. {"开心", new Vector3(0.1f, -0.22f, -0.001f)},
  452. {"哭", new Vector3(0.07f, -0.64f, -0.001f)},
  453. {"期待", new Vector3(0.04f, -0.20f, -0.001f)},
  454. {"色咪咪", new Vector3(0.03f, -0.09f, -0.001f)},
  455. {"委屈", new Vector3(0f, -0.27f, -0.001f)},
  456. };
  457. public static Dictionary<string, Vector3> RightExpressionPositionDictionary = new Dictionary<string, Vector3>
  458. {
  459. {"郁闷", new Vector3(0, -0.22f, -0.001f)},
  460. {"汗颜", new Vector3(-0.22f, 0.91f, -0.001f)},
  461. {"惊讶", new Vector3(-0.09f, -0.07f, -0.001f)},
  462. {"开心", new Vector3(-0.1f, -0.22f, -0.001f)},
  463. {"哭", new Vector3(-0.07f, -0.64f, -0.001f)},
  464. {"期待", new Vector3(-0.04f, -0.20f, -0.001f)},
  465. {"色咪咪", new Vector3(-0.03f, -0.09f, -0.001f)},
  466. {"委屈", new Vector3(0f, -0.27f, -0.001f)},
  467. };
  468. #region 换装
  469. public string Eye;
  470. public string Top;
  471. public string Shoe;
  472. public string Head;
  473. public string Wing;
  474. public string Dress;
  475. public string Mouse;
  476. public string HeadWear;
  477. public string LeftLongSleeve;
  478. public string LeftShortSleeve;
  479. public string RightLongSleeve;
  480. public string RightShortSleeve;
  481. private string TempClose;
  482. public DragonBones.Slot NeckSlot;
  483. public DragonBones.Slot LeftHandSlot;
  484. public DragonBones.Slot RightHandSlot;
  485. public DragonBones.Slot LeftLegSlot;
  486. public DragonBones.Slot RightLegSlot;
  487. public DragonBones.Slot LeftShortSleeveSlot;
  488. public DragonBones.Slot RightShortSleeveSlot;
  489. public DragonBones.Slot EyeSlot;
  490. public DragonBones.Slot TopSlot;
  491. public DragonBones.Slot HeadSlot;
  492. public DragonBones.Slot DressSlot;
  493. public DragonBones.Slot WingSlot;
  494. public DragonBones.Slot MouseSlot;
  495. public DragonBones.Slot LeftShoeSlot;
  496. public DragonBones.Slot RightShoeSlot;
  497. public DragonBones.Slot HeadWearSlot;
  498. public UnityArmatureComponent UAC;
  499. public UnityArmatureComponent LeftLongSleeveUAC;
  500. public UnityArmatureComponent RightLongSleeveUAC;
  501. #endregion
  502. #endregion
  503. public override bool RegistImmed()
  504. {
  505. if (base.RegistImmed())
  506. {
  507. return true;
  508. }
  509. enabled = true;
  510. Auxiliary.CompileDic(transform, ChildDic);
  511. Vector3 bigShadowScale = new Vector3(1.820952f, 2.418199f, 1.820952f);
  512. Vector3 smallShadowScale = new Vector3(1.081191f, 1.435807f, 1.081191f);
  513. ChildDic["Shadow"].CreateStreamScale
  514. (
  515. new List<float>() {0, 0, 0},
  516. new List<float>() {0.33f, 0.33f, 0.33f, 0.33f},
  517. new List<VecPair>() {new VecPair(bigShadowScale, smallShadowScale), new VecPair(smallShadowScale, bigShadowScale), new VecPair(bigShadowScale, smallShadowScale), new VecPair(smallShadowScale, bigShadowScale)},
  518. true,
  519. true,
  520. Curve.EaseOutQuad
  521. );
  522. ExpressionSr = ChildDic["ExpressionSr"].GetComponent<SpriteRenderer>();
  523. return false;
  524. }
  525. public void Update()
  526. {
  527. if (InDressRoom)
  528. {
  529. JumpTimer += Time.deltaTime;
  530. if (JumpTimer > JumpTime)
  531. {
  532. if (!AnimLock1 && !AnimLock2)
  533. {
  534. PlayAnim(JumpAnimationName);
  535. }
  536. AnimLock2 = true;
  537. }
  538. if (JumpTimer > JumpFrequency)
  539. {
  540. AnimLock2 = false;
  541. JumpTime = Mathf.Lerp(0, JumpFrequency, Random.Range(0f, 1f));
  542. JumpTimer = 0;
  543. }
  544. }
  545. //if (GardenSmartFoxManager.GardenSmartFox.PlazaRoomManager.InPlazaRoom)
  546. //{
  547. // MoveThread();
  548. //}
  549. }
  550. public void OnStart(string str, EventObject eventObject)
  551. {
  552. if (eventObject.animationState.name == JumpAnimationName)
  553. {
  554. ChildDic["Shadow"].StreamReForScale();
  555. AnimLock1 = true;
  556. TempClose = Eye;
  557. ChangeClose(BodyPart.Eye, "眼睛表情1");
  558. }
  559. else if (eventObject.animationState.name == IdleAnimationName)
  560. {
  561. AnimLock1 = false;
  562. if (TempClose != null)
  563. {
  564. ChangeClose(BodyPart.Eye, TempClose);
  565. }
  566. }
  567. }
  568. public string CurrentAnimationName;
  569. public void PlayAnim(string animName)
  570. {
  571. if (AnimLock1)
  572. {
  573. return;
  574. }
  575. if (UAC.anim.lastAnimationName == animName)
  576. {
  577. return;
  578. }
  579. if (GardenSmartFoxManager.GardenSmartFox.SFSPlazaRoomManager.InPlazaRoom)
  580. {
  581. CurrentAnimationName = animName;
  582. }
  583. UAC.anim.FadeIn(animName, GetFadeInTime(UAC.anim.lastAnimationName, animName));
  584. }
  585. public float GetFadeInTime(string lastAnimation, string targetAnimation)
  586. {
  587. if (lastAnimation == JumpAnimationName && targetAnimation == IdleAnimationName)
  588. return -1f;
  589. else
  590. return 0.1f;
  591. //throw new Exception();
  592. }
  593. public void SetAllCollider(bool enable)
  594. {
  595. BoxCollider2D[] colliders = GetComponentsInChildren<BoxCollider2D>();
  596. for (int i = 0; i < colliders.Length; i++)
  597. {
  598. colliders[i].enabled = enable;
  599. }
  600. }
  601. public void OnPointerClick(PointerEventData eventData)
  602. {
  603. ManaAudio.PlayClip(Clip.CurrentClip);
  604. ManaNickName.ShowNickNameSettingPanel();
  605. PlayAnim(JumpAnimationName);
  606. }
  607. public void ResetExpression()
  608. {
  609. ExpressionSr.SetActive(false);
  610. EyeSlot.UnityTransform.GetChild(0).SetActive(true);
  611. MouseSlot.UnityTransform.GetChild(0).SetActive(true);
  612. }
  613. private string ExpressionName;
  614. private Coroutine ResetExpressionCoroutine;
  615. public void ChangeExpression(string expressionName, float duration)
  616. {
  617. ExpressionName = expressionName;
  618. ExpressionSr.sprite = ManaReso.LoadSprite(expressionName, Folder.Scene);
  619. ExpressionSr.transform.parent = EyeSlot.UnityTransform;
  620. ExpressionSr.SetActive(true);
  621. EyeSlot.UnityTransform.GetChild(0).SetActive(false);
  622. MouseSlot.UnityTransform.GetChild(0).SetActive(false);
  623. FlipExpression(expressionName, PlayerDirection);
  624. if (ResetExpressionCoroutine != null)
  625. Auxiliary.Instance.StopCoroutine(ResetExpressionCoroutine);
  626. ResetExpressionCoroutine = Auxiliary.Instance.DelayCall
  627. (
  628. () =>
  629. {
  630. ResetExpression();
  631. },
  632. duration
  633. );
  634. }
  635. public void Flip(PlayerDirection direction)
  636. {
  637. FlipExpression(ExpressionName, direction);
  638. if (direction == PlayerDirection.Left)
  639. {
  640. UAC.armature.flipX = false;
  641. playerDirection = PlayerDirection.Left;
  642. }
  643. else if (direction == PlayerDirection.Right)
  644. {
  645. UAC.armature.flipX = true;
  646. playerDirection = PlayerDirection.Right;
  647. }
  648. else
  649. {
  650. throw new Exception();
  651. }
  652. }
  653. public void FlipExpression(string expressionName, PlayerDirection direction)
  654. {
  655. if (string.IsNullOrEmpty(ExpressionName))
  656. {
  657. return;
  658. }
  659. if (direction == PlayerDirection.Left)
  660. {
  661. ExpressionSr.flipX = false;
  662. ExpressionSr.transform.localPosition = LeftExpressionPositionDictionary[ExpressionName];
  663. }
  664. else if (direction == PlayerDirection.Right)
  665. {
  666. UAC.armature.flipX = true;
  667. ExpressionSr.flipX = true;
  668. ExpressionSr.transform.localPosition = RightExpressionPositionDictionary[ExpressionName];
  669. playerDirection = PlayerDirection.Right;
  670. }
  671. else
  672. {
  673. throw new Exception();
  674. }
  675. }
  676. public void Save(bool showNavigate)
  677. {
  678. ManaAudio.PlayClip(Clip.BtnClip);
  679. List<CloseUnit> closeUnitList = new List<CloseUnit>();
  680. closeUnitList.Add(ManaPlayer.CloseUnitDic[ManaPlayer.CloseIDDic[Head]]);
  681. closeUnitList.Add(ManaPlayer.CloseUnitDic[ManaPlayer.CloseIDDic[Dress]]);
  682. closeUnitList.Add(ManaPlayer.CloseUnitDic[ManaPlayer.CloseIDDic[Shoe]]);
  683. closeUnitList.Add(ManaPlayer.CloseUnitDic[ManaPlayer.CloseIDDic[HeadWear]]);
  684. closeUnitList.Add(ManaPlayer.CloseUnitDic[ManaPlayer.CloseIDDic[Top]]);
  685. if (Wing != "Empty")
  686. {
  687. closeUnitList.Add(ManaPlayer.CloseUnitDic[ManaPlayer.CloseIDDic[Wing]]);
  688. }
  689. for (int i = 0; i < closeUnitList.Count; i++)
  690. {
  691. if (!closeUnitList[i].Bought)
  692. {
  693. if (showNavigate)
  694. {
  695. BuyNavigate(closeUnitList);
  696. }
  697. return;
  698. }
  699. }
  700. ManaPlayer.DressData[0] = Head;
  701. ManaPlayer.DressData[1] = Dress;
  702. ManaPlayer.DressData[2] = Shoe;
  703. ManaPlayer.DressData[3] = HeadWear;
  704. ManaPlayer.DressData[4] = Top;
  705. ManaPlayer.DressData[7] = Wing;
  706. ManaPlayer.DressData[8] = LeftLongSleeve;
  707. ManaPlayer.DressData[9] = LeftShortSleeve;
  708. ManaPlayer.DressData[10] = RightLongSleeve;
  709. ManaPlayer.DressData[11] = RightShortSleeve;
  710. //GardenSmartFoxManager.GardenSmartFox.PlazaRoomManager.SyncClose();
  711. }
  712. public void Reset()
  713. {
  714. ManaAudio.PlayClip(Clip.BtnClip);
  715. List<string> dressData = new List<string>(ManaPlayer.DressData);
  716. dressData[5] = Eye;
  717. ManaPlayer.BuildPlayer(dressData);
  718. }
  719. public void Return()
  720. {
  721. bool allSave = true;
  722. bool allBought = true;
  723. List<string> currentDerssData = new List<string>() {Head, Dress, Shoe, HeadWear, Top, Wing};
  724. for (int i = 0; i < currentDerssData.Count; i++)
  725. {
  726. if (!ManaPlayer.CloseIDDic.ContainsKey(currentDerssData[i]))
  727. {
  728. continue;
  729. }
  730. int id = ManaPlayer.CloseIDDic[currentDerssData[i]];
  731. allBought = allBought && ManaPlayer.CloseUnitDic[id].Bought;
  732. //Debug.Log(ManaPlayer.CloseUnitDic[id].Name + " " + ManaPlayer.CloseUnitDic[id].Bought);
  733. allSave = allSave && currentDerssData[i] == ManaPlayer.DressData[i];
  734. }
  735. if (allBought)
  736. {
  737. if (allSave)
  738. {
  739. ExitDressRoom();
  740. }
  741. else
  742. {
  743. Reset();
  744. ExitDressRoom();
  745. }
  746. }
  747. else
  748. {
  749. Bubble.Show
  750. (
  751. null, Language.GetStr("UI", "P_Return"), null, null,
  752. () =>
  753. {
  754. Reset();
  755. ManaReso.Get("K_Bubble").GetTweenGra().AddEventOnetime(EventType.BackwardFinish, () => { ExitDressRoom(); });
  756. }
  757. );
  758. }
  759. }
  760. public void BuyNavigate(List<CloseUnit> closeUnitList)
  761. {
  762. for (int i = 0; i < closeUnitList.Count; i++)
  763. {
  764. if (closeUnitList[i].Bought)
  765. {
  766. closeUnitList.RemoveAt(i--);
  767. }
  768. else
  769. {
  770. closeUnitList[i].BuyBtn.onClick.Invoke();
  771. closeUnitList.RemoveAt(i--);
  772. ManaReso.Get("Pa_Info").GetTweenCG().AddEventOnetime
  773. (
  774. EventType.BackwardFinish,
  775. () =>
  776. {
  777. if (closeUnitList.Count == 0)
  778. {
  779. Save(false);
  780. }
  781. else
  782. {
  783. BuyNavigate(closeUnitList);
  784. }
  785. }
  786. );
  787. return;
  788. }
  789. }
  790. }
  791. public void ExitDressRoom()
  792. {
  793. ManaCenter.SceneSwitchLock = false;
  794. TweenRoot tweenRoot = ManaReso.Get("I_BlackMask").TweenBacCG();
  795. tweenRoot.AddEventOnetime
  796. (
  797. EventType.BackwardFinish,
  798. () =>
  799. {
  800. transform.SetParent(ManaReso.Get("GardenNormal"));
  801. transform.position = ManaReso.Get("PlayerPosTra").position;
  802. transform.localScale = ManaReso.Get("PlayerPosTra").lossyScale;
  803. ManaReso.Get("Garden").TweenForSr();
  804. ManaReso.Get("DressRoom").TweenBacSr();
  805. ManaReso.Get("C_Main").TweenForCG();
  806. ManaReso.Get("P_DressRoom").TweenBacCG();
  807. }
  808. );
  809. tweenRoot = ManaReso.Get("P_DressRoom").GetTweenCG();
  810. tweenRoot.AddEventOnetime
  811. (
  812. EventType.BackwardFinish,
  813. () =>
  814. {
  815. SetAllCollider(true);
  816. InDressRoom = false;
  817. JumpTimer = 0;
  818. PlayAnim(IdleAnimationName);
  819. ChildDic["Shadow"].GetStreamScale().Pause();
  820. ChildDic["Shadow"].GetStreamScale().InOrigin = true;
  821. ChildDic["ShadowParent"].SetActive(false);
  822. ManaReso.Get("B_SignIn0").TweenForCG();
  823. ManaReso.Get("I_BlackMask").TweenForCG();
  824. }
  825. );
  826. }
  827. public void EnterDressRoom()
  828. {
  829. if (ManaCenter.SceneSwitchLock)
  830. {
  831. return;
  832. }
  833. ManaReso.Get("B_SignIn0").TweenBacCG();
  834. InDressRoom = true;
  835. JumpTime = Mathf.Lerp(0, 10, Random.Range(0.5f, 1f));
  836. ManaCenter.SceneSwitchLock = true;
  837. ManaReso.Get("C_Main").TweenBacCG();
  838. SetAllCollider(false);
  839. TweenRoot tweenRoot = ManaReso.Get("I_BlackMask").TweenBacCG();
  840. tweenRoot.AddEventOnetime
  841. (
  842. EventType.BackwardFinish,
  843. () =>
  844. {
  845. ManaGarden.RetrieveAllElf();
  846. ChildDic["ShadowParent"].SetActive(true);
  847. ChildDic["ShadowParent"].SetLZ(3);
  848. transform.SetParent(ManaReso.Get("DressRoom"));
  849. transform.position = ManaReso.Get("DressRoomPos").position;
  850. transform.localScale = ManaReso.Get("DressRoomPos").lossyScale;
  851. ManaReso.Get("Garden").TweenBacSr();
  852. ManaReso.Get("DressRoom").TweenForSr();
  853. ManaReso.Get("P_DressRoom").TweenForCG();
  854. }
  855. );
  856. tweenRoot = ManaReso.Get("P_DressRoom").GetTweenCG();
  857. tweenRoot.AddEventOnetime
  858. (
  859. EventType.ForwardFinish,
  860. () =>
  861. {
  862. ManaReso.Get("I_BlackMask").TweenForCG();
  863. }
  864. );
  865. }
  866. #region 换装
  867. public void CorrectPivot()
  868. {
  869. List<Transform> children = new List<Transform>();
  870. while (transform.childCount > 0)
  871. {
  872. children.Add(transform.GetChild(0));
  873. children.Back(0).parent = null;
  874. }
  875. Vector3 offset = UAC.transform.FindChild("Pivot").position - transform.position;
  876. children[0].position += offset;
  877. children[1].position += offset;
  878. transform.position += offset;
  879. for (int i = 0; i < children.Count; i++)
  880. {
  881. children[i].parent = transform;
  882. }
  883. }
  884. public UnityArmatureComponent Build()
  885. {
  886. if (!ManaPlayer.Complete)
  887. {
  888. UnityFactory.factory.LoadDragonBonesData(ManaReso.Load<TextAsset>("stand_ske", Folder.Config));
  889. UnityFactory.factory.LoadTextureAtlasData(ManaReso.Load<TextAsset>("stand_tex", Folder.Config), "stand_texture");
  890. ManaPlayer.Complete = true;
  891. }
  892. UAC = UnityFactory.factory.BuildArmatureComponent("Armature");
  893. UAC.transform.parent = transform;
  894. UAC.transform.localScale = new Vector3(1, 1, 1);
  895. UAC.transform.localPosition = new Vector3();
  896. UAC.anim.Play(IdleAnimationName);
  897. UAC.AddEventListener(EventObject.START, OnStart);
  898. Eye = "眼睛1";
  899. Top = "上衣1";
  900. Shoe = "鞋子1";
  901. Head = "脑壳1";
  902. Wing = "Empty";
  903. Dress = "裙子1";
  904. Mouse = "嘴巴1";
  905. HeadWear = "头饰品1";
  906. NeckSlot = UAC.armature.GetSlot("脖子");
  907. LeftHandSlot = UAC.armature.GetSlot("左手");
  908. RightHandSlot = UAC.armature.GetSlot("右手");
  909. LeftLegSlot = UAC.armature.GetSlot("左腿");
  910. RightLegSlot = UAC.armature.GetSlot("右腿");
  911. LeftLongSleeveUAC = UAC.transform.FindChild("长袖9左 (长袖9左)").GetComponent<UnityArmatureComponent>();
  912. RightLongSleeveUAC = UAC.transform.FindChild("长袖9右 (长袖9右)").GetComponent<UnityArmatureComponent>();
  913. LeftShortSleeveSlot = UAC.armature.GetSlot("上衣1袖子左");
  914. RightShortSleeveSlot = UAC.armature.GetSlot("上衣1袖子右");
  915. EyeSlot = UAC.armature.GetSlot("眼睛");
  916. TopSlot = UAC.armature.GetSlot("上衣");
  917. HeadSlot = UAC.armature.GetSlot("脑壳");
  918. WingSlot = UAC.armature.GetSlot("翅膀");
  919. DressSlot = UAC.armature.GetSlot("裙子");
  920. MouseSlot = UAC.armature.GetSlot("嘴巴");
  921. LeftShoeSlot = UAC.armature.GetSlot("鞋子左");
  922. RightShoeSlot = UAC.armature.GetSlot("鞋子右");
  923. HeadWearSlot = UAC.armature.GetSlot("头饰品");
  924. ChangeClose(BodyPart.Eye, "眼睛1", false);
  925. ChangeClose(BodyPart.Top, "上衣1", false);
  926. ChangeClose(BodyPart.Shoe, "鞋子1", false);
  927. ChangeClose(BodyPart.Head, "脑壳1", false);
  928. ChangeClose(BodyPart.Dress, "裙子1", false);
  929. ChangeClose(BodyPart.Mouse, "嘴巴1", false);
  930. ChangeClose(BodyPart.Headwear, "头饰品1", false);
  931. ChangeClose(BodyPart.LeftLongSleeve, "Empty", false);
  932. ChangeClose(BodyPart.RightLongSleeve, "Empty", false);
  933. ChangeClose(BodyPart.LeftShortSleeve, "短袖2左", false);
  934. ChangeClose(BodyPart.RightShortSleeve, "短袖2右", false);
  935. CorrectPivot();
  936. return UAC;
  937. }
  938. public UnityArmatureComponent BuildPink()
  939. {
  940. Build();
  941. ChangeClose(BodyPart.Eye, "眼睛3", false);
  942. ChangeClose(BodyPart.Top, "上衣3", false);
  943. ChangeClose(BodyPart.Shoe, "鞋子3", false);
  944. ChangeClose(BodyPart.Head, "脑壳3", false);
  945. ChangeClose(BodyPart.Wing, "Empty", false);
  946. ChangeClose(BodyPart.Dress, "裙子3", false);
  947. ChangeClose(BodyPart.Mouse, "嘴巴3", false);
  948. ChangeClose(BodyPart.Headwear, "头饰品3", false);
  949. ResetDepth();
  950. return UAC;
  951. }
  952. public UnityArmatureComponent BuildBlond()
  953. {
  954. Build();
  955. ChangeClose(BodyPart.Wing, "Empty", false);
  956. ResetDepth();
  957. return UAC;
  958. }
  959. public UnityArmatureComponent BuildBrown()
  960. {
  961. Build();
  962. ChangeClose(BodyPart.Eye, "眼睛2", false);
  963. ChangeClose(BodyPart.Top, "上衣2", false);
  964. ChangeClose(BodyPart.Shoe, "鞋子2", false);
  965. ChangeClose(BodyPart.Head, "脑壳2", false);
  966. ChangeClose(BodyPart.Wing, "Empty", false);
  967. ChangeClose(BodyPart.Dress, "裙子2", false);
  968. ChangeClose(BodyPart.Mouse, "嘴巴2", false);
  969. ChangeClose(BodyPart.Headwear, "头饰品2", false);
  970. ResetDepth();
  971. return UAC;
  972. }
  973. public void ResetDepth()
  974. {
  975. UAC.transform.SetLZ(2.5f);
  976. WingSlot.UnityTransform.SetLZ(0);
  977. EyeSlot.UnityTransform.SetLZ(0);
  978. TopSlot.UnityTransform.SetLZ(0);
  979. MouseSlot.UnityTransform.SetLZ(0);
  980. HeadWearSlot.UnityTransform.SetLZ(0);
  981. LeftShoeSlot.UnityTransform.SetLZ(0);
  982. RightShoeSlot.UnityTransform.SetLZ(0);
  983. LeftLegSlot.UnityTransform.SetLZ(0);
  984. RightLegSlot.UnityTransform.SetLZ(0);
  985. NeckSlot.UnityTransform.SetLZ(0);
  986. LeftHandSlot.UnityTransform.SetLZ(0);
  987. RightHandSlot.UnityTransform.SetLZ(0);
  988. LeftShortSleeveSlot.UnityTransform.SetLZ(0);
  989. RightShortSleeveSlot.UnityTransform.SetLZ(0);
  990. WingSlot.SetLZ(0.003f);
  991. EyeSlot.SetLZ(-0.001f);
  992. TopSlot.SetLZ(-0.003f);
  993. MouseSlot.SetLZ(-0.001f);
  994. HeadWearSlot.SetLZ(-0.001f);
  995. HeadSlot.UnityTransform.SetLZ(0);
  996. if (HeadSlot.UnityTransform.childCount > 1)
  997. {
  998. HeadSlot.UnityTransform.GetChild(0).SetLZ(0.002f);
  999. HeadSlot.UnityTransform.GetChild(1).SetLZ(0f);
  1000. }
  1001. DressSlot.UnityTransform.SetLZ(-0.002f);
  1002. if (DressSlot.UnityTransform.childCount > 1)
  1003. {
  1004. DressSlot.UnityTransform.GetChild(0).SetLZ(0.002f);
  1005. DressSlot.UnityTransform.GetChild(1).SetLZ(0f);
  1006. }
  1007. LeftShoeSlot.SetLZ(-0.001f);
  1008. RightShoeSlot.SetLZ(-0.001f);
  1009. LeftLegSlot.SetLZ(0);
  1010. RightLegSlot.SetLZ(0);
  1011. NeckSlot.SetLZ(0.001f);
  1012. LeftHandSlot.SetLZ(-0.001f);
  1013. RightHandSlot.SetLZ(-0.001f);
  1014. LeftShortSleeveSlot.SetLZ(-0.0015f);
  1015. RightShortSleeveSlot.SetLZ(-0.0015f);
  1016. LeftLongSleeveUAC.transform.SetLZ(-0.0015f);
  1017. RightLongSleeveUAC.transform.SetLZ(-0.0015f);
  1018. }
  1019. public void ChangeClose(BodyPart bodyPart, string armatureName, bool setDepth = true)
  1020. {
  1021. // Debug.Log (bodyPart + " " + armatureName);
  1022. List<DragonBones.Slot> slotList = new List<DragonBones.Slot>();
  1023. if (bodyPart == BodyPart.Eye)
  1024. {
  1025. Eye = armatureName;
  1026. slotList.Add(EyeSlot);
  1027. }
  1028. else if (bodyPart == BodyPart.Top)
  1029. {
  1030. Top = armatureName;
  1031. slotList.Add(TopSlot);
  1032. }
  1033. else if (bodyPart == BodyPart.Shoe)
  1034. {
  1035. Shoe = armatureName;
  1036. slotList.Add(LeftShoeSlot);
  1037. slotList.Add(RightShoeSlot);
  1038. }
  1039. else if (bodyPart == BodyPart.Head)
  1040. {
  1041. Head = armatureName;
  1042. slotList.Add(HeadSlot);
  1043. }
  1044. else if (bodyPart == BodyPart.Wing)
  1045. {
  1046. if (Wing == armatureName)
  1047. {
  1048. return;
  1049. }
  1050. else
  1051. {
  1052. Wing = armatureName;
  1053. slotList.Add(WingSlot);
  1054. }
  1055. }
  1056. else if (bodyPart == BodyPart.Dress)
  1057. {
  1058. Dress = armatureName;
  1059. slotList.Add(DressSlot);
  1060. }
  1061. else if (bodyPart == BodyPart.Mouse)
  1062. {
  1063. Mouse = armatureName;
  1064. slotList.Add(MouseSlot);
  1065. }
  1066. else if (bodyPart == BodyPart.Headwear)
  1067. {
  1068. HeadWear = armatureName;
  1069. slotList.Add(HeadWearSlot);
  1070. }
  1071. else if (bodyPart == BodyPart.Leg)
  1072. {
  1073. slotList.Add(LeftLegSlot);
  1074. slotList.Add(RightLegSlot);
  1075. }
  1076. else if (bodyPart == BodyPart.LeftHand)
  1077. {
  1078. slotList.Add(LeftHandSlot);
  1079. }
  1080. else if (bodyPart == BodyPart.RightHand)
  1081. {
  1082. slotList.Add(RightHandSlot);
  1083. }
  1084. else if (bodyPart == BodyPart.Neck)
  1085. {
  1086. slotList.Add(NeckSlot);
  1087. }
  1088. else if (bodyPart == BodyPart.LeftLongSleeve)
  1089. {
  1090. LeftLongSleeve = armatureName;
  1091. ChangeClose(LeftLongSleeveUAC, armatureName);
  1092. return;
  1093. }
  1094. else if (bodyPart == BodyPart.LeftShortSleeve)
  1095. {
  1096. LeftShortSleeve = armatureName;
  1097. slotList.Add(LeftShortSleeveSlot);
  1098. }
  1099. else if (bodyPart == BodyPart.RightLongSleeve)
  1100. {
  1101. RightLongSleeve = armatureName;
  1102. ChangeClose(RightLongSleeveUAC, armatureName);
  1103. return;
  1104. }
  1105. else if (bodyPart == BodyPart.RightShortSleeve)
  1106. {
  1107. RightShortSleeve = armatureName;
  1108. slotList.Add(RightShortSleeveSlot);
  1109. }
  1110. else
  1111. {
  1112. throw new Exception();
  1113. }
  1114. ChangeClose(slotList, armatureName, setDepth);
  1115. if (bodyPart == BodyPart.Wing)
  1116. {
  1117. TweenRoot tweenRoot = transform.FindChild("Armature/" + Wing).GetChild(0).CreateTweenScale(new Vector3(1, 1, 1), new Vector3(0.6f, 1, 1), 0.75f, true, true, Curve.Linear);
  1118. tweenRoot.PingPong = true;
  1119. tweenRoot.StartForward();
  1120. }
  1121. }
  1122. public void ChangeClose(List<DragonBones.Slot> slotList, string armatureName, bool setDepth = true)
  1123. {
  1124. for (int i = 0; i < slotList.Count; i++)
  1125. {
  1126. slotList[i].childArmature = UnityFactory.factory.BuildArmature(armatureName, null, null, null, true);
  1127. slotList[i].UnityTransform = slotList[i].childArmature.UnityTransform.parent;
  1128. }
  1129. if (setDepth)
  1130. {
  1131. ResetDepth();
  1132. }
  1133. }
  1134. public void ChangeClose(UnityArmatureComponent uac, string armatureName, bool setDepth = true)
  1135. {
  1136. if (armatureName == "Empty")
  1137. {
  1138. uac.SetActive(false);
  1139. }
  1140. else
  1141. {
  1142. uac.SetActive(true);
  1143. }
  1144. if (setDepth)
  1145. {
  1146. ResetDepth();
  1147. }
  1148. }
  1149. #endregion
  1150. }