- 规范 UI 设计成为:
- UIForm 负责展示
- Controller 负责控制
- UseCase 负责业务逻辑
- RawData 负责提供原始数据
- Context 负责为 UIForm 提供数据
- 添加和补充一系列 UI 功能
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
using Definition.Enum;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class DisplayItemContext : UIContext
|
||||
{
|
||||
public string IconAssetName;
|
||||
public ItemRarity Rarity;
|
||||
public bool IsWeapon;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: df1bccc6ff70fbc4089c7809e35c1f61
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,17 @@
|
||||
using Definition.Enum;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class DisplayItemInfoFormContext : UIContext
|
||||
{
|
||||
public string IconAssetName;
|
||||
public string Title;
|
||||
public string TypeText;
|
||||
public ItemRarity Rarity;
|
||||
public string Description;
|
||||
public int Price;
|
||||
public bool IsWeapon;
|
||||
public Vector3 TargetPos;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cdcef9502b7fa944ca95cb839fdc60bc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class DisplayListAreaContext : UIContext
|
||||
{
|
||||
public string Title;
|
||||
public int CurrentCount;
|
||||
public int MaxCount = -1;
|
||||
public DisplayItemContext[] ItemContexts;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a10dfda6cc0f45247bfcdbfb578110bc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,40 +1,15 @@
|
||||
using System.Text;
|
||||
using DataTable;
|
||||
using Definition.DataStruct;
|
||||
using Definition.Enum;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class GoodsItemContext
|
||||
public class GoodsItemContext : UIContext
|
||||
{
|
||||
public string Title;
|
||||
public ItemRarity Rarity;
|
||||
public string Type;
|
||||
public Sprite Icon;
|
||||
public string Description;
|
||||
public int Price;
|
||||
|
||||
public static string CreateWeaponDescription(DRWeapon drWeapon)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append($"伤害:{drWeapon.Attack}\n");
|
||||
sb.Append($"冷却:{drWeapon.Cooldown}\n");
|
||||
sb.Append($"范围:{drWeapon.AttackRange}\n");
|
||||
sb.Append(CreatePropDescription(drWeapon.Modifiers));
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static string CreatePropDescription(StatModifier[] modifiers)
|
||||
{
|
||||
if (modifiers == null || modifiers.Length == 0) return null;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (var modifier in modifiers)
|
||||
{
|
||||
sb.Append(modifier.ToString());
|
||||
sb.Append("\n");
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class HudFormContext : UIContext
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f8d476720436b84483bd1c29da4d558
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -2,9 +2,9 @@ using System.Collections.Generic;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class LevelUpFormContext
|
||||
public class LevelUpFormContext : UIContext
|
||||
{
|
||||
public int Level;
|
||||
public List<LevelUpPropContext> Props;
|
||||
public List<LevelUpRewardItemContext> Props;
|
||||
public int RefreshPrice;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-3
@@ -2,11 +2,9 @@ using UnityEngine;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class LevelUpPropContext
|
||||
public class LevelUpRewardItemContext : UIContext
|
||||
{
|
||||
public int PropId;
|
||||
public string Title;
|
||||
public string Type;
|
||||
public Sprite Icon;
|
||||
public string Description;
|
||||
public string IconAssetName;
|
||||
@@ -2,11 +2,13 @@ using System.Collections.Generic;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class ShopFormContext
|
||||
public class ShopFormContext : UIContext
|
||||
{
|
||||
public int CurrentLevel;
|
||||
public int RefreshPrice;
|
||||
public int PlayerCoin;
|
||||
public List<GoodsItemContext> GoodsItems;
|
||||
public DisplayListAreaContext PropListContext;
|
||||
public DisplayListAreaContext WeaponListContext;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user