海淀天下城电子沙盘单机版
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.
 
 
 
 

60 lines
1.9 KiB

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class CarAttributePanle : ResourceLoadPanel<CarAttributePanle>
{
private Button SureBtn;
private Button CloseBtn;
private Toggle Select_t;
private void Start()
{
var P_car = GameObject.Find("P_AllParent/P_Car").transform;
var cars = P_car.GetComponentsInChildren<CarAttributeRecord>();
var Father = transform.Find(GlobalVariable.ContentPath);
GameObject obj = Resources.Load<GameObject>("UI/CarAttributeItem");
foreach (CarAttributeRecord item in cars)
{
GameObject clone = Instantiate(obj, Father.transform);
clone.GetComponent<CarItemAttribute>().CarAttributeRecord = item;
clone.name = item.CarType.ToString();
}
SureBtn = transform.Find("SureBtn").GetComponent<Button>();
CloseBtn = transform.Find("CloseBtn").GetComponent<Button>();
Select_t = transform.Find("FormTitle/Select_t").GetComponent<Toggle>();
Select_t.onValueChanged.AddListener(AllSelect);
SureBtn.onClick.AddListener(Submit);
CloseBtn.onClick.AddListener(Close);
}
private void Close()
{
gameObject.SetActive(false);
Select_t.isOn = false;
}
private void Submit()
{
var select = transform.Find(GlobalVariable.ContentPath).GetComponentsInChildren<CarItemAttribute>();
foreach (CarItemAttribute item in select)
{
item.Submit();
}
Select_t.isOn = false;
gameObject.SetActive(false);
}
private void OnDisable()
{
}
private void AllSelect(bool arg0)
{
var select = transform.Find(GlobalVariable.ContentPath).GetComponentsInChildren<Toggle>();
foreach (Toggle item in select)
{
item.isOn = arg0;
}
}
}