123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine.UI;
- public class Slot : Regist
- {
- #region 变量
- public bool Valid
- {
- get { return _Valid; }
- set
- {
- _Valid = value;
- if (_Valid)
- {
- Icon.SetActive(false);
- }
- else
- {
- Icon.SetActive(true);
- }
- }
- }
- private bool _Valid;
- public int ID;
- public int Index;
- public bool Available;
- public Flower Flower;
- public TextMesh TextMesh;
- public FlowerInfo FlowerInfo;
- public GameObject Icon;
- public BoxCollider2D Collider;
- #endregion
- public override void RegistImmed()
- {
- if (RegistFlag)
- {
- return;
- }
- else
- {
- RegistFlag = 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"));
- }
- public void Plant(FlowerInfo flowerInfo, bool anim)
- {
- FlowerInfo = flowerInfo;
- ID = flowerInfo.ID_;
- 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;
- ManaReso.Save(Flower);
- ManaGarden.PlantList.Remove(this);
- for (int i = 0; i < Flower.ElfList.Count; i++)
- {
- ManaReso.Save(Flower.ElfList[i]);
- }
- Flower.ElfList = new List<Transform>();
- Flower.Award_ = false;
- Flower.GoldBk.SetActive(false);
- Flower.GoldBk.GetTweenSr().Pause();
- Flower.GoldIcon.GetTweenSr().Pause();
- Flower.GoldBk.GetTweenSr().InOrigin = true;
- Flower.GoldIcon.GetTweenSr().InOrigin = true;
- }
- }
|