规范命名空间

具体来说就是 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,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
{