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.
51 lines
1.8 KiB
51 lines
1.8 KiB
using UnityEngine; |
|
using UnityEngine.UI; |
|
using UniRx; |
|
using System; |
|
|
|
public class FloorButtonsPanel : UIView |
|
{ |
|
private GameObject Item; |
|
public FloorData Data = new FloorData(); |
|
public override void Awake() |
|
{ |
|
base.Awake(); |
|
|
|
Item = Find("Scroll View/Viewport/Content/Item"); |
|
var url = HttpManager.Instance.GetFloorButtons; |
|
HttpManager.Instance.Get<FloorData>(url, data => |
|
{ |
|
Data = data; |
|
FloorShortcuts.Instance.Highest = Data.Highest; |
|
FloorShortcuts.Instance.Lowest = Data.Lowest; |
|
FloorShortcuts.Instance.CurrentNumber = Data.Highest; |
|
FloorShortcuts.Instance.Buildingfilter = "Floor"; |
|
LoadButtons(); |
|
}); |
|
} |
|
|
|
private void LoadButtons() |
|
{ |
|
foreach (var floor in Data.Floors) |
|
{ |
|
GameObject go = GameObject.Instantiate(Item); |
|
go.SetActive(true); |
|
go.transform.SetParent(Item.transform.parent, false); |
|
|
|
go.name = floor.ButtonName; |
|
go.transform.Find("Label").GetComponent<Text>().text = floor.FloorName; |
|
|
|
go.GetComponent<FloorController>().Prefix = Data.Prefix; |
|
go.GetComponent<FloorController>().HighestFloor = Data.Highest; |
|
go.GetComponent<FloorController>().LowestFloor = Data.Lowest; |
|
|
|
go.GetComponent<FloorController>().isRefugeFloor = floor.BNC; |
|
go.GetComponent<FloorController>().isFireCompartment = floor.FHFQ; |
|
go.GetComponent<FloorController>().isFireDoor = floor.FM; |
|
go.GetComponent<FloorController>().isFireShutter = floor.FHJL; |
|
go.GetComponent<FloorController>().isHydrant = floor.SNXHS; |
|
go.GetComponent<FloorController>().isFireControlRoom = floor.XKS; |
|
go.GetComponent<FloorController>().isPumpRoom = floor.BFSX; |
|
} |
|
} |
|
}
|
|
|