(client) chore:Clean code #47
@ -195,6 +195,8 @@ TilemapRenderer:
|
|||||||
m_RayTracingAccelStructBuildFlagsOverride: 0
|
m_RayTracingAccelStructBuildFlagsOverride: 0
|
||||||
m_RayTracingAccelStructBuildFlags: 1
|
m_RayTracingAccelStructBuildFlags: 1
|
||||||
m_SmallMeshCulling: 1
|
m_SmallMeshCulling: 1
|
||||||
|
m_ForceMeshLod: -1
|
||||||
|
m_MeshLodSelectionBias: 0
|
||||||
m_RenderingLayerMask: 1
|
m_RenderingLayerMask: 1
|
||||||
m_RendererPriority: 0
|
m_RendererPriority: 0
|
||||||
m_Materials:
|
m_Materials:
|
||||||
@ -216,6 +218,7 @@ TilemapRenderer:
|
|||||||
m_AutoUVMaxDistance: 0.5
|
m_AutoUVMaxDistance: 0.5
|
||||||
m_AutoUVMaxAngle: 89
|
m_AutoUVMaxAngle: 89
|
||||||
m_LightmapParameters: {fileID: 0}
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_GlobalIlluminationMeshLod: 0
|
||||||
m_SortingLayerID: 0
|
m_SortingLayerID: 0
|
||||||
m_SortingLayer: 0
|
m_SortingLayer: 0
|
||||||
m_SortingOrder: 0
|
m_SortingOrder: 0
|
||||||
@ -242,37 +245,6 @@ Transform:
|
|||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 613797070}
|
m_Father: {fileID: 613797070}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &309861628
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 309861630}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: "\u5B9E\u4F53\u5C42"
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!4 &309861630
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 309861628}
|
|
||||||
serializedVersion: 2
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
m_LocalPosition: {x: 0.17242, y: 0.05575, z: 1}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_ConstrainProportionsScale: 0
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 0}
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!1 &613797067
|
--- !u!1 &613797067
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -290,7 +262,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 0
|
||||||
--- !u!114 &613797068
|
--- !u!114 &613797068
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -388,7 +360,6 @@ MonoBehaviour:
|
|||||||
m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0}
|
m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0}
|
||||||
m_RequiresDepthTexture: 0
|
m_RequiresDepthTexture: 0
|
||||||
m_RequiresColorTexture: 0
|
m_RequiresColorTexture: 0
|
||||||
m_Version: 2
|
|
||||||
m_TaaSettings:
|
m_TaaSettings:
|
||||||
m_Quality: 3
|
m_Quality: 3
|
||||||
m_FrameInfluence: 0.1
|
m_FrameInfluence: 0.1
|
||||||
@ -396,6 +367,7 @@ MonoBehaviour:
|
|||||||
m_MipBias: 0
|
m_MipBias: 0
|
||||||
m_VarianceClampScale: 0.9
|
m_VarianceClampScale: 0.9
|
||||||
m_ContrastAdaptiveSharpening: 0
|
m_ContrastAdaptiveSharpening: 0
|
||||||
|
m_Version: 2
|
||||||
--- !u!81 &1057087088
|
--- !u!81 &1057087088
|
||||||
AudioListener:
|
AudioListener:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -546,6 +518,8 @@ TilemapRenderer:
|
|||||||
m_RayTracingAccelStructBuildFlagsOverride: 0
|
m_RayTracingAccelStructBuildFlagsOverride: 0
|
||||||
m_RayTracingAccelStructBuildFlags: 1
|
m_RayTracingAccelStructBuildFlags: 1
|
||||||
m_SmallMeshCulling: 1
|
m_SmallMeshCulling: 1
|
||||||
|
m_ForceMeshLod: -1
|
||||||
|
m_MeshLodSelectionBias: 0
|
||||||
m_RenderingLayerMask: 1
|
m_RenderingLayerMask: 1
|
||||||
m_RendererPriority: 0
|
m_RendererPriority: 0
|
||||||
m_Materials:
|
m_Materials:
|
||||||
@ -567,6 +541,7 @@ TilemapRenderer:
|
|||||||
m_AutoUVMaxDistance: 0.5
|
m_AutoUVMaxDistance: 0.5
|
||||||
m_AutoUVMaxAngle: 89
|
m_AutoUVMaxAngle: 89
|
||||||
m_LightmapParameters: {fileID: 0}
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_GlobalIlluminationMeshLod: 0
|
||||||
m_SortingLayerID: 0
|
m_SortingLayerID: 0
|
||||||
m_SortingLayer: 0
|
m_SortingLayer: 0
|
||||||
m_SortingOrder: 0
|
m_SortingOrder: 0
|
||||||
@ -593,51 +568,6 @@ Transform:
|
|||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 613797070}
|
m_Father: {fileID: 613797070}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &1371068281
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 1371068282}
|
|
||||||
- component: {fileID: 1371068283}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Loader
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!4 &1371068282
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1371068281}
|
|
||||||
serializedVersion: 2
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
m_LocalPosition: {x: 0, y: 0, z: -0}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_ConstrainProportionsScale: 0
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 0}
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!114 &1371068283
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1371068281}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 147e91e6929d90a4fb877c0b0a6b608c, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
entityManager: {fileID: 2036983433}
|
|
||||||
--- !u!1 &2036983430
|
--- !u!1 &2036983430
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -655,7 +585,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 0
|
||||||
--- !u!4 &2036983432
|
--- !u!4 &2036983432
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -684,8 +614,11 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
isGlobal: 1
|
isGlobal: 1
|
||||||
entityLevel: {fileID: 309861628}
|
characterPrefab: {fileID: 0}
|
||||||
entityPrefab: {fileID: 3332598847335032684, guid: 6cd8b01a0f57372438dc30c864ae1530, type: 3}
|
monsterPrefab: {fileID: 0}
|
||||||
|
buildingPrefab: {fileID: 0}
|
||||||
|
bulletPrefab: {fileID: 0}
|
||||||
|
pickupPrefab: {fileID: 0}
|
||||||
defaultEntityPrefab: {fileID: 7975757421877276383, guid: 89661daa5f100c64783f0ad9cd37a7ff, type: 3}
|
defaultEntityPrefab: {fileID: 7975757421877276383, guid: 89661daa5f100c64783f0ad9cd37a7ff, type: 3}
|
||||||
--- !u!114 &2036983434
|
--- !u!114 &2036983434
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -716,7 +649,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 0
|
m_IsActive: 1
|
||||||
--- !u!114 &2104915507
|
--- !u!114 &2104915507
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -751,6 +684,4 @@ SceneRoots:
|
|||||||
- {fileID: 1057087090}
|
- {fileID: 1057087090}
|
||||||
- {fileID: 613797070}
|
- {fileID: 613797070}
|
||||||
- {fileID: 2104915508}
|
- {fileID: 2104915508}
|
||||||
- {fileID: 309861630}
|
|
||||||
- {fileID: 2036983432}
|
- {fileID: 2036983432}
|
||||||
- {fileID: 1371068282}
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
|
using Data;
|
||||||
|
using Parsing;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using Data;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace AI
|
namespace AI
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
using System;
|
|
||||||
using AI;
|
|
||||||
using Data;
|
using Data;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Utils
|
namespace AI
|
||||||
{
|
{
|
||||||
|
|
||||||
public static class BehaviorTree
|
public static class BehaviorTree
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
@ -1,9 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using Base;
|
|
||||||
using Data;
|
using Data;
|
||||||
using Managers;
|
using Managers;
|
||||||
using Prefab;
|
|
||||||
using Unity.VisualScripting;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace AI
|
namespace AI
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
namespace Base
|
namespace Base
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
// C#
|
// C#
|
||||||
|
using Managers; // 确保日志命名空间正确
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic; // 新增,用于List
|
using System.Collections.Generic; // 新增,用于List
|
||||||
using Logging;
|
|
||||||
using Managers; // 确保日志命名空间正确
|
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
@ -18,7 +17,7 @@ namespace Base
|
|||||||
public GameObject loadingUI;
|
public GameObject loadingUI;
|
||||||
// 假设 CustomProgressBar 是一个自定义组件,其 API 与原代码使用方式一致
|
// 假设 CustomProgressBar 是一个自定义组件,其 API 与原代码使用方式一致
|
||||||
// 如果这里是 UnityEngine.UI.Image,需要完全改变 Progress 和 Opacity 的实现
|
// 如果这里是 UnityEngine.UI.Image,需要完全改变 Progress 和 Opacity 的实现
|
||||||
public Gradient progressBar; // 自定义进度条组件
|
public Gradient progressBar; // 自定义进度条组件
|
||||||
public TMP_Text describeText; // 描述文本
|
public TMP_Text describeText; // 描述文本
|
||||||
|
|
||||||
public float duration = 0.5f; // 每个步骤的过渡时间
|
public float duration = 0.5f; // 每个步骤的过渡时间
|
||||||
@ -96,7 +95,7 @@ namespace Base
|
|||||||
// 在 Awake 中初始化管理器列表并注册,确保在 Start 之前完成
|
// 在 Awake 中初始化管理器列表并注册,确保在 Start 之前完成
|
||||||
_managersToLoad = new List<ILaunchManager>
|
_managersToLoad = new List<ILaunchManager>
|
||||||
{
|
{
|
||||||
new Logging.LoggerManagerWrapper(), // UnityLogger的包装器
|
Logging.UnityLogger.Instance, // UnityLogger的包装器
|
||||||
Managers.DefineManager.Instance,
|
Managers.DefineManager.Instance,
|
||||||
Managers.PackagesImageManager.Instance,
|
Managers.PackagesImageManager.Instance,
|
||||||
Managers.TileManager.Instance,
|
Managers.TileManager.Instance,
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UI;
|
using UI;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using Object = UnityEngine.Object;
|
|
||||||
|
|
||||||
namespace Base
|
namespace Base
|
||||||
{
|
{
|
||||||
@ -72,7 +70,7 @@ namespace Base
|
|||||||
needUpdate = false;
|
needUpdate = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(_visibleWindows.Any(window => window.isInputOccupied))
|
if (_visibleWindows.Any(window => window.isInputOccupied))
|
||||||
return;
|
return;
|
||||||
foreach (var window in _allWindows)
|
foreach (var window in _allWindows)
|
||||||
{
|
{
|
||||||
@ -114,7 +112,7 @@ namespace Base
|
|||||||
|
|
||||||
// 显示目标窗口并更新缓存与暂停状态
|
// 显示目标窗口并更新缓存与暂停状态
|
||||||
windowToShow.Show();
|
windowToShow.Show();
|
||||||
var itick=windowToShow as ITickUI;
|
var itick = windowToShow as ITickUI;
|
||||||
if (itick != null)
|
if (itick != null)
|
||||||
Base.Clock.AddTickUI(itick);
|
Base.Clock.AddTickUI(itick);
|
||||||
|
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Networking;
|
|
||||||
using Formatting = Newtonsoft.Json.Formatting;
|
using Formatting = Newtonsoft.Json.Formatting;
|
||||||
|
|
||||||
namespace Configs
|
namespace Configs
|
||||||
|
@ -7,7 +7,7 @@ namespace Data
|
|||||||
public class BehaviorTreeDef : Define
|
public class BehaviorTreeDef : Define
|
||||||
{
|
{
|
||||||
public BehaviorTreeDef[] childTree;
|
public BehaviorTreeDef[] childTree;
|
||||||
public string className= "ThinkNode_Selector";
|
public string className = "ThinkNode_Selector";
|
||||||
public string value;
|
public string value;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
namespace Data
|
namespace Data
|
||||||
{
|
{
|
||||||
public class BulletDef:EntityDef
|
public class BulletDef : EntityDef
|
||||||
{
|
{
|
||||||
public string className;
|
public string className;
|
||||||
public string value;
|
public string value;
|
||||||
|
@ -1,10 +1,3 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace Data
|
namespace Data
|
||||||
{
|
{
|
||||||
public class CharacterDef : EntityDef
|
public class CharacterDef : EntityDef
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
using System;
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using Configs;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -5,9 +6,7 @@ using System.Linq;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using Configs;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Object = System.Object;
|
|
||||||
|
|
||||||
namespace Data
|
namespace Data
|
||||||
{
|
{
|
||||||
|
@ -237,7 +237,7 @@ namespace Data
|
|||||||
{
|
{
|
||||||
base.Init(xmlDef);
|
base.Init(xmlDef);
|
||||||
|
|
||||||
nodeName = xmlDef.Attribute("name")?.Value??"noName";
|
nodeName = xmlDef.Attribute("name")?.Value ?? "noName";
|
||||||
position = StringToVector(xmlDef.Attribute("position")?.Value ?? "(0 0)");
|
position = StringToVector(xmlDef.Attribute("position")?.Value ?? "(0 0)");
|
||||||
FPS = float.TryParse(xmlDef.Attribute("FPS")?.Value, out var result) ? result : 1.0f;
|
FPS = float.TryParse(xmlDef.Attribute("FPS")?.Value, out var result) ? result : 1.0f;
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,8 +1,3 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace Data
|
namespace Data
|
||||||
{
|
{
|
||||||
public class EntityDef : Define
|
public class EntityDef : Define
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
namespace Data
|
namespace Data
|
||||||
{
|
{
|
||||||
public class MonsterDef:EntityDef
|
public class MonsterDef : EntityDef
|
||||||
{
|
{
|
||||||
public WeaponDef weapon;
|
public WeaponDef weapon;
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,6 @@ namespace Entity
|
|||||||
attackTargetCount = def.attackTargetCount;
|
attackTargetCount = def.attackTargetCount;
|
||||||
}
|
}
|
||||||
public Attributes()
|
public Attributes()
|
||||||
{}
|
{ }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,10 +1,8 @@
|
|||||||
using Base;
|
|
||||||
using Data;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Entity
|
namespace Entity
|
||||||
{
|
{
|
||||||
public class Building:Entity
|
public class Building : Entity
|
||||||
{
|
{
|
||||||
public override void SetTarget(Vector3 pos)
|
public override void SetTarget(Vector3 pos)
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace Entity
|
namespace Entity
|
||||||
{
|
{
|
||||||
public class BuildingOutline:Outline
|
public class BuildingOutline : Outline
|
||||||
{
|
{
|
||||||
public BoxCollider2D boxCollider;
|
public BoxCollider2D boxCollider;
|
||||||
override public void Init()
|
override public void Init()
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
using System;
|
|
||||||
using Base;
|
using Base;
|
||||||
using Data;
|
using Data;
|
||||||
using Prefab;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Entity
|
namespace Entity
|
||||||
@ -20,7 +18,7 @@ namespace Entity
|
|||||||
protected override void AutoBehave()
|
protected override void AutoBehave()
|
||||||
{
|
{
|
||||||
TryMove();
|
TryMove();
|
||||||
lifeTime-=Time.deltaTime;
|
lifeTime -= Time.deltaTime;
|
||||||
if (lifeTime <= 0)
|
if (lifeTime <= 0)
|
||||||
{
|
{
|
||||||
Kill();
|
Kill();
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using Data;
|
using Data;
|
||||||
using Item;
|
using Item;
|
||||||
using Managers;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Utils;
|
|
||||||
// 添加 System 命名空间以使用 Action
|
// 添加 System 命名空间以使用 Action
|
||||||
|
|
||||||
namespace Entity
|
namespace Entity
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using AI;
|
using AI;
|
||||||
using Base;
|
using Base;
|
||||||
using Data;
|
using Data;
|
||||||
using Item;
|
using Item;
|
||||||
using Managers;
|
using Managers;
|
||||||
using Prefab;
|
using Prefab;
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ namespace Entity
|
|||||||
public virtual void Init(EntityDef entityDef)
|
public virtual void Init(EntityDef entityDef)
|
||||||
{
|
{
|
||||||
attributes = new Attributes(entityDef.attributes);
|
attributes = new Attributes(entityDef.attributes);
|
||||||
aiTree = Utils.BehaviorTree.ConvertToAIBase(entityDef.behaviorTree);
|
aiTree = AI.BehaviorTree.ConvertToAIBase(entityDef.behaviorTree);
|
||||||
affiliation = entityDef.affiliation?.defName;
|
affiliation = entityDef.affiliation?.defName;
|
||||||
InitBody(entityDef.drawingOrder);
|
InitBody(entityDef.drawingOrder);
|
||||||
this.entityDef = entityDef;
|
this.entityDef = entityDef;
|
||||||
@ -219,7 +219,7 @@ namespace Entity
|
|||||||
// 实例化imagePrefab作为默认占位符
|
// 实例化imagePrefab作为默认占位符
|
||||||
targetObj = Instantiate(imagePrefab.gameObject, body.transform);
|
targetObj = Instantiate(imagePrefab.gameObject, body.transform);
|
||||||
targetObj.name = $"{state}_{orientation}_Default";
|
targetObj.name = $"{state}_{orientation}_Default";
|
||||||
targetObj.transform.localPosition=Vector3.zero;
|
targetObj.transform.localPosition = Vector3.zero;
|
||||||
var imagePrefabCom = targetObj.GetComponent<ImagePrefab>();
|
var imagePrefabCom = targetObj.GetComponent<ImagePrefab>();
|
||||||
if (imagePrefabCom != null)
|
if (imagePrefabCom != null)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Item;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Entity
|
namespace Entity
|
||||||
|
@ -4,7 +4,7 @@ using Managers;
|
|||||||
|
|
||||||
namespace Entity
|
namespace Entity
|
||||||
{
|
{
|
||||||
public class Monster:Entity
|
public class Monster : Entity
|
||||||
{
|
{
|
||||||
private WeaponResource weapon;
|
private WeaponResource weapon;
|
||||||
public override void Init(EntityDef entityDef)
|
public override void Init(EntityDef entityDef)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using Managers;
|
using Managers;
|
||||||
using Prefab;
|
using Prefab;
|
||||||
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Events;
|
using UnityEngine.Events;
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ namespace Entity
|
|||||||
|
|
||||||
public Entity entity;
|
public Entity entity;
|
||||||
|
|
||||||
public static Vector3 minimum=new(0.5f,0.5f,0.5f);
|
public static Vector3 minimum = new(0.5f, 0.5f, 0.5f);
|
||||||
|
|
||||||
public virtual void Init()
|
public virtual void Init()
|
||||||
{
|
{
|
||||||
@ -116,7 +116,7 @@ namespace Entity
|
|||||||
private void BecomeDefault()
|
private void BecomeDefault()
|
||||||
{
|
{
|
||||||
entity.Kill();
|
entity.Kill();
|
||||||
EntityManage.Instance.GenerateDefaultEntity(Program.Instance.FocusedDimensionId,entity.Position);
|
EntityManage.Instance.GenerateDefaultEntity(Program.Instance.FocusedDimensionId, entity.Position);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StartControl()
|
private void StartControl()
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using Base;
|
using Base;
|
||||||
using Data;
|
using Data;
|
||||||
using Item;
|
using Item;
|
||||||
using Prefab;
|
using Prefab;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Entity
|
namespace Entity
|
||||||
{
|
{
|
||||||
public class Pickup:Entity
|
public class Pickup : Entity
|
||||||
{
|
{
|
||||||
public ItemResource itemResource;
|
public ItemResource itemResource;
|
||||||
protected override void AutoBehave()
|
protected override void AutoBehave()
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace Item
|
namespace Item
|
||||||
{
|
{
|
||||||
public class ItemBase
|
public class ItemBase
|
||||||
{
|
{
|
||||||
public ItemResource resource;
|
public ItemResource resource;
|
||||||
|
|
||||||
public int count=0;
|
public int count = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Data;
|
using Data;
|
||||||
using Managers;
|
using Managers;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Item
|
namespace Item
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq; // Added for LINQ
|
|
||||||
using Base;
|
using Base;
|
||||||
using Data;
|
using Data;
|
||||||
using Entity;
|
using Entity;
|
||||||
using Prefab;
|
using Prefab;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Object = UnityEngine.Object;
|
using Object = UnityEngine.Object;
|
||||||
|
|
||||||
@ -17,9 +16,9 @@ namespace Item
|
|||||||
public WeaponType Type { get; private set; }
|
public WeaponType Type { get; private set; }
|
||||||
|
|
||||||
public DrawNodeDef AttackAnimationDef { get; private set; }
|
public DrawNodeDef AttackAnimationDef { get; private set; }
|
||||||
public float AttackAnimationTime{get; private set;}
|
public float AttackAnimationTime { get; private set; }
|
||||||
|
|
||||||
public float AttackDetectionTime{get;private set;}
|
public float AttackDetectionTime { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构造函数:通过 WeaponDef 对象初始化 WeaponResource。
|
/// 构造函数:通过 WeaponDef 对象初始化 WeaponResource。
|
||||||
@ -112,7 +111,7 @@ namespace Item
|
|||||||
|
|
||||||
if (parent == null)
|
if (parent == null)
|
||||||
{
|
{
|
||||||
// 逻辑修改说明:这里直接返回 null 更合适,因为没有父节点无法创建实例。
|
// 逻辑修改说明:这里直接返回 null 更合适,因为没有父节点无法创建实例。
|
||||||
Debug.LogWarning($"CreateBodyPartGameObject: 父节点为null (节点名: {drawNode.nodeName ?? "Unnamed DrawNode"})");
|
Debug.LogWarning($"CreateBodyPartGameObject: 父节点为null (节点名: {drawNode.nodeName ?? "Unnamed DrawNode"})");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,10 @@ namespace Logging
|
|||||||
public static int MaxLogs
|
public static int MaxLogs
|
||||||
{
|
{
|
||||||
get => _maxLogs;
|
get => _maxLogs;
|
||||||
set {
|
set
|
||||||
lock (_lock) {
|
{
|
||||||
|
lock (_lock)
|
||||||
|
{
|
||||||
_maxLogs = Mathf.Max(value, 1); // 最小值为1
|
_maxLogs = Mathf.Max(value, 1); // 最小值为1
|
||||||
TrimExcess();
|
TrimExcess();
|
||||||
}
|
}
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
using Managers;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace Logging
|
|
||||||
{
|
|
||||||
public class LoggerManagerWrapper : ILaunchManager
|
|
||||||
{
|
|
||||||
public string StepDescription => "初始化日志";
|
|
||||||
public void Init()
|
|
||||||
{
|
|
||||||
Logging.UnityLogger.Init();
|
|
||||||
}
|
|
||||||
public void Clear()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: ffa9f8b447ee49f486398248d438f7ca
|
|
||||||
timeCreated: 1756128101
|
|
@ -1,57 +1,66 @@
|
|||||||
|
using Managers;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using Utils;
|
||||||
using SerilogLogger = Serilog.Core.Logger;
|
using SerilogLogger = Serilog.Core.Logger;
|
||||||
|
|
||||||
namespace Logging
|
namespace Logging
|
||||||
{
|
{
|
||||||
public static class UnityLogger
|
public class UnityLogger : Singleton<UnityLogger>, ILaunchManager
|
||||||
{
|
{
|
||||||
private static readonly SerilogLogger Logger = new LoggerConfiguration()
|
private bool _initialized = false;
|
||||||
|
private readonly SerilogLogger _logger = new LoggerConfiguration()
|
||||||
.WriteTo.File("Logs/UnityLog.txt")
|
.WriteTo.File("Logs/UnityLog.txt")
|
||||||
.CreateLogger();
|
.CreateLogger();
|
||||||
private static bool _initialized = false;
|
|
||||||
public static void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
if(_initialized)
|
if (_initialized) return;
|
||||||
return;
|
|
||||||
Application.logMessageReceived += OnLogMessageReceived;
|
Application.logMessageReceivedThreaded += OnLogMessageReceived;
|
||||||
_initialized = true;
|
_initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OnLogMessageReceived(string logString, string stackTrace, LogType type)
|
public void Clear()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public string StepDescription => "初始化日志";
|
||||||
|
|
||||||
|
private void OnLogMessageReceived(string logString, string stackTrace, LogType type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case LogType.Assert:
|
case LogType.Assert:
|
||||||
{
|
{
|
||||||
Logger.Warning("\nContent: {0}", logString);
|
_logger.Warning("\nContent: {0}", logString);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LogType.Log:
|
case LogType.Log:
|
||||||
{
|
{
|
||||||
Logger.Information("\nContent: {0}", logString);
|
_logger.Information("\nContent: {0}", logString);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LogType.Warning:
|
case LogType.Warning:
|
||||||
{
|
{
|
||||||
Logger.Warning("\nContent: {0}", logString);
|
_logger.Warning("\nContent: {0}", logString);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LogType.Error:
|
case LogType.Error:
|
||||||
{
|
{
|
||||||
Logger.Error("\nContent: {0}\nStackTrace:\n{1}", logString, stackTrace[..^1]);
|
_logger.Error("\nContent: {0}\nStackTrace:\n{1}", logString, stackTrace[..^1]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LogType.Exception:
|
case LogType.Exception:
|
||||||
{
|
{
|
||||||
Logger.Fatal("\nContent: {0}\nStackTrace:\n{1}", logString, stackTrace[..^1]);
|
_logger.Fatal("\nContent: {0}\nStackTrace:\n{1}", logString, stackTrace[..^1]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
Logger.Information("\nContent: {0}", logString);
|
_logger.Information("\nContent: {0}", logString);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
using Data;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Data;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Managers
|
namespace Managers
|
||||||
@ -10,7 +10,7 @@ namespace Managers
|
|||||||
/// 阵营管理器,负责管理游戏中的所有阵营定义及其相互关系。
|
/// 阵营管理器,负责管理游戏中的所有阵营定义及其相互关系。
|
||||||
/// 继承自 <see cref="Utils.Singleton{T}"/> ,确保全局只有一个实例。
|
/// 继承自 <see cref="Utils.Singleton{T}"/> ,确保全局只有一个实例。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class AffiliationManager:Utils.Singleton<AffiliationManager>,ILaunchManager
|
public class AffiliationManager : Utils.Singleton<AffiliationManager>, ILaunchManager
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 存储所有已加载的阵营定义,键为阵营的唯一名称,值为对应的 <see cref="AffiliationDef"/> 对象。
|
/// 存储所有已加载的阵营定义,键为阵营的唯一名称,值为对应的 <see cref="AffiliationDef"/> 对象。
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
|
using Data;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Data;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Utils;
|
using Utils;
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ namespace Managers
|
|||||||
/// 该管理器是一个单例,用于在应用程序中集中管理各种游戏或系统定义,
|
/// 该管理器是一个单例,用于在应用程序中集中管理各种游戏或系统定义,
|
||||||
/// 包括从不同数据包(Mods)加载定义,处理定义之间的引用,以及提供多种查询方法。
|
/// 包括从不同数据包(Mods)加载定义,处理定义之间的引用,以及提供多种查询方法。
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public class DefineManager : Singleton<DefineManager>,ILaunchManager
|
public class DefineManager : Singleton<DefineManager>, ILaunchManager
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数据集文件路径数组,用于指定定义包的根目录。
|
/// 数据集文件路径数组,用于指定定义包的根目录。
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using Base;
|
using Base;
|
||||||
using Data;
|
using Data;
|
||||||
using Entity;
|
using Entity;
|
||||||
using Prefab;
|
using Prefab;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
@ -269,7 +269,7 @@ namespace Managers
|
|||||||
throw new InvalidOperationException(
|
throw new InvalidOperationException(
|
||||||
$"在 '{instantiatedEntity.name}' 上缺少 EntityPrefab 组件,无法完成实体初始化。");
|
$"在 '{instantiatedEntity.name}' 上缺少 EntityPrefab 组件,无法完成实体初始化。");
|
||||||
}
|
}
|
||||||
entityComponent.entity.currentDimensionId=dimensionId;
|
entityComponent.entity.currentDimensionId = dimensionId;
|
||||||
entityComponent.Init(def);
|
entityComponent.Init(def);
|
||||||
extraInit?.Invoke(entityComponent);
|
extraInit?.Invoke(entityComponent);
|
||||||
|
|
||||||
@ -505,7 +505,7 @@ namespace Managers
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var result=Instantiate(pickupPrefab, pos, Quaternion.identity);
|
var result = Instantiate(pickupPrefab, pos, Quaternion.identity);
|
||||||
var pickup = result.GetComponent<Pickup>();
|
var pickup = result.GetComponent<Pickup>();
|
||||||
result.transform.SetParent(parentLayer);
|
result.transform.SetParent(parentLayer);
|
||||||
pickup.Init(itemDef);
|
pickup.Init(itemDef);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using Data;
|
using Data;
|
||||||
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using EventType = Data.EventType;
|
using EventType = Data.EventType;
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using Data;
|
using Data;
|
||||||
using Item;
|
using Item;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Managers
|
namespace Managers
|
||||||
{
|
{
|
||||||
public class ItemResourceManager : Utils.Singleton<ItemResourceManager>,ILaunchManager
|
public class ItemResourceManager : Utils.Singleton<ItemResourceManager>, ILaunchManager
|
||||||
{
|
{
|
||||||
private ItemResource defaultItem;
|
private ItemResource defaultItem;
|
||||||
private readonly Dictionary<string, Item.ItemResource> _items = new();
|
private readonly Dictionary<string, Item.ItemResource> _items = new();
|
||||||
@ -16,7 +16,7 @@ namespace Managers
|
|||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
defaultItem=ItemResource.GetDefault();
|
defaultItem = ItemResource.GetDefault();
|
||||||
var baseItemDefs = Managers.DefineManager.Instance.QueryDefinesByType<ItemDef>();
|
var baseItemDefs = Managers.DefineManager.Instance.QueryDefinesByType<ItemDef>();
|
||||||
var weaponDefs = Managers.DefineManager.Instance.QueryDefinesByType<WeaponDef>();
|
var weaponDefs = Managers.DefineManager.Instance.QueryDefinesByType<WeaponDef>();
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
|
using Data;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Data;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Managers
|
namespace Managers
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using Prefab;
|
using Prefab;
|
||||||
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Events;
|
using UnityEngine.Events;
|
||||||
|
|
||||||
namespace Managers
|
namespace Managers
|
||||||
{
|
{
|
||||||
public class RightMenuManager:Utils.MonoSingleton<RightMenuManager>
|
public class RightMenuManager : Utils.MonoSingleton<RightMenuManager>
|
||||||
{
|
{
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private GameObject _canvas;
|
private GameObject _canvas;
|
||||||
@ -45,11 +45,11 @@ namespace Managers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GenerateRightMenu(List<(string name, UnityAction callback)> buttons,Vector3 position)
|
public static void GenerateRightMenu(List<(string name, UnityAction callback)> buttons, Vector3 position)
|
||||||
{
|
{
|
||||||
var rightMenuObj = Instantiate(RightMenuManager.Instance.RightMenuPrefab.gameObject,
|
var rightMenuObj = Instantiate(RightMenuManager.Instance.RightMenuPrefab.gameObject,
|
||||||
RightMenuManager.Instance.Canvas.transform);
|
RightMenuManager.Instance.Canvas.transform);
|
||||||
var rightMenu=rightMenuObj.GetComponent<RightMenuPrefab>();
|
var rightMenu = rightMenuObj.GetComponent<RightMenuPrefab>();
|
||||||
rightMenu.Init(buttons);
|
rightMenu.Init(buttons);
|
||||||
rightMenu.transform.position = position;
|
rightMenu.transform.position = position;
|
||||||
rightMenu.Show();
|
rightMenu.Show();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using Data;
|
using Data;
|
||||||
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Tilemaps;
|
using UnityEngine.Tilemaps;
|
||||||
using Utils;
|
using Utils;
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using System;
|
|
||||||
using Managers;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Map
|
namespace Map
|
||||||
@ -12,7 +10,8 @@ namespace Map
|
|||||||
{
|
{
|
||||||
[SerializeField] private bool defaultOpen = false;
|
[SerializeField] private bool defaultOpen = false;
|
||||||
|
|
||||||
[SerializeField] [Tooltip("此维度的唯一标识符。如果为空,将使用GameObject的名称。")]
|
[SerializeField]
|
||||||
|
[Tooltip("此维度的唯一标识符。如果为空,将使用GameObject的名称。")]
|
||||||
private string _dimensionId;
|
private string _dimensionId;
|
||||||
|
|
||||||
[SerializeField] public MapGenerator mapGenerator;
|
[SerializeField] public MapGenerator mapGenerator;
|
||||||
@ -74,7 +73,7 @@ namespace Map
|
|||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
var size = mapGenerator.baseMap.GetSize();
|
var size = mapGenerator.baseMap.GetSize();
|
||||||
cameraPosition = new Vector3(size.x / 2f, size.y / 2f, -10)+transform.position;
|
cameraPosition = new Vector3(size.x / 2f, size.y / 2f, -10) + transform.position;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDestroy()
|
private void OnDestroy()
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
using System;
|
using Managers;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Data;
|
|
||||||
using Managers;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Tilemaps;
|
using UnityEngine.Tilemaps;
|
||||||
|
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Tilemaps;
|
|
||||||
|
|
||||||
namespace Map
|
namespace Map
|
||||||
{
|
{
|
||||||
public class MapGenerator:MonoBehaviour
|
public class MapGenerator : MonoBehaviour
|
||||||
{
|
{
|
||||||
public DoubleMap baseMap;
|
public DoubleMap baseMap;
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ using UnityEngine.UI;
|
|||||||
|
|
||||||
namespace Map
|
namespace Map
|
||||||
{
|
{
|
||||||
public class MiniMap : MonoBehaviour,ITickUI
|
public class MiniMap : MonoBehaviour, ITickUI
|
||||||
{
|
{
|
||||||
public Image background;
|
public Image background;
|
||||||
public RawImage texture;
|
public RawImage texture;
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
using System.Net.Http;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Grpc.Net.Client;
|
using Grpc.Net.Client;
|
||||||
using Grpc.Net.Client.Web;
|
using Grpc.Net.Client.Web;
|
||||||
using Protocol;
|
using Protocol;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
using Utils;
|
using Utils;
|
||||||
|
|
||||||
namespace Network
|
namespace Network
|
||||||
@ -18,21 +19,17 @@ namespace Network
|
|||||||
|
|
||||||
public GrpcClient()
|
public GrpcClient()
|
||||||
{
|
{
|
||||||
var httpHandler = new GrpcWebHandler(GrpcWebMode.GrpcWeb, new HttpClientHandler());
|
|
||||||
var channelOptions = new GrpcChannelOptions
|
var channelOptions = new GrpcChannelOptions
|
||||||
{
|
{
|
||||||
HttpHandler = httpHandler
|
HttpHandler = new GrpcWebHandler(GrpcWebMode.GrpcWeb, new HttpClientHandler())
|
||||||
};
|
};
|
||||||
|
|
||||||
_channel = GrpcChannel.ForAddress(ServerAddress, channelOptions);
|
_channel = GrpcChannel.ForAddress(ServerAddress, channelOptions);
|
||||||
|
|
||||||
_general = new GeneralService.GeneralServiceClient(_channel);
|
_general = new GeneralService.GeneralServiceClient(_channel);
|
||||||
_game = new GameService.GameServiceClient(_channel);
|
_game = new GameService.GameServiceClient(_channel);
|
||||||
}
|
|
||||||
|
|
||||||
~GrpcClient()
|
Application.quitting += () => _channel.ShutdownAsync().Wait();
|
||||||
{
|
|
||||||
_channel.ShutdownAsync().Wait();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<ServerInfo> GetServerInfo()
|
public async Task<ServerInfo> GetServerInfo()
|
||||||
|
8
Client/Assets/Scripts/Parsing.meta
Normal file
8
Client/Assets/Scripts/Parsing.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ef7f384f3b5dc0049ba97561d579cd03
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -5,7 +5,7 @@ using System.Reflection;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace AI
|
namespace Parsing
|
||||||
{
|
{
|
||||||
public static class ConditionDelegateFactory
|
public static class ConditionDelegateFactory
|
||||||
{
|
{
|
@ -1,9 +1,4 @@
|
|||||||
using System;
|
namespace Parsing
|
||||||
using Data;
|
|
||||||
using Managers;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace AI
|
|
||||||
{
|
{
|
||||||
public static class ConditionFunctions
|
public static class ConditionFunctions
|
||||||
{
|
{
|
||||||
@ -12,10 +7,9 @@ namespace AI
|
|||||||
return entity.attributes.health >= minHealth;
|
return entity.attributes.health >= minHealth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static bool HasEnemyInSight(Entity.Entity entity)
|
public static bool HasEnemyInSight(Entity.Entity entity)
|
||||||
{
|
{
|
||||||
return Managers.EntityManage.Instance.ExistsHostile(entity.currentDimensionId,entity.entityPrefab);
|
return Managers.EntityManage.Instance.ExistsHostile(entity.currentDimensionId, entity.entityPrefab);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,7 +2,7 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
|
|
||||||
namespace Utils
|
namespace Parsing
|
||||||
{
|
{
|
||||||
public static class Resolver
|
public static class Resolver
|
||||||
{
|
{
|
@ -5,15 +5,15 @@ using UnityEngine.UI;
|
|||||||
|
|
||||||
namespace Prefab
|
namespace Prefab
|
||||||
{
|
{
|
||||||
public class ButtonPrefab:MonoBehaviour
|
public class ButtonPrefab : MonoBehaviour
|
||||||
{
|
{
|
||||||
public Button button;
|
public Button button;
|
||||||
public TMP_Text text;
|
public TMP_Text text;
|
||||||
|
|
||||||
public string Label
|
public string Label
|
||||||
{
|
{
|
||||||
get{return text.text;}
|
get { return text.text; }
|
||||||
set{text.text = value;}
|
set { text.text = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddListener(UnityAction callback)
|
public void AddListener(UnityAction callback)
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using AI;
|
|
||||||
using Base;
|
using Base;
|
||||||
using Data;
|
using Data;
|
||||||
using Entity;
|
using Entity;
|
||||||
using Unity.VisualScripting;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Prefab
|
namespace Prefab
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using System;
|
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
@ -6,7 +5,7 @@ using UnityEngine.UI;
|
|||||||
namespace Prefab
|
namespace Prefab
|
||||||
{
|
{
|
||||||
// [RequireComponent(typeof(CircleCollider2D))]
|
// [RequireComponent(typeof(CircleCollider2D))]
|
||||||
public class HoverButtonPrefab:MonoBehaviour
|
public class HoverButtonPrefab : MonoBehaviour
|
||||||
{
|
{
|
||||||
public TMP_Text text;
|
public TMP_Text text;
|
||||||
public Button button;
|
public Button button;
|
||||||
@ -23,7 +22,7 @@ namespace Prefab
|
|||||||
|
|
||||||
public void OnMouseOver()
|
public void OnMouseOver()
|
||||||
{
|
{
|
||||||
var dir= (Input.mousePosition - transform.position).magnitude;
|
var dir = (Input.mousePosition - transform.position).magnitude;
|
||||||
|
|
||||||
var color = button.image.color;
|
var color = button.image.color;
|
||||||
color.a = Mathf.Min((startRadius - dir) / (startRadius - endRadius), 1);
|
color.a = Mathf.Min((startRadius - dir) / (startRadius - endRadius), 1);
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using Base;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Prefab
|
namespace Prefab
|
||||||
|
@ -2,7 +2,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace Prefab
|
namespace Prefab
|
||||||
{
|
{
|
||||||
public class ProgressBarPrefab:MonoBehaviour
|
public class ProgressBarPrefab : MonoBehaviour
|
||||||
{
|
{
|
||||||
public GameObject _progress;
|
public GameObject _progress;
|
||||||
public float Progress
|
public float Progress
|
||||||
@ -10,7 +10,7 @@ namespace Prefab
|
|||||||
get => _progress.transform.localScale.x;
|
get => _progress.transform.localScale.x;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
var x=Mathf.Clamp01(value);
|
var x = Mathf.Clamp01(value);
|
||||||
_progress.transform.localScale = new Vector3(x, _progress.transform.localScale.y, _progress.transform.localScale.z);
|
_progress.transform.localScale = new Vector3(x, _progress.transform.localScale.y, _progress.transform.localScale.z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ using UnityEngine.EventSystems;
|
|||||||
|
|
||||||
namespace Prefab
|
namespace Prefab
|
||||||
{
|
{
|
||||||
public class RightMenuPrefab: MonoBehaviour,IPointerExitHandler
|
public class RightMenuPrefab : MonoBehaviour, IPointerExitHandler
|
||||||
{
|
{
|
||||||
public GameObject menu;
|
public GameObject menu;
|
||||||
public ButtonPrefab buttonPrefab;
|
public ButtonPrefab buttonPrefab;
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using System;
|
|
||||||
using Base;
|
using Base;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ namespace Prefab
|
|||||||
// ITick接口实现
|
// ITick接口实现
|
||||||
public void Tick()
|
public void Tick()
|
||||||
{
|
{
|
||||||
var deltaTime=Time.deltaTime;
|
var deltaTime = Time.deltaTime;
|
||||||
if (_isPaused)
|
if (_isPaused)
|
||||||
{
|
{
|
||||||
HandlePausedState();
|
HandlePausedState();
|
||||||
|
@ -9,8 +9,8 @@ namespace Prefab
|
|||||||
|
|
||||||
public string Label
|
public string Label
|
||||||
{
|
{
|
||||||
get{return text.text;}
|
get { return text.text; }
|
||||||
set{text.text = value;}
|
set { text.text = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
using Map;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Map;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Utils;
|
using Utils;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ using UnityEngine.UI;
|
|||||||
|
|
||||||
namespace UI
|
namespace UI
|
||||||
{
|
{
|
||||||
public class BarUI:MonoBehaviour
|
public class BarUI : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField] private Image image;
|
[SerializeField] private Image image;
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ namespace UI
|
|||||||
{
|
{
|
||||||
entityPlacementUI.currentAction = () =>
|
entityPlacementUI.currentAction = () =>
|
||||||
{
|
{
|
||||||
Managers.EntityManage.Instance.GenerateEntity(Program.Instance.FocusedDimensionId,entityDef, Utils.MousePosition.GetWorldPosition());
|
Managers.EntityManage.Instance.GenerateEntity(Program.Instance.FocusedDimensionId, entityDef, Utils.MousePosition.GetWorldPosition());
|
||||||
};
|
};
|
||||||
entityPlacementUI.Prompt = $"当前生成器:\n名称:{entityDef.label}\n描述:{entityDef.description}";
|
entityPlacementUI.Prompt = $"当前生成器:\n名称:{entityDef.label}\n描述:{entityDef.description}";
|
||||||
entityPlacementUI.snapEnabled = false;
|
entityPlacementUI.snapEnabled = false;
|
||||||
@ -175,7 +175,7 @@ namespace UI
|
|||||||
{
|
{
|
||||||
entityPlacementUI.currentAction = () =>
|
entityPlacementUI.currentAction = () =>
|
||||||
{
|
{
|
||||||
Managers.EntityManage.Instance.GenerateMonsterEntity(Program.Instance.FocusedDimensionId,monsterDef, Utils.MousePosition.GetWorldPosition());
|
Managers.EntityManage.Instance.GenerateMonsterEntity(Program.Instance.FocusedDimensionId, monsterDef, Utils.MousePosition.GetWorldPosition());
|
||||||
};
|
};
|
||||||
entityPlacementUI.Prompt = $"当前生成器:\n名称:{monsterDef.label}\n描述:{monsterDef.description}";
|
entityPlacementUI.Prompt = $"当前生成器:\n名称:{monsterDef.label}\n描述:{monsterDef.description}";
|
||||||
entityPlacementUI.snapEnabled = false;
|
entityPlacementUI.snapEnabled = false;
|
||||||
@ -185,7 +185,7 @@ namespace UI
|
|||||||
{
|
{
|
||||||
entityPlacementUI.currentAction = () =>
|
entityPlacementUI.currentAction = () =>
|
||||||
{
|
{
|
||||||
Managers.EntityManage.Instance.GenerateBuildingEntity(Program.Instance.FocusedDimensionId,def, Utils.MousePosition.GetSnappedWorldPosition());
|
Managers.EntityManage.Instance.GenerateBuildingEntity(Program.Instance.FocusedDimensionId, def, Utils.MousePosition.GetSnappedWorldPosition());
|
||||||
};
|
};
|
||||||
entityPlacementUI.Prompt = $"当前生成器:\n名称:{def.label}\n描述:{def.description}";
|
entityPlacementUI.Prompt = $"当前生成器:\n名称:{def.label}\n描述:{def.description}";
|
||||||
entityPlacementUI.snapEnabled = true;
|
entityPlacementUI.snapEnabled = true;
|
||||||
@ -195,7 +195,7 @@ namespace UI
|
|||||||
{
|
{
|
||||||
entityPlacementUI.currentAction = () =>
|
entityPlacementUI.currentAction = () =>
|
||||||
{
|
{
|
||||||
Managers.EntityManage.Instance.GeneratePickupEntity(Program.Instance.FocusedDimensionId,itemDef, Utils.MousePosition.GetWorldPosition());
|
Managers.EntityManage.Instance.GeneratePickupEntity(Program.Instance.FocusedDimensionId, itemDef, Utils.MousePosition.GetWorldPosition());
|
||||||
};
|
};
|
||||||
entityPlacementUI.Prompt = $"当前生成器:\n名称:{itemDef.label}\n描述:{itemDef.description}";
|
entityPlacementUI.Prompt = $"当前生成器:\n名称:{itemDef.label}\n描述:{itemDef.description}";
|
||||||
entityPlacementUI.snapEnabled = false;
|
entityPlacementUI.snapEnabled = false;
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
using Base;
|
using Base;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Events;
|
|
||||||
|
|
||||||
namespace UI
|
namespace UI
|
||||||
{
|
{
|
||||||
|
|
||||||
public delegate void NonReturnCallback();
|
public delegate void NonReturnCallback();
|
||||||
public class EntityPlacementUI:UIBase,ITickUI
|
public class EntityPlacementUI : UIBase, ITickUI
|
||||||
{
|
{
|
||||||
public TMP_Text promptText;
|
public TMP_Text promptText;
|
||||||
|
|
||||||
@ -29,7 +28,7 @@ namespace UI
|
|||||||
{
|
{
|
||||||
Base.UIInputControl.Instance.Hide(this);
|
Base.UIInputControl.Instance.Hide(this);
|
||||||
}
|
}
|
||||||
if (currentAction!=null&&Input.GetMouseButtonDown(0))
|
if (currentAction != null && Input.GetMouseButtonDown(0))
|
||||||
{
|
{
|
||||||
currentAction();
|
currentAction();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using Base;
|
using Base;
|
||||||
using Entity;
|
using Entity;
|
||||||
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
// 确保 Character 类在此命名空间下
|
// 确保 Character 类在此命名空间下
|
||||||
|
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
using Base;
|
using Base;
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
namespace UI
|
namespace UI
|
||||||
{
|
{
|
||||||
public class EscUI:UIBase
|
public class EscUI : UIBase
|
||||||
{
|
{
|
||||||
public void ContinueButton()
|
public void ContinueButton()
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
using System;
|
|
||||||
using Base;
|
using Base;
|
||||||
|
using System;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
@ -7,7 +7,7 @@ using UnityEngine.UI;
|
|||||||
|
|
||||||
namespace UI
|
namespace UI
|
||||||
{
|
{
|
||||||
public class ItemUI:MonoBehaviour,IPointerEnterHandler,IPointerExitHandler,IPointerClickHandler,ITick
|
public class ItemUI : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerClickHandler, ITick
|
||||||
{
|
{
|
||||||
[SerializeField] private Image textureUI;
|
[SerializeField] private Image textureUI;
|
||||||
[SerializeField] private TMP_Text countUI;
|
[SerializeField] private TMP_Text countUI;
|
||||||
@ -29,7 +29,7 @@ namespace UI
|
|||||||
|
|
||||||
public int SlotIndex { get; private set; } = -1;
|
public int SlotIndex { get; private set; } = -1;
|
||||||
|
|
||||||
public void Init(Entity.InventorySlot item,int index)
|
public void Init(Entity.InventorySlot item, int index)
|
||||||
{
|
{
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
@ -75,13 +75,13 @@ namespace UI
|
|||||||
{
|
{
|
||||||
if (switchTime > 0)
|
if (switchTime > 0)
|
||||||
{
|
{
|
||||||
timer+=Time.deltaTime;
|
timer += Time.deltaTime;
|
||||||
if (timer >= switchTime)
|
if (timer >= switchTime)
|
||||||
{
|
{
|
||||||
timer-=switchTime;
|
timer -= switchTime;
|
||||||
texturePtr++;
|
texturePtr++;
|
||||||
texturePtr%=_item.Item.Icon.Count;
|
texturePtr %= _item.Item.Icon.Count;
|
||||||
textureUI.sprite=_item.Item.Icon[texturePtr];
|
textureUI.sprite = _item.Item.Icon[texturePtr];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
using Prefab;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Prefab;
|
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
using System;
|
|
||||||
using TMPro;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace UI
|
namespace UI
|
||||||
{
|
{
|
||||||
public class PlayerStateUI:MonoBehaviour,Base.ITick
|
public class PlayerStateUI : MonoBehaviour, Base.ITick
|
||||||
{
|
{
|
||||||
[SerializeField] private BarUI focusedEntityHP;
|
[SerializeField] private BarUI focusedEntityHP;
|
||||||
[SerializeField] private BarUI lastEntityHP;
|
[SerializeField] private BarUI lastEntityHP;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
using System.Globalization;
|
|
||||||
using Base;
|
using Base;
|
||||||
|
using System.Globalization;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
@ -2,20 +2,18 @@ using System;
|
|||||||
|
|
||||||
namespace Utils
|
namespace Utils
|
||||||
{
|
{
|
||||||
public class PerlinNoise : Utils.Singleton<PerlinNoise>
|
public class PerlinNoise : Singleton<PerlinNoise>
|
||||||
{
|
{
|
||||||
private int[] _p; // 混淆表
|
private readonly int[] _p = new int[512]; // 混淆表
|
||||||
private const int DefaultSeed = 0; // 默认种子
|
|
||||||
|
|
||||||
public PerlinNoise()
|
public PerlinNoise()
|
||||||
{
|
{
|
||||||
Initialize(DefaultSeed);
|
Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化混淆表
|
// 初始化混淆表
|
||||||
private void Initialize(int seed)
|
private void Initialize(int seed = 0)
|
||||||
{
|
{
|
||||||
_p = new int[512]; // 混淆表加倍以方便使用
|
|
||||||
var permutation = new int[256];
|
var permutation = new int[256];
|
||||||
var random = new Random(seed);
|
var random = new Random(seed);
|
||||||
|
|
||||||
@ -26,9 +24,8 @@ namespace Utils
|
|||||||
for (var i = 0; i < 256; i++)
|
for (var i = 0; i < 256; i++)
|
||||||
{
|
{
|
||||||
var swapIndex = random.Next(256);
|
var swapIndex = random.Next(256);
|
||||||
var temp = permutation[i];
|
|
||||||
permutation[i] = permutation[swapIndex];
|
(permutation[i], permutation[swapIndex]) = (permutation[swapIndex], permutation[i]);
|
||||||
permutation[swapIndex] = temp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 将打乱后的数组复制两次,生成512个元素的混淆表
|
// 将打乱后的数组复制两次,生成512个元素的混淆表
|
||||||
@ -86,7 +83,7 @@ namespace Utils
|
|||||||
/// 为给定的(x, y, z)坐标生成3D Perlin噪声。
|
/// 为给定的(x, y, z)坐标生成3D Perlin噪声。
|
||||||
/// 输出值通常在-1到1之间。
|
/// 输出值通常在-1到1之间。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double Noise(double x, double y=0, double z = 0)
|
public double Noise(double x, double y = 0, double z = 0)
|
||||||
{
|
{
|
||||||
var X = (int)Math.Floor(x) & 255;
|
var X = (int)Math.Floor(x) & 255;
|
||||||
var Y = (int)Math.Floor(y) & 255;
|
var Y = (int)Math.Floor(y) & 255;
|
||||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user