123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- /****************************************************************************
- * 2024.6 LXD
- ****************************************************************************/
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using QFramework;
- namespace QFramework
- {
- public partial class LeveItem : UIElement
- {
- /// <summary>
- /// Index值
- /// </summary>
- [HideInInspector]
- public int m_index;
- /// <summary>
- /// 设置时间
- /// </summary>
- [HideInInspector]
- public string m_Time;
- /// <summary>
- /// 关卡名称
- /// </summary>
- [HideInInspector]
- public string m_LevelName;
- #region UI状态
- /// <summary>
- /// 选择状态
- /// </summary>
- [HideInInspector]
- public bool m_SelectState;
- /// <summary>
- /// 时间图标的选中/取消颜色
- /// </summary>
- [Header("时间图标的选中状态")]
- public Color m_SelectTimeIconColor;
- [Header("时间图标的取消状态")]
- public Color m_NormalTimeIconColor;
- /// <summary>
- /// 时间字体的选中/取消颜色
- /// </summary>
- [Header("时间字体的选中状态")]
- public Color m_SelectTimeColor;
- [Header("时间字体的选中状态")]
- public Color m_NormalTimeColor;
- /// <summary>
- /// 关卡名称字体的选中/取消颜色
- /// </summary>
- [Header("关卡名称字体的选中状态")]
- public Color m_SelectConentColor;
- [Header("关卡名称字体的取消状态")]
- public Color m_NormalConentColor;
- #endregion
- /// <summary>
- /// 子集第一个元素
- /// </summary>
- public OperationStepDataInfo m_OperationStepDataInfo;
- void Start()
- {
- ClickBtn.onClick.AddListener(OnClickBtnClick);
- TimeInputField.onEndEdit.AddListener(OnTimeInputFildEndEditor);
- }
- /// <summary>
- /// 初始化
- /// </summary>
- /// <param name="index">indexz</param>
- /// <param name="conent"></param>
- /// <param name="childId"></param>
- public void InitData(int index, OperationStepDataInfo operationStepDataInfo)
- {
- m_OperationStepDataInfo = operationStepDataInfo;
- IdText.text = (index + 1).ToString();
- m_index = index;
- m_LevelName = operationStepDataInfo.parentStepName;
- LeveConentText.text = m_LevelName;
- m_Time = m_LevelName;
- }
- public void OnClickBtnClick()
- {
- SetSelectState(!m_SelectState);
- UIKit.GetPanel<ChallengeConfigurationPanel>().SetSelectState(m_index, m_SelectState);
- }
- public void SetSelectState(bool state)
- {
- SelectStateIcon.gameObject.SetActive(state);
- if (state)
- {
- TimeLogo.color = m_SelectTimeIconColor;
- LeveConentText.color = m_SelectConentColor;
- Placeholder.color = m_SelectTimeColor;
- Text.color = m_SelectTimeColor;
- }
- else
- {
- TimeLogo.color = m_NormalTimeIconColor;
- LeveConentText.color = m_NormalConentColor;
- Text.color = m_NormalTimeColor;
- Placeholder.color= m_NormalConentColor;
- }
- m_SelectState = state;
- }
- public void SetSelectedData(ChallengeConfiguration challengeConfiguration)
- {
- SetSelectState(true);
- TimeInputField.text = challengeConfiguration.LeveTime;
- }
- private void OnTimeInputFildEndEditor(string conent)
- {
- m_Time = conent;
- UIKit.GetPanel<ChallengeConfigurationPanel>().RefreshTotalTime();
- }
- }
- }
|