123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- /****************************************************************************
- * 2024.5 LXD
- ****************************************************************************/
- using UnityEngine;
- using ChivaXR;
- using Sirenix.OdinInspector;
- using I2.Loc;
- namespace QFramework
- {
- public partial class SecondStepItem : UIComponent
- {
- public OperationStepDataInfo m_StepMsgInfo;
- [LabelText("选中字体颜色")]
- public Color m_SelectClolor;
- [LabelText("选中字体")]
- public Font m_SelectFont;
- [LabelText("常态颜色")]
- public Color m_NormalClolor;
- [LabelText("常态字体")]
- public Font m_NormalFont;
- [LabelText("划入颜色")]
- public Color m_HoverClolor;
- [LabelText("划入字体")]
- public Font m_HoverFont;
- private string NO_BREAKING_SPACE = "\u00A0";
- private int m_ParentIndex;
- private int m_Index;
- private void Start()
- {
- if (OperateSetting.Instance.m_CurrentOperationMode == OperationMode.Learn)
- {
- ClickBtn.onClick.AddListener(OnClickBtnClick);
- }
- }
- public void InitData(int parentIndex, int index, OperationStepDataInfo stepMsgInfo)
- {
- m_ParentIndex = parentIndex;
- m_Index = index;
- m_StepMsgInfo = stepMsgInfo;
- //Message.text = index.ToString("00") + "." + stepMsgInfo.stepName;
- LocalizedString message = m_StepMsgInfo.id + "stepName";
- Message.text = m_Index.ToString("00") + "." + message;
- if (OperateSetting.Instance.m_CurrentOperationMode == OperationMode.Exam)
- {
- Message.text = "???";
- }
- }
- private void OnClickBtnClick()
- {
- ProcessManagement.Instance.JumpProcessState(int.Parse(m_StepMsgInfo.id));
- ProcessManagement.Instance.ActiveCurrentProcess();
- }
- public void OnSelect()
- {
- SetBtnState(BtnState.select);
- UIKit.GetPanel<PC_OperatePanel>().UpdateTitleText(m_ParentIndex.ToString() + "." + m_Index.ToString() + " " + m_StepMsgInfo.stepName);
- Debug.Log(UIKit.GetPanel<PC_OperatePanel>().TitleText.text);
- #region 多语言
- if (LocalizationConfig.localization)
- {
- LocalizedString message = m_StepMsgInfo.id + "stepName";
- UIKit.GetPanel<PC_OperatePanel>().UpdateTitleText(m_ParentIndex.ToString() + "." + m_Index.ToString() + " " + message);
- }
- #endregion
- Debug.Log(this.gameObject.name + "Select" + UIKit.GetPanel<PC_OperatePanel>().TitleText.text);
- if (OperateSetting.Instance.m_CurrentOperationMode == OperationMode.Exam)
- {
- Message.text = "???";
- }
- }
- public void OnUnSelect()
- {
- SetBtnState(BtnState.normal);
- if (OperateSetting.Instance.m_CurrentOperationMode == OperationMode.Exam)
- {
- RefrushLocalization();
- }
- }
- public void OnPointEnter()
- {
- if (!SelectIcon.isActiveAndEnabled)
- {
- SetBtnState(BtnState.highter);
- }
- }
- public void OnPointExit()
- {
- if (!SelectIcon.isActiveAndEnabled)
- {
- SetBtnState(BtnState.normal);
- }
- }
- public void SetBtnState(BtnState state)
- {
- switch (state)
- {
- case BtnState.normal:
- Message.color = m_NormalClolor;
- Message.font = m_NormalFont;
- SelectIcon.gameObject.SetActive(false);
- NormalIcon.gameObject.SetActive(true);
- break;
- case BtnState.highter:
- Message.color = m_HoverClolor;
- Message.font = m_HoverFont;
- SelectIcon.gameObject.SetActive(false);
- NormalIcon.gameObject.SetActive(true);
- break;
- case BtnState.select:
- Message.color = m_SelectClolor;
- Message.font = m_SelectFont;
- SelectIcon.gameObject.SetActive(true);
- NormalIcon.gameObject.SetActive(false);
- break;
- }
- }
- protected override void OnBeforeDestroy()
- {
- }
- #region 多语言
- public void RefrushLocalization()
- {
- LocalizedString message = m_StepMsgInfo.id + "stepName";
- Message.text = m_Index.ToString("00") + "." + message;
- if (SelectIcon.isActiveAndEnabled)
- {
- UIKit.GetPanel<PC_OperatePanel>().UpdateTitleText(m_ParentIndex.ToString() + "." + m_Index.ToString() + " " + message);
- Debug.Log(this.gameObject.name + UIKit.GetPanel<PC_OperatePanel>().TitleText.text);
- if (OperateSetting.Instance.m_CurrentOperationMode == OperationMode.Exam)
- {
- Message.text = "???";
- }
- }
- }
- void OnEnable()
- {
- RefrushLocalization();
- LocalizationManager.OnLocalizeEvent += LocalizationManager_OnLocalizeEvent;
- }
- void OnDisEnable()
- {
- LocalizationManager.OnLocalizeEvent -= LocalizationManager_OnLocalizeEvent;
- }
- private void LocalizationManager_OnLocalizeEvent()
- {
- if (LocalizationConfig.localization)
- {
- RefrushLocalization();
- }
- }
- #endregion
- }
- }
|