- 规范 UI 设计成为:
- UIForm 负责展示
- Controller 负责控制
- UseCase 负责业务逻辑
- RawData 负责提供原始数据
- Context 负责为 UIForm 提供数据
- 添加和补充一系列 UI 功能
This commit is contained in:
parent
d650dd63e7
commit
85b0205c73
|
|
@ -78,5 +78,8 @@ crashlytics-build.properties
|
|||
# Temporary auto-generated Android Assets
|
||||
/[Aa]ssets/[Ss]treamingAssets/aa.meta
|
||||
/[Aa]ssets/[Ss]treamingAssets/aa/*
|
||||
/[Aa]ssets/Cainos/*
|
||||
/[Aa]ssets/Cainos.meta
|
||||
|
||||
/UI参考
|
||||
|
||||
/DisplayItemInfoForm_Summary.md
|
||||
/UI_Design_Summary.md
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b2cebe04343227945bab3729ca9a3493
|
||||
timeCreated: 1528026123
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ad56aae2bb0f2ce4a86711287e14e223
|
||||
timeCreated: 1528026123
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
# 商品表
|
||||
# Id GoodsType MinPrice MaxPrice GoodsTypeId
|
||||
# int GoodsType int int int
|
||||
# 商品编号 策划备注 商品类型 最低价格 最高价格 商品对应物品Id
|
||||
101 道具:药 Prop 100 200 101
|
||||
102 小刀 Weapon 120 150 201
|
||||
103 Prop 200 230 102
|
||||
104 Prop 210 250 103
|
||||
105 Prop 80 100 104
|
||||
# 商品表
|
||||
# Id GoodsType GoodsTypeId
|
||||
# int GoodsType int
|
||||
# 商品编号 策划备注 商品类型 商品对应物品Id
|
||||
101 道具:药 Prop 101
|
||||
102 小刀 Weapon 201
|
||||
103 Prop 102
|
||||
104 Prop 103
|
||||
105 Prop 104
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
# 道具表
|
||||
# Id Title IconAssetName Modifiers
|
||||
# int string string StatModifier[]
|
||||
# 奖励编号 策划备注 奖励名 图标资源名 道具属性
|
||||
101 测试道具 肌肉 Almighty_Icon [{"StatType":"Attack","Value":0.05,"IsPercent":true}]
|
||||
102 牙齿 Almighty_Icon [{"StatType":"Attack","Value":0.05,"IsPercent":true}]
|
||||
103 脑 Almighty_Icon [{"StatType":"Attack","Value":0.05,"IsPercent":true}]
|
||||
104 鼻子 Almighty_Icon [{"StatType":"Attack","Value":0.05,"IsPercent":true}]
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 64f3bb52c6a54854688fcc656af2b1c9
|
||||
timeCreated: 1528026123
|
||||
licenseType: Pro
|
||||
guid: e8def20f1612e8844b8f0dda497fa5ba
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,8 +1,24 @@
|
|||
# 道具表
|
||||
# Id Title IconAssetName Modifiers
|
||||
# int string string StatModifier[]
|
||||
# 道具编号 策划备注 道具名 图标资源名 道具属性
|
||||
101 测试道具 药 Almighty_Icon [{"StatType":"MovementSpeed","Value":0.5,"IsPercent":false},{"StatType":"MaxHealth","Value":0.2,"IsPercent":true}]
|
||||
102 小药 Almighty_Icon [{"StatType":"MovementSpeed","Value":0.5,"IsPercent":false},{"StatType":"MaxHealth","Value":0.2,"IsPercent":true}]
|
||||
103 中药 Almighty_Icon [{"StatType":"Critical","Value":20,"IsPercent":false},{"StatType":"Defense","Value":1,"IsPercent":false}]
|
||||
104 大药 Almighty_Icon [{"StatType":"Attack","Value":2,"IsPercent":false},{"StatType":"AttackSpeed","Value":0.1,"IsPercent":true}]
|
||||
# 道具表
|
||||
# Id Title IconAssetName Rarity Price PriceRandomPercent Modifiers
|
||||
# int string string RarityType int float StatModifier[]
|
||||
# 道具编号 策划备注 道具名 图标资源名 道具品质 道具价格 价格浮动 道具属性
|
||||
101 道具_1 Almighty_Icon White 119 0.0500000007450581 [{"StatType":"Attack","Value":10,"IsPercent":false},{"StatType":"Defense","Value":12,"IsPercent":false}]
|
||||
102 道具_2 Almighty_Icon Green 225 0.0799999982118607 [{"StatType":"MaxHealth","Value":53,"IsPercent":false},{"StatType":"AttackSpeed","Value":0.09,"IsPercent":true},{"StatType":"Attack","Value":11,"IsPercent":false}]
|
||||
103 道具_3 Almighty_Icon Blue 329 0.100000001490116 [{"StatType":"Critical","Value":15,"IsPercent":false},{"StatType":"CriticalDamage","Value":21,"IsPercent":false},{"StatType":"Defense","Value":23,"IsPercent":false}]
|
||||
104 道具_4 Almighty_Icon Red 423 0.119999997317791 [{"StatType":"Defense","Value":79,"IsPercent":false}]
|
||||
105 道具_5 Almighty_Icon White 120 0.0500000007450581 [{"StatType":"MovementSpeed","Value":0.8,"IsPercent":false},{"StatType":"Attack","Value":10,"IsPercent":false}]
|
||||
106 道具_6 Almighty_Icon Green 195 0.0799999982118607 [{"StatType":"Dodge","Value":10,"IsPercent":false},{"StatType":"Attack","Value":12,"IsPercent":false},{"StatType":"MaxHealth","Value":44,"IsPercent":false}]
|
||||
107 道具_7 Almighty_Icon Blue 335 0.100000001490116 [{"StatType":"Defense","Value":62,"IsPercent":false}]
|
||||
108 道具_8 Almighty_Icon Red 433 0.119999997317791 [{"StatType":"Attack","Value":44,"IsPercent":false},{"StatType":"Dodge","Value":27,"IsPercent":false}]
|
||||
109 道具_9 Almighty_Icon White 121 0.0500000007450581 [{"StatType":"MaxHealth","Value":32,"IsPercent":false},{"StatType":"Attack","Value":7,"IsPercent":false},{"StatType":"Defense","Value":8,"IsPercent":false}]
|
||||
110 道具_10 Almighty_Icon Green 198 0.0799999982118607 [{"StatType":"AttackSpeed","Value":0.19,"IsPercent":true}]
|
||||
111 道具_11 Almighty_Icon Blue 341 0.100000001490116 [{"StatType":"Attack","Value":57,"IsPercent":false}]
|
||||
112 道具_12 Almighty_Icon Red 443 0.119999997317791 [{"StatType":"MaxHealth","Value":139,"IsPercent":false},{"StatType":"Critical","Value":27,"IsPercent":false}]
|
||||
113 道具_13 Almighty_Icon White 122 0.0500000007450581 [{"StatType":"Critical","Value":5,"IsPercent":false},{"StatType":"Dodge","Value":7,"IsPercent":false},{"StatType":"MovementSpeed","Value":0.6,"IsPercent":false}]
|
||||
114 道具_14 Almighty_Icon Green 201 0.0799999982118607 [{"StatType":"Defense","Value":38,"IsPercent":false}]
|
||||
115 道具_15 Almighty_Icon Blue 346 0.100000001490116 [{"StatType":"MovementSpeed","Value":1.6,"IsPercent":false},{"StatType":"Defense","Value":32,"IsPercent":false}]
|
||||
116 道具_16 Almighty_Icon Red 454 0.119999997317791 [{"StatType":"Dodge","Value":28,"IsPercent":false},{"StatType":"Defense","Value":24,"IsPercent":false},{"StatType":"Attack","Value":24,"IsPercent":false}]
|
||||
117 道具_17 Almighty_Icon White 124 0.0500000007450581 [{"StatType":"Defense","Value":23,"IsPercent":false}]
|
||||
118 道具_18 Almighty_Icon Green 204 0.0799999982118607 [{"StatType":"Attack","Value":17,"IsPercent":false},{"StatType":"MaxHealth","Value":69,"IsPercent":false}]
|
||||
119 道具_19 Almighty_Icon Blue 352 0.100000001490116 [{"StatType":"MaxHealth","Value":74,"IsPercent":false},{"StatType":"Attack","Value":19,"IsPercent":false},{"StatType":"Dodge","Value":20,"IsPercent":false}]
|
||||
120 道具_20 Almighty_Icon Red 464 0.119999997317791 [{"StatType":"AttackSpeed","Value":0.15,"IsPercent":true},{"StatType":"Attack","Value":29,"IsPercent":false},{"StatType":"Defense","Value":27,"IsPercent":false}]
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@
|
|||
# Id RoleName IconAssetName MaxHp Speed Coin WeaponCapacity InitialProperty InitialItem Lv0 Lv1 Lv2 Lv3 Lv4 Lv5 Lv6 Lv7 Lv8 Lv9 Lv10 Lv11 Lv12 Lv13 Lv14 Lv15 Lv16 Lv17 Lv18 Lv19 Lv20 Lv21 Lv22 Lv23 Lv24 Lv25 Lv26 Lv27 Lv28 Lv29 Lv30 Lv31 Lv32 Lv33 Lv34 Lv35 Lv36 Lv37 Lv38 Lv39 Lv40 Lv41 Lv42 Lv43 Lv44 Lv45 Lv46 Lv47 Lv48 Lv49 Lv50 Lv51 Lv52 Lv53 Lv54 Lv55 Lv56 Lv57 Lv58 Lv59 Lv60
|
||||
# int string string int float int int Modifier[] Item[] 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
||||
# 角色编号 策划备注 角色名称 图标资源名 初始最大生命 初始速度 初始金币 最大持有武器数 初始额外属性 初始额外物品 每级升级所需经验
|
||||
101 全能者 全能者 Almighty_Icon 100 4 10 6 [{"StatType":"MovementSpeed","Value":0.5,"IsPercent":false},{"StatType":"MaxHealth","Value":0.2,"IsPercent":true}] [] 100 110 121 133 146 161 177 195 214 236 259 285 314 345 380 418 459 505 556 612 673 740 814 895 985 1083 1192 1311 1442 1586 1745 1919 2111 2323 2555 2810 3091 3400 3740 4114 4526 4979 5476 6024 6626 7289 8018 8820 9702 10672 11739 12913 14204 15625 17187 18906 20797 22876 25164 27680 30448
|
||||
102 老人 老人 Old_Man_Icon 200 3 5 6 [] [] 100 112 125 140 157 176 197 221 248 277 311 348 390 436 489 547 613 687 769 861 965 1080 1210 1355 1518 1700 1904 2132 2388 2675 2996 3356 3758 4209 4714 5280 5914 6623 7418 8308 9305 10422 11672 13073 14642 16399 18367 20571 23039 25804 28900 32368 36252 40603 45475 50932 57044 63889 71556 80143 89760
|
||||
101 全能者 全能者 Almighty_Icon 100 6 10 6 [{"StatType":"MovementSpeed","Value":0.5,"IsPercent":false},{"StatType":"MaxHealth","Value":0.2,"IsPercent":true}] [] 100 110 121 133 146 161 177 195 214 236 259 285 314 345 380 418 459 505 556 612 673 740 814 895 985 1083 1192 1311 1442 1586 1745 1919 2111 2323 2555 2810 3091 3400 3740 4114 4526 4979 5476 6024 6626 7289 8018 8820 9702 10672 11739 12913 14204 15625 17187 18906 20797 22876 25164 27680 30448
|
||||
102 老人 老人 Old_Man_Icon 200 4 5 6 [] [] 100 112 125 140 157 176 197 221 248 277 311 348 390 436 489 547 613 687 769 861 965 1080 1210 1355 1518 1700 1904 2132 2388 2675 2996 3356 3758 4209 4714 5280 5914 6623 7418 8308 9305 10422 11672 13073 14642 16399 18367 20571 23039 25804 28900 32368 36252 40603 45475 50932 57044 63889 71556 80143 89760
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9c3961f379234354e813d7b38146424d
|
||||
timeCreated: 1528026124
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -9,4 +9,6 @@
|
|||
200 开始菜单 StartMenuForm Default False True
|
||||
201 角色选择页 SelectRoleForm Default False True
|
||||
202 游戏商店页 ShopForm Default False True
|
||||
203 游戏HUD HudForm Default False True
|
||||
203 游戏HUD HudForm HUD False True
|
||||
204 角色升级奖励页 LevelUpForm Default False True
|
||||
205 物品信息展示 DisplayItemInfoForm Default False False
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# 武器表
|
||||
# Id Title IconAssetName Attack Cooldown AttackRange AttackSoundId Pramas Modifiers
|
||||
# int string string int float float int string[] StatModifier[]
|
||||
# 武器编号 策划备注 武器名 图标资源名 伤害 冷却 范围 攻击音效编号 额外参数 额外属性
|
||||
201 玩家武器 小刀 Almighty_Icon 100 1.5 3 10000 [] []
|
||||
202 手枪 Almighty_Icon 120 1 10 10000 [] []
|
||||
# 武器表
|
||||
# Id Title IconAssetName Rarity Price PriceRandomPercent Attack Cooldown AttackRange AttackSoundId Pramas Modifiers
|
||||
# int string string RarityType int float int float float int string[] StatModifier[]
|
||||
# 武器编号 策划备注 武器名 图标资源名 道具品质 武器价格 价格浮动 伤害 冷却 范围 攻击音效编号 额外参数 额外属性
|
||||
201 玩家武器 小刀 Almighty_Icon White 120 0.05 100 1.5 3 10000 [] []
|
||||
202 手枪 Almighty_Icon White 130 0.05 120 1 10 10000 [] []
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ Material:
|
|||
- _OutlineSoftness: 0
|
||||
- _OutlineUVSpeedX: 0
|
||||
- _OutlineUVSpeedY: 0
|
||||
- _OutlineWidth: 0
|
||||
- _OutlineWidth: 0.1
|
||||
- _PerspectiveFilter: 0.875
|
||||
- _Reflectivity: 10
|
||||
- _ScaleRatioA: 0.8333333
|
||||
|
|
@ -168,9 +168,9 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 71c1514a6bd24e1e882cebbe1904ce04, type: 3}
|
||||
m_Name: MainTMPFont
|
||||
m_EditorClassIdentifier:
|
||||
hashCode: -1438885570
|
||||
hashCode: 1106704785
|
||||
material: {fileID: -1106088975554028259}
|
||||
materialHashCode: -1897074850
|
||||
materialHashCode: -1461255791
|
||||
m_Version: 1.1.0
|
||||
m_SourceFontFileGUID: 376d7b8f751da3646930f65eab02a204
|
||||
m_SourceFontFile_EditorRef: {fileID: 12800000, guid: 376d7b8f751da3646930f65eab02a204,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
using CustomComponent;
|
||||
using StarForce;
|
||||
using UI;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -22,11 +23,14 @@ public partial class GameEntry : MonoBehaviour
|
|||
|
||||
public static SpriteCacheComponent SpriteCache { get; private set; }
|
||||
|
||||
public static UIRouterComponent UIRouter { get; private set; }
|
||||
|
||||
private static void InitCustomComponents()
|
||||
{
|
||||
BuiltinData = UnityGameFramework.Runtime.GameEntry.GetComponent<BuiltinDataComponent>();
|
||||
HPBar = UnityGameFramework.Runtime.GameEntry.GetComponent<HPBarComponent>();
|
||||
EnemyManager = UnityGameFramework.Runtime.GameEntry.GetComponent<EnemyManagerComponent>();
|
||||
SpriteCache = UnityGameFramework.Runtime.GameEntry.GetComponent<SpriteCacheComponent>();
|
||||
UIRouter = UnityGameFramework.Runtime.GameEntry.GetComponent<UIRouterComponent>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,10 @@ namespace Components
|
|||
/// </summary>
|
||||
[SerializeField] private Transform[] _weaponSlots;
|
||||
|
||||
public IReadOnlyList<WeaponBase> Weapons => _weapons;
|
||||
public IReadOnlyList<PropItem> Props => _props;
|
||||
public int WeaponCapacity => _weaponCapacity;
|
||||
|
||||
public void OnInit(Player player, int weaponCapacity)
|
||||
{
|
||||
_weaponCapacity = weaponCapacity;
|
||||
|
|
@ -97,4 +101,4 @@ namespace Components
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,10 @@ namespace Components
|
|||
{
|
||||
_maxHealthStat = _statComponent.GetStat(StatType.MaxHealth);
|
||||
_maxHealthStatCallback = (modifier, isApply) =>
|
||||
{
|
||||
_statComponent.UpdateStat(_maxHealthStat, modifier, isApply);
|
||||
GameEntry.Event.Fire(this, PlayerHealthChangeEventArgs.Create(0, CurrentHealth, MaxHealth));
|
||||
};
|
||||
_statComponent.Subscribe(StatType.MaxHealth, _maxHealthStatCallback);
|
||||
|
||||
_defenseStat = _statComponent.GetStat(StatType.Defense);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c13ac6879bf568a42b12d798738efd84
|
||||
guid: bce93539c13d79d4fb88e16597c05a27
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Definition.Enum;
|
||||
using UnityGameFramework.Runtime;
|
||||
using UI;
|
||||
|
||||
namespace CustomComponent
|
||||
{
|
||||
public class UIRouterComponent : GameFrameworkComponent
|
||||
{
|
||||
private readonly Dictionary<UIFormType, IUIFormController> _routeControllers = new();
|
||||
|
||||
public void BindUIUseCase(UIFormType uiFormType, IUIUseCase useCase)
|
||||
{
|
||||
IUIFormController controller = GetOrCreateController(uiFormType);
|
||||
controller.BindUseCase(useCase);
|
||||
}
|
||||
|
||||
public int? OpenUI(UIFormType uiFormType, object userData = null)
|
||||
{
|
||||
IUIFormController controller = GetOrCreateController(uiFormType);
|
||||
return controller.OpenUI(userData);
|
||||
}
|
||||
|
||||
public void CloseUI(UIFormType uiFormType)
|
||||
{
|
||||
IUIFormController controller = GetOrCreateController(uiFormType);
|
||||
controller.CloseUI();
|
||||
}
|
||||
|
||||
private IUIFormController GetOrCreateController(UIFormType uiFormType)
|
||||
{
|
||||
if (_routeControllers.TryGetValue(uiFormType, out IUIFormController controller))
|
||||
{
|
||||
return controller;
|
||||
}
|
||||
|
||||
string typename = $"UI.{uiFormType}Controller";
|
||||
Type controllerType = Type.GetType(typename);
|
||||
if (controllerType == null)
|
||||
{
|
||||
controller = new DefaultUIFormController(uiFormType);
|
||||
}
|
||||
else
|
||||
{
|
||||
controller = (IUIFormController)Activator.CreateInstance(controllerType);
|
||||
}
|
||||
|
||||
_routeControllers.Add(uiFormType, controller);
|
||||
return controller;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
foreach (KeyValuePair<UIFormType, IUIFormController> pair in _routeControllers)
|
||||
{
|
||||
pair.Value.CloseUI();
|
||||
}
|
||||
|
||||
_routeControllers.Clear();
|
||||
}
|
||||
|
||||
private class DefaultUIFormController : IUIFormController
|
||||
{
|
||||
private readonly UIFormType _uiFormType;
|
||||
private int? _lastSerialId;
|
||||
|
||||
public DefaultUIFormController(UIFormType uiFormType)
|
||||
{
|
||||
_uiFormType = uiFormType;
|
||||
}
|
||||
|
||||
public int? OpenUI(object userData = null)
|
||||
{
|
||||
_lastSerialId = GameEntry.UI.OpenUIForm(_uiFormType, userData);
|
||||
return _lastSerialId;
|
||||
}
|
||||
|
||||
public void CloseUI()
|
||||
{
|
||||
if (_lastSerialId.HasValue)
|
||||
{
|
||||
GameEntry.UI.CloseUIForm(_lastSerialId.Value);
|
||||
_lastSerialId = null;
|
||||
return;
|
||||
}
|
||||
|
||||
UGuiForm uiForm = GameEntry.UI.GetUIForm(_uiFormType);
|
||||
if (uiForm != null)
|
||||
{
|
||||
GameEntry.UI.CloseUIForm(uiForm);
|
||||
}
|
||||
}
|
||||
|
||||
public void BindUseCase(IUIUseCase useCase)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3ec6493d4e6c45d489e1dd3d5c6228a6
|
||||
guid: b3695ff420be99d44ab812d7e1863044
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
|
@ -1,207 +0,0 @@
|
|||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
// 此文件由工具自动生成,请勿直接修改。
|
||||
// 生成时间:2021-06-16 21:54:35.517
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace DataTable
|
||||
{
|
||||
/// <summary>
|
||||
/// 战机表。
|
||||
/// </summary>
|
||||
public class DRAircraft : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取战机编号。
|
||||
/// </summary>
|
||||
public override int Id
|
||||
{
|
||||
get { return m_Id; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取推进器编号。
|
||||
/// </summary>
|
||||
public int ThrusterId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取武器编号0。
|
||||
/// </summary>
|
||||
public int WeaponId0 { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取武器编号1。
|
||||
/// </summary>
|
||||
public int WeaponId1 { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取武器编号2。
|
||||
/// </summary>
|
||||
public int WeaponId2 { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取装甲编号0。
|
||||
/// </summary>
|
||||
public int ArmorId0 { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取装甲编号1。
|
||||
/// </summary>
|
||||
public int ArmorId1 { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取装甲编号2。
|
||||
/// </summary>
|
||||
public int ArmorId2 { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取死亡特效编号。
|
||||
/// </summary>
|
||||
public int DeadEffectId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取死亡声音编号。
|
||||
/// </summary>
|
||||
public int DeadSoundId { get; private set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
for (int i = 0; i < columnStrings.Length; i++)
|
||||
{
|
||||
columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
ThrusterId = int.Parse(columnStrings[index++]);
|
||||
WeaponId0 = int.Parse(columnStrings[index++]);
|
||||
WeaponId1 = int.Parse(columnStrings[index++]);
|
||||
WeaponId2 = int.Parse(columnStrings[index++]);
|
||||
ArmorId0 = int.Parse(columnStrings[index++]);
|
||||
ArmorId1 = int.Parse(columnStrings[index++]);
|
||||
ArmorId2 = int.Parse(columnStrings[index++]);
|
||||
DeadEffectId = int.Parse(columnStrings[index++]);
|
||||
DeadSoundId = int.Parse(columnStrings[index++]);
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool ParseDataRow(byte[] dataRowBytes, int startIndex, int length, object userData)
|
||||
{
|
||||
using (MemoryStream memoryStream = new MemoryStream(dataRowBytes, startIndex, length, false))
|
||||
{
|
||||
using (BinaryReader binaryReader = new BinaryReader(memoryStream, Encoding.UTF8))
|
||||
{
|
||||
m_Id = binaryReader.Read7BitEncodedInt32();
|
||||
ThrusterId = binaryReader.Read7BitEncodedInt32();
|
||||
WeaponId0 = binaryReader.Read7BitEncodedInt32();
|
||||
WeaponId1 = binaryReader.Read7BitEncodedInt32();
|
||||
WeaponId2 = binaryReader.Read7BitEncodedInt32();
|
||||
ArmorId0 = binaryReader.Read7BitEncodedInt32();
|
||||
ArmorId1 = binaryReader.Read7BitEncodedInt32();
|
||||
ArmorId2 = binaryReader.Read7BitEncodedInt32();
|
||||
DeadEffectId = binaryReader.Read7BitEncodedInt32();
|
||||
DeadSoundId = binaryReader.Read7BitEncodedInt32();
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
private KeyValuePair<int, int>[] m_WeaponId = null;
|
||||
|
||||
public int WeaponIdCount
|
||||
{
|
||||
get { return m_WeaponId.Length; }
|
||||
}
|
||||
|
||||
public int GetWeaponId(int id)
|
||||
{
|
||||
foreach (KeyValuePair<int, int> i in m_WeaponId)
|
||||
{
|
||||
if (i.Key == id)
|
||||
{
|
||||
return i.Value;
|
||||
}
|
||||
}
|
||||
|
||||
throw new GameFrameworkException(Utility.Text.Format("GetWeaponId with invalid id '{0}'.", id));
|
||||
}
|
||||
|
||||
public int GetWeaponIdAt(int index)
|
||||
{
|
||||
if (index < 0 || index >= m_WeaponId.Length)
|
||||
{
|
||||
throw new GameFrameworkException(Utility.Text.Format("GetWeaponIdAt with invalid index '{0}'.", index));
|
||||
}
|
||||
|
||||
return m_WeaponId[index].Value;
|
||||
}
|
||||
|
||||
private KeyValuePair<int, int>[] m_ArmorId = null;
|
||||
|
||||
public int ArmorIdCount
|
||||
{
|
||||
get { return m_ArmorId.Length; }
|
||||
}
|
||||
|
||||
public int GetArmorId(int id)
|
||||
{
|
||||
foreach (KeyValuePair<int, int> i in m_ArmorId)
|
||||
{
|
||||
if (i.Key == id)
|
||||
{
|
||||
return i.Value;
|
||||
}
|
||||
}
|
||||
|
||||
throw new GameFrameworkException(Utility.Text.Format("GetArmorId with invalid id '{0}'.", id));
|
||||
}
|
||||
|
||||
public int GetArmorIdAt(int index)
|
||||
{
|
||||
if (index < 0 || index >= m_ArmorId.Length)
|
||||
{
|
||||
throw new GameFrameworkException(Utility.Text.Format("GetArmorIdAt with invalid index '{0}'.", index));
|
||||
}
|
||||
|
||||
return m_ArmorId[index].Value;
|
||||
}
|
||||
|
||||
private void GeneratePropertyArray()
|
||||
{
|
||||
m_WeaponId = new KeyValuePair<int, int>[]
|
||||
{
|
||||
new KeyValuePair<int, int>(0, WeaponId0),
|
||||
new KeyValuePair<int, int>(1, WeaponId1),
|
||||
new KeyValuePair<int, int>(2, WeaponId2),
|
||||
};
|
||||
|
||||
m_ArmorId = new KeyValuePair<int, int>[]
|
||||
{
|
||||
new KeyValuePair<int, int>(0, ArmorId0),
|
||||
new KeyValuePair<int, int>(1, ArmorId1),
|
||||
new KeyValuePair<int, int>(2, ArmorId2),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e7a6297d01a7dc348b1488bf6245cb1b
|
||||
timeCreated: 1528026147
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
// 此文件由工具自动生成,请勿直接修改。
|
||||
// 生成时间:2021-06-16 21:54:35.539
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace DataTable
|
||||
{
|
||||
/// <summary>
|
||||
/// 装甲表。
|
||||
/// </summary>
|
||||
public class DRArmor : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取装甲编号。
|
||||
/// </summary>
|
||||
public override int Id
|
||||
{
|
||||
get { return m_Id; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取最大生命。
|
||||
/// </summary>
|
||||
public int MaxHP { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取防御力。
|
||||
/// </summary>
|
||||
public int Defense { get; private set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
for (int i = 0; i < columnStrings.Length; i++)
|
||||
{
|
||||
columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
MaxHP = int.Parse(columnStrings[index++]);
|
||||
Defense = int.Parse(columnStrings[index++]);
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool ParseDataRow(byte[] dataRowBytes, int startIndex, int length, object userData)
|
||||
{
|
||||
using (MemoryStream memoryStream = new MemoryStream(dataRowBytes, startIndex, length, false))
|
||||
{
|
||||
using (BinaryReader binaryReader = new BinaryReader(memoryStream, Encoding.UTF8))
|
||||
{
|
||||
m_Id = binaryReader.Read7BitEncodedInt32();
|
||||
MaxHP = binaryReader.Read7BitEncodedInt32();
|
||||
Defense = binaryReader.Read7BitEncodedInt32();
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void GeneratePropertyArray()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,113 +0,0 @@
|
|||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
// 此文件由工具自动生成,请勿直接修改。
|
||||
// 生成时间:2021-06-16 21:54:35.557
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace DataTable
|
||||
{
|
||||
/// <summary>
|
||||
/// 小行星表。
|
||||
/// </summary>
|
||||
public class DRAsteroid : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取小行星编号。
|
||||
/// </summary>
|
||||
public override int Id
|
||||
{
|
||||
get { return m_Id; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取最大生命。
|
||||
/// </summary>
|
||||
public int MaxHP { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取冲击力。
|
||||
/// </summary>
|
||||
public int Attack { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取速度。
|
||||
/// </summary>
|
||||
public float Speed { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取角速度。
|
||||
/// </summary>
|
||||
public float AngularSpeed { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取死亡特效编号。
|
||||
/// </summary>
|
||||
public int DeadEffectId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取死亡声音编号。
|
||||
/// </summary>
|
||||
public int DeadSoundId { get; private set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
for (int i = 0; i < columnStrings.Length; i++)
|
||||
{
|
||||
columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
MaxHP = int.Parse(columnStrings[index++]);
|
||||
Attack = int.Parse(columnStrings[index++]);
|
||||
Speed = float.Parse(columnStrings[index++]);
|
||||
AngularSpeed = float.Parse(columnStrings[index++]);
|
||||
DeadEffectId = int.Parse(columnStrings[index++]);
|
||||
DeadSoundId = int.Parse(columnStrings[index++]);
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool ParseDataRow(byte[] dataRowBytes, int startIndex, int length, object userData)
|
||||
{
|
||||
using (MemoryStream memoryStream = new MemoryStream(dataRowBytes, startIndex, length, false))
|
||||
{
|
||||
using (BinaryReader binaryReader = new BinaryReader(memoryStream, Encoding.UTF8))
|
||||
{
|
||||
m_Id = binaryReader.Read7BitEncodedInt32();
|
||||
MaxHP = binaryReader.Read7BitEncodedInt32();
|
||||
Attack = binaryReader.Read7BitEncodedInt32();
|
||||
Speed = binaryReader.ReadSingle();
|
||||
AngularSpeed = binaryReader.ReadSingle();
|
||||
DeadEffectId = binaryReader.Read7BitEncodedInt32();
|
||||
DeadSoundId = binaryReader.Read7BitEncodedInt32();
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void GeneratePropertyArray()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -18,16 +18,6 @@ namespace DataTable
|
|||
/// </summary>
|
||||
public GoodsType GoodsType { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取最低价格
|
||||
/// </summary>
|
||||
public int MinPrice { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取最高价格
|
||||
/// </summary>
|
||||
public int MaxPrice { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取商品对应具体类型的表Id
|
||||
/// </summary>
|
||||
|
|
@ -43,8 +33,6 @@ namespace DataTable
|
|||
m_Id = int.Parse(fields[index++]);
|
||||
index++;
|
||||
GoodsType = EnumUtility<GoodsType>.Get(fields[index++]);
|
||||
MinPrice = int.Parse(fields[index++]);
|
||||
MaxPrice = int.Parse(fields[index++]);
|
||||
GoodsTypeId = int.Parse(fields[index++]);
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
using Definition.DataStruct;
|
||||
using Newtonsoft.Json;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace DataTable
|
||||
{
|
||||
public class DRLevelUpReward : DataRowBase
|
||||
{
|
||||
private int m_Id;
|
||||
|
||||
public override int Id => m_Id;
|
||||
|
||||
public string Title { get; private set; }
|
||||
|
||||
public string IconAssetName { get; private set; }
|
||||
|
||||
public StatModifier[] Modifiers { get; private set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] fields = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
int index = 0;
|
||||
|
||||
index++;
|
||||
m_Id = int.Parse(fields[index++]);
|
||||
index++;
|
||||
Title = fields[index++];
|
||||
IconAssetName = fields[index++];
|
||||
Modifiers = JsonConvert.DeserializeObject<StatModifier[]>(fields[index++]);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6e945cefd12dc05428a0b4d287784707
|
||||
timeCreated: 1528026147
|
||||
licenseType: Pro
|
||||
guid: d84933d61f76d7942a903b8db26a3ad6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
using Definition.DataStruct;
|
||||
using GameFramework;
|
||||
using Newtonsoft.Json;
|
||||
using StarForce;
|
||||
using UnityGameFramework.Runtime;
|
||||
using Definition.Enum;
|
||||
|
||||
namespace DataTable
|
||||
{
|
||||
|
|
@ -12,6 +14,9 @@ namespace DataTable
|
|||
public override int Id => m_Id;
|
||||
public string Title { get; private set; }
|
||||
public string IconAssetName { get; private set; }
|
||||
public ItemRarity Rarity { get; private set; }
|
||||
public int Price { get; private set; }
|
||||
public float PriceRandomPercent { get; private set; }
|
||||
public StatModifier[] Modifiers { get; private set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
|
|
@ -24,6 +29,9 @@ namespace DataTable
|
|||
index++;
|
||||
Title = fields[index++];
|
||||
IconAssetName = fields[index++];
|
||||
Rarity = EnumUtility<ItemRarity>.Get(fields[index++]);
|
||||
Price = int.Parse(fields[index++]);
|
||||
PriceRandomPercent = float.Parse(fields[index++]);
|
||||
Modifiers = JsonConvert.DeserializeObject<StatModifier[]>(fields[index++]);
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -1,78 +0,0 @@
|
|||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
// 此文件由工具自动生成,请勿直接修改。
|
||||
// 生成时间:2021-06-16 21:54:35.638
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace DataTable
|
||||
{
|
||||
/// <summary>
|
||||
/// 推进器表。
|
||||
/// </summary>
|
||||
public class DRThruster : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取推进器编号。
|
||||
/// </summary>
|
||||
public override int Id
|
||||
{
|
||||
get { return m_Id; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取。
|
||||
/// </summary>
|
||||
public float Speed { get; private set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
for (int i = 0; i < columnStrings.Length; i++)
|
||||
{
|
||||
columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
Speed = float.Parse(columnStrings[index++]);
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool ParseDataRow(byte[] dataRowBytes, int startIndex, int length, object userData)
|
||||
{
|
||||
using (MemoryStream memoryStream = new MemoryStream(dataRowBytes, startIndex, length, false))
|
||||
{
|
||||
using (BinaryReader binaryReader = new BinaryReader(memoryStream, Encoding.UTF8))
|
||||
{
|
||||
m_Id = binaryReader.Read7BitEncodedInt32();
|
||||
Speed = binaryReader.ReadSingle();
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void GeneratePropertyArray()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -26,12 +26,16 @@ namespace DataTable
|
|||
/// 获取武器名称。
|
||||
/// </summary>
|
||||
public string Title { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取图标资源名称。
|
||||
/// </summary>
|
||||
public string IconAssetName { get; private set; }
|
||||
|
||||
public ItemRarity Rarity { get; private set; }
|
||||
public int Price { get; private set; }
|
||||
public float PriceRandomPercent { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取武器伤害。
|
||||
/// </summary>
|
||||
|
|
@ -51,7 +55,7 @@ namespace DataTable
|
|||
/// 获取武器攻击音效。
|
||||
/// </summary>
|
||||
public int AttackSoundId { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取武器额外参数。
|
||||
/// </summary>
|
||||
|
|
@ -72,6 +76,9 @@ namespace DataTable
|
|||
index++;
|
||||
Title = columnStrings[index++];
|
||||
IconAssetName = columnStrings[index++];
|
||||
Rarity = EnumUtility<ItemRarity>.Get(columnStrings[index++]);
|
||||
Price = int.Parse(columnStrings[index++]);
|
||||
PriceRandomPercent = float.Parse(columnStrings[index++]);
|
||||
Attack = int.Parse(columnStrings[index++]);
|
||||
Cooldown = float.Parse(columnStrings[index++]);
|
||||
AttackRange = float.Parse(columnStrings[index++]);
|
||||
|
|
@ -80,7 +87,7 @@ namespace DataTable
|
|||
Modifiers = Utility.Json.ToObject<StatModifier[]>(columnStrings[index++]);
|
||||
|
||||
GeneratePropertyArray();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,20 +1,44 @@
|
|||
using Components;
|
||||
using DataTable;
|
||||
using Definition.Enum;
|
||||
|
||||
namespace Definition.DataStruct
|
||||
{
|
||||
public class PropItem
|
||||
{
|
||||
private DRProp _prop;
|
||||
|
||||
private readonly StatModifier[] _modifiers;
|
||||
public string Title { get; private set; }
|
||||
public string IconAssetName { get; private set; }
|
||||
public ItemRarity Rarity { get; private set; }
|
||||
public StatModifier[] Modifiers => _modifiers;
|
||||
|
||||
public PropItem(DRProp prop)
|
||||
{
|
||||
_prop = prop;
|
||||
if (prop == null) return;
|
||||
|
||||
_modifiers = prop.Modifiers;
|
||||
Title = prop.Title;
|
||||
Rarity = prop.Rarity;
|
||||
IconAssetName = prop.IconAssetName;
|
||||
}
|
||||
|
||||
public PropItem(StatModifier[] modifiers)
|
||||
{
|
||||
_modifiers = modifiers;
|
||||
}
|
||||
|
||||
public PropItem(StatModifier[] modifiers, ItemRarity rarity, string title, string iconAssetName)
|
||||
{
|
||||
_modifiers = modifiers;
|
||||
Title = title;
|
||||
Rarity = rarity;
|
||||
IconAssetName = iconAssetName;
|
||||
}
|
||||
|
||||
public void OnAttach(StatComponent statComponent)
|
||||
{
|
||||
foreach (var modifier in _prop.Modifiers)
|
||||
if (_modifiers == null || statComponent == null) return;
|
||||
foreach (var modifier in _modifiers)
|
||||
{
|
||||
statComponent.AddModifier(modifier);
|
||||
}
|
||||
|
|
@ -22,7 +46,8 @@ namespace Definition.DataStruct
|
|||
|
||||
public void OnDetach(StatComponent statComponent)
|
||||
{
|
||||
foreach (var modifier in _prop.Modifiers)
|
||||
if (_modifiers == null || statComponent == null) return;
|
||||
foreach (var modifier in _modifiers)
|
||||
{
|
||||
statComponent.RemoveModifier(modifier);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
namespace Definition.Enum
|
||||
{
|
||||
public enum ItemRarity
|
||||
{
|
||||
None,
|
||||
White = 1,
|
||||
Green = 2,
|
||||
Blue,
|
||||
Purple,
|
||||
Red
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 836a293c79cb42e42a7235ebdeb3344f
|
||||
timeCreated: 1528026147
|
||||
licenseType: Pro
|
||||
guid: bb7ab0222a370b649956dacb56a122fc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
|
|
@ -12,7 +12,7 @@ namespace Definition.Enum
|
|||
/// </summary>
|
||||
public enum UIFormType : byte
|
||||
{
|
||||
Undefined = 0,
|
||||
TUIForm = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 弹出框。
|
||||
|
|
@ -58,5 +58,10 @@ namespace Definition.Enum
|
|||
/// 升级选择。
|
||||
/// </summary>
|
||||
LevelUpForm = 204,
|
||||
|
||||
/// <summary>
|
||||
/// 物品信息展示页
|
||||
/// </summary>
|
||||
DisplayItemInfoForm = 205,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,20 @@ namespace Entity.EntityData
|
|||
/// </summary>
|
||||
public int Attack => _drWeapon.Attack;
|
||||
|
||||
/// <summary>
|
||||
/// 武器名称。
|
||||
/// </summary>
|
||||
public string Title => _drWeapon.Title;
|
||||
|
||||
/// <summary>
|
||||
/// 图标资源名称。
|
||||
/// </summary>
|
||||
public string IconAssetName => _drWeapon.IconAssetName;
|
||||
|
||||
public ItemRarity Rarity => _drWeapon.Rarity;
|
||||
|
||||
public int Price => _drWeapon.Price;
|
||||
|
||||
/// <summary>
|
||||
/// 攻击间隔。
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using Components;
|
||||
using CustomEvent;
|
||||
using DataTable;
|
||||
|
|
@ -63,6 +64,8 @@ namespace Entity
|
|||
{
|
||||
value -= _expRequires[_currentLevel + 1];
|
||||
_currentLevel++;
|
||||
PendingLevelPoints++;
|
||||
GameEntry.Event.Fire(this, PlayerLevelUpEventArgs.Create());
|
||||
}
|
||||
|
||||
GameEntry.Event.Fire(this, PlayerExpChangeEventArgs.Create(value, _expRequires[_currentLevel + 1]));
|
||||
|
|
@ -71,7 +74,19 @@ namespace Entity
|
|||
}
|
||||
|
||||
public int CurrentLevel => _currentLevel;
|
||||
|
||||
|
||||
public int PendingLevelPoints { get; set; }
|
||||
|
||||
public IReadOnlyList<WeaponBase> Weapons => _backpackComponent != null ? _backpackComponent.Weapons : null;
|
||||
public IReadOnlyList<PropItem> Props => _backpackComponent != null ? _backpackComponent.Props : null;
|
||||
public int WeaponCapacity => _backpackComponent != null ? _backpackComponent.WeaponCapacity : 0;
|
||||
|
||||
public bool AddProp(PropItem prop)
|
||||
{
|
||||
if (prop == null || _backpackComponent == null) return false;
|
||||
return _backpackComponent.AttachProp(prop);
|
||||
}
|
||||
|
||||
public bool Enable
|
||||
{
|
||||
get => _enable;
|
||||
|
|
|
|||
|
|
@ -24,10 +24,15 @@ namespace Entity
|
|||
public abstract class WeaponBase : EntityBase
|
||||
{
|
||||
protected const string AttachPoint = "Weapon Point";
|
||||
|
||||
protected bool _isAttacking = false;
|
||||
|
||||
protected bool _isEnabled = false;
|
||||
|
||||
public WeaponData WeaponData;
|
||||
|
||||
public bool IsAttacking => _isAttacking;
|
||||
|
||||
protected WeaponStateBase _currentState;
|
||||
|
||||
#region FSM
|
||||
|
|
|
|||
|
|
@ -134,6 +134,7 @@ namespace Entity
|
|||
Log.Error("WeaponKnife data is invalid.");
|
||||
return;
|
||||
}
|
||||
WeaponData = _weaponData;
|
||||
|
||||
_collider = GetComponent<Collider>();
|
||||
_rigidbody = GetComponent<Rigidbody>();
|
||||
|
|
@ -329,4 +330,4 @@ namespace Entity
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
using GameFramework;
|
||||
using GameFramework.Event;
|
||||
|
||||
namespace CustomEvent
|
||||
{
|
||||
public class DisplayItemHideEventArgs : GameEventArgs
|
||||
{
|
||||
public static readonly int EventId = typeof(DisplayItemHideEventArgs).GetHashCode();
|
||||
|
||||
public override int Id => EventId;
|
||||
|
||||
|
||||
public DisplayItemHideEventArgs()
|
||||
{
|
||||
}
|
||||
|
||||
public static DisplayItemHideEventArgs Create()
|
||||
{
|
||||
var args = ReferencePool.Acquire<DisplayItemHideEventArgs>();
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a515c94c54304c79b0fa4761f07a732d
|
||||
timeCreated: 1771071838
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
using GameFramework;
|
||||
using GameFramework.Event;
|
||||
using UnityEngine;
|
||||
|
||||
namespace CustomEvent
|
||||
{
|
||||
public class DisplayItemShowEventArgs : GameEventArgs
|
||||
{
|
||||
public static readonly int EventId = typeof(DisplayItemShowEventArgs).GetHashCode();
|
||||
|
||||
public override int Id => EventId;
|
||||
|
||||
public int Index { get; private set; }
|
||||
|
||||
public bool IsWeapon { get; private set; }
|
||||
|
||||
public Vector3 TargetPos { get; private set; }
|
||||
|
||||
public DisplayItemShowEventArgs()
|
||||
{
|
||||
Index = -1;
|
||||
IsWeapon = false;
|
||||
}
|
||||
|
||||
public static DisplayItemShowEventArgs Create(int index, bool isWeapon, Vector3 targetPos)
|
||||
{
|
||||
var args = ReferencePool.Acquire<DisplayItemShowEventArgs>();
|
||||
args.Index = index;
|
||||
args.IsWeapon = isWeapon;
|
||||
args.TargetPos = targetPos;
|
||||
return args;
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
Index = -1;
|
||||
IsWeapon = false;
|
||||
TargetPos = Vector3.zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 51bff2c6818f44398b4b8f7d1448b310
|
||||
timeCreated: 1771071724
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9ee8d2a2a12545b8b8cfc85c5fe912ed
|
||||
timeCreated: 1771071689
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8fc42c90ffa598d4e89c908ad82116d8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
using GameFramework;
|
||||
using GameFramework.Event;
|
||||
|
||||
namespace CustomEvent
|
||||
{
|
||||
public class MenuAboutButtonClickEventArgs : GameEventArgs
|
||||
{
|
||||
public static readonly int EventId = typeof(MenuAboutButtonClickEventArgs).GetHashCode();
|
||||
|
||||
public override int Id => EventId;
|
||||
|
||||
public static MenuAboutButtonClickEventArgs Create()
|
||||
{
|
||||
return ReferencePool.Acquire<MenuAboutButtonClickEventArgs>();
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a9b85e7308914ee49bacd872a67716aa
|
||||
timeCreated: 1528026148
|
||||
licenseType: Pro
|
||||
guid: f58e49962f2db9140aaf209ca65dd2f9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
using GameFramework;
|
||||
using GameFramework.Event;
|
||||
|
||||
namespace CustomEvent
|
||||
{
|
||||
public class MenuFileButtonClickEventArgs : GameEventArgs
|
||||
{
|
||||
public static readonly int EventId = typeof(MenuFileButtonClickEventArgs).GetHashCode();
|
||||
|
||||
public override int Id => EventId;
|
||||
|
||||
public static MenuFileButtonClickEventArgs Create()
|
||||
{
|
||||
return ReferencePool.Acquire<MenuFileButtonClickEventArgs>();
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e093cff04ac83fc47ae21bd659b338ad
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
using GameFramework;
|
||||
using GameFramework.Event;
|
||||
|
||||
namespace CustomEvent
|
||||
{
|
||||
public class MenuGuideButtonClickEventArgs : GameEventArgs
|
||||
{
|
||||
public static readonly int EventId = typeof(MenuGuideButtonClickEventArgs).GetHashCode();
|
||||
|
||||
public override int Id => EventId;
|
||||
|
||||
public static MenuGuideButtonClickEventArgs Create()
|
||||
{
|
||||
return ReferencePool.Acquire<MenuGuideButtonClickEventArgs>();
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b39712010e7085f428e9ef9727bda043
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
using GameFramework;
|
||||
using GameFramework.Event;
|
||||
|
||||
namespace CustomEvent
|
||||
{
|
||||
public class MenuQuitButtonClickEventArgs : GameEventArgs
|
||||
{
|
||||
public static readonly int EventId = typeof(MenuQuitButtonClickEventArgs).GetHashCode();
|
||||
|
||||
public override int Id => EventId;
|
||||
|
||||
public static MenuQuitButtonClickEventArgs Create()
|
||||
{
|
||||
return ReferencePool.Acquire<MenuQuitButtonClickEventArgs>();
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c008a5618fa012842992de55bef3791c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
using GameFramework;
|
||||
using GameFramework.Event;
|
||||
|
||||
namespace CustomEvent
|
||||
{
|
||||
public class MenuSelectRoleConfirmEventArgs : GameEventArgs
|
||||
{
|
||||
public static readonly int EventId = typeof(MenuSelectRoleConfirmEventArgs).GetHashCode();
|
||||
|
||||
public override int Id => EventId;
|
||||
|
||||
public static MenuSelectRoleConfirmEventArgs Create()
|
||||
{
|
||||
return ReferencePool.Acquire<MenuSelectRoleConfirmEventArgs>();
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c360f9423f498704dbb32820841451c0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
using GameFramework;
|
||||
using GameFramework.Event;
|
||||
|
||||
namespace CustomEvent
|
||||
{
|
||||
public class MenuSelectRoleReturnEventArgs : GameEventArgs
|
||||
{
|
||||
public static readonly int EventId = typeof(MenuSelectRoleReturnEventArgs).GetHashCode();
|
||||
|
||||
public override int Id => EventId;
|
||||
|
||||
public static MenuSelectRoleReturnEventArgs Create()
|
||||
{
|
||||
return ReferencePool.Acquire<MenuSelectRoleReturnEventArgs>();
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 25cf88630e365d2428872f6bae81001e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
using GameFramework;
|
||||
using GameFramework.Event;
|
||||
|
||||
namespace CustomEvent
|
||||
{
|
||||
public class MenuSelectRoleSelectedEventArgs : GameEventArgs
|
||||
{
|
||||
public static readonly int EventId = typeof(MenuSelectRoleSelectedEventArgs).GetHashCode();
|
||||
|
||||
public override int Id => EventId;
|
||||
|
||||
public int RoleId { get; private set; } = -1;
|
||||
|
||||
public static MenuSelectRoleSelectedEventArgs Create(int roleId)
|
||||
{
|
||||
var args = ReferencePool.Acquire<MenuSelectRoleSelectedEventArgs>();
|
||||
args.RoleId = roleId;
|
||||
return args;
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
RoleId = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c99f1c134cc628142a36d21c209ed507
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
using GameFramework;
|
||||
using GameFramework.Event;
|
||||
|
||||
namespace CustomEvent
|
||||
{
|
||||
public class MenuSettingButtonClickEventArgs : GameEventArgs
|
||||
{
|
||||
public static readonly int EventId = typeof(MenuSettingButtonClickEventArgs).GetHashCode();
|
||||
|
||||
public override int Id => EventId;
|
||||
|
||||
public static MenuSettingButtonClickEventArgs Create()
|
||||
{
|
||||
return ReferencePool.Acquire<MenuSettingButtonClickEventArgs>();
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d5de2367f2bc83642bbbdc02081ae804
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
using GameFramework;
|
||||
using GameFramework.Event;
|
||||
|
||||
namespace CustomEvent
|
||||
{
|
||||
public class MenuStartGameEventArgs : GameEventArgs
|
||||
{
|
||||
public static readonly int EventId = typeof(MenuStartGameEventArgs).GetHashCode();
|
||||
|
||||
public override int Id => EventId;
|
||||
|
||||
public static MenuStartGameEventArgs Create()
|
||||
{
|
||||
return ReferencePool.Acquire<MenuStartGameEventArgs>();
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 217b0022ddd4a4545a8d8e3d8158a967
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -3,22 +3,22 @@ using GameFramework.Event;
|
|||
|
||||
namespace CustomEvent
|
||||
{
|
||||
public class ShopRefreshEventArgs : GameEventArgs
|
||||
public class RefreshEventArgs : GameEventArgs
|
||||
{
|
||||
public static readonly int EventId = typeof(ShopRefreshEventArgs).GetHashCode();
|
||||
public static readonly int EventId = typeof(RefreshEventArgs).GetHashCode();
|
||||
|
||||
public override int Id => EventId;
|
||||
|
||||
public int Cost { get; private set; }
|
||||
|
||||
public ShopRefreshEventArgs()
|
||||
public RefreshEventArgs()
|
||||
{
|
||||
Cost = 0;
|
||||
}
|
||||
|
||||
public static ShopRefreshEventArgs Create(int cost)
|
||||
public static RefreshEventArgs Create(int cost)
|
||||
{
|
||||
var args = ReferencePool.Acquire<ShopRefreshEventArgs>();
|
||||
var args = ReferencePool.Acquire<RefreshEventArgs>();
|
||||
|
||||
args.Cost = cost;
|
||||
|
||||
|
|
@ -6,6 +6,7 @@
|
|||
//------------------------------------------------------------
|
||||
|
||||
using Definition.DataStruct;
|
||||
using Definition.Enum;
|
||||
using GameFramework;
|
||||
using GameFramework.Event;
|
||||
using GameFramework.Resource;
|
||||
|
|
@ -112,7 +113,7 @@ namespace Procedure
|
|||
if (m_VersionInfo.ForceUpdateGame)
|
||||
{
|
||||
// 需要强制更新游戏应用
|
||||
GameEntry.UI.OpenDialog(new DialogParams
|
||||
GameEntry.UIRouter.OpenUI(UIFormType.DialogForm, new DialogFormRawData
|
||||
{
|
||||
Mode = 2,
|
||||
Title = GameEntry.Localization.GetString("ForceUpdate.Title"),
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ namespace Procedure
|
|||
"Prop",
|
||||
"Role",
|
||||
"Level",
|
||||
"LevelUpReward"
|
||||
};
|
||||
|
||||
private Dictionary<string, bool> _loadedFlag = new Dictionary<string, bool>();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using GameFramework;
|
||||
using GameFramework;
|
||||
using GameFramework.Event;
|
||||
using System.Collections.Generic;
|
||||
using Definition.Enum;
|
||||
using StarForce;
|
||||
using UI;
|
||||
using UnityEngine;
|
||||
|
|
@ -46,7 +47,7 @@ namespace Procedure
|
|||
|
||||
if (Application.internetReachability == NetworkReachability.ReachableViaCarrierDataNetwork)
|
||||
{
|
||||
GameEntry.UI.OpenDialog(new DialogParams
|
||||
GameEntry.UIRouter.OpenUI(UIFormType.DialogForm, new DialogFormRawData
|
||||
{
|
||||
Mode = 2,
|
||||
Title = GameEntry.Localization.GetString("UpdateResourceViaCarrierDataNetwork.Title"),
|
||||
|
|
|
|||
|
|
@ -11,9 +11,13 @@ namespace Procedure
|
|||
public override GameStateType GameStateType => GameStateType.Battle;
|
||||
|
||||
private EnemyManagerComponent _enemyManager = null;
|
||||
|
||||
private int _currentLevel = 0;
|
||||
|
||||
private bool _levelOver;
|
||||
|
||||
private Player Player => _procedureGame.Player;
|
||||
|
||||
private ProcedureGame _procedureGame = null;
|
||||
|
||||
public void LevelOver()
|
||||
|
|
@ -35,8 +39,8 @@ namespace Procedure
|
|||
_currentLevel = _procedureGame.CurrentLevel;
|
||||
_levelOver = false;
|
||||
_enemyManager.OnInit(_currentLevel, this);
|
||||
Player player = _procedureGame.Player;
|
||||
if (player != null) player.Enable = false;
|
||||
|
||||
if (Player != null) Player.Enable = true;
|
||||
}
|
||||
|
||||
public override void OnUpdate(IFsm<IProcedureManager> procedureOwner, float elapseSeconds,
|
||||
|
|
@ -47,7 +51,7 @@ namespace Procedure
|
|||
if (_levelOver)
|
||||
{
|
||||
procedureOwner.SetData<VarByte>("CurrentLevel", (byte)(_currentLevel + 1));
|
||||
_procedureGame.BattleToShop();
|
||||
_procedureGame.BattleToShopOrLevelUp();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -57,8 +61,7 @@ namespace Procedure
|
|||
_enemyManager.OnReset();
|
||||
|
||||
// 停止玩家逻辑
|
||||
Player player = _procedureGame.Player;
|
||||
player.Enable = false;
|
||||
Player.Enable = false;
|
||||
|
||||
// 隐藏所有掉落物实体
|
||||
var entities = GameEntry.Entity.GetEntityGroup("Drop").GetAllEntities();
|
||||
|
|
@ -76,4 +79,4 @@ namespace Procedure
|
|||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
using Definition.Enum;
|
||||
using GameFramework.Fsm;
|
||||
using GameFramework.Procedure;
|
||||
using UI;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace Procedure
|
||||
{
|
||||
public class GameStateLevelUp : GameStateBase
|
||||
{
|
||||
public override GameStateType GameStateType => GameStateType.LevelUp;
|
||||
|
||||
private ProcedureGame _procedureGame;
|
||||
|
||||
public bool IsCompleted { get; set; }
|
||||
|
||||
#region FSM
|
||||
|
||||
public override void OnInit(ProcedureGame master)
|
||||
{
|
||||
Log.Debug("GameStateLevelUp::OnInit");
|
||||
|
||||
_procedureGame = master;
|
||||
|
||||
var useCase = new LevelUpFormUseCase(_procedureGame.Player, this);
|
||||
GameEntry.UIRouter.BindUIUseCase(UIFormType.LevelUpForm, useCase);
|
||||
}
|
||||
|
||||
public override void OnEnter(IFsm<IProcedureManager> procedureOwner)
|
||||
{
|
||||
Log.Debug("GameStateLevelUp::OnEnter");
|
||||
|
||||
IsCompleted = false;
|
||||
|
||||
GameEntry.UIRouter.OpenUI(UIFormType.LevelUpForm);
|
||||
}
|
||||
|
||||
public override void OnUpdate(IFsm<IProcedureManager> procedureOwner, float elapseSeconds,
|
||||
float realElapseSeconds)
|
||||
{
|
||||
if (IsCompleted)
|
||||
{
|
||||
_procedureGame.LevelUpToShop();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnLeave(IFsm<IProcedureManager> procedureOwner)
|
||||
{
|
||||
Log.Debug("GameStateLevelUp::OnLeave");
|
||||
|
||||
GameEntry.UIRouter.CloseUI(UIFormType.LevelUpForm);
|
||||
}
|
||||
|
||||
public override void OnDestroy(IFsm<IProcedureManager> procedureOwner)
|
||||
{
|
||||
_procedureGame = null;
|
||||
|
||||
Log.Debug("GameStateLevelUp::OnDestroy");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: be7365d38adfd8546a0f4b964a128abb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,161 +1,18 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CustomEvent;
|
||||
using DataTable;
|
||||
using Definition.Enum;
|
||||
using Entity;
|
||||
using GameFramework.DataTable;
|
||||
using GameFramework.Fsm;
|
||||
using GameFramework.Procedure;
|
||||
using UI;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace Procedure
|
||||
{
|
||||
public class GameStateShop : GameStateBase
|
||||
{
|
||||
#region Property
|
||||
|
||||
public override GameStateType GameStateType => GameStateType.Shop;
|
||||
|
||||
private ProcedureGame _procedureGame;
|
||||
|
||||
private DRGoods[] _drGoods;
|
||||
|
||||
private DRProp[] _drProps;
|
||||
private IDataTable<DRProp> _propDataTable;
|
||||
|
||||
private IDataTable<DRWeapon> _weaponDataTable;
|
||||
|
||||
private ShopFormController _shopFormController;
|
||||
private ShopFormContext _shopFormContext;
|
||||
|
||||
private LevelUpFormController _levelUpFormController;
|
||||
private LevelUpFormContext _levelUpFormContext;
|
||||
|
||||
private int _shopRefreshTime = 0;
|
||||
|
||||
private Player _player => _procedureGame.Player;
|
||||
|
||||
private bool _shopOver = false;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
#region LevelUp
|
||||
|
||||
private LevelUpFormContext BuildLevelUpFormContext(int count = 4)
|
||||
{
|
||||
List<LevelUpPropContext> props = new List<LevelUpPropContext>();
|
||||
int total = _drProps.Length;
|
||||
if (total <= 0)
|
||||
{
|
||||
Log.Error("GameStateShop::BuildLevelUpFormContext(): _drProps == null");
|
||||
return null;
|
||||
}
|
||||
|
||||
count = Mathf.Min(count, total);
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
int index = Random.Range(0, total);
|
||||
DRProp drProp = _drProps[index];
|
||||
props.Add(new LevelUpPropContext
|
||||
{
|
||||
PropId = drProp.Id,
|
||||
Title = drProp.Title,
|
||||
Type = "Prop",
|
||||
Icon = null,
|
||||
Description = GoodsItemContext.CreatePropDescription(drProp.Modifiers),
|
||||
IconAssetName = drProp.IconAssetName
|
||||
});
|
||||
}
|
||||
|
||||
return new LevelUpFormContext
|
||||
{
|
||||
Level = _player.CurrentLevel,
|
||||
Props = props
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Shop
|
||||
|
||||
private void RefreshGoodsItems()
|
||||
{
|
||||
_shopFormContext = BuildShopFormContext();
|
||||
_shopFormContext.RefreshPrice = (_shopRefreshTime + 1) * _procedureGame.CurrentLevel;
|
||||
_shopRefreshTime++;
|
||||
_shopFormController.OpenUI(_shopFormContext);
|
||||
}
|
||||
|
||||
private ShopFormContext BuildShopFormContext()
|
||||
{
|
||||
int currentLevel = _procedureGame.CurrentLevel;
|
||||
var context = new ShopFormContext
|
||||
{
|
||||
CurrentLevel = currentLevel,
|
||||
RefreshPrice = currentLevel,
|
||||
PlayerCoin = _player.Coin,
|
||||
GoodsItems = InitRandomGoodsItems()
|
||||
};
|
||||
return context;
|
||||
}
|
||||
|
||||
private List<GoodsItemContext> InitRandomGoodsItems(int count = -1)
|
||||
{
|
||||
if (_drGoods == null || _drGoods.Length == 0)
|
||||
{
|
||||
Log.Error("GameStateShop::InitRandomGoodsItems(): _drGoods == null");
|
||||
return null;
|
||||
}
|
||||
|
||||
count = Mathf.Max(count, Random.Range(4, 6));
|
||||
int totalCount = _drGoods.Length;
|
||||
List<GoodsItemContext> items = new List<GoodsItemContext>(count);
|
||||
if (totalCount <= 0) return items;
|
||||
count = Mathf.Min(count, totalCount);
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
int index = Random.Range(0, totalCount);
|
||||
DRGoods drGoods = _drGoods[index];
|
||||
GoodsItemContext goodsItem = new GoodsItemContext
|
||||
{
|
||||
Price = Random.Range(drGoods.MinPrice, drGoods.MaxPrice)
|
||||
};
|
||||
|
||||
if (drGoods.GoodsType == GoodsType.Prop)
|
||||
{
|
||||
DRProp drProp = _propDataTable.GetDataRow(drGoods.GoodsTypeId);
|
||||
goodsItem.Title = drProp.Title;
|
||||
goodsItem.Type = "Prop";
|
||||
GameEntry.SpriteCache.GetSprite(drProp.IconAssetName, sprite => goodsItem.Icon = sprite);
|
||||
goodsItem.Description = GoodsItemContext.CreatePropDescription(drProp.Modifiers);
|
||||
}
|
||||
else if (drGoods.GoodsType == GoodsType.Weapon)
|
||||
{
|
||||
DRWeapon drWeapon = _weaponDataTable.GetDataRow(drGoods.GoodsTypeId);
|
||||
goodsItem.Title = drWeapon.Title;
|
||||
goodsItem.Type = "Weapon";
|
||||
GameEntry.SpriteCache.GetSprite(drWeapon.IconAssetName, sprite => goodsItem.Icon = sprite);
|
||||
goodsItem.Description = GoodsItemContext.CreateWeaponDescription(drWeapon);
|
||||
}
|
||||
|
||||
items.Add(goodsItem);
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
public bool ShopFinish { get; set; }
|
||||
|
||||
#region FSM
|
||||
|
||||
|
|
@ -163,47 +20,25 @@ namespace Procedure
|
|||
{
|
||||
Log.Debug("GameStateShop::OnInit");
|
||||
_procedureGame = master;
|
||||
|
||||
_levelUpFormController = new LevelUpFormController();
|
||||
_shopFormController = new ShopFormController();
|
||||
|
||||
_drGoods = GameEntry.DataTable.GetDataTable<DRGoods>().ToArray();
|
||||
_propDataTable = GameEntry.DataTable.GetDataTable<DRProp>();
|
||||
_drProps = _propDataTable.ToArray();
|
||||
_weaponDataTable = GameEntry.DataTable.GetDataTable<DRWeapon>();
|
||||
|
||||
_shopOver = false;
|
||||
|
||||
var shopFormUseCase = new ShopFormUseCase(_procedureGame, this);
|
||||
GameEntry.UIRouter.BindUIUseCase(UIFormType.ShopForm, shopFormUseCase);
|
||||
}
|
||||
|
||||
public override void OnEnter(IFsm<IProcedureManager> procedureOwner)
|
||||
{
|
||||
Log.Debug("GameStateShop::OnEnter");
|
||||
|
||||
GameEntry.Event.Subscribe(ShopRefreshEventArgs.EventId, ShopRefresh);
|
||||
GameEntry.Event.Subscribe(ShopPurchaseEventArgs.EventId, ShopPurchase);
|
||||
GameEntry.Event.Subscribe(ShopContinueEventArgs.EventId, ShopContinue);
|
||||
GameEntry.Event.Subscribe(CloseUIFormCompleteEventArgs.EventId, CloseUIFormComplete);
|
||||
ShopFinish = false;
|
||||
|
||||
if (_procedureGame.PlayerPendingLevel != 0)
|
||||
{
|
||||
_levelUpFormContext = BuildLevelUpFormContext();
|
||||
_levelUpFormController.OpenUI(_levelUpFormContext);
|
||||
}
|
||||
else
|
||||
{
|
||||
_shopFormContext = BuildShopFormContext();
|
||||
_shopFormController.OpenUI(_shopFormContext);
|
||||
}
|
||||
|
||||
_shopOver = false;
|
||||
GameEntry.UIRouter.OpenUI(UIFormType.ShopForm);
|
||||
}
|
||||
|
||||
public override void OnUpdate(IFsm<IProcedureManager> procedureOwner, float elapseSeconds,
|
||||
float realElapseSeconds)
|
||||
{
|
||||
if (_shopOver)
|
||||
if (ShopFinish)
|
||||
{
|
||||
_shopFormController?.CloseUI();
|
||||
_procedureGame.ShopToBattle();
|
||||
}
|
||||
}
|
||||
|
|
@ -212,96 +47,16 @@ namespace Procedure
|
|||
{
|
||||
Log.Debug("GameStateShop::OnLeave");
|
||||
|
||||
_shopFormContext = null;
|
||||
_shopFormController.CloseUI();
|
||||
_shopFormController = null;
|
||||
|
||||
_levelUpFormContext = null;
|
||||
_levelUpFormController.CloseUI();
|
||||
_levelUpFormController = null;
|
||||
|
||||
GameEntry.Event.Unsubscribe(CloseUIFormCompleteEventArgs.EventId, CloseUIFormComplete);
|
||||
GameEntry.Event.Unsubscribe(ShopRefreshEventArgs.EventId, ShopRefresh);
|
||||
GameEntry.Event.Unsubscribe(ShopPurchaseEventArgs.EventId, ShopPurchase);
|
||||
GameEntry.Event.Unsubscribe(ShopContinueEventArgs.EventId, ShopContinue);
|
||||
GameEntry.UIRouter.CloseUI(UIFormType.ShopForm);
|
||||
}
|
||||
|
||||
public override void OnDestroy(IFsm<IProcedureManager> procedureOwner)
|
||||
{
|
||||
_procedureGame = null;
|
||||
_shopFormController = null;
|
||||
_shopFormContext = null;
|
||||
|
||||
_levelUpFormController = null;
|
||||
_levelUpFormContext = null;
|
||||
|
||||
_drGoods = null;
|
||||
_propDataTable = null;
|
||||
_weaponDataTable = null;
|
||||
|
||||
Log.Debug("GameStateShop::OnDestroy");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Event Handlers
|
||||
|
||||
private void ShopRefresh(object sender, EventArgs e)
|
||||
{
|
||||
if (!(e is ShopRefreshEventArgs args)) return;
|
||||
|
||||
if (_player.Coin < args.Cost) return;
|
||||
_player.Coin -= args.Cost;
|
||||
RefreshGoodsItems();
|
||||
}
|
||||
|
||||
|
||||
private void ShopPurchase(object sender, EventArgs e)
|
||||
{
|
||||
if (!(e is ShopPurchaseEventArgs args)) return;
|
||||
|
||||
int index = args.GoodsIndex;
|
||||
|
||||
if (index < 0 && index >= _shopFormContext.GoodsItems.Count)
|
||||
{
|
||||
Log.Warning("GameStateShop::ShopPurchase: Invalid index");
|
||||
return;
|
||||
}
|
||||
|
||||
if (_player.Coin < _shopFormContext.GoodsItems[index].Price) return;
|
||||
_player.Coin -= _shopFormContext.GoodsItems[index].Price;
|
||||
_shopFormContext.GoodsItems.RemoveAt(index);
|
||||
_shopFormController.OpenUI(_shopFormContext);
|
||||
// TODO: OnGoodsPurchased
|
||||
}
|
||||
|
||||
private void ShopContinue(object sender, EventArgs e)
|
||||
{
|
||||
if (!(e is ShopContinueEventArgs)) return;
|
||||
|
||||
_shopOver = true;
|
||||
}
|
||||
|
||||
private void CloseUIFormComplete(object sender, EventArgs e)
|
||||
{
|
||||
if (!(e is CloseUIFormCompleteEventArgs args)) return;
|
||||
|
||||
if (args.UIFormAssetName == nameof(UIFormType.LevelUpForm))
|
||||
{
|
||||
|
||||
if (--_procedureGame.PlayerPendingLevel != 0)
|
||||
{
|
||||
_levelUpFormContext = BuildLevelUpFormContext();
|
||||
_levelUpFormController.OpenUI(_levelUpFormContext);
|
||||
}
|
||||
else
|
||||
{
|
||||
_levelUpFormContext = BuildLevelUpFormContext();
|
||||
_levelUpFormController.OpenUI(_levelUpFormContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using CustomComponent;
|
||||
using CustomEvent;
|
||||
using DataTable;
|
||||
using Definition.Enum;
|
||||
|
|
@ -8,7 +7,6 @@ using Entity.EntityData;
|
|||
using GameFramework.Event;
|
||||
using GameFramework.Fsm;
|
||||
using GameFramework.Procedure;
|
||||
using StarForce;
|
||||
using UnityGameFramework.Runtime;
|
||||
using UI;
|
||||
|
||||
|
|
@ -19,6 +17,7 @@ namespace Procedure
|
|||
None = 0,
|
||||
Battle = 1,
|
||||
Shop = 2,
|
||||
LevelUp = 3,
|
||||
}
|
||||
|
||||
public class ProcedureGame : ProcedureBase
|
||||
|
|
@ -36,31 +35,28 @@ namespace Procedure
|
|||
private Dictionary<GameStateType, GameStateBase> _gameStates;
|
||||
public Player Player;
|
||||
|
||||
/// <summary>
|
||||
/// 玩家升级可分配点数
|
||||
/// </summary>
|
||||
public int PlayerPendingLevel = 0;
|
||||
|
||||
private void InitGameState()
|
||||
{
|
||||
_gameStates = new Dictionary<GameStateType, GameStateBase>
|
||||
{
|
||||
{ GameStateType.Battle, new GameStateBattle() },
|
||||
{ GameStateType.LevelUp, new GameStateLevelUp() },
|
||||
{ GameStateType.Shop, new GameStateShop() },
|
||||
};
|
||||
_gameStates[GameStateType.Battle].OnInit(this);
|
||||
_gameStates[GameStateType.LevelUp].OnInit(this);
|
||||
_gameStates[GameStateType.Shop].OnInit(this);
|
||||
|
||||
_currentGameState = GameStateType.Battle;
|
||||
_gameStates[_currentGameState].OnEnter(_procedureOwner);
|
||||
}
|
||||
|
||||
public void BattleToShop()
|
||||
public void BattleToShopOrLevelUp()
|
||||
{
|
||||
if (_currentGameState == GameStateType.Shop) return;
|
||||
if (_currentGameState == GameStateType.Shop || _currentGameState == GameStateType.LevelUp) return;
|
||||
|
||||
_gameStates[_currentGameState].OnLeave(_procedureOwner);
|
||||
_currentGameState = GameStateType.Shop;
|
||||
_currentGameState = Player.PendingLevelPoints > 0 ? GameStateType.LevelUp : GameStateType.Shop;
|
||||
_gameStates[_currentGameState].OnEnter(_procedureOwner);
|
||||
}
|
||||
|
||||
|
|
@ -73,6 +69,15 @@ namespace Procedure
|
|||
_gameStates[_currentGameState].OnEnter(_procedureOwner);
|
||||
}
|
||||
|
||||
public void LevelUpToShop()
|
||||
{
|
||||
if (_currentGameState == GameStateType.Shop) return;
|
||||
|
||||
_gameStates[_currentGameState].OnLeave(_procedureOwner);
|
||||
_currentGameState = GameStateType.Shop;
|
||||
_gameStates[_currentGameState].OnEnter(_procedureOwner);
|
||||
}
|
||||
|
||||
#region FSM
|
||||
|
||||
protected override void OnEnter(IFsm<IProcedureManager> procedureOwner)
|
||||
|
|
@ -83,14 +88,13 @@ namespace Procedure
|
|||
|
||||
GameEntry.Event.Subscribe(OpenUIFormSuccessEventArgs.EventId, OpenUIFormSuccess);
|
||||
GameEntry.Event.Subscribe(ShowEntitySuccessEventArgs.EventId, ShowEntitySuccess);
|
||||
GameEntry.Event.Subscribe(PlayerLevelUpEventArgs.EventId, PlayerLevelUp);
|
||||
|
||||
|
||||
CurrentLevel = 1;
|
||||
_currentPlayerData = new PlayerData(-1, 1001);
|
||||
GameEntry.Entity.ShowPlayer(_currentPlayerData);
|
||||
|
||||
GameEntry.UI.OpenUIForm(UIFormType.HudForm, this);
|
||||
|
||||
|
||||
GameEntry.UIRouter.OpenUI(UIFormType.HudForm);
|
||||
|
||||
InitGameState();
|
||||
}
|
||||
|
||||
|
|
@ -107,9 +111,11 @@ namespace Procedure
|
|||
var role = GameEntry.DataTable.GetDataTableRow<DRRole>(selectedRoleId);
|
||||
Player.InitRole(role);
|
||||
_hudInitialized = true;
|
||||
InitGameState();
|
||||
}
|
||||
|
||||
_gameStates[_currentGameState].OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds);
|
||||
if (_hudInitialized)
|
||||
_gameStates[_currentGameState].OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds);
|
||||
}
|
||||
|
||||
protected override void OnLeave(IFsm<IProcedureManager> procedureOwner, bool isShutdown)
|
||||
|
|
@ -121,12 +127,14 @@ namespace Procedure
|
|||
|
||||
_gameStates.Clear();
|
||||
|
||||
_hudForm.Close();
|
||||
GameEntry.UIRouter.CloseUI(UIFormType.HudForm);
|
||||
|
||||
_hudForm = null;
|
||||
|
||||
Player = null;
|
||||
|
||||
_procedureOwner = null;
|
||||
|
||||
GameEntry.Event.Unsubscribe(PlayerLevelUpEventArgs.EventId, PlayerLevelUp);
|
||||
GameEntry.Event.Unsubscribe(OpenUIFormSuccessEventArgs.EventId, OpenUIFormSuccess);
|
||||
GameEntry.Event.Unsubscribe(ShowEntitySuccessEventArgs.EventId, ShowEntitySuccess);
|
||||
|
||||
|
|
@ -141,9 +149,9 @@ namespace Procedure
|
|||
{
|
||||
if (!(e is OpenUIFormSuccessEventArgs args)) return;
|
||||
|
||||
if (args.UserData == this)
|
||||
if (args.UIForm.Logic is HudForm hudForm)
|
||||
{
|
||||
_hudForm = args.UIForm.Logic as HudForm;
|
||||
_hudForm = hudForm;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -151,19 +159,12 @@ namespace Procedure
|
|||
{
|
||||
if (!(e is ShowEntitySuccessEventArgs args)) return;
|
||||
|
||||
if (args.EntityLogicType == typeof(Player))
|
||||
if (args.Entity.Logic is Player player)
|
||||
{
|
||||
Player = args.Entity.Logic as Player;
|
||||
Player = player;
|
||||
}
|
||||
}
|
||||
|
||||
private void PlayerLevelUp(object sender, GameEventArgs e)
|
||||
{
|
||||
if (!(e is PlayerLevelUpEventArgs)) return;
|
||||
|
||||
//PlayerPendingLevel++;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +1,4 @@
|
|||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using Definition.Enum;
|
||||
using GameFramework.Event;
|
||||
using Scene;
|
||||
using UI;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
|
@ -16,31 +8,16 @@ namespace Procedure
|
|||
{
|
||||
public class ProcedureStartMenu : ProcedureBase
|
||||
{
|
||||
private bool _isStartGame = false;
|
||||
private StartMenuForm _startMenuForm = null;
|
||||
private SelectRoleForm _selectRoleForm = null;
|
||||
|
||||
public override bool UseNativeDialog => false;
|
||||
|
||||
private bool _startGame = false;
|
||||
|
||||
private int _selectedRoleId = 0;
|
||||
|
||||
public void StartGame(int roleId)
|
||||
public void StartGame(int selectedRoleId)
|
||||
{
|
||||
_isStartGame = true;
|
||||
_selectedRoleId = roleId;
|
||||
}
|
||||
|
||||
private void OnStartGame(ProcedureOwner procedureOwner)
|
||||
{
|
||||
procedureOwner.SetData<VarInt32>("NextSceneId", (int)SceneId.Game);
|
||||
procedureOwner.SetData<VarInt32>("SelectedRoleId", _selectedRoleId);
|
||||
ChangeState<ProcedureChangeScene>(procedureOwner);
|
||||
}
|
||||
|
||||
public void OpenSelectForm()
|
||||
{
|
||||
_startMenuForm.Close();
|
||||
GameEntry.UI.OpenUIForm(UIFormType.SelectRoleForm, this);
|
||||
_selectedRoleId = selectedRoleId;
|
||||
_startGame = true;
|
||||
}
|
||||
|
||||
#region FSM
|
||||
|
|
@ -48,54 +25,29 @@ namespace Procedure
|
|||
protected override void OnEnter(ProcedureOwner procedureOwner)
|
||||
{
|
||||
base.OnEnter(procedureOwner);
|
||||
|
||||
GameEntry.UIRouter.OpenUI(UIFormType.StartMenuForm);
|
||||
|
||||
// 1. 初始化变量与事件
|
||||
GameEntry.Event.Subscribe(OpenUIFormSuccessEventArgs.EventId, OnOpenUIFormSuccess);
|
||||
_isStartGame = false;
|
||||
|
||||
// 2. 打开 StartMenuForm
|
||||
GameEntry.UI.OpenUIForm(UIFormType.StartMenuForm, this);
|
||||
var useCase2 = new SelectRoleFormUseCase(this);
|
||||
GameEntry.UIRouter.BindUIUseCase(UIFormType.SelectRoleForm, useCase2);
|
||||
}
|
||||
|
||||
protected override void OnLeave(ProcedureOwner procedureOwner, bool isShutdown)
|
||||
{
|
||||
base.OnLeave(procedureOwner, isShutdown);
|
||||
|
||||
GameEntry.Event.Unsubscribe(OpenUIFormSuccessEventArgs.EventId, OnOpenUIFormSuccess);
|
||||
|
||||
if (_startMenuForm != null)
|
||||
{
|
||||
_startMenuForm.Close(true);
|
||||
_startMenuForm = null;
|
||||
}
|
||||
|
||||
if (_selectRoleForm != null)
|
||||
{
|
||||
_selectRoleForm.Close(true);
|
||||
_selectRoleForm = null;
|
||||
}
|
||||
GameEntry.UIRouter.CloseUI(UIFormType.StartMenuForm);
|
||||
GameEntry.UIRouter.CloseUI(UIFormType.SelectRoleForm);
|
||||
}
|
||||
|
||||
protected override void OnUpdate(ProcedureOwner procedureOwner, float elapseSeconds, float realElapseSeconds)
|
||||
{
|
||||
base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds);
|
||||
|
||||
if (_isStartGame)
|
||||
if (_startGame)
|
||||
{
|
||||
OnStartGame(procedureOwner);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Event Handlers
|
||||
|
||||
private void OnOpenUIFormSuccess(object sender, GameEventArgs e)
|
||||
{
|
||||
if (e is OpenUIFormSuccessEventArgs ne)
|
||||
{
|
||||
if (ne.UIForm.Logic is StartMenuForm startMenuForm) _startMenuForm = startMenuForm;
|
||||
if (ne.UIForm.Logic is SelectRoleForm selectRoleForm) _selectRoleForm = selectRoleForm;
|
||||
procedureOwner.SetData<VarInt32>("NextSceneId", (int)SceneId.Game);
|
||||
procedureOwner.SetData<VarInt32>("SelectedRoleId", _selectedRoleId);
|
||||
ChangeState<ProcedureChangeScene>(procedureOwner);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6cf6edb3e93c9814dbeb37df22394fed
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
namespace UI
|
||||
{
|
||||
public interface IUIFormController
|
||||
{
|
||||
int? OpenUI(object userData = null);
|
||||
void CloseUI();
|
||||
void BindUseCase(IUIUseCase useCase);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 08145adf06b2b2c4b9d61d3ef6d39cfc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public interface IUIUseCase
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8b527e4ad6d6207418137211caa179d5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -242,4 +242,4 @@ namespace UI
|
|||
GameEntry.UI.CloseUIForm(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class UIContext
|
||||
{
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue