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

161 lines
4.4 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Submit : MonoBehaviour
{
/// <summary>
/// 练习模式图片
/// </summary>
private Sprite practicesprite;
/// <summary>
/// 考核模式图片
/// </summary>
private Sprite examinesprite;
/// <summary>
/// 考核练习图片
/// </summary>
public Image practicemode;
/// <summary>
/// 步骤列表
/// </summary>
public GameObject taskstep;
/// <summary>
/// 考试和训练内容
/// </summary>
public GameObject contractreversionpanl;
/// <summary>
/// 提交按钮
/// </summary>
public Button submitbutton;
/// <summary>
/// 交卷按钮
/// </summary>
public Button onvolumebutton;
/// <summary>
/// 练习的分页面
/// </summary>
public GameObject practicepanl;
/// <summary>
/// 考试分数
/// </summary>
public Text marktext;
/// <summary>
/// 返回按钮
/// </summary>
public Button backbutton;
/// <summary>
/// 操作步骤还原
/// </summary>
public Transform thesecondsteppanl, thethirdsteppanl, stepfourpanl, thefifthsteppanl, stepsixpanl, stepsevenpanl, stepeightpanl;
private void Awake()
{
practicesprite = Resources.Load<Sprite>("UIpanel/练习模式");
examinesprite = Resources.Load<Sprite>("UIpanel/考试模式");
if (ScoreManager.Instance.judgmentbos)
{
practicemode.sprite = examinesprite;
onvolumebutton.gameObject.SetActive(true);
}
else
{
practicemode.sprite = practicesprite;
submitbutton.gameObject.SetActive(true);
}
}
void Start()
{
submitbutton.onClick.AddListener(() =>
{
practicemode.gameObject.SetActive(false);
taskstep.SetActive(false);
contractreversionpanl.SetActive(false);
marktext.text = ScoreManager.Instance.Score.ToString();
practicepanl.SetActive(true);
});
backbutton.onClick.AddListener(() =>
{
practicepanl.SetActive(false);
practicemode.gameObject.SetActive(true);
taskstep.SetActive(true);
contractreversionpanl.SetActive(true);
ScoreManager.Instance.SubtractScore(100);
Inactivation(contractreversionpanl.transform);
});
}
public void Inactivation(Transform pos)
{
for (int i = 0; i < pos.childCount; i++)
{
Transform pront = pos.GetChild(i);
if (i > 0)
{
pront.gameObject.SetActive(false);
}
}
pos.transform.GetChild(0).gameObject.SetActive(true);
for (int i = 0; i < thesecondsteppanl.childCount; i++)
{
Transform pront2 = thefifthsteppanl.GetChild(i);
if (i > 0)
{
pront2.gameObject.SetActive(false);
}
}
for (int i = 0; i < thethirdsteppanl.childCount; i++)
{
Transform pront3 = thethirdsteppanl.GetChild(i);
if (i > 0)
{
pront3.gameObject.SetActive(false);
}
}
for (int i = 0; i < stepfourpanl.childCount; i++)
{
Transform pront4 = stepfourpanl.GetChild(i);
if (i > 0)
{
pront4.gameObject.SetActive(false);
}
}
for (int i = 0; i < thefifthsteppanl.childCount; i++)
{
Transform pront5 = thefifthsteppanl.GetChild(i);
if (i > 0)
{
pront5.gameObject.SetActive(false);
}
}
for (int i = 0; i < stepsixpanl.childCount; i++)
{
Transform pront6 = stepsixpanl.GetChild(i);
if (i > 0)
{
pront6.gameObject.SetActive(false);
}
}
for (int i = 0; i < stepsevenpanl.childCount; i++)
{
Transform pront7 = stepsevenpanl.GetChild(i);
if (i > 0)
{
pront7.gameObject.SetActive(false);
}
}
for (int i = 0; i < stepeightpanl.childCount; i++)
{
Transform pront8 = stepeightpanl.GetChild(i);
if (i > 0)
{
pront8.gameObject.SetActive(false);
}
}
}
void Update()
{
}
}