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 Animation = DragonBones.Animation; using Slot = DragonBones.Slot; using Random = UnityEngine.Random; using Transform = UnityEngine.Transform; public enum BodyPart { Leg = 0, LeftHand = 1, RightHand = 2, LeftLongSleeve = 3, LeftShortSleeve = 4, RightLongSleeve = 5, RightShortSleeve = 6, Neck = 7, Eye = 8, Top = 9, Shoe = 10, Head = 11, Wing = 12, Dress = 13, Mouse = 14, Headwear = 15, } public class ExchangeInfo { public float Rate; public double Value; public Current Current; public static void GetExchangeValue(ExchangeInfo info, StaticsManager.ConsumeModule consumeModule) { if (info.Current == Current.Coin) { Manager.AddCoin(info.Value, StaticsManager.ItemID.获得金币, consumeModule); } else if (info.Current == Current.Diamond) { Manager.AddDiamond(info.Value, StaticsManager.ItemID.获得钻石, consumeModule); } } public static ExchangeInfo GetExchangeInfo(Current current, double amt, float rate) { ExchangeInfo info = new ExchangeInfo(); info.Rate = rate; info.Value = amt * rate; info.Current = current; return info; } } public class CloseItem { public enum CloseType { Top, Hair, Wing, Dress, Decarator, Shoe, } #region Var public string Name { get { return Language.GetStr("DressRoom", "Armature" + ID); } } public int ID; public int Index; public int BuyLevel; public int PixelSize; public bool Possess; public string ArmatureName; public string[] ExtraArmatureNames; public BodyPart[] ExtraBodyParts; public float SpriteAlpha; public float IconOffset; public Text BuyBtnLab; public Sprite[] Sprites; public Image Icon1; public Image Icon2; public Image Icon3; public Button BuyBtn; public Button DressBtn; public Vector2 IconOffset1; public Vector2 IconOffset2; public BodyPart BodyPart; public Transform Transform; public CloseType Type; public bool Ignore; public double BuyAmt; public double BuyAdvanceAmt; public Current BuyCurrent; public Current BuyAdvanceCurrent; public Dictionary ChildDic = new Dictionary(); #endregion public CloseItem(XmlAttributeCollection attribute) { Ignore = Auxiliary.StringToBool(attribute[19].Value, false); ID = Auxiliary.StringToInt(attribute[0].Value, -1); BodyPart = BodyPartParse(attribute[4].Value); ArmatureName = attribute[16].Value; PlayerManager.CloseIDDic.Add(ArmatureName, ID); PlayerManager.CloseItemDic.Add(ID, this); if (Ignore) { return; } Type = TypeParse(attribute[2].Value); Index = Auxiliary.StringToInt(attribute[3].Value, -1); BuyLevel = Auxiliary.StringToInt(attribute[5].Value, 0); BuyCurrent = Auxiliary.CurrentParse(attribute[6].Value); BuyAmt = Auxiliary.StringToDouble(attribute[7].Value, 0); BuyAdvanceCurrent = Auxiliary.CurrentParse(attribute[8].Value); BuyAdvanceAmt = Auxiliary.StringToDouble(attribute[9].Value, 0); PixelSize = Auxiliary.StringToInt(attribute[10].Value, 100); IconOffset = Auxiliary.StringToFloat(attribute[11].Value, 0); IconOffset1 = Auxiliary.StringToVector(',', attribute[12].Value, new Vector3()); IconOffset2 = Auxiliary.StringToVector(',', attribute[13].Value, new Vector3()); Sprites = SpriteParse(attribute[14].Value); SpriteAlpha = Auxiliary.StringToFloat(attribute[15].Value, 1); ExtraBodyParts = BodyPartParses(attribute[17].Value); ExtraArmatureNames = Auxiliary.StringToStrings(',', attribute[18].Value, new List()).ToArray(); CreateItem(); } protected void CreateItem() { Transform = ResourceManager.Get(ResourceLabel.CloseItem, Folder.UI, false, ResourceManager.Get(PrefabLabel.Canvas), false); if (Type == CloseType.Top) { Transform.SetParent(ResourceManager.Get("Pb_TopGrid")); } else if (Type == CloseType.Hair) { Transform.SetParent(ResourceManager.Get("Pa_HairGrid")); } else if (Type == CloseType.Dress) { Transform.SetParent(ResourceManager.Get("Pc_DressGrid")); } else if (Type == CloseType.Wing) { Transform.SetParent(ResourceManager.Get("Pe_WingGrid")); } else if (Type == CloseType.Decarator) { Transform.SetParent(ResourceManager.Get("Pd_DecaratorGrid")); } else if (Type == CloseType.Shoe) { Transform.SetParent(ResourceManager.Get("Pf_ShoeGrid")); } else { throw new Exception(); } Transform.SetSiblingIndex(Index); Auxiliary.CompileDic(Transform, ChildDic); Icon1 = ChildDic["Icon1"].GetComponent(); Icon2 = ChildDic["Icon2"].GetComponent(); Icon3 = ChildDic["Icon3"].GetComponent(); DressBtn = ChildDic["CloseItem"].GetComponent