更新Demo

更新Demo
This commit is contained in:
ALEXTANG
2023-12-20 12:08:25 +08:00
parent 5cf6b8c034
commit f64bb37706
2996 changed files with 29677 additions and 173915 deletions

121
.gitignore vendored
View File

@@ -1,118 +1,15 @@
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Mm]emoryCaptures/
/EditorBuild/
# /[Aa]ssets/TResources/DLL/
/[Aa]ssets/StreamingAssets
/BuildBundleInfo/
[Aa]ssets/AATest/
[Aa]ssets/AATest.meta
# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta
# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*
# Autogenerated Jetbrains Rider plugin
[Aa]ssets/Plugins/Editor/JetBrains*
# Visual Studio cache directory
.vs/
# Gradle cache directory
.gradle/
# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db
# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta
# Unity3D generated file on crash reports
sysinfo.txt
# Builds
*.apk
# Crashlytics generated file
crashlytics-build.properties
# TEnginePersistentDataPath
TEnginePersistentDataPath/
# Hotfix
TEngineHotUpdate/bin
TEngineHotUpdate/obj
#HybirdCLR(HuaTuo)
/HybirdCLRData/
[Hh]ybridCLRData/
#AATemp
[Aa]ssets/AATemp/
[Aa]ssets/AATemp.meta
#Rider
/.idea/
# ABConfig
[Aa]ssets/BuildConfig/
[Aa]ssets/BuildConfig.meta
[Aa]ssets/StreamingAssets/
[Aa]ssets/StreamingAssets.meta
Assets/HybridCLRBuildCache/AssetBundleOutput.meta
Assets/HybridCLRBuildCache/AssetBundleOutput/StandaloneWindows.meta
Assets/HybridCLRBuildCache.meta
Assets/HybridCLRBuildCache/AssetBundleSourceData.meta
Assets/HybridCLRBuildCache/AssetBundleSourceData/StandaloneWindows.meta
#Bundles
Bundles/
#Sandbox
Sandbox/
UnityProject/UserSettings/Layouts/default-2021.dwlt
UnityProject/UserSettings/Search.settings
#Luban
Luban/.cache.meta
Tools/Luban/
Tools/Luban.ClientServer/
Configs/.cache.meta
GenerateDatas/
#HybridCLR
Assets/HybridCLRData.meta
UserSettings/Search.settings
#Unity UserSettings
UserSettings/Search.index
UserSettings/Layouts/default-2021.dwlt
#UnityOnlineServiceData
Assets/UnityOnlineServiceData.meta
Assets/UnityOnlineServiceData
#FileServer
Tools/FileServer/AssetRoot
UnityProject/ProjectSettings/CommonBurstAotSettings.json
UnityProject/ProjectSettings/BurstAotSettings_StandaloneWindows.json

View File

@@ -1,45 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!687078895 &4343727234628468602
SpriteAtlas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: common
serializedVersion: 2
m_EditorData:
serializedVersion: 2
textureSettings:
serializedVersion: 2
anisoLevel: 1
compressionQuality: 50
maxTextureSize: 2048
textureCompression: 0
filterMode: 1
generateMipMaps: 0
readable: 0
crunchedCompression: 0
sRGB: 1
platformSettings: []
packingSettings:
serializedVersion: 2
padding: 2
blockOffset: 1
allowAlphaSplitting: 0
enableRotation: 0
enableTightPacking: 0
enableAlphaDilation: 0
secondaryTextureSettings: {}
variantMultiplier: 1
packables: []
bindAsDefault: 1
isAtlasV2: 0
cachedData: {fileID: 0}
m_MasterAtlas: {fileID: 0}
m_PackedSprites: []
m_PackedSpriteNamesToIndex: []
m_RenderDataMap: {}
m_Tag: common
m_IsVariant: 0
m_IsPlaceholder: 0

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 1679f4d6c3aca0549bfab2e3f327a98b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 4343727234628468602
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: da65d981892b04348a32d0735a688d74
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 4343727234628468602
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 1a8431d2a64361c4d821790ed88aeb3d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 4343727234628468602
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 215de3b14107cf74e80d358561bcef96
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 4343727234628468602
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 19e308892414d5947bde6bb440dfb451
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 4343727234628468602
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 92fdb3e147f9fb14f822a25db8605938
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 4343727234628468602
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: bceaaa1ebd8e7284eb63a80fd5612648
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 4343727234628468602
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,18 +0,0 @@
{
"name": "BattleCore.Runtime",
"rootNamespace": "BattleCore.Runtime",
"references": [
"GUID:aa06d4cc755c979489c256c1bcca1dfb",
"GUID:d8b63aba1907145bea998dd612889d6b",
"GUID:a90b2d3377c5e4a4db95cc44fb82045e"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 641632c4f8079b94f963b5284d859a12
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 890abd3a957e406ab422fc468ba6c169
timeCreated: 1682353243

View File

@@ -1,6 +0,0 @@
namespace BattleCore.Runtime
{
public static class EntityExtension
{
}
}

View File

@@ -1,27 +0,0 @@
using UnityEngine;
using Unity.Mathematics;
namespace BattleCore.Runtime
{
public static class MathematicsExt
{
public static int2 ToInt2(this Vector2Int vec) => new int2(vec.x, vec.y);
public static int3 ToInt3(this Vector3Int vec) => new int3(vec.x, vec.y, vec.z);
public static float2 ToFloat2(this Vector2 vec) => new float2(vec.x, vec.y);
public static float3 ToFloat3(this Vector3 vec) => new float3(vec.x, vec.y, vec.z);
public static bool IsEquals(this int2 a, int2 b) => math.all(a == b);
public static bool IsEquals(this int3 a, int3 b) => math.all(a == b);
public static Vector2Int ToVec2(this int2 vec) => new Vector2Int(vec.x, vec.y);
public static Vector3Int ToVec3(this int2 vec) => new Vector3Int(vec.x, vec.y, 0);
public static Vector3Int ToVec3(this int3 vec) => new Vector3Int(vec.x, vec.y, vec.z);
public static Vector2 ToVec2(this float2 vec) => new Vector2(vec.x, vec.y);
public static Vector3 ToVec3(this float3 vec) => new Vector3(vec.x, vec.y, vec.z);
public static int ManhattanDist(this int2 vec) => vec.x + vec.y;
public static int ManhattanDist(this int3 vec) => vec.x + vec.y + vec.z;
public static float ManhattanDist(this float2 vec) => vec.x + vec.y;
public static float ManhattanDist(this float3 vec) => vec.x + vec.y + vec.z;
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 2b0e288b918a41698571ec3d36059851
timeCreated: 1682353251

View File

@@ -1,21 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BattleCore.Runtime
{
public class Empty : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
}

View File

@@ -1,16 +0,0 @@
namespace GameBase
{
public class BaseClsTemplate<T>
{
protected static T Imp;
/// <summary>
/// Unity工程注册处理函数。
/// </summary>
/// <param name="imp">实现类。</param>
public static void RegisterImp(T imp)
{
Imp = imp;
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: b062b3e32edd4536a4308a3d180842e0
timeCreated: 1681989133

View File

@@ -1,190 +0,0 @@
using UnityEngine;
using System.Collections.Generic;
using System;
using System.Threading;
using System.Linq;
/*******************************************************************************
//开启一个Loom进程
Loom.RunAsync(() =>
{
aucThread = new Thread(ReceiveMsg);
aucThread.Start();
}
//进程调用主线程方法
MainPack pack = (MainPack)MainPack.Descriptor.Parser.ParseFrom(buffer, 0, len);
Loom.QueueOnMainThread((param) =>
{
UdpHandleResponse(pack);
}, null);
*******************************************************************************/
namespace GameBase
{
/// <summary>
/// Loom多线程通信。
/// <remarks></remarks>
/// </summary>
public class Loom : MonoBehaviour
{
public Dictionary<string, CancellationTokenSource> TokenSourcesDictionary = new Dictionary<string, CancellationTokenSource>();
private static readonly int MaxThreads = 8;
private static int _numThreads;
private static Loom _current;
public static Loom Current
{
get
{
Initialize();
return _current;
}
}
public void Awake()
{
_current = this;
_initialized = true;
}
protected void OnDestroy()
{
}
private static bool _initialized;
private static void Initialize()
{
if (!_initialized)
{
if (!Application.isPlaying)
{
return;
}
_initialized = true;
var obj = new GameObject("[Loom]");
_current = obj.AddComponent<Loom>();
DontDestroyOnLoad(obj);
}
}
public struct NoDelayedQueueItem
{
public Action<object> Action;
public object Param;
}
private readonly List<NoDelayedQueueItem> _actions = new List<NoDelayedQueueItem>();
public struct DelayedQueueItem
{
public float Time;
public Action<object> Action;
public object Param;
}
private readonly List<DelayedQueueItem> _delayed = new List<DelayedQueueItem>();
private readonly List<DelayedQueueItem> _currentDelayed = new List<DelayedQueueItem>();
public static void QueueOnMainThread(Action<object> taction, object param, float time = 0f)
{
if (time != 0f)
{
lock (Current._delayed)
{
Current._delayed.Add(new DelayedQueueItem { Time = Time.time + time, Action = taction, Param = param });
}
}
else
{
lock (Current._actions)
{
Current._actions.Add(new NoDelayedQueueItem { Action = taction, Param = param });
}
}
}
public static Thread RunAsync(Action action)
{
Initialize();
while (_numThreads >= MaxThreads)
{
Thread.Sleep(100);
}
Interlocked.Increment(ref _numThreads);
ThreadPool.QueueUserWorkItem(RunAction, action);
return null;
}
private static void RunAction(object action)
{
try
{
((Action)action)();
}
catch
{
// ignored
}
finally
{
Interlocked.Decrement(ref _numThreads);
}
}
void OnDisable()
{
if (_current == this)
{
_current = null;
}
}
private readonly List<NoDelayedQueueItem> _currentActions = new List<NoDelayedQueueItem>();
void Update()
{
if (_actions.Count > 0)
{
lock (_actions)
{
_currentActions.Clear();
_currentActions.AddRange(_actions);
_actions.Clear();
}
for (int i = 0; i < _currentActions.Count; i++)
{
_currentActions[i].Action(_currentActions[i].Param);
}
}
if (_delayed.Count > 0)
{
lock (_delayed)
{
_currentDelayed.Clear();
_currentDelayed.AddRange(_delayed.Where(d => d.Time <= Time.time));
for (int i = 0; i < _currentDelayed.Count; i++)
{
_delayed.Remove(_currentDelayed[i]);
}
}
for (int i = 0; i < _currentDelayed.Count; i++)
{
_currentDelayed[i].Action(_currentDelayed[i].Param);
}
}
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 00565f0d362f4c36836804455e19c3df
timeCreated: 1681990210

View File

@@ -1,214 +0,0 @@
using System.Collections.Generic;
using TEngine;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace GameBase
{
/// <summary>
/// 单例接口。
/// </summary>
public interface ISingleton
{
void Active();
void Release();
}
/// <summary>
/// 单例管理器(统一化持久和释放)。
/// </summary>
public static class SingletonMgr
{
private static List<ISingleton> _singletonList;
private static Dictionary<string, GameObject> _gameObjects;
private static GameObject _root;
public static GameObject Root
{
get
{
if (_root == null)
{
_root = GameObject.Find("[SingletonMgr]");
if (_root == null)
{
_root = new GameObject("[SingletonMgr]")
{
transform =
{
position = Vector3.zero
}
};
}
UnityEngine.Object.DontDestroyOnLoad(_root);
}
return _root;
}
}
public static void Retain(ISingleton go)
{
if (_singletonList == null)
{
_singletonList = new List<ISingleton>();
}
_singletonList.Add(go);
}
public static void Retain(GameObject go)
{
if (_gameObjects == null)
{
_gameObjects = new Dictionary<string, GameObject>();
}
if (!_gameObjects.ContainsKey(go.name))
{
_gameObjects.Add(go.name, go);
if (Application.isPlaying)
{
UnityEngine.Object.DontDestroyOnLoad(go);
}
}
}
public static void Release(GameObject go)
{
if (_gameObjects != null && _gameObjects.ContainsKey(go.name))
{
_gameObjects.Remove(go.name);
UnityEngine.Object.Destroy(go);
}
}
public static void Release(ISingleton go)
{
if (_singletonList != null && _singletonList.Contains(go))
{
_singletonList.Remove(go);
}
}
public static void Release()
{
if (_gameObjects != null)
{
foreach (var item in _gameObjects)
{
UnityEngine.Object.Destroy(item.Value);
}
_gameObjects.Clear();
}
if (_singletonList != null)
{
for (int i = 0; i < _singletonList.Count; ++i)
{
_singletonList[i].Release();
}
_singletonList.Clear();
}
Resources.UnloadUnusedAssets();
}
public static GameObject GetGameObject(string name)
{
GameObject go = null;
if (_gameObjects != null)
{
_gameObjects.TryGetValue(name, out go);
}
return go;
}
internal static bool ContainsKey(string name)
{
if (_gameObjects != null)
{
return _gameObjects.ContainsKey(name);
}
return false;
}
internal static ISingleton GetSingleton(string name)
{
for (int i = 0; i < _singletonList.Count; ++i)
{
if (_singletonList[i].ToString() == name)
{
return _singletonList[i];
}
}
return null;
}
/// <summary>
/// 释放所有单例。
/// </summary>
public static void ReStart()
{
Release();
SceneManager.LoadScene(0);
}
}
/// <summary>
/// 全局单例对象(非线程安全)。
/// </summary>
/// <typeparam name="T">泛型T。</typeparam>
public abstract class TSingleton<T> : ISingleton where T : TSingleton<T>, new()
{
private static T _instance;
public static T Instance
{
get
{
if (null == _instance)
{
_instance = new T();
_instance.Init();
#if UNITY_EDITOR
Log.Info($"TSingleton Instance:{typeof(T).Name}");
#endif
SingletonMgr.Retain(_instance);
}
return _instance;
}
}
public static bool IsValid => _instance != null;
protected TSingleton()
{
}
protected virtual void Init()
{
}
public virtual void Active()
{
}
public virtual void Release()
{
if (_instance != null)
{
SingletonMgr.Release(_instance);
_instance = null;
}
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: aa2cb5bb622045d7a6f2a4c4faea3ca6
timeCreated: 1681989590

View File

@@ -1,111 +0,0 @@
using TEngine;
using UnityEngine;
namespace GameBase
{
/// <summary>
/// 具备Unity完整生命周期的单例。
/// </summary>
/// <typeparam name="T"></typeparam>
public abstract class UnitySingleton<T> : MonoBehaviour where T : MonoBehaviour
{
private static T _instance;
public static T Instance
{
get
{
if (_instance == null)
{
var ins = UnityEngine.Object.FindObjectOfType<T>();
if (ins != null)
{
var obj = ins.gameObject;
obj.name = typeof(T).Name;
_instance = ins;
SingletonMgr.Retain(obj);
return Instance;
}
System.Type thisType = typeof(T);
string instName = thisType.Name;
GameObject go = SingletonMgr.GetGameObject(instName);
if (go == null)
{
go = GameObject.Find($"{instName}");
if (go == null)
{
go = new GameObject(instName);
go.transform.position = Vector3.zero;
}
}
_instance = go.GetComponent<T>();
if (_instance == null)
{
_instance = go.AddComponent<T>();
}
if (_instance == null)
{
Log.Error($"Can't create UnitySingleton<{typeof(T)}>");
}
}
return _instance;
}
}
public static T Active()
{
return Instance;
}
public static bool IsValid => _instance != null;
private bool CheckInstance()
{
if (this == Instance)
{
return true;
}
GameObject.Destroy(gameObject);
return false;
}
protected virtual void OnLoad()
{
}
public virtual void Awake()
{
if (CheckInstance())
{
OnLoad();
}
#if UNITY_EDITOR
Log.Debug($"UnitySingleton Instance:{typeof(T).Name}");
#endif
GameObject tEngine = SingletonMgr.Root;
if (tEngine != null)
{
this.gameObject.transform.SetParent(tEngine.transform);
}
}
protected virtual void OnDestroy()
{
Release();
}
public static void Release()
{
if (_instance != null)
{
SingletonMgr.Release(_instance.gameObject);
_instance = null;
}
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 25c99243aa534df5870e36fdf9d36afd
timeCreated: 1681990223

View File

@@ -1,24 +0,0 @@
using TEngine;
using UnityEngine;
#if ENABLE_URP
using UnityEngine.Rendering.Universal;
#endif
namespace GameLogic
{
public class CameraUtils
{
public static void AddCameraStack(Camera camera,Camera mainCamera)
{
#if ENABLE_URP
if (mainCamera != null)
{
// 通过脚本的方式,只要能找到 camera 不轮是否跨 base 相机的场景,都可以 Add 进 Stack
mainCamera.GetComponent<UniversalAdditionalCameraData>().cameraStack.Add(GameModule.UI.UICamera);
}
#else
Log.Fatal("Could not add camera stack because had no URP-Render-Pip");
#endif
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 6375b5490bbdcc145a24706a6c4e9cb7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,15 +0,0 @@
using TEngine;
namespace GameLogic
{
public static class ActorEventDefine
{
public static readonly int ScoreChange = StringId.StringToHash("ActorEventDefine.ScoreChange");
public static readonly int GameOver = StringId.StringToHash("ActorEventDefine.GameOver");
public static readonly int EnemyDead = StringId.StringToHash("ActorEventDefine.EnemyDead");
public static readonly int PlayerDead = StringId.StringToHash("ActorEventDefine.PlayerDead");
public static readonly int AsteroidExplosion = StringId.StringToHash("ActorEventDefine.AsteroidExplosion");
public static readonly int EnemyFireBullet = StringId.StringToHash("ActorEventDefine.EnemyFireBullet");
public static readonly int PlayerFireBullet = StringId.StringToHash("ActorEventDefine.PlayerFireBullet");
}
}

View File

@@ -1,21 +0,0 @@
using UnityEngine;
using UniFramework.Pooling;
public class EntityEffect : MonoBehaviour
{
public float DelayDestroyTime = 1f;
private SpawnHandle _handle;
public void InitEntity(SpawnHandle handle)
{
_handle = handle;
Invoke(nameof(DelayDestroy), DelayDestroyTime);
}
private void DelayDestroy()
{
_handle.Restore();
_handle = null;
}
}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 22e854424b81c9d49b36e6aa8b1cc9ba
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,36 +0,0 @@
# UniFramework.Pooling
一个功能强大的游戏对象池系统。
该系统依赖于YooAsset资源系统支持各类异步编程支持同步接口和异步接口。
```c#
using UnityEngine;
using YooAsset;
using UniFramework.Pooling;
IEnumerator Start()
{
// 初始化游戏对象池系统
UniPooling.Initalize();
// 创建孵化器
var spawner = UniPooling.CreateSpawner("DefaultPackage");
// 创建Cube预制体的对象池
var operation = spawner.CreateGameObjectPoolAsync("Cube.prefab");
yield return operation;
// 孵化Cube游戏对象
SpawnHandle handle = spawner.SpawnAsync("Cube.prefab");
yield return handle;
Debug.Log(handle.GameObj.name);
// 回收游戏对象
handle.Restore();
// 丢弃游戏对象
handle.Discard();
}
```

View File

@@ -1,70 +0,0 @@
using YooAsset;
namespace UniFramework.Pooling
{
public class CreatePoolOperation : GameAsyncOperation
{
private enum ESteps
{
None,
Waiting,
Done,
}
private readonly AssetOperationHandle _handle;
private ESteps _steps = ESteps.None;
internal CreatePoolOperation(AssetOperationHandle handle)
{
_handle = handle;
}
protected override void OnStart()
{
_steps = ESteps.Waiting;
}
protected override void OnUpdate()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
if (_steps == ESteps.Waiting)
{
if (_handle.IsValid == false)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = $"{nameof(AssetOperationHandle)} is invalid.";
return;
}
if (_handle.IsDone == false)
return;
if (_handle.AssetObject == null)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = $"{nameof(AssetOperationHandle.AssetObject)} is null.";
return;
}
_steps = ESteps.Done;
Status = EOperationStatus.Succeed;
}
}
/// <summary>
/// 等待异步实例化结束
/// </summary>
public void WaitForAsyncComplete()
{
if (_handle != null)
{
if (_steps == ESteps.Done)
return;
_handle.WaitForAsyncComplete();
OnUpdate();
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a5687620a17f42e4085a0e2243be7561
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,215 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using YooAsset;
namespace UniFramework.Pooling
{
internal class GameObjectPool
{
private readonly Transform _poolRoot;
private readonly Queue<InstantiateOperation> _cacheOperations;
private readonly bool _dontDestroy;
private readonly int _initCapacity;
private readonly int _maxCapacity;
private readonly float _destroyTime;
private float _lastRestoreRealTime = -1f;
/// <summary>
/// 资源句柄
/// </summary>
public AssetOperationHandle AssetHandle { private set; get; }
/// <summary>
/// 资源定位地址
/// </summary>
public string Location { private set; get; }
/// <summary>
/// 内部缓存总数
/// </summary>
public int CacheCount
{
get { return _cacheOperations.Count; }
}
/// <summary>
/// 外部使用总数
/// </summary>
public int SpawnCount { private set; get; } = 0;
/// <summary>
/// 是否常驻不销毁
/// </summary>
public bool DontDestroy
{
get { return _dontDestroy; }
}
public GameObjectPool(GameObject poolRoot, string location, bool dontDestroy, int initCapacity, int maxCapacity, float destroyTime)
{
_poolRoot = poolRoot.transform;
Location = location;
_dontDestroy = dontDestroy;
_initCapacity = initCapacity;
_maxCapacity = maxCapacity;
_destroyTime = destroyTime;
// 创建缓存池
_cacheOperations = new Queue<InstantiateOperation>(initCapacity);
}
/// <summary>
/// 创建对象池
/// </summary>
public void CreatePool(ResourcePackage package)
{
// 加载游戏对象
AssetHandle = package.LoadAssetAsync<GameObject>(Location);
// 创建初始对象
for (int i = 0; i < _initCapacity; i++)
{
var operation = AssetHandle.InstantiateAsync(_poolRoot);
_cacheOperations.Enqueue(operation);
}
}
/// <summary>
/// 销毁游戏对象池
/// </summary>
public void DestroyPool()
{
// 卸载资源对象
AssetHandle.Release();
AssetHandle = null;
// 销毁游戏对象
foreach (var operation in _cacheOperations)
{
if (operation.Result != null)
GameObject.Destroy(operation.Result);
}
_cacheOperations.Clear();
SpawnCount = 0;
}
/// <summary>
/// 查询静默时间内是否可以销毁
/// </summary>
public bool CanAutoDestroy()
{
if (_dontDestroy)
return false;
if (_destroyTime < 0)
return false;
if (_lastRestoreRealTime > 0 && SpawnCount <= 0)
return (Time.realtimeSinceStartup - _lastRestoreRealTime) > _destroyTime;
else
return false;
}
/// <summary>
/// 游戏对象池是否已经销毁
/// </summary>
public bool IsDestroyed()
{
return AssetHandle == null;
}
/// <summary>
/// 回收
/// </summary>
public void Restore(InstantiateOperation operation)
{
if (IsDestroyed())
{
DestroyInstantiateOperation(operation);
return;
}
SpawnCount--;
if (SpawnCount <= 0)
_lastRestoreRealTime = Time.realtimeSinceStartup;
// 如果外部逻辑销毁了游戏对象
if (operation.Status == EOperationStatus.Succeed)
{
if (operation.Result == null)
return;
}
// 如果缓存池还未满员
if (_cacheOperations.Count < _maxCapacity)
{
SetRestoreGameObject(operation.Result);
_cacheOperations.Enqueue(operation);
}
else
{
DestroyInstantiateOperation(operation);
}
}
/// <summary>
/// 丢弃
/// </summary>
public void Discard(InstantiateOperation operation)
{
if (IsDestroyed())
{
DestroyInstantiateOperation(operation);
return;
}
SpawnCount--;
if (SpawnCount <= 0)
_lastRestoreRealTime = Time.realtimeSinceStartup;
DestroyInstantiateOperation(operation);
}
/// <summary>
/// 获取一个游戏对象
/// </summary>
public SpawnHandle Spawn(Transform parent, Vector3 position, Quaternion rotation, bool forceClone, params System.Object[] userDatas)
{
InstantiateOperation operation;
if (forceClone == false && _cacheOperations.Count > 0)
operation = _cacheOperations.Dequeue();
else
operation = AssetHandle.InstantiateAsync();
SpawnCount++;
SpawnHandle handle = new SpawnHandle(this, operation, parent, position, rotation, userDatas);
YooAssets.StartOperation(handle);
return handle;
}
private void DestroyInstantiateOperation(InstantiateOperation operation)
{
// 取消异步操作
operation.Cancel();
// 销毁游戏对象
if (operation.Result != null)
{
GameObject.Destroy(operation.Result);
}
}
private void SetRestoreGameObject(GameObject gameObj)
{
if (gameObj != null)
{
gameObj.SetActive(false);
gameObj.transform.SetParent(_poolRoot);
gameObj.transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity);
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 1dd976626eb4ca645b4ec80921f4e8fd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,148 +0,0 @@
using UnityEngine;
using YooAsset;
namespace UniFramework.Pooling
{
public sealed class SpawnHandle : GameAsyncOperation
{
private enum ESteps
{
None,
Waiting,
Done,
}
private readonly GameObjectPool _pool;
private InstantiateOperation _operation;
private readonly Transform _parent;
private readonly Vector3 _position;
private readonly Quaternion _rotation;
private ESteps _steps = ESteps.None;
/// <summary>
/// 实例化的游戏对象
/// </summary>
public GameObject GameObj
{
get
{
if (_operation == null)
{
UniLogger.Warning("The spawn handle is invalid !");
return null;
}
return _operation.Result;
}
}
/// <summary>
/// 用户自定义数据集
/// </summary>
public System.Object[] UserDatas { private set; get; }
private SpawnHandle()
{
}
internal SpawnHandle(GameObjectPool pool, InstantiateOperation operation, Transform parent, Vector3 position, Quaternion rotation, params System.Object[] userDatas)
{
_pool = pool;
_operation = operation;
_parent = parent;
_position = position;
_rotation = rotation;
UserDatas = userDatas;
}
protected override void OnStart()
{
_steps = ESteps.Waiting;
}
protected override void OnUpdate()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
if (_steps == ESteps.Waiting)
{
if (_operation.IsDone == false)
return;
if (_operation.Status != EOperationStatus.Succeed)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = _operation.Error;
return;
}
if (_operation.Result == null)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = $"Clone game object is null.";
return;
}
// 设置参数
_operation.Result.transform.SetParent(_parent);
_operation.Result.transform.SetPositionAndRotation(_position, _rotation);
_operation.Result.SetActive(true);
_steps = ESteps.Done;
Status = EOperationStatus.Succeed;
}
}
/// <summary>
/// 回收
/// </summary>
public void Restore()
{
if (_operation != null)
{
ClearCompletedCallback();
CancelHandle();
_pool.Restore(_operation);
_operation = null;
}
}
/// <summary>
/// 丢弃
/// </summary>
public void Discard()
{
if (_operation != null)
{
ClearCompletedCallback();
CancelHandle();
_pool.Discard(_operation);
_operation = null;
}
}
/// <summary>
/// 等待异步实例化结束
/// </summary>
public void WaitForAsyncComplete()
{
if (_operation != null)
{
if (_steps == ESteps.Done)
return;
_operation.WaitForAsyncComplete();
OnUpdate();
}
}
private void CancelHandle()
{
if (IsDone == false)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = $"User cancelled !";
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 6350d2984a149b349b9cec658d21b12a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,259 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using YooAsset;
namespace UniFramework.Pooling
{
public class Spawner
{
private readonly List<GameObjectPool> _gameObjectPools = new List<GameObjectPool>(100);
private readonly List<GameObjectPool> _removeList = new List<GameObjectPool>(100);
private readonly GameObject _spawnerRoot;
private readonly ResourcePackage _package;
public string PackageName
{
get
{
return _package.PackageName;
}
}
private Spawner()
{
}
internal Spawner(GameObject poolingRoot, ResourcePackage package)
{
_spawnerRoot = new GameObject($"{package.PackageName}");
_spawnerRoot.transform.SetParent(poolingRoot.transform);
_package = package;
}
/// <summary>
/// 更新游戏对象池系统
/// </summary>
internal void Update()
{
_removeList.Clear();
foreach (var pool in _gameObjectPools)
{
if (pool.CanAutoDestroy())
_removeList.Add(pool);
}
foreach (var pool in _removeList)
{
_gameObjectPools.Remove(pool);
pool.DestroyPool();
}
}
/// <summary>
/// 销毁游戏对象池系统
/// </summary>
internal void Destroy()
{
DestroyAll(true);
}
/// <summary>
/// 销毁所有对象池及其资源
/// </summary>
/// <param name="includeAll">销毁所有对象池,包括常驻对象池</param>
public void DestroyAll(bool includeAll)
{
if (includeAll)
{
foreach (var pool in _gameObjectPools)
{
pool.DestroyPool();
}
_gameObjectPools.Clear();
}
else
{
List<GameObjectPool> removeList = new List<GameObjectPool>();
foreach (var pool in _gameObjectPools)
{
if (pool.DontDestroy == false)
removeList.Add(pool);
}
foreach (var pool in removeList)
{
_gameObjectPools.Remove(pool);
pool.DestroyPool();
}
}
}
/// <summary>
/// 异步创建指定资源的游戏对象池
/// </summary>
/// <param name="location">资源定位地址</param>
/// <param name="dontDestroy">资源常驻不销毁</param>
/// <param name="initCapacity">对象池的初始容量</param>
/// <param name="maxCapacity">对象池的最大容量</param>
/// <param name="destroyTime">静默销毁时间(注意:小于零代表不主动销毁)</param>
public CreatePoolOperation CreateGameObjectPoolAsync(string location, bool dontDestroy = false, int initCapacity = 0, int maxCapacity = int.MaxValue, float destroyTime = -1f)
{
return CreateGameObjectPoolInternal(location, dontDestroy, initCapacity, maxCapacity, destroyTime);
}
/// <summary>
/// 同步创建指定资源的游戏对象池
/// </summary>
/// <param name="location">资源定位地址</param>
/// <param name="dontDestroy">资源常驻不销毁</param>
/// <param name="initCapacity">对象池的初始容量</param>
/// <param name="maxCapacity">对象池的最大容量</param>
/// <param name="destroyTime">静默销毁时间(注意:小于零代表不主动销毁)</param>
public CreatePoolOperation CreateGameObjectPoolSync(string location, bool dontDestroy = false, int initCapacity = 0, int maxCapacity = int.MaxValue, float destroyTime = -1f)
{
var operation = CreateGameObjectPoolInternal(location, dontDestroy, initCapacity, maxCapacity, destroyTime);
operation.WaitForAsyncComplete();
return operation;
}
/// <summary>
/// 创建指定资源的游戏对象池
/// </summary>
private CreatePoolOperation CreateGameObjectPoolInternal(string location, bool dontDestroy = false, int initCapacity = 0, int maxCapacity = int.MaxValue, float destroyTime = -1f)
{
if (maxCapacity < initCapacity)
throw new Exception("The max capacity value must be greater the init capacity value.");
GameObjectPool pool = TryGetGameObjectPool(location);
if (pool != null)
{
UniLogger.Warning($"GameObject pool is already existed : {location}");
var operation = new CreatePoolOperation(pool.AssetHandle);
YooAssets.StartOperation(operation);
return operation;
}
else
{
pool = new GameObjectPool(_spawnerRoot, location, dontDestroy, initCapacity, maxCapacity, destroyTime);
pool.CreatePool(_package);
_gameObjectPools.Add(pool);
var operation = new CreatePoolOperation(pool.AssetHandle);
YooAssets.StartOperation(operation);
return operation;
}
}
/// <summary>
/// 异步实例化一个游戏对象
/// </summary>
/// <param name="location">资源定位地址</param>
/// <param name="forceClone">强制克隆游戏对象,忽略缓存池里的对象</param>
/// <param name="userDatas">用户自定义数据</param>
public SpawnHandle SpawnAsync(string location, bool forceClone = false, params System.Object[] userDatas)
{
return SpawnInternal(location, null, Vector3.zero, Quaternion.identity, forceClone, userDatas);
}
/// <summary>
/// 异步实例化一个游戏对象
/// </summary>
/// <param name="location">资源定位地址</param>
/// <param name="parent">父物体</param>
/// <param name="forceClone">强制克隆游戏对象,忽略缓存池里的对象</param>
/// <param name="userDatas">用户自定义数据</param>
public SpawnHandle SpawnAsync(string location, Transform parent, bool forceClone = false, params System.Object[] userDatas)
{
return SpawnInternal(location, parent, Vector3.zero, Quaternion.identity, forceClone, userDatas);
}
/// <summary>
/// 异步实例化一个游戏对象
/// </summary>
/// <param name="location">资源定位地址</param>
/// <param name="parent">父物体</param>
/// <param name="position">世界坐标</param>
/// <param name="rotation">世界角度</param>
/// <param name="forceClone">强制克隆游戏对象,忽略缓存池里的对象</param>
/// <param name="userDatas">用户自定义数据</param>
public SpawnHandle SpawnAsync(string location, Transform parent, Vector3 position, Quaternion rotation, bool forceClone = false, params System.Object[] userDatas)
{
return SpawnInternal(location, parent, position, rotation, forceClone, userDatas);
}
/// <summary>
/// 同步实例化一个游戏对象
/// </summary>
/// <param name="location">资源定位地址</param>
/// <param name="forceClone">强制克隆游戏对象,忽略缓存池里的对象</param>
/// <param name="userDatas">用户自定义数据</param>
public SpawnHandle SpawnSync(string location, bool forceClone = false, params System.Object[] userDatas)
{
SpawnHandle handle = SpawnInternal(location, null, Vector3.zero, Quaternion.identity, forceClone, userDatas);
handle.WaitForAsyncComplete();
return handle;
}
/// <summary>
/// 同步实例化一个游戏对象
/// </summary>
/// <param name="location">资源定位地址</param>
/// <param name="parent">父物体</param>
/// <param name="forceClone">强制克隆游戏对象,忽略缓存池里的对象</param>
/// <param name="userDatas">用户自定义数据</param>
public SpawnHandle SpawnSync(string location, Transform parent, bool forceClone = false, params System.Object[] userDatas)
{
SpawnHandle handle = SpawnInternal(location, parent, Vector3.zero, Quaternion.identity, forceClone, userDatas);
handle.WaitForAsyncComplete();
return handle;
}
/// <summary>
/// 同步实例化一个游戏对象
/// </summary>
/// <param name="location">资源定位地址</param>
/// <param name="parent">父物体</param>
/// <param name="position">世界坐标</param>
/// <param name="rotation">世界角度</param>
/// <param name="forceClone">强制克隆游戏对象,忽略缓存池里的对象</param>
/// <param name="userDatas">用户自定义数据</param>
public SpawnHandle SpawnSync(string location, Transform parent, Vector3 position, Quaternion rotation, bool forceClone = false, params System.Object[] userDatas)
{
SpawnHandle handle = SpawnInternal(location, parent, position, rotation, forceClone, userDatas);
handle.WaitForAsyncComplete();
return handle;
}
/// <summary>
/// 实例化一个游戏对象
/// </summary>
private SpawnHandle SpawnInternal(string location, Transform parent, Vector3 position, Quaternion rotation, bool forceClone, params System.Object[] userDatas)
{
var pool = TryGetGameObjectPool(location);
if (pool != null)
{
return pool.Spawn(parent, position, rotation, forceClone, userDatas);
}
// 如果不存在创建游戏对象池
pool = new GameObjectPool(_spawnerRoot, location, false, 0, int.MaxValue, -1f);
pool.CreatePool(_package);
_gameObjectPools.Add(pool);
return pool.Spawn(parent, position, rotation, forceClone, userDatas);
}
private GameObjectPool TryGetGameObjectPool(string location)
{
foreach (var pool in _gameObjectPools)
{
if (pool.Location == location)
return pool;
}
return null;
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 6c0b7912d44674d47a5b7240670dcc87
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,21 +0,0 @@
using System.Diagnostics;
namespace UniFramework.Pooling
{
internal static class UniLogger
{
[Conditional("DEBUG")]
public static void Log(string info)
{
UnityEngine.Debug.Log(info);
}
public static void Warning(string info)
{
UnityEngine.Debug.LogWarning(info);
}
public static void Error(string info)
{
UnityEngine.Debug.LogError(info);
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 50142a5596fb6c1439dced35faef4d4c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,127 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using YooAsset;
namespace UniFramework.Pooling
{
/// <summary>
/// 游戏对象池系统
/// </summary>
public static class UniPooling
{
private static bool _isInitialize = false;
private static GameObject _driver = null;
private static readonly List<Spawner> _spawners = new List<Spawner>();
/// <summary>
/// 初始化游戏对象池系统
/// </summary>
public static void Initalize()
{
if (_isInitialize)
throw new Exception($"{nameof(UniPooling)} is initialized !");
if (_isInitialize == false)
{
// 创建驱动器
_isInitialize = true;
_driver = new UnityEngine.GameObject($"[{nameof(UniPooling)}]");
_driver.AddComponent<UniPoolingDriver>();
UnityEngine.Object.DontDestroyOnLoad(_driver);
UniLogger.Log($"{nameof(UniPooling)} initalize !");
}
}
/// <summary>
/// 销毁游戏对象池系统
/// </summary>
public static void Destroy()
{
if (_isInitialize)
{
foreach (var spawner in _spawners)
{
spawner.Destroy();
}
_spawners.Clear();
_isInitialize = false;
if (_driver != null)
GameObject.Destroy(_driver);
UniLogger.Log($"{nameof(UniPooling)} destroy all !");
}
}
/// <summary>
/// 更新游戏对象池系统
/// </summary>
internal static void Update()
{
if (_isInitialize)
{
foreach (var spawner in _spawners)
{
spawner.Update();
}
}
}
/// <summary>
/// 创建游戏对象生成器
/// </summary>
/// <param name="packageName">资源包名称</param>
public static Spawner CreateSpawner(string packageName)
{
// 获取资源包
var assetPackage = YooAssets.GetPackage(packageName);
if (assetPackage == null)
throw new Exception($"Not found asset package : {packageName}");
// 检测资源包初始化状态
if (assetPackage.InitializeStatus == EOperationStatus.None)
throw new Exception($"Asset package {packageName} not initialize !");
if (assetPackage.InitializeStatus == EOperationStatus.Failed)
throw new Exception($"Asset package {packageName} initialize failed !");
if (HasSpawner(packageName))
return GetSpawner(packageName);
Spawner spawner = new Spawner(_driver, assetPackage);
_spawners.Add(spawner);
return spawner;
}
/// <summary>
/// 获取游戏对象生成器
/// </summary>
/// <param name="packageName">资源包名称</param>
public static Spawner GetSpawner(string packageName)
{
foreach (var spawner in _spawners)
{
if (spawner.PackageName == packageName)
return spawner;
}
UniLogger.Warning($"Not found spawner : {packageName}");
return null;
}
/// <summary>
/// 检测游戏对象生成器是否存在
/// </summary>
/// <param name="packageName">资源包名称</param>
public static bool HasSpawner(string packageName)
{
foreach (var spawner in _spawners)
{
if (spawner.PackageName == packageName)
return true;
}
return false;
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 04fd1800aa2e61644893fa7893d93db8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,12 +0,0 @@
using UnityEngine;
namespace UniFramework.Pooling
{
internal class UniPoolingDriver : MonoBehaviour
{
void Update()
{
UniPooling.Update();
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: f4112e0723ed46c45927cc3498d62e5a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,199 +0,0 @@

namespace UniFramework.Utility
{
public sealed class UniTimer
{
/// <summary>
/// 延迟后,触发一次
/// </summary>
public static UniTimer CreateOnceTimer(float delay)
{
return new UniTimer(delay, -1, -1, 1);
}
/// <summary>
/// 延迟后,永久性的间隔触发
/// </summary>
/// <param name="delay">延迟时间</param>
/// <param name="interval">间隔时间</param>
public static UniTimer CreatePepeatTimer(float delay, float interval)
{
return new UniTimer(delay, interval, -1, -1);
}
/// <summary>
/// 延迟后,在一段时间内间隔触发
/// </summary>
/// <param name="delay">延迟时间</param>
/// <param name="interval">间隔时间</param>
/// <param name="duration">触发周期</param>
public static UniTimer CreatePepeatTimer(float delay, float interval, float duration)
{
return new UniTimer(delay, interval, duration, -1);
}
/// <summary>
/// 延迟后,间隔触发一定次数
/// </summary>
/// <param name="delay">延迟时间</param>
/// <param name="interval">间隔时间</param>
/// <param name="maxTriggerCount">最大触发次数</param>
public static UniTimer CreatePepeatTimer(float delay, float interval, long maxTriggerCount)
{
return new UniTimer(delay, interval, -1, maxTriggerCount);
}
/// <summary>
/// 延迟后,在一段时间内触发
/// </summary>
/// <param name="delay">延迟时间</param>
/// <param name="duration">触发周期</param>
public static UniTimer CreateDurationTimer(float delay, float duration)
{
return new UniTimer(delay, -1, duration, -1);
}
/// <summary>
/// 延迟后,永久触发
/// </summary>
public static UniTimer CreateForeverTimer(float delay)
{
return new UniTimer(delay, -1, -1, -1);
}
private readonly float _intervalTime;
private readonly float _durationTime;
private readonly long _maxTriggerCount;
// 需要重置的变量
private float _delayTimer = 0;
private float _durationTimer = 0;
private float _intervalTimer = 0;
private long _triggerCount = 0;
/// <summary>
/// 延迟时间
/// </summary>
public float DelayTime { private set; get; }
/// <summary>
/// 是否已经结束
/// </summary>
public bool IsOver { private set; get; }
/// <summary>
/// 是否已经暂停
/// </summary>
public bool IsPause { private set; get; }
/// <summary>
/// 延迟剩余时间
/// </summary>
public float Remaining
{
get
{
if (IsOver)
return 0f;
else
return System.Math.Max(0f, DelayTime - _delayTimer);
}
}
/// <summary>
/// 计时器
/// </summary>
/// <param name="delay">延迟时间</param>
/// <param name="interval">间隔时间</param>
/// <param name="duration">运行时间</param>
/// <param name="maxTriggerTimes">最大触发次数</param>
public UniTimer(float delay, float interval, float duration, long maxTriggerCount)
{
DelayTime = delay;
_intervalTime = interval;
_durationTime = duration;
_maxTriggerCount = maxTriggerCount;
}
/// <summary>
/// 暂停计时器
/// </summary>
public void Pause()
{
IsPause = true;
}
/// <summary>
/// 恢复计时器
/// </summary>
public void Resume()
{
IsPause = false;
}
/// <summary>
/// 结束计时器
/// </summary>
public void Kill()
{
IsOver = true;
}
/// <summary>
/// 重置计时器
/// </summary>
public void Reset()
{
_delayTimer = 0;
_durationTimer = 0;
_intervalTimer = 0;
_triggerCount = 0;
IsOver = false;
IsPause = false;
}
/// <summary>
/// 更新计时器
/// </summary>
public bool Update(float deltaTime)
{
if (IsOver || IsPause)
return false;
_delayTimer += deltaTime;
if (_delayTimer < DelayTime)
return false;
if(_intervalTime > 0)
_intervalTimer += deltaTime;
if (_durationTime > 0)
_durationTimer += deltaTime;
// 检测间隔执行
if (_intervalTime > 0)
{
if (_intervalTimer < _intervalTime)
return false;
_intervalTimer = 0;
}
// 检测结束条件
if (_durationTime > 0)
{
if (_durationTimer >= _durationTime)
Kill();
}
// 检测结束条件
if (_maxTriggerCount > 0)
{
_triggerCount++;
if (_triggerCount >= _maxTriggerCount)
Kill();
}
return true;
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a9ba1e57e76e1c3498c1e678e2737ab2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: ca2e7b4bdd8611b4ca9a21408a8a20a1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 4703541a565f5ec4bb35edd81c28958c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 145b951be40d41dea06e76bd967a5d15
timeCreated: 1682045847

View File

@@ -1,19 +0,0 @@
using System;
using ProtoBuf;
namespace GameLogic
{
[Serializable, ProtoContract(Name = @"HeartBeat")]
public class HeartBeat : PacketBase
{
public HeartBeat()
{
}
public override int Id => 1;
public override void Clear()
{
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: d8b9b60d2abf409ca9dd2ce00506ac79
timeCreated: 1682046644

View File

@@ -1,254 +0,0 @@
using ProtoBuf;
using ProtoBuf.Meta;
using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Sockets;
using System.Reflection;
using TEngine;
namespace GameLogic
{
public class NetworkChannelHelper : INetworkChannelHelper, IMemory
{
private readonly Dictionary<int, Type> _serverToClientPacketTypes = new Dictionary<int, Type>();
private readonly MemoryStream _cachedStream = new MemoryStream(1024 * 8);
private INetworkChannel _networkChannel = null;
/// <summary>
/// 获取消息包头长度。
/// <remarks>4。</remarks>
/// </summary>
public int PacketHeaderLength => sizeof(int);
/// <summary>
/// 初始化网络频道辅助器。
/// </summary>
/// <param name="networkChannel">网络频道。</param>
public void Initialize(INetworkChannel networkChannel)
{
_networkChannel = networkChannel;
// 反射注册包和包处理函数。
Type packetBaseType = typeof(ProtoPacket);
Assembly assembly = Assembly.GetExecutingAssembly();
Type[] types = assembly.GetTypes();
for (int i = 0; i < types.Length; i++)
{
if (!types[i].IsClass || types[i].IsAbstract)
{
continue;
}
if (types[i].BaseType == packetBaseType)
{
PacketBase packetBase = (PacketBase)Activator.CreateInstance(types[i]);
Type packetType = GetServerToClientPacketType(packetBase.Id);
if (packetType != null)
{
Log.Warning("Already exist packet type '{0}', check '{1}' or '{2}'?.", packetBase.Id.ToString(), packetType.Name, packetBase.GetType().Name);
continue;
}
_serverToClientPacketTypes.Add(packetBase.Id, types[i]);
}
}
GameEvent.AddEventListener<INetworkChannel, object>(NetworkEvent.NetworkConnectedEvent, OnNetworkConnected);
GameEvent.AddEventListener<INetworkChannel>(NetworkEvent.NetworkClosedEvent, OnNetworkClosed);
GameEvent.AddEventListener<INetworkChannel, int>(NetworkEvent.NetworkMissHeartBeatEvent, OnNetworkMissHeartBeat);
GameEvent.AddEventListener<INetworkChannel, NetworkErrorCode, SocketError, string>(NetworkEvent.NetworkErrorEvent, OnNetworkError);
GameEvent.AddEventListener<INetworkChannel, object>(NetworkEvent.NetworkCustomErrorEvent, OnNetworkCustomError);
}
/// <summary>
/// 关闭并清理网络频道辅助器。
/// </summary>
public void Shutdown()
{
GameEvent.RemoveEventListener<INetworkChannel, object>(NetworkEvent.NetworkConnectedEvent, OnNetworkConnected);
GameEvent.RemoveEventListener<INetworkChannel>(NetworkEvent.NetworkClosedEvent, OnNetworkClosed);
GameEvent.RemoveEventListener<INetworkChannel, int>(NetworkEvent.NetworkMissHeartBeatEvent, OnNetworkMissHeartBeat);
GameEvent.RemoveEventListener<INetworkChannel, NetworkErrorCode, SocketError, string>(NetworkEvent.NetworkErrorEvent, OnNetworkError);
GameEvent.RemoveEventListener<INetworkChannel, object>(NetworkEvent.NetworkCustomErrorEvent, OnNetworkCustomError);
_networkChannel = null;
}
/// <summary>
/// 准备进行连接。
/// </summary>
public void PrepareForConnecting()
{
_networkChannel.Socket.ReceiveBufferSize = 1024 * 64;
_networkChannel.Socket.SendBufferSize = 1024 * 64;
}
/// <summary>
/// 发送心跳消息包。
/// </summary>
/// <returns>是否发送心跳消息包成功。</returns>
public bool SendHeartBeat()
{
_networkChannel.Send(MemoryPool.Acquire<HeartBeat>());
return true;
}
/// <summary>
/// 序列化消息包。
/// </summary>
/// <typeparam name="T">消息包类型。</typeparam>
/// <param name="packet">要序列化的消息包。</param>
/// <param name="destination">要序列化的目标流。</param>
/// <returns>是否序列化成功。</returns>
public bool Serialize<T>(T packet, Stream destination) where T : Packet
{
PacketBase packetImpl = packet as PacketBase;
if (packetImpl == null)
{
Log.Warning("Packet is invalid.");
return false;
}
_cachedStream.SetLength(_cachedStream.Capacity); // 此行防止 Array.Copy 的数据无法写入
_cachedStream.Position = 0L;
PacketHeader packetHeader = MemoryPool.Acquire<PacketHeader>();
Serializer.Serialize(_cachedStream, packetHeader);
MemoryPool.Release(packetHeader);
Serializer.SerializeWithLengthPrefix(_cachedStream, packet, PrefixStyle.Fixed32);
MemoryPool.Release((IMemory)packet);
_cachedStream.WriteTo(destination);
return true;
}
/// <summary>
/// 反序列化消息包头。
/// </summary>
/// <param name="source">要反序列化的来源流。</param>
/// <param name="customErrorData">用户自定义错误数据。</param>
/// <returns>反序列化后的消息包头。</returns>
public IPacketHeader DeserializePacketHeader(Stream source, out object customErrorData)
{
// 注意:此函数并不在主线程调用!
customErrorData = null;
return (IPacketHeader)RuntimeTypeModel.Default.Deserialize(source, MemoryPool.Acquire<PacketHeader>(), typeof(PacketHeader));
}
/// <summary>
/// 反序列化消息包。
/// </summary>
/// <param name="packetHeader">消息包头。</param>
/// <param name="source">要反序列化的来源流。</param>
/// <param name="customErrorData">用户自定义错误数据。</param>
/// <returns>反序列化后的消息包。</returns>
public Packet DeserializePacket(IPacketHeader packetHeader, Stream source, out object customErrorData)
{
// 注意:此函数并不在主线程调用!
customErrorData = null;
PacketHeader scPacketHeader = packetHeader as PacketHeader;
if (scPacketHeader == null)
{
Log.Warning("Packet header is invalid.");
return null;
}
Packet packet = null;
if (scPacketHeader.IsValid)
{
Type packetType = GetServerToClientPacketType(scPacketHeader.Id);
if (packetType != null)
{
packet = (Packet)RuntimeTypeModel.Default.DeserializeWithLengthPrefix(source, MemoryPool.Acquire(packetType), packetType, PrefixStyle.Fixed32, 0);
}
else
{
Log.Warning("Can not deserialize packet for packet id '{0}'.", scPacketHeader.Id.ToString());
}
}
else
{
Log.Warning("Packet header is invalid.");
}
MemoryPool.Release(scPacketHeader);
return packet;
}
private Type GetServerToClientPacketType(int id)
{
if (_serverToClientPacketTypes.TryGetValue(id, out var type))
{
return type;
}
return null;
}
private void OnNetworkConnected(INetworkChannel channel, object userdata)
{
if (channel != _networkChannel)
{
return;
}
Log.Info("Network channel '{0}' connected, local address '{1}', remote address '{2}'.",
channel.Name, channel.Socket.LocalEndPoint.ToString(),
channel.Socket.RemoteEndPoint.ToString());
}
private void OnNetworkClosed(INetworkChannel channel)
{
if (channel != _networkChannel)
{
return;
}
Log.Info("Network channel '{0}' closed.", channel.Name);
}
private void OnNetworkMissHeartBeat(INetworkChannel channel, int missCount)
{
if (channel != _networkChannel)
{
return;
}
Log.Fatal("Network channel '{0}' miss heart beat '{1}' times.", channel.Name, missCount.ToString());
if (missCount < 2)
{
return;
}
channel.Close();
}
private void OnNetworkError(INetworkChannel channel, NetworkErrorCode networkErrorCode, SocketError socketError, string errorMessage)
{
if (channel != _networkChannel)
{
return;
}
Log.Fatal("Network channel '{0}' error, error code is '{1}', error message is '{2}'.", channel.Name, networkErrorCode.ToString(), errorMessage);
channel.Close();
}
private void OnNetworkCustomError(INetworkChannel channel, object userData)
{
if (channel != _networkChannel)
{
return;
}
}
public void Clear()
{
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: bf86ce2ddfb5429abecfb06257c86acd
timeCreated: 1682045961

View File

@@ -1,24 +0,0 @@
using TEngine;
namespace GameLogic
{
/// <summary>
/// 网络消息包基类。
/// </summary>
public abstract class PacketBase : Packet
{
/// <summary>
/// 网络消息包Id。
/// </summary>
public int ProtoId;
/// <summary>
/// 网络消息包包体。
/// </summary>
public byte[] ProtoBody;
public void Close()
{
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: acea4283f57644b6b4452354d23f2803
timeCreated: 1682045887

View File

@@ -1,47 +0,0 @@
using TEngine;
namespace GameLogic
{
/// <summary>
/// 网络消息包头。
/// </summary>
public class PacketHeader : IPacketHeader, IMemory
{
/// <summary>
/// 网络消息包Id。
/// </summary>
public short Id
{
get;
set;
}
/// <summary>
/// 网络消息包长度。
/// </summary>
public int PacketLength
{
get;
set;
}
/// <summary>
/// 网络消息包是否合法。
/// </summary>
public bool IsValid
{
get
{
return PacketLength >= 0;
}
}
/// <summary>
/// 清除网络消息包头。
/// </summary>
public void Clear()
{
PacketLength = 0;
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 30edc133b73141598b5351d4afc2ad93
timeCreated: 1682046771

View File

@@ -1,15 +0,0 @@
namespace GameLogic
{
/// <summary>
/// 网络消息包。
/// </summary>
public partial class ProtoPacket : PacketBase
{
public override int Id => 1;
public override void Clear()
{
Close();
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: da70995486db4799baba570b1767ab86
timeCreated: 1682045865

View File

@@ -1,138 +0,0 @@
// using System;
// using System.ComponentModel;
// using System.IO;
// using ProtoBuf;
// using ProtoBuf.Meta;
//
// /// <summary>
// /// ProtoBuf工具
// /// </summary>
// public class ProtobufUtils
// {
// /// <summary>
// /// 消息压入内存流。
// /// </summary>
// /// <param name="message"></param>
// /// <param name="stream"></param>
// public static void ToStream(object message, MemoryStream stream)
// {
// ((IMessage)message).WriteTo(stream);
// }
//
// /// <summary>
// /// 比特流解析。
// /// </summary>
// /// <param name="type"></param>
// /// <param name="bytes"></param>
// /// <param name="index"></param>
// /// <param name="count"></param>
// /// <returns></returns>
// public static object FromBytes(Type type, byte[] bytes, int index, int count)
// {
// object message = Activator.CreateInstance(type);
// ((IMessage)message).MergeFrom(bytes, index, count);
// ISupportInitialize iSupportInitialize = message as ISupportInitialize;
// if (iSupportInitialize == null)
// {
// return message;
// }
//
// iSupportInitialize.EndInit();
// return message;
// }
//
// /// <summary>
// /// 比特流解析。
// /// </summary>
// /// <param name="instance"></param>
// /// <param name="bytes"></param>
// /// <param name="index"></param>
// /// <param name="count"></param>
// /// <returns></returns>
// public static object FromBytes(object instance, byte[] bytes, int index, int count)
// {
// object message = instance;
// ((IMessage)message).MergeFrom(bytes, index, count);
// ISupportInitialize iSupportInitialize = message as ISupportInitialize;
// if (iSupportInitialize == null)
// {
// return message;
// }
//
// iSupportInitialize.EndInit();
// return message;
// }
//
// /// <summary>
// /// 从内存流取出。
// /// </summary>
// /// <param name="type"></param>
// /// <param name="stream"></param>
// /// <returns></returns>
// public static object FromStream(Type type, MemoryStream stream)
// {
// object message = Activator.CreateInstance(type);
// ((IMessage)message).MergeFrom(stream.GetBuffer(), (int)stream.Position, (int)stream.Length);
// ISupportInitialize iSupportInitialize = message as ISupportInitialize;
// if (iSupportInitialize == null)
// {
// return message;
// }
//
// iSupportInitialize.EndInit();
// return message;
// }
//
// /// <summary>
// /// 从内存流取出。
// /// </summary>
// /// <param name="message"></param>
// /// <param name="stream"></param>
// /// <returns></returns>
// public static object FromStream(object message, MemoryStream stream)
// {
// // TODO 这个message最好从池中获取减少gc
// ((IMessage)message).MergeFrom(stream.GetBuffer(), (int)stream.Position, (int)stream.Length);
// ISupportInitialize iSupportInitialize = message as ISupportInitialize;
// if (iSupportInitialize == null)
// {
// return message;
// }
//
// iSupportInitialize.EndInit();
// return message;
// }
//
// /// <summary>
// /// 序列化protobuf
// /// </summary>
// /// <param name="message"></param>
// /// <returns></returns>
// public static byte[] Serialize(object message)
// {
// return ((IMessage)message).ToByteArray();
// }
//
// /// <summary>
// /// 反序列化protobuf
// /// </summary>
// /// <typeparam name="T"></typeparam>
// /// <param name="dataBytes"></param>
// /// <returns></returns>
// public static T Deserialize<T>(byte[] dataBytes) where T : IMessage, new()
// {
// T msg = new T();
// msg = (T)msg.Descriptor.Parser.ParseFrom(dataBytes);
// return msg;
// }
//
// public static int GetHighOrder(int cmdMerge)
// {
// return cmdMerge >> 16;
// }
//
// public static int GetLowOrder(int cmdMerge)
// {
// return cmdMerge & 65535;
// }
// }

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 972ca4545003463d8710de956f0fde66
timeCreated: 1682047511

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 12517ef95f49a9144b18989aa8097420
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: d376f2d7d7324712998e19cfa2e03039
timeCreated: 1680161323

View File

@@ -1,76 +0,0 @@
using Bright.Serialization;
using System.IO;
using GameBase;
using GameConfig;
using SimpleJSON;
using UnityEngine;
/// <summary>
/// 配置加载器
/// </summary>
public class ConfigLoader:Singleton<ConfigLoader>
{
private bool _init = false;
private Tables _tables;
public Tables Tables
{
get
{
if (!_init)
{
_init = true;
Load();
}
return _tables;
}
}
/// <summary>
/// 加载配置
/// </summary>
public void Load()
{
var tablesCtor = typeof(Tables).GetConstructors()[0];
var loaderReturnType = tablesCtor.GetParameters()[0].ParameterType.GetGenericArguments()[1];
System.Delegate loader = loaderReturnType == typeof(ByteBuf)
? new System.Func<string, ByteBuf>(LoadByteBuf)
: (System.Delegate)new System.Func<string, JSONNode>(LoadJson);
_tables = (Tables)tablesCtor.Invoke(new object[] { loader });
}
/// <summary>
/// 加载Json配置。
/// </summary>
/// <param name="file">FileName</param>
/// <returns>JSONNode</returns>
private JSONNode LoadJson(string file)
{
#if UNITY_EDITOR
var ret = File.ReadAllText($"{Application.dataPath}/../GenerateDatas/json/{file}.json", System.Text.Encoding.UTF8);
#else
var textAssets = GameModule.Resource.LoadAsset<TextAsset>($"{SettingsUtils.FrameworkGlobalSettings.ConfigFolderName}{file}.json");
var ret = textAssets.text;
#endif
return JSON.Parse(ret);
}
/// <summary>
/// 加载二进制配置。
/// </summary>
/// <param name="file">FileName</param>
/// <returns>ByteBuf</returns>
private ByteBuf LoadByteBuf(string file)
{
byte[] ret = null;
#if UNITY_EDITOR
ret = File.ReadAllBytes($"{Application.dataPath}/../GenerateDatas/bytes/{file}.bytes");
#else
var textAssets = GameModule.Resource.LoadAsset<TextAsset>($"{SettingsUtils.FrameworkGlobalSettings.ConfigFolderName}{file}.bytes");
ret = textAssets.bytes;
#endif
return new ByteBuf(ret);
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: abc35c855bfb323429a1d72066c8489c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,65 +0,0 @@
using System;
using System.Collections.Generic;
using TEngine;
namespace GameProto
{
/// <summary>
/// 指定Key委托。
/// </summary>
/// <typeparam name="TKey">键。</typeparam>
/// <typeparam name="TValue">值。</typeparam>
public delegate TKey ConvertDictionaryKey<out TKey, in TValue>(TValue val);
/// <summary>
/// 配置表辅助工具。
/// </summary>
public static class ConfigUtility
{
/// <summary>
/// 生成64long的主键。
/// </summary>
/// <param name="key1">键1。</param>
/// <param name="key2">键2。</param>
/// <returns>64long的主键。</returns>
public static UInt64 Make64Key(uint key1, uint key2)
{
return ((UInt64)key1 << 32) | key2;
}
/// <summary>
/// 拷贝配置表字典。
/// </summary>
/// <param name="dict">拷贝地址。</param>
/// <param name="source">拷贝源。</param>
/// <param name="convKey">指定主键。</param>
/// <typeparam name="TKey">键。</typeparam>
/// <typeparam name="TValue">值。</typeparam>
/// <returns>是否拷贝成功。</returns>
public static bool CopyConfigDict<TKey, TValue>(ref Dictionary<TKey, TValue> dict,List<TValue> source, ConvertDictionaryKey<TKey, TValue> convKey)
{
if (source == null)
{
return false;
}
dict.Clear();
bool failed = false;
for (int i = 0; i < source.Count; i++)
{
var data = source[i];
TKey key = convKey(data);
if (dict.ContainsKey(key))
{
Log.Fatal("Copy Config Failed: {0} IndexOf {1} Had Repeated Key: {2} ", typeof(TValue).Name, i + 1, key);
failed = true;
break;
}
dict.Add(key, data);
}
return !failed;
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: e278e636820842f293e2a765962ad4f8
timeCreated: 1683300170

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 31f94e2989871ec49b783b3aeb1b142c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,32 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace GameConfig.Battle
{
public enum ActorAttrAddType
{
/// <summary>
/// 无效数据
/// </summary>
NONE = 0,
/// <summary>
/// 加法计算
/// </summary>
ABSOLUTE_VAL = 1,
/// <summary>
/// 多个项结果累加,然后对加法做乘法
/// </summary>
SUM_PERCENT_VAL = 2,
/// <summary>
/// 每一项都是对最终结果做乘法
/// </summary>
MUL_PERCENT_VAL = 3,
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 073f19ae3fef26f43b193ff35a27eb9c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,88 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace GameConfig.Battle
{
public enum ActorAttrDataType
{
/// <summary>
/// 无效数据
/// </summary>
None = 0,
/// <summary>
/// 最大血量
/// </summary>
MaxHp = 1,
/// <summary>
/// 攻击力
/// </summary>
Attack = 2,
/// <summary>
/// 物理伤害
/// </summary>
PhyDamage = 3,
/// <summary>
/// 物理防御
/// </summary>
PhyDef = 4,
/// <summary>
/// 法术伤害
/// </summary>
MagicDamage = 5,
/// <summary>
/// 法术防御
/// </summary>
MagicDef = 6,
/// <summary>
/// 移动速度
/// </summary>
MoveSpeed = 7,
/// <summary>
/// 攻击速度
/// </summary>
AttackSpeed = 8,
/// <summary>
/// 命中率
/// </summary>
Hit = 9,
/// <summary>
/// 闪避率
/// </summary>
Dodge = 10,
/// <summary>
/// 暴击率
/// </summary>
CriticalAtkRatio = 11,
/// <summary>
/// San值(疯狂值)
/// </summary>
SanValue = 12,
/// <summary>
/// 最大MP
/// </summary>
MaxMp = 13,
/// <summary>
/// 物理伤害倍率
/// </summary>
PhyDamageRatio = 14,
/// <summary>
/// 魔法伤害倍率
/// </summary>
MagicDamageRatio = 15,
/// <summary>
/// 暴击倍率
/// </summary>
CriticalRatio = 16,
/// <summary>
/// 暴击减免
/// </summary>
CriticalReduce = 17,
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 89dbbbd30b2f8c74f86ede4e27591ba7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,116 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Bright.Serialization;
using System.Collections.Generic;
using SimpleJSON;
namespace GameConfig.Battle
{
public sealed partial class BuffAttrConfig : Bright.Config.BeanBase
{
public BuffAttrConfig(JSONNode _json)
{
{ if(!_json["BuffID"].IsNumber) { throw new SerializationException(); } BuffID = _json["BuffID"]; }
{ if(!_json["name"].IsString) { throw new SerializationException(); } Name = _json["name"]; }
{ if(!_json["StackNum"].IsNumber) { throw new SerializationException(); } StackNum = _json["StackNum"]; }
{ if(!_json["DurTime"].IsNumber) { throw new SerializationException(); } DurTime = _json["DurTime"]; }
{ if(!_json["ResultType"].IsNumber) { throw new SerializationException(); } ResultType = (Battle.BuffResultType)_json["ResultType"].AsInt; }
{ if(!_json["RemoveWhenDie"].IsNumber) { throw new SerializationException(); } RemoveWhenDie = _json["RemoveWhenDie"]; }
{ if(!_json["DotDamageData"].IsObject) { throw new SerializationException(); } DotDamageData = Battle.SkillAttrDamageData.DeserializeSkillAttrDamageData(_json["DotDamageData"]); }
{ if(!_json["DotTickConfig"].IsObject) { throw new SerializationException(); } DotTickConfig = Battle.BuffDotTickConfig.DeserializeBuffDotTickConfig(_json["DotTickConfig"]); }
{ var __json0 = _json["AttrData"]; if(!__json0.IsArray) { throw new SerializationException(); } AttrData = new System.Collections.Generic.List<Battle.ResAttrImpactData>(__json0.Count); foreach(JSONNode __e0 in __json0.Children) { Battle.ResAttrImpactData __v0; { if(!__e0.IsObject) { throw new SerializationException(); } __v0 = Battle.ResAttrImpactData.DeserializeResAttrImpactData(__e0); } AttrData.Add(__v0); } }
PostInit();
}
public BuffAttrConfig(int BuffID, string name, int StackNum, float DurTime, Battle.BuffResultType ResultType, int RemoveWhenDie, Battle.SkillAttrDamageData DotDamageData, Battle.BuffDotTickConfig DotTickConfig, System.Collections.Generic.List<Battle.ResAttrImpactData> AttrData )
{
this.BuffID = BuffID;
this.Name = name;
this.StackNum = StackNum;
this.DurTime = DurTime;
this.ResultType = ResultType;
this.RemoveWhenDie = RemoveWhenDie;
this.DotDamageData = DotDamageData;
this.DotTickConfig = DotTickConfig;
this.AttrData = AttrData;
PostInit();
}
public static BuffAttrConfig DeserializeBuffAttrConfig(JSONNode _json)
{
return new Battle.BuffAttrConfig(_json);
}
/// <summary>
/// BuffID
/// </summary>
public int BuffID { get; private set; }
/// <summary>
/// 名字
/// </summary>
public string Name { get; private set; }
/// <summary>
/// 叠加次数
/// </summary>
public int StackNum { get; private set; }
/// <summary>
/// 持续时间
/// </summary>
public float DurTime { get; private set; }
/// <summary>
/// 数值效果类型
/// </summary>
public Battle.BuffResultType ResultType { get; private set; }
/// <summary>
/// 死亡消失
/// </summary>
public int RemoveWhenDie { get; private set; }
public Battle.SkillAttrDamageData DotDamageData { get; private set; }
public Battle.BuffDotTickConfig DotTickConfig { get; private set; }
public System.Collections.Generic.List<Battle.ResAttrImpactData> AttrData { get; private set; }
public const int __ID__ = 1652935996;
public override int GetTypeId() => __ID__;
public void Resolve(Dictionary<string, object> _tables)
{
DotDamageData?.Resolve(_tables);
DotTickConfig?.Resolve(_tables);
foreach(var _e in AttrData) { _e?.Resolve(_tables); }
PostResolve();
}
public void TranslateText(System.Func<string, string, string> translator)
{
DotDamageData?.TranslateText(translator);
DotTickConfig?.TranslateText(translator);
foreach(var _e in AttrData) { _e?.TranslateText(translator); }
}
public override string ToString()
{
return "{ "
+ "BuffID:" + BuffID + ","
+ "Name:" + Name + ","
+ "StackNum:" + StackNum + ","
+ "DurTime:" + DurTime + ","
+ "ResultType:" + ResultType + ","
+ "RemoveWhenDie:" + RemoveWhenDie + ","
+ "DotDamageData:" + DotDamageData + ","
+ "DotTickConfig:" + DotTickConfig + ","
+ "AttrData:" + Bright.Common.StringUtil.CollectionToString(AttrData) + ","
+ "}";
}
partial void PostInit();
partial void PostResolve();
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 5224da34dfb42c141b22335957c1b784
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,111 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Bright.Serialization;
using System.Collections.Generic;
using SimpleJSON;
namespace GameConfig.Battle
{
public sealed partial class BuffConfig : Bright.Config.BeanBase
{
public BuffConfig(JSONNode _json)
{
{ if(!_json["BuffID"].IsNumber) { throw new SerializationException(); } BuffID = _json["BuffID"]; }
{ if(!_json["name"].IsString) { throw new SerializationException(); } Name = _json["name"]; }
{ if(!_json["prefId"].IsNumber) { throw new SerializationException(); } PrefId = _json["prefId"]; }
{ if(!_json["desc"].IsString) { throw new SerializationException(); } Desc = _json["desc"]; }
{ if(!_json["icon"].IsString) { throw new SerializationException(); } Icon = _json["icon"]; }
{ if(!_json["TimeType"].IsNumber) { throw new SerializationException(); } TimeType = (Battle.BuffTimeType)_json["TimeType"].AsInt; }
{ if(!_json["ReplaceType"].IsNumber) { throw new SerializationException(); } ReplaceType = (Battle.BuffReplaceType)_json["ReplaceType"].AsInt; }
{ if(!_json["State"].IsObject) { throw new SerializationException(); } State = Battle.BuffTriggleState.DeserializeBuffTriggleState(_json["State"]); }
PostInit();
}
public BuffConfig(int BuffID, string name, int prefId, string desc, string icon, Battle.BuffTimeType TimeType, Battle.BuffReplaceType ReplaceType, Battle.BuffTriggleState State )
{
this.BuffID = BuffID;
this.Name = name;
this.PrefId = prefId;
this.Desc = desc;
this.Icon = icon;
this.TimeType = TimeType;
this.ReplaceType = ReplaceType;
this.State = State;
PostInit();
}
public static BuffConfig DeserializeBuffConfig(JSONNode _json)
{
return new Battle.BuffConfig(_json);
}
/// <summary>
/// BuffID
/// </summary>
public int BuffID { get; private set; }
/// <summary>
/// 名字
/// </summary>
public string Name { get; private set; }
/// <summary>
/// 表现ID
/// </summary>
public int PrefId { get; private set; }
/// <summary>
/// 描述
/// </summary>
public string Desc { get; private set; }
/// <summary>
/// 图标
/// </summary>
public string Icon { get; private set; }
/// <summary>
/// 持续类型
/// </summary>
public Battle.BuffTimeType TimeType { get; private set; }
/// <summary>
/// 叠加类型
/// </summary>
public Battle.BuffReplaceType ReplaceType { get; private set; }
public Battle.BuffTriggleState State { get; private set; }
public const int __ID__ = 1807662187;
public override int GetTypeId() => __ID__;
public void Resolve(Dictionary<string, object> _tables)
{
State?.Resolve(_tables);
PostResolve();
}
public void TranslateText(System.Func<string, string, string> translator)
{
State?.TranslateText(translator);
}
public override string ToString()
{
return "{ "
+ "BuffID:" + BuffID + ","
+ "Name:" + Name + ","
+ "PrefId:" + PrefId + ","
+ "Desc:" + Desc + ","
+ "Icon:" + Icon + ","
+ "TimeType:" + TimeType + ","
+ "ReplaceType:" + ReplaceType + ","
+ "State:" + State + ","
+ "}";
}
partial void PostInit();
partial void PostResolve();
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 6b4f7b8798a4dca4ca075552d618f24d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,64 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Bright.Serialization;
using System.Collections.Generic;
using SimpleJSON;
namespace GameConfig.Battle
{
public sealed partial class BuffDotTickConfig : Bright.Config.BeanBase
{
public BuffDotTickConfig(JSONNode _json)
{
{ if(!_json["TickTime"].IsNumber) { throw new SerializationException(); } TickTime = _json["TickTime"]; }
{ if(!_json["TickWhenAdd"].IsNumber) { throw new SerializationException(); } TickWhenAdd = _json["TickWhenAdd"]; }
PostInit();
}
public BuffDotTickConfig(float TickTime, int TickWhenAdd )
{
this.TickTime = TickTime;
this.TickWhenAdd = TickWhenAdd;
PostInit();
}
public static BuffDotTickConfig DeserializeBuffDotTickConfig(JSONNode _json)
{
return new Battle.BuffDotTickConfig(_json);
}
public float TickTime { get; private set; }
public int TickWhenAdd { get; private set; }
public const int __ID__ = 2124630047;
public override int GetTypeId() => __ID__;
public void Resolve(Dictionary<string, object> _tables)
{
PostResolve();
}
public void TranslateText(System.Func<string, string, string> translator)
{
}
public override string ToString()
{
return "{ "
+ "TickTime:" + TickTime + ","
+ "TickWhenAdd:" + TickWhenAdd + ","
+ "}";
}
partial void PostInit();
partial void PostResolve();
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 3b87372c0c0ce0547bc2221f8f8cc7dc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,36 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace GameConfig.Battle
{
public enum BuffReplaceType
{
/// <summary>
/// 更新时间范围
/// </summary>
BUFF_REPLACE_INSTEAD = 0,
/// <summary>
/// 不允许叠加
/// </summary>
BUFF_REPLACE_FORBIT = 1,
/// <summary>
/// 累加时间范围
/// </summary>
BUFF_REPLACE_ADD_TIME = 2,
/// <summary>
/// 叠加数值
/// </summary>
BUFF_REPLACE_ADD_ATTR = 3,
/// <summary>
/// 叠加种类
/// </summary>
BUFF_REPLACE_TYPE_COUNT = 4,
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 6141f2c1272ed3848baf1f8d3341fc79
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,100 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace GameConfig.Battle
{
public enum BuffResultType
{
/// <summary>
/// 无
/// </summary>
BUFF_RESULT_NONE = 0,
/// <summary>
/// 物理攻击提升
/// </summary>
BUFF_RESULT_PHY_ATK_UP = 1,
/// <summary>
/// 物理攻击降低
/// </summary>
BUFF_RESULT_PHY_ATK_DOWN = 2,
/// <summary>
/// 物理防御提升
/// </summary>
BUFF_RESULT_PHY_DEF_UP = 3,
/// <summary>
/// 物理防御降低
/// </summary>
BUFF_RESULT_PHY_DEF_DOWN = 4,
/// <summary>
/// 物理命中提升
/// </summary>
BUFF_RESULT_PHY_HIT_UP = 5,
/// <summary>
/// 物理命中降低
/// </summary>
BUFF_RESULT_PHY_HIT_DOWN = 6,
/// <summary>
/// 物理持续掉血
/// </summary>
BUFF_RESULT_PHY_LOSE_HP = 7,
/// <summary>
/// 法术攻击提升
/// </summary>
BUFF_RESULT_MAG_ATK_UP = 8,
/// <summary>
/// 法术攻击降低
/// </summary>
BUFF_RESULT_MAG_ATK_DOWN = 9,
/// <summary>
/// 法术防御提升
/// </summary>
BUFF_RESULT_MAG_DEF_UP = 10,
/// <summary>
/// 法术防御降低
/// </summary>
BUFF_RESULT_MAG_DEF_DOWN = 11,
/// <summary>
/// 法术命中提升
/// </summary>
BUFF_RESULT_MAG_HIT_UP = 12,
/// <summary>
/// 法术命中降低
/// </summary>
BUFF_RESULT_MAG_HIT_DOWN = 13,
/// <summary>
/// 法术持续掉血
/// </summary>
BUFF_RESULT_MAG_LOSE_HP = 14,
/// <summary>
/// 暴击率提升
/// </summary>
BUFF_RESULT_CIRT_UP = 15,
/// <summary>
/// 暴击率降低
/// </summary>
BUFF_RESULT_CIRT_DOWN = 16,
/// <summary>
/// 暴击倍率提升
/// </summary>
BUFF_RESULT_CIRT_VALUE_UP = 17,
/// <summary>
/// 暴击倍率降低
/// </summary>
BUFF_RESULT_CIRT_VALUE_DOWN = 18,
/// <summary>
/// 移速提升
/// </summary>
BUFF_RESULT_MOVE_SPEED_UP = 19,
/// <summary>
/// 移速降低
/// </summary>
BUFF_RESULT_MOVE_SPEED_DOWN = 20,
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 2e26edcf2629cd142b51031f7b81f679
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,60 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace GameConfig.Battle
{
public enum BuffStateID
{
/// <summary>
/// 无状态
/// </summary>
BUFF_STATE_NONE = 0,
/// <summary>
/// 眩晕状态
/// </summary>
BUFF_STATE_STUN = 1,
/// <summary>
/// 无敌状态
/// </summary>
BUFF_STATE_UNDEAD = 2,
/// <summary>
/// 隐身状态
/// </summary>
BUFF_STATE_INVISIBLE = 3,
/// <summary>
/// 体形变大
/// </summary>
BUFF_STATE_BIGGER = 4,
/// <summary>
/// 定身,不能移动
/// </summary>
BUFF_STATE_NO_MOVE = 5,
/// <summary>
/// 沉默,不能放技能
/// </summary>
BUFF_STATE_NO_SKILL = 6,
/// <summary>
/// 昏睡
/// </summary>
BUFF_STATE_SLEEP = 7,
/// <summary>
/// 强制开启阻挡
/// </summary>
BUFF_STATE_FORCE_COLLIDER = 8,
/// <summary>
/// 无视阻挡
/// </summary>
BUFF_STATE_IGNORE_COLLIDER = 9,
/// <summary>
/// 最大状态
/// </summary>
BUFF_STATE_MAX = 10,
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 24a5cdf7ed62f5945aba3814ebf02ae8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,24 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace GameConfig.Battle
{
public enum BuffTimeType
{
/// <summary>
/// 指定持续时间
/// </summary>
BUFF_TIME_DURING = 0,
/// <summary>
/// 无尽时间
/// </summary>
BUFF_TIME_INFINIT = 1,
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: dff2bf6f031b38d4c8574d94e75d28d1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,64 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Bright.Serialization;
using System.Collections.Generic;
using SimpleJSON;
namespace GameConfig.Battle
{
public sealed partial class BuffTriggleState : Bright.Config.BeanBase
{
public BuffTriggleState(JSONNode _json)
{
{ if(!_json["StateID"].IsNumber) { throw new SerializationException(); } StateID = (Battle.BuffStateID)_json["StateID"].AsInt; }
{ if(!_json["StateParam"].IsNumber) { throw new SerializationException(); } StateParam = _json["StateParam"]; }
PostInit();
}
public BuffTriggleState(Battle.BuffStateID StateID, float StateParam )
{
this.StateID = StateID;
this.StateParam = StateParam;
PostInit();
}
public static BuffTriggleState DeserializeBuffTriggleState(JSONNode _json)
{
return new Battle.BuffTriggleState(_json);
}
public Battle.BuffStateID StateID { get; private set; }
public float StateParam { get; private set; }
public const int __ID__ = 1328146134;
public override int GetTypeId() => __ID__;
public void Resolve(Dictionary<string, object> _tables)
{
PostResolve();
}
public void TranslateText(System.Func<string, string, string> translator)
{
}
public override string ToString()
{
return "{ "
+ "StateID:" + StateID + ","
+ "StateParam:" + StateParam + ","
+ "}";
}
partial void PostInit();
partial void PostResolve();
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 03926dd0c4ff9dd479230386fd1e9190
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,68 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Bright.Serialization;
using System.Collections.Generic;
using SimpleJSON;
namespace GameConfig.Battle
{
public sealed partial class ResAttrImpactData : Bright.Config.BeanBase
{
public ResAttrImpactData(JSONNode _json)
{
{ if(!_json["DataType"].IsNumber) { throw new SerializationException(); } DataType = (Battle.ActorAttrDataType)_json["DataType"].AsInt; }
{ if(!_json["AddType"].IsNumber) { throw new SerializationException(); } AddType = (Battle.ActorAttrAddType)_json["AddType"].AsInt; }
{ if(!_json["Value"].IsNumber) { throw new SerializationException(); } Value = _json["Value"]; }
PostInit();
}
public ResAttrImpactData(Battle.ActorAttrDataType DataType, Battle.ActorAttrAddType AddType, float Value )
{
this.DataType = DataType;
this.AddType = AddType;
this.Value = Value;
PostInit();
}
public static ResAttrImpactData DeserializeResAttrImpactData(JSONNode _json)
{
return new Battle.ResAttrImpactData(_json);
}
public Battle.ActorAttrDataType DataType { get; private set; }
public Battle.ActorAttrAddType AddType { get; private set; }
public float Value { get; private set; }
public const int __ID__ = 1319292907;
public override int GetTypeId() => __ID__;
public void Resolve(Dictionary<string, object> _tables)
{
PostResolve();
}
public void TranslateText(System.Func<string, string, string> translator)
{
}
public override string ToString()
{
return "{ "
+ "DataType:" + DataType + ","
+ "AddType:" + AddType + ","
+ "Value:" + Value + ","
+ "}";
}
partial void PostInit();
partial void PostResolve();
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 9d3720a9d26e66047ad302fd1dc92da5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,80 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Bright.Serialization;
using System.Collections.Generic;
using SimpleJSON;
namespace GameConfig.Battle
{
public sealed partial class SkillAttrDamageData : Bright.Config.BeanBase
{
public SkillAttrDamageData(JSONNode _json)
{
{ if(!_json["MagicType"].IsNumber) { throw new SerializationException(); } MagicType = (Battle.SkillMagicType)_json["MagicType"].AsInt; }
{ if(!_json["AttrType"].IsNumber) { throw new SerializationException(); } AttrType = (Battle.SkillAttrDamageType)_json["AttrType"].AsInt; }
{ if(!_json["Param1"].IsNumber) { throw new SerializationException(); } Param1 = _json["Param1"]; }
{ if(!_json["Param2"].IsNumber) { throw new SerializationException(); } Param2 = _json["Param2"]; }
{ if(!_json["Param3"].IsNumber) { throw new SerializationException(); } Param3 = _json["Param3"]; }
{ if(!_json["MaxLimit"].IsNumber) { throw new SerializationException(); } MaxLimit = _json["MaxLimit"]; }
PostInit();
}
public SkillAttrDamageData(Battle.SkillMagicType MagicType, Battle.SkillAttrDamageType AttrType, float Param1, float Param2, float Param3, float MaxLimit )
{
this.MagicType = MagicType;
this.AttrType = AttrType;
this.Param1 = Param1;
this.Param2 = Param2;
this.Param3 = Param3;
this.MaxLimit = MaxLimit;
PostInit();
}
public static SkillAttrDamageData DeserializeSkillAttrDamageData(JSONNode _json)
{
return new Battle.SkillAttrDamageData(_json);
}
public Battle.SkillMagicType MagicType { get; private set; }
public Battle.SkillAttrDamageType AttrType { get; private set; }
public float Param1 { get; private set; }
public float Param2 { get; private set; }
public float Param3 { get; private set; }
public float MaxLimit { get; private set; }
public const int __ID__ = -94519547;
public override int GetTypeId() => __ID__;
public void Resolve(Dictionary<string, object> _tables)
{
PostResolve();
}
public void TranslateText(System.Func<string, string, string> translator)
{
}
public override string ToString()
{
return "{ "
+ "MagicType:" + MagicType + ","
+ "AttrType:" + AttrType + ","
+ "Param1:" + Param1 + ","
+ "Param2:" + Param2 + ","
+ "Param3:" + Param3 + ","
+ "MaxLimit:" + MaxLimit + ","
+ "}";
}
partial void PostInit();
partial void PostResolve();
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 485330d35ed83074e98aee4f9afebff7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,40 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace GameConfig.Battle
{
public enum SkillAttrDamageType
{
/// <summary>
/// 无数值
/// </summary>
ATTR_TYPE_NONE = 0,
/// <summary>
/// 按释放者的伤害类型*X%+固定值计算,目标有防御计算
/// </summary>
ATTR_TYPE_DMG_WEAPON = 1,
/// <summary>
/// 按释放者的伤害类型*X%+固定值计算(无视目标的防御)
/// </summary>
ATTR_TYPE_DMG_NO_DEFEND = 2,
/// <summary>
/// 按受击者的气血上限*X%+固定值计算(无视目标的防御)
/// </summary>
ATTR_TYPE_DMG_TARGET_HP_NO_DEFEND = 3,
/// <summary>
/// 按释放者的攻击类型*X%+固定值计算,恢复当前生命
/// </summary>
ATTR_TYPE_HP_AS_ATK = 4,
/// <summary>
/// 按受击者的HP上限*X%+固定值计算,恢复当前生命
/// </summary>
ATTR_TYPE_HP_RATIO = 5,
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a875b3c697d164841b02d808b103a384
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,132 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Bright.Serialization;
using System.Collections.Generic;
using SimpleJSON;
namespace GameConfig.Battle
{
public sealed partial class SkillBaseConfig : Bright.Config.BeanBase
{
public SkillBaseConfig(JSONNode _json)
{
{ if(!_json["id"].IsNumber) { throw new SerializationException(); } Id = _json["id"]; }
{ if(!_json["name"].IsString) { throw new SerializationException(); } Name = _json["name"]; }
{ if(!_json["SkillDispID"].IsNumber) { throw new SerializationException(); } SkillDispID = _json["SkillDispID"]; }
{ if(!_json["SkillType"].IsNumber) { throw new SerializationException(); } SkillType = _json["SkillType"]; }
{ if(!_json["desc"].IsString) { throw new SerializationException(); } Desc = _json["desc"]; }
{ if(!_json["CostMP"].IsNumber) { throw new SerializationException(); } CostMP = _json["CostMP"]; }
{ if(!_json["GCDID"].IsNumber) { throw new SerializationException(); } GCDID = _json["GCDID"]; }
{ if(!_json["SkillCD"].IsNumber) { throw new SerializationException(); } SkillCD = _json["SkillCD"]; }
{ if(!_json["IsRepeatTrigger"].IsBoolean) { throw new SerializationException(); } IsRepeatTrigger = _json["IsRepeatTrigger"]; }
{ var __json0 = _json["BuffID"]; if(!__json0.IsArray) { throw new SerializationException(); } BuffID = new System.Collections.Generic.List<int>(__json0.Count); foreach(JSONNode __e0 in __json0.Children) { int __v0; { if(!__e0.IsNumber) { throw new SerializationException(); } __v0 = __e0; } BuffID.Add(__v0); } }
{ var __json0 = _json["AttrDamageData"]; if(!__json0.IsArray) { throw new SerializationException(); } AttrDamageData = new System.Collections.Generic.List<Battle.SkillAttrDamageData>(__json0.Count); foreach(JSONNode __e0 in __json0.Children) { Battle.SkillAttrDamageData __v0; { if(!__e0.IsObject) { throw new SerializationException(); } __v0 = Battle.SkillAttrDamageData.DeserializeSkillAttrDamageData(__e0); } AttrDamageData.Add(__v0); } }
PostInit();
}
public SkillBaseConfig(int id, string name, int SkillDispID, int SkillType, string desc, int CostMP, int GCDID, float SkillCD, bool IsRepeatTrigger, System.Collections.Generic.List<int> BuffID, System.Collections.Generic.List<Battle.SkillAttrDamageData> AttrDamageData )
{
this.Id = id;
this.Name = name;
this.SkillDispID = SkillDispID;
this.SkillType = SkillType;
this.Desc = desc;
this.CostMP = CostMP;
this.GCDID = GCDID;
this.SkillCD = SkillCD;
this.IsRepeatTrigger = IsRepeatTrigger;
this.BuffID = BuffID;
this.AttrDamageData = AttrDamageData;
PostInit();
}
public static SkillBaseConfig DeserializeSkillBaseConfig(JSONNode _json)
{
return new Battle.SkillBaseConfig(_json);
}
/// <summary>
/// 技能ID
/// </summary>
public int Id { get; private set; }
/// <summary>
/// 名字
/// </summary>
public string Name { get; private set; }
/// <summary>
/// 表现ID
/// </summary>
public int SkillDispID { get; private set; }
/// <summary>
/// 技能类型SkillType
/// </summary>
public int SkillType { get; private set; }
/// <summary>
/// 描述
/// </summary>
public string Desc { get; private set; }
/// <summary>
/// 消耗MP
/// </summary>
public int CostMP { get; private set; }
/// <summary>
/// 所属公CD组ID
/// </summary>
public int GCDID { get; private set; }
/// <summary>
/// 技能CD
/// </summary>
public float SkillCD { get; private set; }
/// <summary>
/// 是否重复触发
/// </summary>
public bool IsRepeatTrigger { get; private set; }
/// <summary>
/// BuffIDList
/// </summary>
public System.Collections.Generic.List<int> BuffID { get; private set; }
public System.Collections.Generic.List<Battle.SkillAttrDamageData> AttrDamageData { get; private set; }
public const int __ID__ = 2067672430;
public override int GetTypeId() => __ID__;
public void Resolve(Dictionary<string, object> _tables)
{
foreach(var _e in AttrDamageData) { _e?.Resolve(_tables); }
PostResolve();
}
public void TranslateText(System.Func<string, string, string> translator)
{
foreach(var _e in AttrDamageData) { _e?.TranslateText(translator); }
}
public override string ToString()
{
return "{ "
+ "Id:" + Id + ","
+ "Name:" + Name + ","
+ "SkillDispID:" + SkillDispID + ","
+ "SkillType:" + SkillType + ","
+ "Desc:" + Desc + ","
+ "CostMP:" + CostMP + ","
+ "GCDID:" + GCDID + ","
+ "SkillCD:" + SkillCD + ","
+ "IsRepeatTrigger:" + IsRepeatTrigger + ","
+ "BuffID:" + Bright.Common.StringUtil.CollectionToString(BuffID) + ","
+ "AttrDamageData:" + Bright.Common.StringUtil.CollectionToString(AttrDamageData) + ","
+ "}";
}
partial void PostInit();
partial void PostResolve();
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: b651cf87b4372cf4a8894a9421a6dcff
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,28 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace GameConfig.Battle
{
public enum SkillMagicType
{
/// <summary>
/// 无类型
/// </summary>
SKILL_TYPE_NONE = 0,
/// <summary>
/// 物理伤害属性
/// </summary>
SKILL_TYPE_DMG_PHY = 1,
/// <summary>
/// 魔法伤害属性
/// </summary>
SKILL_TYPE_DMG_MAGIC = 2,
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 050deaa6f717a36428b057b5c1f889b2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,65 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Bright.Serialization;
using System.Collections.Generic;
using SimpleJSON;
namespace GameConfig.Battle
{
public sealed partial class TbBuff
{
private readonly Dictionary<int, Battle.BuffConfig> _dataMap;
private readonly List<Battle.BuffConfig> _dataList;
public TbBuff(JSONNode _json)
{
_dataMap = new Dictionary<int, Battle.BuffConfig>();
_dataList = new List<Battle.BuffConfig>();
foreach(JSONNode _row in _json.Children)
{
var _v = Battle.BuffConfig.DeserializeBuffConfig(_row);
_dataList.Add(_v);
_dataMap.Add(_v.BuffID, _v);
}
PostInit();
}
public Dictionary<int, Battle.BuffConfig> DataMap => _dataMap;
public List<Battle.BuffConfig> DataList => _dataList;
public Battle.BuffConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public Battle.BuffConfig Get(int key) => _dataMap[key];
public Battle.BuffConfig this[int key] => _dataMap[key];
public void Resolve(Dictionary<string, object> _tables)
{
foreach(var v in _dataList)
{
v.Resolve(_tables);
}
PostResolve();
}
public void TranslateText(System.Func<string, string, string> translator)
{
foreach(var v in _dataList)
{
v.TranslateText(translator);
}
}
partial void PostInit();
partial void PostResolve();
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 4bae3a42b1e627f44b53f42fa8835064
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show More