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, Wing, Dress, Mouse, Headwear, } public class CloseUnit { public enum CloseType { Top, Hair, Wing, Dress, Decarator, } #region Var public string Description { get { return Language.GetStr("DressRoom", "Armature" + ID); } } public int ID; public int Index; public int BuyLevel; public int PixelSize; public bool Bought; public string ArmatureName; public float SpriteAlpha; public float IconOffset; public Text BuyBtnLab; public Sprite[] Sprites; public Image Icon1; public Image Icon2; public Button BuyBtn; public Button DressBtn; public Vector2 IconOffset1; public BodyPart BodyPart; public Transform Transform; public CloseType Type; public double BuyAmt; public double BuyAdvanceAmt; public Current BuyCurrent; public Current BuyAdvanceCurrent; public Dictionary ChildDic = new Dictionary(); #endregion public CloseUnit(XmlAttributeCollection attribute) { ID = Auxiliary.IntParse(attribute[0].Value, -1); Type = TypeParse(attribute[2].Value); Index = Auxiliary.IntParse(attribute[3].Value, -1); BodyPart = BodyPartParse(attribute[4].Value); BuyLevel = Auxiliary.IntParse(attribute[5].Value, 0); BuyCurrent = Auxiliary.CurrentParse(attribute[6].Value); BuyAmt = Auxiliary.DoubleParse(attribute[7].Value, 0); BuyAdvanceCurrent = Auxiliary.CurrentParse(attribute[8].Value); BuyAdvanceAmt = Auxiliary.DoubleParse(attribute[9].Value, 0); PixelSize = Auxiliary.IntParse(attribute[10].Value, 100); IconOffset = Auxiliary.FloatParse(attribute[11].Value, 0); IconOffset1 = Auxiliary.VectorParse(',', attribute[12].Value, new Vector3()); Sprites = SpriteParse(attribute[13].Value); SpriteAlpha = Auxiliary.FloatParse(attribute[14].Value, 1); ArmatureName = attribute[15].Value; ManaPlayer.CloseIDDic.Add(ArmatureName, ID); ManaPlayer.CloseUnitDic.Add(ID, this); 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); Icon1 = ChildDic["Icon1"].GetComponent(); Icon2 = ChildDic["Icon2"].GetComponent(); DressBtn = ChildDic["CloseItem"].GetComponent