规范命名空间

具体来说就是 SepCore 开头,然后接所属的模块名,比如 SepCore.Entity,SepCore.Simulation,SepCore.Procedure
This commit is contained in:
SepComet
2026-06-03 16:57:40 +08:00
parent 5de3fdc795
commit edd7088804
210 changed files with 461 additions and 547 deletions
@@ -1,7 +1,10 @@
using CustomComponent;
using SepCore.CustomComponent;
using Simulation;
using UnityEngine;
using SepCore.BuiltinData;
using SepCore.DamageText;
using SepCore.EnemyManager;
using SepCore.HPBar;
using SepCore.SpriteCache;
using SepCore.UIRouter;
using SepCore.Simulation;
/// <summary>
/// 游戏入口。
@@ -3,7 +3,7 @@ using System.Threading;
using Cysharp.Threading.Tasks;
using GameFramework.Event;
namespace UnityGameFramework.Runtime.AsyncTask
namespace SepCore.AsyncTask
{
/// <summary>
/// 异步任务辅助类,用于将事件回调转换为 UniTask
@@ -124,4 +124,4 @@ namespace UnityGameFramework.Runtime.AsyncTask
return tcs.Task;
}
}
}
}
@@ -1,10 +1,7 @@
using System;
using Cysharp.Threading.Tasks;
using GameFramework;
using GameFramework.Config;
using UnityGameFramework.Runtime;
namespace UnityGameFramework.Runtime.AsyncTask
namespace SepCore.AsyncTask
{
/// <summary>
/// Config 异步扩展方法
@@ -5,7 +5,7 @@ using GameFramework.DataTable;
using SepCore.DataTable;
using UnityGameFramework.Runtime;
namespace UnityGameFramework.Runtime.AsyncTask
namespace SepCore.AsyncTask
{
/// <summary>
/// DataTable 异步扩展方法
@@ -1,10 +1,9 @@
using System;
using Cysharp.Threading.Tasks;
using GameFramework;
using GameFramework.Download;
using UnityGameFramework.Runtime;
using DownloadFailureEventArgs = UnityGameFramework.Runtime.DownloadFailureEventArgs;
using DownloadSuccessEventArgs = UnityGameFramework.Runtime.DownloadSuccessEventArgs;
namespace UnityGameFramework.Runtime.AsyncTask
namespace SepCore.AsyncTask
{
/// <summary>
/// Download 异步扩展方法
@@ -1,10 +1,11 @@
using System;
using Cysharp.Threading.Tasks;
using GameFramework;
using GameFramework.Entity;
using UnityGameFramework.Runtime;
using HideEntityCompleteEventArgs = UnityGameFramework.Runtime.HideEntityCompleteEventArgs;
using ShowEntityFailureEventArgs = UnityGameFramework.Runtime.ShowEntityFailureEventArgs;
using ShowEntitySuccessEventArgs = UnityGameFramework.Runtime.ShowEntitySuccessEventArgs;
namespace UnityGameFramework.Runtime.AsyncTask
namespace SepCore.AsyncTask
{
/// <summary>
/// Entity 异步扩展方法
@@ -22,7 +23,7 @@ namespace UnityGameFramework.Runtime.AsyncTask
/// <param name="userData">用户自定义数据</param>
/// <param name="timeout">超时时间(秒),0表示不超时</param>
/// <returns>显示的实体</returns>
public static UniTask<Entity> ShowEntityAsync(this EntityComponent entityComponent,
public static UniTask<UnityGameFramework.Runtime.Entity> ShowEntityAsync(this EntityComponent entityComponent,
int entityId,
Type entityLogicType,
string entityAssetName,
@@ -30,7 +31,7 @@ namespace UnityGameFramework.Runtime.AsyncTask
object userData = null,
float timeout = 30f)
{
UniTask<Entity> waitTask = AsyncTaskHelper.WaitSuccessOrFailureAsync<ShowEntitySuccessEventArgs, ShowEntityFailureEventArgs>(
UniTask<UnityGameFramework.Runtime.Entity> waitTask = AsyncTaskHelper.WaitSuccessOrFailureAsync<ShowEntitySuccessEventArgs, ShowEntityFailureEventArgs>(
ShowEntitySuccessEventArgs.EventId,
ShowEntityFailureEventArgs.EventId,
successArgs => successArgs.Entity.Id == entityId && ReferenceEquals(successArgs.UserData, userData),
@@ -104,7 +105,7 @@ namespace UnityGameFramework.Runtime.AsyncTask
/// <param name="timeout">超时时间(秒),0表示不超时</param>
/// <returns>隐藏完成事件</returns>
public static UniTask<HideEntityCompleteEventArgs> HideEntityAsync(this EntityComponent entityComponent,
Entity entity,
UnityGameFramework.Runtime.Entity entity,
object userData = null,
float timeout = 30f)
{
@@ -4,7 +4,7 @@ using GameFramework;
using GameFramework.Localization;
using UnityGameFramework.Runtime;
namespace UnityGameFramework.Runtime.AsyncTask
namespace SepCore.AsyncTask
{
/// <summary>
/// Localization 异步扩展方法
@@ -1,10 +1,9 @@
using System;
using Cysharp.Threading.Tasks;
using GameFramework;
using GameFramework.Network;
using UnityGameFramework.Runtime;
using NetworkClosedEventArgs = UnityGameFramework.Runtime.NetworkClosedEventArgs;
using NetworkConnectedEventArgs = UnityGameFramework.Runtime.NetworkConnectedEventArgs;
namespace UnityGameFramework.Runtime.AsyncTask
namespace SepCore.AsyncTask
{
/// <summary>
/// Network 异步扩展方法
@@ -73,4 +72,4 @@ namespace UnityGameFramework.Runtime.AsyncTask
);
}
}
}
}
@@ -1,10 +1,10 @@
using System;
using Cysharp.Threading.Tasks;
using GameFramework;
using GameFramework.Resource;
using UnityGameFramework.Runtime;
using ResourceApplySuccessEventArgs = UnityGameFramework.Runtime.ResourceApplySuccessEventArgs;
using ResourceUpdateAllCompleteEventArgs = UnityGameFramework.Runtime.ResourceUpdateAllCompleteEventArgs;
using ResourceVerifySuccessEventArgs = UnityGameFramework.Runtime.ResourceVerifySuccessEventArgs;
namespace UnityGameFramework.Runtime.AsyncTask
namespace SepCore.AsyncTask
{
/// <summary>
/// Resource 异步扩展方法
@@ -59,4 +59,4 @@ namespace UnityGameFramework.Runtime.AsyncTask
);
}
}
}
}
@@ -1,10 +1,11 @@
using System;
using Cysharp.Threading.Tasks;
using GameFramework;
using GameFramework.Scene;
using UnityGameFramework.Runtime;
using LoadSceneFailureEventArgs = UnityGameFramework.Runtime.LoadSceneFailureEventArgs;
using LoadSceneSuccessEventArgs = UnityGameFramework.Runtime.LoadSceneSuccessEventArgs;
using UnloadSceneFailureEventArgs = UnityGameFramework.Runtime.UnloadSceneFailureEventArgs;
using UnloadSceneSuccessEventArgs = UnityGameFramework.Runtime.UnloadSceneSuccessEventArgs;
namespace UnityGameFramework.Runtime.AsyncTask
namespace SepCore.AsyncTask
{
/// <summary>
/// Scene 异步扩展方法
@@ -1,10 +1,10 @@
using System;
using Cysharp.Threading.Tasks;
using GameFramework;
using GameFramework.Sound;
using UnityGameFramework.Runtime;
using PlaySoundFailureEventArgs = UnityGameFramework.Runtime.PlaySoundFailureEventArgs;
using PlaySoundSuccessEventArgs = UnityGameFramework.Runtime.PlaySoundSuccessEventArgs;
namespace UnityGameFramework.Runtime.AsyncTask
namespace SepCore.AsyncTask
{
/// <summary>
/// Sound 异步扩展方法
@@ -29,17 +29,17 @@ namespace UnityGameFramework.Runtime.AsyncTask
float timeout = 30f)
{
int serialId = 0;
UniTask<PlaySoundSuccessEventArgs> waitTask = AsyncTaskHelper.WaitSuccessOrFailureAsync<PlaySoundSuccessEventArgs, PlaySoundFailureEventArgs>(
PlaySoundSuccessEventArgs.EventId,
PlaySoundFailureEventArgs.EventId,
successArgs => successArgs.SerialId == serialId,
failureArgs => failureArgs.SerialId == serialId,
timeout
);
UniTask<PlaySoundSuccessEventArgs> waitTask =
AsyncTaskHelper.WaitSuccessOrFailureAsync<PlaySoundSuccessEventArgs, PlaySoundFailureEventArgs>(
PlaySoundSuccessEventArgs.EventId,
PlaySoundFailureEventArgs.EventId,
successArgs => successArgs.SerialId == serialId,
failureArgs => failureArgs.SerialId == serialId,
timeout
);
serialId = soundComponent.PlaySound(soundAssetName, soundGroupName, 0, playSoundParams, userData);
return waitTask;
}
}
}
@@ -3,7 +3,7 @@ using SepCore.Definition;
using SepCore.UI;
using UnityGameFramework.Runtime;
namespace UnityGameFramework.Runtime.AsyncTask
namespace SepCore.AsyncTask
{
/// <summary>
/// UI 异步扩展方法
@@ -1,10 +1,7 @@
using System;
using Cysharp.Threading.Tasks;
using GameFramework;
using GameFramework.WebRequest;
using UnityGameFramework.Runtime;
namespace UnityGameFramework.Runtime.AsyncTask
namespace SepCore.AsyncTask
{
/// <summary>
/// WebRequest 异步扩展方法
@@ -1,18 +1,18 @@
using System;
using System.Collections.Generic;
using SepCore.Definition;
using Entity.EntityData;
using SepCore.Entity;
using UnityGameFramework.Runtime;
using SepCore.DataTable;
using CustomUtility;
using SepCore.CustomUtility;
namespace Entity
namespace SepCore.Entity
{
public static class EntityExtension
{
private static int s_SerialId = -10;
private const string EntityNamespace = "Entity.";
private const string EntityNamespace = "SepCore.Entity.";
private static readonly Dictionary<string, Type> _typeDict;
private static readonly Dictionary<int, string> _assetNameDict;
@@ -180,9 +180,9 @@ namespace Entity
return assetName;
}
public static int GenerateSerialId(this EntityComponent entityComponent)
public static int NextId(this EntityComponent entityComponent)
{
return --s_SerialId;
}
}
}
}
@@ -1,16 +1,9 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using GameFramework.Localization;
using GameFramework.Localization;
using System;
using System.Xml;
using UnityGameFramework.Runtime;
namespace StarForce
namespace SepCore.Localization
{
/// <summary>
/// XML 格式的本地化辅助器。
@@ -5,7 +5,7 @@
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
namespace StarForce
namespace SepCore.Network
{
public abstract class CSPacketBase : PacketBase
{
@@ -5,7 +5,7 @@
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
namespace StarForce
namespace SepCore.Network
{
public sealed class CSPacketHeader : PacketHeaderBase
{
@@ -16,7 +16,7 @@ using System.IO;
using System.Reflection;
using UnityGameFramework.Runtime;
namespace StarForce
namespace SepCore.Network
{
public class NetworkChannelHelper : INetworkChannelHelper
{
@@ -8,7 +8,7 @@
using ProtoBuf;
using System;
namespace StarForce
namespace SepCore.Network
{
[Serializable, ProtoContract(Name = @"CSHeartBeat")]
public class CSHeartBeat : CSPacketBase
@@ -8,7 +8,7 @@
using ProtoBuf;
using System;
namespace StarForce
namespace SepCore.Network
{
[Serializable, ProtoContract(Name = @"SCHeartBeat")]
public class SCHeartBeat : SCPacketBase
@@ -8,7 +8,7 @@
using GameFramework.Network;
using ProtoBuf;
namespace StarForce
namespace SepCore.Network
{
public abstract class PacketBase : Packet, IExtensible
{
@@ -8,7 +8,7 @@
using GameFramework.Network;
using UnityGameFramework.Runtime;
namespace StarForce
namespace SepCore.Network
{
public class SCHeartBeatHandler : PacketHandlerBase
{
@@ -7,7 +7,7 @@
using GameFramework.Network;
namespace StarForce
namespace SepCore.Network
{
public abstract class PacketHandlerBase : IPacketHandler
{
@@ -8,7 +8,7 @@
using GameFramework;
using GameFramework.Network;
namespace StarForce
namespace SepCore.Network
{
public abstract class PacketHeaderBase : IPacketHeader, IReference
{
@@ -5,7 +5,7 @@
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
namespace StarForce
namespace SepCore.Network
{
public enum PacketType : byte
{
@@ -5,7 +5,7 @@
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
namespace StarForce
namespace SepCore.Network
{
public abstract class SCPacketBase : PacketBase
{
@@ -5,7 +5,7 @@
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
namespace StarForce
namespace SepCore.Network
{
public sealed class SCPacketHeader : PacketHeaderBase
{
@@ -1,20 +1,13 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using GameFramework;
using SepCore.DataTable;
using SepCore.Definition;
using Entity;
using GameFramework;
using SepCore.Entity;
using GameFramework.DataTable;
using GameFramework.Sound;
using UnityGameFramework.Runtime;
using CustomUtility;
using SepCore.CustomUtility;
namespace StarForce
namespace SepCore.Sound
{
public static class SoundExtension
{
@@ -2,7 +2,7 @@
using GameFramework.UI;
using SepCore.DataTable;
using SepCore.Definition;
using CustomUtility;
using SepCore.CustomUtility;
using UnityGameFramework.Runtime;
namespace SepCore.UI
@@ -1,9 +1,9 @@
using System;
using SepCore.Definition;
using Entity;
using SepCore.Entity;
using UnityEngine;
namespace Components
namespace SepCore.Components
{
public class AbsorbComponent : MonoBehaviour
{
@@ -1,10 +1,10 @@
using System.Collections;
using System.Collections.Generic;
using Entity;
using Entity.Weapon;
using SepCore.Entity;
using SepCore.Entity.Weapon;
using UnityEngine;
namespace Components
namespace SepCore.Components
{
public class AttackComponent : MonoBehaviour
{
@@ -1,10 +1,10 @@
using System.Collections.Generic;
using SepCore.Definition;
using Entity.Weapon;
using Entity;
using SepCore.Entity.Weapon;
using SepCore.Entity;
using UnityEngine;
namespace Components
namespace SepCore.Components
{
public class BackpackComponent : MonoBehaviour
{
@@ -3,7 +3,7 @@ using SepCore.Event;
using SepCore.Definition;
using UnityEngine;
namespace Components
namespace SepCore.Components
{
public class HealthComponent : MonoBehaviour
{
@@ -1,6 +1,6 @@
using UnityEngine;
namespace Components
namespace SepCore.Components
{
public class InputComponent : MonoBehaviour
{
@@ -1,11 +1,11 @@
using System;
using SepCore.Definition;
using Entity;
using Simulation;
using SepCore.Entity;
using SepCore.Simulation;
using UnityEngine;
using CustomDebugger;
using SepCore.Debugger;
namespace Components
namespace SepCore.Components
{
public class MovementComponent : MonoBehaviour
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using SepCore.Definition;
using UnityEngine;
namespace Components
namespace SepCore.Components
{
public class StatComponent : MonoBehaviour
{
@@ -1,34 +1,21 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using GameFramework;
using SepCore.Definition;
using GameFramework;
using StarForce;
using SepCore.UI;
using UnityEngine;
using UnityEngine.Serialization;
using UnityGameFramework.Runtime;
namespace CustomComponent
namespace SepCore.BuiltinData
{
public class BuiltinDataComponent : GameFrameworkComponent
{
[FormerlySerializedAs("m_BuildInfoTextAsset")] [SerializeField]
private TextAsset _buildInfoTextAsset = null;
[SerializeField] private TextAsset _buildInfoTextAsset = null;
[FormerlySerializedAs("m_DefaultDictionaryTextAsset")] [SerializeField]
private TextAsset _defaultDictionaryTextAsset = null;
[SerializeField] private TextAsset _defaultDictionaryTextAsset = null;
[FormerlySerializedAs("m_UpdateResourceFormTemplate")] [SerializeField]
private GameObject _updateResourceFormTemplate = null;
[SerializeField] private GameObject _updateResourceFormTemplate = null;
private BuildInfo m_BuildInfo = null;
private BuildInfo _buildInfo = null;
public BuildInfo BuildInfo => m_BuildInfo;
public BuildInfo BuildInfo => _buildInfo;
public GameObject UpdateResourceFormTemplate => _updateResourceFormTemplate;
@@ -40,8 +27,8 @@ namespace CustomComponent
return;
}
m_BuildInfo = Utility.Json.ToObject<BuildInfo>(_buildInfoTextAsset.text);
if (m_BuildInfo == null)
_buildInfo = Utility.Json.ToObject<BuildInfo>(_buildInfoTextAsset.text);
if (_buildInfo == null)
{
Log.Warning("Parse build info failure.");
return;
@@ -3,7 +3,7 @@ using GameFramework.ObjectPool;
using UnityEngine;
using UnityGameFramework.Runtime;
namespace CustomComponent
namespace SepCore.DamageText
{
public class DamageTextComponent : GameFrameworkComponent
{
@@ -3,7 +3,7 @@ using DG.Tweening;
using TMPro;
using UnityEngine;
namespace CustomComponent
namespace SepCore.DamageText
{
public class DamageTextItem : MonoBehaviour
{
@@ -77,4 +77,4 @@ namespace CustomComponent
_sequence = null;
}
}
}
}
@@ -2,7 +2,7 @@ using GameFramework;
using GameFramework.ObjectPool;
using UnityEngine;
namespace CustomComponent
namespace SepCore.DamageText
{
public class DamageTextItemObject : ObjectBase
{
@@ -1,15 +1,14 @@
using System.Collections.Generic;
using SepCore.DataTable;
using SepCore.Definition;
using Entity;
using Entity.EntityData;
using SepCore.Entity;
using GameFramework.Event;
using SepCore.Utility;
using SepCore.CustomUtility;
using UnityEngine;
using UnityGameFramework.Runtime;
using Random = UnityEngine.Random;
namespace CustomComponent
namespace SepCore.EnemyManager
{
public class EnemyManagerComponent : GameFrameworkComponent
{
@@ -1,11 +1,10 @@
using GameFramework.ObjectPool;
using System.Collections.Generic;
using Entity;
using StarForce;
using SepCore.Entity;
using UnityEngine;
using UnityGameFramework.Runtime;
namespace CustomComponent
namespace SepCore.HPBar
{
public class HPBarComponent : GameFrameworkComponent
{
@@ -1,12 +1,12 @@
using System.Collections;
using Entity;
using SepCore.Entity;
using SepCore.UI;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UI;
using UnityGameFramework.Runtime;
namespace StarForce
namespace SepCore.HPBar
{
public class HPBarItem : MonoBehaviour
{
@@ -1,15 +1,8 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using GameFramework;
using GameFramework;
using GameFramework.ObjectPool;
using UnityEngine;
namespace StarForce
namespace SepCore.HPBar
{
public class HPBarItemObject : ObjectBase
{
@@ -1,7 +1,7 @@
using Unity.Mathematics;
using UnityEngine;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,6 +1,6 @@
using Unity.Mathematics;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Unity.Collections;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,7 +1,7 @@
using Unity.Mathematics;
using UnityEngine;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -2,7 +2,7 @@ using System;
using Unity.Collections;
using Unity.Mathematics;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,6 +1,6 @@
using UnityEngine;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace Simulation
namespace SepCore.Simulation
{
public sealed class EntityBinding
{
@@ -1,4 +1,4 @@
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,6 +1,6 @@
using UnityEngine;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -3,7 +3,7 @@ using Unity.Collections;
using Unity.Jobs;
using Unity.Mathematics;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,4 +1,4 @@
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,6 +1,6 @@
using Unity.Mathematics;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,6 +1,6 @@
using Unity.Mathematics;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,6 +1,6 @@
using Unity.Mathematics;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -3,7 +3,7 @@ using Unity.Collections;
using Unity.Jobs;
using Unity.Mathematics;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -3,7 +3,7 @@ using Unity.Collections;
using Unity.Jobs;
using Unity.Mathematics;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,6 +1,6 @@
using Unity.Mathematics;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,6 +1,6 @@
using Unity.Mathematics;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -3,7 +3,7 @@ using Unity.Collections;
using Unity.Jobs;
using Unity.Mathematics;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -3,7 +3,7 @@ using Unity.Collections;
using Unity.Jobs;
using Unity.Mathematics;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,12 +1,12 @@
using CustomDebugger;
using Entity;
using SepCore.Debugger;
using SepCore.Entity;
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;
using Unity.Mathematics;
using UnityEngine;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,4 +1,4 @@
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,10 +1,10 @@
using SepCore.Event;
using SepCore.Definition;
using Entity;
using Entity.Weapon;
using SepCore.Entity;
using SepCore.Entity.Weapon;
using UnityEngine;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,8 +1,8 @@
using Entity;
using Entity.Weapon;
using SepCore.Entity;
using SepCore.Entity.Weapon;
using UnityEngine;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,11 +1,11 @@
using Components;
using CustomDebugger;
using CustomUtility;
using SepCore.Components;
using SepCore.Debugger;
using SepCore.CustomUtility;
using SepCore.Definition;
using Entity;
using SepCore.Entity;
using UnityEngine;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,10 +1,10 @@
using CustomDebugger;
using SepCore.Debugger;
using Unity.Collections;
using Unity.Jobs;
using Unity.Mathematics;
using UnityEngine;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -3,7 +3,7 @@ using Unity.Jobs;
using Unity.Mathematics;
using UnityEngine;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,11 +1,10 @@
using SepCore.Event;
using Entity;
using Entity.EntityData;
using Entity.Weapon;
using SepCore.Entity;
using SepCore.Entity.Weapon;
using GameFramework.Event;
using UnityEngine;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -124,7 +123,7 @@ namespace Simulation
return;
}
EffectData effectData = new EffectData(entityComponent.GenerateSerialId(), effectTypeId)
EffectData effectData = new EffectData(entityComponent.NextId(), effectTypeId)
{
Position = args.HitPosition
};
@@ -1,6 +1,6 @@
using UnityEngine;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,7 +1,7 @@
using Entity;
using SepCore.Entity;
using UnityEngine;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,6 +1,6 @@
using UnityEngine;
namespace Simulation
namespace SepCore.Simulation
{
public struct EnemySimData
{
@@ -1,6 +1,6 @@
using UnityEngine;
namespace Simulation
namespace SepCore.Simulation
{
public struct PickupSimData
{
@@ -1,6 +1,6 @@
using UnityEngine;
namespace Simulation
namespace SepCore.Simulation
{
public struct ProjectileSimData
{
@@ -1,6 +1,6 @@
using UnityEngine;
namespace Simulation
namespace SepCore.Simulation
{
public readonly struct SimulationTickContext
{
@@ -1,8 +1,8 @@
using Entity;
using SepCore.Entity;
using GameFramework.Event;
using UnityGameFramework.Runtime;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,9 +1,8 @@
using Components;
using Entity;
using Entity.EntityData;
using SepCore.Components;
using SepCore.Entity;
using UnityEngine;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,6 +1,6 @@
using UnityEngine;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -5,7 +5,7 @@ using Unity.Jobs;
using Unity.Mathematics;
using UnityEngine;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,7 +1,6 @@
using Entity;
using Entity.EntityData;
using SepCore.Entity;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,8 +1,8 @@
using CustomDebugger;
using SepCore.Debugger;
using Unity.Collections;
using UnityEngine;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld
{
@@ -1,9 +1,9 @@
using System.Collections.Generic;
using CustomDebugger;
using SepCore.Debugger;
using UnityEngine;
using UnityGameFramework.Runtime;
namespace Simulation
namespace SepCore.Simulation
{
public sealed partial class SimulationWorld : GameFrameworkComponent
{
@@ -2,68 +2,71 @@ using System;
using System.Collections.Generic;
using SepCore.Definition;
using GameFramework.Resource;
using CustomUtility;
using SepCore.CustomUtility;
using UnityEngine;
using UnityGameFramework.Runtime;
public class SpriteCacheComponent : GameFrameworkComponent
namespace SepCore.SpriteCache
{
[SerializeField] private float _pixelsPerUnit = 100f;
[SerializeField] private Vector2 _defaultPivot = new(0.5f, 0.5f);
private Dictionary<string, Sprite> _spriteCache;
private ResourceComponent _resource;
void Start()
public class SpriteCacheComponent : GameFrameworkComponent
{
_spriteCache = new Dictionary<string, Sprite>();
_resource = GameEntry.Resource;
}
[SerializeField] private float _pixelsPerUnit = 100f;
[SerializeField] private Vector2 _defaultPivot = new(0.5f, 0.5f);
public void GetSprite(string assetName, Action<Sprite> callback)
{
if (_spriteCache.TryGetValue(assetName, out var sprite))
private Dictionary<string, Sprite> _spriteCache;
private ResourceComponent _resource;
void Start()
{
callback?.Invoke(sprite);
return;
_spriteCache = new Dictionary<string, Sprite>();
_resource = GameEntry.Resource;
}
else
public void GetSprite(string assetName, Action<Sprite> callback)
{
_resource.LoadAsset
(
AssetUtility.GetUITextureIconAsset(assetName),
Constant.AssetPriority.UIFormAsset,
new LoadAssetCallbacks(
(resourcePath, asset, duration, userData) =>
{
Log.Debug(resourcePath);
Texture2D texture = asset as Texture2D;
if (texture != null)
if (_spriteCache.TryGetValue(assetName, out var sprite))
{
callback?.Invoke(sprite);
return;
}
else
{
_resource.LoadAsset
(
AssetUtility.GetUITextureIconAsset(assetName),
Constant.AssetPriority.UIFormAsset,
new LoadAssetCallbacks(
(resourcePath, asset, duration, userData) =>
{
Sprite newSprite = Sprite.Create(
texture,
new Rect(0, 0, texture.width, texture.height),
_defaultPivot,
_pixelsPerUnit);
_spriteCache.TryAdd(assetName, newSprite);
callback?.Invoke(newSprite);
Log.Debug(resourcePath);
Texture2D texture = asset as Texture2D;
if (texture != null)
{
Sprite newSprite = Sprite.Create(
texture,
new Rect(0, 0, texture.width, texture.height),
_defaultPivot,
_pixelsPerUnit);
_spriteCache.TryAdd(assetName, newSprite);
callback?.Invoke(newSprite);
}
},
(resourcePath, status, errorMessage, userData) =>
{
Log.Error("Can not load icon '{0}' from '{1}' with error message '{2}'.",
assetName,
resourcePath,
errorMessage);
}
},
(resourcePath, status, errorMessage, userData) =>
{
Log.Error("Can not load icon '{0}' from '{1}' with error message '{2}'.",
assetName,
resourcePath,
errorMessage);
}
)
);
)
);
}
}
private void OnDestroy()
{
_spriteCache.Clear();
_resource = null;
}
}
private void OnDestroy()
{
_spriteCache.Clear();
_resource = null;
}
}
}
@@ -6,7 +6,7 @@ using SepCore.UI;
using UnityEngine;
using UnityGameFramework.Runtime;
namespace SepCore.CustomComponent
namespace SepCore.UIRouter
{
public class UIRouterComponent : GameFrameworkComponent
{
@@ -1,6 +1,6 @@
using Unity.Profiling;
namespace CustomDebugger
namespace SepCore.Debugger
{
public static class CustomProfilerMarker
{
@@ -1,8 +1,8 @@
using Entity.EntityData;
using SepCore.Entity;
using UnityEngine;
using UnityGameFramework.Runtime;
namespace Entity
namespace SepCore.Entity
{
public class CoinEntity : EntityBase
{
@@ -1,16 +1,7 @@
//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using Entity;
using Entity.EntityData;
using UnityEngine;
using UnityEngine;
using UnityGameFramework.Runtime;
namespace Entity
namespace SepCore.Entity
{
/// <summary>
/// 特效类。
@@ -1,5 +1,5 @@
using SepCore.Definition;
using Entity;
using SepCore.Entity;
using UnityEngine;
public abstract class EnemyBase : TargetableObject
@@ -1,9 +1,9 @@
using SepCore.Definition;
using Entity.EntityData;
using SepCore.Entity;
using UnityEngine;
using UnityGameFramework.Runtime;
namespace Entity
namespace SepCore.Entity
{
public class EnemyProjectile : EntityBase
{
@@ -1,11 +1,11 @@
using Components;
using CustomUtility;
using SepCore.Components;
using SepCore.CustomUtility;
using SepCore.Definition;
using Entity.EntityData;
using SepCore.Entity;
using UnityEngine;
using UnityGameFramework.Runtime;
namespace Entity
namespace SepCore.Entity
{
public class MeleeEnemy : EnemyBase
{
@@ -87,7 +87,7 @@ namespace Entity
{
if (Random.value < _meleeEnemyData.DropPercent)
{
var data = new CoinData(_meleeEnemyData.DropCoin, GameEntry.Entity.GenerateSerialId(), 10001)
var data = new CoinData(_meleeEnemyData.DropCoin, GameEntry.Entity.NextId(), 10001)
{
Position = this.CachedTransform.position
};
@@ -96,7 +96,7 @@ namespace Entity
if (Random.value < _meleeEnemyData.DropPercent)
{
var data = new ExpData(_meleeEnemyData.DropExp, GameEntry.Entity.GenerateSerialId(), 10002)
var data = new ExpData(_meleeEnemyData.DropExp, GameEntry.Entity.NextId(), 10002)
{
Position = this.CachedTransform.position
};
@@ -1,11 +1,11 @@
using Components;
using CustomUtility;
using SepCore.Components;
using SepCore.CustomUtility;
using SepCore.Definition;
using Entity.EntityData;
using SepCore.Entity;
using UnityEngine;
using UnityGameFramework.Runtime;
namespace Entity
namespace SepCore.Entity
{
public class RemoteEnemy : EnemyBase
{
@@ -146,7 +146,7 @@ namespace Entity
direction.Normalize();
}
int projectileEntityId = GameEntry.Entity.GenerateSerialId();
int projectileEntityId = GameEntry.Entity.NextId();
var projectileData = new EnemyProjectileData(projectileEntityId, Id, _remoteEnemyData.Camp,
_attackDamage, _projectileSpeed, _projectileLifeTime, direction)
{
@@ -1,9 +1,9 @@
using Entity.EntityData;
using SepCore.Entity;
using GameFramework;
using UnityEngine;
using UnityGameFramework.Runtime;
namespace Entity
namespace SepCore.Entity
{
public abstract class EntityBase : EntityLogic
{
@@ -1,8 +1,8 @@
using Entity.EntityData;
using SepCore.Entity;
using UnityEngine;
using UnityGameFramework.Runtime;
namespace Entity
namespace SepCore.Entity
{
public class ExpEntity:EntityBase
{
@@ -1,15 +1,15 @@
using System.Collections.Generic;
using Components;
using SepCore.Components;
using SepCore.Event;
using SepCore.DataTable;
using SepCore.Definition;
using Entity.EntityData;
using SepCore.Entity;
using GameFramework.Event;
using UnityGameFramework.Runtime;
using Entity.Weapon;
using SepCore.Utility;
using SepCore.Entity.Weapon;
using SepCore.CustomUtility;
namespace Entity
namespace SepCore.Entity
{
public class Player : TargetableObject
{
@@ -141,7 +141,7 @@ namespace Entity
// BackpackComponent
Coin = role.Coin;
_backpackComponent.OnInit(this, role.WeaponCapacity);
GameEntry.Entity.ShowWeapon(EntityDataFactory.Create(GameEntry.Entity.GenerateSerialId(),
GameEntry.Entity.ShowWeapon(EntityDataFactory.Create(GameEntry.Entity.NextId(),
WeaponType.WeaponKnife, Id, _playerData.Camp));
// StatComponent
@@ -5,13 +5,13 @@
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using Components;
using SepCore.Components;
using SepCore.Definition;
using Entity.EntityData;
using CustomUtility;
using SepCore.Entity;
using SepCore.CustomUtility;
using UnityEngine;
namespace Entity
namespace SepCore.Entity
{
/// <summary>
/// 可作为目标的实体类。
@@ -1,7 +1,7 @@
using GameFramework.ObjectPool;
using UnityEngine;
namespace Entity.Weapon
namespace SepCore.Entity.Weapon
{
public sealed class HandgunHitMarkerAttackEffect : IWeaponAttackEffect
{

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