using System.Linq; using Core.Language; using Excel2Json; using Fort23.UTool; namespace Fort23.Mono { [UIBinding(prefab = "ShopBtnWidget")] public partial class ShopBtnWidget : ItemWidgetBasic { public ShopGroupConfig ShopGroupConfig; public SmallPlacesConfig SmallPlacesConfig; private void Init() { } public override void AddEvent() { } public override void DelEvent() { } public override void AddButtonEvent() { base.AddButtonEvent(); } public void CustomInit(ShopGroupConfig shopGroupConfig) { this.ShopGroupConfig = shopGroupConfig; Text_Name.text = LanguageManager.Instance.Text(ShopGroupConfig.shopName); } public void CustomInit(int smallPlacesId) { this.SmallPlacesConfig = ConfigComponent.Instance.Get(smallPlacesId); Text_Name.text = LanguageManager.Instance.Text(SmallPlacesConfig.placeName); PlayerManager.Instance.GetSmallPlacesData(SmallPlacesConfig.ID - 1); AccountFileInfo.SmallPlacesData lastSmallPlacesData = PlayerManager.Instance.GetSmallPlacesData(SmallPlacesConfig.ID - 1); SmallPlacesConfig lastSmallPlacesConfig = ConfigComponent.Instance.Get(SmallPlacesConfig.ID - 1); if (SmallPlacesConfig.ID > 1 && (lastSmallPlacesData == null || lastSmallPlacesData.completionEventCount < lastSmallPlacesConfig.CompletionEventCount)) { uiToggle.Hind(); // TipMessagePanel.OpenTipMessagePanel( // $"[{LanguageManager.Instance.Text(shopBtnWidget.SmallPlacesConfig.placeName)}]未解锁, 完成{lastSmallPlacesConfig.CompletionEventCount}个任务后, 可解锁. "); return; } if (lastSmallPlacesConfig.UnlockEnvetid != 0) { AccountFileInfo.EventList eventList = AccountFileInfo.Instance.playerData.completeEvents.FirstOrDefault(ce => ce.eventID == lastSmallPlacesConfig.UnlockEnvetid); if (eventList == null || !eventList.isCompleted) { uiToggle.Hind(); return; } } AccountFileInfo.SmallPlacesData currentSmallPlacesData = PlayerManager.Instance.GetSmallPlacesData(SmallPlacesConfig.ID); if (currentSmallPlacesData == null) { uiToggle.Hind(); return; } uiToggle.Show(); } } }