using UnityEngine; using UnityEngine.UI; using System.Collections; using System.Collections.Generic; public class SlotLabel { public static string Slot = "Slot"; public static string SlotArrow = "SlotArrow"; } public class Slot : Regist { #region Config public int ID { get { return PlantFlowerInfo.ID; } } public bool Lock { get { return lock_; } set { lock_ = value; if (lock_) { Icon.SetActive(false); } else { Icon.SetActive(true); } } } public bool lock_; public bool Available { get { return available; } set { if (value) { if (PlantFlower == null) { available = value; } } else { available = value; } } } public bool available; public int Index; public Flower PlantFlower; public TextMesh StatusTextMesh; public FlowerInfo PlantFlowerInfo; public GameObject Icon; public BoxCollider2D Collider; #endregion public override bool InitAtOnce() { if (base.InitAtOnce()) { return true; } enabled = true; Icon = transform.GetChild(0).gameObject; Collider = GetComponent(); StatusTextMesh = transform.GetChild(0).GetChild(0).GetComponent(); LanguageManager.Add(StatusTextMesh, new MulLanStr(LanguageLabel.Object__SlotSign)); return false; } public void Plant(FlowerInfo flowerInfo, bool anim) { PlantFlowerInfo = flowerInfo; Collider.enabled = false; Available = false; PlantFlowerInfo.PlantAmt++; PlantFlower = ResourceManager.GetFlower(flowerInfo, this, true); if (anim) { PlantFlower.PlayFlashLight(); } GardenManager.PlantSlotList.Add(this); } public void Retrieve() { Collider.enabled = true; available = true; PlantFlowerInfo.PlantAmt--; GardenManager.PlantSlotList.Remove(this); PlantFlower.RetrieveFlower(); PlantFlower = null; } }