diff options
Diffstat (limited to 'Assets/Scripts/SoulCoreGameLoop')
| -rw-r--r-- | Assets/Scripts/SoulCoreGameLoop/Icon.meta | 8 | ||||
| -rw-r--r-- | Assets/Scripts/SoulCoreGameLoop/Icon/UIEventListener.png | bin | 0 -> 267 bytes | |||
| -rw-r--r-- | Assets/Scripts/SoulCoreGameLoop/Icon/UIEventListener.png.meta | 114 | ||||
| -rw-r--r-- | Assets/Scripts/SoulCoreGameLoop/UI.meta | 8 | ||||
| -rw-r--r-- | Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs | 41 | ||||
| -rw-r--r-- | Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs.meta | 11 | ||||
| -rw-r--r-- | Assets/Scripts/SoulCoreGameLoop/UI/UIEventListener.cs | 52 | ||||
| -rw-r--r-- | Assets/Scripts/SoulCoreGameLoop/UI/UIEventListener.cs.meta | 11 | ||||
| -rw-r--r-- | Assets/Scripts/SoulCoreGameLoop/WangSoul.GameCore.asmdef | 16 | ||||
| -rw-r--r-- | Assets/Scripts/SoulCoreGameLoop/WangSoul.GameCore.asmdef.meta | 7 |
10 files changed, 268 insertions, 0 deletions
diff --git a/Assets/Scripts/SoulCoreGameLoop/Icon.meta b/Assets/Scripts/SoulCoreGameLoop/Icon.meta new file mode 100644 index 0000000..282a139 --- /dev/null +++ b/Assets/Scripts/SoulCoreGameLoop/Icon.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1d34cbd34981faa41884e15b9c79266a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SoulCoreGameLoop/Icon/UIEventListener.png b/Assets/Scripts/SoulCoreGameLoop/Icon/UIEventListener.png Binary files differnew file mode 100644 index 0000000..49a256c --- /dev/null +++ b/Assets/Scripts/SoulCoreGameLoop/Icon/UIEventListener.png diff --git a/Assets/Scripts/SoulCoreGameLoop/Icon/UIEventListener.png.meta b/Assets/Scripts/SoulCoreGameLoop/Icon/UIEventListener.png.meta new file mode 100644 index 0000000..dd67303 --- /dev/null +++ b/Assets/Scripts/SoulCoreGameLoop/Icon/UIEventListener.png.meta @@ -0,0 +1,114 @@ +fileFormatVersion: 2 +guid: bfb0c63404ebf8440bdd3c54bc130d45 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SoulCoreGameLoop/UI.meta b/Assets/Scripts/SoulCoreGameLoop/UI.meta new file mode 100644 index 0000000..8b9d12a --- /dev/null +++ b/Assets/Scripts/SoulCoreGameLoop/UI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 135f2ead0b71bb64da4717b3fc8af654 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs b/Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs new file mode 100644 index 0000000..ab03647 --- /dev/null +++ b/Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs @@ -0,0 +1,41 @@ +using System; +using TMPro; +using UnityEditor; +using UnityEngine; + +namespace SoulCoreGameLoop.UI +{ + [RequireComponent(typeof(Animator))] + public class AreaHint : MonoBehaviour, IUIEventSender<AreaHintMessage> + { + private const String TriggerPlay = "Play"; + + public TMP_Text areaName; + private Animator _animator; + + [InitializeOnLoadMethod] + public static void RegisterListener () + => UIEventListener.JoinListener<AreaHintMessage>(); + + public void OnReceive(AreaHintMessage evt) + { + areaName.text = evt.AreaName; + _animator.Play(TriggerPlay); + } + + private void Start() + { + _animator = GetComponent<Animator>(); + } + } + + public struct AreaHintMessage + { + public readonly string AreaName; + + public AreaHintMessage(string areaName) + { + AreaName = areaName; + } + } +} diff --git a/Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs.meta b/Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs.meta new file mode 100644 index 0000000..ac152c3 --- /dev/null +++ b/Assets/Scripts/SoulCoreGameLoop/UI/AreaHint.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bad4905764b2bf444bb53c3b0c619d91 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SoulCoreGameLoop/UI/UIEventListener.cs b/Assets/Scripts/SoulCoreGameLoop/UI/UIEventListener.cs new file mode 100644 index 0000000..2d33a9b --- /dev/null +++ b/Assets/Scripts/SoulCoreGameLoop/UI/UIEventListener.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Object = System.Object; + +namespace SoulCoreGameLoop.UI +{ + /// <summary> + /// UI 事件监听器 + /// </summary> + public static class UIEventListener + { + private static readonly Dictionary<TypeCode, Object> TypeSets = new (); + + /// <summary> + /// 向 UI 事件监听器添加发送器实例 + /// </summary> + /// <typeparam name="T"> 发送器绑定类型 </typeparam> + public static void JoinListener<T>() where T : new() + { + var typeCode = Type.GetTypeCode(typeof(T)); + TypeSets.Add(typeCode, new T()); + } + + /// <summary> + /// 向 UI 事件监听器发送消息 + /// </summary> + /// <param name="message"> 发送器 </param> + /// <typeparam name="T"> 消息类型 </typeparam> + public static void Send<T>(T message) + { + var typeCode = Type.GetTypeCode(typeof(T)); + if (TypeSets.TryGetValue(typeCode, out var set)) + { + var sender = (IUIEventSender<T>) set; + sender.OnReceive(message); + } + } + } + + /// <summary> + /// UI 事件发送器 + /// </summary> + /// <typeparam name="TEvent"></typeparam> + public interface IUIEventSender<in TEvent> + { + /// <summary> + /// 当接收到 UI 事件时的处理 + /// </summary> + /// <param name="evt"></param> + public void OnReceive(TEvent evt); + } +} diff --git a/Assets/Scripts/SoulCoreGameLoop/UI/UIEventListener.cs.meta b/Assets/Scripts/SoulCoreGameLoop/UI/UIEventListener.cs.meta new file mode 100644 index 0000000..277f53b --- /dev/null +++ b/Assets/Scripts/SoulCoreGameLoop/UI/UIEventListener.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4c0f577ae0bc33c498d7bf73ba7838f7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SoulCoreGameLoop/WangSoul.GameCore.asmdef b/Assets/Scripts/SoulCoreGameLoop/WangSoul.GameCore.asmdef new file mode 100644 index 0000000..974980b --- /dev/null +++ b/Assets/Scripts/SoulCoreGameLoop/WangSoul.GameCore.asmdef @@ -0,0 +1,16 @@ +{ + "name": "WangSoul.GameCore", + "rootNamespace": "", + "references": [ + "GUID:6055be8ebefd69e48b49212b09b47b2f" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +}
\ No newline at end of file diff --git a/Assets/Scripts/SoulCoreGameLoop/WangSoul.GameCore.asmdef.meta b/Assets/Scripts/SoulCoreGameLoop/WangSoul.GameCore.asmdef.meta new file mode 100644 index 0000000..a78b0ae --- /dev/null +++ b/Assets/Scripts/SoulCoreGameLoop/WangSoul.GameCore.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 7180449da99cc834fabe9f79ce3695a3 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: |
