gongyejiqiren/Assets/_Scripts/Application/UI/FirstEnterTrainPanel.cs

90 lines
3.6 KiB
C#

using CG.Framework;
using CG.UTility;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
/*******************************************************************************
*Create By CG
*Function
*******************************************************************************/
namespace ZXK.GYJQR
{
public class FirstEnterTrainPanel : UIBase
{
private GameObject TrainExplainBG = null;
private GameObject HandlerExplainBG = null;
private Image _oprationImg = null;
private GameObject AZBSExplain = null;
private GameObject BJCJExplain = null;
public System.Action EnteredEvent = null;
private int _enterHandlerNumber = 0;
protected override void Awake()
{
base.Awake();
CG.UTility.PopUpMng._TriAble = false;
AZBSExplain = GetWedage("AZBSTrainExplainTxt_N");
BJCJExplain = GetWedage("BJCJTrainExplainTxt_N");
TrainExplainBG = GetWedage("TrainExplainBG_N");
HandlerExplainBG = GetWedage("HandlerExplainBG_N");
_oprationImg = GetWedage("OprationImg_N").GetComponent<Image>();
if (GameManager.Instance._CurSystemType == EnumCtrl.SystemType.AZBS)
{
_oprationImg.sprite = Resources.Load<Sprite>(ConstCtrl.OPRATION1_IMG_PATH);
AZBSExplain.SetActive(true);
BJCJExplain.SetActive(false);
}
else if (GameManager.Instance._CurSystemType == EnumCtrl.SystemType.BJCZ)
{
_oprationImg.sprite = Resources.Load<Sprite>(ConstCtrl.OPRATION2_IMG_PATH);
AZBSExplain.SetActive(false);
BJCJExplain.SetActive(true);
}
AddEventListener("TrainExplainTitle_N", UIEventType.OnToggleValueChanged, (bool isOn) =>
{
if (isOn)
{
GetWedage("TrainExplainTitle_N").transform.Find("Label").GetComponent<Text>().color = new Color(0 / 255.0f, 107 / 255.0f, 255 / 255.0f);
}
else
{
GetWedage("TrainExplainTitle_N").transform.Find("Label").GetComponent<Text>().color = new Color(0 / 255.0f, 0 / 255.0f, 0 / 255.0f);
}
TrainExplainBG.SetActive(isOn);
});
AddEventListener("HandlerExplainTitle_N", UIEventType.OnToggleValueChanged, (bool isOn) =>
{
if (isOn)
{
_enterHandlerNumber++;
GetWedage("HandlerExplainTitle_N").transform.Find("Label").GetComponent<Text>().color = new Color(0 / 255.0f, 107 / 255.0f, 255 / 255.0f);
}
else
{
GetWedage("HandlerExplainTitle_N").transform.Find("Label").GetComponent<Text>().color = new Color(0 / 255.0f, 0 / 255.0f, 0 / 255.0f);
}
HandlerExplainBG.SetActive(isOn);
});
AddEventListener("CloseBtn_N", UIEventType.OnButtonClick, () =>
{
if (_enterHandlerNumber == 0)
{
GetWedage("HandlerExplainTitle_N").GetComponent<Toggle>().isOn = true;
}
else
{
UI_Manage.Instance.ClosePanel("FirstEnterTrainPanel");
EnteredEvent?.Invoke();
CG.UTility.PopUpMng._TriAble = true;
}
});
GetWedage("TrainExplainTitle_N").GetComponent<Toggle>().isOn = true;
}
}
}