12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- 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<SmallPlacesConfig>(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>(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();
- }
- }
- }
|