12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Reflection;
- using TMPro;
- using UnityEngine;
- using UnityEngine.Events;
- using UnityEngine.EventSystems;
- using UnityEngine.UI;
- namespace TFramework
- {
- [Serializable]
- public class UIBehaviour : Behaviour
- {
- private RectTransform _rt;
- /// <summary>
- /// 启用动画
- /// </summary>
- [SerializeField]
- private bool enableAnim = false;
-
- public string m_uiAnimType;
- private UIAnimBase uIAnim;
- public RectTransform rectTransform => _rt = _rt ?? GetComponent<RectTransform>();
- public bool IsEnableAnim
- {
- get
- {
- if (enableAnim)
- {
- if (uIAnim == null)
- uIAnim = GlobalTool.CretaInstanceToCurrentDomain<UIAnimBase>(m_uiAnimType);
- }
- return enableAnim;
- }
- set
- {
- enableAnim = value;
- }
- }
- [SerializeField]
- private bool isScriptUse;
- [SerializeField]
- private List<VariableInfo> variableInfos;
- [SerializeField]
- private string parnetPanel;
- public override void Start()
- {
- base.Start();
- }
- private void OnEnable()
- {
- if (IsEnableAnim)
- uIAnim.EnableAnim(rectTransform);
- }
- private void OnDisable()
- {
- if (IsEnableAnim)
- uIAnim.DisableAnim(rectTransform);
- }
- #region Text
-
- /// <summary>
- /// 获取TextPro文本在本地化语言配置表的编号
- /// </summary>
- /// <returns></returns>
- public int GetLanguageId()
- {
- Text text = GetComponent<Text>();
- if (text)
- return (text as LocalizedLanguageText) == null ? -1 : (text as LocalizedLanguageText).lacalizedLanguageId;
- else
- return -1;
- }
- #endregion
- }
- [Serializable]
- public class VariableInfo
- {
- public string variableName;
- public string compentType;
- }
- }
|