using UnityEngine; using UnityEngine.UI; using UnityEngine.Serialization; using UnityEngine.EventSystems; using System; using System.Xml; using System.Collections; using System.Collections.Generic; using Random = UnityEngine.Random; public enum OpType { Rip, Null, Water, Fertilize, } public class FlowerInfo { #region 变量 public int Amount { get { return amount; } set { amount = value; AmountLab.SetActive(true); AmountLab.text = "x" + amount; } } public int amount; public int RemainAmount { get { return Amount - PlantAmt; } } public int PlantAmt; public bool Plant { get { return PlantAmt > 0; } } public bool Unlock { get { return Unlock_; } set { Unlock_ = value; if (Unlock_) { Image.material = null; if (Special) { if (GardenManager.MyFlowerSpec == 0) { ResourceManager.Get(PrefabLabel.G_Regular).TweenForVec(); ResourceManager.SetActive(PrefabLabel.G_Special, true); } GardenManager.MyFlowerSpec++; } else { GardenManager.MyFlowerRegu++; } Amount = 1; Manager.SkillPlus += SkillPlus; } } } private float SkillPlus = 0.1f; public static string FullIDPrefix = "Flower"; public string FullID { get { return FullIDPrefix + ID_; } } public string Name { get { return Language.GetStr("FlowerName", FullID); } } public string Description { get { return Language.GetStr("FlowerDesc", FullID); } } public Sprite Icon { get { return ResourceManager.LoadSprite(Icon_, Folder.Atlas2); } } public int ID_; public bool Unlock_; public string Icon_; public bool Special; public int UnlockAmt; public float FlowerCoinBuff; public Current UnlockCur; public Text Text; public Text AmountLab; public Image Image; public Button Button; public UIPartical UIPartical; public Transform FlowerItem; public Dictionary ChildDic = new Dictionary(); #endregion public FlowerInfo(XmlAttributeCollection attribute) { FlowerItem = ResourceManager.Get(ResourceLabel.FlowerItem, Folder.UI, false, ResourceManager.Get(PrefabLabel.G_RegularGrid), false, ObjType.FlowerItem); FlowerItem.AddComponent(); Auxiliary.CompileDic(FlowerItem, ChildDic); Text = ChildDic["Lab"].GetComponent(); Image = ChildDic["Icon"].GetComponent(); Button = ChildDic["FlowerItem"].GetComponent