逻辑写一半ProMax
This commit is contained in:
parent
7506bda817
commit
d606df27e0
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
8
xiaofang/Assets/Script/UI/ZZZZZZ.meta
Normal file
8
xiaofang/Assets/Script/UI/ZZZZZZ.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8acec06eb18d0f0438b438144b6b041a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
640
xiaofang/Assets/Script/UI/ZZZZZZ/ZZUIManager.cs
Normal file
640
xiaofang/Assets/Script/UI/ZZZZZZ/ZZUIManager.cs
Normal file
@ -0,0 +1,640 @@
|
||||
using DG.Tweening;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ZZUIManager : MonoBehaviour
|
||||
{
|
||||
[Header("面板")]
|
||||
/// <summary>
|
||||
/// 点击可以弹出右边框
|
||||
/// </summary>
|
||||
public GameObject Right_Box;
|
||||
/// <summary>
|
||||
/// 总指挥框
|
||||
/// </summary>
|
||||
public GameObject Warn_Tip;
|
||||
/// <summary>
|
||||
/// 学生疏散情况
|
||||
/// </summary>
|
||||
public GameObject Right_Situation;
|
||||
/// <summary>
|
||||
/// 撤离方案选择框
|
||||
/// </summary>
|
||||
public GameObject DiaLogBox;
|
||||
/// <summary>
|
||||
/// 下楼梯队形选着
|
||||
/// </summary>
|
||||
public GameObject DiaLogBox2;
|
||||
/// <summary>
|
||||
/// 已经安全撤离框
|
||||
/// </summary>
|
||||
public GameObject Right_Message;
|
||||
/// <summary>
|
||||
/// 为能安全撤离的框
|
||||
/// </summary>
|
||||
public GameObject Right_Message2;
|
||||
/// <summary>
|
||||
/// 下拉框
|
||||
/// </summary>
|
||||
public Dropdown dropdwn;
|
||||
/// <summary>
|
||||
/// 撤离方案选择
|
||||
/// </summary>
|
||||
public ToggleGroup Tip123;
|
||||
/// <summary>
|
||||
/// 三个楼梯
|
||||
/// </summary>
|
||||
[Header("按钮")]
|
||||
public Button Icn_Stairway_1;
|
||||
public Button Icn_Stairway_2;
|
||||
public Button Icn_Stairway_3;
|
||||
/// <summary>
|
||||
/// 疏散顺序
|
||||
/// </summary>
|
||||
public Button Warn;
|
||||
/// <summary>
|
||||
/// 呼出队形机
|
||||
/// </summary>
|
||||
public Button Flee;
|
||||
/// <summary>
|
||||
/// 死亡图标的一号电梯
|
||||
/// </summary>
|
||||
public Button Die;
|
||||
/// <summary>
|
||||
/// 电梯图标的二号电梯
|
||||
/// </summary>
|
||||
public Button Phone;
|
||||
/// <summary>
|
||||
/// 地图F4
|
||||
/// </summary>
|
||||
public Button TP_1;
|
||||
public Button TP_2;
|
||||
public Button TP_3;
|
||||
public Button TP_4;
|
||||
/// <summary>
|
||||
/// 对讲机
|
||||
/// </summary>
|
||||
public Button Intercom;
|
||||
/// <summary>
|
||||
/// 左边的物品栏
|
||||
/// </summary>
|
||||
public Button Prop1;
|
||||
public Button Prop2;
|
||||
public Button Prop3;
|
||||
/// <summary>
|
||||
/// 右边物品栏
|
||||
/// </summary>
|
||||
public Button Prop4;
|
||||
public Button Prop5;
|
||||
public Button Prop6;
|
||||
/// <summary>
|
||||
/// 撤离教室方案ABC
|
||||
/// </summary>
|
||||
public Toggle DialogboxA;
|
||||
public Toggle DialogboxB;
|
||||
public Toggle DialogboxC;
|
||||
/// <summary>
|
||||
/// 撤离方案确定
|
||||
/// </summary>
|
||||
public Button DialogboxSure;
|
||||
/// <summary>
|
||||
/// 梯队队形选择AB
|
||||
/// </summary>
|
||||
public Button Dialogbox2A;
|
||||
public Button Dialogbox2B;
|
||||
/// <summary>
|
||||
/// 梯队选择确定
|
||||
/// </summary>
|
||||
public Button Dialogbox2Sure;
|
||||
/// <summary>
|
||||
/// 加减号
|
||||
/// </summary>
|
||||
public Button Minus;
|
||||
public Button Plus;
|
||||
/// <summary>
|
||||
/// 上报按钮
|
||||
/// </summary>
|
||||
public Button Sumbit;
|
||||
public Button Sumbit2;
|
||||
/// <summary>
|
||||
/// 确定起火点按钮
|
||||
/// </summary>
|
||||
public Button FireButton;
|
||||
/// <summary>
|
||||
/// 右边的框
|
||||
/// </summary>
|
||||
public Button Right_BoxButton;
|
||||
|
||||
public Button Close1;
|
||||
public Button Close2;
|
||||
|
||||
|
||||
[Header("文本")]
|
||||
/// <summary>
|
||||
/// 右边框框紧急任务
|
||||
/// </summary>
|
||||
public Text Tip_1;
|
||||
public Text Tip_2;
|
||||
public Text Tip_3;
|
||||
public Text Tip_4;
|
||||
/// <summary>
|
||||
/// 现场总指挥
|
||||
/// </summary>
|
||||
public Text Head_Text;
|
||||
/// <summary>
|
||||
/// 总指挥介绍
|
||||
/// </summary>
|
||||
public Text WarnTip_Text;
|
||||
/// <summary>
|
||||
/// 疏散情况文本
|
||||
/// </summary>
|
||||
public Text Situation_Tip_1;
|
||||
public Text Situation_Tip_2;
|
||||
public Text Situation_Tip_3;
|
||||
public Text Situation_Tip_4;
|
||||
/// <summary>
|
||||
/// 撤离方案ABC
|
||||
/// </summary>
|
||||
public Text LeftText1;
|
||||
public Text LeftText2;
|
||||
public Text LeftText3;
|
||||
/// <summary>
|
||||
/// 撤离方案介绍
|
||||
/// </summary>
|
||||
public Text RightText1;
|
||||
public Text RightText2;
|
||||
public Text RightText3;
|
||||
/// <summary>
|
||||
/// 楼梯梯队介绍
|
||||
/// </summary>
|
||||
public Text LeftLT_Text1;
|
||||
public Text RightLT_Text1;
|
||||
/// <summary>
|
||||
/// 梯队介绍
|
||||
/// </summary>
|
||||
public Text LeftLT_Text2;
|
||||
public Text RightLT_Text;
|
||||
/// <summary>
|
||||
/// 撤离班级
|
||||
/// </summary>
|
||||
public Text Right_MessageText;
|
||||
/// <summary>
|
||||
/// 学生人数
|
||||
/// </summary>
|
||||
public InputField Student_Number;
|
||||
/// <summary>
|
||||
/// 未撤离班级
|
||||
/// </summary>
|
||||
public Text NO_Left_MessageText;
|
||||
public Text NO_Right_MessageText;
|
||||
/// <summary>
|
||||
/// 未撤离学生人数
|
||||
/// </summary>
|
||||
public Text NO_Student;
|
||||
/// <summary>
|
||||
/// 时间文本
|
||||
/// </summary>
|
||||
public Text TimeText;
|
||||
/// <summary>
|
||||
/// 道具数量左->右
|
||||
/// </summary>
|
||||
public Text PropText1;
|
||||
public Text PropText2;
|
||||
public Text PropText3;
|
||||
public Text PropText4;
|
||||
public Text PropText5;
|
||||
public Text PropText6;
|
||||
/// <summary>
|
||||
/// 网络延迟
|
||||
/// </summary>
|
||||
public Text WLYC;
|
||||
/// <summary>
|
||||
/// 标题文本
|
||||
/// </summary>
|
||||
public Text TileText;
|
||||
//起火点按钮文本
|
||||
public Text FireText;
|
||||
|
||||
//计时器
|
||||
private float timeElapsed = 0f;
|
||||
//记录
|
||||
int num = 0;
|
||||
public Image bg;
|
||||
|
||||
public float moveDuration = 0.5f; // 动画持续时间
|
||||
public RectTransform buttonRect; // 你的按钮 RectTransform
|
||||
public bool isHidden=true;
|
||||
public float showPositionX;
|
||||
public float hidePositionX;
|
||||
|
||||
public ZZUIManager instert;
|
||||
public void Awake()
|
||||
{
|
||||
isHidden = true;
|
||||
instert = this;
|
||||
TimeText.text = "00.00";
|
||||
num = 0;
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
FireText.color = new Color(113, 113, 113);
|
||||
Debug.Log("变色了");
|
||||
hidePositionX = 337f;
|
||||
showPositionX = 1.159973f;
|
||||
//右边框框弹出来
|
||||
Right_BoxButton.onClick.AddListener(() =>
|
||||
{
|
||||
OnClickHideButton();
|
||||
});
|
||||
|
||||
#region 道具
|
||||
Prop1.onClick.AddListener(() =>
|
||||
{
|
||||
Prop(1);
|
||||
});
|
||||
Prop2.onClick.AddListener(() =>
|
||||
{
|
||||
Prop(2);
|
||||
});
|
||||
Prop3.onClick.AddListener(() =>
|
||||
{
|
||||
Prop(3);
|
||||
});
|
||||
Prop4.onClick.AddListener(() =>
|
||||
{
|
||||
Prop(4);
|
||||
});
|
||||
Prop5.onClick.AddListener(() =>
|
||||
{
|
||||
Prop(5);
|
||||
});
|
||||
Prop6.onClick.AddListener(() =>
|
||||
{
|
||||
Prop(6);
|
||||
});
|
||||
#endregion
|
||||
|
||||
#region 地标点击事件(地图那四个点)
|
||||
TP_1.onClick.AddListener(() =>
|
||||
{
|
||||
MapTP(1);
|
||||
});
|
||||
TP_2.onClick.AddListener(() =>
|
||||
{
|
||||
MapTP(2);
|
||||
});
|
||||
TP_3.onClick.AddListener(() =>
|
||||
{
|
||||
MapTP(3);
|
||||
});
|
||||
TP_4.onClick.AddListener(() =>
|
||||
{
|
||||
MapTP(4);
|
||||
});
|
||||
#endregion
|
||||
//关闭总指挥框
|
||||
if (Warn_Tip.activeSelf&&(Input.GetMouseButtonDown(0)|| Input.GetMouseButtonDown(1)|| Input.GetMouseButtonDown(2)))
|
||||
{
|
||||
Warn_Tip.SetActive(false);
|
||||
}
|
||||
|
||||
Minus.onClick.AddListener(() =>
|
||||
{
|
||||
int currentValue = int.Parse(Student_Number.text);
|
||||
// 增加1
|
||||
currentValue--;
|
||||
// 更新 InputField 的文本
|
||||
Student_Number.text = currentValue.ToString();
|
||||
});
|
||||
Plus.onClick.AddListener(() =>
|
||||
{
|
||||
int currentValue = int.Parse(Student_Number.text);
|
||||
// 增加1
|
||||
currentValue++;
|
||||
// 更新 InputField 的文本
|
||||
Student_Number.text = currentValue.ToString();
|
||||
});
|
||||
|
||||
//打开队形
|
||||
Flee.onClick.AddListener(() => {
|
||||
DiaLogBox2.SetActive(true);
|
||||
});
|
||||
|
||||
Close1.onClick.AddListener(() => { Close(); });
|
||||
Close2.onClick.AddListener(() => { Close(); });
|
||||
|
||||
//下拉列表(人物选着)
|
||||
dropdwn.onValueChanged.AddListener(delegate {
|
||||
DropdownValueChanged(dropdwn);
|
||||
});
|
||||
//默认开一次这样开局就能默认第一个选项一次
|
||||
DropdownValueChanged(dropdwn);
|
||||
|
||||
//右边框框 上报总指 (已经安全撤离的)
|
||||
Sumbit.onClick.AddListener(() =>
|
||||
{
|
||||
SumbitButton();
|
||||
});
|
||||
|
||||
//右边框框 上报总指 (未安全撤离的)
|
||||
Sumbit2.onClick.AddListener(() =>
|
||||
{
|
||||
Sumbit2Button();
|
||||
});
|
||||
//撤离方案选择
|
||||
DialogboxA.onValueChanged.AddListener(delegate { OnToggleChanged(DialogboxA); });
|
||||
DialogboxB.onValueChanged.AddListener(delegate { OnToggleChanged(DialogboxB); });
|
||||
DialogboxC.onValueChanged.AddListener(delegate { OnToggleChanged(DialogboxC); });
|
||||
//撤离方案确定
|
||||
DialogboxSure.onClick.AddListener(() =>
|
||||
{
|
||||
|
||||
DiaLogBox.SetActive(false);
|
||||
});
|
||||
//梯队选择队形
|
||||
Dialogbox2A.onClick.AddListener(() =>
|
||||
{
|
||||
num = 1;
|
||||
});
|
||||
Dialogbox2B.onClick.AddListener(() =>
|
||||
{
|
||||
num = 2;
|
||||
});
|
||||
//梯队队形确定
|
||||
Dialogbox2Sure.onClick.AddListener(() =>
|
||||
{
|
||||
if(num==1)
|
||||
{
|
||||
|
||||
|
||||
|
||||
num = 0;
|
||||
DiaLogBox2.SetActive(false);
|
||||
}
|
||||
if(num==2)
|
||||
{
|
||||
|
||||
|
||||
num = 0;
|
||||
DiaLogBox2.SetActive(false);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
// 更新时间
|
||||
timeElapsed += Time.deltaTime;
|
||||
|
||||
// 计算分钟和秒数
|
||||
int minutes = Mathf.FloorToInt(timeElapsed / 60);
|
||||
int seconds = Mathf.FloorToInt(timeElapsed % 60);
|
||||
|
||||
// 格式化时间为 "00.00" 格式
|
||||
TimeText.text = string.Format("{0:00}.{1:00}", minutes, seconds);
|
||||
}
|
||||
//动画部分
|
||||
public void OnClickHideButton()
|
||||
{
|
||||
// 如果按钮已隐藏,点击后显示
|
||||
if (isHidden)
|
||||
{
|
||||
// 恢复按钮到原位置
|
||||
buttonRect.DOAnchorPosX(showPositionX, moveDuration).SetEase(Ease.InOutCubic);
|
||||
bg.transform.Rotate(0, 0,180f);
|
||||
isHidden = false; // 更新状态为未隐藏
|
||||
}
|
||||
else
|
||||
{
|
||||
// 隐藏按钮
|
||||
buttonRect.DOAnchorPosX(hidePositionX, moveDuration).SetEase(Ease.InOutCubic);
|
||||
bg.transform.Rotate(0, 0,180f);
|
||||
isHidden = true; // 更新状态为隐藏
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 道具需要执行的
|
||||
/// </summary>
|
||||
/// <param name="a">从左->右</param>
|
||||
public void Prop(int a)
|
||||
{
|
||||
switch (a)
|
||||
{
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
break;
|
||||
case 5:
|
||||
break;
|
||||
case 6:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 地图地点
|
||||
/// </summary>
|
||||
/// <param name="a">1-操场 2-教室 3-厨房 4-楼道</param>
|
||||
public void MapTP(int a)
|
||||
{
|
||||
switch(a)
|
||||
{
|
||||
case 1:
|
||||
|
||||
FireText.color = new Color(255, 255, 255);
|
||||
TileText.text = "请选择无法用于疏散的楼道";
|
||||
break;
|
||||
case 2:
|
||||
|
||||
FireText.color = new Color(255, 255, 255);
|
||||
TileText.text = "请选择无法用于疏散的楼道";
|
||||
break;
|
||||
case 3:
|
||||
|
||||
FireText.color = new Color(255, 255, 255);
|
||||
TileText.text = "请选择无法用于疏散的楼道";
|
||||
break;
|
||||
case 4:
|
||||
|
||||
FireText.color = new Color(255, 255, 255);
|
||||
TileText.text = "请选择无法用于疏散的楼道";
|
||||
break;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 下拉列表执行的事件
|
||||
/// </summary>
|
||||
/// <param name="change"></param>
|
||||
void DropdownValueChanged(Dropdown change)
|
||||
{
|
||||
int index = change.value;
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
// 执行 Option 1 相关的事件
|
||||
Debug.Log("Option 1 selected");
|
||||
break;
|
||||
case 1:
|
||||
// 执行 Option 2 相关的事件
|
||||
Debug.Log("Option 2 selected");
|
||||
break;
|
||||
case 2:
|
||||
// 执行 Option 3 相关的事件
|
||||
Debug.Log("Option 3 selected");
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
break;
|
||||
case 5:
|
||||
break;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 修改右边框框内容
|
||||
/// </summary>
|
||||
/// <param name="str">内容</param>
|
||||
/// <param name="a">从上到下</param>
|
||||
public void FixWarn(string str,int a)
|
||||
{
|
||||
switch (a)
|
||||
{
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
break;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 修改网络延迟
|
||||
/// </summary>
|
||||
/// <param name="str">网络延迟的数字部分</param>
|
||||
public void FixDelay(string str)
|
||||
{
|
||||
WLYC.text = "网络延迟:" + str;
|
||||
}
|
||||
/// <summary>
|
||||
/// 修改疏散班级情况
|
||||
/// </summary>
|
||||
/// <param name="str">班级撤离情况</param>
|
||||
/// <param name="a">更新第几条消息从上往下</param>
|
||||
public void FixSituation(string str,int a)
|
||||
{
|
||||
switch (a)
|
||||
{
|
||||
case 1:
|
||||
Situation_Tip_1.text = str;
|
||||
break;
|
||||
case 2:
|
||||
Situation_Tip_2.text = str;
|
||||
break;
|
||||
case 3:
|
||||
Situation_Tip_3.text = str;
|
||||
break;
|
||||
case 4:
|
||||
Situation_Tip_4.text = str;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 修改成功撤离班级的信息
|
||||
/// </summary>
|
||||
/// <param name="str">撤离班级的名字</param>
|
||||
/// <param name="a">人数</param>
|
||||
public void FixFledOk(string str,int a)
|
||||
{
|
||||
Right_MessageText.text = str;
|
||||
int currentValue = int.Parse(Student_Number.text);
|
||||
currentValue = a;
|
||||
// 更新 InputField 的文本
|
||||
Student_Number.text = currentValue.ToString();
|
||||
}
|
||||
/// <summary>
|
||||
/// 修改未撤离班级
|
||||
/// </summary>
|
||||
/// <param name="str">未撤离的班级</param>
|
||||
/// <param name="a">未撤离的人数</param>
|
||||
public void FixNo(string str,int a)
|
||||
{
|
||||
NO_Left_MessageText.text = str;
|
||||
NO_Right_MessageText.text = str;
|
||||
NO_Student.text =a.ToString();
|
||||
}
|
||||
/// <summary>
|
||||
/// 修改撤离方案的介绍
|
||||
/// </summary>
|
||||
/// <param name="str">内容</param>
|
||||
/// <param name="a">A=1,B=2,C=3选项</param>
|
||||
public void FixFled(string str,int a)
|
||||
{
|
||||
switch (a)
|
||||
{
|
||||
case 1:
|
||||
RightText1.text = str;
|
||||
break;
|
||||
case 2:
|
||||
RightText2.text = str;
|
||||
break;
|
||||
case 3:
|
||||
RightText3.text = str;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 撤离方案选择
|
||||
/// </summary>
|
||||
/// <param name="change">A-1 B-2 C-3</param>
|
||||
public void OnToggleChanged(Toggle changedToggle)
|
||||
{
|
||||
if (changedToggle.isOn)
|
||||
{
|
||||
if (changedToggle == DialogboxA)
|
||||
{
|
||||
Debug.Log("Toggle 1 is selected");
|
||||
}
|
||||
else if (changedToggle == DialogboxB)
|
||||
{
|
||||
Debug.Log("Toggle 2 is selected");
|
||||
}
|
||||
else if (changedToggle == DialogboxC)
|
||||
{
|
||||
Debug.Log("Toggle 3 is selected");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 已经安全撤离的班级 上报总指 按钮事件
|
||||
/// </summary>
|
||||
public void SumbitButton()
|
||||
{
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 未安全撤离的班级 上报总指 按钮事件
|
||||
/// </summary>
|
||||
public void Sumbit2Button()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Close()
|
||||
{
|
||||
DiaLogBox2?.SetActive(false);
|
||||
DiaLogBox?.SetActive(false);
|
||||
}
|
||||
}
|
11
xiaofang/Assets/Script/UI/ZZZZZZ/ZZUIManager.cs.meta
Normal file
11
xiaofang/Assets/Script/UI/ZZZZZZ/ZZUIManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f09f97107d8fe4b4caf814aaa73212a8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user