| | |
| | | Do("custom.ButtonUtil"); |
| | | Do("global.logex"); |
| | | Do("global.functions"); |
| | | Do("global.object"); |
| | | |
| | | lastGCTime = 0f; |
| | | } |
| | |
| | | public static void CloseAll() |
| | | { |
| | | WindowCenter.Instance.CloseAll(); |
| | | |
| | | } |
| | | |
| | | public static void DestroyWin(string _name) |
| | |
| | | using System.Collections;
|
| | | using System.Collections.Generic;
|
| | | using UnityEngine;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | | using UnityEngine.Events;
|
| | | using System;
|
| | | using TableConfig;
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | public static class ComponentExtersion
|
| | | {
|
| | |
|
| | | public static Component FindChildComponent(this Component _component, string _type, string _path)
|
| | | {
|
| | | try
|
| | | {
|
| | | if (_component == null)
|
| | | {
|
| | | return null;
|
| | | }
|
| | |
|
| | | var transform = _component.transform.Find(_path);
|
| | | if (transform == null)
|
| | | {
|
| | | return null;
|
| | | }
|
| | |
|
| | | return transform.GetComponent(_type);
|
| | | }
|
| | | catch (Exception ex)
|
| | | {
|
| | | DebugEx.Log(ex);
|
| | | return null;
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | public static T AddMissingComponent<T>(this Component _compoent) where T : Component
|
| | | {
|
| | |
| | | return component;
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | public static void AddListener(this Button _button, UnityAction _action)
|
| | | {
|
| | | if (_button == null)
|
| | |
| | | _button.onClick.AddListener(_action);
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | public static void RemoveAllListeners(this Button _button)
|
| | | {
|
| | | if (_button == null)
|
| | |
| | | _button.onClick.RemoveAllListeners();
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | public static void AddListener(this Toggle _toggle, UnityAction<bool> _action)
|
| | | {
|
| | | if (_toggle == null)
|
| | |
| | | _toggle.onValueChanged.AddListener(_action);
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | public static void RemoveAllListeners(this Toggle _toggle)
|
| | | {
|
| | | if (_toggle == null)
|
| | |
| | | _toggle.onValueChanged.RemoveAllListeners();
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | public static void AddListener(this Slider _slider, UnityAction<float> _action)
|
| | | {
|
| | | if (_slider == null)
|
| | |
| | | _slider.onValueChanged.AddListener(_action);
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | public static void RemoveAllListeners(this Slider _slider)
|
| | | {
|
| | | if (_slider == null)
|
| | |
| | | _slider.onValueChanged.RemoveAllListeners();
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | public static void AddListener(this InputField _inputField, UnityAction<string> _action)
|
| | | {
|
| | | if (_inputField == null)
|
| | |
| | | _inputField.onValueChanged.AddListener(_action);
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | public static void RemoveAllListeners(this InputField _inputField)
|
| | | {
|
| | | if (_inputField == null)
|
| | |
| | | _inputField.onValueChanged.RemoveAllListeners();
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | public static void SetEnable(this Button _btn, Text _btnTxt, bool _enable, EnableButtonConfig.EnableButtonType _type =
|
| | | EnableButtonConfig.EnableButtonType.Default)
|
| | | {
|
| | | EnableButtonConfig.SetEnable(_btn, _btnTxt, _enable, _type);
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | public static void SetInteractable(this Button _btn, Text _btnText, bool _interactable)
|
| | | {
|
| | | if (_btn != null)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | public static void SetSprite(this Image _image, string _id)
|
| | | {
|
| | | if (_image == null)
|
| | |
| | | _image.overrideSprite = sprite;
|
| | | }
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | public static void SetSprite(this TextImage _textImage, string _id)
|
| | | {
|
| | | if (_textImage == null)
|
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | |
| | | [XLua.LuaCallCSharp] |
| | | public static class TransformExtension |
| | | { |
| | | |
| | | [XLua.LuaCallCSharp] |
| | | public static void SetParentEx(this Transform transform, Transform parent, Vector3 localPosition, Quaternion rotation, Vector3 scale) |
| | | { |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | [XLua.LuaCallCSharp] |
| | | public static void SetParentEx(this Transform transform, Transform parent, Vector3 localPosition, Vector3 eulerAngles, Vector3 scale) |
| | | { |
| | | if (transform != null && parent != null) |
| | |
| | | transform.localScale = scale; |
| | | } |
| | | } |
| | | |
| | | |
| | | public static T[] GetComponentsInChildren<T>(this Transform transform, bool includeInactive, bool includeSelf) where T : Component |
| | | { |
| | |
| | | |
| | | } |
| | | |
| | | [XLua.LuaCallCSharp] |
| | | public static Transform GetChildTransformDeeply(this Transform transform, string childName, bool includeSelf = false) |
| | | { |
| | | |
| | |
| | | /// </summary> |
| | | /// <param name="_child"></param> |
| | | /// <param name="_parent"></param> |
| | | [XLua.LuaCallCSharp] |
| | | public static void MatchWhith(this RectTransform _child, RectTransform _parent) |
| | | { |
| | | |
| | |
| | | _child.localScale = Vector3.one; |
| | | } |
| | | |
| | | |
| | | [XLua.LuaCallCSharp] |
| | | public static bool ContainWorldPosition(this RectTransform _rectTransform, Vector3 _worldPosition) |
| | | { |
| | | var worldCorners = new Vector3[4]; |
| | |
| | | return false; |
| | | } |
| | | |
| | | [XLua.LuaCallCSharp] |
| | | public static bool RectTransformContain(this RectTransform _rectTransform, RectTransform _target) |
| | | { |
| | | var targetWorldCorners = new Vector3[4]; |
| | |
| | | /// <summary>
|
| | | /// UI辅助类
|
| | | /// </summary>
|
| | | [XLua.LuaCallCSharp]
|
| | | public static class UIHelper
|
| | | {
|
| | | #region UI通用
|
| | |
| | | public static readonly Color s_NavyYellow = new Color32(255, 239, 71, 255);
|
| | | public static readonly Color s_LightGreen = new Color32(141, 220, 17, 255);
|
| | | public static readonly Color s_LightYellow = new Color32(255, 244, 205, 255); //fff4cd
|
| | |
|
| | | public static Color GetUIColor(int itemColor, bool bright = false)
|
| | | {
|
| | | switch (itemColor)
|
| | |
| | | }
|
| | | return GetUIColor(TextColType.White, bright);
|
| | | }
|
| | |
|
| | | public static Color GetUIColor(TextColType type, bool bright = false)
|
| | | {
|
| | | switch (type)
|
| | |
| | | using UnityEngine.EventSystems;
|
| | | using Snxxz.UI;
|
| | |
|
| | | [XLua.LuaCallCSharp]
|
| | | public static class UIUtility
|
| | | {
|
| | | [XLua.LuaCallCSharp]
|
| | |
|
| | | public static GameObject CreateWidget(string _sourceName, string _name)
|
| | | {
|
| | | var prefab = UILoader.LoadPrefab(_sourceName);
|