|
@@ -22,6 +22,8 @@ namespace Fort23.Mono
|
|
|
|
|
|
List<ShopBtnWidget> _shopBtnWidgets = new List<ShopBtnWidget>();
|
|
|
|
|
|
+ private int shopId;
|
|
|
+
|
|
|
private void Init()
|
|
|
{
|
|
|
isAddStack = true;
|
|
@@ -43,7 +45,27 @@ namespace Fort23.Mono
|
|
|
public override CTask GetFocus()
|
|
|
{
|
|
|
AppBarPanel.OpenPanel(this);
|
|
|
- if (currentSelectedShopBtnWidget != null)
|
|
|
+ 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();
|
|
|
}
|
|
@@ -65,7 +87,7 @@ namespace Fort23.Mono
|
|
|
|
|
|
public async override CTask<bool> AsyncInit(object[] uiData)
|
|
|
{
|
|
|
- int shopId = int.Parse(uiData[0].ToString());
|
|
|
+ shopId = int.Parse(uiData[0].ToString());
|
|
|
List<ShopGroupConfig> shopGroupConfigs = ConfigComponent.Instance.GetAll<ShopGroupConfig>().ToList();
|
|
|
shopGroupConfigs.Sort(Sort);
|
|
|
foreach (var shopGroupConfig in shopGroupConfigs)
|
|
@@ -77,24 +99,22 @@ namespace Fort23.Mono
|
|
|
shopBtnWidget.CustomInit(shopGroupConfig);
|
|
|
shopBtnWidget.OnClick = OnClick;
|
|
|
_shopBtnWidgets.Add(shopBtnWidget);
|
|
|
- if (shopGroupConfig.ID == shopId)
|
|
|
- {
|
|
|
- currentSelectedShopBtnWidget = shopBtnWidget;
|
|
|
- }
|
|
|
+ // if (shopGroupConfig.ID == shopId)
|
|
|
+ // {
|
|
|
+ // currentSelectedShopBtnWidget = shopBtnWidget;
|
|
|
+ // }
|
|
|
}
|
|
|
|
|
|
ShopBtnContent.GetComponent<UIToggleList>().GetChildObj();
|
|
|
- if (currentSelectedShopBtnWidget == null)
|
|
|
- {
|
|
|
- _shopBtnWidgets[0]?.OnPointerClick();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- currentSelectedShopBtnWidget.OnPointerClick();
|
|
|
- }
|
|
|
-
|
|
|
+ // if (currentSelectedShopBtnWidget == null)
|
|
|
+ // {
|
|
|
+ // _shopBtnWidgets[0]?.OnPointerClick();
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // currentSelectedShopBtnWidget.OnPointerClick();
|
|
|
+ // }
|
|
|
|
|
|
- // isPauseCombat = uiData[0] as bool? == true;
|
|
|
return await base.AsyncInit(uiData);
|
|
|
}
|
|
|
|