123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- 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<BoxCollider2D>();
- TextMesh = transform.GetChild(0).GetChild(0).GetComponent<TextMesh>();
- 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();
- }
- }
|