天津23维预案
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

101 lines
4.3 KiB

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using AX.MessageSystem;
using AX.TrackRecord;
public class TeamNameToggle : MonoBehaviour {
private EditForceName editName;
[HideInInspector]
public string EditName = "";
void Start ()
{
this.gameObject.GetComponent<Toggle>().group = this.transform.parent.gameObject.GetComponent<ToggleGroup>();
if (ExamInfoHelpClass.applicationMode == ExamInfoHelpClass.ApplicationMode.PATHFINDING && (ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.CopyQuestion ||
ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.CreatQuestion ||
ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.EditQuestion||
ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.CheckQuestion))
{
editName = GameObject.Find("PowerTeamNameWin").GetComponent<EditForceName>();
}
else
{
editName = GameObject.Find("TeamNameWin").GetComponent<EditForceName>();
}
this.gameObject.GetComponent<Toggle>().onValueChanged.AddListener(ShowName);
this.transform.Find("delect").GetComponent<Button>().onClick.AddListener( Delect);
}
void ShowName(bool a)
{
if (a)
{
EditName = this.gameObject.transform.Find("Label").GetComponent<Text>().text;
//寻路模式下
if (ExamInfoHelpClass.applicationMode == ExamInfoHelpClass.ApplicationMode.PATHFINDING && (ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.CopyQuestion ||
ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.CreatQuestion ||
ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.EditQuestion||
ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.CheckQuestion))
{
for (int i = 0; i < SetPowerScript.Instance.TeamList.Count; i++)
{
string Team = SetPowerScript.Instance.TeamList[i].TeamName;
if (Team.Equals(EditName))
{
SetPowerScript.Instance.gameObject.SetActive(true);
SetPowerScript.Instance.InstanceItem(SetPowerScript.Instance.TeamList[i]);
}
}
}
}
//else
//{
// InstantiationCar.Instance.isboolCar = false;
// InstantiationStaff.Instance.isboolStaff = false;
//}
}
void Delect()
{
GameObject TipWindow = Instantiate(Resources.Load<GameObject>("UIPrefab/TipWindow"));
TipWindow.GetComponent<TipWindowManager>().SetWindow(
"确定删除名称?", new UnityEngine.Events.UnityAction(OKSubmit), new UnityEngine.Events.UnityAction(NOSubmit));
}
private void OKSubmit()
{
Destroy(this.gameObject);
editName.Forceinput.text = "";
for (int i=0;i<EditForceName.Instance.listName.Count;i++)
{
EditForceName.Instance.listName.Remove(transform.Find("Label").GetComponent<Text>().text);
}
InstantiationCar.Instance.isboolCar = false;
InstantiationStaff.Instance.isboolStaff = false;
//寻路模式下
if (ExamInfoHelpClass.applicationMode == ExamInfoHelpClass.ApplicationMode.PATHFINDING && (ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.CopyQuestion ||
ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.CreatQuestion ||
ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.EditQuestion))
{
for (int i = 0; i < SetPowerScript.Instance.TeamList.Count; i++)
{
if (SetPowerScript.Instance.TeamList[i].TeamName.Equals(transform.Find("Label").GetComponent<Text>().text))
{
SetPowerScript.Instance.TeamList.RemoveAt(i);
}
}
}
if (GameObject.Find("Canvas").transform.Find("PowerAttributeUI"))
{
GameObject.Find("Canvas").transform.Find("PowerAttributeUI").gameObject.SetActive(false);
}
}
private void NOSubmit()
{
}
void Update () {
}
}