123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- using UnityEngine;
- using UnityEngine.UI;
- using System.Collections;
- using System.Collections.Generic;
- public class SlotLabel
- {
- public static string Slot = "Slot";
- public static string SlotArrow = "SlotArrorw";
- }
- public class Slot : Regist
- {
- #region Config
- 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 InitAtOnce()
- {
- if (base.InitAtOnce())
- {
- return true;
- }
- enabled = true;
- Icon = transform.GetChild(0).gameObject;
- Collider = GetComponent<BoxCollider2D>();
- TextMesh = transform.GetChild(0).GetChild(0).GetComponent<TextMesh>();
- LanguageManager.Add(TextMesh, new MulLanStr(LanguageLabel.Object__SlotSign));
- return false;
- }
- public void Plant(FlowerInfo flowerInfo, bool anim)
- {
- FlowerInfo = flowerInfo;
- Collider.enabled = false;
- Available = false;
- FlowerInfo.PlantAmt++;
- Flower = ResourceManager.GetFlower(flowerInfo, this, true);
- if (anim)
- {
- Flower.PlayFlashLight();
- }
-
- GardenManager.PlantList.Add(this);
- }
- public void Retrieve()
- {
- Collider.enabled = true;
- Available_ = true;
- FlowerInfo.PlantAmt--;
- GardenManager.PlantList.Remove(this);
- Flower.Retrieve();
- Flower = null;
- }
- }
|