360 lines
9.1 KiB
C#
360 lines
9.1 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Xml.Serialization;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class Signforpanl : MonoBehaviour
|
|
{
|
|
/// <summary>
|
|
/// 第二步操作步骤页面
|
|
/// </summary>
|
|
public GameObject workordernumber;
|
|
/// <summary>
|
|
/// 工作看板按钮
|
|
/// </summary>
|
|
public Button workpanelbtn;
|
|
/// <summary>
|
|
/// 代办工单页面
|
|
/// </summary>
|
|
public RectTransform agencyworkorder;
|
|
/// <summary>
|
|
/// 代办工单按钮
|
|
/// </summary>
|
|
public Button workorderbutton;
|
|
/// <summary>
|
|
/// 工单输入编号面板
|
|
/// </summary>
|
|
public RectTransform incomingworkorder;
|
|
/// <summary>
|
|
/// 工单输入框编号
|
|
/// </summary>
|
|
public InputField workorderentry;
|
|
/// <summary>
|
|
/// 查询按钮
|
|
/// </summary>
|
|
public Button inquirebutton;
|
|
/// <summary>
|
|
/// 违约特工面板
|
|
/// </summary>
|
|
public RectTransform breachofcontract;
|
|
/// <summary>
|
|
/// 违约派工高亮图片
|
|
/// </summary>
|
|
public Image reveal1;
|
|
/// <summary>
|
|
/// 高亮图片选择
|
|
/// </summary>
|
|
public Toggle revealtoggle2;
|
|
public Image reveal2;
|
|
/// <summary>
|
|
/// 违约派工按钮
|
|
/// </summary>
|
|
public Button dispatchbutton;
|
|
/// <summary>
|
|
/// 签收页面
|
|
/// </summary>
|
|
public RectTransform signforpanl;
|
|
/// <summary>
|
|
/// 文本传递的内容
|
|
/// </summary>
|
|
public Text contenttext1;
|
|
public Text contenttext2;
|
|
public Text contenttext3;
|
|
/// <summary>
|
|
/// 签收确认按钮
|
|
/// </summary>
|
|
public Button isbutton;
|
|
private bool ispbool;
|
|
/// <summary>
|
|
/// 否定签收按钮
|
|
/// </summary>
|
|
public Button nobutton;
|
|
/// <summary>
|
|
/// 显示查看信息页面
|
|
/// </summary>
|
|
public RectTransform controlspanl1;
|
|
/// <summary>
|
|
/// 传递文本内容
|
|
/// </summary>
|
|
public Text contenttext4, contenttext5, contenttext6;
|
|
/// <summary>
|
|
/// 查看人员信息按钮
|
|
/// </summary>
|
|
public Button viewbutton;
|
|
/// <summary>
|
|
/// 确认按钮
|
|
/// </summary>
|
|
public Button verifybutton2;
|
|
/// <summary>
|
|
/// 遮挡名字图片
|
|
/// </summary>
|
|
public Image zhednag;
|
|
/// <summary>
|
|
/// 显示名字文本
|
|
/// </summary>
|
|
public Text nametext;
|
|
/// <summary>
|
|
/// 派工按钮
|
|
/// </summary>
|
|
public Button sendworkbutton;
|
|
/// <summary>
|
|
/// 查找人员信息页面
|
|
/// </summary>
|
|
public RectTransform controlspanl2;
|
|
/// <summary>
|
|
/// 人员输入列表
|
|
/// </summary>
|
|
public InputField inputname;
|
|
/// <summary>
|
|
/// 人员查询按钮
|
|
/// </summary>
|
|
public Button inquirebuton;
|
|
/// <summary>
|
|
/// 高亮选择
|
|
/// </summary>
|
|
public Toggle Toggle1, Toggle2, Toggle3, Toggle4, Toggle5;
|
|
/// <summary>
|
|
/// 确认按钮
|
|
/// </summary>
|
|
public Button okbutton;
|
|
/// <summary>
|
|
/// 显示人员信息面板
|
|
/// </summary>
|
|
public RectTransform controlspanl3;
|
|
/// <summary>
|
|
/// 点击确认按钮
|
|
/// </summary>
|
|
public Button verifybutton;
|
|
/// <summary>
|
|
/// 第三步步骤显示
|
|
/// </summary>
|
|
public RectTransform thethirdsteppanl;
|
|
/// <summary>
|
|
/// 选择人员判分
|
|
/// </summary>
|
|
public Toggle personneltoggle;
|
|
|
|
void Start()
|
|
{
|
|
init();
|
|
verifybutton2.onClick.AddListener(() =>
|
|
{
|
|
controlspanl2.gameObject.SetActive(false);
|
|
controlspanl1.gameObject.SetActive(true);
|
|
});
|
|
inquirebuton.onClick.AddListener(() =>
|
|
{
|
|
if (inputname.text.Contains("原"))
|
|
{
|
|
controlspanl2.gameObject.SetActive(false);
|
|
controlspanl3.gameObject.SetActive(true);
|
|
}
|
|
});
|
|
|
|
verifybutton.onClick.AddListener(() =>
|
|
{
|
|
controlspanl3.gameObject.SetActive(false);
|
|
zhednag.gameObject.SetActive(true);
|
|
nametext.gameObject.SetActive(true);
|
|
controlspanl1.gameObject.SetActive(true);
|
|
});
|
|
sendworkbutton.onClick.AddListener(Stepbystep);
|
|
okbutton.onClick.AddListener(() =>
|
|
{
|
|
controlspanl2.gameObject.SetActive(false);
|
|
controlspanl1.gameObject.SetActive(true);
|
|
});
|
|
}
|
|
/// <summary>
|
|
/// 初始化
|
|
/// </summary>
|
|
private void init()
|
|
{
|
|
workpanelbtn.onClick.AddListener(() =>
|
|
{
|
|
workordernumber.SetActive(false);
|
|
agencyworkorder.gameObject.SetActive(true);
|
|
});
|
|
workorderbutton.onClick.AddListener(() =>
|
|
{
|
|
agencyworkorder.gameObject.SetActive(false);
|
|
incomingworkorder.gameObject.SetActive(true);
|
|
|
|
});
|
|
inquirebutton.onClick.AddListener(() =>
|
|
{
|
|
|
|
incomingworkorder.gameObject.SetActive(false);
|
|
breachofcontract.gameObject.SetActive(true);
|
|
|
|
});
|
|
dispatchbutton.onClick.AddListener(Pagepanl);//第二步结束算分
|
|
revealtoggle2.onValueChanged.AddListener(delegate
|
|
{
|
|
Getpicture(revealtoggle2);
|
|
});
|
|
EquippingItems();
|
|
CanceItems();
|
|
EquippingItems2();
|
|
}
|
|
/// <summary>
|
|
/// 高亮图片选择
|
|
/// </summary>
|
|
/// <param name="toggle">toggle组件</param>
|
|
public void Getpicture(Toggle toggle)
|
|
{
|
|
if (toggle.isOn)
|
|
{
|
|
reveal1.gameObject.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
reveal1.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 签收页面和查看人员页面
|
|
/// </summary>
|
|
private void Pagepanl()
|
|
{
|
|
breachofcontract.gameObject.SetActive(false);
|
|
signforpanl.gameObject.SetActive(true);
|
|
}
|
|
/// <summary>
|
|
/// 传递参数
|
|
/// </summary>
|
|
/// <param name="str1"></param>
|
|
/// <param name="str2"></param>
|
|
/// <param name="str3"></param>
|
|
public void Passbyvalue(string str1, string str2, string str3)
|
|
{
|
|
contenttext1.text = str1;
|
|
contenttext2.text = str2;
|
|
contenttext3.text = str3;
|
|
}
|
|
/// <summary>
|
|
/// 签收按钮
|
|
/// </summary>
|
|
public void EquippingItems()
|
|
{
|
|
isbutton.onClick.AddListener(() =>
|
|
{
|
|
ispbool = true;
|
|
signforpanl.gameObject.SetActive(false);
|
|
controlspanl1.gameObject.SetActive(true);
|
|
});
|
|
}
|
|
/// <summary>
|
|
/// 不签收按钮
|
|
/// </summary>
|
|
public void CanceItems()
|
|
{
|
|
nobutton.onClick.AddListener(() =>
|
|
{
|
|
ispbool = false;
|
|
signforpanl.gameObject.SetActive(false);
|
|
controlspanl1.gameObject.SetActive(true);
|
|
});
|
|
}
|
|
/// <summary>
|
|
/// 初始化文本
|
|
/// </summary>
|
|
/// <param name="str1"></param>
|
|
/// <param name="str2"></param>
|
|
/// <param name="str3"></param>
|
|
public void Getvalue(string str1, string str2, string str3)
|
|
{
|
|
contenttext4.text = str1;
|
|
contenttext5.text = str2;
|
|
contenttext6.text = str3;
|
|
}
|
|
public void EquippingItems2()
|
|
{
|
|
viewbutton.onClick.AddListener(() =>
|
|
{
|
|
controlspanl1.gameObject.SetActive(false);
|
|
controlspanl2.gameObject.SetActive(true);
|
|
});
|
|
}
|
|
/// <summary>
|
|
/// 初始化页面
|
|
/// </summary>
|
|
public void Getrestore2()
|
|
{
|
|
inputname.text = null;
|
|
Toggle1.isOn = false;
|
|
Toggle2.isOn = false;
|
|
Toggle3.isOn = false;
|
|
Toggle4.isOn = false;
|
|
Toggle5.isOn = false;
|
|
}
|
|
/// <summary>
|
|
/// 步骤分
|
|
/// </summary>
|
|
public void Stepbystep()
|
|
{
|
|
Debug.Log("第二步得分");
|
|
if (ScoreManager.Instance.Subject == Subject.Performanceexercise ||
|
|
ScoreManager.Instance.Subject == Subject.Electricchargeexercise ||
|
|
ScoreManager.Instance.Subject == Subject.Aluminoelectricexercise)
|
|
{
|
|
Practicescore2();
|
|
}
|
|
if (ScoreManager.Instance.Subject == Subject.Performanceexamination)
|
|
{
|
|
Judgmentstep2();//判断考试步骤分
|
|
}
|
|
controlspanl1.gameObject.SetActive(false);
|
|
thethirdsteppanl.gameObject.SetActive(true);
|
|
}
|
|
/// <summary>
|
|
/// 练习步骤得分
|
|
/// </summary>
|
|
private void Practicescore2()
|
|
{
|
|
if (revealtoggle2.isOn)
|
|
{
|
|
ScoreManager.Instance.AddScore(2.5f);
|
|
}
|
|
if (ispbool)
|
|
{
|
|
ScoreManager.Instance.AddScore(2.5f);
|
|
}
|
|
if (personneltoggle.isOn)
|
|
{
|
|
ScoreManager.Instance.AddScore(7.5f);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 考试步骤得分
|
|
/// </summary>
|
|
private void Judgmentstep2()
|
|
{
|
|
float score = 0;
|
|
string str;
|
|
if (revealtoggle2.isOn)
|
|
{
|
|
score += (float.Parse(ScoreManager.Instance.totalpoints[1]) * 0.2f);
|
|
}
|
|
if (ispbool)
|
|
{
|
|
score += (float.Parse(ScoreManager.Instance.totalpoints[1]) * 0.2f);
|
|
}
|
|
if (personneltoggle.isOn)
|
|
{
|
|
score += (float.Parse(ScoreManager.Instance.totalpoints[1]) * 0.6f);
|
|
}
|
|
if ((score - Mathf.Floor(score)) < 0.001f)
|
|
{
|
|
str = score.ToString();
|
|
}
|
|
else
|
|
{
|
|
str = score.ToString("0.000");
|
|
}
|
|
ScoreManager.Instance.Honourscores[1] = float.Parse(str);
|
|
}
|
|
}
|