添加 ShopForm 下的 StatForm,展示玩家属性
This commit is contained in:
@@ -10,6 +10,7 @@ namespace SepCore.UI
|
||||
public List<GoodsItemContext> GoodsItems;
|
||||
public DisplayListContext PropListContext;
|
||||
public DisplayListContext WeaponListContext;
|
||||
public StatContext StatContext;
|
||||
|
||||
// 控制字段
|
||||
public bool NeedRefreshGoodsItems;
|
||||
@@ -17,6 +18,7 @@ namespace SepCore.UI
|
||||
public bool NeedRefreshWeaponList;
|
||||
public bool NeedRefreshPropList;
|
||||
public bool NeedRefreshPrice;
|
||||
public bool NeedRefreshStat;
|
||||
|
||||
public ShopContext()
|
||||
{
|
||||
|
||||
@@ -40,14 +40,26 @@ namespace SepCore.UI
|
||||
BuildDisplayListContext(DisplayListAreaType.Prop, rawData.PropItems, rawData.PropMaxCount),
|
||||
WeaponListContext = BuildDisplayListContext(DisplayListAreaType.Weapon, rawData.WeaponItems,
|
||||
rawData.WeaponMaxCount),
|
||||
StatContext = BuildStatContext(rawData.StatRawData),
|
||||
NeedRefreshGoodsItems = true,
|
||||
NeedRefreshPlayerCoin = true,
|
||||
NeedRefreshPropList = true,
|
||||
NeedRefreshWeaponList = true,
|
||||
NeedRefreshStat = true,
|
||||
NeedRefreshPrice = true
|
||||
};
|
||||
}
|
||||
|
||||
private static StatContext BuildStatContext(StatRawData rawData)
|
||||
{
|
||||
if (rawData == null)
|
||||
{
|
||||
Log.Error("ShopController.BuildStatContext: rawData is null.");
|
||||
}
|
||||
|
||||
return new StatContext(rawData);
|
||||
}
|
||||
|
||||
private static DisplayListContext BuildDisplayListContext(DisplayListAreaType listType,
|
||||
IReadOnlyList<object> items, int maxCount)
|
||||
{
|
||||
|
||||
@@ -144,6 +144,12 @@ namespace SepCore.UI
|
||||
Context.NeedRefreshPropList = true;
|
||||
}
|
||||
|
||||
if (result.StatRawData != null)
|
||||
{
|
||||
Context.StatContext = BuildStatContext(result.StatRawData);
|
||||
Context.NeedRefreshStat = true;
|
||||
}
|
||||
|
||||
Context.NeedRefreshGoodsItems = true;
|
||||
RefreshUI(Form, Context);
|
||||
}
|
||||
@@ -243,6 +249,8 @@ namespace SepCore.UI
|
||||
Context.WeaponListContext.CurrentCount = currentCount;
|
||||
|
||||
Context.NeedRefreshWeaponList = true;
|
||||
Context.StatContext = BuildStatContext(_useCase.CreateStatRawData());
|
||||
Context.NeedRefreshStat = true;
|
||||
RefreshUI(Form, Context);
|
||||
GameEntry.UIRouter.CloseUIAsync(UIFormType.ItemTooltipForm).Forget();
|
||||
}
|
||||
|
||||
@@ -49,6 +49,12 @@ namespace SepCore.UI
|
||||
View.weaponList.OnInit(context.WeaponListContext);
|
||||
context.NeedRefreshWeaponList = false;
|
||||
}
|
||||
|
||||
if (context.NeedRefreshStat)
|
||||
{
|
||||
View.statForm.OnInit(context.StatContext);
|
||||
context.NeedRefreshStat = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnOpen(object userData)
|
||||
|
||||
@@ -16,5 +16,6 @@ namespace SepCore.UI
|
||||
[SerializeField] public global::SepCore.UI.FormatTextUI continueButtonFormatText;
|
||||
[SerializeField] public global::SepCore.UI.DisplayListForm weaponList;
|
||||
[SerializeField] public global::SepCore.UI.DisplayListForm propList;
|
||||
[SerializeField] public global::SepCore.UI.StatForm statForm;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user