初始化仓库
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: edd16bf2e418bec43bc774c7fc6c60d6
|
||||
folderAsset: yes
|
||||
timeCreated: 1528026145
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,140 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 游戏入口。
|
||||
/// </summary>
|
||||
public partial class GameEntry : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取游戏基础组件。
|
||||
/// </summary>
|
||||
public static BaseComponent Base { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取配置组件。
|
||||
/// </summary>
|
||||
public static ConfigComponent Config { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取数据结点组件。
|
||||
/// </summary>
|
||||
public static DataNodeComponent DataNode { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取数据表组件。
|
||||
/// </summary>
|
||||
public static DataTableComponent DataTable { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取调试组件。
|
||||
/// </summary>
|
||||
public static DebuggerComponent Debugger { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取下载组件。
|
||||
/// </summary>
|
||||
public static DownloadComponent Download { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取实体组件。
|
||||
/// </summary>
|
||||
public static EntityComponent Entity { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取事件组件。
|
||||
/// </summary>
|
||||
public static EventComponent Event { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取文件系统组件。
|
||||
/// </summary>
|
||||
public static FileSystemComponent FileSystem { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取有限状态机组件。
|
||||
/// </summary>
|
||||
public static FsmComponent Fsm { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取本地化组件。
|
||||
/// </summary>
|
||||
public static LocalizationComponent Localization { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取网络组件。
|
||||
/// </summary>
|
||||
public static NetworkComponent Network { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取对象池组件。
|
||||
/// </summary>
|
||||
public static ObjectPoolComponent ObjectPool { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取流程组件。
|
||||
/// </summary>
|
||||
public static ProcedureComponent Procedure { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源组件。
|
||||
/// </summary>
|
||||
public static ResourceComponent Resource { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取场景组件。
|
||||
/// </summary>
|
||||
public static SceneComponent Scene { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取配置组件。
|
||||
/// </summary>
|
||||
public static SettingComponent Setting { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取声音组件。
|
||||
/// </summary>
|
||||
public static SoundComponent Sound { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取界面组件。
|
||||
/// </summary>
|
||||
public static UIComponent UI { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取网络组件。
|
||||
/// </summary>
|
||||
public static WebRequestComponent WebRequest { get; private set; }
|
||||
|
||||
private static void InitBuiltinComponents()
|
||||
{
|
||||
Base = UnityGameFramework.Runtime.GameEntry.GetComponent<BaseComponent>();
|
||||
Config = UnityGameFramework.Runtime.GameEntry.GetComponent<ConfigComponent>();
|
||||
DataNode = UnityGameFramework.Runtime.GameEntry.GetComponent<DataNodeComponent>();
|
||||
DataTable = UnityGameFramework.Runtime.GameEntry.GetComponent<DataTableComponent>();
|
||||
Debugger = UnityGameFramework.Runtime.GameEntry.GetComponent<DebuggerComponent>();
|
||||
Download = UnityGameFramework.Runtime.GameEntry.GetComponent<DownloadComponent>();
|
||||
Entity = UnityGameFramework.Runtime.GameEntry.GetComponent<EntityComponent>();
|
||||
Event = UnityGameFramework.Runtime.GameEntry.GetComponent<EventComponent>();
|
||||
FileSystem = UnityGameFramework.Runtime.GameEntry.GetComponent<FileSystemComponent>();
|
||||
Fsm = UnityGameFramework.Runtime.GameEntry.GetComponent<FsmComponent>();
|
||||
Localization = UnityGameFramework.Runtime.GameEntry.GetComponent<LocalizationComponent>();
|
||||
Network = UnityGameFramework.Runtime.GameEntry.GetComponent<NetworkComponent>();
|
||||
ObjectPool = UnityGameFramework.Runtime.GameEntry.GetComponent<ObjectPoolComponent>();
|
||||
Procedure = UnityGameFramework.Runtime.GameEntry.GetComponent<ProcedureComponent>();
|
||||
Resource = UnityGameFramework.Runtime.GameEntry.GetComponent<ResourceComponent>();
|
||||
Scene = UnityGameFramework.Runtime.GameEntry.GetComponent<SceneComponent>();
|
||||
Setting = UnityGameFramework.Runtime.GameEntry.GetComponent<SettingComponent>();
|
||||
Sound = UnityGameFramework.Runtime.GameEntry.GetComponent<SoundComponent>();
|
||||
UI = UnityGameFramework.Runtime.GameEntry.GetComponent<UIComponent>();
|
||||
WebRequest = UnityGameFramework.Runtime.GameEntry.GetComponent<WebRequestComponent>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 98387342fa09ebd46a2ab54100d80c2f
|
||||
timeCreated: 1528026146
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,32 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using CustomComponent;
|
||||
using StarForce;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 游戏入口。
|
||||
/// </summary>
|
||||
public partial class GameEntry : MonoBehaviour
|
||||
{
|
||||
public static BuiltinDataComponent BuiltinData { get; private set; }
|
||||
|
||||
public static HPBarComponent HPBar { get; private set; }
|
||||
|
||||
public static EnemyManagerComponent EnemyManager { get; private set; }
|
||||
|
||||
public static SpriteCacheComponent SpriteCache { 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>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f95ee7b97daca3f44a2f5cf743bb39ac
|
||||
timeCreated: 1528026146
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 游戏入口。
|
||||
/// </summary>
|
||||
public partial class GameEntry : MonoBehaviour
|
||||
{
|
||||
private void Start()
|
||||
{
|
||||
InitBuiltinComponents();
|
||||
InitCustomComponents();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3d09b8a3e8c0e7e4dbcfd2fa52bf69ea
|
||||
timeCreated: 1528026145
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: -100
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 33ba0562010e2da46883baefb271f573
|
||||
folderAsset: yes
|
||||
timeCreated: 1528026146
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,77 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using Definition.DataStruct;
|
||||
using GameFramework;
|
||||
using StarForce;
|
||||
using UI;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace CustomComponent
|
||||
{
|
||||
public class BuiltinDataComponent : GameFrameworkComponent
|
||||
{
|
||||
[SerializeField]
|
||||
private TextAsset m_BuildInfoTextAsset = null;
|
||||
|
||||
[SerializeField]
|
||||
private TextAsset m_DefaultDictionaryTextAsset = null;
|
||||
|
||||
[SerializeField]
|
||||
private UpdateResourceForm m_UpdateResourceFormTemplate = null;
|
||||
|
||||
private BuildInfo m_BuildInfo = null;
|
||||
|
||||
public BuildInfo BuildInfo
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_BuildInfo;
|
||||
}
|
||||
}
|
||||
|
||||
public UpdateResourceForm UpdateResourceFormTemplate
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_UpdateResourceFormTemplate;
|
||||
}
|
||||
}
|
||||
|
||||
public void InitBuildInfo()
|
||||
{
|
||||
if (m_BuildInfoTextAsset == null || string.IsNullOrEmpty(m_BuildInfoTextAsset.text))
|
||||
{
|
||||
Log.Info("Build info can not be found or empty.");
|
||||
return;
|
||||
}
|
||||
|
||||
m_BuildInfo = Utility.Json.ToObject<BuildInfo>(m_BuildInfoTextAsset.text);
|
||||
if (m_BuildInfo == null)
|
||||
{
|
||||
Log.Warning("Parse build info failure.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void InitDefaultDictionary()
|
||||
{
|
||||
if (m_DefaultDictionaryTextAsset == null || string.IsNullOrEmpty(m_DefaultDictionaryTextAsset.text))
|
||||
{
|
||||
Log.Info("Default dictionary can not be found or empty.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GameEntry.Localization.ParseData(m_DefaultDictionaryTextAsset.text))
|
||||
{
|
||||
Log.Warning("Parse default dictionary failure.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cfb0b001fcb30fe45ac95ddb8c28ba57
|
||||
timeCreated: 1528026146
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3ecda907b9217e5499e31cb81a154ff4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Entity;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Components
|
||||
{
|
||||
public class AttackComponent : MonoBehaviour
|
||||
{
|
||||
private bool _isAttacking = false;
|
||||
private List<WeaponBase> _weapons;
|
||||
|
||||
public void SetIsAttacking(bool isAttacking) => _isAttacking = isAttacking;
|
||||
|
||||
public void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnUpdate(float elapsedTime, float realElapseSeconds)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a2b35b5ae4185cb4cab2d84b0569db3d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,100 @@
|
||||
using System.Collections.Generic;
|
||||
using CustomEvent;
|
||||
using Definition.DataStruct;
|
||||
using Entity;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Components
|
||||
{
|
||||
public class BackpackComponent : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// 武器槽容量,由DRRole决定。
|
||||
/// </summary>
|
||||
private int _weaponCapacity;
|
||||
|
||||
/// <summary>
|
||||
/// 玩家类引用。
|
||||
/// </summary>
|
||||
private Player _player;
|
||||
|
||||
/// <summary>
|
||||
/// 武器列表。
|
||||
/// </summary>
|
||||
private List<WeaponBase> _weapons;
|
||||
|
||||
/// <summary>
|
||||
/// 道具列表。
|
||||
/// </summary>
|
||||
private List<PropItem> _props;
|
||||
|
||||
/// <summary>
|
||||
/// 玩家状态组件引用,用于道具效果的应用。
|
||||
/// </summary>
|
||||
private StatComponent _statComponent;
|
||||
|
||||
/// <summary>
|
||||
/// 武器装备槽,在 Editor 中进行配置,表示武器在世界中的显示位置。
|
||||
/// </summary>
|
||||
[SerializeField] private Transform[] _weaponSlots;
|
||||
|
||||
public void OnInit(Player player, int weaponCapacity)
|
||||
{
|
||||
_weaponCapacity = weaponCapacity;
|
||||
_player = player;
|
||||
|
||||
_weapons = new List<WeaponBase>(_weaponCapacity);
|
||||
_props = new List<PropItem>();
|
||||
_statComponent = GetComponent<StatComponent>();
|
||||
}
|
||||
|
||||
public void OnReset()
|
||||
{
|
||||
_weapons.Clear();
|
||||
_props.Clear();
|
||||
}
|
||||
|
||||
public bool AttachWeapon(WeaponBase weapon)
|
||||
{
|
||||
if (_weapons.Count == _weaponCapacity) return false;
|
||||
GameEntry.Entity.AttachEntity(weapon.Id, _player.Id, _weaponSlots[_weapons.Count]);
|
||||
_weapons.Add(weapon);
|
||||
weapon.SetEnabled(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool DetachWeapon(WeaponBase weapon)
|
||||
{
|
||||
bool result = _weapons.Remove(weapon);
|
||||
if (result)
|
||||
{
|
||||
GameEntry.Entity.DetachEntity(weapon.Id, _player.Id);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool AttachProp(PropItem prop)
|
||||
{
|
||||
_props.Add(prop);
|
||||
prop.OnAttach(_statComponent);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool DetachProp(PropItem prop)
|
||||
{
|
||||
_props.Remove(prop);
|
||||
prop.OnDetach(_statComponent);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SetWeaponState(bool state)
|
||||
{
|
||||
if (_weapons == null) return;
|
||||
foreach (var weapon in _weapons)
|
||||
{
|
||||
weapon.SetEnabled(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2980af28a40c84247a688f6b684dd4c3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,122 @@
|
||||
using System;
|
||||
using CustomEvent;
|
||||
using Definition.DataStruct;
|
||||
using Definition.Enum;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Components
|
||||
{
|
||||
public class HealthComponent : MonoBehaviour
|
||||
{
|
||||
private int _maxHealthBase;
|
||||
private int _currentHealth;
|
||||
private bool _isDead => _currentHealth <= 0;
|
||||
|
||||
private StatComponent _statComponent;
|
||||
|
||||
private StatProperty _maxHealthStat;
|
||||
private Action<StatModifier, bool> _maxHealthStatCallback;
|
||||
public StatProperty MaxHealthStat => _maxHealthStat;
|
||||
|
||||
private StatProperty _defenseStat;
|
||||
private Action<StatModifier, bool> _defenseStatCallback;
|
||||
public StatProperty DefenseStat => _defenseStat;
|
||||
|
||||
private StatProperty _dodgeStat;
|
||||
private Action<StatModifier, bool> _dodgeStatCallback;
|
||||
public StatProperty DodgeStat => _dodgeStat;
|
||||
|
||||
private bool _isPlayer => _statComponent != null;
|
||||
|
||||
public float HealthRatio => MaxHealth > 0 ? (float)CurrentHealth / MaxHealth : 0f;
|
||||
|
||||
public int MaxHealth => Mathf.CeilToInt((_maxHealthBase + _maxHealthStat.Value) * _maxHealthStat.Percent);
|
||||
|
||||
public int CurrentHealth
|
||||
{
|
||||
get => _currentHealth;
|
||||
set => _currentHealth = value;
|
||||
}
|
||||
|
||||
#region FSM
|
||||
|
||||
public void OnInit(int maxHealth, StatComponent statComponent = null)
|
||||
{
|
||||
_maxHealthBase = maxHealth;
|
||||
_currentHealth = maxHealth;
|
||||
_statComponent = statComponent;
|
||||
|
||||
_statComponent = statComponent;
|
||||
if (_statComponent != null)
|
||||
{
|
||||
_maxHealthStat = _statComponent.GetStat(StatType.MaxHealth);
|
||||
_maxHealthStatCallback = (modifier, isApply) =>
|
||||
_statComponent.UpdateStat(_maxHealthStat, modifier, isApply);
|
||||
_statComponent.Subscribe(StatType.MaxHealth, _maxHealthStatCallback);
|
||||
|
||||
_defenseStat = _statComponent.GetStat(StatType.Defense);
|
||||
_defenseStatCallback = (modifier, isApply) =>
|
||||
_statComponent.UpdateStat(_defenseStat, modifier, isApply);
|
||||
_statComponent.Subscribe(StatType.Defense, _defenseStatCallback);
|
||||
|
||||
_dodgeStat = _statComponent.GetStat(StatType.Dodge);
|
||||
_dodgeStatCallback = (modifier, isApply) =>
|
||||
_statComponent.UpdateStat(_dodgeStat, modifier, isApply);
|
||||
_statComponent.Subscribe(StatType.Dodge, _dodgeStatCallback);
|
||||
}
|
||||
else
|
||||
{
|
||||
_maxHealthStat = new StatProperty();
|
||||
_defenseStat = new StatProperty();
|
||||
_dodgeStat = new StatProperty();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnReset()
|
||||
{
|
||||
if (_statComponent != null)
|
||||
{
|
||||
_statComponent.Unsubscribe(StatType.MaxHealth, _maxHealthStatCallback);
|
||||
_maxHealthStatCallback = null;
|
||||
|
||||
_statComponent.Unsubscribe(StatType.Defense, _defenseStatCallback);
|
||||
_defenseStatCallback = null;
|
||||
|
||||
_statComponent.Unsubscribe(StatType.Dodge, _dodgeStatCallback);
|
||||
_dodgeStatCallback = null;
|
||||
}
|
||||
|
||||
_statComponent = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public void TakeDamage(int damage)
|
||||
{
|
||||
if (_isDead) return;
|
||||
|
||||
if (_dodgeStat.Value > UnityEngine.Random.value)
|
||||
{
|
||||
damage = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int defenseValue = (int)_defenseStat.Value;
|
||||
float defensePercent = _defenseStat.Percent;
|
||||
damage -= defenseValue;
|
||||
damage = Mathf.CeilToInt(damage / defensePercent);
|
||||
}
|
||||
|
||||
_currentHealth -= damage;
|
||||
CauseDamage(damage);
|
||||
if (_isPlayer)
|
||||
GameEntry.Event.Fire(this, PlayerHealthChangeEventArgs.Create(damage, CurrentHealth, MaxHealth));
|
||||
}
|
||||
|
||||
private void CauseDamage(int damage)
|
||||
{
|
||||
//TODO:受击效果:跳字、粒子
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce4964a40efccaa4fb22df63713b567b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,51 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Components
|
||||
{
|
||||
public class InputComponent : MonoBehaviour
|
||||
{
|
||||
private PlayerInputActions _inputActions;
|
||||
[SerializeField] private bool _isListening = false;
|
||||
|
||||
[SerializeField] private Vector3 _direction = Vector3.zero;
|
||||
public Vector3 Direction => _direction;
|
||||
|
||||
public void OnInit()
|
||||
{
|
||||
_inputActions = new();
|
||||
}
|
||||
|
||||
public void OnUpdate(float elapseSeconds, float realElapseSeconds)
|
||||
{
|
||||
if (_isListening && _inputActions != null)
|
||||
{
|
||||
ReadInput();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnReset()
|
||||
{
|
||||
_inputActions = null;
|
||||
_isListening = false;
|
||||
}
|
||||
|
||||
private void ReadInput()
|
||||
{
|
||||
Vector2 rawDir = _inputActions.Game.Move.ReadValue<Vector2>();
|
||||
_direction = new Vector3(rawDir.x, 0, rawDir.y);
|
||||
}
|
||||
|
||||
public void SetListening(bool isListening)
|
||||
{
|
||||
_isListening = isListening;
|
||||
if (_isListening)
|
||||
{
|
||||
_inputActions.Enable();
|
||||
}
|
||||
else
|
||||
{
|
||||
_inputActions.Disable();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f754cc5f339dcfa4aaec3aa32260c4b8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using Definition.DataStruct;
|
||||
using Definition.Enum;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace Components
|
||||
{
|
||||
public class MovementComponent : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private bool _isMoving;
|
||||
[SerializeField] private Vector3 _direction;
|
||||
[SerializeField] private Transform _cachedTransform;
|
||||
|
||||
public float Speed => (_speedBase + _movementStat.Value) * _movementStat.Percent;
|
||||
[SerializeField] private float _speedBase;
|
||||
|
||||
private StatComponent _statComponent;
|
||||
|
||||
private StatProperty _movementStat;
|
||||
private Action<StatModifier, bool> _movementStatCallback;
|
||||
|
||||
public void OnInit(float speed, Transform target, StatComponent statComponent = null)
|
||||
{
|
||||
_speedBase = speed;
|
||||
_cachedTransform = target;
|
||||
_direction = Vector3.forward;
|
||||
|
||||
_statComponent = statComponent;
|
||||
if (_statComponent != null)
|
||||
{
|
||||
_movementStat = _statComponent.GetStat(StatType.MovementSpeed);
|
||||
_movementStatCallback = (modifier, isApply) =>
|
||||
_statComponent.UpdateStat(_movementStat, modifier, isApply);
|
||||
_statComponent.Subscribe(StatType.MovementSpeed, _movementStatCallback);
|
||||
}
|
||||
else
|
||||
{
|
||||
_movementStat = new StatProperty();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnUpdate(float elapseSeconds, float realElapseSeconds)
|
||||
{
|
||||
if (_isMoving && _cachedTransform != null)
|
||||
{
|
||||
Move(elapseSeconds);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnReset()
|
||||
{
|
||||
_speedBase = 0;
|
||||
_cachedTransform = null;
|
||||
_direction = Vector3.zero;
|
||||
_isMoving = false;
|
||||
|
||||
if (_statComponent != null)
|
||||
{
|
||||
_statComponent.Unsubscribe(StatType.MovementSpeed, _movementStatCallback);
|
||||
_movementStatCallback = null;
|
||||
}
|
||||
|
||||
_statComponent = null;
|
||||
}
|
||||
|
||||
private void Move(float deltaTime = 0)
|
||||
{
|
||||
this.transform.Translate(Speed * deltaTime * _direction);
|
||||
}
|
||||
|
||||
public void SetMove(bool isMoving) => _isMoving = isMoving;
|
||||
public void SetDirection(Vector3 direction) => _direction = direction;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9baf591df06b9bb44ba5313457ba84b3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Definition.DataStruct;
|
||||
using Definition.Enum;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Components
|
||||
{
|
||||
public class StatComponent : MonoBehaviour
|
||||
{
|
||||
private Dictionary<StatType, List<StatModifier>> _statModifiers;
|
||||
private Dictionary<StatType, Action<StatModifier, bool>> _statModifierCallbacks;
|
||||
|
||||
public void OnInit()
|
||||
{
|
||||
_statModifiers = new Dictionary<StatType, List<StatModifier>>();
|
||||
_statModifierCallbacks = new Dictionary<StatType, Action<StatModifier, bool>>();
|
||||
}
|
||||
|
||||
public void OnReset()
|
||||
{
|
||||
_statModifiers.Clear();
|
||||
_statModifierCallbacks.Clear();
|
||||
}
|
||||
|
||||
public void AddModifier(StatModifier modifier)
|
||||
{
|
||||
if (!_statModifiers.TryGetValue(modifier.StatType, out var modifiers))
|
||||
{
|
||||
_statModifiers.Add(modifier.StatType, modifiers = new List<StatModifier>());
|
||||
modifiers.Add(modifier);
|
||||
}
|
||||
else
|
||||
{
|
||||
modifiers.Add(modifier);
|
||||
}
|
||||
|
||||
if (_statModifierCallbacks.TryGetValue(modifier.StatType, out var callbacks))
|
||||
callbacks?.Invoke(modifier, true);
|
||||
}
|
||||
|
||||
public void RemoveModifier(StatModifier modifier)
|
||||
{
|
||||
if (_statModifiers.TryGetValue(modifier.StatType, out var modifiers))
|
||||
{
|
||||
_statModifiers[modifier.StatType].Remove(modifier);
|
||||
}
|
||||
|
||||
if (_statModifierCallbacks.TryGetValue(modifier.StatType, out var callbacks))
|
||||
callbacks?.Invoke(modifier, false);
|
||||
}
|
||||
|
||||
public void Subscribe(StatType statType, Action<StatModifier, bool> callback)
|
||||
{
|
||||
if (!_statModifierCallbacks.TryAdd(statType, callback))
|
||||
{
|
||||
_statModifierCallbacks[statType] += callback;
|
||||
}
|
||||
}
|
||||
|
||||
public void Unsubscribe(StatType statType, Action<StatModifier, bool> callback)
|
||||
{
|
||||
if (!_statModifierCallbacks.TryGetValue(statType, out var callbacks))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
callbacks -= callback;
|
||||
if (callbacks == null)
|
||||
{
|
||||
_statModifierCallbacks.Remove(statType);
|
||||
}
|
||||
}
|
||||
|
||||
public StatProperty GetStat(StatType statType)
|
||||
{
|
||||
var result = new StatProperty();
|
||||
|
||||
if (!_statModifiers.TryGetValue(statType, out var modifiers)) return result;
|
||||
|
||||
foreach (var modifier in modifiers)
|
||||
{
|
||||
if (modifier.IsPercent) result.Percent += modifier.Value;
|
||||
else result.Value += modifier.Value;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void UpdateStat(StatProperty stat, StatModifier modifier, bool isApply)
|
||||
{
|
||||
float coef = isApply ? 1f : -1f;
|
||||
if (modifier.IsPercent)
|
||||
{
|
||||
stat.Percent += modifier.Value * coef;
|
||||
}
|
||||
else
|
||||
{
|
||||
stat.Value += modifier.Value * coef;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5befb68803e86e248873416ce662184b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 35199cfd0c69c8c42895c16263b21b7b
|
||||
folderAsset: yes
|
||||
timeCreated: 1528026146
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,56 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DataTable
|
||||
{
|
||||
public static class BinaryReaderExtension
|
||||
{
|
||||
public static Color32 ReadColor32(this BinaryReader binaryReader)
|
||||
{
|
||||
return new Color32(binaryReader.ReadByte(), binaryReader.ReadByte(), binaryReader.ReadByte(), binaryReader.ReadByte());
|
||||
}
|
||||
|
||||
public static Color ReadColor(this BinaryReader binaryReader)
|
||||
{
|
||||
return new Color(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle());
|
||||
}
|
||||
|
||||
public static DateTime ReadDateTime(this BinaryReader binaryReader)
|
||||
{
|
||||
return new DateTime(binaryReader.ReadInt64());
|
||||
}
|
||||
|
||||
public static Quaternion ReadQuaternion(this BinaryReader binaryReader)
|
||||
{
|
||||
return new Quaternion(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle());
|
||||
}
|
||||
|
||||
public static Rect ReadRect(this BinaryReader binaryReader)
|
||||
{
|
||||
return new Rect(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle());
|
||||
}
|
||||
|
||||
public static Vector2 ReadVector2(this BinaryReader binaryReader)
|
||||
{
|
||||
return new Vector2(binaryReader.ReadSingle(), binaryReader.ReadSingle());
|
||||
}
|
||||
|
||||
public static Vector3 ReadVector3(this BinaryReader binaryReader)
|
||||
{
|
||||
return new Vector3(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle());
|
||||
}
|
||||
|
||||
public static Vector4 ReadVector4(this BinaryReader binaryReader)
|
||||
{
|
||||
return new Vector4(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f303871e05cae2d489d6ba3adb6e39d3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,207 @@
|
||||
//------------------------------------------------------------
|
||||
// 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),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e7a6297d01a7dc348b1488bf6245cb1b
|
||||
timeCreated: 1528026147
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,85 @@
|
||||
//------------------------------------------------------------
|
||||
// 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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e945cefd12dc05428a0b4d287784707
|
||||
timeCreated: 1528026147
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,113 @@
|
||||
//------------------------------------------------------------
|
||||
// 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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 836a293c79cb42e42a7235ebdeb3344f
|
||||
timeCreated: 1528026147
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,32 @@
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace DataTable
|
||||
{
|
||||
public class DREnemy : DataRowBase
|
||||
{
|
||||
private int m_id;
|
||||
public override int Id => m_id;
|
||||
public int MaxHealth { get; private set; }
|
||||
public float Speed { get; private set; }
|
||||
public int DropCoin { get; private set; }
|
||||
public int DropExp { get; private set; }
|
||||
public float DropPercent { get; private set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
MaxHealth = int.Parse(columnStrings[index++]);
|
||||
Speed = float.Parse(columnStrings[index++]);
|
||||
DropCoin = int.Parse(columnStrings[index++]);
|
||||
DropExp = int.Parse(columnStrings[index++]);
|
||||
DropPercent = float.Parse(columnStrings[index++]);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 65140fe454964f14951a73965686fb0e
|
||||
timeCreated: 1769221617
|
||||
@@ -0,0 +1,74 @@
|
||||
//------------------------------------------------------------
|
||||
// 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.576
|
||||
//------------------------------------------------------------
|
||||
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace DataTable
|
||||
{
|
||||
/// <summary>
|
||||
/// 实体表。
|
||||
/// </summary>
|
||||
public class DREntity : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取实体编号。
|
||||
/// </summary>
|
||||
public override int Id
|
||||
{
|
||||
get { return m_Id; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源名称。
|
||||
/// </summary>
|
||||
public string AssetName { 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++;
|
||||
AssetName = 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();
|
||||
AssetName = binaryReader.ReadString();
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void GeneratePropertyArray()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a48a9c6b974d6674f8a0421fc603dc56
|
||||
timeCreated: 1528026147
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,53 @@
|
||||
using Definition.Enum;
|
||||
using StarForce;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace DataTable
|
||||
{
|
||||
public class DRGoods : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取商品Id。
|
||||
/// </summary>
|
||||
public override int Id => m_Id;
|
||||
|
||||
/// <summary>
|
||||
/// 获取商品类型。
|
||||
/// </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>
|
||||
public int GoodsTypeId { get; 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++;
|
||||
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,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 595bda561b5491c4e878f071ceb31089
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,110 @@
|
||||
using System;
|
||||
using Definition.DataStruct;
|
||||
using Definition.Enum;
|
||||
using StarForce;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace DataTable
|
||||
{
|
||||
public class DRLevel : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取关卡编号。
|
||||
/// </summary>
|
||||
public override int Id => m_Id;
|
||||
|
||||
/// <summary>
|
||||
/// 获取关卡内会生成的实体编号
|
||||
/// </summary>
|
||||
public int[] EntityIds { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取关卡内每次生成实体的数量
|
||||
/// </summary>
|
||||
public int[] EntityCounts { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取关卡内生成实体的间隔时间
|
||||
/// </summary>
|
||||
public float[] Intervals { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取关卡时间。
|
||||
/// </summary>
|
||||
public int Duration { get; private set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
GenerateEntityIds(columnStrings[index++]);
|
||||
GenerateEntityCounts(columnStrings[index++]);
|
||||
GenerateIntervals(columnStrings[index++]);
|
||||
Duration = int.Parse(columnStrings[index++]);
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void GeneratePropertyArray()
|
||||
{
|
||||
}
|
||||
|
||||
private void GenerateEntityIds(string raw)
|
||||
{
|
||||
if (!raw.StartsWith('[') || !raw.EndsWith(']'))
|
||||
{
|
||||
throw new ArgumentException("Input must be enclosed in square brackets.");
|
||||
}
|
||||
|
||||
if (raw.Length == 2) return;
|
||||
string[] entityIds = raw.Substring(1, raw.Length - 2).Split(",");
|
||||
int length = entityIds.Length;
|
||||
EntityIds = new int[length];
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
EntityIds[i] = int.Parse(entityIds[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void GenerateEntityCounts(string raw)
|
||||
{
|
||||
if (!raw.StartsWith('[') || !raw.EndsWith(']'))
|
||||
{
|
||||
throw new ArgumentException("Input must be enclosed in square brackets.");
|
||||
}
|
||||
|
||||
if (raw.Length == 2) return;
|
||||
string[] entityCounts = raw.Substring(1, raw.Length - 2).Split(",");
|
||||
int length = entityCounts.Length;
|
||||
EntityCounts = new int[length];
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
EntityCounts[i] = int.Parse(entityCounts[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void GenerateIntervals(string raw)
|
||||
{
|
||||
if (!raw.StartsWith('[') || !raw.EndsWith(']'))
|
||||
{
|
||||
throw new ArgumentException("Input must be enclosed in square brackets.");
|
||||
}
|
||||
|
||||
if (raw.Length == 2) return;
|
||||
string[] intervals = raw.Substring(1, raw.Length - 2).Split(",");
|
||||
int length = intervals.Length;
|
||||
Intervals = new float[length];
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
Intervals[i] = float.Parse(intervals[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d2c6e5a5e57b464397483dd1f164ddf8
|
||||
timeCreated: 1769159930
|
||||
@@ -0,0 +1,78 @@
|
||||
//------------------------------------------------------------
|
||||
// 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.591
|
||||
//------------------------------------------------------------
|
||||
|
||||
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 DRMusic : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取音乐编号。
|
||||
/// </summary>
|
||||
public override int Id
|
||||
{
|
||||
get { return m_Id; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源名称。
|
||||
/// </summary>
|
||||
public string AssetName { 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++;
|
||||
AssetName = 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();
|
||||
AssetName = binaryReader.ReadString();
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void GeneratePropertyArray()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5539646031a664344b90aeb64f92930d
|
||||
timeCreated: 1528026147
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,32 @@
|
||||
using Definition.DataStruct;
|
||||
using GameFramework;
|
||||
using Newtonsoft.Json;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace DataTable
|
||||
{
|
||||
public class DRProp : 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 84edcc54b1524344a9f7b36d1bf55419
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,139 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Definition.DataStruct;
|
||||
using Definition.Enum;
|
||||
using GameFramework;
|
||||
using StarForce;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace DataTable
|
||||
{
|
||||
public class DRRole : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取角色编号。
|
||||
/// </summary>
|
||||
public override int Id => m_Id;
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源名称。
|
||||
/// </summary>
|
||||
public string RoleName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取图标名称。
|
||||
/// </summary>
|
||||
public string IconName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取初始最大生命。
|
||||
/// </summary>
|
||||
public int MaxHealth { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取初始速度。
|
||||
/// </summary>
|
||||
public float Speed { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取初始金币。
|
||||
/// </summary>
|
||||
public int Coin { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取最大持有武器数。
|
||||
/// </summary>
|
||||
public int WeaponCapacity { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取初始属性。
|
||||
/// </summary>
|
||||
public StatModifier[] InitialProperties { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取初始物品。
|
||||
/// </summary>
|
||||
public KeyValuePair<int, int>[] InitialItemIds { get; private set; }
|
||||
|
||||
public int[] ExpRequires { get; private set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
RoleName = columnStrings[index++];
|
||||
IconName = columnStrings[index++];
|
||||
MaxHealth = int.Parse(columnStrings[index++]);
|
||||
Speed = float.Parse(columnStrings[index++]);
|
||||
Coin = int.Parse(columnStrings[index++]);
|
||||
WeaponCapacity = int.Parse(columnStrings[index++]);
|
||||
InitialProperties = Utility.Json.ToObject<StatModifier[]>(columnStrings[index++]);
|
||||
GenerateItems(columnStrings[index++]);
|
||||
GenerateExpRequires(ref columnStrings, index);
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void GeneratePropertyArray()
|
||||
{
|
||||
}
|
||||
|
||||
private void GenerateItems(string raw)
|
||||
{
|
||||
if (!raw.StartsWith('[') || !raw.EndsWith(']'))
|
||||
{
|
||||
throw new ArgumentException("Input must be enclosed in square brackets.");
|
||||
}
|
||||
|
||||
if (raw.Length <= 2) return;
|
||||
|
||||
string[] items = raw.Substring(1, raw.Length - 2).Split(";");
|
||||
int length = items.Length;
|
||||
InitialItemIds = new KeyValuePair<int, int>[length];
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
string input = items[i];
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
Log.Warning("Invalid item: {0}", input);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!input.StartsWith('[') || !input.EndsWith(']'))
|
||||
{
|
||||
throw new ArgumentException("Input must be enclosed in square brackets.");
|
||||
}
|
||||
|
||||
string inner = input.Substring(1, input.Length - 2);
|
||||
|
||||
// 如果是空列表 "[]"
|
||||
if (inner.Length == 0) continue;
|
||||
|
||||
string[] index = inner.Split(",");
|
||||
var item = new KeyValuePair<int, int>(int.Parse(index[0]), int.Parse(index[1]));
|
||||
InitialItemIds[i] = item;
|
||||
}
|
||||
}
|
||||
|
||||
private void GenerateExpRequires(ref string[] columnStrings, int index)
|
||||
{
|
||||
List<int> expRequires = new List<int>();
|
||||
int baseExp = int.Parse(columnStrings[index]);
|
||||
for (int i = index; i < columnStrings.Length; i++)
|
||||
{
|
||||
expRequires.Add(int.Parse(columnStrings[i]) - baseExp);
|
||||
}
|
||||
|
||||
ExpRequires = expRequires.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d596bc33ed84659449059b972a2c4e26
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,81 @@
|
||||
//------------------------------------------------------------
|
||||
// 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.610
|
||||
//------------------------------------------------------------
|
||||
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace DataTable
|
||||
{
|
||||
/// <summary>
|
||||
/// 场景配置表。
|
||||
/// </summary>
|
||||
public class DRScene : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取场景编号。
|
||||
/// </summary>
|
||||
public override int Id
|
||||
{
|
||||
get { return m_Id; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源名称。
|
||||
/// </summary>
|
||||
public string AssetName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取背景音乐编号。
|
||||
/// </summary>
|
||||
public int BackgroundMusicId { 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++;
|
||||
AssetName = columnStrings[index++];
|
||||
BackgroundMusicId = 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();
|
||||
AssetName = binaryReader.ReadString();
|
||||
BackgroundMusicId = binaryReader.Read7BitEncodedInt32();
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void GeneratePropertyArray()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0ce61902e6e3c23409f9ef10ccc8c550
|
||||
timeCreated: 1528026147
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,113 @@
|
||||
//------------------------------------------------------------
|
||||
// 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.625
|
||||
//------------------------------------------------------------
|
||||
|
||||
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 DRSound : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取声音编号。
|
||||
/// </summary>
|
||||
public override int Id
|
||||
{
|
||||
get { return m_Id; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源名称。
|
||||
/// </summary>
|
||||
public string AssetName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取优先级(默认0,128最高,-128最低)。
|
||||
/// </summary>
|
||||
public int Priority { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取是否循环。
|
||||
/// </summary>
|
||||
public bool Loop { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取音量(0~1)。
|
||||
/// </summary>
|
||||
public float Volume { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取声音空间混合量(0为2D,1为3D,中间值混合效果)。
|
||||
/// </summary>
|
||||
public float SpatialBlend { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取声音最大距离。
|
||||
/// </summary>
|
||||
public float MaxDistance { 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++;
|
||||
AssetName = columnStrings[index++];
|
||||
Priority = int.Parse(columnStrings[index++]);
|
||||
Loop = bool.Parse(columnStrings[index++]);
|
||||
Volume = float.Parse(columnStrings[index++]);
|
||||
SpatialBlend = float.Parse(columnStrings[index++]);
|
||||
MaxDistance = 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();
|
||||
AssetName = binaryReader.ReadString();
|
||||
Priority = binaryReader.Read7BitEncodedInt32();
|
||||
Loop = binaryReader.ReadBoolean();
|
||||
Volume = binaryReader.ReadSingle();
|
||||
SpatialBlend = binaryReader.ReadSingle();
|
||||
MaxDistance = binaryReader.ReadSingle();
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void GeneratePropertyArray()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fc0abcc42a26c844d91d422da22eb94d
|
||||
timeCreated: 1528026147
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,78 @@
|
||||
//------------------------------------------------------------
|
||||
// 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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a9b85e7308914ee49bacd872a67716aa
|
||||
timeCreated: 1528026148
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,99 @@
|
||||
//------------------------------------------------------------
|
||||
// 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.652
|
||||
//------------------------------------------------------------
|
||||
|
||||
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 DRUIForm : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取界面编号。
|
||||
/// </summary>
|
||||
public override int Id
|
||||
{
|
||||
get { return m_Id; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源名称。
|
||||
/// </summary>
|
||||
public string AssetName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取界面组名称。
|
||||
/// </summary>
|
||||
public string UIGroupName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取是否允许多个界面实例。
|
||||
/// </summary>
|
||||
public bool AllowMultiInstance { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取是否暂停被其覆盖的界面。
|
||||
/// </summary>
|
||||
public bool PauseCoveredUIForm { 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++;
|
||||
AssetName = columnStrings[index++];
|
||||
UIGroupName = columnStrings[index++];
|
||||
AllowMultiInstance = bool.Parse(columnStrings[index++]);
|
||||
PauseCoveredUIForm = bool.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();
|
||||
AssetName = binaryReader.ReadString();
|
||||
UIGroupName = binaryReader.ReadString();
|
||||
AllowMultiInstance = binaryReader.ReadBoolean();
|
||||
PauseCoveredUIForm = binaryReader.ReadBoolean();
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void GeneratePropertyArray()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f28db9f996bc3d04eb73541b1f8b1036
|
||||
timeCreated: 1528026148
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,92 @@
|
||||
//------------------------------------------------------------
|
||||
// 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.666
|
||||
//------------------------------------------------------------
|
||||
|
||||
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 DRUISound : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取声音编号。
|
||||
/// </summary>
|
||||
public override int Id
|
||||
{
|
||||
get { return m_Id; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源名称。
|
||||
/// </summary>
|
||||
public string AssetName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取优先级(默认0,128最高,-128最低)。
|
||||
/// </summary>
|
||||
public int Priority { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取音量(0~1)。
|
||||
/// </summary>
|
||||
public float Volume { 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++;
|
||||
AssetName = columnStrings[index++];
|
||||
Priority = int.Parse(columnStrings[index++]);
|
||||
Volume = 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();
|
||||
AssetName = binaryReader.ReadString();
|
||||
Priority = binaryReader.Read7BitEncodedInt32();
|
||||
Volume = binaryReader.ReadSingle();
|
||||
}
|
||||
}
|
||||
|
||||
GeneratePropertyArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void GeneratePropertyArray()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d69c673440234c24a9718897060d4e14
|
||||
timeCreated: 1528026148
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,91 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Definition.DataStruct;
|
||||
using Definition.Enum;
|
||||
using Entity;
|
||||
using GameFramework;
|
||||
using StarForce;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace DataTable
|
||||
{
|
||||
/// <summary>
|
||||
/// 武器表。
|
||||
/// </summary>
|
||||
public class DRWeapon : DataRowBase
|
||||
{
|
||||
private int m_Id = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取武器编号。
|
||||
/// </summary>
|
||||
public override int Id => m_Id;
|
||||
|
||||
/// <summary>
|
||||
/// 获取武器名称。
|
||||
/// </summary>
|
||||
public string Title { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取图标资源名称。
|
||||
/// </summary>
|
||||
public string IconAssetName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取武器伤害。
|
||||
/// </summary>
|
||||
public int Attack { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取武器冷却。
|
||||
/// </summary>
|
||||
public float Cooldown { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取武器攻击范围。
|
||||
/// </summary>
|
||||
public float AttackRange { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取武器攻击音效。
|
||||
/// </summary>
|
||||
public int AttackSoundId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取武器额外参数。
|
||||
/// </summary>
|
||||
public string Pramas { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取武器额外属性。
|
||||
/// </summary>
|
||||
public StatModifier[] Modifiers { get; private set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
|
||||
int index = 0;
|
||||
index++;
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
Title = columnStrings[index++];
|
||||
IconAssetName = columnStrings[index++];
|
||||
Attack = int.Parse(columnStrings[index++]);
|
||||
Cooldown = float.Parse(columnStrings[index++]);
|
||||
AttackRange = float.Parse(columnStrings[index++]);
|
||||
AttackSoundId = int.Parse(columnStrings[index++]);
|
||||
Pramas = columnStrings[index++];
|
||||
Modifiers = Utility.Json.ToObject<StatModifier[]>(columnStrings[index++]);
|
||||
|
||||
GeneratePropertyArray();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void GeneratePropertyArray()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b386151345d3f14ab9b7dc5ed6dd864
|
||||
timeCreated: 1528026148
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,104 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using GameFramework.DataTable;
|
||||
using System;
|
||||
using Definition;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace DataTable
|
||||
{
|
||||
public static class DataTableExtension
|
||||
{
|
||||
private const string DataRowClassPrefixName = "DataTable.DR";
|
||||
internal static readonly char[] DataSplitSeparators = new char[] { '\t' };
|
||||
internal static readonly char[] DataTrimSeparators = new char[] { '\"' };
|
||||
|
||||
public static void LoadDataTable(this DataTableComponent dataTableComponent, string dataTableName,
|
||||
string dataTableAssetName, object userData)
|
||||
{
|
||||
if (string.IsNullOrEmpty(dataTableName))
|
||||
{
|
||||
Log.Warning("Data table name is invalid.");
|
||||
return;
|
||||
}
|
||||
|
||||
string[] splitedNames = dataTableName.Split('_');
|
||||
if (splitedNames.Length > 2)
|
||||
{
|
||||
Log.Warning("Data table name is invalid.");
|
||||
return;
|
||||
}
|
||||
|
||||
string dataRowClassName = DataRowClassPrefixName + splitedNames[0];
|
||||
Type dataRowType = Type.GetType(dataRowClassName);
|
||||
if (dataRowType == null)
|
||||
{
|
||||
Log.Warning("Can not get data row type with class name '{0}'.", dataRowClassName);
|
||||
return;
|
||||
}
|
||||
|
||||
string name = splitedNames.Length > 1 ? splitedNames[1] : null;
|
||||
DataTableBase dataTable = dataTableComponent.CreateDataTable(dataRowType, name);
|
||||
dataTable.ReadData(dataTableAssetName, Constant.AssetPriority.DataTableAsset, userData);
|
||||
}
|
||||
|
||||
public static Color32 ParseColor32(string value)
|
||||
{
|
||||
string[] splitedValue = value.Split(',');
|
||||
return new Color32(byte.Parse(splitedValue[0]), byte.Parse(splitedValue[1]), byte.Parse(splitedValue[2]),
|
||||
byte.Parse(splitedValue[3]));
|
||||
}
|
||||
|
||||
public static Color ParseColor(string value)
|
||||
{
|
||||
string[] splitedValue = value.Split(',');
|
||||
return new Color(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]), float.Parse(splitedValue[2]),
|
||||
float.Parse(splitedValue[3]));
|
||||
}
|
||||
|
||||
public static Quaternion ParseQuaternion(string value)
|
||||
{
|
||||
string[] splitedValue = value.Split(',');
|
||||
return new Quaternion(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]),
|
||||
float.Parse(splitedValue[2]), float.Parse(splitedValue[3]));
|
||||
}
|
||||
|
||||
public static Rect ParseRect(string value)
|
||||
{
|
||||
string[] splitedValue = value.Split(',');
|
||||
return new Rect(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]), float.Parse(splitedValue[2]),
|
||||
float.Parse(splitedValue[3]));
|
||||
}
|
||||
|
||||
public static Vector2 ParseVector2(string value)
|
||||
{
|
||||
string[] splitedValue = value.Split(',');
|
||||
return new Vector2(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]));
|
||||
}
|
||||
|
||||
public static Vector3 ParseVector3(string value)
|
||||
{
|
||||
string[] splitedValue = value.Split(',');
|
||||
return new Vector3(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]),
|
||||
float.Parse(splitedValue[2]));
|
||||
}
|
||||
|
||||
public static Vector4 ParseVector4(string value)
|
||||
{
|
||||
string[] splitedValue = value.Split(',');
|
||||
return new Vector4(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]), float.Parse(splitedValue[2]),
|
||||
float.Parse(splitedValue[3]));
|
||||
}
|
||||
|
||||
public static T GetDataTableRow<T>(this DataTableComponent dataTableComponent, int id) where T : DataRowBase
|
||||
{
|
||||
return dataTableComponent.GetDataTable<T>().GetDataRow(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 23740ffb8ecb90b48ad986504e1d2474
|
||||
timeCreated: 1528026147
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5479812568543994bbbcdbee6c42fce1
|
||||
folderAsset: yes
|
||||
timeCreated: 1528026148
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,86 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using Definition;
|
||||
using GameFramework.Debugger;
|
||||
using GameFramework.Localization;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace StarForce
|
||||
{
|
||||
public class ChangeLanguageDebuggerWindow : IDebuggerWindow
|
||||
{
|
||||
private Vector2 m_ScrollPosition = Vector2.zero;
|
||||
private bool m_NeedRestart = false;
|
||||
|
||||
public void Initialize(params object[] args)
|
||||
{
|
||||
}
|
||||
|
||||
public void Shutdown()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnEnter()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnLeave()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnUpdate(float elapseSeconds, float realElapseSeconds)
|
||||
{
|
||||
if (m_NeedRestart)
|
||||
{
|
||||
m_NeedRestart = false;
|
||||
UnityGameFramework.Runtime.GameEntry.Shutdown(ShutdownType.Restart);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnDraw()
|
||||
{
|
||||
m_ScrollPosition = GUILayout.BeginScrollView(m_ScrollPosition);
|
||||
{
|
||||
DrawSectionChangeLanguage();
|
||||
}
|
||||
GUILayout.EndScrollView();
|
||||
}
|
||||
|
||||
private void DrawSectionChangeLanguage()
|
||||
{
|
||||
GUILayout.Label("<b>Change Language</b>");
|
||||
GUILayout.BeginHorizontal("box");
|
||||
{
|
||||
if (GUILayout.Button("Chinese Simplified", GUILayout.Height(30)))
|
||||
{
|
||||
GameEntry.Localization.Language = Language.ChineseSimplified;
|
||||
SaveLanguage();
|
||||
}
|
||||
if (GUILayout.Button("Chinese Traditional", GUILayout.Height(30)))
|
||||
{
|
||||
GameEntry.Localization.Language = Language.ChineseTraditional;
|
||||
SaveLanguage();
|
||||
}
|
||||
if (GUILayout.Button("English", GUILayout.Height(30)))
|
||||
{
|
||||
GameEntry.Localization.Language = Language.English;
|
||||
SaveLanguage();
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
private void SaveLanguage()
|
||||
{
|
||||
GameEntry.Setting.SetString(Constant.Setting.Language, GameEntry.Localization.Language.ToString());
|
||||
GameEntry.Setting.Save();
|
||||
m_NeedRestart = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 278a7992e66d1ea4081597614f912f3d
|
||||
timeCreated: 1528026148
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d30f1c0886d45b40b4497064082c7f1
|
||||
folderAsset: yes
|
||||
timeCreated: 1528026148
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c9bfd67d99634cc45a60985500514160
|
||||
folderAsset: yes
|
||||
timeCreated: 1528026148
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,39 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
namespace Definition
|
||||
{
|
||||
public static partial class Constant
|
||||
{
|
||||
/// <summary>
|
||||
/// 资源优先级。
|
||||
/// </summary>
|
||||
public static class AssetPriority
|
||||
{
|
||||
public const int ConfigAsset = 100;
|
||||
public const int DataTableAsset = 100;
|
||||
public const int DictionaryAsset = 100;
|
||||
public const int FontAsset = 50;
|
||||
public const int MusicAsset = 20;
|
||||
public const int SceneAsset = 0;
|
||||
public const int SoundAsset = 30;
|
||||
public const int UIFormAsset = 50;
|
||||
public const int UISoundAsset = 30;
|
||||
|
||||
public const int MyAircraftAsset = 90;
|
||||
public const int PlayerAsset = 90;
|
||||
public const int AircraftAsset = 80;
|
||||
public const int ThrusterAsset = 30;
|
||||
public const int WeaponAsset = 30;
|
||||
public const int ArmorAsset = 30;
|
||||
public const int BulletAsset = 80;
|
||||
public const int AsteroiAsset = 80;
|
||||
public const int EnemyAsset = 80;
|
||||
public const int EffectAsset = 80;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: be044f4c80eead74cb105ed3c02de870
|
||||
timeCreated: 1528830649
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,29 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace Definition
|
||||
{
|
||||
public static partial class Constant
|
||||
{
|
||||
/// <summary>
|
||||
/// 层。
|
||||
/// </summary>
|
||||
public static class Layer
|
||||
{
|
||||
public const string DefaultLayerName = "Default";
|
||||
public static readonly int DefaultLayerId = LayerMask.NameToLayer(DefaultLayerName);
|
||||
|
||||
public const string UILayerName = "UI";
|
||||
public static readonly int UILayerId = LayerMask.NameToLayer(UILayerName);
|
||||
|
||||
public const string TargetableObjectLayerName = "Targetable Object";
|
||||
public static readonly int TargetableObjectLayerId = LayerMask.NameToLayer(TargetableObjectLayerName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a43e7bbaf538cc045aaacf091c7d612e
|
||||
timeCreated: 1528026149
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,25 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
namespace Definition
|
||||
{
|
||||
public static partial class Constant
|
||||
{
|
||||
public static class Setting
|
||||
{
|
||||
public const string Language = "Setting.Language";
|
||||
public const string SoundGroupMuted = "Setting.{0}Muted";
|
||||
public const string SoundGroupVolume = "Setting.{0}Volume";
|
||||
public const string MusicMuted = "Setting.MusicMuted";
|
||||
public const string MusicVolume = "Setting.MusicVolume";
|
||||
public const string SoundMuted = "Setting.SoundMuted";
|
||||
public const string SoundVolume = "Setting.SoundVolume";
|
||||
public const string UISoundMuted = "Setting.UISoundMuted";
|
||||
public const string UISoundVolume = "Setting.UISoundVolume";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 28dc5d8fb274e45429ff40494dedac8a
|
||||
timeCreated: 1528026149
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: af9011f89c35904448c0225db21e8266
|
||||
folderAsset: yes
|
||||
timeCreated: 1528026149
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,54 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
namespace Definition.DataStruct
|
||||
{
|
||||
public class BuildInfo
|
||||
{
|
||||
public string GameVersion
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public int InternalGameVersion
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string CheckVersionUrl
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string WindowsAppUrl
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string MacOSAppUrl
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string IOSAppUrl
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public string AndroidAppUrl
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 265686b0408d79949a657768398c72cc
|
||||
timeCreated: 1528026149
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,37 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
using Definition.Enum;
|
||||
|
||||
namespace Definition.DataStruct
|
||||
{
|
||||
[StructLayout(LayoutKind.Auto)]
|
||||
public struct ImpactData
|
||||
{
|
||||
public ImpactData(CampType camp /*, int health*/, int attackBase, StatProperty attackStat = null,
|
||||
StatProperty defenseStat = null, StatProperty dodgeStat = null)
|
||||
{
|
||||
Camp = camp;
|
||||
//Health = health;
|
||||
AttackBase = attackBase;
|
||||
AttackStat = attackStat;
|
||||
DefenseStat = defenseStat;
|
||||
DodgeStat = dodgeStat;
|
||||
}
|
||||
|
||||
public CampType Camp { get; }
|
||||
|
||||
public int AttackBase { get; }
|
||||
|
||||
public StatProperty AttackStat { get; }
|
||||
|
||||
public StatProperty DefenseStat { get; }
|
||||
|
||||
public StatProperty DodgeStat { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 22538aa3f76228d48819a9942febb66d
|
||||
timeCreated: 1528026149
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,31 @@
|
||||
using Components;
|
||||
using DataTable;
|
||||
|
||||
namespace Definition.DataStruct
|
||||
{
|
||||
public class PropItem
|
||||
{
|
||||
private DRProp _prop;
|
||||
|
||||
public PropItem(DRProp prop)
|
||||
{
|
||||
_prop = prop;
|
||||
}
|
||||
|
||||
public void OnAttach(StatComponent statComponent)
|
||||
{
|
||||
foreach (var modifier in _prop.Modifiers)
|
||||
{
|
||||
statComponent.AddModifier(modifier);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnDetach(StatComponent statComponent)
|
||||
{
|
||||
foreach (var modifier in _prop.Modifiers)
|
||||
{
|
||||
statComponent.RemoveModifier(modifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 135b5ab1b6f5491989f080cf8b949201
|
||||
timeCreated: 1770212750
|
||||
@@ -0,0 +1,91 @@
|
||||
using System;
|
||||
using Definition.Enum;
|
||||
using StarForce;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace Definition.DataStruct
|
||||
{
|
||||
public class StatModifier
|
||||
{
|
||||
// None = 0,
|
||||
// MaxHealth = 1,
|
||||
// MovementSpeed = 2,
|
||||
// Attack = 3,
|
||||
// Defense = 4,
|
||||
// AttackSpeed = 5,
|
||||
// Critical = 6,
|
||||
// CriticalDamage = 7,
|
||||
// Dodge = 8,
|
||||
|
||||
private readonly string[] _statTypeNames =
|
||||
{
|
||||
"无效",
|
||||
"最大生命",
|
||||
"移动速度",
|
||||
"伤害",
|
||||
"防御",
|
||||
"冷却",
|
||||
"暴击率",
|
||||
"暴击伤害",
|
||||
"闪避"
|
||||
};
|
||||
|
||||
public StatType StatType;
|
||||
public float Value;
|
||||
public bool IsPercent;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (IsPercent)
|
||||
{
|
||||
if (Value > 0)
|
||||
{
|
||||
return $"{_statTypeNames[(int)StatType]}: <color=green>+{Value * 100}%</color>";
|
||||
}
|
||||
else
|
||||
{
|
||||
return $"{_statTypeNames[(int)StatType]}: <color=red>+{Value * 100}%</color>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Value > 0)
|
||||
{
|
||||
return $"{_statTypeNames[(int)StatType]}: <color=green>+{Value}</color>";
|
||||
}
|
||||
else
|
||||
{
|
||||
return $"{_statTypeNames[(int)StatType]}: <color=red>+{Value}</color>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static StatModifier StringToModifier(string input)
|
||||
{
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
Log.Warning("Invalid modifier: {0}", input);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!input.StartsWith('[') || !input.EndsWith(']'))
|
||||
{
|
||||
throw new ArgumentException("Input must be enclosed in square brackets.");
|
||||
}
|
||||
|
||||
string inner = input.Substring(1, input.Length - 2);
|
||||
|
||||
// 如果是空列表 "[]"
|
||||
if (inner.Length == 0) return null;
|
||||
|
||||
string[] property = inner.Split(",");
|
||||
int propertyIndex = 0;
|
||||
return new StatModifier
|
||||
{
|
||||
StatType = EnumUtility<StatType>.Get(property[propertyIndex++]),
|
||||
Value = float.Parse(property[propertyIndex++]),
|
||||
IsPercent = bool.Parse(property[propertyIndex++])
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4f70088ee3846934796f2cacb72fd920
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace Definition.DataStruct
|
||||
{
|
||||
public class StatProperty
|
||||
{
|
||||
public float Value;
|
||||
public float Percent;
|
||||
|
||||
public StatProperty()
|
||||
{
|
||||
Value = 0f;
|
||||
Percent = 1f;
|
||||
}
|
||||
|
||||
public StatProperty(float value, float percent)
|
||||
{
|
||||
Value = value;
|
||||
Percent = percent;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 18e7bc9587114ae4a91c70f829543de8
|
||||
timeCreated: 1770353735
|
||||
@@ -0,0 +1,75 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
namespace Definition.DataStruct
|
||||
{
|
||||
public class VersionInfo
|
||||
{
|
||||
// 是否需要强制更新游戏应用
|
||||
public bool ForceUpdateGame
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
// 最新的游戏版本号
|
||||
public string LatestGameVersion
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
// 最新的游戏内部版本号
|
||||
public int InternalGameVersion
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
// 最新的资源内部版本号
|
||||
public int InternalResourceVersion
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
// 资源更新下载地址
|
||||
public string UpdatePrefixUri
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
// 资源版本列表长度
|
||||
public int VersionListLength
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
// 资源版本列表哈希值
|
||||
public int VersionListHashCode
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
// 资源版本列表压缩后长度
|
||||
public int VersionListCompressedLength
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
// 资源版本列表压缩后哈希值
|
||||
public int VersionListCompressedHashCode
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f1245482e9f20354796d50d6d85d2fe0
|
||||
timeCreated: 1528026150
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2fc27161191c61549a74f80fd54e9645
|
||||
folderAsset: yes
|
||||
timeCreated: 1528026150
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,47 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
namespace Definition.Enum
|
||||
{
|
||||
/// <summary>
|
||||
/// 阵营类型。
|
||||
/// </summary>
|
||||
public enum CampType : byte
|
||||
{
|
||||
Unknown = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 第一玩家阵营。
|
||||
/// </summary>
|
||||
Player,
|
||||
|
||||
/// <summary>
|
||||
/// 第一敌人阵营。
|
||||
/// </summary>
|
||||
Enemy,
|
||||
|
||||
/// <summary>
|
||||
/// 第一中立阵营。
|
||||
/// </summary>
|
||||
Neutral,
|
||||
|
||||
/// <summary>
|
||||
/// 第二玩家阵营。
|
||||
/// </summary>
|
||||
Player2,
|
||||
|
||||
/// <summary>
|
||||
/// 第二敌人阵营。
|
||||
/// </summary>
|
||||
Enemy2,
|
||||
|
||||
/// <summary>
|
||||
/// 第二中立阵营
|
||||
/// </summary>
|
||||
Neutral2,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 61f18b2b0752f32449d9978f481a75fc
|
||||
timeCreated: 1528026150
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Definition.Enum
|
||||
{
|
||||
public enum EnemyType : byte
|
||||
{
|
||||
None = 0,
|
||||
MeleeEnemy = 101,
|
||||
RemoteEnemy = 102,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2aa817d65bcc425a9e015f3c1de7c9a9
|
||||
timeCreated: 1770209105
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Definition.Enum
|
||||
{
|
||||
public enum GoodsType
|
||||
{
|
||||
None = 0,
|
||||
Weapon,
|
||||
Prop
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b6d8e25599afc54bb6e29b09e606bbd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,35 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
namespace Definition.Enum
|
||||
{
|
||||
/// <summary>
|
||||
/// 关系类型。
|
||||
/// </summary>
|
||||
public enum RelationType : byte
|
||||
{
|
||||
/// <summary>
|
||||
/// 未知的。
|
||||
/// </summary>
|
||||
Unknown,
|
||||
|
||||
/// <summary>
|
||||
/// 友好的。
|
||||
/// </summary>
|
||||
Friendly,
|
||||
|
||||
/// <summary>
|
||||
/// 中立的。
|
||||
/// </summary>
|
||||
Neutral,
|
||||
|
||||
/// <summary>
|
||||
/// 敌对的。
|
||||
/// </summary>
|
||||
Hostile
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2c5c37ca396eb9d47a70999b5825152b
|
||||
timeCreated: 1528026150
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace Definition.Enum
|
||||
{
|
||||
public enum StatType
|
||||
{
|
||||
None = 0,
|
||||
|
||||
MaxHealth = 1,
|
||||
MovementSpeed = 2,
|
||||
Attack = 3,
|
||||
Defense = 4,
|
||||
AttackSpeed = 5,
|
||||
Critical = 6,
|
||||
CriticalDamage = 7,
|
||||
Dodge = 8,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 657fd4fd021a424397aa17c0359a1da1
|
||||
timeCreated: 1768966119
|
||||
@@ -0,0 +1,57 @@
|
||||
//------------------------------------------------------------
|
||||
// Game Framework
|
||||
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
|
||||
// Homepage: https://gameframework.cn/
|
||||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
namespace Definition.Enum
|
||||
{
|
||||
/// <summary>
|
||||
/// 界面编号。
|
||||
/// </summary>
|
||||
public enum UIFormType : byte
|
||||
{
|
||||
Undefined = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 弹出框。
|
||||
/// </summary>
|
||||
DialogForm = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 主菜单。
|
||||
/// </summary>
|
||||
MenuForm = 100,
|
||||
|
||||
/// <summary>
|
||||
/// 设置。
|
||||
/// </summary>
|
||||
SettingForm = 101,
|
||||
|
||||
/// <summary>
|
||||
/// 关于。
|
||||
/// </summary>
|
||||
AboutForm = 102,
|
||||
|
||||
/// <summary>
|
||||
/// 主菜单。
|
||||
/// </summary>
|
||||
StartMenuForm = 200,
|
||||
|
||||
/// <summary>
|
||||
/// 选择角色。
|
||||
/// </summary>
|
||||
SelectRoleForm = 201,
|
||||
|
||||
/// <summary>
|
||||
/// 游戏商店。
|
||||
/// </summary>
|
||||
ShopForm = 202,
|
||||
|
||||
/// <summary>
|
||||
/// 游戏HUD。
|
||||
/// </summary>
|
||||
HudForm = 203,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 75fd10c7585513846ab25372be0590b7
|
||||
timeCreated: 1528026162
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Definition.Enum
|
||||
{
|
||||
public enum WeaponType : byte
|
||||
{
|
||||
None = 0,
|
||||
WeaponKnife = 201,
|
||||
Remote = 202,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1e4fe53d087154645ad496d2f178c843
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7330dc72b718ca14ea10a999060be9f8
|
||||
folderAsset: yes
|
||||
timeCreated: 1528026150
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user