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.
74 lines
2.0 KiB
74 lines
2.0 KiB
using UnityEngine; |
|
using System.Collections; |
|
using AX.MessageSystem; |
|
|
|
public class PageEventShow : MonoBehaviour { |
|
/// <summary> |
|
/// 用于Page键盘事件挂在shinei上 |
|
/// </summary> |
|
private int MinCeng; |
|
private int MaxCeng; |
|
public BuildType buildType; |
|
void Awake() |
|
{ |
|
//寻找建筑的最高层和最底层 |
|
ArrayList Array=new ArrayList(); |
|
if (MySceneManager.GetActiveScene().name.Equals("11")) |
|
{ |
|
foreach (Transform child in this.transform) |
|
{ |
|
|
|
if (child.name.Contains("qian")) |
|
{ |
|
foreach (Transform childs in child) |
|
{ |
|
int Num_ = int.Parse(childs.name.Substring(3)); |
|
Array.Add(Num_); |
|
} |
|
|
|
} |
|
if (child.name.Contains("hou")) |
|
{ |
|
foreach (Transform childs in child) |
|
{ |
|
int Num_ = int.Parse(childs.name.Substring(3)); |
|
Array.Add(Num_); |
|
} |
|
|
|
} |
|
} |
|
} |
|
else |
|
{ |
|
foreach (Transform child in this.transform) |
|
{ |
|
int Num = int.Parse(child.name.Substring(3)); |
|
Array.Add(Num); |
|
} |
|
} |
|
|
|
Array.Sort(); |
|
MinCeng=(int)Array[0]; |
|
MaxCeng = (int)Array[Array.Count-1]; |
|
|
|
MessageDispatcher.AddListener("SELECTFLOOR_EVENT", SelectFloor); |
|
} |
|
void OnDestroy() |
|
{ |
|
MessageDispatcher.RemoveListener("SELECTFLOOR_EVENT", SelectFloor); |
|
} |
|
private void SelectFloor(IMessage message) |
|
{ |
|
if (buildType == (BuildType)message.Sender) |
|
{ |
|
InputManager.Instance_.MinCeng = MinCeng; |
|
InputManager.Instance_.MaxCeng = MaxCeng+1; |
|
if (InputManager.Instance_.MaxCeng == 0) |
|
{ |
|
InputManager.Instance_.MaxCeng = 0; |
|
} |
|
} |
|
} |
|
|
|
|
|
}
|
|
|