1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- 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 bool Available;
- public Flower Flower;
- public TextMesh TextMesh;
- public FlowerInfo FlowerInfo;
- public GameObject Icon;
- public BoxCollider2D Collider;
- #endregion
- public override void RegistImmed()
- {
- enabled = true;
- Icon = transform.GetChild(0).gameObject;
- Collider = GetComponent<BoxCollider2D>();
- TextMesh = transform.GetChild(0).GetChild(0).GetComponent<TextMesh>();
- ManaText.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.Award = true;
- ManaGarden.PlantList.Add(this);
- }
- public void Retrieve()
- {
- Collider.enabled = true;
- Available = true;
- FlowerInfo.Plant = false;
- ManaReso.Save(Flower);
- ManaGarden.PlantList.Remove(this);
- }
- }
|