using System; using System.Collections; using System.Collections.Generic; using System.Runtime.ConstrainedExecution; using UnityEngine; using UnityEngine.UI; using UnityEngine.Windows; public enum Enable { Getoutofline1, Getoutofline2, Getoutofline3, Getoutofline4, } public class Thethirdsteppanl : MonoBehaviour { /// /// 工单初始页面显示 /// public RectTransform thirdoperationpanl1; /// /// 复制输入框文本 /// public InputField inputFieldname; /// /// 发送工资的按钮 /// public Button workorderviewbutton; /// /// 显示查询页面 /// public RectTransform thirdoperationpanl2; /// /// 输入工单编号框 /// public InputField inputmbuer; /// /// 查询按钮 /// public Button viewbuton; /// /// 人员选择界面 /// public RectTransform thirdoperationpanl3; /// /// 人员高亮显示 /// public Toggle toggleiamge1; /// /// 人员图片显示 /// public Image imagelxs; /// /// 合同违约按钮 /// public Button breachofcontractbutton; /// /// 签收按钮 /// public Button signforbutton; /// /// 显示签收成功按钮 /// public Image signforimage; /// /// 用于判断签收之后不多次加分 /// private bool signisp = true; /// /// 有无违约页面 /// public RectTransform thirdoperationpanl4; /// /// 传递参数的文本 /// public Text receivetext1, receivetext2, receivetext3; /// /// 高亮显示 /// public Toggle togglepromise; public Toggle notoggle; /// /// 显示的图片 /// public Image weiyue; /// /// 页面五信息页面 /// public RectTransform thirdoperationpanl5; /// /// 信息页面按钮 /// public Button messagebutton; /// /// 页面六工程编号填写 /// public RectTransform thirdoperationpanl6; /// /// 输入工单编号框 /// public InputField inputid; /// /// 查询按钮 /// public Button inquirebutton2; /// /// 页面7查询信息页面 /// public RectTransform thirdoperationpanl7; /// /// 点击信息按钮 /// public Button tapbutton; /// /// 页面8确认按钮页面 /// public RectTransform thirdoperationpanl8; /// /// 确认按钮 /// public Button verifybutton; /// /// 页面9违约类型 /// public RectTransform thirdoperationpanl9; /// /// 违约按钮 /// public Button verifybutton3; /// /// 选择违约项 /// public Toggle electricitytoggle1, electricitytoggle2, electricitytoggle3, electricitytoggle4; /// /// 页面10违约内容显示 /// public RectTransform thirdoperationpanl10; /// /// 违约确认按钮 /// public Button verifybutton4; /// /// 违约行为选项 /// public Toggle breachtoggle1, breachtoggle2, breachtoggle3; /// /// 页面11 /// public RectTransform thirdoperationpanl11; /// /// 是否违约下拉框 /// public Dropdown glideinput1, glideinput2, glideinput3, glideinput4; /// /// 输入违约内容 /// public InputField textinput1, textinput2; /// /// 用枚举判断选那个下拉框 /// Enable enable = Enable.Getoutofline1; /// /// 输入日期按钮 /// public InputField inputdata; /// /// 保存按钮的 /// public Button savebutton; /// /// 发送按钮 /// public Button cancelbutton; /// /// 判断是否选择正确加分 /// private bool cancelisp = true; /// /// 提示文本 /// public Text tipstext2; // 定义日期格式,可以根据需要添加更多格式 private string[] dateFormats = new string[] { "yyyy-MM-dd", "dd/MM/yyyy", "MM/dd/yyyy" }; /// /// 页面12 /// public RectTransform thirdoperationpanl12; /// /// 收集按钮 /// public Button collectbutton; /// /// 资料上传按钮 /// public Button profilebutton; /// /// 页面13 /// public RectTransform thirdoperationpanl13; /// /// 确认资料按钮 /// public Button verifybutton5; /// /// 页面14 /// public RectTransform thirdoperationpanl14; /// /// 保存按钮 /// public Button savebutton2; /// /// 页面15 /// public RectTransform thirdoperationpanl15; /// /// 发送按钮 /// public Button sendbutton; void Start() { workorderviewbutton.onClick.AddListener(() => { signisp = true; cancelisp = true; thirdoperationpanl1.gameObject.SetActive(false); thirdoperationpanl2.gameObject.SetActive(true); }); viewbuton.onClick.AddListener(() => { thirdoperationpanl2.gameObject.SetActive(false); thirdoperationpanl3.gameObject.SetActive(true); }); toggleiamge1.onValueChanged.AddListener((ison) => { if (ison) { ScoreManager.Instance.AddScore(1); imagelxs.gameObject.SetActive(true); } else { ScoreManager.Instance.SubtractScore(1); imagelxs.gameObject.SetActive(false); } }); breachofcontractbutton.onClick.AddListener(() => { thirdoperationpanl3.gameObject.SetActive(false); thirdoperationpanl4.gameObject.SetActive(true); }); togglepromise.onValueChanged.AddListener(delegate { ToggleValueChanged(togglepromise); }); notoggle.onValueChanged.AddListener(delegate { ToggleValueChanged2(notoggle); }); messagebutton.onClick.AddListener(() => { thirdoperationpanl5.gameObject.SetActive(false); thirdoperationpanl6.gameObject.SetActive(true); }); inquirebutton2.onClick.AddListener(() => { thirdoperationpanl6.gameObject.SetActive(false); thirdoperationpanl7.gameObject.SetActive(true); }); tapbutton.onClick.AddListener(() => { thirdoperationpanl7.gameObject.SetActive(false); thirdoperationpanl8.gameObject.SetActive(true); }); verifybutton.onClick.AddListener(() => { thirdoperationpanl8.gameObject.SetActive(false); thirdoperationpanl9.gameObject.SetActive(true); }); glideinput1.onValueChanged.AddListener(delegate { Status(Enable.Getoutofline1); }); glideinput2.onValueChanged.AddListener(delegate { Status(Enable.Getoutofline2); }); glideinput3.onValueChanged.AddListener(delegate { Status(Enable.Getoutofline3); }); glideinput4.onValueChanged.AddListener(delegate { Status(Enable.Getoutofline4); }); savebutton.onClick.AddListener(Getsave); cancelbutton.onClick.AddListener(() => { if (glideinput1.options[glideinput1.value].text == "否" && glideinput2.options[glideinput2.value].text == "否" && glideinput2.options[glideinput2.value].text == "否" && glideinput2.options[glideinput2.value].text == "否" && cancelisp) { ScoreManager.Instance.AddScore(4); Debug.LogError(ScoreManager.Instance.Score); cancelisp = false; } thirdoperationpanl11.gameObject.SetActive(false); thirdoperationpanl12.gameObject.SetActive(true); }); collectbutton.onClick.AddListener(() => { thirdoperationpanl12.gameObject.SetActive(false); thirdoperationpanl13.gameObject.SetActive(true); }); verifybutton5.onClick.AddListener(() => { thirdoperationpanl13.gameObject.SetActive(false); thirdoperationpanl14.gameObject.SetActive(true); }); savebutton2.onClick.AddListener(() => { thirdoperationpanl14.gameObject.SetActive(false); thirdoperationpanl15.gameObject.SetActive(true); }); sendbutton.onClick.AddListener(() => { thirdoperationpanl15.gameObject.SetActive(false); }); signforbutton.onClick.AddListener(() => { if (signisp) { ScoreManager.Instance.AddScore(2); signisp = false; } signforimage.gameObject.SetActive(true); Invoke("Getimage", 1.5f); }); electricitytoggle1.onValueChanged.AddListener((ison) => { if (ison) { ScoreManager.Instance.AddScore(3); thirdoperationpanl9.gameObject.SetActive(false); thirdoperationpanl10.gameObject.SetActive(true); } else { ScoreManager.Instance.SubtractScore(3); } }); electricitytoggle2.onValueChanged.AddListener((ison) => { if (ison) { thirdoperationpanl9.gameObject.SetActive(false); thirdoperationpanl11.gameObject.SetActive(true); } }); electricitytoggle3.onValueChanged.AddListener((ison) => { if (ison) { thirdoperationpanl9.gameObject.SetActive(false); thirdoperationpanl11.gameObject.SetActive(true); } }); electricitytoggle4.onValueChanged.AddListener((ison) => { if (ison) { thirdoperationpanl9.gameObject.SetActive(false); thirdoperationpanl11.gameObject.SetActive(true); } }); breachtoggle1.onValueChanged.AddListener((ison) => { if (ison) { thirdoperationpanl10.gameObject.SetActive(false); thirdoperationpanl11.gameObject.SetActive(true); } }); breachtoggle2.onValueChanged.AddListener((ison) => { if (ison) { ScoreManager.Instance.AddScore(1); thirdoperationpanl10.gameObject.SetActive(false); thirdoperationpanl11.gameObject.SetActive(true); } else { ScoreManager.Instance.SubtractScore(1); } }); breachtoggle3.onValueChanged.AddListener((ison) => { if (ison) { thirdoperationpanl10.gameObject.SetActive(false); thirdoperationpanl11.gameObject.SetActive(true); } }); } /// /// 一定时间后失活图片 /// public void Getimage() { signforimage.gameObject.SetActive(false); } /// /// 判断是否符合保存条件 /// private void Getsave() { DateTime dateValue; if (DateTime.TryParseExact(inputdata.text, dateFormats, null, System.Globalization.DateTimeStyles.None, out dateValue)) { tipstext2.text = "保存成功"; Invoke("Cleartext", 1.5f); } else { tipstext2.text = "输入完成信息"; Invoke("Cleartext", 1.5f); } } private void Cleartext() { tipstext2.text = ""; } /// /// 初始化页面 /// /// /// /// public void Getvalue(string str, string str1, string str2) { receivetext1.text = str; receivetext2.text = str1; receivetext3.text = str2; } /// /// 图片显示高亮 /// public void ToggleValueChanged(Toggle toggle) { if (toggle.isOn) { ScoreManager.Instance.AddScore(1.5f); thirdoperationpanl4.gameObject.SetActive(false); thirdoperationpanl5.gameObject.SetActive(true); } else { ScoreManager.Instance.SubtractScore(1.5f); thirdoperationpanl4.gameObject.SetActive(true); thirdoperationpanl5.gameObject.SetActive(false); } } public void ToggleValueChanged2(Toggle toggle) { if (toggle.isOn) { thirdoperationpanl4.gameObject.SetActive(false); thirdoperationpanl5.gameObject.SetActive(true); } else { thirdoperationpanl4.gameObject.SetActive(true); thirdoperationpanl5.gameObject.SetActive(false); } } /// /// 用枚举判断选择了那个选项框 /// public void Status(Enable enable) { switch (enable) { case Enable.Getoutofline1: Debug.Log("1"); glideinput1.captionText.text = glideinput1.options[glideinput1.value].text; break; case Enable.Getoutofline2: Debug.Log("2"); glideinput2.captionText.text = glideinput2.options[glideinput2.value].text; break; case Enable.Getoutofline3: Debug.Log("3"); glideinput3.captionText.text = glideinput3.options[glideinput3.value].text; break; case Enable.Getoutofline4: Debug.Log("4"); glideinput4.captionText.text = glideinput4.options[glideinput4.value].text; break; default: break; } } /// /// 初始话页面按钮 /// public void Getrestore3() { inputmbuer.text = null; imagelxs.gameObject.SetActive(false); toggleiamge1.isOn = false; togglepromise.isOn = false; notoggle.isOn = false; electricitytoggle1.isOn = false; electricitytoggle2.isOn = false; electricitytoggle3.isOn = false; electricitytoggle4.isOn = false; breachtoggle1.isOn = false; breachtoggle2.isOn = false; breachtoggle3.isOn = false; glideinput1.value = 1; glideinput2.value = 1; glideinput3.value = 1; glideinput4.value = 1; textinput1.text = null; textinput2.text = null; inputdata.text = null; } void Update() { } }