引入 UISerializationRoot 和 Item
- 完成 MenuForm 和 SelectRoleForm 的迁移
This commit is contained in:
@@ -39,20 +39,9 @@ namespace SepCore.UI
|
||||
return null;
|
||||
}
|
||||
|
||||
if (rawData.Rewards == null)
|
||||
{
|
||||
Log.Error("LevelUpFormController.BuildContext() rewards are null.");
|
||||
return null;
|
||||
}
|
||||
|
||||
List<LevelUpRewardItemContext> props = new List<LevelUpRewardItemContext>(rawData.Rewards.Count);
|
||||
foreach (var reward in rawData.Rewards)
|
||||
{
|
||||
if (reward == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
props.Add(new LevelUpRewardItemContext
|
||||
{
|
||||
Title = reward.Title,
|
||||
@@ -80,7 +69,7 @@ namespace SepCore.UI
|
||||
|
||||
if (userData != null)
|
||||
{
|
||||
Log.Warning("LevelUpController.OpenUIAsync() userData type is invalid.");
|
||||
Log.Error("LevelUpController.OpenUIAsync() userData type is invalid.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ namespace SepCore.UI
|
||||
propItem.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
if (_context.Props == null) return;
|
||||
int count = Mathf.Min(_propItems.Length, _context.Props.Count);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
@@ -40,13 +39,13 @@ namespace SepCore.UI
|
||||
{
|
||||
base.OnOpen(userData);
|
||||
|
||||
if (userData is LevelUpContext context)
|
||||
if (userData is not LevelUpContext context)
|
||||
{
|
||||
RefreshUI(context);
|
||||
Log.Error("LevelUpForm requires LevelUpContext as userData.");
|
||||
return;
|
||||
}
|
||||
|
||||
Log.Warning("LevelUpForm requires LevelUpFormContext as userData.");
|
||||
RefreshUI(context);
|
||||
}
|
||||
|
||||
protected override void OnClose(bool isShutdown, object userData)
|
||||
|
||||
@@ -30,17 +30,15 @@ namespace SepCore.UI
|
||||
|
||||
_context = context;
|
||||
|
||||
if (_titleText != null) _titleText.text = context.Title;
|
||||
if (_descriptionText != null) _descriptionText.text = context.Description;
|
||||
if (_iconArea != null) _iconArea.OnInit(context.Icon, context.Rarity);
|
||||
_titleText.text = context.Title;
|
||||
_descriptionText.text = context.Description;
|
||||
_iconArea.OnInit(context.Icon, context.Rarity);
|
||||
|
||||
LoadIcon(_context.IconAssetName).Forget();
|
||||
}
|
||||
|
||||
private async UniTaskVoid LoadIcon(string iconAssetName)
|
||||
{
|
||||
if (_iconArea == null) return;
|
||||
|
||||
if (string.IsNullOrEmpty(iconAssetName)) return;
|
||||
|
||||
var sprite = await SpriteLoader.LoadSpriteByKeyAsync(iconAssetName);
|
||||
|
||||
Reference in New Issue
Block a user