254 lines
10 KiB
C#
254 lines
10 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
using UnityEngine.UI;
|
|
using XFrame.Core.UI;
|
|
|
|
public class View_Panel2 : XUIPanel
|
|
{
|
|
public Button training_task_btn;//训练任务按钮
|
|
public Button append_btn;//添加按钮
|
|
public Button scenario_btn;//想定编辑
|
|
public Image append_room_panl;//添加房间页面
|
|
public InputField room_input;//输入房间名字
|
|
public Button Fork_off_btn;//叉掉添加房间页面
|
|
public Button verify_btn;//添加房间确认按钮
|
|
public Button cancel_btno;//取消添加房间按钮
|
|
public Text tips_txt;//提示文本
|
|
public Image distribution_panl;//席位分配面板
|
|
public Button off_btn;//席位分配叉掉页面
|
|
public Button submit_btn;//席位分配提交按钮
|
|
public Image selector_panl;//选择人员页面
|
|
public Button off3_btn;//选择人员页面叉掉按钮
|
|
public Button yemian_btn1;//页面按钮
|
|
public Button yemian_btn2;
|
|
public Button yemian_btn3;
|
|
public Button yemian_btn4;
|
|
public Button yemian_btn5;
|
|
public Button yemian_btn6;
|
|
public Button yemian_btn7;
|
|
public Button yemian_btn8;
|
|
public Button tijiao_btn;//提交按钮
|
|
public Button quxiao_btn;//取消按钮
|
|
public Image Storm_and_capture_panl;//红方蓝方
|
|
public Button Cancel4_btn;//红蓝方叉掉页面
|
|
public Button start_training_btn;//开始训练按钮
|
|
public Button entering_key_btn;//进入导调按钮
|
|
public Transform place;//需要生成地方
|
|
public GameObject root_pan;//需要生成房间预设体
|
|
public List<Text> roomnamelist=new List<Text>();//创建房间的名字
|
|
public List<string> rootlist = new List<string>();//存入房间的名字
|
|
public List<Button> buttonlist = new List<Button>();//克隆出来房间按钮
|
|
public View_Panel2() : base(UIType.Normal, UIMode.HideOther, UICollider.Normal)
|
|
{
|
|
uiPath = "UIPanel/View_Panel2";
|
|
}
|
|
public override void Awake(GameObject go)
|
|
{
|
|
append_room_panl = GameObject.Find("View_Panel2(Clone)").transform.GetChild(2).GetComponent<Image>();
|
|
Fork_off_btn = GameObject.Find("View_Panel2(Clone)").transform.GetChild(2).transform.GetChild(1).GetComponent<Button>();
|
|
room_input = GameObject.Find("View_Panel2(Clone)").transform.GetChild(2).transform.GetChild(3).GetComponent<InputField>();
|
|
scenario_btn =GameObject.Find("View_Panel2(Clone)").transform.GetChild(0).transform.GetChild(2).GetComponent<Button>();
|
|
verify_btn = GameObject.Find("View_Panel2(Clone)").transform.GetChild(2).transform.GetChild(8).GetComponent<Button>();
|
|
cancel_btno = GameObject.Find("View_Panel2(Clone)").transform.GetChild(2).transform.GetChild(9).GetComponent<Button>();
|
|
tips_txt = GameObject.Find("View_Panel2(Clone)").transform.GetChild(2).transform.GetChild(10).GetComponent<Text>();
|
|
distribution_panl = GameObject.Find("View_Panel2(Clone)").transform.GetChild(3).GetComponent<Image>();
|
|
off_btn = GameObject.Find("View_Panel2(Clone)").transform.GetChild(3).transform.GetChild(1).GetComponent<Button>();
|
|
submit_btn = GameObject.Find("View_Panel2(Clone)").transform.GetChild(3).transform.GetChild(5).GetComponent<Button>();
|
|
selector_panl = GameObject.Find("View_Panel2(Clone)").transform.GetChild(4).GetComponent<Image>();
|
|
off3_btn = GameObject.Find("View_Panel2(Clone)").transform.GetChild(4).transform.GetChild(1).GetComponent<Button>();
|
|
place = GameObject.Find("View_Panel2(Clone)").transform.GetChild(1).transform.GetChild(0).transform.GetChild(0).GetComponent<Transform>();
|
|
yemian_btn1 = GameObject.Find("View_Panel2(Clone)").transform.GetChild(3).transform.GetChild(3).transform.GetChild(3).transform.GetChild(3).GetComponent<Button>();
|
|
yemian_btn2 = GameObject.Find("View_Panel2(Clone)").transform.GetChild(3).transform.GetChild(3).transform.GetChild(4).transform.GetChild(3).GetComponent<Button>();
|
|
yemian_btn3 = GameObject.Find("View_Panel2(Clone)").transform.GetChild(3).transform.GetChild(3).transform.GetChild(5).transform.GetChild(3).GetComponent<Button>();
|
|
yemian_btn4 = GameObject.Find("View_Panel2(Clone)").transform.GetChild(3).transform.GetChild(3).transform.GetChild(6).transform.GetChild(3).GetComponent<Button>();
|
|
yemian_btn5 = GameObject.Find("View_Panel2(Clone)").transform.GetChild(3).transform.GetChild(4).transform.GetChild(3).transform.GetChild(3).GetComponent<Button>();
|
|
yemian_btn6 = GameObject.Find("View_Panel2(Clone)").transform.GetChild(3).transform.GetChild(4).transform.GetChild(4).transform.GetChild(3).GetComponent<Button>();
|
|
yemian_btn7 = GameObject.Find("View_Panel2(Clone)").transform.GetChild(3).transform.GetChild(4).transform.GetChild(5).transform.GetChild(3).GetComponent<Button>();
|
|
yemian_btn8 = GameObject.Find("View_Panel2(Clone)").transform.GetChild(3).transform.GetChild(4).transform.GetChild(6).transform.GetChild(3).GetComponent<Button>();
|
|
tijiao_btn = GameObject.Find("View_Panel2(Clone)").transform.GetChild(4).transform.GetChild(8).GetComponent<Button>();
|
|
quxiao_btn = GameObject.Find("View_Panel2(Clone)").transform.GetChild(4).transform.GetChild(9).GetComponent<Button>();
|
|
Storm_and_capture_panl = GameObject.Find("View_Panel2(Clone)").transform.GetChild(5).GetComponent<Image>();
|
|
Cancel4_btn =GameObject.Find("View_Panel2(Clone)").transform.GetChild(5).transform.GetChild(1).GetComponent<Button>();
|
|
start_training_btn = GameObject.Find("View_Panel2(Clone)").transform.GetChild(5).transform.GetChild(6).GetComponent<Button>();
|
|
entering_key_btn = GameObject.Find("View_Panel2(Clone)").transform.GetChild(5).transform.GetChild(7).GetComponent<Button>();
|
|
root_pan = Resources.Load<GameObject>("UIPanel/generate_panl");
|
|
this.transform.Find("UPBG/append_btn").GetComponent<Button>().onClick.AddListener(() =>
|
|
{
|
|
append_room_panl.gameObject.SetActive(true);
|
|
});
|
|
Forkoffbtn();
|
|
Verify();
|
|
Submit();
|
|
Tiao();//生成人员页面
|
|
Cance();
|
|
Scenejump();//场景跳转按钮
|
|
}
|
|
|
|
private void Tiao()
|
|
{
|
|
yemian_btn1.onClick.AddListener(() =>
|
|
{
|
|
JiHUO();
|
|
});
|
|
yemian_btn2.onClick.AddListener(() =>
|
|
{
|
|
JiHUO();
|
|
});
|
|
yemian_btn3.onClick.AddListener(() =>
|
|
{
|
|
JiHUO();
|
|
});
|
|
yemian_btn4.onClick.AddListener(() =>
|
|
{
|
|
JiHUO();
|
|
});
|
|
yemian_btn5.onClick.AddListener(() =>
|
|
{
|
|
JiHUO();
|
|
});
|
|
yemian_btn6.onClick.AddListener(() =>
|
|
{
|
|
JiHUO();
|
|
});
|
|
yemian_btn7.onClick.AddListener(() =>
|
|
{
|
|
JiHUO();
|
|
});
|
|
yemian_btn8.onClick.AddListener(() =>
|
|
{
|
|
JiHUO();
|
|
});
|
|
tijiao_btn.onClick.AddListener(() =>
|
|
{
|
|
selector_panl.gameObject.SetActive(false);
|
|
});
|
|
quxiao_btn.onClick.AddListener(() =>
|
|
{
|
|
selector_panl.gameObject.SetActive(false);
|
|
});
|
|
}
|
|
|
|
private void Scenejump()
|
|
{
|
|
start_training_btn.onClick.AddListener(() =>
|
|
{
|
|
GameMain.model = false;
|
|
//SceneManager.LoadScene("Training_pilot_terminal_panl");
|
|
SceneManager.LoadScene("AdamTraining_pilot_terminal_panl 1");
|
|
});
|
|
entering_key_btn.onClick.AddListener(() =>
|
|
{
|
|
GameMain.model = true;
|
|
SceneManager.LoadScene("Training_pilot_terminal_panl");
|
|
});
|
|
scenario_btn.onClick.AddListener(() =>
|
|
{
|
|
SceneManager.LoadScene("Contingenc_yediting_panl");
|
|
});
|
|
}
|
|
|
|
/// <summary>
|
|
/// 红蓝作战叉掉按钮
|
|
/// </summary>
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
private void Cance()
|
|
{
|
|
Cancel4_btn.onClick.AddListener(() =>
|
|
{
|
|
Storm_and_capture_panl.gameObject.SetActive(false);
|
|
});
|
|
}
|
|
|
|
/// <summary>
|
|
/// 房间查看按钮
|
|
/// </summary>
|
|
private void Roombtn()
|
|
{
|
|
for (int i = 0; i < buttonlist.Count; i++)
|
|
{
|
|
buttonlist[i].onClick.AddListener(() =>
|
|
{
|
|
Storm_and_capture_panl.gameObject.SetActive(true);
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 分配面板提交按钮和取消人员选择按钮
|
|
/// </summary>
|
|
private void Submit()
|
|
{
|
|
int a=0;
|
|
submit_btn.onClick.AddListener(() =>
|
|
{
|
|
append_room_panl.gameObject.SetActive(false);
|
|
distribution_panl.gameObject.SetActive(false);
|
|
selector_panl.gameObject.SetActive(false);
|
|
GameObject.Instantiate(root_pan, place);
|
|
roomnamelist.Add(GameObject.Find("View_Panel2(Clone)").transform.GetChild(1).transform.GetChild(0).transform.GetChild(0).transform.GetChild(a).transform.GetChild(2).GetComponent<Text>());
|
|
buttonlist.Add(GameObject.Find("View_Panel2(Clone)").transform.GetChild(1).transform.GetChild(0).transform.GetChild(0).transform.GetChild(a).transform.GetChild(1).GetComponent<Button>());
|
|
for (int i = 0; i < rootlist.Count; i++)
|
|
{
|
|
roomnamelist[i].text = rootlist[i].ToString();
|
|
}
|
|
a++;
|
|
Roombtn();
|
|
});
|
|
|
|
|
|
|
|
off3_btn.onClick.AddListener(() =>
|
|
{
|
|
selector_panl.gameObject.SetActive(false);
|
|
});
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加分配面板和取消
|
|
/// </summary>
|
|
private void Verify()
|
|
{
|
|
|
|
verify_btn.onClick.AddListener(() =>
|
|
{
|
|
if (room_input.text.Length>=1)
|
|
{
|
|
rootlist.Add(room_input.text);
|
|
distribution_panl.gameObject.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
tips_txt.text = "请输入房间名称";
|
|
}
|
|
});
|
|
off_btn.onClick.AddListener(() =>
|
|
{
|
|
distribution_panl.gameObject.SetActive(false);
|
|
});
|
|
}
|
|
|
|
/// <summary>
|
|
/// 叉掉房间按钮
|
|
/// </summary>
|
|
private void Forkoffbtn()
|
|
{
|
|
Fork_off_btn.onClick.AddListener(() =>
|
|
{
|
|
append_room_panl.gameObject.SetActive(false);
|
|
});
|
|
cancel_btno.onClick.AddListener(() =>
|
|
{
|
|
append_room_panl.gameObject.SetActive(false);
|
|
});
|
|
}
|
|
public void JiHUO()
|
|
{
|
|
selector_panl.gameObject.SetActive(true );
|
|
}
|
|
}
|