using UnityEngine;
|
using UnityEngine.UI;
|
using System;
|
|
// 一级界面带预制体,底部功能按钮样式
|
public class OneLevelWin : FunctionsBaseWin
|
{
|
[NonSerialized] GroupButtonEx tabBtn;
|
public FuncBtnData[] funcBtnDatas;
|
[NonSerialized] Button closeBtn;
|
protected override void InitComponent()
|
{
|
// 创建
|
var instance = UIUtility.CreateWidget("OneLevelWin", "BottomTabs");
|
instance.transform.SetParent(_rectTransform, false);
|
closeBtn = _rectTransform.GetComponent<Button>("BottomTabs/bg/backbtn");
|
tabBtn = _rectTransform.GetComponent<GroupButtonEx>("BottomTabs/bg/btns/funcbtn");
|
var btnParent = _rectTransform.GetComponent<RectTransform>("BottomTabs/bg/btns");
|
|
|
tabButtons = new GroupButtonEx[funcBtnDatas.Length];
|
for (int i = 0; i < tabButtons.Length; i++)
|
{
|
GameObject go = Instantiate(tabBtn.gameObject, btnParent);
|
var data = funcBtnDatas[i];
|
tabButtons[i] = go.GetComponent<GroupButtonEx>();
|
tabButtons[i].selectIcon.SetSprite(data.iconName);
|
tabButtons[i].selectIcon.SetNativeSize();
|
tabButtons[i].title.text = Language.Get(data.name);
|
tabButtons[i].redpoint.redpointId = data.redpointID;
|
tabButtons[i].SetActive(true);
|
}
|
base.InitComponent();
|
|
closeBtn.AddListener(CloseWindow);
|
}
|
|
protected override void OpenSubUIByTabIndex()
|
{
|
}
|
|
|
}
|
|
[Serializable]
|
public struct FuncBtnData
|
{
|
public int redpointID;
|
public string name;
|
public string iconName; //默认显示的图标(选中)
|
}
|