using UnityEngine; using UnityEngine.UI; using System.Collections; using System.Collections.Generic; public class Slot : Regist { #region 变量 public int ID { get { return FlowerInfo.ID_; } } public bool Lock { get { return Lock_; } set { Lock_ = value; if (Lock_) { Icon.SetActive(false); } else { Icon.SetActive(true); } } } public bool Available { get { return Available_; } set { if (value) { if (Flower == null) { Available_ = value; } } else { Available_ = value; } } } public bool Lock_; public bool Available_; public int Index; public Flower Flower; public TextMesh TextMesh; public FlowerInfo FlowerInfo; public GameObject Icon; public BoxCollider2D Collider; #endregion public override bool RegistImmed() { if (base.RegistImmed()) { return true; } enabled = true; Icon = transform.GetChild(0).gameObject; Collider = GetComponent(); TextMesh = transform.GetChild(0).GetChild(0).GetComponent(); ManaLan.Add(TextMesh, new LanStr("Object", "SlotSign")); return false; } public void Plant(FlowerInfo flowerInfo, bool anim) { FlowerInfo = flowerInfo; Collider.enabled = false; Available = false; FlowerInfo.Slot = this; FlowerInfo.Plant = true; Flower = ManaReso.GetFlower(flowerInfo, this, true); if (anim) { Flower.PlayParticle(); } ManaGarden.PlantList.Add(this); } public void Retrieve() { Collider.enabled = true; Available_ = true; FlowerInfo.Plant = false; ManaGarden.PlantList.Remove(this); Flower.Retrieve(); } }