天津23维预案
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

55 lines
1.4 KiB

using UnityEngine;
using System.Collections;
using AX.MessageSystem;
using System;
public class HaveOneSelectfloor : MonoBehaviour {
[HideInInspector]
public int floor;
public BuildType buildType = BuildType.TypeA;
// Use this for initialization
void Awake()
{
MessageDispatcher.AddListener("SELECTFLOOR_EVENT", SelectFloor);
MessageDispatcher.AddListener("RESETFLOOR_EVENT", ResetFloor);
string floorStr = gameObject.name.Substring(3);
floor = int.Parse(floorStr);
}
bool One = true;
private void SelectFloor(IMessage message)
{
if (buildType == (BuildType)message.Sender)
{
if (floor > (int)message.Data)
{
this.gameObject.SetActive(false);
}
else
{
this.gameObject.SetActive(true);
}
}
}
private void ResetFloor(IMessage message)
{
if (buildType == (BuildType)message.Sender)
{
if (floor > (int)message.Data)
{
gameObject.SetActive(false);
}
else
{
gameObject.SetActive(true);
}
}
}
void OnDestroy()
{
MessageDispatcher.RemoveListener("SELECTFLOOR_EVENT", SelectFloor);
MessageDispatcher.RemoveListener("RESETFLOOR_EVENT", SelectFloor);
}
}