继续调整,创建 Procedure 与 Presentation 程序集

- 创建 Procedure 与 Presentation 两个程序集
- 初步解决这两个程序集与原程序集的引用关系
This commit is contained in:
SepComet
2026-06-02 23:26:08 +08:00
parent affa44e4d0
commit 6b8a6a8789
50 changed files with 907 additions and 688 deletions
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 710248cee26a898459031e4336703628
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: de04e3a2f42efa84798cde2397f505db
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
namespace UI
{
public class RoleItemRawData
{
public int RoleId;
public string IconName;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bd682bb88cf9b8c4fac0fe7002d3646b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
namespace UI
{
public class RolePropertyAreaRawData
{
public string RoleName;
public string InitialPropertyText;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3a582029cb4c5e5459ebe6d42335299f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 476e0babdb10df1499873cc46eaaa41e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -2,19 +2,18 @@ using SepCore.Definition;
using Entity;
using CustomUtility;
using Entity.Weapon;
using Procedure;
namespace UI
{
public class DisplayItemInfoFormUseCase : IUIUseCase
{
private readonly ProcedureGame _procedureGame;
private readonly Player _player;
private Player Player => _procedureGame != null ? _procedureGame.Player : null;
private Player Player => _player;
public DisplayItemInfoFormUseCase(ProcedureGame procedureGame)
public DisplayItemInfoFormUseCase(Player player)
{
_procedureGame = procedureGame;
_player = player;
}
public DisplayItemInfoFormRawData CreateModel(int index, bool isWeapon)
@@ -72,4 +71,4 @@ namespace UI
};
}
}
}
}
@@ -1,20 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using SepCore.DataTable;
using SepCore.Definition;
using Entity;
using Procedure;
using UnityEngine;
using Random = UnityEngine.Random;
using UnityGameFramework.Runtime;
using CustomUtility;
using GameFramework.DataTable;
namespace UI
{
internal class LevelUpFormUseCase : IUIUseCase
public class LevelUpFormUseCase : IUIUseCase
{
private const int BaseRefreshPrice = 2;
private readonly GameStateLevelUp _gameStateLevelUp;
private readonly Action _onCompleted;
private readonly DRLevelUpReward[] _allRewards;
private readonly IDataTable<DRLevelRarity> _levelRarityTable;
private readonly Dictionary<ItemRarity, List<DRLevelUpReward>> _rewardsByRarity = new();
@@ -22,13 +22,13 @@ namespace UI
private int _refreshCount;
private LevelUpFormRawData _currentModel;
private readonly Player _player;
public LevelUpFormUseCase(Player player, GameStateLevelUp gameStateLevelUp)
public LevelUpFormUseCase(Player player, Action onCompleted)
{
_player = player;
_gameStateLevelUp = gameStateLevelUp;
_onCompleted = onCompleted;
_allRewards = GameEntry.DataTable.GetDataTable<DRLevelUpReward>().ToArray();
_levelRarityTable = GameEntry.DataTable.GetDataTable<DRLevelRarity>();
@@ -39,7 +39,7 @@ namespace UI
{
_refreshCount = 0;
if (_gameStateLevelUp == null || _player.PendingLevelPoints <= 0)
if (_player == null || _player.PendingLevelPoints <= 0)
{
_currentModel = null;
return null;
@@ -90,7 +90,7 @@ namespace UI
return _currentModel;
}
_gameStateLevelUp.IsCompleted = true;
_onCompleted?.Invoke();
_currentModel = null;
return null;
}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f9cd57f1c1a63854e8ba23be83ead8b4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,11 @@
using SepCore.Definition;
namespace UI
{
public class DisplayItemRawData
{
public string IconAssetName;
public ItemRarity Rarity;
public bool IsWeapon;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8a8892ea402a6ca4b943466ac00676e7
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 DisplayListAreaRawData
{
public string Title;
public int CurrentCount;
public int MaxCount = -1;
public DisplayItemRawData[] ItemContexts;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 06d87c8d30eefa645b7d84c306bf2cb8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,15 @@
using SepCore.Definition;
using UnityEngine;
namespace UI
{
public class GoodsItemRawData
{
public string Title;
public ItemRarity Rarity;
public string Type;
public Sprite Icon;
public string Description;
public int Price;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9b9270fdc0ddab146bd3b5d9b2261a39
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,14 @@
using SepCore.Definition;
using UnityEngine;
namespace UI
{
public class LevelUpRewardItemRawData
{
public string Title;
public Sprite Icon;
public ItemRarity ItemRarity;
public string Description;
public string IconAssetName;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 56a75fb39cca45c4ea220af2c850e677
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -9,7 +9,7 @@ namespace UI
public int CurrentLevel;
public int RefreshPrice;
public int PlayerCoin;
public List<GoodsItemContext> GoodsItems;
public List<GoodsItemRawData> GoodsItems;
public IReadOnlyList<PropItem> PropItems;
public int PropMaxCount = -1;
public IReadOnlyList<WeaponBase> WeaponItems;
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using SepCore.DataTable;
@@ -6,30 +7,30 @@ using Entity;
using Entity.EntityData;
using CustomUtility;
using GameFramework.DataTable;
using Procedure;
using UnityEngine;
using UnityGameFramework.Runtime;
using Random = UnityEngine.Random;
namespace UI
{
internal sealed class ShopRefreshResult
public sealed class ShopRefreshResult
{
public List<GoodsItemContext> GoodsItems;
public List<GoodsItemRawData> GoodsItems;
public int RefreshPrice;
}
internal sealed class ShopPurchaseResult
public sealed class ShopPurchaseResult
{
public int GoodsIndex;
public DisplayItemContext DisplayItem;
public DisplayItemRawData DisplayItem;
}
internal class ShopFormUseCase : IUIUseCase
public class ShopFormUseCase : IUIUseCase
{
private readonly ProcedureGame _procedureGame;
private readonly GameStateShop _gameStateShop;
private readonly Player _player;
private readonly int _currentLevel;
private readonly Action _onShopFinish;
private readonly DRGoods[] _allGoods;
private readonly IDataTable<DRProp> _propDataTable;
private readonly IDataTable<DRWeapon> _weaponDataTable;
@@ -41,7 +42,7 @@ namespace UI
private readonly List<ShopGoodsSelection> _selections = new();
private int _refreshTime;
private Player Player => _procedureGame.Player;
private Player Player => _player;
private sealed class ShopGoodsSelection
{
@@ -50,10 +51,11 @@ namespace UI
public int Price;
}
public ShopFormUseCase(ProcedureGame procedureGame, GameStateShop gameStateShop)
public ShopFormUseCase(Player player, int currentLevel, Action onShopFinish)
{
_procedureGame = procedureGame;
_gameStateShop = gameStateShop;
_player = player;
_currentLevel = currentLevel;
_onShopFinish = onShopFinish;
_allGoods = GameEntry.DataTable.GetDataTable<DRGoods>().ToArray();
_propDataTable = GameEntry.DataTable.GetDataTable<DRProp>();
_weaponDataTable = GameEntry.DataTable.GetDataTable<DRWeapon>();
@@ -67,12 +69,12 @@ namespace UI
_refreshTime = 0;
Player player = Player;
if (_procedureGame == null || player == null)
if (_player == null || player == null)
{
return null;
}
int currentLevel = _procedureGame.CurrentLevel;
int currentLevel = _currentLevel;
return new ShopFormRawData
{
CurrentLevel = currentLevel,
@@ -89,14 +91,14 @@ namespace UI
public ShopRefreshResult TryRefresh(int cost)
{
Player player = Player;
if (player == null || _procedureGame == null || player.Coin < cost)
if (player == null || _player == null || player.Coin < cost)
{
return null;
}
player.Coin -= cost;
int refreshPrice = (_refreshTime + 1) * _procedureGame.CurrentLevel;
int refreshPrice = (_refreshTime + 1) * _currentLevel;
_refreshTime++;
return new ShopRefreshResult
@@ -127,7 +129,7 @@ namespace UI
return null;
}
DisplayItemContext displayItem = ApplyGoodsPurchase(selection);
DisplayItemRawData displayItem = ApplyGoodsPurchase(selection);
if (displayItem == null)
{
return null;
@@ -145,10 +147,10 @@ namespace UI
public void Continue()
{
_gameStateShop.ShopFinish = true;
_onShopFinish?.Invoke();
}
private List<GoodsItemContext> BuildRandomGoodsItems(int count)
private List<GoodsItemRawData> BuildRandomGoodsItems(int count)
{
if (_allGoods == null || _allGoods.Length == 0)
{
@@ -157,10 +159,10 @@ namespace UI
}
int finalCount = Mathf.Min(count, _allGoods.Length);
List<GoodsItemContext> goodsItems = new List<GoodsItemContext>(finalCount);
List<GoodsItemRawData> goodsItems = new List<GoodsItemRawData>(finalCount);
_selections.Clear();
int currentLevel = _procedureGame != null ? _procedureGame.CurrentLevel : 1;
int currentLevel = _currentLevel > 0 ? _currentLevel : 1;
for (int i = 0; i < finalCount; i++)
{
@@ -172,7 +174,7 @@ namespace UI
break;
}
GoodsItemContext goodsItem = new GoodsItemContext();
GoodsItemRawData goodsItem = new GoodsItemRawData();
int price;
if (drGoods.GoodsType == GoodsType.Prop)
@@ -318,7 +320,7 @@ namespace UI
return Mathf.Max(1, finalPrice);
}
private DisplayItemContext ApplyGoodsPurchase(ShopGoodsSelection goods)
private DisplayItemRawData ApplyGoodsPurchase(ShopGoodsSelection goods)
{
if (goods == null || Player == null)
{
@@ -335,7 +337,7 @@ namespace UI
}
Player.AddProp(new PropItem(drProp.Modifiers, drProp.Rarity, drProp.Title, drProp.IconAssetName));
return new DisplayItemContext
return new DisplayItemRawData
{
IconAssetName = drProp.IconAssetName,
Rarity = drProp.Rarity,
@@ -368,7 +370,7 @@ namespace UI
GameEntry.Entity.ShowWeapon(weaponData);
return new DisplayItemContext
return new DisplayItemRawData
{
IconAssetName = drWeapon.IconAssetName,
Rarity = drWeapon.Rarity,
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 07fd450f557f928488983d5aff38ae8f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,8 +1,8 @@
using System;
using System.Text;
using SepCore.DataTable;
using GameFramework.DataTable;
using Procedure;
using UnityEngine;
using Random = UnityEngine.Random;
namespace UI
{
@@ -10,13 +10,13 @@ namespace UI
{
private readonly IDataTable<DRRole> _roleDataTable;
private readonly ProcedureStartMenu _procedureStartMenu;
private readonly Action<int> _onStartGame;
public int SelectedRoleId { get; private set; }
public SelectRoleFormUseCase(ProcedureStartMenu procedureStartMenu)
public SelectRoleFormUseCase(Action<int> onStartGame)
{
_procedureStartMenu = procedureStartMenu;
_onStartGame = onStartGame;
_roleDataTable = GameEntry.DataTable.GetDataTable<DRRole>();
}
@@ -48,7 +48,7 @@ namespace UI
bool result = SelectedRoleId >= 0;
if (result)
{
_procedureStartMenu.StartGame(SelectedRoleId);
_onStartGame?.Invoke(SelectedRoleId);
}
return result;
@@ -96,4 +96,4 @@ namespace UI
return sb.ToString();
}
}
}
}