123456789101112131415161718192021222324252627282930313233 |
- using FairyGUI;
- namespace FL.FGUI
- {
- public partial class MainHomeBottomPanelVM
- {
- /// <summary>
- /// 设置按钮的解锁状态
- /// 索引和BtnCtrl.selectedIndex一致
- /// </summary>
- /// <param name="btnIndex">BtnCtrl.selectedIndex</param>
- /// <param name="isUnlock"></param>
- /// <param name="unlockTips">已解锁时,可不用传</param>
- public void SetUnlockState(int btnIndex, bool isUnlock, string unlockTips = null)
- {
- var button = btnIndex switch
- {
- 1 => RoleBtn,
- 2 => PartnerBtn,
- 3 => EpigraphBtn,
- 4 => DungeonBtn,
- 5 => FarmBtn,
- 6 => BoxBtn,
- _ => null,
- };
- button.GetController("UnlockCtrl").selectedIndex = isUnlock ? 1 : 0;
- if (!isUnlock)
- {
- (button.GetChild("UnlockTxt") as GTextField).text = unlockTips;
- }
- }
- }
- }
|