using FairyGUI; namespace FL.FGUI { public partial class MainHomeBottomPanelVM { /// /// 设置按钮的解锁状态 /// 索引和BtnCtrl.selectedIndex一致 /// /// BtnCtrl.selectedIndex /// /// 已解锁时,可不用传 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; } } } }