| | |
| | | using UnityEngine.UI; |
| | | using UnityEngine.Events; |
| | | using System; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | //关联游戏玩法功能按钮,如升星功能 |
| | | public class FunctionButtonGroup : MonoBehaviour |
| | |
| | | return a < b ? -1 : 1; |
| | | } |
| | | |
| | | public FunctionButton AddFunction(string pattern, int order, int functionId, string title, int redpointId) |
| | | public async UniTask<FunctionButton> AddFunction(string pattern, int order, int functionId, string title, int redpointId) |
| | | { |
| | | if (m_Container == null) |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | var instance = UIUtility.CreateWidget(pattern, string.Concat("Function_", order)); |
| | | var instance = await UIUtility.CreateWidget(pattern, string.Concat("Function_", order)); |
| | | if (this == null || instance == null) |
| | | { |
| | | if (null != instance) |
| | | { |
| | | DestroyImmediate(instance); |
| | | } |
| | | return null; |
| | | } |
| | | instance.transform.SetParentEx(this.m_Container, Vector3.zero, Quaternion.identity, Vector3.one); |
| | | |
| | | var functionButton = instance.GetComponent<FunctionButton>(); |