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 FlowerLabel { public static string AwardGoldBk = "AwardGoldBk"; public static string AwardGoldIcon = "AwardGoldIcon"; public static string AwardGoldPos = "AwardGoldPos"; public static string FlashLight = "FlashLight"; public static string FlowerIcon = "FlowerIcon"; public static string OperatePanelBk = "OperatePanelBk"; public static string OperateIcon = "OperateIcon"; public static string OperateOutlineParent = "OperateOutlineParent"; public static string NewFlowerEffect = "NewFlowerEffect"; public static string FlowerShadow = "FlowerShadow"; public static string ScorePos = "ScorePos"; public static string MiniGamePanel = "MiniGamePanel"; public static string Flash = "Flash"; public static string ParticleSystem = "ParticleSystem"; public static string AwardGoldBkLeftPos = "AwardGoldBkLeftPos"; } public class FlowerInfo { #region Config public int Amount { get { return amount; } set { amount = value; AmountText.SetActive(true); AmountText.text = AmountTextPrefix + amount; } } public int amount; public int RemainAmount { get { return Amount - PlantAmt; } } public int PlantAmt; public bool IsPlanted { get { return PlantAmt > 0; } } public bool Unlock { get { return unlock; } set { unlock = value; if (unlock) { Image.material = null; if (IsSpecial) { if (GardenManager.TotalUnlockSpecialFlower == 0) { ResourceManager.Get(CanvasLabel.G_Regular).TweenForVec(); ResourceManager.SetActive(CanvasLabel.G_Special, true); } GardenManager.TotalUnlockSpecialFlower++; } else { GardenManager.TotalUnlockNormalFlower++; } Amount = 1; Manager.SkillPlus += SkillPlus; } } } public bool unlock; public bool IsSpecial; public float SkillPlus = 0.1f; public static string IDPrefix = "Flower"; public static string AmountTextPrefix = "x"; public string FullID { get { return IDPrefix + ID; } } public int ID; public string Name { get { return Language.GetStr(LanguageLabel.CombineLanguageLabel(LanguageLabel.FlowerName, FullID)); } } public string Description { get { return null; } } public Sprite Icon { get { return ResourceManager.LoadSprite(icon, Folder.Atlas2); } } public string icon; public int UnlockCost; public float AwardCoinBuff; public Current UnlockCur; public Text StatusText; public Text AmountText; 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(CanvasLabel.G_RegularGrid), false, ObjType.FlowerItem); FlowerItem.AddComponent(); Auxiliary.CompileDic(FlowerItem, ChildDic); StatusText = ChildDic[FlowerItemLabel.Status].GetComponent(); Image = ChildDic[FlowerItemLabel.Icon].GetComponent(); Button = ChildDic[FlowerItemLabel.FlowerItem].GetComponent