/**************************************************************************** * 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().UpdateTitleText(m_ParentIndex.ToString() + "." + m_Index.ToString() + " " + m_StepMsgInfo.stepName); Debug.Log(UIKit.GetPanel().TitleText.text); #region 多语言 if (LocalizationConfig.localization) { LocalizedString message = m_StepMsgInfo.id + "stepName"; UIKit.GetPanel().UpdateTitleText(m_ParentIndex.ToString() + "." + m_Index.ToString() + " " + message); } #endregion Debug.Log(this.gameObject.name + "Select" + UIKit.GetPanel().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().UpdateTitleText(m_ParentIndex.ToString() + "." + m_Index.ToString() + " " + message); Debug.Log(this.gameObject.name + UIKit.GetPanel().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 } }