| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 | 
							- using System.Collections.Generic;
 
- using System.Linq;
 
- using Core.Audio;
 
- using Core.Language;
 
- using Core.Utility;
 
- using Excel2Json;
 
- using Fort23.Core;
 
- using Fort23.UTool;
 
- using GameLogic.Combat.CombatTool;
 
- namespace Fort23.Mono
 
- {
 
-     [UIBinding(prefab = "ShopPanel")]
 
-     public partial class ShopPanel : UIPanel
 
-     {
 
-         private List<AccountFileInfo.ShopData> _shopDatas;
 
-         public List<UIComponent> _shopGroupWidgetType1s = new List<UIComponent>();
 
-         // List<EnergyWidget> _energyWidgets = new List<EnergyWidget>();
 
-         ShopBtnWidget currentSelectedShopBtnWidget;
 
-         public List<ShopBtnWidget> _shopBtnWidgets = new List<ShopBtnWidget>();
 
-         private int shopId;
 
-         private void Init()
 
-         {
 
-             isAddStack = true;
 
-             IsShowAppBar = true;
 
-         }
 
-         protected override void AddEvent()
 
-         {
 
-             EventManager.Instance.AddEventListener(CustomEventType.ShopRefence, ShopRefence);
 
-         }
 
-         protected override void DelEvent()
 
-         {
 
-             EventManager.Instance.RemoveEventListener(CustomEventType.ShopRefence, ShopRefence);
 
-         }
 
-         public async override CTask GetFocus()
 
-         {
 
-             AppBarPanel.OpenPanel(this);
 
-             if (currentSelectedShopBtnWidget == null)
 
-             {
 
-                 foreach (var shopBtnWidget in _shopBtnWidgets)
 
-                 {
 
-                     if (shopBtnWidget.ShopGroupConfig.ID == shopId)
 
-                     {
 
-                         currentSelectedShopBtnWidget = shopBtnWidget;
 
-                         break;
 
-                     }
 
-                 }
 
-                 if (currentSelectedShopBtnWidget == null)
 
-                 {
 
-                     _shopBtnWidgets[0]?.OnPointerClick();
 
-                 }
 
-                 else
 
-                 {
 
-                     currentSelectedShopBtnWidget.OnPointerClick();
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 currentSelectedShopBtnWidget.OnPointerClick();
 
-             }
 
-             if (PlayerGuideManager.Instance.GuideIsCanDo(7))
 
-             {
 
-                 await PlayerGuideManager.Instance.SetGuid(7);
 
-             }
 
-             base.GetFocus();
 
-         }
 
-         public override CTask LoseFocus()
 
-         {
 
-             // TitlePanel.ClosePanel();
 
-             return base.LoseFocus();
 
-         }
 
-         public int Sort(ShopGroupConfig s, ShopGroupConfig b)
 
-         {
 
-             return s.pageSortNum.CompareTo(b.pageSortNum);
 
-         }
 
-         public async override CTask<bool> AsyncInit(object[] uiData)
 
-         {
 
-             shopId = int.Parse(uiData[0].ToString());
 
-             List<ShopGroupConfig> shopGroupConfigs = ConfigComponent.Instance.GetAll<ShopGroupConfig>().ToList();
 
-             shopGroupConfigs.Sort(Sort);
 
-             foreach (var shopGroupConfig in shopGroupConfigs)
 
-             {
 
-                 if (!shopGroupConfig.isShow)
 
-                     continue;
 
-                 ShopBtnWidget shopBtnWidget =
 
-                     await UIManager.Instance.CreateGComponent<ShopBtnWidget>(null, ShopBtnContent);
 
-                 shopBtnWidget.CustomInit(shopGroupConfig);
 
-                 shopBtnWidget.OnClick = OnClick;
 
-                 _shopBtnWidgets.Add(shopBtnWidget);
 
-                 // if (shopGroupConfig.ID == shopId)
 
-                 // {
 
-                 //     currentSelectedShopBtnWidget = shopBtnWidget;
 
-                 // }
 
-             }
 
-             ShopBtnContent.GetComponent<UIToggleList>().GetChildObj();
 
-             // if (currentSelectedShopBtnWidget == null)
 
-             // {
 
-             //     _shopBtnWidgets[0]?.OnPointerClick();
 
-             // }
 
-             // else
 
-             // {
 
-             //     currentSelectedShopBtnWidget.OnPointerClick();
 
-             // }
 
-             return await base.AsyncInit(uiData);
 
-         }
 
-         private async void OnClick(ItemWidgetBasic obj)
 
-         {
 
-             if (PlayerGuideManager.Instance.GuideIsCanDo(7, 1))
 
-             {
 
-                 PlayerGuideManager.Instance.NextGuide();
 
-             }
 
-             ShopBtnWidget shopBtnWidget = obj as ShopBtnWidget;
 
-             TitlePanel.OpenPanel(shopBtnWidget.ShopGroupConfig.titleShowItemIds.ToList());
 
-             Text_Title.text = LanguageManager.Instance.Text(shopBtnWidget.ShopGroupConfig.shopName);
 
-             ShopBtnContent.GetComponent<UIToggleList>()
 
-                 .ClickWidget(shopBtnWidget.own.GetComponent<UIToggleWidgetBasic>());
 
-             currentSelectedShopBtnWidget = shopBtnWidget;
 
-             foreach (var shopGroupWidgetType1 in _shopGroupWidgetType1s)
 
-             {
 
-                 UIManager.Instance.DormancyGComponent(shopGroupWidgetType1);
 
-             }
 
-             _shopGroupWidgetType1s.Clear();
 
-             _shopDatas = ShopManger.Instance.GetAllShopConfig();
 
-             foreach (var shopData in _shopDatas)
 
-             {
 
-                 ShopConfig shopConfig = ConfigComponent.Instance.Get<ShopConfig>(shopData.id);
 
-                 if (shopConfig.shopGroup == shopBtnWidget.ShopGroupConfig.ID)
 
-                 {
 
-                     if (shopConfig.shopItemGroup == 4)
 
-                     {
 
-                         ShopBoxWidget shopBoxWidget =
 
-                             await UIManager.Instance.CreateGComponent<ShopBoxWidget>(null, Content);
 
-                         shopBoxWidget.CustomInit();
 
-                         _shopGroupWidgetType1s.Add(shopBoxWidget);
 
-                     }
 
-                     // if (shopData.id == 1 || shopData.id == 5)
 
-                     // {
 
-                     //     ShopGroupWidgetType1 shopGroupWidgetType1 =
 
-                     //         await UIManager.Instance.CreateGComponentForObject<ShopGroupWidgetType1>(ShopGroupWidgetType1,
 
-                     //             null, Content, isInstance: true);
 
-                     //     _shopGroupWidgetType1s.Add(shopGroupWidgetType1);
 
-                     //     await shopGroupWidgetType1.CustomInit(shopData);
 
-                     // }
 
-                     else
 
-                     {
 
-                         ShopGroupWidgetType1 shopGroupWidgetType1 =
 
-                             await UIManager.Instance.CreateGComponentForObject<ShopGroupWidgetType1>(
 
-                                 ShopGroupWidgetType2,
 
-                                 null, Content, isInstance: true);
 
-                         _shopGroupWidgetType1s.Add(shopGroupWidgetType1);
 
-                         await shopGroupWidgetType1.CustomInit(shopData);
 
-                     }
 
-                 }
 
-             }
 
-             if (PlayerGuideManager.Instance.GuideIsCanDo(7, 4))
 
-             {
 
-                 PlayerGuideManager.Instance.NextGuide();
 
-             }
 
-         }
 
-         public async override CTask Show()
 
-         {
 
-             await base.Show();
 
-             // foreach (var widget in _energyWidgets)
 
-             // {
 
-             //     UIManager.Instance.DormancyGComponent(widget);
 
-             // }
 
-             //
 
-             // _energyWidgets.Clear();
 
-             // EnergyWidget energyWidget =
 
-             //     await UIManager.Instance.CreateGComponent<EnergyWidget>(null, Group_ResourceBar);
 
-             // energyWidget.CustomInit(GlobalParam.Item_Coin_ID);
 
-             // _energyWidgets.Add(energyWidget);
 
-             // energyWidget = await UIManager.Instance.CreateGComponent<EnergyWidget>(null, Group_ResourceBar);
 
-             // energyWidget.CustomInit(GlobalParam.Item_Diamond_ID);
 
-             // _energyWidgets.Add(energyWidget);
 
-         }
 
-         private void ShopRefence(IEventData e)
 
-         {
 
-             currentSelectedShopBtnWidget.OnPointerClick();
 
-         }
 
-         public override void AddButtonEvent()
 
-         {
 
-             Btn_Close.onClick.AddListener(() => { UIManager.Instance.HideUIUIPanel<ShopPanel>(); });
 
-         }
 
-         public async override CTask Close()
 
-         {
 
-             foreach (var shopGroupWidgetType1 in _shopGroupWidgetType1s)
 
-             {
 
-                 UIManager.Instance.DormancyGComponent(shopGroupWidgetType1);
 
-             }
 
-             _shopGroupWidgetType1s.Clear();
 
-             // foreach (var widget in _energyWidgets)
 
-             // {
 
-             //     UIManager.Instance.DormancyGComponent(widget);
 
-             // }
 
-             //
 
-             // _energyWidgets.Clear();
 
-             foreach (var shopBtnWidget in _shopBtnWidgets)
 
-             {
 
-                 UIManager.Instance.DormancyGComponent(shopBtnWidget);
 
-             }
 
-             _shopBtnWidgets.Clear();
 
-             currentSelectedShopBtnWidget = null;
 
-             // MainUIPanel mainUIPanel = UIManager.Instance.GetComponent<MainUIPanel>();
 
-             // if (mainUIPanel != null)
 
-             // {
 
-             //     mainUIPanel.shopDatas = AccountFileInfo.Instance.playerData.shopDatas;
 
-             //     mainUIPanel.FindShop();
 
-             // }
 
-             await base.Close();
 
-         }
 
-         public static async CTask<ShopPanel> OpenPanel(int shopId)
 
-         {
 
-             ShopPanel shopPanel =
 
-                 await UIManager.Instance.LoadAndOpenPanel<ShopPanel>(null, uiData: new object[] { shopId },
 
-                     isFullUI: true);
 
-             AudioManager.Instance.PlayAudio("ui_shangdian.wav");
 
-             return shopPanel;
 
-         }
 
-     }
 
- }
 
 
  |