ShanxiKnowledgeBase/SXElectricity Marketing 2.0/Assets/Zion/Scripts/YL/Thethirdsteppanl.cs

610 lines
17 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.ConstrainedExecution;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Windows;
public enum Enable
{
Getoutofline1,
Getoutofline2,
Getoutofline3,
Getoutofline4,
}
public class Thethirdsteppanl : MonoBehaviour
{
/// <summary>
/// 工单初始页面显示
/// </summary>
public RectTransform thirdoperationpanl1;
/// <summary>
/// 复制输入框文本
/// </summary>
public InputField inputFieldname;
/// <summary>
/// 发送工资的按钮
/// </summary>
public Button workorderviewbutton;
/// <summary>
/// 显示查询页面
/// </summary>
public RectTransform thirdoperationpanl2;
/// <summary>
/// 输入工单编号框
/// </summary>
public InputField inputmbuer;
/// <summary>
/// 查询按钮
/// </summary>
public Button viewbuton;
/// <summary>
/// 人员选择界面
/// </summary>
public RectTransform thirdoperationpanl3;
/// <summary>
/// 人员高亮显示
/// </summary>
public Toggle toggleiamge1;
/// <summary>
/// 人员图片显示
/// </summary>
public Image imagelxs;
/// <summary>
/// 合同违约按钮
/// </summary>
public Button breachofcontractbutton;
/// <summary>
/// 签收按钮
/// </summary>
public Button signforbutton;
private bool ispsign = true;
/// <summary>
/// 显示签收成功按钮
/// </summary>
public Image signforimage;
/// <summary>
/// 用于判断签收之后不多次加分
/// </summary>
private bool signisp = true;
/// <summary>
/// 有无违约页面
/// </summary>
public RectTransform thirdoperationpanl4;
/// <summary>
/// 传递参数的文本
/// </summary>
public Text receivetext1, receivetext2, receivetext3;
/// <summary>
/// 高亮显示
/// </summary>
public Toggle togglepromise;
public Toggle notoggle;
/// <summary>
/// 显示的图片
/// </summary>
public Image weiyue;
/// <summary>
/// 页面五信息页面
/// </summary>
public RectTransform thirdoperationpanl5;
/// <summary>
/// 信息页面按钮
/// </summary>
public Button messagebutton;
/// <summary>
/// 页面六工程编号填写
/// </summary>
public RectTransform thirdoperationpanl6;
/// <summary>
/// 输入工单编号框
/// </summary>
public InputField inputid;
/// <summary>
/// 查询按钮
/// </summary>
public Button inquirebutton2;
/// <summary>
/// 页面7查询信息页面
/// </summary>
public RectTransform thirdoperationpanl7;
/// <summary>
/// 点击信息按钮
/// </summary>
public Button tapbutton;
/// <summary>
/// 页面8确认按钮页面
/// </summary>
public RectTransform thirdoperationpanl8;
/// <summary>
/// 确认按钮
/// </summary>
public Button verifybutton;
/// <summary>
/// 页面9违约类型
/// </summary>
public RectTransform thirdoperationpanl9;
/// <summary>
/// 违约按钮
/// </summary>
public Button verifybutton3;
/// <summary>
/// 选择违约项
/// </summary>
public Toggle electricitytoggle1, electricitytoggle2, electricitytoggle3, electricitytoggle4;
/// <summary>
/// 页面10违约内容显示
/// </summary>
public RectTransform thirdoperationpanl10;
/// <summary>
/// 违约确认按钮
/// </summary>
public Button verifybutton4;
/// <summary>
/// 违约行为选项
/// </summary>
public Toggle breachtoggle1, breachtoggle2, breachtoggle3;
/// <summary>
/// 页面11
/// </summary>
public RectTransform thirdoperationpanl11;
/// <summary>
/// 是否违约下拉框
/// </summary>
public Dropdown glideinput1, glideinput2, glideinput3, glideinput4;
/// <summary>
/// 输入违约内容
/// </summary>
public InputField textinput1, textinput2;
/// <summary>
/// 用枚举判断选那个下拉框
/// </summary>
Enable enable = Enable.Getoutofline1;
/// <summary>
/// 输入日期按钮
/// </summary>
public InputField inputdata;
/// <summary>
/// 保存按钮的
/// </summary>
public Button savebutton;
/// <summary>
/// 发送按钮
/// </summary>
public Button cancelbutton;
/// <summary>
/// 提示文本
/// </summary>
public Text tipstext2;
// 定义日期格式,可以根据需要添加更多格式
private string[] dateFormats = new string[] { "yyyy-MM-dd", "dd/MM/yyyy", "MM/dd/yyyy" };
/// <summary>
/// 页面12
/// </summary>
public RectTransform thirdoperationpanl12;
/// <summary>
/// 收集按钮
/// </summary>
public Button collectbutton;
/// <summary>
/// 资料上传按钮
/// </summary>
public Button profilebutton;
/// <summary>
/// 页面13
/// </summary>
public RectTransform thirdoperationpanl13;
/// <summary>
/// 确认资料按钮
/// </summary>
public Button verifybutton5;
/// <summary>
/// 页面14
/// </summary>
public RectTransform thirdoperationpanl14;
/// <summary>
/// 保存按钮
/// </summary>
public Button savebutton2;
/// <summary>
/// 页面15
/// </summary>
public RectTransform thirdoperationpanl15;
/// <summary>
/// 发送按钮
/// </summary>
public Button sendbutton;
/// <summary>
/// 第三步得分
/// </summary>
private float thethirdstep1 = 0;
private float thethirdstep2 = 0;
private float thethirdstep3 = 0;
private float thethirdstep4 = 0;
private float thethirdstep5 = 0;
private float thethirdstep6 = 0;
void Start()
{
workorderviewbutton.onClick.AddListener(() =>
{
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)
{
imagelxs.gameObject.SetActive(true);
}
else
{
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(() =>
{
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(() =>
{
Debug.Log("第三步得分");
if (ScoreManager.Instance.Subject == Subject.Performanceexercise ||
ScoreManager.Instance.Subject == Subject.Electricchargeexercise ||
ScoreManager.Instance.Subject == Subject.Aluminoelectricexercise)
{
Practicescore3();
}
if (ScoreManager.Instance.Subject == Subject.Performanceexamination)
{
Judgmentstep3();
}
thirdoperationpanl15.gameObject.SetActive(false);
});
signforbutton.onClick.AddListener(() =>
{
ispsign = true;
signforimage.gameObject.SetActive(true);
Invoke("Getimage", 1.5f);
});
electricitytoggle1.onValueChanged.AddListener((ison) =>
{
if (ison)
{
thirdoperationpanl9.gameObject.SetActive(false);
thirdoperationpanl10.gameObject.SetActive(true);
}
});
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)
{
thirdoperationpanl10.gameObject.SetActive(false);
thirdoperationpanl11.gameObject.SetActive(true);
}
});
breachtoggle3.onValueChanged.AddListener((ison) =>
{
if (ison)
{
thirdoperationpanl10.gameObject.SetActive(false);
thirdoperationpanl11.gameObject.SetActive(true);
}
});
}
/// <summary>
/// 练习步骤得分
/// </summary>
private void Practicescore3()
{
if (toggleiamge1.isOn)
{
ScoreManager.Instance.AddScore(2.5f);//页面勾选
}
if (ispsign)
{
ScoreManager.Instance.AddScore(2);//页面签到
}
if (togglepromise.isOn)
{
ScoreManager.Instance.AddScore(2f);//是否违约
}
if (electricitytoggle1.isOn)
{
ScoreManager.Instance.AddScore(2);//是否是窃电类型
}
if (breachtoggle2.isOn)
{
ScoreManager.Instance.AddScore(2);
}
if (glideinput1.captionText.text == "否" && glideinput2.captionText.text == "否" && glideinput3.captionText.text == "否" && glideinput4.captionText.text == "否")
{
ScoreManager.Instance.AddScore(2);
}
}
/// <summary>
/// 考试步骤得分
/// </summary>
private void Judgmentstep3()
{
float score = 0f;
string str;
if (toggleiamge1.isOn)
{
score += (float.Parse(ScoreManager.Instance.totalpoints[2]) * 0.2f);
}
if (ispsign)
{
score += (float.Parse(ScoreManager.Instance.totalpoints[2]) * 0.16f);
}
if (togglepromise.isOn)
{
score += (float.Parse(ScoreManager.Instance.totalpoints[2]) * 0.16f);
}
if (electricitytoggle1.isOn)
{
score += (float.Parse(ScoreManager.Instance.totalpoints[2]) * 0.16f);
}
if (breachtoggle2.isOn)
{
score += (float.Parse(ScoreManager.Instance.totalpoints[2]) * 0.16f);
}
if (glideinput1.captionText.text == "否" && glideinput2.captionText.text == "否" && glideinput3.captionText.text == "否" && glideinput4.captionText.text == "否")
{
score += (float.Parse(ScoreManager.Instance.totalpoints[2]) * 0.16f);
}
if (score- Mathf.Floor(score)< 0.001f)
{
str = score.ToString();
}
else
{
str = score.ToString("0.000");
}
ScoreManager.Instance.Honourscores[2] = float.Parse(str);
}
/// <summary>
/// 一定时间后失活图片
/// </summary>
public void Getimage()
{
signforimage.gameObject.SetActive(false);
}
/// <summary>
/// 判断是否符合保存条件
/// </summary>
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 = "";
}
/// <summary>
/// 初始化页面
/// </summary>
/// <param name="str"></param>
/// <param name="str1"></param>
/// <param name="str2"></param>
public void Getvalue(string str, string str1, string str2)
{
receivetext1.text = str;
receivetext2.text = str1;
receivetext3.text = str2;
}
/// <summary>
/// 图片显示高亮
/// </summary>
public void ToggleValueChanged(Toggle toggle)
{
if (toggle.isOn)
{
thirdoperationpanl4.gameObject.SetActive(false);
thirdoperationpanl5.gameObject.SetActive(true);
}
else
{
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);
}
}
/// <summary>
/// 用枚举判断选择了那个选项框
/// </summary>
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;
}
}
/// <summary>
/// 初始话页面按钮
/// </summary>
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()
{
}
}