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