diff --git a/.gitignore b/.gitignore index f1f5e64..036465e 100644 --- a/.gitignore +++ b/.gitignore @@ -81,3 +81,6 @@ crashlytics-build.properties /UI参考 /AGENTS.md +/bin + +~$*.xlsx diff --git a/Assets/GameFramework/Scripts/Editor/Inspector/BaseComponentInspector.cs b/Assets/GameFramework/Scripts/Editor/Inspector/BaseComponentInspector.cs index 65d3792..328d8be 100644 --- a/Assets/GameFramework/Scripts/Editor/Inspector/BaseComponentInspector.cs +++ b/Assets/GameFramework/Scripts/Editor/Inspector/BaseComponentInspector.cs @@ -104,7 +104,7 @@ namespace UnityGameFramework.Editor } EditorGUI.EndDisabledGroup(); - int frameRate = EditorGUILayout.IntSlider("Frame Rate", m_FrameRate.intValue, 1, 120); + int frameRate = EditorGUILayout.IntSlider("Frame Rate", m_FrameRate.intValue, 1, 240); if (frameRate != m_FrameRate.intValue) { if (EditorApplication.isPlaying) diff --git a/Assets/GameFramework/Scripts/Runtime/Debugger/DebuggerComponent.ScreenInformationWindow.cs b/Assets/GameFramework/Scripts/Runtime/Debugger/DebuggerComponent.ScreenInformationWindow.cs index 5c516c1..5f8b614 100644 --- a/Assets/GameFramework/Scripts/Runtime/Debugger/DebuggerComponent.ScreenInformationWindow.cs +++ b/Assets/GameFramework/Scripts/Runtime/Debugger/DebuggerComponent.ScreenInformationWindow.cs @@ -66,7 +66,7 @@ namespace UnityGameFramework.Runtime private string GetResolutionString(Resolution resolution) { - return Utility.Text.Format("{0} x {1} @ {2}Hz", resolution.width, resolution.height, resolution.refreshRate); + return Utility.Text.Format("{0} x {1} @ {2}Hz", resolution.width, resolution.height, resolution.refreshRateRatio); } private string GetCutoutsString(Rect[] cutouts) diff --git a/Assets/GameMain/Configs/ResourceBuilder.xml b/Assets/GameMain/Configs/ResourceBuilder.xml index 8e0b951..2a0c5c7 100644 --- a/Assets/GameMain/Configs/ResourceBuilder.xml +++ b/Assets/GameMain/Configs/ResourceBuilder.xml @@ -2,14 +2,14 @@ - 0 - 1 + 1 + 33 1 UnityGameFramework.Runtime.DefaultCompressionHelper True False StarForce.Editor.StarForceBuildEventHandler - + D:/Learn/GameLearn/UnityProjects/VampireLike/bin/AssetBundles True True True diff --git a/Assets/GameMain/Configs/ResourceCollection.xml b/Assets/GameMain/Configs/ResourceCollection.xml index b5987c3..5ad3660 100644 --- a/Assets/GameMain/Configs/ResourceCollection.xml +++ b/Assets/GameMain/Configs/ResourceCollection.xml @@ -16,43 +16,56 @@ + + + + + - - + + - - + + + + + + - + + + + + @@ -62,97 +75,120 @@ + + + - + - + + + - + + + + + + - + - + + + + - - - - - + + + - + - - - + - + + + + + - - + - - + + + + + + + - + + + + + + - + + + + - - \ No newline at end of file diff --git a/Assets/GameMain/DataTables/Enemy.txt b/Assets/GameMain/DataTables/Enemy.txt index 7ca14d2..2bcad84 100644 --- a/Assets/GameMain/DataTables/Enemy.txt +++ b/Assets/GameMain/DataTables/Enemy.txt @@ -1,5 +1,5 @@ -# 敌人基础属性表 -# Id MaxHealth Speed CoinDrop ExpDrop DropPercent -# int int float int int float -# 实体编号 策划备注 最大生命 移动速度 金币掉落 经验掉落 掉落概率 - 101 近战敌人 20 3 2 1 0.3 +# 敌人基础属性表 +# Id MaxHealth HpAddPerLevel Speed CoinDrop ExpDrop DropPercent +# int int int float int int float +# 实体编号 策划备注 最大生命 每关卡增加生命 移动速度 金币掉落 经验掉落 掉落概率 + 101 近战敌人 50 50 3 5 1 0.3 diff --git a/Assets/GameMain/DataTables/LevelRarity.txt b/Assets/GameMain/DataTables/LevelRarity.txt new file mode 100644 index 0000000..6cc8c8f --- /dev/null +++ b/Assets/GameMain/DataTables/LevelRarity.txt @@ -0,0 +1,7 @@ +# 关卡道具品质掉落概率表 +# Id LevelMin LevelMax WhiteWeight GreenWeight BlueWeight PurpleWeight RedWeight SumWeight +# int float float float float float float float float +# 概率编号 策划备注 关卡左区间 关卡右区间 白色掉落率 绿色掉落率 蓝色掉落率 紫色掉落率 红色掉落率 总掉落率(不需要读取) + 1 1 3 75 20 4 1 0 100 + 2 4 5 30 50 15 4 1 100 + 3 6 10 10 20 40 20 10 100 diff --git a/Assets/GameMain/DataTables/LevelRarity.txt.meta b/Assets/GameMain/DataTables/LevelRarity.txt.meta new file mode 100644 index 0000000..422c335 --- /dev/null +++ b/Assets/GameMain/DataTables/LevelRarity.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0080b46050fc460cb6d6c7fc8d4e8c27 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/DataTables/LevelUpReward.txt b/Assets/GameMain/DataTables/LevelUpReward.txt index b2eb50e..a746f00 100644 --- a/Assets/GameMain/DataTables/LevelUpReward.txt +++ b/Assets/GameMain/DataTables/LevelUpReward.txt @@ -1,8 +1,22 @@ -# 道具表 -# Id Title IconAssetName Modifiers -# int string string StatModifier[] -# 奖励编号 策划备注 奖励名 图标资源名 道具属性 - 101 测试道具 肌肉 Almighty_Icon [{"StatType":"Attack","Value":0.05,"IsPercent":true}] - 102 牙齿 Almighty_Icon [{"StatType":"Attack","Value":0.05,"IsPercent":true}] - 103 脑 Almighty_Icon [{"StatType":"Attack","Value":0.05,"IsPercent":true}] - 104 鼻子 Almighty_Icon [{"StatType":"Attack","Value":0.05,"IsPercent":true}] +# 道具表 +# Id Title IconAssetName Rarity Modifiers +# int string string RarityType StatModifier[] +# 奖励编号 策划备注 奖励名 图标资源名 道具品质 道具属性 + 101 测试道具 肌肉 Almighty_Icon White [{"StatType":"Attack","Value":0.05,"IsPercent":true}] + 102 牙齿 Almighty_Icon White [{"StatType":"Attack","Value":0.05,"IsPercent":true}] + 103 脑 Almighty_Icon White [{"StatType":"Critical","Value":0.05,"IsPercent":true}] + 104 鼻子 Almighty_Icon White [{"StatType":"AbsorbRange","Value":0.05,"IsPercent":true}] + 105 腿 Almighty_Icon White [{"StatType":"MovementSpeed","Value":0.05,"IsPercent":true}] + 106 眼睛 Almighty_Icon White [{"StatType":"MaxHealth","Value":0.05,"IsPercent":true}] + 107 肌肉 Almighty_Icon Green [{"StatType":"Attack","Value":0.15,"IsPercent":true}] + 108 牙齿 Almighty_Icon Green [{"StatType":"Attack","Value":0.15,"IsPercent":true}] + 109 脑 Almighty_Icon Green [{"StatType":"Critical","Value":0.15,"IsPercent":true}] + 110 鼻子 Almighty_Icon Green [{"StatType":"AbsorbRange","Value":0.15,"IsPercent":true}] + 111 腿 Almighty_Icon Green [{"StatType":"MovementSpeed","Value":0.15,"IsPercent":true}] + 112 眼睛 Almighty_Icon Green [{"StatType":"MaxHealth","Value":0.15,"IsPercent":true}] + 113 肌肉 Almighty_Icon Blue [{"StatType":"Attack","Value":0.3,"IsPercent":true}] + 114 牙齿 Almighty_Icon Blue [{"StatType":"Attack","Value":0.3,"IsPercent":true}] + 115 脑 Almighty_Icon Blue [{"StatType":"Critical","Value":0.3,"IsPercent":true}] + 116 鼻子 Almighty_Icon Blue [{"StatType":"AbsorbRange","Value":0.3,"IsPercent":true}] + 117 腿 Almighty_Icon Blue [{"StatType":"MovementSpeed","Value":0.3,"IsPercent":true}] + 118 眼睛 Almighty_Icon Blue [{"StatType":"MaxHealth","Value":0.3,"IsPercent":true}] diff --git a/Assets/GameMain/DataTables/Weapon.txt b/Assets/GameMain/DataTables/Weapon.txt index 8e6d608..9e072dd 100644 --- a/Assets/GameMain/DataTables/Weapon.txt +++ b/Assets/GameMain/DataTables/Weapon.txt @@ -2,5 +2,5 @@ # Id Title IconAssetName Rarity Price PriceRandomPercent Attack Cooldown AttackRange AttackSoundId Pramas Modifiers # int string string RarityType int float int float float int string[] StatModifier[] # 武器编号 策划备注 武器名 图标资源名 道具品质 武器价格 价格浮动 伤害 冷却 范围 攻击音效编号 额外参数 额外属性 - 201 玩家武器 小刀 Almighty_Icon White 120 0.05 100 1.5 3 10000 [] [] - 202 手枪 Almighty_Icon White 130 0.05 120 1 10 10000 [] [] + 201 玩家武器 小刀 Almighty_Icon White 120 0.05 100 1.5 5 10000 [] [] + 202 手枪 Almighty_Icon White 130 0.05 120 1 15 10000 [] [] diff --git a/Assets/GameMain/Entities/MeleeEnemy.prefab b/Assets/GameMain/Entities/MeleeEnemy.prefab index d1f7662..4c3a5ed 100644 --- a/Assets/GameMain/Entities/MeleeEnemy.prefab +++ b/Assets/GameMain/Entities/MeleeEnemy.prefab @@ -65,7 +65,7 @@ MeshRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 2100000, guid: 28c42f88cfe56e84e95c0d7545db8c1b, type: 2} + - {fileID: 2100000, guid: 83e5fce2d1e5b3e4ab6551de03cc9c22, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 diff --git a/Assets/GameMain/Entities/Player.prefab b/Assets/GameMain/Entities/Player.prefab index aeeb24a..a260094 100644 --- a/Assets/GameMain/Entities/Player.prefab +++ b/Assets/GameMain/Entities/Player.prefab @@ -369,6 +369,7 @@ GameObject: - component: {fileID: 582203051508165858} - component: {fileID: 4988822728923805024} - component: {fileID: 4321355627424240428} + - component: {fileID: 7894423710682551789} m_Layer: 7 m_Name: Player m_TagString: Player @@ -421,7 +422,7 @@ MeshRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} + - {fileID: 2100000, guid: c4f37184fcb9306428d7d002f7dca96d, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 @@ -566,3 +567,22 @@ MonoBehaviour: - {fileID: 4149661712638700245} - {fileID: 5429551983429523606} - {fileID: 2395797268595685132} +--- !u!114 &7894423710682551789 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8198962528757305497} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 46f46350fed64d8389ebb4ae72b65796, type: 3} + m_Name: + m_EditorClassIdentifier: + _absorbRangeBase: 3 + _absorbSpeed: 8 + _collectDistance: 0.35 + _maxDetectCount: 64 + _detectLayerMask: + serializedVersion: 2 + m_Bits: 8192 diff --git a/Assets/GameMain/Entities/RemoteEnemy.prefab b/Assets/GameMain/Entities/RemoteEnemy.prefab index 7bdd32a..06f7b4b 100644 --- a/Assets/GameMain/Entities/RemoteEnemy.prefab +++ b/Assets/GameMain/Entities/RemoteEnemy.prefab @@ -64,7 +64,7 @@ MeshRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 2100000, guid: 2257393dd6ed51a49a6c3fd178382b59, type: 2} + - {fileID: 2100000, guid: 429ed03405bf8854eab46552b7470ac0, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 diff --git a/Assets/GameMain/Scenes/StressTest.meta b/Assets/GameMain/Fonts/Shaders.meta similarity index 77% rename from Assets/GameMain/Scenes/StressTest.meta rename to Assets/GameMain/Fonts/Shaders.meta index a8221dc..e6d5003 100644 --- a/Assets/GameMain/Scenes/StressTest.meta +++ b/Assets/GameMain/Fonts/Shaders.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d278c30ab68ad1e4b8c981c2ffe9473e +guid: 9dc75a5d11c10e94c9d5ed1176388036 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/GameMain/Fonts/Shaders/TMP_Bitmap-Custom-Atlas.shader b/Assets/GameMain/Fonts/Shaders/TMP_Bitmap-Custom-Atlas.shader new file mode 100644 index 0000000..bab2b2c --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_Bitmap-Custom-Atlas.shader @@ -0,0 +1,143 @@ +Shader "TextMeshPro/Bitmap Custom Atlas" { + +Properties { + _MainTex ("Font Atlas", 2D) = "white" {} + _FaceTex ("Font Texture", 2D) = "white" {} + [HDR]_FaceColor ("Text Color", Color) = (1,1,1,1) + + _VertexOffsetX ("Vertex OffsetX", float) = 0 + _VertexOffsetY ("Vertex OffsetY", float) = 0 + _MaskSoftnessX ("Mask SoftnessX", float) = 0 + _MaskSoftnessY ("Mask SoftnessY", float) = 0 + + _ClipRect("Clip Rect", vector) = (-32767, -32767, 32767, 32767) + _Padding ("Padding", float) = 0 + + _StencilComp("Stencil Comparison", Float) = 8 + _Stencil("Stencil ID", Float) = 0 + _StencilOp("Stencil Operation", Float) = 0 + _StencilWriteMask("Stencil Write Mask", Float) = 255 + _StencilReadMask("Stencil Read Mask", Float) = 255 + + _CullMode("Cull Mode", Float) = 0 + _ColorMask("Color Mask", Float) = 15 +} + +SubShader{ + + Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" } + + Stencil + { + Ref[_Stencil] + Comp[_StencilComp] + Pass[_StencilOp] + ReadMask[_StencilReadMask] + WriteMask[_StencilWriteMask] + } + + + Lighting Off + Cull [_CullMode] + ZTest [unity_GUIZTestMode] + ZWrite Off + Fog { Mode Off } + Blend SrcAlpha OneMinusSrcAlpha + ColorMask[_ColorMask] + + Pass { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile __ UNITY_UI_CLIP_RECT + #pragma multi_compile __ UNITY_UI_ALPHACLIP + + + #include "UnityCG.cginc" + + struct appdata_t { + float4 vertex : POSITION; + fixed4 color : COLOR; + float2 texcoord0 : TEXCOORD0; + float2 texcoord1 : TEXCOORD1; + }; + + struct v2f { + float4 vertex : SV_POSITION; + fixed4 color : COLOR; + float2 texcoord0 : TEXCOORD0; + float2 texcoord1 : TEXCOORD1; + float4 mask : TEXCOORD2; + }; + + uniform sampler2D _MainTex; + uniform sampler2D _FaceTex; + uniform float4 _FaceTex_ST; + uniform fixed4 _FaceColor; + + uniform float _VertexOffsetX; + uniform float _VertexOffsetY; + uniform float4 _ClipRect; + uniform float _MaskSoftnessX; + uniform float _MaskSoftnessY; + + float2 UnpackUV(float uv) + { + float2 output; + output.x = floor(uv / 4096); + output.y = uv - 4096 * output.x; + + return output * 0.001953125; + } + + v2f vert (appdata_t v) + { + float4 vert = v.vertex; + vert.x += _VertexOffsetX; + vert.y += _VertexOffsetY; + + vert.xy += (vert.w * 0.5) / _ScreenParams.xy; + + float4 vPosition = UnityPixelSnap(UnityObjectToClipPos(vert)); + + fixed4 faceColor = v.color; + faceColor *= _FaceColor; + + v2f OUT; + OUT.vertex = vPosition; + OUT.color = faceColor; + OUT.texcoord0 = v.texcoord0; + OUT.texcoord1 = TRANSFORM_TEX(UnpackUV(v.texcoord1), _FaceTex); + float2 pixelSize = vPosition.w; + pixelSize /= abs(float2(_ScreenParams.x * UNITY_MATRIX_P[0][0], _ScreenParams.y * UNITY_MATRIX_P[1][1])); + + // Clamp _ClipRect to 16bit. + float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); + OUT.mask = float4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)); + + return OUT; + } + + fixed4 frag (v2f IN) : SV_Target + { + fixed4 color = tex2D(_MainTex, IN.texcoord0) * tex2D(_FaceTex, IN.texcoord1) * IN.color; + + // Alternative implementation to UnityGet2DClipping with support for softness. + #if UNITY_UI_CLIP_RECT + half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(IN.mask.xy)) * IN.mask.zw); + color *= m.x * m.y; + #endif + + #if UNITY_UI_ALPHACLIP + clip(color.a - 0.001); + #endif + + return color; + } + ENDCG + } +} + + CustomEditor "TMPro.EditorUtilities.TMP_BitmapShaderGUI" +} diff --git a/Assets/GameMain/Fonts/Shaders/TMP_Bitmap-Custom-Atlas.shader.meta b/Assets/GameMain/Fonts/Shaders/TMP_Bitmap-Custom-Atlas.shader.meta new file mode 100644 index 0000000..a0e6fef --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_Bitmap-Custom-Atlas.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b6539f2b0fa989d4fb7e057799b9260d +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Fonts/Shaders/TMP_Bitmap-Mobile.shader b/Assets/GameMain/Fonts/Shaders/TMP_Bitmap-Mobile.shader new file mode 100644 index 0000000..006a271 --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_Bitmap-Mobile.shader @@ -0,0 +1,145 @@ +Shader "TextMeshPro/Mobile/Bitmap" { + +Properties { + _MainTex ("Font Atlas", 2D) = "white" {} + [HDR]_Color ("Text Color", Color) = (1,1,1,1) + _DiffusePower ("Diffuse Power", Range(1.0,4.0)) = 1.0 + + _VertexOffsetX("Vertex OffsetX", float) = 0 + _VertexOffsetY("Vertex OffsetY", float) = 0 + _MaskSoftnessX("Mask SoftnessX", float) = 0 + _MaskSoftnessY("Mask SoftnessY", float) = 0 + + _ClipRect("Clip Rect", vector) = (-32767, -32767, 32767, 32767) + + _StencilComp("Stencil Comparison", Float) = 8 + _Stencil("Stencil ID", Float) = 0 + _StencilOp("Stencil Operation", Float) = 0 + _StencilWriteMask("Stencil Write Mask", Float) = 255 + _StencilReadMask("Stencil Read Mask", Float) = 255 + + _CullMode("Cull Mode", Float) = 0 + _ColorMask("Color Mask", Float) = 15 +} + +SubShader { + + Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } + + Stencil + { + Ref[_Stencil] + Comp[_StencilComp] + Pass[_StencilOp] + ReadMask[_StencilReadMask] + WriteMask[_StencilWriteMask] + } + + + Lighting Off + Cull [_CullMode] + ZTest [unity_GUIZTestMode] + ZWrite Off + Fog { Mode Off } + Blend SrcAlpha OneMinusSrcAlpha + ColorMask[_ColorMask] + + Pass { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma fragmentoption ARB_precision_hint_fastest + + #pragma multi_compile __ UNITY_UI_CLIP_RECT + #pragma multi_compile __ UNITY_UI_ALPHACLIP + + + #include "UnityCG.cginc" + + struct appdata_t { + float4 vertex : POSITION; + fixed4 color : COLOR; + float2 texcoord0 : TEXCOORD0; + float2 texcoord1 : TEXCOORD1; + }; + + struct v2f { + float4 vertex : POSITION; + fixed4 color : COLOR; + float2 texcoord0 : TEXCOORD0; + float4 mask : TEXCOORD2; + }; + + sampler2D _MainTex; + fixed4 _Color; + float _DiffusePower; + + uniform float _VertexOffsetX; + uniform float _VertexOffsetY; + uniform float4 _ClipRect; + uniform float _MaskSoftnessX; + uniform float _MaskSoftnessY; + + v2f vert (appdata_t v) + { + v2f OUT; + float4 vert = v.vertex; + vert.x += _VertexOffsetX; + vert.y += _VertexOffsetY; + + vert.xy += (vert.w * 0.5) / _ScreenParams.xy; + + OUT.vertex = UnityPixelSnap(UnityObjectToClipPos(vert)); + OUT.color = v.color; + OUT.color *= _Color; + OUT.color.rgb *= _DiffusePower; + OUT.texcoord0 = v.texcoord0; + + float2 pixelSize = OUT.vertex.w; + //pixelSize /= abs(float2(_ScreenParams.x * UNITY_MATRIX_P[0][0], _ScreenParams.y * UNITY_MATRIX_P[1][1])); + + // Clamp _ClipRect to 16bit. + float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); + OUT.mask = float4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)); + + return OUT; + } + + fixed4 frag (v2f IN) : COLOR + { + fixed4 color = fixed4(IN.color.rgb, IN.color.a * tex2D(_MainTex, IN.texcoord0).a); + + // Alternative implementation to UnityGet2DClipping with support for softness. + #if UNITY_UI_CLIP_RECT + half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(IN.mask.xy)) * IN.mask.zw); + color *= m.x * m.y; + #endif + + #if UNITY_UI_ALPHACLIP + clip(color.a - 0.001); + #endif + + return color; + } + ENDCG + } +} + +SubShader { + Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } + Lighting Off Cull Off ZTest Always ZWrite Off Fog { Mode Off } + Blend SrcAlpha OneMinusSrcAlpha + BindChannels { + Bind "Color", color + Bind "Vertex", vertex + Bind "TexCoord", texcoord0 + } + Pass { + SetTexture [_MainTex] { + constantColor [_Color] combine constant * primary, constant * texture + } + } +} + +CustomEditor "TMPro.EditorUtilities.TMP_BitmapShaderGUI" +} diff --git a/Assets/GameMain/Fonts/Shaders/TMP_Bitmap-Mobile.shader.meta b/Assets/GameMain/Fonts/Shaders/TMP_Bitmap-Mobile.shader.meta new file mode 100644 index 0000000..51ef45d --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_Bitmap-Mobile.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f06c2627a191cc1468383483fbafca04 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Fonts/Shaders/TMP_Bitmap.shader b/Assets/GameMain/Fonts/Shaders/TMP_Bitmap.shader new file mode 100644 index 0000000..8ce4937 --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_Bitmap.shader @@ -0,0 +1,143 @@ +Shader "TextMeshPro/Bitmap" { + +Properties { + _MainTex ("Font Atlas", 2D) = "white" {} + _FaceTex ("Font Texture", 2D) = "white" {} + [HDR]_FaceColor ("Text Color", Color) = (1,1,1,1) + + _VertexOffsetX ("Vertex OffsetX", float) = 0 + _VertexOffsetY ("Vertex OffsetY", float) = 0 + _MaskSoftnessX ("Mask SoftnessX", float) = 0 + _MaskSoftnessY ("Mask SoftnessY", float) = 0 + + _ClipRect("Clip Rect", vector) = (-32767, -32767, 32767, 32767) + + _StencilComp("Stencil Comparison", Float) = 8 + _Stencil("Stencil ID", Float) = 0 + _StencilOp("Stencil Operation", Float) = 0 + _StencilWriteMask("Stencil Write Mask", Float) = 255 + _StencilReadMask("Stencil Read Mask", Float) = 255 + + _CullMode("Cull Mode", Float) = 0 + _ColorMask("Color Mask", Float) = 15 +} + +SubShader{ + + Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" } + + Stencil + { + Ref[_Stencil] + Comp[_StencilComp] + Pass[_StencilOp] + ReadMask[_StencilReadMask] + WriteMask[_StencilWriteMask] + } + + + Lighting Off + Cull [_CullMode] + ZTest [unity_GUIZTestMode] + ZWrite Off + Fog { Mode Off } + Blend SrcAlpha OneMinusSrcAlpha + ColorMask[_ColorMask] + + Pass { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile __ UNITY_UI_CLIP_RECT + #pragma multi_compile __ UNITY_UI_ALPHACLIP + + + #include "UnityCG.cginc" + + struct appdata_t { + float4 vertex : POSITION; + fixed4 color : COLOR; + float2 texcoord0 : TEXCOORD0; + float2 texcoord1 : TEXCOORD1; + }; + + struct v2f { + float4 vertex : SV_POSITION; + fixed4 color : COLOR; + float2 texcoord0 : TEXCOORD0; + float2 texcoord1 : TEXCOORD1; + float4 mask : TEXCOORD2; + }; + + uniform sampler2D _MainTex; + uniform sampler2D _FaceTex; + uniform float4 _FaceTex_ST; + uniform fixed4 _FaceColor; + + uniform float _VertexOffsetX; + uniform float _VertexOffsetY; + uniform float4 _ClipRect; + uniform float _MaskSoftnessX; + uniform float _MaskSoftnessY; + + float2 UnpackUV(float uv) + { + float2 output; + output.x = floor(uv / 4096); + output.y = uv - 4096 * output.x; + + return output * 0.001953125; + } + + v2f vert (appdata_t v) + { + float4 vert = v.vertex; + vert.x += _VertexOffsetX; + vert.y += _VertexOffsetY; + + vert.xy += (vert.w * 0.5) / _ScreenParams.xy; + + float4 vPosition = UnityPixelSnap(UnityObjectToClipPos(vert)); + + fixed4 faceColor = v.color; + faceColor *= _FaceColor; + + v2f OUT; + OUT.vertex = vPosition; + OUT.color = faceColor; + OUT.texcoord0 = v.texcoord0; + OUT.texcoord1 = TRANSFORM_TEX(UnpackUV(v.texcoord1), _FaceTex); + float2 pixelSize = vPosition.w; + pixelSize /= abs(float2(_ScreenParams.x * UNITY_MATRIX_P[0][0], _ScreenParams.y * UNITY_MATRIX_P[1][1])); + + // Clamp _ClipRect to 16bit. + float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); + OUT.mask = float4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)); + + return OUT; + } + + fixed4 frag (v2f IN) : SV_Target + { + fixed4 color = tex2D(_MainTex, IN.texcoord0); + color = fixed4 (tex2D(_FaceTex, IN.texcoord1).rgb * IN.color.rgb, IN.color.a * color.a); + + // Alternative implementation to UnityGet2DClipping with support for softness. + #if UNITY_UI_CLIP_RECT + half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(IN.mask.xy)) * IN.mask.zw); + color *= m.x * m.y; + #endif + + #if UNITY_UI_ALPHACLIP + clip(color.a - 0.001); + #endif + + return color; + } + ENDCG + } +} + + CustomEditor "TMPro.EditorUtilities.TMP_BitmapShaderGUI" +} diff --git a/Assets/GameMain/Fonts/Shaders/TMP_Bitmap.shader.meta b/Assets/GameMain/Fonts/Shaders/TMP_Bitmap.shader.meta new file mode 100644 index 0000000..f1e8c9b --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_Bitmap.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 6a58ea03d3bd54e428d969b85afa5680 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Fonts/Shaders/TMP_SDF Overlay.shader b/Assets/GameMain/Fonts/Shaders/TMP_SDF Overlay.shader new file mode 100644 index 0000000..c50c593 --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_SDF Overlay.shader @@ -0,0 +1,317 @@ +Shader "TextMeshPro/Distance Field Overlay" { + +Properties { + _FaceTex ("Face Texture", 2D) = "white" {} + _FaceUVSpeedX ("Face UV Speed X", Range(-5, 5)) = 0.0 + _FaceUVSpeedY ("Face UV Speed Y", Range(-5, 5)) = 0.0 + [HDR]_FaceColor ("Face Color", Color) = (1,1,1,1) + _FaceDilate ("Face Dilate", Range(-1,1)) = 0 + + [HDR]_OutlineColor ("Outline Color", Color) = (0,0,0,1) + _OutlineTex ("Outline Texture", 2D) = "white" {} + _OutlineUVSpeedX ("Outline UV Speed X", Range(-5, 5)) = 0.0 + _OutlineUVSpeedY ("Outline UV Speed Y", Range(-5, 5)) = 0.0 + _OutlineWidth ("Outline Thickness", Range(0, 1)) = 0 + _OutlineSoftness ("Outline Softness", Range(0,1)) = 0 + + _Bevel ("Bevel", Range(0,1)) = 0.5 + _BevelOffset ("Bevel Offset", Range(-0.5,0.5)) = 0 + _BevelWidth ("Bevel Width", Range(-.5,0.5)) = 0 + _BevelClamp ("Bevel Clamp", Range(0,1)) = 0 + _BevelRoundness ("Bevel Roundness", Range(0,1)) = 0 + + _LightAngle ("Light Angle", Range(0.0, 6.2831853)) = 3.1416 + [HDR]_SpecularColor ("Specular", Color) = (1,1,1,1) + _SpecularPower ("Specular", Range(0,4)) = 2.0 + _Reflectivity ("Reflectivity", Range(5.0,15.0)) = 10 + _Diffuse ("Diffuse", Range(0,1)) = 0.5 + _Ambient ("Ambient", Range(1,0)) = 0.5 + + _BumpMap ("Normal map", 2D) = "bump" {} + _BumpOutline ("Bump Outline", Range(0,1)) = 0 + _BumpFace ("Bump Face", Range(0,1)) = 0 + + _ReflectFaceColor ("Reflection Color", Color) = (0,0,0,1) + _ReflectOutlineColor("Reflection Color", Color) = (0,0,0,1) + _Cube ("Reflection Cubemap", Cube) = "black" { /* TexGen CubeReflect */ } + _EnvMatrixRotation ("Texture Rotation", vector) = (0, 0, 0, 0) + + + [HDR]_UnderlayColor ("Border Color", Color) = (0,0,0, 0.5) + _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0 + _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0 + _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0 + _UnderlaySoftness ("Border Softness", Range(0,1)) = 0 + + [HDR]_GlowColor ("Color", Color) = (0, 1, 0, 0.5) + _GlowOffset ("Offset", Range(-1,1)) = 0 + _GlowInner ("Inner", Range(0,1)) = 0.05 + _GlowOuter ("Outer", Range(0,1)) = 0.05 + _GlowPower ("Falloff", Range(1, 0)) = 0.75 + + _WeightNormal ("Weight Normal", float) = 0 + _WeightBold ("Weight Bold", float) = 0.5 + + _ShaderFlags ("Flags", float) = 0 + _ScaleRatioA ("Scale RatioA", float) = 1 + _ScaleRatioB ("Scale RatioB", float) = 1 + _ScaleRatioC ("Scale RatioC", float) = 1 + + _MainTex ("Font Atlas", 2D) = "white" {} + _TextureWidth ("Texture Width", float) = 512 + _TextureHeight ("Texture Height", float) = 512 + _GradientScale ("Gradient Scale", float) = 5.0 + _ScaleX ("Scale X", float) = 1.0 + _ScaleY ("Scale Y", float) = 1.0 + _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875 + _Sharpness ("Sharpness", Range(-1,1)) = 0 + + _VertexOffsetX ("Vertex OffsetX", float) = 0 + _VertexOffsetY ("Vertex OffsetY", float) = 0 + + _MaskCoord ("Mask Coordinates", vector) = (0, 0, 32767, 32767) + _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) + _MaskSoftnessX ("Mask SoftnessX", float) = 0 + _MaskSoftnessY ("Mask SoftnessY", float) = 0 + + _StencilComp ("Stencil Comparison", Float) = 8 + _Stencil ("Stencil ID", Float) = 0 + _StencilOp ("Stencil Operation", Float) = 0 + _StencilWriteMask ("Stencil Write Mask", Float) = 255 + _StencilReadMask ("Stencil Read Mask", Float) = 255 + + _CullMode ("Cull Mode", Float) = 0 + _ColorMask ("Color Mask", Float) = 15 +} + +SubShader { + + Tags + { + "Queue"="Overlay" + "IgnoreProjector"="True" + "RenderType"="Transparent" + } + + Stencil + { + Ref [_Stencil] + Comp [_StencilComp] + Pass [_StencilOp] + ReadMask [_StencilReadMask] + WriteMask [_StencilWriteMask] + } + + Cull [_CullMode] + ZWrite Off + Lighting Off + Fog { Mode Off } + ZTest Always + Blend One OneMinusSrcAlpha + ColorMask [_ColorMask] + + Pass { + CGPROGRAM + #pragma target 3.0 + #pragma vertex VertShader + #pragma fragment PixShader + #pragma shader_feature __ BEVEL_ON + #pragma shader_feature __ UNDERLAY_ON UNDERLAY_INNER + #pragma shader_feature __ GLOW_ON + + #pragma multi_compile __ UNITY_UI_CLIP_RECT + #pragma multi_compile __ UNITY_UI_ALPHACLIP + + #include "UnityCG.cginc" + #include "UnityUI.cginc" + #include "TMPro_Properties.cginc" + #include "TMPro.cginc" + + struct vertex_t { + UNITY_VERTEX_INPUT_INSTANCE_ID + float4 position : POSITION; + float3 normal : NORMAL; + fixed4 color : COLOR; + float2 texcoord0 : TEXCOORD0; + float2 texcoord1 : TEXCOORD1; + }; + + + struct pixel_t { + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + float4 position : SV_POSITION; + fixed4 color : COLOR; + float2 atlas : TEXCOORD0; // Atlas + float4 param : TEXCOORD1; // alphaClip, scale, bias, weight + float4 mask : TEXCOORD2; // Position in object space(xy), pixel Size(zw) + float3 viewDir : TEXCOORD3; + + #if (UNDERLAY_ON || UNDERLAY_INNER) + float4 texcoord2 : TEXCOORD4; // u,v, scale, bias + fixed4 underlayColor : COLOR1; + #endif + float4 textures : TEXCOORD5; + }; + + // Used by Unity internally to handle Texture Tiling and Offset. + float4 _FaceTex_ST; + float4 _OutlineTex_ST; + + pixel_t VertShader(vertex_t input) + { + pixel_t output; + + UNITY_INITIALIZE_OUTPUT(pixel_t, output); + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input,output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + float bold = step(input.texcoord1.y, 0); + + float4 vert = input.position; + vert.x += _VertexOffsetX; + vert.y += _VertexOffsetY; + + float4 vPosition = UnityObjectToClipPos(vert); + + float2 pixelSize = vPosition.w; + pixelSize /= float2(_ScaleX, _ScaleY) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy)); + float scale = rsqrt(dot(pixelSize, pixelSize)); + scale *= abs(input.texcoord1.y) * _GradientScale * (_Sharpness + 1); + if (UNITY_MATRIX_P[3][3] == 0) scale = lerp(abs(scale) * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(input.normal.xyz), normalize(WorldSpaceViewDir(vert))))); + + float weight = lerp(_WeightNormal, _WeightBold, bold) / 4.0; + weight = (weight + _FaceDilate) * _ScaleRatioA * 0.5; + + float bias =(.5 - weight) + (.5 / scale); + + float alphaClip = (1.0 - _OutlineWidth*_ScaleRatioA - _OutlineSoftness*_ScaleRatioA); + + #if GLOW_ON + alphaClip = min(alphaClip, 1.0 - _GlowOffset * _ScaleRatioB - _GlowOuter * _ScaleRatioB); + #endif + + alphaClip = alphaClip / 2.0 - ( .5 / scale) - weight; + + #if (UNDERLAY_ON || UNDERLAY_INNER) + float4 underlayColor = _UnderlayColor; + underlayColor.rgb *= underlayColor.a; + + float bScale = scale; + bScale /= 1 + ((_UnderlaySoftness*_ScaleRatioC) * bScale); + float bBias = (0.5 - weight) * bScale - 0.5 - ((_UnderlayDilate * _ScaleRatioC) * 0.5 * bScale); + + float x = -(_UnderlayOffsetX * _ScaleRatioC) * _GradientScale / _TextureWidth; + float y = -(_UnderlayOffsetY * _ScaleRatioC) * _GradientScale / _TextureHeight; + float2 bOffset = float2(x, y); + #endif + + // Generate UV for the Masking Texture + float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); + float2 maskUV = (vert.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy); + + // Support for texture tiling and offset + float2 textureUV = UnpackUV(input.texcoord1.x); + float2 faceUV = TRANSFORM_TEX(textureUV, _FaceTex); + float2 outlineUV = TRANSFORM_TEX(textureUV, _OutlineTex); + + + output.position = vPosition; + output.color = input.color; + output.atlas = input.texcoord0; + output.param = float4(alphaClip, scale, bias, weight); + output.mask = half4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)); + output.viewDir = mul((float3x3)_EnvMatrix, _WorldSpaceCameraPos.xyz - mul(unity_ObjectToWorld, vert).xyz); + #if (UNDERLAY_ON || UNDERLAY_INNER) + output.texcoord2 = float4(input.texcoord0 + bOffset, bScale, bBias); + output.underlayColor = underlayColor; + #endif + output.textures = float4(faceUV, outlineUV); + + return output; + } + + + fixed4 PixShader(pixel_t input) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(input); + + float c = tex2D(_MainTex, input.atlas).a; + + #ifndef UNDERLAY_ON + clip(c - input.param.x); + #endif + + float scale = input.param.y; + float bias = input.param.z; + float weight = input.param.w; + float sd = (bias - c) * scale; + + float outline = (_OutlineWidth * _ScaleRatioA) * scale; + float softness = (_OutlineSoftness * _ScaleRatioA) * scale; + + half4 faceColor = _FaceColor; + half4 outlineColor = _OutlineColor; + + faceColor.rgb *= input.color.rgb; + + faceColor *= tex2D(_FaceTex, input.textures.xy + float2(_FaceUVSpeedX, _FaceUVSpeedY) * _Time.y); + outlineColor *= tex2D(_OutlineTex, input.textures.zw + float2(_OutlineUVSpeedX, _OutlineUVSpeedY) * _Time.y); + + faceColor = GetColor(sd, faceColor, outlineColor, outline, softness); + + #if BEVEL_ON + float3 dxy = float3(0.5 / _TextureWidth, 0.5 / _TextureHeight, 0); + float3 n = GetSurfaceNormal(input.atlas, weight, dxy); + + float3 bump = UnpackNormal(tex2D(_BumpMap, input.textures.xy + float2(_FaceUVSpeedX, _FaceUVSpeedY) * _Time.y)).xyz; + bump *= lerp(_BumpFace, _BumpOutline, saturate(sd + outline * 0.5)); + n = normalize(n- bump); + + float3 light = normalize(float3(sin(_LightAngle), cos(_LightAngle), -1.0)); + + float3 col = GetSpecular(n, light); + faceColor.rgb += col*faceColor.a; + faceColor.rgb *= 1-(dot(n, light)*_Diffuse); + faceColor.rgb *= lerp(_Ambient, 1, n.z*n.z); + + fixed4 reflcol = texCUBE(_Cube, reflect(input.viewDir, -n)); + faceColor.rgb += reflcol.rgb * lerp(_ReflectFaceColor.rgb, _ReflectOutlineColor.rgb, saturate(sd + outline * 0.5)) * faceColor.a; + #endif + + #if UNDERLAY_ON + float d = tex2D(_MainTex, input.texcoord2.xy).a * input.texcoord2.z; + faceColor += input.underlayColor * saturate(d - input.texcoord2.w) * (1 - faceColor.a); + #endif + + #if UNDERLAY_INNER + float d = tex2D(_MainTex, input.texcoord2.xy).a * input.texcoord2.z; + faceColor += input.underlayColor * (1 - saturate(d - input.texcoord2.w)) * saturate(1 - sd) * (1 - faceColor.a); + #endif + + #if GLOW_ON + float4 glowColor = GetGlowColor(sd, scale); + faceColor.rgb += glowColor.rgb * glowColor.a; + #endif + + // Alternative implementation to UnityGet2DClipping with support for softness. + #if UNITY_UI_CLIP_RECT + half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw); + faceColor *= m.x * m.y; + #endif + + #if UNITY_UI_ALPHACLIP + clip(faceColor.a - 0.001); + #endif + + return faceColor * input.color.a; + } + + ENDCG + } +} + +Fallback "TextMeshPro/Mobile/Distance Field" +CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI" +} diff --git a/Assets/GameMain/Fonts/Shaders/TMP_SDF Overlay.shader.meta b/Assets/GameMain/Fonts/Shaders/TMP_SDF Overlay.shader.meta new file mode 100644 index 0000000..4a454e0 --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_SDF Overlay.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1be7b5c5ed8a01f49b26f30ee2146240 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Fonts/Shaders/TMP_SDF SSD.shader b/Assets/GameMain/Fonts/Shaders/TMP_SDF SSD.shader new file mode 100644 index 0000000..ed48574 --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_SDF SSD.shader @@ -0,0 +1,310 @@ +Shader "TextMeshPro/Distance Field SSD" { + +Properties { + _FaceTex ("Face Texture", 2D) = "white" {} + _FaceUVSpeedX ("Face UV Speed X", Range(-5, 5)) = 0.0 + _FaceUVSpeedY ("Face UV Speed Y", Range(-5, 5)) = 0.0 + [HDR]_FaceColor ("Face Color", Color) = (1,1,1,1) + _FaceDilate ("Face Dilate", Range(-1,1)) = 0 + + [HDR]_OutlineColor ("Outline Color", Color) = (0,0,0,1) + _OutlineTex ("Outline Texture", 2D) = "white" {} + _OutlineUVSpeedX ("Outline UV Speed X", Range(-5, 5)) = 0.0 + _OutlineUVSpeedY ("Outline UV Speed Y", Range(-5, 5)) = 0.0 + _OutlineWidth ("Outline Thickness", Range(0, 1)) = 0 + _OutlineSoftness ("Outline Softness", Range(0,1)) = 0 + + _Bevel ("Bevel", Range(0,1)) = 0.5 + _BevelOffset ("Bevel Offset", Range(-0.5,0.5)) = 0 + _BevelWidth ("Bevel Width", Range(-.5,0.5)) = 0 + _BevelClamp ("Bevel Clamp", Range(0,1)) = 0 + _BevelRoundness ("Bevel Roundness", Range(0,1)) = 0 + + _LightAngle ("Light Angle", Range(0.0, 6.2831853)) = 3.1416 + [HDR]_SpecularColor ("Specular", Color) = (1,1,1,1) + _SpecularPower ("Specular", Range(0,4)) = 2.0 + _Reflectivity ("Reflectivity", Range(5.0,15.0)) = 10 + _Diffuse ("Diffuse", Range(0,1)) = 0.5 + _Ambient ("Ambient", Range(1,0)) = 0.5 + + _BumpMap ("Normal map", 2D) = "bump" {} + _BumpOutline ("Bump Outline", Range(0,1)) = 0 + _BumpFace ("Bump Face", Range(0,1)) = 0 + + _ReflectFaceColor ("Reflection Color", Color) = (0,0,0,1) + _ReflectOutlineColor("Reflection Color", Color) = (0,0,0,1) + _Cube ("Reflection Cubemap", Cube) = "black" { /* TexGen CubeReflect */ } + _EnvMatrixRotation ("Texture Rotation", vector) = (0, 0, 0, 0) + + + [HDR]_UnderlayColor ("Border Color", Color) = (0,0,0, 0.5) + _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0 + _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0 + _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0 + _UnderlaySoftness ("Border Softness", Range(0,1)) = 0 + + [HDR]_GlowColor ("Color", Color) = (0, 1, 0, 0.5) + _GlowOffset ("Offset", Range(-1,1)) = 0 + _GlowInner ("Inner", Range(0,1)) = 0.05 + _GlowOuter ("Outer", Range(0,1)) = 0.05 + _GlowPower ("Falloff", Range(1, 0)) = 0.75 + + _WeightNormal ("Weight Normal", float) = 0 + _WeightBold ("Weight Bold", float) = 0.5 + + _ShaderFlags ("Flags", float) = 0 + _ScaleRatioA ("Scale RatioA", float) = 1 + _ScaleRatioB ("Scale RatioB", float) = 1 + _ScaleRatioC ("Scale RatioC", float) = 1 + + _MainTex ("Font Atlas", 2D) = "white" {} + _TextureWidth ("Texture Width", float) = 512 + _TextureHeight ("Texture Height", float) = 512 + _GradientScale ("Gradient Scale", float) = 5.0 + _ScaleX ("Scale X", float) = 1.0 + _ScaleY ("Scale Y", float) = 1.0 + _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875 + _Sharpness ("Sharpness", Range(-1,1)) = 0 + + _VertexOffsetX ("Vertex OffsetX", float) = 0 + _VertexOffsetY ("Vertex OffsetY", float) = 0 + + _MaskCoord ("Mask Coordinates", vector) = (0, 0, 32767, 32767) + _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) + _MaskSoftnessX ("Mask SoftnessX", float) = 0 + _MaskSoftnessY ("Mask SoftnessY", float) = 0 + + _StencilComp ("Stencil Comparison", Float) = 8 + _Stencil ("Stencil ID", Float) = 0 + _StencilOp ("Stencil Operation", Float) = 0 + _StencilWriteMask ("Stencil Write Mask", Float) = 255 + _StencilReadMask ("Stencil Read Mask", Float) = 255 + + _CullMode ("Cull Mode", Float) = 0 + _ColorMask ("Color Mask", Float) = 15 +} + +SubShader { + Tags + { + "Queue" = "Transparent" + "IgnoreProjector" = "True" + "RenderType" = "Transparent" + } + + Stencil + { + Ref[_Stencil] + Comp[_StencilComp] + Pass[_StencilOp] + ReadMask[_StencilReadMask] + WriteMask[_StencilWriteMask] + } + + Cull[_CullMode] + ZWrite Off + Lighting Off + Fog { Mode Off } + ZTest[unity_GUIZTestMode] + Blend One OneMinusSrcAlpha + ColorMask[_ColorMask] + + Pass { + CGPROGRAM + #pragma target 3.0 + #pragma vertex VertShader + #pragma fragment PixShader + #pragma shader_feature __ BEVEL_ON + #pragma shader_feature __ UNDERLAY_ON UNDERLAY_INNER + #pragma shader_feature __ GLOW_ON + #pragma shader_feature __ FORCE_LINEAR + + #pragma multi_compile __ UNITY_UI_CLIP_RECT + #pragma multi_compile __ UNITY_UI_ALPHACLIP + + #include "UnityCG.cginc" + #include "UnityUI.cginc" + #include "TMPro_Properties.cginc" + #include "TMPro.cginc" + + struct vertex_t { + UNITY_VERTEX_INPUT_INSTANCE_ID + float4 position : POSITION; + float3 normal : NORMAL; + float4 color : COLOR; + float2 texcoord0 : TEXCOORD0; + float2 texcoord1 : TEXCOORD1; + }; + + + struct pixel_t { + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + float4 position : SV_POSITION; + float4 color : COLOR; + float2 atlas : TEXCOORD0; + float weight : TEXCOORD1; + float2 mask : TEXCOORD2; // Position in object space(xy) + float3 viewDir : TEXCOORD3; + + #if (UNDERLAY_ON || UNDERLAY_INNER) + float2 texcoord2 : TEXCOORD4; + float4 underlayColor : COLOR1; + #endif + float4 textures : TEXCOORD5; + }; + + // Used by Unity internally to handle Texture Tiling and Offset. + float4 _FaceTex_ST; + float4 _OutlineTex_ST; + + float4 SRGBToLinear(float4 rgba) { + return float4(lerp(rgba.rgb / 12.92f, pow((rgba.rgb + 0.055f) / 1.055f, 2.4f), step(0.04045f, rgba.rgb)), rgba.a); + } + + pixel_t VertShader(vertex_t input) + { + pixel_t output; + + UNITY_INITIALIZE_OUTPUT(pixel_t, output); + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input,output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + float bold = step(input.texcoord1.y, 0); + + float4 vert = input.position; + vert.x += _VertexOffsetX; + vert.y += _VertexOffsetY; + + float4 vPosition = UnityObjectToClipPos(vert); + + float weight = lerp(_WeightNormal, _WeightBold, bold) / 4.0; + weight = (weight + _FaceDilate) * _ScaleRatioA * 0.5; + + #if (UNDERLAY_ON || UNDERLAY_INNER) + float4 underlayColor = _UnderlayColor; + underlayColor.rgb *= underlayColor.a; + + float x = -(_UnderlayOffsetX * _ScaleRatioC) * _GradientScale / _TextureWidth; + float y = -(_UnderlayOffsetY * _ScaleRatioC) * _GradientScale / _TextureHeight; + float2 bOffset = float2(x, y); + #endif + + // Generate UV for the Masking Texture + float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); + + // Support for texture tiling and offset + float2 textureUV = UnpackUV(input.texcoord1.x); + float2 faceUV = TRANSFORM_TEX(textureUV, _FaceTex); + float2 outlineUV = TRANSFORM_TEX(textureUV, _OutlineTex); + + float4 color = input.color; + #if (FORCE_LINEAR && !UNITY_COLORSPACE_GAMMA) + color = SRGBToLinear(input.color); + #endif + + output.position = vPosition; + output.color = color; + output.atlas = input.texcoord0; + output.weight = weight; + output.mask = half2(vert.xy * 2 - clampedRect.xy - clampedRect.zw); + output.viewDir = mul((float3x3)_EnvMatrix, _WorldSpaceCameraPos.xyz - mul(unity_ObjectToWorld, vert).xyz); + #if (UNDERLAY_ON || UNDERLAY_INNER) + output.texcoord2 = input.texcoord0 + bOffset; + output.underlayColor = underlayColor; + #endif + output.textures = float4(faceUV, outlineUV); + + return output; + } + + + fixed4 PixShader(pixel_t input) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(input); + + float c = tex2D(_MainTex, input.atlas).a; + + float2 pixelSize = float2(ddx(input.atlas.y), ddy(input.atlas.y)); + pixelSize *= _TextureWidth * .75; + float scale = rsqrt(dot(pixelSize, pixelSize)) * _GradientScale * (_Sharpness + 1); + + float weight = input.weight; + float bias = (.5 - weight) + (.5 / scale); + float sd = (bias - c) * scale; + + float outline = (_OutlineWidth * _ScaleRatioA) * scale; + float softness = (_OutlineSoftness * _ScaleRatioA) * scale; + + half4 faceColor = _FaceColor; + half4 outlineColor = _OutlineColor; + + faceColor.rgb *= input.color.rgb; + + faceColor *= tex2D(_FaceTex, input.textures.xy + float2(_FaceUVSpeedX, _FaceUVSpeedY) * _Time.y); + outlineColor *= tex2D(_OutlineTex, input.textures.zw + float2(_OutlineUVSpeedX, _OutlineUVSpeedY) * _Time.y); + + faceColor = GetColor(sd, faceColor, outlineColor, outline, softness); + + #if BEVEL_ON + float3 dxy = float3(0.5 / _TextureWidth, 0.5 / _TextureHeight, 0); + float3 n = GetSurfaceNormal(input.atlas, weight, dxy); + + float3 bump = UnpackNormal(tex2D(_BumpMap, input.textures.xy + float2(_FaceUVSpeedX, _FaceUVSpeedY) * _Time.y)).xyz; + bump *= lerp(_BumpFace, _BumpOutline, saturate(sd + outline * 0.5)); + n = normalize(n - bump); + + float3 light = normalize(float3(sin(_LightAngle), cos(_LightAngle), -1.0)); + + float3 col = GetSpecular(n, light); + faceColor.rgb += col * faceColor.a; + faceColor.rgb *= 1 - (dot(n, light) * _Diffuse); + faceColor.rgb *= lerp(_Ambient, 1, n.z * n.z); + + fixed4 reflcol = texCUBE(_Cube, reflect(input.viewDir, -n)); + faceColor.rgb += reflcol.rgb * lerp(_ReflectFaceColor.rgb, _ReflectOutlineColor.rgb, saturate(sd + outline * 0.5)) * faceColor.a; + #endif + + #if (UNDERLAY_ON || UNDERLAY_INNER) + float bScale = scale; + bScale /= 1 + ((_UnderlaySoftness * _ScaleRatioC) * bScale); + float bBias = (0.5 - weight) * bScale - 0.5 - ((_UnderlayDilate * _ScaleRatioC) * 0.5 * bScale); + #endif + + #if UNDERLAY_ON + float d = tex2D(_MainTex, input.texcoord2.xy).a * bScale; + faceColor += input.underlayColor * saturate(d - bBias) * (1 - faceColor.a); + #endif + + #if UNDERLAY_INNER + float d = tex2D(_MainTex, input.texcoord2.xy).a * bScale; + faceColor += input.underlayColor * (1 - saturate(d - bBias)) * saturate(1 - sd) * (1 - faceColor.a); + #endif + + #if GLOW_ON + float4 glowColor = GetGlowColor(sd, scale); + faceColor.rgb += glowColor.rgb * glowColor.a; + #endif + + // Alternative implementation to UnityGet2DClipping with support for softness. + #if UNITY_UI_CLIP_RECT + float2 maskZW = 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + (1 / scale)); + half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * maskZW); + faceColor *= m.x * m.y; + #endif + + #if UNITY_UI_ALPHACLIP + clip(faceColor.a - 0.001); + #endif + + return faceColor * input.color.a; + } + + ENDCG + } +} + +Fallback "TextMeshPro/Mobile/Distance Field" +CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI" +} diff --git a/Assets/GameMain/Fonts/Shaders/TMP_SDF SSD.shader.meta b/Assets/GameMain/Fonts/Shaders/TMP_SDF SSD.shader.meta new file mode 100644 index 0000000..97facd0 --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_SDF SSD.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f9ef7b3e3b869a348bce0a7852d93e79 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Fonts/Shaders/TMP_SDF-Mobile Masking.shader b/Assets/GameMain/Fonts/Shaders/TMP_SDF-Mobile Masking.shader new file mode 100644 index 0000000..7019aaf --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_SDF-Mobile Masking.shader @@ -0,0 +1,247 @@ +// Simplified SDF shader: +// - No Shading Option (bevel / bump / env map) +// - No Glow Option +// - Softness is applied on both side of the outline + +Shader "TextMeshPro/Mobile/Distance Field - Masking" { + +Properties { + [HDR]_FaceColor ("Face Color", Color) = (1,1,1,1) + _FaceDilate ("Face Dilate", Range(-1,1)) = 0 + + [HDR]_OutlineColor ("Outline Color", Color) = (0,0,0,1) + _OutlineWidth ("Outline Thickness", Range(0,1)) = 0 + _OutlineSoftness ("Outline Softness", Range(0,1)) = 0 + + [HDR]_UnderlayColor ("Border Color", Color) = (0,0,0,.5) + _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0 + _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0 + _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0 + _UnderlaySoftness ("Border Softness", Range(0,1)) = 0 + + _WeightNormal ("Weight Normal", float) = 0 + _WeightBold ("Weight Bold", float) = .5 + + _ShaderFlags ("Flags", float) = 0 + _ScaleRatioA ("Scale RatioA", float) = 1 + _ScaleRatioB ("Scale RatioB", float) = 1 + _ScaleRatioC ("Scale RatioC", float) = 1 + + _MainTex ("Font Atlas", 2D) = "white" {} + _TextureWidth ("Texture Width", float) = 512 + _TextureHeight ("Texture Height", float) = 512 + _GradientScale ("Gradient Scale", float) = 5 + _ScaleX ("Scale X", float) = 1 + _ScaleY ("Scale Y", float) = 1 + _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875 + _Sharpness ("Sharpness", Range(-1,1)) = 0 + + _VertexOffsetX ("Vertex OffsetX", float) = 0 + _VertexOffsetY ("Vertex OffsetY", float) = 0 + + _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) + _MaskSoftnessX ("Mask SoftnessX", float) = 0 + _MaskSoftnessY ("Mask SoftnessY", float) = 0 + _MaskTex ("Mask Texture", 2D) = "white" {} + _MaskInverse ("Inverse", float) = 0 + _MaskEdgeColor ("Edge Color", Color) = (1,1,1,1) + _MaskEdgeSoftness ("Edge Softness", Range(0, 1)) = 0.01 + _MaskWipeControl ("Wipe Position", Range(0, 1)) = 0.5 + + _StencilComp ("Stencil Comparison", Float) = 8 + _Stencil ("Stencil ID", Float) = 0 + _StencilOp ("Stencil Operation", Float) = 0 + _StencilWriteMask ("Stencil Write Mask", Float) = 255 + _StencilReadMask ("Stencil Read Mask", Float) = 255 + + _CullMode ("Cull Mode", Float) = 0 + _ColorMask ("Color Mask", Float) = 15 +} + +SubShader { + Tags + { + "Queue"="Transparent" + "IgnoreProjector"="True" + "RenderType"="Transparent" + } + + + Stencil + { + Ref [_Stencil] + Comp [_StencilComp] + Pass [_StencilOp] + ReadMask [_StencilReadMask] + WriteMask [_StencilWriteMask] + } + + Cull [_CullMode] + ZWrite Off + Lighting Off + Fog { Mode Off } + ZTest [unity_GUIZTestMode] + Blend One OneMinusSrcAlpha + ColorMask [_ColorMask] + + Pass { + CGPROGRAM + #pragma vertex VertShader + #pragma fragment PixShader + #pragma shader_feature __ OUTLINE_ON + #pragma shader_feature __ UNDERLAY_ON UNDERLAY_INNER + + #pragma multi_compile __ UNITY_UI_CLIP_RECT + #pragma multi_compile __ UNITY_UI_ALPHACLIP + + + #include "UnityCG.cginc" + #include "UnityUI.cginc" + #include "TMPro_Properties.cginc" + + struct vertex_t { + float4 vertex : POSITION; + float3 normal : NORMAL; + fixed4 color : COLOR; + float2 texcoord0 : TEXCOORD0; + float2 texcoord1 : TEXCOORD1; + }; + + struct pixel_t { + float4 vertex : SV_POSITION; + fixed4 faceColor : COLOR; + fixed4 outlineColor : COLOR1; + float4 texcoord0 : TEXCOORD0; // Texture UV, Mask UV + half4 param : TEXCOORD1; // Scale(x), BiasIn(y), BiasOut(z), Bias(w) + half4 mask : TEXCOORD2; // Position in clip space(xy), Softness(zw) + #if (UNDERLAY_ON | UNDERLAY_INNER) + float4 texcoord1 : TEXCOORD3; // Texture UV, alpha, reserved + half2 underlayParam : TEXCOORD4; // Scale(x), Bias(y) + #endif + }; + + float _MaskWipeControl; + float _MaskEdgeSoftness; + fixed4 _MaskEdgeColor; + bool _MaskInverse; + + pixel_t VertShader(vertex_t input) + { + float bold = step(input.texcoord1.y, 0); + + float4 vert = input.vertex; + vert.x += _VertexOffsetX; + vert.y += _VertexOffsetY; + float4 vPosition = UnityObjectToClipPos(vert); + + float2 pixelSize = vPosition.w; + pixelSize /= float2(_ScaleX, _ScaleY) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy)); + + float scale = rsqrt(dot(pixelSize, pixelSize)); + scale *= abs(input.texcoord1.y) * _GradientScale * (_Sharpness + 1); + if(UNITY_MATRIX_P[3][3] == 0) scale = lerp(abs(scale) * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(input.normal.xyz), normalize(WorldSpaceViewDir(vert))))); + + float weight = lerp(_WeightNormal, _WeightBold, bold) / 4.0; + weight = (weight + _FaceDilate) * _ScaleRatioA * 0.5; + + float layerScale = scale; + + scale /= 1 + (_OutlineSoftness * _ScaleRatioA * scale); + float bias = (0.5 - weight) * scale - 0.5; + float outline = _OutlineWidth * _ScaleRatioA * 0.5 * scale; + + float opacity = input.color.a; + #if (UNDERLAY_ON | UNDERLAY_INNER) + opacity = 1.0; + #endif + + fixed4 faceColor = fixed4(input.color.rgb, opacity) * _FaceColor; + faceColor.rgb *= faceColor.a; + + fixed4 outlineColor = _OutlineColor; + outlineColor.a *= opacity; + outlineColor.rgb *= outlineColor.a; + outlineColor = lerp(faceColor, outlineColor, sqrt(min(1.0, (outline * 2)))); + + #if (UNDERLAY_ON | UNDERLAY_INNER) + + layerScale /= 1 + ((_UnderlaySoftness * _ScaleRatioC) * layerScale); + float layerBias = (.5 - weight) * layerScale - .5 - ((_UnderlayDilate * _ScaleRatioC) * .5 * layerScale); + + float x = -(_UnderlayOffsetX * _ScaleRatioC) * _GradientScale / _TextureWidth; + float y = -(_UnderlayOffsetY * _ScaleRatioC) * _GradientScale / _TextureHeight; + float2 layerOffset = float2(x, y); + #endif + + // Generate UV for the Masking Texture + float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); + float2 maskUV = (vert.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy); + + // Structure for pixel shader + pixel_t output = { + vPosition, + faceColor, + outlineColor, + float4(input.texcoord0.x, input.texcoord0.y, maskUV.x, maskUV.y), + half4(scale, bias - outline, bias + outline, bias), + half4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)), + #if (UNDERLAY_ON | UNDERLAY_INNER) + float4(input.texcoord0 + layerOffset, input.color.a, 0), + half2(layerScale, layerBias), + #endif + }; + + return output; + } + + + // PIXEL SHADER + fixed4 PixShader(pixel_t input) : SV_Target + { + half d = tex2D(_MainTex, input.texcoord0.xy).a * input.param.x; + half4 c = input.faceColor * saturate(d - input.param.w); + + #ifdef OUTLINE_ON + c = lerp(input.outlineColor, input.faceColor, saturate(d - input.param.z)); + c *= saturate(d - input.param.y); + #endif + + #if UNDERLAY_ON + d = tex2D(_MainTex, input.texcoord1.xy).a * input.underlayParam.x; + c += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * saturate(d - input.underlayParam.y) * (1 - c.a); + #endif + + #if UNDERLAY_INNER + half sd = saturate(d - input.param.z); + d = tex2D(_MainTex, input.texcoord1.xy).a * input.underlayParam.x; + c += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * (1 - saturate(d - input.underlayParam.y)) * sd * (1 - c.a); + #endif + + // Alternative implementation to UnityGet2DClipping with support for softness. + //#if UNITY_UI_CLIP_RECT + half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw); + c *= m.x * m.y; + //#endif + + float a = abs(_MaskInverse - tex2D(_MaskTex, input.texcoord0.zw).a); + float t = a + (1 - _MaskWipeControl) * _MaskEdgeSoftness - _MaskWipeControl; + a = saturate(t / _MaskEdgeSoftness); + c.rgb = lerp(_MaskEdgeColor.rgb*c.a, c.rgb, a); + c *= a; + + #if (UNDERLAY_ON | UNDERLAY_INNER) + c *= input.texcoord1.z; + #endif + + #if UNITY_UI_ALPHACLIP + clip(c.a - 0.001); + #endif + + return c; + } + ENDCG + } +} + +CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI" +} diff --git a/Assets/GameMain/Fonts/Shaders/TMP_SDF-Mobile Masking.shader.meta b/Assets/GameMain/Fonts/Shaders/TMP_SDF-Mobile Masking.shader.meta new file mode 100644 index 0000000..c47e690 --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_SDF-Mobile Masking.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 25229adaac96caa42a737b60465f3229 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Fonts/Shaders/TMP_SDF-Mobile Overlay.shader b/Assets/GameMain/Fonts/Shaders/TMP_SDF-Mobile Overlay.shader new file mode 100644 index 0000000..ce82bed --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_SDF-Mobile Overlay.shader @@ -0,0 +1,240 @@ +// Simplified SDF shader: +// - No Shading Option (bevel / bump / env map) +// - No Glow Option +// - Softness is applied on both side of the outline + +Shader "TextMeshPro/Mobile/Distance Field Overlay" { + +Properties { + [HDR]_FaceColor ("Face Color", Color) = (1,1,1,1) + _FaceDilate ("Face Dilate", Range(-1,1)) = 0 + + [HDR]_OutlineColor ("Outline Color", Color) = (0,0,0,1) + _OutlineWidth ("Outline Thickness", Range(0,1)) = 0 + _OutlineSoftness ("Outline Softness", Range(0,1)) = 0 + + [HDR]_UnderlayColor ("Border Color", Color) = (0,0,0,.5) + _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0 + _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0 + _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0 + _UnderlaySoftness ("Border Softness", Range(0,1)) = 0 + + _WeightNormal ("Weight Normal", float) = 0 + _WeightBold ("Weight Bold", float) = .5 + + _ShaderFlags ("Flags", float) = 0 + _ScaleRatioA ("Scale RatioA", float) = 1 + _ScaleRatioB ("Scale RatioB", float) = 1 + _ScaleRatioC ("Scale RatioC", float) = 1 + + _MainTex ("Font Atlas", 2D) = "white" {} + _TextureWidth ("Texture Width", float) = 512 + _TextureHeight ("Texture Height", float) = 512 + _GradientScale ("Gradient Scale", float) = 5 + _ScaleX ("Scale X", float) = 1 + _ScaleY ("Scale Y", float) = 1 + _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875 + _Sharpness ("Sharpness", Range(-1,1)) = 0 + + _VertexOffsetX ("Vertex OffsetX", float) = 0 + _VertexOffsetY ("Vertex OffsetY", float) = 0 + + _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) + _MaskSoftnessX ("Mask SoftnessX", float) = 0 + _MaskSoftnessY ("Mask SoftnessY", float) = 0 + + _StencilComp ("Stencil Comparison", Float) = 8 + _Stencil ("Stencil ID", Float) = 0 + _StencilOp ("Stencil Operation", Float) = 0 + _StencilWriteMask ("Stencil Write Mask", Float) = 255 + _StencilReadMask ("Stencil Read Mask", Float) = 255 + + _CullMode ("Cull Mode", Float) = 0 + _ColorMask ("Color Mask", Float) = 15 +} + +SubShader { + Tags + { + "Queue"="Overlay" + "IgnoreProjector"="True" + "RenderType"="Transparent" + } + + + Stencil + { + Ref [_Stencil] + Comp [_StencilComp] + Pass [_StencilOp] + ReadMask [_StencilReadMask] + WriteMask [_StencilWriteMask] + } + + Cull [_CullMode] + ZWrite Off + Lighting Off + Fog { Mode Off } + ZTest Always + Blend One OneMinusSrcAlpha + ColorMask [_ColorMask] + + Pass { + CGPROGRAM + #pragma vertex VertShader + #pragma fragment PixShader + #pragma shader_feature __ OUTLINE_ON + #pragma shader_feature __ UNDERLAY_ON UNDERLAY_INNER + + #pragma multi_compile __ UNITY_UI_CLIP_RECT + #pragma multi_compile __ UNITY_UI_ALPHACLIP + + #include "UnityCG.cginc" + #include "UnityUI.cginc" + #include "TMPro_Properties.cginc" + + struct vertex_t { + UNITY_VERTEX_INPUT_INSTANCE_ID + float4 vertex : POSITION; + float3 normal : NORMAL; + fixed4 color : COLOR; + float2 texcoord0 : TEXCOORD0; + float2 texcoord1 : TEXCOORD1; + }; + + struct pixel_t { + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + float4 vertex : SV_POSITION; + fixed4 faceColor : COLOR; + fixed4 outlineColor : COLOR1; + float4 texcoord0 : TEXCOORD0; // Texture UV, Mask UV + half4 param : TEXCOORD1; // Scale(x), BiasIn(y), BiasOut(z), Bias(w) + half4 mask : TEXCOORD2; // Position in clip space(xy), Softness(zw) + #if (UNDERLAY_ON | UNDERLAY_INNER) + float4 texcoord1 : TEXCOORD3; // Texture UV, alpha, reserved + half2 underlayParam : TEXCOORD4; // Scale(x), Bias(y) + #endif + }; + + + pixel_t VertShader(vertex_t input) + { + pixel_t output; + + UNITY_INITIALIZE_OUTPUT(pixel_t, output); + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + float bold = step(input.texcoord1.y, 0); + + float4 vert = input.vertex; + vert.x += _VertexOffsetX; + vert.y += _VertexOffsetY; + float4 vPosition = UnityObjectToClipPos(vert); + + float2 pixelSize = vPosition.w; + pixelSize /= float2(_ScaleX, _ScaleY) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy)); + + float scale = rsqrt(dot(pixelSize, pixelSize)); + scale *= abs(input.texcoord1.y) * _GradientScale * (_Sharpness + 1); + if(UNITY_MATRIX_P[3][3] == 0) scale = lerp(abs(scale) * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(input.normal.xyz), normalize(WorldSpaceViewDir(vert))))); + + float weight = lerp(_WeightNormal, _WeightBold, bold) / 4.0; + weight = (weight + _FaceDilate) * _ScaleRatioA * 0.5; + + float layerScale = scale; + + scale /= 1 + (_OutlineSoftness * _ScaleRatioA * scale); + float bias = (0.5 - weight) * scale - 0.5; + float outline = _OutlineWidth * _ScaleRatioA * 0.5 * scale; + + float opacity = input.color.a; + #if (UNDERLAY_ON | UNDERLAY_INNER) + opacity = 1.0; + #endif + + fixed4 faceColor = fixed4(input.color.rgb, opacity) * _FaceColor; + faceColor.rgb *= faceColor.a; + + fixed4 outlineColor = _OutlineColor; + outlineColor.a *= opacity; + outlineColor.rgb *= outlineColor.a; + outlineColor = lerp(faceColor, outlineColor, sqrt(min(1.0, (outline * 2)))); + + #if (UNDERLAY_ON | UNDERLAY_INNER) + layerScale /= 1 + ((_UnderlaySoftness * _ScaleRatioC) * layerScale); + float layerBias = (.5 - weight) * layerScale - .5 - ((_UnderlayDilate * _ScaleRatioC) * .5 * layerScale); + + float x = -(_UnderlayOffsetX * _ScaleRatioC) * _GradientScale / _TextureWidth; + float y = -(_UnderlayOffsetY * _ScaleRatioC) * _GradientScale / _TextureHeight; + float2 layerOffset = float2(x, y); + #endif + + // Generate UV for the Masking Texture + float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); + float2 maskUV = (vert.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy); + + // Populate structure for pixel shader + output.vertex = vPosition; + output.faceColor = faceColor; + output.outlineColor = outlineColor; + output.texcoord0 = float4(input.texcoord0.x, input.texcoord0.y, maskUV.x, maskUV.y); + output.param = half4(scale, bias - outline, bias + outline, bias); + output.mask = half4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)); + #if (UNDERLAY_ON || UNDERLAY_INNER) + output.texcoord1 = float4(input.texcoord0 + layerOffset, input.color.a, 0); + output.underlayParam = half2(layerScale, layerBias); + #endif + + return output; + } + + + // PIXEL SHADER + fixed4 PixShader(pixel_t input) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(input); + + half d = tex2D(_MainTex, input.texcoord0.xy).a * input.param.x; + half4 c = input.faceColor * saturate(d - input.param.w); + + #ifdef OUTLINE_ON + c = lerp(input.outlineColor, input.faceColor, saturate(d - input.param.z)); + c *= saturate(d - input.param.y); + #endif + + #if UNDERLAY_ON + d = tex2D(_MainTex, input.texcoord1.xy).a * input.underlayParam.x; + c += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * saturate(d - input.underlayParam.y) * (1 - c.a); + #endif + + #if UNDERLAY_INNER + half sd = saturate(d - input.param.z); + d = tex2D(_MainTex, input.texcoord1.xy).a * input.underlayParam.x; + c += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * (1 - saturate(d - input.underlayParam.y)) * sd * (1 - c.a); + #endif + + // Alternative implementation to UnityGet2DClipping with support for softness. + #if UNITY_UI_CLIP_RECT + half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw); + c *= m.x * m.y; + #endif + + #if (UNDERLAY_ON | UNDERLAY_INNER) + c *= input.texcoord1.z; + #endif + + #if UNITY_UI_ALPHACLIP + clip(c.a - 0.001); + #endif + + return c; + } + ENDCG + } +} + +CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI" +} diff --git a/Assets/GameMain/Fonts/Shaders/TMP_SDF-Mobile Overlay.shader.meta b/Assets/GameMain/Fonts/Shaders/TMP_SDF-Mobile Overlay.shader.meta new file mode 100644 index 0000000..0f0213f --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_SDF-Mobile Overlay.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 7f1361f834115be4ea4ec2387c67334e +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Fonts/Shaders/TMP_SDF-Mobile SSD.shader b/Assets/GameMain/Fonts/Shaders/TMP_SDF-Mobile SSD.shader new file mode 100644 index 0000000..df4d5b0 --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_SDF-Mobile SSD.shader @@ -0,0 +1,106 @@ +// Simplified SDF shader: +// - No Shading Option (bevel / bump / env map) +// - No Glow Option +// - Softness is applied on both side of the outline + +Shader "TextMeshPro/Mobile/Distance Field SSD" { + +Properties { + [HDR]_FaceColor ("Face Color", Color) = (1,1,1,1) + _FaceDilate ("Face Dilate", Range(-1,1)) = 0 + + [HDR]_OutlineColor ("Outline Color", Color) = (0,0,0,1) + _OutlineWidth ("Outline Thickness", Range(0,1)) = 0 + _OutlineSoftness ("Outline Softness", Range(0,1)) = 0 + + [HDR]_UnderlayColor ("Border Color", Color) = (0,0,0,.5) + _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0 + _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0 + _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0 + _UnderlaySoftness ("Border Softness", Range(0,1)) = 0 + + _WeightNormal ("Weight Normal", float) = 0 + _WeightBold ("Weight Bold", float) = .5 + + _ShaderFlags ("Flags", float) = 0 + _ScaleRatioA ("Scale RatioA", float) = 1 + _ScaleRatioB ("Scale RatioB", float) = 1 + _ScaleRatioC ("Scale RatioC", float) = 1 + + _MainTex ("Font Atlas", 2D) = "white" {} + _TextureWidth ("Texture Width", float) = 512 + _TextureHeight ("Texture Height", float) = 512 + _GradientScale ("Gradient Scale", float) = 5 + _ScaleX ("Scale X", float) = 1 + _ScaleY ("Scale Y", float) = 1 + _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875 + _Sharpness ("Sharpness", Range(-1,1)) = 0 + + _VertexOffsetX ("Vertex OffsetX", float) = 0 + _VertexOffsetY ("Vertex OffsetY", float) = 0 + + _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) + _MaskSoftnessX ("Mask SoftnessX", float) = 0 + _MaskSoftnessY ("Mask SoftnessY", float) = 0 + _MaskTex ("Mask Texture", 2D) = "white" {} + _MaskInverse ("Inverse", float) = 0 + _MaskEdgeColor ("Edge Color", Color) = (1,1,1,1) + _MaskEdgeSoftness ("Edge Softness", Range(0, 1)) = 0.01 + _MaskWipeControl ("Wipe Position", Range(0, 1)) = 0.5 + + _StencilComp ("Stencil Comparison", Float) = 8 + _Stencil ("Stencil ID", Float) = 0 + _StencilOp ("Stencil Operation", Float) = 0 + _StencilWriteMask ("Stencil Write Mask", Float) = 255 + _StencilReadMask ("Stencil Read Mask", Float) = 255 + + _CullMode ("Cull Mode", Float) = 0 + _ColorMask ("Color Mask", Float) = 15 +} + +SubShader { + Tags { + "Queue"="Transparent" + "IgnoreProjector"="True" + "RenderType"="Transparent" + } + + Stencil + { + Ref [_Stencil] + Comp [_StencilComp] + Pass [_StencilOp] + ReadMask [_StencilReadMask] + WriteMask [_StencilWriteMask] + } + + Cull [_CullMode] + ZWrite Off + Lighting Off + Fog { Mode Off } + ZTest [unity_GUIZTestMode] + Blend One OneMinusSrcAlpha + ColorMask [_ColorMask] + + Pass { + CGPROGRAM + #pragma vertex VertShader + #pragma fragment PixShader + #pragma shader_feature __ OUTLINE_ON + #pragma shader_feature __ UNDERLAY_ON UNDERLAY_INNER + + #pragma multi_compile __ UNITY_UI_CLIP_RECT + #pragma multi_compile __ UNITY_UI_ALPHACLIP + + #include "UnityCG.cginc" + #include "UnityUI.cginc" + #include "TMPro_Properties.cginc" + + #include "TMPro_Mobile.cginc" + + ENDCG + } +} + +CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI" +} diff --git a/Assets/GameMain/Fonts/Shaders/TMP_SDF-Mobile SSD.shader.meta b/Assets/GameMain/Fonts/Shaders/TMP_SDF-Mobile SSD.shader.meta new file mode 100644 index 0000000..b2b0403 --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_SDF-Mobile SSD.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1aeec1235e121cb46ba8ea88d1025009 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Fonts/Shaders/TMP_SDF-Mobile.shader b/Assets/GameMain/Fonts/Shaders/TMP_SDF-Mobile.shader new file mode 100644 index 0000000..d3f5866 --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_SDF-Mobile.shader @@ -0,0 +1,240 @@ +// Simplified SDF shader: +// - No Shading Option (bevel / bump / env map) +// - No Glow Option +// - Softness is applied on both side of the outline + +Shader "TextMeshPro/Mobile/Distance Field" { + +Properties { + [HDR]_FaceColor ("Face Color", Color) = (1,1,1,1) + _FaceDilate ("Face Dilate", Range(-1,1)) = 0 + + [HDR]_OutlineColor ("Outline Color", Color) = (0,0,0,1) + _OutlineWidth ("Outline Thickness", Range(0,1)) = 0 + _OutlineSoftness ("Outline Softness", Range(0,1)) = 0 + + [HDR]_UnderlayColor ("Border Color", Color) = (0,0,0,.5) + _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0 + _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0 + _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0 + _UnderlaySoftness ("Border Softness", Range(0,1)) = 0 + + _WeightNormal ("Weight Normal", float) = 0 + _WeightBold ("Weight Bold", float) = .5 + + _ShaderFlags ("Flags", float) = 0 + _ScaleRatioA ("Scale RatioA", float) = 1 + _ScaleRatioB ("Scale RatioB", float) = 1 + _ScaleRatioC ("Scale RatioC", float) = 1 + + _MainTex ("Font Atlas", 2D) = "white" {} + _TextureWidth ("Texture Width", float) = 512 + _TextureHeight ("Texture Height", float) = 512 + _GradientScale ("Gradient Scale", float) = 5 + _ScaleX ("Scale X", float) = 1 + _ScaleY ("Scale Y", float) = 1 + _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875 + _Sharpness ("Sharpness", Range(-1,1)) = 0 + + _VertexOffsetX ("Vertex OffsetX", float) = 0 + _VertexOffsetY ("Vertex OffsetY", float) = 0 + + _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) + _MaskSoftnessX ("Mask SoftnessX", float) = 0 + _MaskSoftnessY ("Mask SoftnessY", float) = 0 + + _StencilComp ("Stencil Comparison", Float) = 8 + _Stencil ("Stencil ID", Float) = 0 + _StencilOp ("Stencil Operation", Float) = 0 + _StencilWriteMask ("Stencil Write Mask", Float) = 255 + _StencilReadMask ("Stencil Read Mask", Float) = 255 + + _CullMode ("Cull Mode", Float) = 0 + _ColorMask ("Color Mask", Float) = 15 +} + +SubShader { + Tags + { + "Queue"="Transparent" + "IgnoreProjector"="True" + "RenderType"="Transparent" + } + + + Stencil + { + Ref [_Stencil] + Comp [_StencilComp] + Pass [_StencilOp] + ReadMask [_StencilReadMask] + WriteMask [_StencilWriteMask] + } + + Cull [_CullMode] + ZWrite Off + Lighting Off + Fog { Mode Off } + ZTest [unity_GUIZTestMode] + Blend One OneMinusSrcAlpha + ColorMask [_ColorMask] + + Pass { + CGPROGRAM + #pragma vertex VertShader + #pragma fragment PixShader + #pragma shader_feature __ OUTLINE_ON + #pragma shader_feature __ UNDERLAY_ON UNDERLAY_INNER + + #pragma multi_compile __ UNITY_UI_CLIP_RECT + #pragma multi_compile __ UNITY_UI_ALPHACLIP + + #include "UnityCG.cginc" + #include "UnityUI.cginc" + #include "TMPro_Properties.cginc" + + struct vertex_t { + UNITY_VERTEX_INPUT_INSTANCE_ID + float4 vertex : POSITION; + float3 normal : NORMAL; + fixed4 color : COLOR; + float2 texcoord0 : TEXCOORD0; + float2 texcoord1 : TEXCOORD1; + }; + + struct pixel_t { + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + float4 vertex : SV_POSITION; + fixed4 faceColor : COLOR; + fixed4 outlineColor : COLOR1; + float4 texcoord0 : TEXCOORD0; // Texture UV, Mask UV + half4 param : TEXCOORD1; // Scale(x), BiasIn(y), BiasOut(z), Bias(w) + half4 mask : TEXCOORD2; // Position in clip space(xy), Softness(zw) + #if (UNDERLAY_ON | UNDERLAY_INNER) + float4 texcoord1 : TEXCOORD3; // Texture UV, alpha, reserved + half2 underlayParam : TEXCOORD4; // Scale(x), Bias(y) + #endif + }; + + + pixel_t VertShader(vertex_t input) + { + pixel_t output; + + UNITY_INITIALIZE_OUTPUT(pixel_t, output); + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + float bold = step(input.texcoord1.y, 0); + + float4 vert = input.vertex; + vert.x += _VertexOffsetX; + vert.y += _VertexOffsetY; + float4 vPosition = UnityObjectToClipPos(vert); + + float2 pixelSize = vPosition.w; + pixelSize /= float2(_ScaleX, _ScaleY) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy)); + + float scale = rsqrt(dot(pixelSize, pixelSize)); + scale *= abs(input.texcoord1.y) * _GradientScale * (_Sharpness + 1); + if(UNITY_MATRIX_P[3][3] == 0) scale = lerp(abs(scale) * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(input.normal.xyz), normalize(WorldSpaceViewDir(vert))))); + + float weight = lerp(_WeightNormal, _WeightBold, bold) / 4.0; + weight = (weight + _FaceDilate) * _ScaleRatioA * 0.5; + + float layerScale = scale; + + scale /= 1 + (_OutlineSoftness * _ScaleRatioA * scale); + float bias = (0.5 - weight) * scale - 0.5; + float outline = _OutlineWidth * _ScaleRatioA * 0.5 * scale; + + float opacity = input.color.a; + #if (UNDERLAY_ON | UNDERLAY_INNER) + opacity = 1.0; + #endif + + fixed4 faceColor = fixed4(input.color.rgb, opacity) * _FaceColor; + faceColor.rgb *= faceColor.a; + + fixed4 outlineColor = _OutlineColor; + outlineColor.a *= opacity; + outlineColor.rgb *= outlineColor.a; + outlineColor = lerp(faceColor, outlineColor, sqrt(min(1.0, (outline * 2)))); + + #if (UNDERLAY_ON | UNDERLAY_INNER) + layerScale /= 1 + ((_UnderlaySoftness * _ScaleRatioC) * layerScale); + float layerBias = (.5 - weight) * layerScale - .5 - ((_UnderlayDilate * _ScaleRatioC) * .5 * layerScale); + + float x = -(_UnderlayOffsetX * _ScaleRatioC) * _GradientScale / _TextureWidth; + float y = -(_UnderlayOffsetY * _ScaleRatioC) * _GradientScale / _TextureHeight; + float2 layerOffset = float2(x, y); + #endif + + // Generate UV for the Masking Texture + float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); + float2 maskUV = (vert.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy); + + // Populate structure for pixel shader + output.vertex = vPosition; + output.faceColor = faceColor; + output.outlineColor = outlineColor; + output.texcoord0 = float4(input.texcoord0.x, input.texcoord0.y, maskUV.x, maskUV.y); + output.param = half4(scale, bias - outline, bias + outline, bias); + output.mask = half4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)); + #if (UNDERLAY_ON || UNDERLAY_INNER) + output.texcoord1 = float4(input.texcoord0 + layerOffset, input.color.a, 0); + output.underlayParam = half2(layerScale, layerBias); + #endif + + return output; + } + + + // PIXEL SHADER + fixed4 PixShader(pixel_t input) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(input); + + half d = tex2D(_MainTex, input.texcoord0.xy).a * input.param.x; + half4 c = input.faceColor * saturate(d - input.param.w); + + #ifdef OUTLINE_ON + c = lerp(input.outlineColor, input.faceColor, saturate(d - input.param.z)); + c *= saturate(d - input.param.y); + #endif + + #if UNDERLAY_ON + d = tex2D(_MainTex, input.texcoord1.xy).a * input.underlayParam.x; + c += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * saturate(d - input.underlayParam.y) * (1 - c.a); + #endif + + #if UNDERLAY_INNER + half sd = saturate(d - input.param.z); + d = tex2D(_MainTex, input.texcoord1.xy).a * input.underlayParam.x; + c += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * (1 - saturate(d - input.underlayParam.y)) * sd * (1 - c.a); + #endif + + // Alternative implementation to UnityGet2DClipping with support for softness. + #if UNITY_UI_CLIP_RECT + half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw); + c *= m.x * m.y; + #endif + + #if (UNDERLAY_ON | UNDERLAY_INNER) + c *= input.texcoord1.z; + #endif + + #if UNITY_UI_ALPHACLIP + clip(c.a - 0.001); + #endif + + return c; + } + ENDCG + } +} + +CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI" +} diff --git a/Assets/GameMain/Fonts/Shaders/TMP_SDF-Mobile.shader.meta b/Assets/GameMain/Fonts/Shaders/TMP_SDF-Mobile.shader.meta new file mode 100644 index 0000000..335e0fd --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_SDF-Mobile.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: fb171366644152948b39e5c17f4b1f39 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Fonts/Shaders/TMP_SDF-Surface-Mobile.shader b/Assets/GameMain/Fonts/Shaders/TMP_SDF-Surface-Mobile.shader new file mode 100644 index 0000000..be764ae --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_SDF-Surface-Mobile.shader @@ -0,0 +1,138 @@ +// Simplified version of the SDF Surface shader : +// - No support for Bevel, Bump or envmap +// - Diffuse only lighting +// - Fully supports only 1 directional light. Other lights can affect it, but it will be per-vertex/SH. + +Shader "TextMeshPro/Mobile/Distance Field (Surface)" { + +Properties { + _FaceTex ("Fill Texture", 2D) = "white" {} + [HDR]_FaceColor ("Fill Color", Color) = (1,1,1,1) + _FaceDilate ("Face Dilate", Range(-1,1)) = 0 + + [HDR]_OutlineColor ("Outline Color", Color) = (0,0,0,1) + _OutlineTex ("Outline Texture", 2D) = "white" {} + _OutlineWidth ("Outline Thickness", Range(0, 1)) = 0 + _OutlineSoftness ("Outline Softness", Range(0,1)) = 0 + + [HDR]_GlowColor ("Color", Color) = (0, 1, 0, 0.5) + _GlowOffset ("Offset", Range(-1,1)) = 0 + _GlowInner ("Inner", Range(0,1)) = 0.05 + _GlowOuter ("Outer", Range(0,1)) = 0.05 + _GlowPower ("Falloff", Range(1, 0)) = 0.75 + + _WeightNormal ("Weight Normal", float) = 0 + _WeightBold ("Weight Bold", float) = 0.5 + + // Should not be directly exposed to the user + _ShaderFlags ("Flags", float) = 0 + _ScaleRatioA ("Scale RatioA", float) = 1 + _ScaleRatioB ("Scale RatioB", float) = 1 + _ScaleRatioC ("Scale RatioC", float) = 1 + + _MainTex ("Font Atlas", 2D) = "white" {} + _TextureWidth ("Texture Width", float) = 512 + _TextureHeight ("Texture Height", float) = 512 + _GradientScale ("Gradient Scale", float) = 5.0 + _ScaleX ("Scale X", float) = 1.0 + _ScaleY ("Scale Y", float) = 1.0 + _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875 + _Sharpness ("Sharpness", Range(-1,1)) = 0 + + _VertexOffsetX ("Vertex OffsetX", float) = 0 + _VertexOffsetY ("Vertex OffsetY", float) = 0 + + _CullMode ("Cull Mode", Float) = 0 + //_MaskCoord ("Mask Coords", vector) = (0,0,0,0) + //_MaskSoftness ("Mask Softness", float) = 0 +} + +SubShader { + + Tags { + "Queue"="Transparent" + "IgnoreProjector"="True" + "RenderType"="Transparent" + } + + LOD 300 + Cull [_CullMode] + + CGPROGRAM + #pragma surface PixShader Lambert alpha:blend vertex:VertShader noforwardadd nolightmap nodirlightmap + #pragma target 3.0 + #pragma shader_feature __ GLOW_ON + + #include "TMPro_Properties.cginc" + #include "TMPro.cginc" + + half _FaceShininess; + half _OutlineShininess; + + struct Input + { + fixed4 color : COLOR; + float2 uv_MainTex; + float2 uv2_FaceTex; + float2 uv2_OutlineTex; + float2 param; // Weight, Scale + float3 viewDirEnv; + }; + + #include "TMPro_Surface.cginc" + + ENDCG + + // Pass to render object as a shadow caster + Pass + { + Name "Caster" + Tags { "LightMode" = "ShadowCaster" } + Offset 1, 1 + + Fog {Mode Off} + ZWrite On ZTest LEqual Cull Off + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_shadowcaster + #include "UnityCG.cginc" + + struct v2f { + V2F_SHADOW_CASTER; + float2 uv : TEXCOORD1; + float2 uv2 : TEXCOORD3; + float alphaClip : TEXCOORD2; + }; + + uniform float4 _MainTex_ST; + uniform float4 _OutlineTex_ST; + float _OutlineWidth; + float _FaceDilate; + float _ScaleRatioA; + + v2f vert( appdata_base v ) + { + v2f o; + TRANSFER_SHADOW_CASTER(o) + o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); + o.uv2 = TRANSFORM_TEX(v.texcoord, _OutlineTex); + o.alphaClip = o.alphaClip = (1.0 - _OutlineWidth * _ScaleRatioA - _FaceDilate * _ScaleRatioA) / 2; + return o; + } + + uniform sampler2D _MainTex; + + float4 frag(v2f i) : COLOR + { + fixed4 texcol = tex2D(_MainTex, i.uv).a; + clip(texcol.a - i.alphaClip); + SHADOW_CASTER_FRAGMENT(i) + } + ENDCG + } +} + +CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI" +} diff --git a/Assets/GameMain/Fonts/Shaders/TMP_SDF-Surface-Mobile.shader.meta b/Assets/GameMain/Fonts/Shaders/TMP_SDF-Surface-Mobile.shader.meta new file mode 100644 index 0000000..a663819 --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_SDF-Surface-Mobile.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 4ca22ae3bc068c84eb7858d5b9bdf3e2 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Fonts/Shaders/TMP_SDF-Surface.shader b/Assets/GameMain/Fonts/Shaders/TMP_SDF-Surface.shader new file mode 100644 index 0000000..bcb2bb2 --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_SDF-Surface.shader @@ -0,0 +1,158 @@ +Shader "TextMeshPro/Distance Field (Surface)" { + +Properties { + _FaceTex ("Fill Texture", 2D) = "white" {} + _FaceUVSpeedX ("Face UV Speed X", Range(-5, 5)) = 0.0 + _FaceUVSpeedY ("Face UV Speed Y", Range(-5, 5)) = 0.0 + [HDR]_FaceColor ("Fill Color", Color) = (1,1,1,1) + _FaceDilate ("Face Dilate", Range(-1,1)) = 0 + + [HDR]_OutlineColor ("Outline Color", Color) = (0,0,0,1) + _OutlineTex ("Outline Texture", 2D) = "white" {} + _OutlineUVSpeedX ("Outline UV Speed X", Range(-5, 5)) = 0.0 + _OutlineUVSpeedY ("Outline UV Speed Y", Range(-5, 5)) = 0.0 + _OutlineWidth ("Outline Thickness", Range(0, 1)) = 0 + _OutlineSoftness ("Outline Softness", Range(0,1)) = 0 + + _Bevel ("Bevel", Range(0,1)) = 0.5 + _BevelOffset ("Bevel Offset", Range(-0.5,0.5)) = 0 + _BevelWidth ("Bevel Width", Range(-.5,0.5)) = 0 + _BevelClamp ("Bevel Clamp", Range(0,1)) = 0 + _BevelRoundness ("Bevel Roundness", Range(0,1)) = 0 + + _BumpMap ("Normalmap", 2D) = "bump" {} + _BumpOutline ("Bump Outline", Range(0,1)) = 0.5 + _BumpFace ("Bump Face", Range(0,1)) = 0.5 + + _ReflectFaceColor ("Face Color", Color) = (0,0,0,1) + _ReflectOutlineColor ("Outline Color", Color) = (0,0,0,1) + _Cube ("Reflection Cubemap", Cube) = "black" { /* TexGen CubeReflect */ } + _EnvMatrixRotation ("Texture Rotation", vector) = (0, 0, 0, 0) + [HDR]_SpecColor ("Specular Color", Color) = (0,0,0,1) + + _FaceShininess ("Face Shininess", Range(0,1)) = 0 + _OutlineShininess ("Outline Shininess", Range(0,1)) = 0 + + [HDR]_GlowColor ("Color", Color) = (0, 1, 0, 0.5) + _GlowOffset ("Offset", Range(-1,1)) = 0 + _GlowInner ("Inner", Range(0,1)) = 0.05 + _GlowOuter ("Outer", Range(0,1)) = 0.05 + _GlowPower ("Falloff", Range(1, 0)) = 0.75 + + _WeightNormal ("Weight Normal", float) = 0 + _WeightBold ("Weight Bold", float) = 0.5 + + // Should not be directly exposed to the user + _ShaderFlags ("Flags", float) = 0 + _ScaleRatioA ("Scale RatioA", float) = 1 + _ScaleRatioB ("Scale RatioB", float) = 1 + _ScaleRatioC ("Scale RatioC", float) = 1 + + _MainTex ("Font Atlas", 2D) = "white" {} + _TextureWidth ("Texture Width", float) = 512 + _TextureHeight ("Texture Height", float) = 512 + _GradientScale ("Gradient Scale", float) = 5.0 + _ScaleX ("Scale X", float) = 1.0 + _ScaleY ("Scale Y", float) = 1.0 + _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875 + _Sharpness ("Sharpness", Range(-1,1)) = 0 + + _VertexOffsetX ("Vertex OffsetX", float) = 0 + _VertexOffsetY ("Vertex OffsetY", float) = 0 + + _CullMode ("Cull Mode", Float) = 0 + //_MaskCoord ("Mask Coords", vector) = (0,0,0,0) + //_MaskSoftness ("Mask Softness", float) = 0 +} + +SubShader { + + Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } + + LOD 300 + Cull [_CullMode] + + CGPROGRAM + #pragma surface PixShader BlinnPhong alpha:blend vertex:VertShader nolightmap nodirlightmap + #pragma target 3.0 + #pragma shader_feature __ GLOW_ON + #pragma glsl + + #include "TMPro_Properties.cginc" + #include "TMPro.cginc" + + half _FaceShininess; + half _OutlineShininess; + + struct Input + { + fixed4 color : COLOR; + float2 uv_MainTex; + float2 uv2_FaceTex; + float2 uv2_OutlineTex; + float2 param; // Weight, Scale + float3 viewDirEnv; + }; + + + #define BEVEL_ON 1 + #include "TMPro_Surface.cginc" + + ENDCG + + // Pass to render object as a shadow caster + Pass + { + Name "Caster" + Tags { "LightMode" = "ShadowCaster" } + Offset 1, 1 + + Fog {Mode Off} + ZWrite On + ZTest LEqual + Cull Off + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_shadowcaster + #include "UnityCG.cginc" + + struct v2f { + V2F_SHADOW_CASTER; + float2 uv : TEXCOORD1; + float2 uv2 : TEXCOORD3; + float alphaClip : TEXCOORD2; + }; + + uniform float4 _MainTex_ST; + uniform float4 _OutlineTex_ST; + float _OutlineWidth; + float _FaceDilate; + float _ScaleRatioA; + + v2f vert( appdata_base v ) + { + v2f o; + TRANSFER_SHADOW_CASTER(o) + o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); + o.uv2 = TRANSFORM_TEX(v.texcoord, _OutlineTex); + o.alphaClip = (1.0 - _OutlineWidth * _ScaleRatioA - _FaceDilate * _ScaleRatioA) / 2; + return o; + } + + uniform sampler2D _MainTex; + + float4 frag(v2f i) : COLOR + { + fixed4 texcol = tex2D(_MainTex, i.uv).a; + clip(texcol.a - i.alphaClip); + SHADOW_CASTER_FRAGMENT(i) + } + ENDCG + } +} + +CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI" +} + diff --git a/Assets/GameMain/Fonts/Shaders/TMP_SDF-Surface.shader.meta b/Assets/GameMain/Fonts/Shaders/TMP_SDF-Surface.shader.meta new file mode 100644 index 0000000..261e4a6 --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_SDF-Surface.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f5b2cc6c7ce8cc5408ad507a4f40af49 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Fonts/Shaders/TMP_SDF.shader b/Assets/GameMain/Fonts/Shaders/TMP_SDF.shader new file mode 100644 index 0000000..011ee19 --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_SDF.shader @@ -0,0 +1,317 @@ +Shader "TextMeshPro/Distance Field" { + +Properties { + _FaceTex ("Face Texture", 2D) = "white" {} + _FaceUVSpeedX ("Face UV Speed X", Range(-5, 5)) = 0.0 + _FaceUVSpeedY ("Face UV Speed Y", Range(-5, 5)) = 0.0 + [HDR]_FaceColor ("Face Color", Color) = (1,1,1,1) + _FaceDilate ("Face Dilate", Range(-1,1)) = 0 + + [HDR]_OutlineColor ("Outline Color", Color) = (0,0,0,1) + _OutlineTex ("Outline Texture", 2D) = "white" {} + _OutlineUVSpeedX ("Outline UV Speed X", Range(-5, 5)) = 0.0 + _OutlineUVSpeedY ("Outline UV Speed Y", Range(-5, 5)) = 0.0 + _OutlineWidth ("Outline Thickness", Range(0, 1)) = 0 + _OutlineSoftness ("Outline Softness", Range(0,1)) = 0 + + _Bevel ("Bevel", Range(0,1)) = 0.5 + _BevelOffset ("Bevel Offset", Range(-0.5,0.5)) = 0 + _BevelWidth ("Bevel Width", Range(-.5,0.5)) = 0 + _BevelClamp ("Bevel Clamp", Range(0,1)) = 0 + _BevelRoundness ("Bevel Roundness", Range(0,1)) = 0 + + _LightAngle ("Light Angle", Range(0.0, 6.2831853)) = 3.1416 + [HDR]_SpecularColor ("Specular", Color) = (1,1,1,1) + _SpecularPower ("Specular", Range(0,4)) = 2.0 + _Reflectivity ("Reflectivity", Range(5.0,15.0)) = 10 + _Diffuse ("Diffuse", Range(0,1)) = 0.5 + _Ambient ("Ambient", Range(1,0)) = 0.5 + + _BumpMap ("Normal map", 2D) = "bump" {} + _BumpOutline ("Bump Outline", Range(0,1)) = 0 + _BumpFace ("Bump Face", Range(0,1)) = 0 + + _ReflectFaceColor ("Reflection Color", Color) = (0,0,0,1) + _ReflectOutlineColor("Reflection Color", Color) = (0,0,0,1) + _Cube ("Reflection Cubemap", Cube) = "black" { /* TexGen CubeReflect */ } + _EnvMatrixRotation ("Texture Rotation", vector) = (0, 0, 0, 0) + + + [HDR]_UnderlayColor ("Border Color", Color) = (0,0,0, 0.5) + _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0 + _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0 + _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0 + _UnderlaySoftness ("Border Softness", Range(0,1)) = 0 + + [HDR]_GlowColor ("Color", Color) = (0, 1, 0, 0.5) + _GlowOffset ("Offset", Range(-1,1)) = 0 + _GlowInner ("Inner", Range(0,1)) = 0.05 + _GlowOuter ("Outer", Range(0,1)) = 0.05 + _GlowPower ("Falloff", Range(1, 0)) = 0.75 + + _WeightNormal ("Weight Normal", float) = 0 + _WeightBold ("Weight Bold", float) = 0.5 + + _ShaderFlags ("Flags", float) = 0 + _ScaleRatioA ("Scale RatioA", float) = 1 + _ScaleRatioB ("Scale RatioB", float) = 1 + _ScaleRatioC ("Scale RatioC", float) = 1 + + _MainTex ("Font Atlas", 2D) = "white" {} + _TextureWidth ("Texture Width", float) = 512 + _TextureHeight ("Texture Height", float) = 512 + _GradientScale ("Gradient Scale", float) = 5.0 + _ScaleX ("Scale X", float) = 1.0 + _ScaleY ("Scale Y", float) = 1.0 + _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875 + _Sharpness ("Sharpness", Range(-1,1)) = 0 + + _VertexOffsetX ("Vertex OffsetX", float) = 0 + _VertexOffsetY ("Vertex OffsetY", float) = 0 + + _MaskCoord ("Mask Coordinates", vector) = (0, 0, 32767, 32767) + _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) + _MaskSoftnessX ("Mask SoftnessX", float) = 0 + _MaskSoftnessY ("Mask SoftnessY", float) = 0 + + _StencilComp ("Stencil Comparison", Float) = 8 + _Stencil ("Stencil ID", Float) = 0 + _StencilOp ("Stencil Operation", Float) = 0 + _StencilWriteMask ("Stencil Write Mask", Float) = 255 + _StencilReadMask ("Stencil Read Mask", Float) = 255 + + _CullMode ("Cull Mode", Float) = 0 + _ColorMask ("Color Mask", Float) = 15 +} + +SubShader { + + Tags + { + "Queue"="Transparent" + "IgnoreProjector"="True" + "RenderType"="Transparent" + } + + Stencil + { + Ref [_Stencil] + Comp [_StencilComp] + Pass [_StencilOp] + ReadMask [_StencilReadMask] + WriteMask [_StencilWriteMask] + } + + Cull [_CullMode] + ZWrite Off + Lighting Off + Fog { Mode Off } + ZTest [unity_GUIZTestMode] + Blend One OneMinusSrcAlpha + ColorMask [_ColorMask] + + Pass { + CGPROGRAM + #pragma target 3.0 + #pragma vertex VertShader + #pragma fragment PixShader + #pragma shader_feature __ BEVEL_ON + #pragma shader_feature __ UNDERLAY_ON UNDERLAY_INNER + #pragma shader_feature __ GLOW_ON + + #pragma multi_compile __ UNITY_UI_CLIP_RECT + #pragma multi_compile __ UNITY_UI_ALPHACLIP + + #include "UnityCG.cginc" + #include "UnityUI.cginc" + #include "TMPro_Properties.cginc" + #include "TMPro.cginc" + + struct vertex_t { + UNITY_VERTEX_INPUT_INSTANCE_ID + float4 position : POSITION; + float3 normal : NORMAL; + fixed4 color : COLOR; + float2 texcoord0 : TEXCOORD0; + float2 texcoord1 : TEXCOORD1; + }; + + + struct pixel_t { + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + float4 position : SV_POSITION; + fixed4 color : COLOR; + float2 atlas : TEXCOORD0; // Atlas + float4 param : TEXCOORD1; // alphaClip, scale, bias, weight + float4 mask : TEXCOORD2; // Position in object space(xy), pixel Size(zw) + float3 viewDir : TEXCOORD3; + + #if (UNDERLAY_ON || UNDERLAY_INNER) + float4 texcoord2 : TEXCOORD4; // u,v, scale, bias + fixed4 underlayColor : COLOR1; + #endif + float4 textures : TEXCOORD5; + }; + + // Used by Unity internally to handle Texture Tiling and Offset. + float4 _FaceTex_ST; + float4 _OutlineTex_ST; + + pixel_t VertShader(vertex_t input) + { + pixel_t output; + + UNITY_INITIALIZE_OUTPUT(pixel_t, output); + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input,output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + float bold = step(input.texcoord1.y, 0); + + float4 vert = input.position; + vert.x += _VertexOffsetX; + vert.y += _VertexOffsetY; + + float4 vPosition = UnityObjectToClipPos(vert); + + float2 pixelSize = vPosition.w; + pixelSize /= float2(_ScaleX, _ScaleY) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy)); + float scale = rsqrt(dot(pixelSize, pixelSize)); + scale *= abs(input.texcoord1.y) * _GradientScale * (_Sharpness + 1); + if (UNITY_MATRIX_P[3][3] == 0) scale = lerp(abs(scale) * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(input.normal.xyz), normalize(WorldSpaceViewDir(vert))))); + + float weight = lerp(_WeightNormal, _WeightBold, bold) / 4.0; + weight = (weight + _FaceDilate) * _ScaleRatioA * 0.5; + + float bias =(.5 - weight) + (.5 / scale); + + float alphaClip = (1.0 - _OutlineWidth * _ScaleRatioA - _OutlineSoftness * _ScaleRatioA); + + #if GLOW_ON + alphaClip = min(alphaClip, 1.0 - _GlowOffset * _ScaleRatioB - _GlowOuter * _ScaleRatioB); + #endif + + alphaClip = alphaClip / 2.0 - ( .5 / scale) - weight; + + #if (UNDERLAY_ON || UNDERLAY_INNER) + float4 underlayColor = _UnderlayColor; + underlayColor.rgb *= underlayColor.a; + + float bScale = scale; + bScale /= 1 + ((_UnderlaySoftness*_ScaleRatioC) * bScale); + float bBias = (0.5 - weight) * bScale - 0.5 - ((_UnderlayDilate * _ScaleRatioC) * 0.5 * bScale); + + float x = -(_UnderlayOffsetX * _ScaleRatioC) * _GradientScale / _TextureWidth; + float y = -(_UnderlayOffsetY * _ScaleRatioC) * _GradientScale / _TextureHeight; + float2 bOffset = float2(x, y); + #endif + + // Generate UV for the Masking Texture + float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); + float2 maskUV = (vert.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy); + + // Support for texture tiling and offset + float2 textureUV = UnpackUV(input.texcoord1.x); + float2 faceUV = TRANSFORM_TEX(textureUV, _FaceTex); + float2 outlineUV = TRANSFORM_TEX(textureUV, _OutlineTex); + + + output.position = vPosition; + output.color = input.color; + output.atlas = input.texcoord0; + output.param = float4(alphaClip, scale, bias, weight); + output.mask = half4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)); + output.viewDir = mul((float3x3)_EnvMatrix, _WorldSpaceCameraPos.xyz - mul(unity_ObjectToWorld, vert).xyz); + #if (UNDERLAY_ON || UNDERLAY_INNER) + output.texcoord2 = float4(input.texcoord0 + bOffset, bScale, bBias); + output.underlayColor = underlayColor; + #endif + output.textures = float4(faceUV, outlineUV); + + return output; + } + + + fixed4 PixShader(pixel_t input) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(input); + + float c = tex2D(_MainTex, input.atlas).a; + + #ifndef UNDERLAY_ON + clip(c - input.param.x); + #endif + + float scale = input.param.y; + float bias = input.param.z; + float weight = input.param.w; + float sd = (bias - c) * scale; + + float outline = (_OutlineWidth * _ScaleRatioA) * scale; + float softness = (_OutlineSoftness * _ScaleRatioA) * scale; + + half4 faceColor = _FaceColor; + half4 outlineColor = _OutlineColor; + + faceColor.rgb *= input.color.rgb; + + faceColor *= tex2D(_FaceTex, input.textures.xy + float2(_FaceUVSpeedX, _FaceUVSpeedY) * _Time.y); + outlineColor *= tex2D(_OutlineTex, input.textures.zw + float2(_OutlineUVSpeedX, _OutlineUVSpeedY) * _Time.y); + + faceColor = GetColor(sd, faceColor, outlineColor, outline, softness); + + #if BEVEL_ON + float3 dxy = float3(0.5 / _TextureWidth, 0.5 / _TextureHeight, 0); + float3 n = GetSurfaceNormal(input.atlas, weight, dxy); + + float3 bump = UnpackNormal(tex2D(_BumpMap, input.textures.xy + float2(_FaceUVSpeedX, _FaceUVSpeedY) * _Time.y)).xyz; + bump *= lerp(_BumpFace, _BumpOutline, saturate(sd + outline * 0.5)); + n = normalize(n- bump); + + float3 light = normalize(float3(sin(_LightAngle), cos(_LightAngle), -1.0)); + + float3 col = GetSpecular(n, light); + faceColor.rgb += col*faceColor.a; + faceColor.rgb *= 1-(dot(n, light)*_Diffuse); + faceColor.rgb *= lerp(_Ambient, 1, n.z*n.z); + + fixed4 reflcol = texCUBE(_Cube, reflect(input.viewDir, -n)); + faceColor.rgb += reflcol.rgb * lerp(_ReflectFaceColor.rgb, _ReflectOutlineColor.rgb, saturate(sd + outline * 0.5)) * faceColor.a; + #endif + + #if UNDERLAY_ON + float d = tex2D(_MainTex, input.texcoord2.xy).a * input.texcoord2.z; + faceColor += input.underlayColor * saturate(d - input.texcoord2.w) * (1 - faceColor.a); + #endif + + #if UNDERLAY_INNER + float d = tex2D(_MainTex, input.texcoord2.xy).a * input.texcoord2.z; + faceColor += input.underlayColor * (1 - saturate(d - input.texcoord2.w)) * saturate(1 - sd) * (1 - faceColor.a); + #endif + + #if GLOW_ON + float4 glowColor = GetGlowColor(sd, scale); + faceColor.rgb += glowColor.rgb * glowColor.a; + #endif + + // Alternative implementation to UnityGet2DClipping with support for softness. + #if UNITY_UI_CLIP_RECT + half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw); + faceColor *= m.x * m.y; + #endif + + #if UNITY_UI_ALPHACLIP + clip(faceColor.a - 0.001); + #endif + + return faceColor * input.color.a; + } + + ENDCG + } +} + +Fallback "TextMeshPro/Mobile/Distance Field" +CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI" +} diff --git a/Assets/GameMain/Fonts/Shaders/TMP_SDF.shader.meta b/Assets/GameMain/Fonts/Shaders/TMP_SDF.shader.meta new file mode 100644 index 0000000..693dc09 --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_SDF.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 5b5a6a737c460eb4abc105d6583d405e +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Fonts/Shaders/TMP_Sprite.shader b/Assets/GameMain/Fonts/Shaders/TMP_Sprite.shader new file mode 100644 index 0000000..e8283a7 --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_Sprite.shader @@ -0,0 +1,116 @@ +Shader "TextMeshPro/Sprite" +{ + Properties + { + [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {} + _Color ("Tint", Color) = (1,1,1,1) + + _StencilComp ("Stencil Comparison", Float) = 8 + _Stencil ("Stencil ID", Float) = 0 + _StencilOp ("Stencil Operation", Float) = 0 + _StencilWriteMask ("Stencil Write Mask", Float) = 255 + _StencilReadMask ("Stencil Read Mask", Float) = 255 + + _CullMode ("Cull Mode", Float) = 0 + _ColorMask ("Color Mask", Float) = 15 + _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) + + [Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0 + } + + SubShader + { + Tags + { + "Queue"="Transparent" + "IgnoreProjector"="True" + "RenderType"="Transparent" + "PreviewType"="Plane" + "CanUseSpriteAtlas"="True" + } + + Stencil + { + Ref [_Stencil] + Comp [_StencilComp] + Pass [_StencilOp] + ReadMask [_StencilReadMask] + WriteMask [_StencilWriteMask] + } + + Cull [_CullMode] + Lighting Off + ZWrite Off + ZTest [unity_GUIZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + ColorMask [_ColorMask] + + Pass + { + Name "Default" + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma target 2.0 + + #include "UnityCG.cginc" + #include "UnityUI.cginc" + + #pragma multi_compile __ UNITY_UI_CLIP_RECT + #pragma multi_compile __ UNITY_UI_ALPHACLIP + + struct appdata_t + { + float4 vertex : POSITION; + float4 color : COLOR; + float2 texcoord : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct v2f + { + float4 vertex : SV_POSITION; + fixed4 color : COLOR; + float2 texcoord : TEXCOORD0; + float4 worldPosition : TEXCOORD1; + UNITY_VERTEX_OUTPUT_STEREO + }; + + sampler2D _MainTex; + fixed4 _Color; + fixed4 _TextureSampleAdd; + float4 _ClipRect; + float4 _MainTex_ST; + + v2f vert(appdata_t v) + { + v2f OUT; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT); + OUT.worldPosition = v.vertex; + OUT.vertex = UnityObjectToClipPos(OUT.worldPosition); + + OUT.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex); + + OUT.color = v.color * _Color; + return OUT; + } + + fixed4 frag(v2f IN) : SV_Target + { + half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color; + + #ifdef UNITY_UI_CLIP_RECT + color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect); + #endif + + #ifdef UNITY_UI_ALPHACLIP + clip (color.a - 0.001); + #endif + + return color; + } + ENDCG + } + } +} diff --git a/Assets/GameMain/Fonts/Shaders/TMP_Sprite.shader.meta b/Assets/GameMain/Fonts/Shaders/TMP_Sprite.shader.meta new file mode 100644 index 0000000..1c5a1fc --- /dev/null +++ b/Assets/GameMain/Fonts/Shaders/TMP_Sprite.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: ab1c66f8a301fe043930c9f0c23716cf +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/Sprite Assets/coin.asset b/Assets/GameMain/Fonts/coin.asset similarity index 100% rename from Assets/TextMesh Pro/Resources/Sprite Assets/coin.asset rename to Assets/GameMain/Fonts/coin.asset diff --git a/Assets/TextMesh Pro/Resources/Sprite Assets/coin.asset.meta b/Assets/GameMain/Fonts/coin.asset.meta similarity index 100% rename from Assets/TextMesh Pro/Resources/Sprite Assets/coin.asset.meta rename to Assets/GameMain/Fonts/coin.asset.meta diff --git a/Assets/GameMain/Materials/Blue.mat b/Assets/GameMain/Materials/Blue.mat new file mode 100644 index 0000000..4dea6ad --- /dev/null +++ b/Assets/GameMain/Materials/Blue.mat @@ -0,0 +1,137 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Blue + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 1 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BlendOp: 0 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _FlashAmount: 0 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _SampleGI: 0 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 0.1, g: 1, b: 0.9, a: 1} + - _Color: {r: 0.09999997, g: 1, b: 0.9, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _FlashColor: {r: 1, g: 1, b: 1, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] +--- !u!114 &4582237545370899445 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 7 diff --git a/Assets/GameMain/Scenes/StressTest/GlobalVolumeProfile.asset.meta b/Assets/GameMain/Materials/Blue.mat.meta similarity index 64% rename from Assets/GameMain/Scenes/StressTest/GlobalVolumeProfile.asset.meta rename to Assets/GameMain/Materials/Blue.mat.meta index 06bddd4..9b5ed68 100644 --- a/Assets/GameMain/Scenes/StressTest/GlobalVolumeProfile.asset.meta +++ b/Assets/GameMain/Materials/Blue.mat.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: 94ca859a535c2074392c01285b2754e0 +guid: c4f37184fcb9306428d7d002f7dca96d NativeFormatImporter: externalObjects: {} - mainObjectFileID: 11400000 + mainObjectFileID: 2100000 userData: assetBundleName: assetBundleVariant: diff --git a/Assets/GameMain/Materials/Green.mat b/Assets/GameMain/Materials/InstancingGreen.mat similarity index 99% rename from Assets/GameMain/Materials/Green.mat rename to Assets/GameMain/Materials/InstancingGreen.mat index 1b10d11..ea4f2b0 100644 --- a/Assets/GameMain/Materials/Green.mat +++ b/Assets/GameMain/Materials/InstancingGreen.mat @@ -7,7 +7,7 @@ Material: m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_Name: Green + m_Name: InstancingGreen m_Shader: {fileID: 4800000, guid: f17bc7e2694233349a8b22e96c5c43de, type: 3} m_Parent: {fileID: 0} m_ModifiedSerializedProperties: 0 diff --git a/Assets/GameMain/Materials/Green.mat.meta b/Assets/GameMain/Materials/InstancingGreen.mat.meta similarity index 100% rename from Assets/GameMain/Materials/Green.mat.meta rename to Assets/GameMain/Materials/InstancingGreen.mat.meta diff --git a/Assets/GameMain/Materials/InstancingGrey.mat b/Assets/GameMain/Materials/InstancingGrey.mat new file mode 100644 index 0000000..87cc500 --- /dev/null +++ b/Assets/GameMain/Materials/InstancingGrey.mat @@ -0,0 +1,136 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: InstancingGrey + m_Shader: {fileID: 4800000, guid: f17bc7e2694233349a8b22e96c5c43de, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 1 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BlendOp: 0 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _FlashAmount: 0 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _SampleGI: 0 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + - _Color: {r: 1, g: 0.29245266, b: 0.29245266, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _FlashColor: {r: 1, g: 1, b: 1, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] +--- !u!114 &4582237545370899445 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 7 diff --git a/Assets/GameMain/Scenes/MainSettings.lighting.meta b/Assets/GameMain/Materials/InstancingGrey.mat.meta similarity index 60% rename from Assets/GameMain/Scenes/MainSettings.lighting.meta rename to Assets/GameMain/Materials/InstancingGrey.mat.meta index 6d5e4b0..ab4237d 100644 --- a/Assets/GameMain/Scenes/MainSettings.lighting.meta +++ b/Assets/GameMain/Materials/InstancingGrey.mat.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: bd0dcd203508e774b84313644b9fad2c +guid: 83e5fce2d1e5b3e4ab6551de03cc9c22 NativeFormatImporter: externalObjects: {} - mainObjectFileID: 4890085278179872738 + mainObjectFileID: 2100000 userData: assetBundleName: assetBundleVariant: diff --git a/Assets/GameMain/Materials/Red.mat b/Assets/GameMain/Materials/InstancingRed.mat similarity index 99% rename from Assets/GameMain/Materials/Red.mat rename to Assets/GameMain/Materials/InstancingRed.mat index 390f724..e590da2 100644 --- a/Assets/GameMain/Materials/Red.mat +++ b/Assets/GameMain/Materials/InstancingRed.mat @@ -7,7 +7,7 @@ Material: m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_Name: Red + m_Name: InstancingRed m_Shader: {fileID: 4800000, guid: f17bc7e2694233349a8b22e96c5c43de, type: 3} m_Parent: {fileID: 0} m_ModifiedSerializedProperties: 0 diff --git a/Assets/GameMain/Materials/Red.mat.meta b/Assets/GameMain/Materials/InstancingRed.mat.meta similarity index 100% rename from Assets/GameMain/Materials/Red.mat.meta rename to Assets/GameMain/Materials/InstancingRed.mat.meta diff --git a/Assets/GameMain/Materials/Yellow.mat b/Assets/GameMain/Materials/InstancingYellow.mat similarity index 99% rename from Assets/GameMain/Materials/Yellow.mat rename to Assets/GameMain/Materials/InstancingYellow.mat index 0c94059..ff98550 100644 --- a/Assets/GameMain/Materials/Yellow.mat +++ b/Assets/GameMain/Materials/InstancingYellow.mat @@ -7,7 +7,7 @@ Material: m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_Name: Yellow + m_Name: InstancingYellow m_Shader: {fileID: 4800000, guid: f17bc7e2694233349a8b22e96c5c43de, type: 3} m_Parent: {fileID: 0} m_ModifiedSerializedProperties: 0 diff --git a/Assets/GameMain/Materials/Yellow.mat.meta b/Assets/GameMain/Materials/InstancingYellow.mat.meta similarity index 100% rename from Assets/GameMain/Materials/Yellow.mat.meta rename to Assets/GameMain/Materials/InstancingYellow.mat.meta diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator.meta b/Assets/GameMain/Scenes/Game.meta similarity index 77% rename from Assets/GameMain/Scripts/Editor/DataTableGenerator.meta rename to Assets/GameMain/Scenes/Game.meta index 4c9a657..4daa879 100644 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator.meta +++ b/Assets/GameMain/Scenes/Game.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 051868bff0e1df3498c100dc5a9f027d +guid: 1e2a290aa42884640815cb6fd552deac folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/GameMain/Scenes/Game.unity b/Assets/GameMain/Scenes/Game.unity index b4db875..42b3eee 100644 --- a/Assets/GameMain/Scenes/Game.unity +++ b/Assets/GameMain/Scenes/Game.unity @@ -96,7 +96,8 @@ LightmapSettings: m_ExportTrainingData: 0 m_TrainingDataDestination: TrainingData m_LightProbeSampleCountMultiplier: 4 - m_LightingDataAsset: {fileID: 0} + m_LightingDataAsset: {fileID: 112000000, guid: fb9bd70ff25fcde4e954a6f3ec6ca2cd, + type: 2} m_LightingSettings: {fileID: 0} --- !u!196 &4 NavMeshSettings: diff --git a/Assets/GameMain/Scenes/Game/LightingData.asset b/Assets/GameMain/Scenes/Game/LightingData.asset new file mode 100644 index 0000000..f058418 Binary files /dev/null and b/Assets/GameMain/Scenes/Game/LightingData.asset differ diff --git a/Assets/GameMain/Scenes/Game/LightingData.asset.meta b/Assets/GameMain/Scenes/Game/LightingData.asset.meta new file mode 100644 index 0000000..86c47b1 --- /dev/null +++ b/Assets/GameMain/Scenes/Game/LightingData.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fb9bd70ff25fcde4e954a6f3ec6ca2cd +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 112000000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Scenes/Game/ReflectionProbe-0.exr b/Assets/GameMain/Scenes/Game/ReflectionProbe-0.exr new file mode 100644 index 0000000..f38e702 Binary files /dev/null and b/Assets/GameMain/Scenes/Game/ReflectionProbe-0.exr differ diff --git a/Assets/GameMain/Scenes/Game/ReflectionProbe-0.exr.meta b/Assets/GameMain/Scenes/Game/ReflectionProbe-0.exr.meta new file mode 100644 index 0000000..821a177 --- /dev/null +++ b/Assets/GameMain/Scenes/Game/ReflectionProbe-0.exr.meta @@ -0,0 +1,127 @@ +fileFormatVersion: 2 +guid: 0e45b8557b1831845a6e03fce7b5aa2b +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: 1 + seamlessCubemap: 1 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 2 + aniso: 0 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 1 + 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: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 2 + 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: 100 + 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 + - serializedVersion: 3 + buildTarget: Android + 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/GameMain/Scenes/MainSettings.lighting b/Assets/GameMain/Scenes/MainSettings.lighting deleted file mode 100644 index fdc42a1..0000000 --- a/Assets/GameMain/Scenes/MainSettings.lighting +++ /dev/null @@ -1,66 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!850595691 &4890085278179872738 -LightingSettings: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: MainSettings - serializedVersion: 6 - m_GIWorkflowMode: 1 - m_EnableBakedLightmaps: 1 - m_EnableRealtimeLightmaps: 0 - m_RealtimeEnvironmentLighting: 1 - m_BounceScale: 1 - m_AlbedoBoost: 1 - m_IndirectOutputScale: 1 - m_UsingShadowmask: 0 - m_BakeBackend: 0 - m_LightmapMaxSize: 1024 - m_BakeResolution: 50 - m_Padding: 2 - m_LightmapCompression: 0 - m_AO: 0 - m_AOMaxDistance: 1 - m_CompAOExponent: 0 - m_CompAOExponentDirect: 0 - m_ExtractAO: 0 - m_MixedBakeMode: 1 - m_LightmapsBakeMode: 1 - m_FilterMode: 1 - m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0} - m_ExportTrainingData: 0 - m_TrainingDataDestination: TrainingData - m_RealtimeResolution: 1 - m_ForceWhiteAlbedo: 0 - m_ForceUpdates: 0 - m_FinalGather: 0 - m_FinalGatherRayCount: 1024 - m_FinalGatherFiltering: 1 - m_PVRCulling: 1 - m_PVRSampling: 1 - m_PVRDirectSampleCount: 32 - m_PVRSampleCount: 512 - m_PVREnvironmentSampleCount: 512 - m_PVREnvironmentReferencePointCount: 2048 - m_LightProbeSampleCountMultiplier: 4 - m_PVRBounces: 2 - m_PVRMinBounces: 2 - m_PVREnvironmentImportanceSampling: 0 - m_PVRFilteringMode: 0 - m_PVRDenoiserTypeDirect: 0 - m_PVRDenoiserTypeIndirect: 0 - m_PVRDenoiserTypeAO: 0 - m_PVRFilterTypeDirect: 0 - m_PVRFilterTypeIndirect: 0 - m_PVRFilterTypeAO: 0 - m_PVRFilteringGaussRadiusDirect: 1 - m_PVRFilteringGaussRadiusIndirect: 5 - m_PVRFilteringGaussRadiusAO: 2 - m_PVRFilteringAtrousPositionSigmaDirect: 0.5 - m_PVRFilteringAtrousPositionSigmaIndirect: 2 - m_PVRFilteringAtrousPositionSigmaAO: 1 - m_PVRTiledBaking: 0 - m_NumRaysToShootPerTexel: -1 - m_RespectSceneVisibilityWhenBakingGI: 0 diff --git a/Assets/GameMain/Scenes/Menu.meta b/Assets/GameMain/Scenes/Menu.meta new file mode 100644 index 0000000..256b42b --- /dev/null +++ b/Assets/GameMain/Scenes/Menu.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 29930de0f940628418fed89e3808746f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Scenes/Menu/LightingData.asset b/Assets/GameMain/Scenes/Menu/LightingData.asset new file mode 100644 index 0000000..7f85015 Binary files /dev/null and b/Assets/GameMain/Scenes/Menu/LightingData.asset differ diff --git a/Assets/GameMain/Scenes/Menu/LightingData.asset.meta b/Assets/GameMain/Scenes/Menu/LightingData.asset.meta new file mode 100644 index 0000000..48b1d34 --- /dev/null +++ b/Assets/GameMain/Scenes/Menu/LightingData.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6756a079a4ef9c6428b0209b454e1241 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 112000000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Scenes/StressTest/GlobalVolumeProfile.asset b/Assets/GameMain/Scenes/StressTest/GlobalVolumeProfile.asset deleted file mode 100644 index c76f07b..0000000 --- a/Assets/GameMain/Scenes/StressTest/GlobalVolumeProfile.asset +++ /dev/null @@ -1,104 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &-32820517437979890 -MonoBehaviour: - m_ObjectHideFlags: 3 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 0b2db86121404754db890f4c8dfe81b2, type: 3} - m_Name: Bloom - m_EditorClassIdentifier: - active: 1 - skipIterations: - m_OverrideState: 0 - m_Value: 1 - threshold: - m_OverrideState: 0 - m_Value: 0.9 - intensity: - m_OverrideState: 1 - m_Value: 1 - scatter: - m_OverrideState: 0 - m_Value: 0.7 - clamp: - m_OverrideState: 0 - m_Value: 65472 - tint: - m_OverrideState: 0 - m_Value: {r: 1, g: 1, b: 1, a: 1} - highQualityFiltering: - m_OverrideState: 0 - m_Value: 0 - downscale: - m_OverrideState: 0 - m_Value: 0 - maxIterations: - m_OverrideState: 0 - m_Value: 6 - dirtTexture: - m_OverrideState: 0 - m_Value: {fileID: 0} - dimension: 1 - dirtIntensity: - m_OverrideState: 0 - m_Value: 0 ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3} - m_Name: GlobalVolumeProfile - m_EditorClassIdentifier: - components: - - {fileID: 1881579288749618558} - - {fileID: -32820517437979890} ---- !u!114 &1881579288749618558 -MonoBehaviour: - m_ObjectHideFlags: 3 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 97c23e3b12dc18c42a140437e53d3951, type: 3} - m_Name: Tonemapping - m_EditorClassIdentifier: - active: 1 - mode: - m_OverrideState: 1 - m_Value: 1 - neutralHDRRangeReductionMode: - m_OverrideState: 0 - m_Value: 2 - acesPreset: - m_OverrideState: 0 - m_Value: 3 - hueShiftAmount: - m_OverrideState: 0 - m_Value: 0 - detectPaperWhite: - m_OverrideState: 0 - m_Value: 0 - paperWhite: - m_OverrideState: 0 - m_Value: 300 - detectBrightnessLimits: - m_OverrideState: 0 - m_Value: 1 - minNits: - m_OverrideState: 0 - m_Value: 0.005 - maxNits: - m_OverrideState: 0 - m_Value: 1000 diff --git a/Assets/GameMain/Scripts/Base/GameEntry.Custom.cs b/Assets/GameMain/Scripts/Base/GameEntry.Custom.cs index d70f028..456e71c 100644 --- a/Assets/GameMain/Scripts/Base/GameEntry.Custom.cs +++ b/Assets/GameMain/Scripts/Base/GameEntry.Custom.cs @@ -18,6 +18,11 @@ public partial class GameEntry : MonoBehaviour public static BuiltinDataComponent BuiltinData { get; private set; } public static HPBarComponent HPBar { get; private set; } + + public static DamageTextComponent DamageText { get; private set; } +#if UNITY_EDITOR || DEVELOPMENT_BUILD + public static RuntimeDebugPanelComponent RuntimeDebugPanel { get; private set; } +#endif public static EnemyManagerComponent EnemyManager { get; private set; } @@ -29,6 +34,18 @@ public partial class GameEntry : MonoBehaviour { BuiltinData = UnityGameFramework.Runtime.GameEntry.GetComponent(); HPBar = UnityGameFramework.Runtime.GameEntry.GetComponent(); + DamageText = UnityGameFramework.Runtime.GameEntry.GetComponent(); + if (DamageText == null && Base != null) + { + DamageText = Base.gameObject.AddComponent(); + } +#if UNITY_EDITOR || DEVELOPMENT_BUILD + RuntimeDebugPanel = UnityGameFramework.Runtime.GameEntry.GetComponent(); + if (RuntimeDebugPanel == null && Base != null) + { + RuntimeDebugPanel = Base.gameObject.AddComponent(); + } +#endif EnemyManager = UnityGameFramework.Runtime.GameEntry.GetComponent(); SpriteCache = UnityGameFramework.Runtime.GameEntry.GetComponent(); UIRouter = UnityGameFramework.Runtime.GameEntry.GetComponent(); diff --git a/Assets/GameMain/Scripts/Components/AbsorbComponent.cs b/Assets/GameMain/Scripts/Components/AbsorbComponent.cs new file mode 100644 index 0000000..6c6bc7b --- /dev/null +++ b/Assets/GameMain/Scripts/Components/AbsorbComponent.cs @@ -0,0 +1,101 @@ +using System; +using Definition.DataStruct; +using Definition.Enum; +using Entity; +using UnityEngine; + +namespace Components +{ + public class AbsorbComponent : MonoBehaviour + { + [SerializeField] private float _absorbRangeBase = 3f; + [SerializeField] private float _absorbSpeed = 15f; + [SerializeField] private float _collectDistance = 0.35f; + [SerializeField] private int _maxDetectCount = 64; + [SerializeField] private LayerMask _detectLayerMask = ~0; + + private Player _player; + private Transform _target; + private StatComponent _statComponent; + private Collider[] _buffer; + + private StatProperty _absorbRangeStat; + private Action _absorbRangeStatCallback; + + private float AbsorbRange => Mathf.Max(0f, (_absorbRangeBase + _absorbRangeStat.Value) * _absorbRangeStat.Percent); + + public void OnInit(Player player, StatComponent statComponent = null) + { + _player = player; + _target = player != null ? player.CachedTransform : null; + _statComponent = statComponent; + _buffer = new Collider[Mathf.Max(1, _maxDetectCount)]; + + if (_statComponent != null) + { + _absorbRangeStat = _statComponent.GetStat(StatType.AbsorbRange); + _absorbRangeStatCallback = (modifier, isApply) => + _statComponent.UpdateStat(_absorbRangeStat, modifier, isApply); + _statComponent.Subscribe(StatType.AbsorbRange, _absorbRangeStatCallback); + } + else + { + _absorbRangeStat = new StatProperty(); + } + } + + public void OnUpdate(float elapseSeconds, float realElapseSeconds) + { + if (_player == null || !_player.Available || _target == null || _buffer == null) return; + + int hitCount = Physics.OverlapSphereNonAlloc( + _target.position, + AbsorbRange, + _buffer, + _detectLayerMask, + QueryTriggerInteraction.Collide + ); + + for (int i = 0; i < hitCount; i++) + { + Collider hit = _buffer[i]; + if (hit == null) continue; + + CoinEntity coin = hit.GetComponent(); + if (coin != null && coin.Available) + { + AbsorbDrop(coin.CachedTransform, elapseSeconds); + coin.TryCollect(_player, _collectDistance); + continue; + } + + ExpEntity exp = hit.GetComponent(); + if (exp != null && exp.Available) + { + AbsorbDrop(exp.CachedTransform, elapseSeconds); + exp.TryCollect(_player, _collectDistance); + } + } + } + + public void OnReset() + { + if (_statComponent != null) + { + _statComponent.Unsubscribe(StatType.AbsorbRange, _absorbRangeStatCallback); + _absorbRangeStatCallback = null; + } + + _statComponent = null; + _target = null; + _player = null; + _buffer = null; + } + + private void AbsorbDrop(Transform drop, float deltaTime) + { + if (drop == null || _target == null) return; + drop.position = Vector3.MoveTowards(drop.position, _target.position, _absorbSpeed * deltaTime); + } + } +} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableCodeGenerator.cs.meta b/Assets/GameMain/Scripts/Components/AbsorbComponent.cs.meta similarity index 83% rename from Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableCodeGenerator.cs.meta rename to Assets/GameMain/Scripts/Components/AbsorbComponent.cs.meta index 9c867cf..0d15fec 100644 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableCodeGenerator.cs.meta +++ b/Assets/GameMain/Scripts/Components/AbsorbComponent.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 40941eb45ca7d284f8a806370b88fa78 +guid: 46f46350fed64d8389ebb4ae72b65796 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/GameMain/Scripts/Components/HealthComponent.cs b/Assets/GameMain/Scripts/Components/HealthComponent.cs index 26aca1e..5aad635 100644 --- a/Assets/GameMain/Scripts/Components/HealthComponent.cs +++ b/Assets/GameMain/Scripts/Components/HealthComponent.cs @@ -1,4 +1,4 @@ -using System; +using System; using CustomEvent; using Definition.DataStruct; using Definition.Enum; @@ -119,7 +119,9 @@ namespace Components private void CauseDamage(int damage) { - //TODO:受击效果:跳字、粒子 + if (damage <= 0 || GameEntry.DamageText == null) return; + GameEntry.DamageText.ShowDamage(transform.position + Vector3.up * 1.1f, damage); } } -} \ No newline at end of file +} + diff --git a/Assets/GameMain/Scripts/CustomComponent/DamageText.meta b/Assets/GameMain/Scripts/CustomComponent/DamageText.meta new file mode 100644 index 0000000..814975c --- /dev/null +++ b/Assets/GameMain/Scripts/CustomComponent/DamageText.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6befdfdd5f3e430a864a90bf445000e8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Scripts/CustomComponent/DamageText/DamageTextComponent.cs b/Assets/GameMain/Scripts/CustomComponent/DamageText/DamageTextComponent.cs new file mode 100644 index 0000000..86efb80 --- /dev/null +++ b/Assets/GameMain/Scripts/CustomComponent/DamageText/DamageTextComponent.cs @@ -0,0 +1,67 @@ +using System.Collections.Generic; +using GameFramework.ObjectPool; +using TMPro; +using UnityEngine; +using UnityEngine.UI; +using UnityGameFramework.Runtime; + +namespace CustomComponent +{ + public class DamageTextComponent : GameFrameworkComponent + { + [SerializeField] private int _instancePoolCapacity = 32; + + [SerializeField] private string _poolName = "DamageTextItem"; + + [SerializeField] private RectTransform _instanceRoot; + + [SerializeField] private Canvas _canvas; + + [SerializeField] private GameObject _damageTextItemPrefab; + + private IObjectPool _damageTextItemPool; + + private readonly List _activeDamageTextItems = new(); + + private void Start() + { + _damageTextItemPool = + GameEntry.ObjectPool.CreateSingleSpawnObjectPool(_poolName, + _instancePoolCapacity); + } + + public void ShowDamage(Vector3 worldPosition, int damage) + { + if (damage <= 0 || _damageTextItemPool == null || _canvas == null) return; + + DamageTextItem item = CreateDamageTextItem(); + if (item == null) return; + + item.Show(worldPosition, damage, _canvas, OnItemComplete); + _activeDamageTextItems.Add(item); + } + + private DamageTextItem CreateDamageTextItem() + { + DamageTextItemObject itemObject = _damageTextItemPool.Spawn(); + if (itemObject != null) + { + return (DamageTextItem)itemObject.Target; + } + + GameObject itemGo = Instantiate(_damageTextItemPrefab, _instanceRoot, false); + + DamageTextItem item = itemGo.GetComponent(); + _damageTextItemPool.Register(DamageTextItemObject.Create(item), true); + return item; + } + + private void OnItemComplete(DamageTextItem item) + { + if (item == null) return; + item.ResetItem(); + _activeDamageTextItems.Remove(item); + _damageTextItemPool.Unspawn(item); + } + } +} \ No newline at end of file diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableGenerator.cs.meta b/Assets/GameMain/Scripts/CustomComponent/DamageText/DamageTextComponent.cs.meta similarity index 83% rename from Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableGenerator.cs.meta rename to Assets/GameMain/Scripts/CustomComponent/DamageText/DamageTextComponent.cs.meta index 37a8f2f..ff14999 100644 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableGenerator.cs.meta +++ b/Assets/GameMain/Scripts/CustomComponent/DamageText/DamageTextComponent.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f91ec109eb6c73a408325960701b4c94 +guid: 366eb88b821a4048891b7fb01a1b8d42 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/GameMain/Scripts/CustomComponent/DamageText/DamageTextItem.cs b/Assets/GameMain/Scripts/CustomComponent/DamageText/DamageTextItem.cs new file mode 100644 index 0000000..21ea3c4 --- /dev/null +++ b/Assets/GameMain/Scripts/CustomComponent/DamageText/DamageTextItem.cs @@ -0,0 +1,80 @@ +using System; +using DG.Tweening; +using TMPro; +using UnityEngine; + +namespace CustomComponent +{ + public class DamageTextItem : MonoBehaviour + { + private const float RiseDistance = 80f; + private const float RiseDuration = 0.55f; + private const float FadeDelay = 0.2f; + private const float FadeDuration = 0.35f; + private static readonly Color NormalColor = new Color(1f, 0.32f, 0.23f, 1f); + + [SerializeField] private RectTransform _cachedTransform; + + [SerializeField] private CanvasGroup _canvasGroup; + + [SerializeField] private TMP_Text _text; + + private Sequence _sequence; + private Action _onComplete; + + private void Awake() + { + if (_cachedTransform == null) _cachedTransform = GetComponent(); + if (_canvasGroup == null) _canvasGroup = GetComponent(); + if (_text == null) _text = GetComponent(); + } + + public void Show(Vector3 worldPosition, int damage, Canvas canvas, Action onComplete) + { + if (canvas == null || GameEntry.Scene.MainCamera == null) return; + + _onComplete = onComplete; + gameObject.SetActive(true); + KillSequence(); + + _canvasGroup.alpha = 1f; + _cachedTransform.localScale = Vector3.one; + _text.color = NormalColor; + _text.text = damage.ToString(); + + Vector3 screenPos = GameEntry.Scene.MainCamera.WorldToScreenPoint(worldPosition); + RectTransformUtility.ScreenPointToLocalPointInRectangle((RectTransform)canvas.transform, screenPos, + canvas.worldCamera, out Vector2 localPos); + localPos.x += UnityEngine.Random.Range(-24f, 24f); + _cachedTransform.anchoredPosition = localPos; + + _sequence = DOTween.Sequence(); + _sequence.Append(_cachedTransform.DOAnchorPosY(localPos.y + RiseDistance, RiseDuration) + .SetEase(Ease.OutQuad)); + _sequence.Join(_cachedTransform.DOPunchScale(new Vector3(0.15f, 0.15f, 0f), 0.18f, 6, 0.75f)); + _sequence.Join(_canvasGroup.DOFade(0f, FadeDuration).SetDelay(FadeDelay)); + _sequence.OnComplete(() => _onComplete?.Invoke(this)); + } + + public void ResetItem() + { + KillSequence(); + _onComplete = null; + _canvasGroup.alpha = 1f; + _text.text = string.Empty; + gameObject.SetActive(false); + } + + private void OnDestroy() + { + KillSequence(); + } + + private void KillSequence() + { + if (_sequence == null) return; + _sequence.Kill(); + _sequence = null; + } + } +} \ No newline at end of file diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableGeneratorMenu.cs.meta b/Assets/GameMain/Scripts/CustomComponent/DamageText/DamageTextItem.cs.meta similarity index 83% rename from Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableGeneratorMenu.cs.meta rename to Assets/GameMain/Scripts/CustomComponent/DamageText/DamageTextItem.cs.meta index 9c5322f..552af7c 100644 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableGeneratorMenu.cs.meta +++ b/Assets/GameMain/Scripts/CustomComponent/DamageText/DamageTextItem.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7ddc8f13b2516c643a67d92a319dbf72 +guid: 501e678f9cb14af6ac45e8d2050388d3 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/GameMain/Scripts/CustomComponent/DamageText/DamageTextItemObject.cs b/Assets/GameMain/Scripts/CustomComponent/DamageText/DamageTextItemObject.cs new file mode 100644 index 0000000..3ff5800 --- /dev/null +++ b/Assets/GameMain/Scripts/CustomComponent/DamageText/DamageTextItemObject.cs @@ -0,0 +1,23 @@ +using GameFramework; +using GameFramework.ObjectPool; +using UnityEngine; + +namespace CustomComponent +{ + public class DamageTextItemObject : ObjectBase + { + public static DamageTextItemObject Create(object target) + { + DamageTextItemObject itemObject = ReferencePool.Acquire(); + itemObject.Initialize(target); + return itemObject; + } + + protected override void Release(bool isShutdown) + { + DamageTextItem item = (DamageTextItem)Target; + if (item == null) return; + Object.Destroy(item.gameObject); + } + } +} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.BooleanProcessor.cs.meta b/Assets/GameMain/Scripts/CustomComponent/DamageText/DamageTextItemObject.cs.meta similarity index 83% rename from Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.BooleanProcessor.cs.meta rename to Assets/GameMain/Scripts/CustomComponent/DamageText/DamageTextItemObject.cs.meta index 1c86b4f..8fb6ccb 100644 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.BooleanProcessor.cs.meta +++ b/Assets/GameMain/Scripts/CustomComponent/DamageText/DamageTextItemObject.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 00bc8bc968fa2134095a36a43f326d56 +guid: 4aba1230dece448eba1fa7579ca7a13d MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/GameMain/Scripts/CustomComponent/DebugPanel.meta b/Assets/GameMain/Scripts/CustomComponent/DebugPanel.meta new file mode 100644 index 0000000..38c84e7 --- /dev/null +++ b/Assets/GameMain/Scripts/CustomComponent/DebugPanel.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a11ef2e359b24bfdb6c9120cc2ec81b8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Scripts/CustomComponent/DebugPanel/RuntimeDebugPanelComponent.cs b/Assets/GameMain/Scripts/CustomComponent/DebugPanel/RuntimeDebugPanelComponent.cs new file mode 100644 index 0000000..06228ed --- /dev/null +++ b/Assets/GameMain/Scripts/CustomComponent/DebugPanel/RuntimeDebugPanelComponent.cs @@ -0,0 +1,349 @@ +#if UNITY_EDITOR || DEVELOPMENT_BUILD +using System; +using System.Linq; +using DataTable; +using Definition.DataStruct; +using Entity; +using Game.Utility; +using UnityEngine; +using UnityGameFramework.Runtime; +#if ENABLE_INPUT_SYSTEM +using UnityEngine.InputSystem; +#endif + +namespace CustomComponent +{ + public class RuntimeDebugPanelComponent : GameFrameworkComponent + { + private const float MinSpawnRate = 0.1f; + private const float CornerTapWindow = 0.6f; + private const int RequiredCornerTapCount = 3; + + private Rect _windowRect = new Rect(20f, 60f, 460f, 620f); + private bool _isPanelVisible; + private int _windowId; + + private string _searchText = string.Empty; + private int _selectedIndex; + private int _addCount = 1; + private Vector2 _buffScroll; + + private float _spawnRateScaleInput = 1f; + private float _extendDurationSeconds = 30f; + + private DRProp[] _allProps = Array.Empty(); + private DRProp[] _filteredProps = Array.Empty(); + private string[] _displayNames = Array.Empty(); + + private int _cornerTapCount; + private float _lastCornerTapTime = -10f; + + protected override void Awake() + { + base.Awake(); + + _windowId = GetInstanceID(); + } + + private void Update() + { + if (IsTogglePressed()) + { + _isPanelVisible = !_isPanelVisible; + } + + HandleCornerTapGesture(); + } + + private void OnGUI() + { + DrawToggleButton(); + if (!_isPanelVisible) return; + + _windowRect = GUI.Window(_windowId, _windowRect, DrawWindow, "Runtime Debug Panel"); + } + + private void DrawToggleButton() + { + const float width = 64f; + const float height = 30f; + Rect buttonRect = new Rect(Screen.width - width - 12f, 10f, width, height); + if (GUI.Button(buttonRect, "DEBUG")) + { + _isPanelVisible = !_isPanelVisible; + } + } + + private void DrawWindow(int windowId) + { + EnsurePropList(); + + GUILayout.BeginVertical(); + + DrawBuffSection(); + + GUILayout.Space(8f); + GUILayout.Label(string.Empty, GUI.skin.horizontalSlider); + GUILayout.Space(8f); + + DrawBattleSection(); + + GUILayout.Space(8f); + GUILayout.Label("Tips: press `F8` or tap top-left corner 3 times to toggle.", GUILayout.Height(20f)); + + GUILayout.EndVertical(); + GUI.DragWindow(new Rect(0, 0, 10000, 22)); + } + + private void DrawBuffSection() + { + GUILayout.Label("Buff Debug"); + GUILayout.BeginHorizontal(); + GUILayout.Label("Search", GUILayout.Width(52f)); + _searchText = GUILayout.TextField(_searchText); + if (GUILayout.Button("Refresh", GUILayout.Width(80f))) + { + EnsurePropList(true); + } + GUILayout.EndHorizontal(); + + ApplyFilter(_searchText); + if (_displayNames.Length == 0) + { + GUILayout.Label("No Buff data. Enter battle and try again."); + return; + } + + _selectedIndex = Mathf.Clamp(_selectedIndex, 0, _displayNames.Length - 1); + _buffScroll = GUILayout.BeginScrollView(_buffScroll, GUILayout.Height(120f)); + _selectedIndex = GUILayout.SelectionGrid(_selectedIndex, _displayNames, 1); + GUILayout.EndScrollView(); + + DRProp selectedProp = GetSelectedProp(); + if (selectedProp == null) return; + + GUILayout.Label($"Selected: {selectedProp.Title} ({selectedProp.Rarity})"); + GUILayout.Label(ItemDescUtility.CreatePropDescription(selectedProp.Modifiers), GUILayout.Height(40f)); + + GUILayout.BeginHorizontal(); + GUILayout.Label("Count", GUILayout.Width(52f)); + string addCountText = GUILayout.TextField(_addCount.ToString(), GUILayout.Width(60f)); + if (!int.TryParse(addCountText, out _addCount)) _addCount = 1; + _addCount = Mathf.Clamp(_addCount, 1, 99); + + if (GUILayout.Button("Add Buff To Player", GUILayout.Height(24f))) + { + AddSelectedBuffToPlayer(selectedProp, _addCount); + } + GUILayout.EndHorizontal(); + } + + private void DrawBattleSection() + { + GUILayout.Label("Battle Debug"); + EnemyManagerComponent enemyManager = GameEntry.EnemyManager; + Player player = FindPlayer(); + + if (enemyManager == null) + { + GUILayout.Label("EnemyManager unavailable."); + return; + } + + GUILayout.Label($"Spawn Rate: {enemyManager.SpawnRateScale:F2}"); + GUILayout.Label($"Battle Time: {enemyManager.ElapsedBattleTime:F1}s / {enemyManager.BattleDuration:F1}s"); + + GUILayout.BeginHorizontal(); + GUILayout.Label("Rate", GUILayout.Width(52f)); + string rateText = GUILayout.TextField(_spawnRateScaleInput.ToString("F2"), GUILayout.Width(60f)); + if (float.TryParse(rateText, out float parsedRate)) + { + _spawnRateScaleInput = Mathf.Clamp(parsedRate, MinSpawnRate, 50f); + } + + if (GUILayout.Button("Apply", GUILayout.Width(70f))) + { + enemyManager.SetSpawnRateScale(_spawnRateScaleInput); + } + if (GUILayout.Button("x0.5", GUILayout.Width(60f))) + { + _spawnRateScaleInput = Mathf.Max(MinSpawnRate, enemyManager.SpawnRateScale * 0.5f); + enemyManager.SetSpawnRateScale(_spawnRateScaleInput); + } + if (GUILayout.Button("x2", GUILayout.Width(60f))) + { + _spawnRateScaleInput = enemyManager.SpawnRateScale * 2f; + enemyManager.SetSpawnRateScale(_spawnRateScaleInput); + } + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + GUILayout.Label("Add Sec", GUILayout.Width(52f)); + string durationText = GUILayout.TextField(_extendDurationSeconds.ToString("F0"), GUILayout.Width(60f)); + if (float.TryParse(durationText, out float parsedDuration)) + { + _extendDurationSeconds = Mathf.Clamp(parsedDuration, 1f, 3600f); + } + + if (GUILayout.Button("Extend Battle", GUILayout.Height(24f))) + { + enemyManager.AddBattleDuration(_extendDurationSeconds); + } + GUILayout.EndHorizontal(); + + GUILayout.Label($"Player Weapon: {(player == null ? "Player not found" : (player.WeaponEnabled ? "Enabled" : "Disabled"))}"); + GUILayout.BeginHorizontal(); + GUI.enabled = player != null; + if (GUILayout.Button("Disable Weapons", GUILayout.Height(24f))) + { + player.SetWeaponEnabled(false); + } + if (GUILayout.Button("Enable Weapons", GUILayout.Height(24f))) + { + player.SetWeaponEnabled(true); + } + GUI.enabled = true; + GUILayout.EndHorizontal(); + } + + private void EnsurePropList(bool force = false) + { + if (!force && _allProps != null && _allProps.Length > 0) return; + + if (GameEntry.DataTable == null) + { + _allProps = Array.Empty(); + _filteredProps = Array.Empty(); + _displayNames = Array.Empty(); + return; + } + + var table = GameEntry.DataTable.GetDataTable(); + _allProps = table != null ? table.ToArray() : Array.Empty(); + _selectedIndex = Mathf.Clamp(_selectedIndex, 0, Mathf.Max(0, _allProps.Length - 1)); + ApplyFilter(_searchText); + } + + private void ApplyFilter(string keyword) + { + if (_allProps == null || _allProps.Length == 0) + { + _filteredProps = Array.Empty(); + _displayNames = Array.Empty(); + return; + } + + if (string.IsNullOrWhiteSpace(keyword)) + { + _filteredProps = _allProps; + } + else + { + string search = keyword.Trim(); + _filteredProps = _allProps.Where(p => + p != null && + (p.Title?.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0 || + p.Id.ToString().Contains(search))).ToArray(); + } + + _displayNames = _filteredProps.Select(p => $"[{p.Id}] {p.Title} ({p.Rarity})").ToArray(); + if (_displayNames.Length == 0) _selectedIndex = 0; + else _selectedIndex = Mathf.Clamp(_selectedIndex, 0, _displayNames.Length - 1); + } + + private DRProp GetSelectedProp() + { + if (_filteredProps == null || _filteredProps.Length == 0) return null; + _selectedIndex = Mathf.Clamp(_selectedIndex, 0, _filteredProps.Length - 1); + return _filteredProps[_selectedIndex]; + } + + private static Player FindPlayer() + { + return UnityEngine.Object.FindObjectOfType(); + } + + private static void AddSelectedBuffToPlayer(DRProp prop, int count) + { + Player player = FindPlayer(); + if (player == null || prop == null || prop.Modifiers == null) return; + + int applyCount = Mathf.Clamp(count, 1, 99); + for (int i = 0; i < applyCount; i++) + { + player.AddProp(new PropItem(prop.Modifiers, prop.Rarity, prop.Title, prop.IconAssetName)); + } + } + + private void HandleCornerTapGesture() + { + if (!TryGetTouchReleased(out Vector2 touchPosition)) return; + if (touchPosition.x > 80f || touchPosition.y < Screen.height - 80f) return; + + float now = Time.unscaledTime; + if (now - _lastCornerTapTime > CornerTapWindow) + { + _cornerTapCount = 0; + } + + _lastCornerTapTime = now; + _cornerTapCount++; + + if (_cornerTapCount >= RequiredCornerTapCount) + { + _cornerTapCount = 0; + _isPanelVisible = !_isPanelVisible; + } + } + + private static bool IsTogglePressed() + { +#if ENABLE_INPUT_SYSTEM + Keyboard keyboard = Keyboard.current; + if (keyboard == null) return false; + return keyboard.backquoteKey.wasPressedThisFrame || keyboard.f8Key.wasPressedThisFrame; +#else + return Input.GetKeyDown(KeyCode.BackQuote) || Input.GetKeyDown(KeyCode.F8); +#endif + } + + private static bool TryGetTouchReleased(out Vector2 touchPosition) + { +#if ENABLE_INPUT_SYSTEM + Touchscreen touchscreen = Touchscreen.current; + if (touchscreen == null) + { + touchPosition = default; + return false; + } + + var touch = touchscreen.primaryTouch; + if (!touch.press.wasReleasedThisFrame) + { + touchPosition = default; + return false; + } + + touchPosition = touch.position.ReadValue(); + return true; +#else + if (Input.touchCount <= 0) + { + touchPosition = default; + return false; + } + + Touch touch = Input.GetTouch(0); + if (touch.phase != TouchPhase.Ended) + { + touchPosition = default; + return false; + } + + touchPosition = touch.position; + return true; +#endif + } + } +} +#endif diff --git a/Assets/GameMain/Scripts/CustomComponent/DebugPanel/RuntimeDebugPanelComponent.cs.meta b/Assets/GameMain/Scripts/CustomComponent/DebugPanel/RuntimeDebugPanelComponent.cs.meta new file mode 100644 index 0000000..c9a928c --- /dev/null +++ b/Assets/GameMain/Scripts/CustomComponent/DebugPanel/RuntimeDebugPanelComponent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1d8ada5157a04921a6e543a040e57960 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Scripts/CustomComponent/EnemyManager/EnemyManagerComponent.cs b/Assets/GameMain/Scripts/CustomComponent/EnemyManager/EnemyManagerComponent.cs index 0110d03..b6e81a4 100644 --- a/Assets/GameMain/Scripts/CustomComponent/EnemyManager/EnemyManagerComponent.cs +++ b/Assets/GameMain/Scripts/CustomComponent/EnemyManager/EnemyManagerComponent.cs @@ -13,6 +13,8 @@ namespace CustomComponent { public class EnemyManagerComponent : GameFrameworkComponent { + private const float MinSpawnRateScale = 0.1f; + private EntityComponent _entity; private List _enemies; @@ -20,23 +22,35 @@ namespace CustomComponent public List Enemies => _enemies; private float _spawnEnemyTimer; + private int _spawnEnemyMaxCount = 5000; + private int _currentEnemyCount; + private int _spawnDistanceFromPlayer = 20; + private int _currentSpawnEnemyId; + private int _currentLevel; + private float[] _baseSpawnEnemyIntervals; private float[] _spawnEnemyIntervals; private int[] _spawnEnemyIds; private int[] _spawnEnemyCounts; private float _duration; + private float _baseDuration; private float[] _nextSpawnTimes; + private float _spawnRateScale = 1f; private Transform _player; private GameStateBattle _battle; + public float SpawnRateScale => _spawnRateScale; + public float BattleDuration => _duration; + public float ElapsedBattleTime => _spawnEnemyTimer; + #region FSM private void Start() @@ -64,12 +78,14 @@ namespace CustomComponent _currentLevel = level; DRLevel levelData = GameEntry.DataTable.GetDataTableRow(_currentLevel); - _spawnEnemyIntervals = levelData.Intervals; + _baseSpawnEnemyIntervals = (float[])levelData.Intervals.Clone(); + _spawnEnemyIntervals = (float[])_baseSpawnEnemyIntervals.Clone(); _spawnEnemyIds = levelData.EntityIds; _spawnEnemyCounts = levelData.EntityCounts; - _duration = levelData.Duration; + _baseDuration = levelData.Duration; + _duration = _baseDuration; - _nextSpawnTimes = (float[])_spawnEnemyIntervals.Clone(); + SetSpawnRateScale(_spawnRateScale); _currentSpawnEnemyId = 0; } @@ -77,10 +93,7 @@ namespace CustomComponent public void OnUpdate(float elapseSeconds, float realElapseSeconds) { _spawnEnemyTimer += elapseSeconds; - // if (_spawnEnemyTimer < _spawnEnemyInterval) return; - // SpawnEnemy(); - // _spawnEnemyTimer = 0; - // _spawnEnemyInterval = Mathf.Max(0.1f, _spawnEnemyInterval - _spawnEnemyAccelerate); + if (_spawnEnemyTimer > _duration) { _battle.LevelOver(); @@ -108,9 +121,11 @@ namespace CustomComponent _currentSpawnEnemyId = 0; _currentLevel = 0; + _baseSpawnEnemyIntervals = null; _spawnEnemyIntervals = null; _spawnEnemyIds = null; _spawnEnemyCounts = null; + _baseDuration = 0; _duration = 0; _nextSpawnTimes = null; @@ -120,6 +135,57 @@ namespace CustomComponent ClearEnemies(); } + public void SetSpawnRateScale(float scale) + { + float newScale = Mathf.Max(MinSpawnRateScale, scale); + if (_baseSpawnEnemyIntervals == null || _baseSpawnEnemyIntervals.Length == 0) + { + _spawnRateScale = newScale; + return; + } + + bool hasRuntimeState = _nextSpawnTimes != null && _spawnEnemyIntervals != null && + _nextSpawnTimes.Length == _baseSpawnEnemyIntervals.Length && + _spawnEnemyIntervals.Length == _baseSpawnEnemyIntervals.Length; + float oldScale = _spawnRateScale; + _spawnRateScale = newScale; + + if (!hasRuntimeState) + { + for (int i = 0; i < _baseSpawnEnemyIntervals.Length; i++) + { + _spawnEnemyIntervals[i] = GetScaledInterval(_baseSpawnEnemyIntervals[i], _spawnRateScale); + } + + _nextSpawnTimes = (float[])_spawnEnemyIntervals.Clone(); + return; + } + + for (int i = 0; i < _baseSpawnEnemyIntervals.Length; i++) + { + float oldInterval = GetScaledInterval(_baseSpawnEnemyIntervals[i], oldScale); + float newInterval = GetScaledInterval(_baseSpawnEnemyIntervals[i], _spawnRateScale); + + float remainTime = Mathf.Max(0f, _nextSpawnTimes[i] - _spawnEnemyTimer); + float remainRatio = oldInterval > Mathf.Epsilon ? Mathf.Clamp01(remainTime / oldInterval) : 0f; + + _spawnEnemyIntervals[i] = newInterval; + _nextSpawnTimes[i] = _spawnEnemyTimer + newInterval * remainRatio; + } + } + + public void AddBattleDuration(float seconds) + { + if (seconds <= 0f) return; + _duration += seconds; + } + + private static float GetScaledInterval(float baseInterval, float scale) + { + float safeScale = Mathf.Max(MinSpawnRateScale, scale); + return baseInterval / safeScale; + } + #endregion private void SpawnEnemy(int entityId) @@ -128,7 +194,7 @@ namespace CustomComponent if (_currentEnemyCount >= _spawnEnemyMaxCount) return; int entityPoolId = _currentSpawnEnemyId % _spawnEnemyMaxCount; - var enemyData = new EnemyData(entityPoolId, entityId) + var enemyData = new EnemyData(entityPoolId, entityId, _currentLevel) { Position = GetRandomPosition() }; @@ -187,4 +253,4 @@ namespace CustomComponent #endregion } -} \ No newline at end of file +} diff --git a/Assets/GameMain/Scripts/CustomComponent/HPBar/HPBarComponent.cs b/Assets/GameMain/Scripts/CustomComponent/HPBar/HPBarComponent.cs index ebc7833..dbcbc64 100644 --- a/Assets/GameMain/Scripts/CustomComponent/HPBar/HPBarComponent.cs +++ b/Assets/GameMain/Scripts/CustomComponent/HPBar/HPBarComponent.cs @@ -17,14 +17,11 @@ namespace CustomComponent { public class HPBarComponent : GameFrameworkComponent { - [FormerlySerializedAs("m_HPBarItemTemplate")] [SerializeField] - private HPBarItem _hpBarItemTemplate = null; + [SerializeField] private HPBarItem _hpBarItemTemplate = null; - [FormerlySerializedAs("m_HPBarInstanceRoot")] [SerializeField] - private Transform _hpBarInstanceRoot = null; + [SerializeField] private Transform _hpBarInstanceRoot = null; - [FormerlySerializedAs("m_InstancePoolCapacity")] [SerializeField] - private int _instancePoolCapacity = 16; + [SerializeField] private int _instancePoolCapacity = 16; private IObjectPool _hpBarItemObjectPool = null; private List _activeHPBarItems = null; @@ -39,7 +36,8 @@ namespace CustomComponent } _cachedCanvas = _hpBarInstanceRoot.GetComponent(); - _hpBarItemObjectPool = GameEntry.ObjectPool.CreateSingleSpawnObjectPool("HPBarItem", _instancePoolCapacity); + _hpBarItemObjectPool = + GameEntry.ObjectPool.CreateSingleSpawnObjectPool("HPBarItem", _instancePoolCapacity); _activeHPBarItems = new List(); } @@ -124,4 +122,4 @@ namespace CustomComponent return hpBarItem; } } -} +} \ No newline at end of file diff --git a/Assets/GameMain/Scripts/DataTable/DREnemy.cs b/Assets/GameMain/Scripts/DataTable/DREnemy.cs index 546c1be..f56e9ad 100644 --- a/Assets/GameMain/Scripts/DataTable/DREnemy.cs +++ b/Assets/GameMain/Scripts/DataTable/DREnemy.cs @@ -7,6 +7,7 @@ namespace DataTable private int m_id; public override int Id => m_id; public int MaxHealth { get; private set; } + public int HpAddPerLevel { get; private set; } public float Speed { get; private set; } public int DropCoin { get; private set; } public int DropExp { get; private set; } @@ -21,6 +22,7 @@ namespace DataTable m_id = int.Parse(columnStrings[index++]); index++; MaxHealth = int.Parse(columnStrings[index++]); + HpAddPerLevel = int.Parse(columnStrings[index++]); Speed = float.Parse(columnStrings[index++]); DropCoin = int.Parse(columnStrings[index++]); DropExp = int.Parse(columnStrings[index++]); @@ -29,4 +31,4 @@ namespace DataTable return true; } } -} \ No newline at end of file +} diff --git a/Assets/GameMain/Scripts/DataTable/DRLevelRarity.cs b/Assets/GameMain/Scripts/DataTable/DRLevelRarity.cs new file mode 100644 index 0000000..90e7e97 --- /dev/null +++ b/Assets/GameMain/Scripts/DataTable/DRLevelRarity.cs @@ -0,0 +1,39 @@ +using UnityGameFramework.Runtime; + +namespace DataTable +{ + public class DRLevelRarity : DataRowBase + { + private int m_Id; + + public override int Id => m_Id; + + public int LevelMin { get; private set; } + public int LevelMax { get; private set; } + + public int WhiteWeight { get; private set; } + public int GreenWeight { get; private set; } + public int BlueWeight { get; private set; } + public int PurpleWeight { get; private set; } + public int RedWeight { get; private set; } + + public override bool ParseDataRow(string dataRowString, object userData) + { + string[] fields = dataRowString.Split(DataTableExtension.DataSplitSeparators); + + int index = 0; + index++; + m_Id = int.Parse(fields[index++]); + index++; + LevelMin = int.Parse(fields[index++]); + LevelMax = int.Parse(fields[index++]); + WhiteWeight = int.Parse(fields[index++]); + GreenWeight = int.Parse(fields[index++]); + BlueWeight = int.Parse(fields[index++]); + PurpleWeight = int.Parse(fields[index++]); + RedWeight = int.Parse(fields[index++]); + + return true; + } + } +} diff --git a/Assets/GameMain/Scripts/DataTable/DRLevelRarity.cs.meta b/Assets/GameMain/Scripts/DataTable/DRLevelRarity.cs.meta new file mode 100644 index 0000000..13b53a9 --- /dev/null +++ b/Assets/GameMain/Scripts/DataTable/DRLevelRarity.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2be3a3c9896a441496abfb07467e9e19 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Scripts/DataTable/DRLevelUpReward.cs b/Assets/GameMain/Scripts/DataTable/DRLevelUpReward.cs index e37c5ed..57c8f24 100644 --- a/Assets/GameMain/Scripts/DataTable/DRLevelUpReward.cs +++ b/Assets/GameMain/Scripts/DataTable/DRLevelUpReward.cs @@ -1,5 +1,7 @@ using Definition.DataStruct; +using Definition.Enum; using Newtonsoft.Json; +using StarForce; using UnityGameFramework.Runtime; namespace DataTable @@ -13,6 +15,8 @@ namespace DataTable public string Title { get; private set; } public string IconAssetName { get; private set; } + + public ItemRarity Rarity { get; private set; } public StatModifier[] Modifiers { get; private set; } @@ -26,6 +30,7 @@ namespace DataTable index++; Title = fields[index++]; IconAssetName = fields[index++]; + Rarity = EnumUtility.Get(fields[index++]); Modifiers = JsonConvert.DeserializeObject(fields[index++]); return true; diff --git a/Assets/GameMain/Scripts/Definition/DataStruct/StatModifier.cs b/Assets/GameMain/Scripts/Definition/DataStruct/StatModifier.cs index 6d79cb1..97b59b6 100644 --- a/Assets/GameMain/Scripts/Definition/DataStruct/StatModifier.cs +++ b/Assets/GameMain/Scripts/Definition/DataStruct/StatModifier.cs @@ -16,6 +16,7 @@ namespace Definition.DataStruct // Critical = 6, // CriticalDamage = 7, // Dodge = 8, + // AbsorbRange = 9 private readonly string[] _statTypeNames = { @@ -27,7 +28,8 @@ namespace Definition.DataStruct "冷却", "暴击率", "暴击伤害", - "闪避" + "闪避", + "金币/经验吸收范围" }; public StatType StatType; diff --git a/Assets/GameMain/Scripts/Definition/Enum/StatType.cs b/Assets/GameMain/Scripts/Definition/Enum/StatType.cs index 388e680..b1e5961 100644 --- a/Assets/GameMain/Scripts/Definition/Enum/StatType.cs +++ b/Assets/GameMain/Scripts/Definition/Enum/StatType.cs @@ -3,7 +3,7 @@ namespace Definition.Enum public enum StatType { None = 0, - + MaxHealth = 1, MovementSpeed = 2, Attack = 3, @@ -12,5 +12,6 @@ namespace Definition.Enum Critical = 6, CriticalDamage = 7, Dodge = 8, + AbsorbRange = 9, } -} \ No newline at end of file +} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableCodeGenerator.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableCodeGenerator.cs deleted file mode 100644 index af3c559..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableCodeGenerator.cs +++ /dev/null @@ -1,13 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System.Text; - -namespace StarForce.Editor.DataTableTools -{ - public delegate void DataTableCodeGenerator(DataTableProcessor dataTableProcessor, StringBuilder codeContent, object userData); -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableGenerator.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableGenerator.cs deleted file mode 100644 index fd76f3e..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableGenerator.cs +++ /dev/null @@ -1,412 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using GameFramework; -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using System.Text.RegularExpressions; -using UnityEngine; - -namespace StarForce.Editor.DataTableTools -{ - public sealed class DataTableGenerator - { - private const string DataTablePath = "Assets/GameMain/DataTables"; - private const string CSharpCodePath = "Assets/GameMain/Scripts/DataTable"; - private const string CSharpCodeTemplateFileName = "Assets/GameMain/Configs/DataTableCodeTemplate.txt"; - private static readonly Regex EndWithNumberRegex = new Regex(@"\d+$"); - private static readonly Regex NameRegex = new Regex(@"^[A-Z][A-Za-z0-9_]*$"); - - public static DataTableProcessor CreateDataTableProcessor(string dataTableName) - { - return new DataTableProcessor(Utility.Path.GetRegularPath(Path.Combine(DataTablePath, dataTableName + ".txt")), Encoding.GetEncoding("GB2312"), 1, 2, null, 3, 4, 1); - } - - public static bool CheckRawData(DataTableProcessor dataTableProcessor, string dataTableName) - { - for (int i = 0; i < dataTableProcessor.RawColumnCount; i++) - { - string name = dataTableProcessor.GetName(i); - if (string.IsNullOrEmpty(name) || name == "#") - { - continue; - } - - if (!NameRegex.IsMatch(name)) - { - Debug.LogWarning(Utility.Text.Format("Check raw data failure. DataTableName='{0}' Name='{1}'", dataTableName, name)); - return false; - } - } - - return true; - } - - public static void GenerateDataFile(DataTableProcessor dataTableProcessor, string dataTableName) - { - string binaryDataFileName = Utility.Path.GetRegularPath(Path.Combine(DataTablePath, dataTableName + ".bytes")); - if (!dataTableProcessor.GenerateDataFile(binaryDataFileName) && File.Exists(binaryDataFileName)) - { - File.Delete(binaryDataFileName); - } - } - - public static void GenerateCodeFile(DataTableProcessor dataTableProcessor, string dataTableName) - { - dataTableProcessor.SetCodeTemplate(CSharpCodeTemplateFileName, Encoding.UTF8); - dataTableProcessor.SetCodeGenerator(DataTableCodeGenerator); - - string csharpCodeFileName = Utility.Path.GetRegularPath(Path.Combine(CSharpCodePath, "DR" + dataTableName + ".cs")); - if (!dataTableProcessor.GenerateCodeFile(csharpCodeFileName, Encoding.UTF8, dataTableName) && File.Exists(csharpCodeFileName)) - { - File.Delete(csharpCodeFileName); - } - } - - private static void DataTableCodeGenerator(DataTableProcessor dataTableProcessor, StringBuilder codeContent, object userData) - { - string dataTableName = (string)userData; - - codeContent.Replace("__DATA_TABLE_CREATE_TIME__", DateTime.UtcNow.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss.fff")); - codeContent.Replace("__DATA_TABLE_NAME_SPACE__", "StarForce"); - codeContent.Replace("__DATA_TABLE_CLASS_NAME__", "DR" + dataTableName); - codeContent.Replace("__DATA_TABLE_COMMENT__", dataTableProcessor.GetValue(0, 1) + "。"); - codeContent.Replace("__DATA_TABLE_ID_COMMENT__", "获取" + dataTableProcessor.GetComment(dataTableProcessor.IdColumn) + "。"); - codeContent.Replace("__DATA_TABLE_PROPERTIES__", GenerateDataTableProperties(dataTableProcessor)); - codeContent.Replace("__DATA_TABLE_PARSER__", GenerateDataTableParser(dataTableProcessor)); - codeContent.Replace("__DATA_TABLE_PROPERTY_ARRAY__", GenerateDataTablePropertyArray(dataTableProcessor)); - } - - private static string GenerateDataTableProperties(DataTableProcessor dataTableProcessor) - { - StringBuilder stringBuilder = new StringBuilder(); - bool firstProperty = true; - for (int i = 0; i < dataTableProcessor.RawColumnCount; i++) - { - if (dataTableProcessor.IsCommentColumn(i)) - { - // 注释列 - continue; - } - - if (dataTableProcessor.IsIdColumn(i)) - { - // 编号列 - continue; - } - - if (firstProperty) - { - firstProperty = false; - } - else - { - stringBuilder.AppendLine().AppendLine(); - } - - stringBuilder - .AppendLine(" /// ") - .AppendFormat(" /// 获取{0}。", dataTableProcessor.GetComment(i)).AppendLine() - .AppendLine(" /// ") - .AppendFormat(" public {0} {1}", dataTableProcessor.GetLanguageKeyword(i), dataTableProcessor.GetName(i)).AppendLine() - .AppendLine(" {") - .AppendLine(" get;") - .AppendLine(" private set;") - .Append(" }"); - } - - return stringBuilder.ToString(); - } - - private static string GenerateDataTableParser(DataTableProcessor dataTableProcessor) - { - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder - .AppendLine(" public override bool ParseDataRow(string dataRowString, object userData)") - .AppendLine(" {") - .AppendLine(" string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);") - .AppendLine(" for (int i = 0; i < columnStrings.Length; i++)") - .AppendLine(" {") - .AppendLine(" columnStrings[i] = columnStrings[i].Trim(DataTableExtension.DataTrimSeparators);") - .AppendLine(" }") - .AppendLine() - .AppendLine(" int index = 0;"); - - for (int i = 0; i < dataTableProcessor.RawColumnCount; i++) - { - if (dataTableProcessor.IsCommentColumn(i)) - { - // 注释列 - stringBuilder.AppendLine(" index++;"); - continue; - } - - if (dataTableProcessor.IsIdColumn(i)) - { - // 编号列 - stringBuilder.AppendLine(" m_Id = int.Parse(columnStrings[index++]);"); - continue; - } - - if (dataTableProcessor.IsSystem(i)) - { - string languageKeyword = dataTableProcessor.GetLanguageKeyword(i); - if (languageKeyword == "string") - { - stringBuilder.AppendFormat(" {0} = columnStrings[index++];", dataTableProcessor.GetName(i)).AppendLine(); - } - else - { - stringBuilder.AppendFormat(" {0} = {1}.Parse(columnStrings[index++]);", dataTableProcessor.GetName(i), languageKeyword).AppendLine(); - } - } - else - { - stringBuilder.AppendFormat(" {0} = DataTableExtension.Parse{1}(columnStrings[index++]);", dataTableProcessor.GetName(i), dataTableProcessor.GetType(i).Name).AppendLine(); - } - } - - stringBuilder.AppendLine() - .AppendLine(" GeneratePropertyArray();") - .AppendLine(" return true;") - .AppendLine(" }") - .AppendLine() - .AppendLine(" public override bool ParseDataRow(byte[] dataRowBytes, int startIndex, int length, object userData)") - .AppendLine(" {") - .AppendLine(" using (MemoryStream memoryStream = new MemoryStream(dataRowBytes, startIndex, length, false))") - .AppendLine(" {") - .AppendLine(" using (BinaryReader binaryReader = new BinaryReader(memoryStream, Encoding.UTF8))") - .AppendLine(" {"); - - for (int i = 0; i < dataTableProcessor.RawColumnCount; i++) - { - if (dataTableProcessor.IsCommentColumn(i)) - { - // 注释列 - continue; - } - - if (dataTableProcessor.IsIdColumn(i)) - { - // 编号列 - stringBuilder.AppendLine(" m_Id = binaryReader.Read7BitEncodedInt32();"); - continue; - } - - string languageKeyword = dataTableProcessor.GetLanguageKeyword(i); - if (languageKeyword == "int" || languageKeyword == "uint" || languageKeyword == "long" || languageKeyword == "ulong") - { - stringBuilder.AppendFormat(" {0} = binaryReader.Read7BitEncoded{1}();", dataTableProcessor.GetName(i), dataTableProcessor.GetType(i).Name).AppendLine(); - } - else - { - stringBuilder.AppendFormat(" {0} = binaryReader.Read{1}();", dataTableProcessor.GetName(i), dataTableProcessor.GetType(i).Name).AppendLine(); - } - } - - stringBuilder - .AppendLine(" }") - .AppendLine(" }") - .AppendLine() - .AppendLine(" GeneratePropertyArray();") - .AppendLine(" return true;") - .Append(" }"); - - return stringBuilder.ToString(); - } - - private static string GenerateDataTablePropertyArray(DataTableProcessor dataTableProcessor) - { - List propertyCollections = new List(); - for (int i = 0; i < dataTableProcessor.RawColumnCount; i++) - { - if (dataTableProcessor.IsCommentColumn(i)) - { - // 注释列 - continue; - } - - if (dataTableProcessor.IsIdColumn(i)) - { - // 编号列 - continue; - } - - string name = dataTableProcessor.GetName(i); - if (!EndWithNumberRegex.IsMatch(name)) - { - continue; - } - - string propertyCollectionName = EndWithNumberRegex.Replace(name, string.Empty); - int id = int.Parse(EndWithNumberRegex.Match(name).Value); - - PropertyCollection propertyCollection = null; - foreach (PropertyCollection pc in propertyCollections) - { - if (pc.Name == propertyCollectionName) - { - propertyCollection = pc; - break; - } - } - - if (propertyCollection == null) - { - propertyCollection = new PropertyCollection(propertyCollectionName, dataTableProcessor.GetLanguageKeyword(i)); - propertyCollections.Add(propertyCollection); - } - - propertyCollection.AddItem(id, name); - } - - StringBuilder stringBuilder = new StringBuilder(); - bool firstProperty = true; - foreach (PropertyCollection propertyCollection in propertyCollections) - { - if (firstProperty) - { - firstProperty = false; - } - else - { - stringBuilder.AppendLine().AppendLine(); - } - - stringBuilder - .AppendFormat(" private KeyValuePair[] m_{0} = null;", propertyCollection.Name, propertyCollection.LanguageKeyword).AppendLine() - .AppendLine() - .AppendFormat(" public int {0}Count", propertyCollection.Name).AppendLine() - .AppendLine(" {") - .AppendLine(" get") - .AppendLine(" {") - .AppendFormat(" return m_{0}.Length;", propertyCollection.Name).AppendLine() - .AppendLine(" }") - .AppendLine(" }") - .AppendLine() - .AppendFormat(" public {1} Get{0}(int id)", propertyCollection.Name, propertyCollection.LanguageKeyword).AppendLine() - .AppendLine(" {") - .AppendFormat(" foreach (KeyValuePair i in m_{0})", propertyCollection.Name, propertyCollection.LanguageKeyword).AppendLine() - .AppendLine(" {") - .AppendLine(" if (i.Key == id)") - .AppendLine(" {") - .AppendLine(" return i.Value;") - .AppendLine(" }") - .AppendLine(" }") - .AppendLine() - .AppendFormat(" throw new GameFrameworkException(Utility.Text.Format(\"Get{0} with invalid id '{{0}}'.\", id));", propertyCollection.Name).AppendLine() - .AppendLine(" }") - .AppendLine() - .AppendFormat(" public {1} Get{0}At(int index)", propertyCollection.Name, propertyCollection.LanguageKeyword).AppendLine() - .AppendLine(" {") - .AppendFormat(" if (index < 0 || index >= m_{0}.Length)", propertyCollection.Name).AppendLine() - .AppendLine(" {") - .AppendFormat(" throw new GameFrameworkException(Utility.Text.Format(\"Get{0}At with invalid index '{{0}}'.\", index));", propertyCollection.Name).AppendLine() - .AppendLine(" }") - .AppendLine() - .AppendFormat(" return m_{0}[index].Value;", propertyCollection.Name).AppendLine() - .Append(" }"); - } - - if (propertyCollections.Count > 0) - { - stringBuilder.AppendLine().AppendLine(); - } - - stringBuilder - .AppendLine(" private void GeneratePropertyArray()") - .AppendLine(" {"); - - firstProperty = true; - foreach (PropertyCollection propertyCollection in propertyCollections) - { - if (firstProperty) - { - firstProperty = false; - } - else - { - stringBuilder.AppendLine().AppendLine(); - } - - stringBuilder - .AppendFormat(" m_{0} = new KeyValuePair[]", propertyCollection.Name, propertyCollection.LanguageKeyword).AppendLine() - .AppendLine(" {"); - - int itemCount = propertyCollection.ItemCount; - for (int i = 0; i < itemCount; i++) - { - KeyValuePair item = propertyCollection.GetItem(i); - stringBuilder.AppendFormat(" new KeyValuePair({1}, {2}),", propertyCollection.LanguageKeyword, item.Key.ToString(), item.Value).AppendLine(); - } - - stringBuilder.Append(" };"); - } - - stringBuilder - .AppendLine() - .Append(" }"); - - return stringBuilder.ToString(); - } - - private sealed class PropertyCollection - { - private readonly string m_Name; - private readonly string m_LanguageKeyword; - private readonly List> m_Items; - - public PropertyCollection(string name, string languageKeyword) - { - m_Name = name; - m_LanguageKeyword = languageKeyword; - m_Items = new List>(); - } - - public string Name - { - get - { - return m_Name; - } - } - - public string LanguageKeyword - { - get - { - return m_LanguageKeyword; - } - } - - public int ItemCount - { - get - { - return m_Items.Count; - } - } - - public KeyValuePair GetItem(int index) - { - if (index < 0 || index >= m_Items.Count) - { - throw new GameFrameworkException(Utility.Text.Format("GetItem with invalid index '{0}'.", index)); - } - - return m_Items[index]; - } - - public void AddItem(int id, string propertyName) - { - m_Items.Add(new KeyValuePair(id, propertyName)); - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableGeneratorMenu.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableGeneratorMenu.cs deleted file mode 100644 index 1daace5..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableGeneratorMenu.cs +++ /dev/null @@ -1,36 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using GameFramework; -using Procedure; -using UnityEditor; -using UnityEngine; - -namespace StarForce.Editor.DataTableTools -{ - public sealed class DataTableGeneratorMenu - { - [MenuItem("Star Force/Generate DataTables")] - private static void GenerateDataTables() - { - foreach (string dataTableName in ProcedurePreload.DataTableNames) - { - DataTableProcessor dataTableProcessor = DataTableGenerator.CreateDataTableProcessor(dataTableName); - if (!DataTableGenerator.CheckRawData(dataTableProcessor, dataTableName)) - { - Debug.LogError(Utility.Text.Format("Check raw data failure. DataTableName='{0}'", dataTableName)); - break; - } - - DataTableGenerator.GenerateDataFile(dataTableProcessor, dataTableName); - DataTableGenerator.GenerateCodeFile(dataTableProcessor, dataTableName); - } - - AssetDatabase.Refresh(); - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.BooleanProcessor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.BooleanProcessor.cs deleted file mode 100644 index 7eeafc1..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.BooleanProcessor.cs +++ /dev/null @@ -1,53 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System.IO; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private sealed class BooleanProcessor : GenericDataProcessor - { - public override bool IsSystem - { - get - { - return true; - } - } - - public override string LanguageKeyword - { - get - { - return "bool"; - } - } - - public override string[] GetTypeStrings() - { - return new string[] - { - "bool", - "boolean", - "system.boolean" - }; - } - - public override bool Parse(string value) - { - return bool.Parse(value); - } - - public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value) - { - binaryWriter.Write(Parse(value)); - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.ByteProcessor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.ByteProcessor.cs deleted file mode 100644 index 231f681..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.ByteProcessor.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System.IO; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private sealed class ByteProcessor : GenericDataProcessor - { - public override bool IsSystem - { - get - { - return true; - } - } - - public override string LanguageKeyword - { - get - { - return "byte"; - } - } - - public override string[] GetTypeStrings() - { - return new string[] - { - "byte", - "system.byte" - }; - } - - public override byte Parse(string value) - { - return byte.Parse(value); - } - - public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value) - { - binaryWriter.Write(Parse(value)); - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.ByteProcessor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.ByteProcessor.cs.meta deleted file mode 100644 index 53f2fef..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.ByteProcessor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 11199a40fe5a3ef49a3c3d1ae670ac97 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.CharProcessor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.CharProcessor.cs deleted file mode 100644 index b1b3d99..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.CharProcessor.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System.IO; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private sealed class CharProcessor : GenericDataProcessor - { - public override bool IsSystem - { - get - { - return true; - } - } - - public override string LanguageKeyword - { - get - { - return "char"; - } - } - - public override string[] GetTypeStrings() - { - return new string[] - { - "char", - "system.char" - }; - } - - public override char Parse(string value) - { - return char.Parse(value); - } - - public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value) - { - binaryWriter.Write(Parse(value)); - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.CharProcessor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.CharProcessor.cs.meta deleted file mode 100644 index 2e7685d..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.CharProcessor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 37f1181bc8fb29742b06ec3f42f652b4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Color32Processor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Color32Processor.cs deleted file mode 100644 index 5651d6a..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Color32Processor.cs +++ /dev/null @@ -1,58 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System.IO; -using UnityEngine; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private sealed class Color32Processor : GenericDataProcessor - { - public override bool IsSystem - { - get - { - return false; - } - } - - public override string LanguageKeyword - { - get - { - return "Color32"; - } - } - - public override string[] GetTypeStrings() - { - return new string[] - { - "color32", - "unityengine.color32" - }; - } - - public override Color32 Parse(string value) - { - string[] splitedValue = value.Split(','); - return new Color32(byte.Parse(splitedValue[0]), byte.Parse(splitedValue[1]), byte.Parse(splitedValue[2]), byte.Parse(splitedValue[3])); - } - - public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value) - { - Color32 color32 = Parse(value); - binaryWriter.Write(color32.r); - binaryWriter.Write(color32.g); - binaryWriter.Write(color32.b); - binaryWriter.Write(color32.a); - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Color32Processor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Color32Processor.cs.meta deleted file mode 100644 index 06aacf1..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Color32Processor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2a9b916d7c8e446439b74c27340be473 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.ColorProcessor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.ColorProcessor.cs deleted file mode 100644 index 44ab1b1..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.ColorProcessor.cs +++ /dev/null @@ -1,58 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System.IO; -using UnityEngine; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private sealed class ColorProcessor : GenericDataProcessor - { - public override bool IsSystem - { - get - { - return false; - } - } - - public override string LanguageKeyword - { - get - { - return "Color"; - } - } - - public override string[] GetTypeStrings() - { - return new string[] - { - "color", - "unityengine.color" - }; - } - - public override Color Parse(string value) - { - string[] splitedValue = value.Split(','); - return new Color(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]), float.Parse(splitedValue[2]), float.Parse(splitedValue[3])); - } - - public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value) - { - Color color = Parse(value); - binaryWriter.Write(color.r); - binaryWriter.Write(color.g); - binaryWriter.Write(color.b); - binaryWriter.Write(color.a); - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.ColorProcessor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.ColorProcessor.cs.meta deleted file mode 100644 index 55de18f..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.ColorProcessor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f4583af9902c99a4fad14d732796117e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.CommentProcessor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.CommentProcessor.cs deleted file mode 100644 index 79127fd..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.CommentProcessor.cs +++ /dev/null @@ -1,71 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System.IO; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private sealed class CommentProcessor : DataProcessor - { - public override System.Type Type - { - get - { - return null; - } - } - - public override bool IsId - { - get - { - return false; - } - } - - public override bool IsComment - { - get - { - return true; - } - } - - public override bool IsSystem - { - get - { - return false; - } - } - - public override string LanguageKeyword - { - get - { - return null; - } - } - - public override string[] GetTypeStrings() - { - return new string[] - { - string.Empty, - "#", - "comment" - }; - } - - public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value) - { - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.CommentProcessor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.CommentProcessor.cs.meta deleted file mode 100644 index a55709c..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.CommentProcessor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 2ece238877c1e9344a50ce47697a93ef -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DataProcessor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DataProcessor.cs deleted file mode 100644 index a6bf5a1..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DataProcessor.cs +++ /dev/null @@ -1,46 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System.IO; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - public abstract class DataProcessor - { - public abstract System.Type Type - { - get; - } - - public abstract bool IsId - { - get; - } - - public abstract bool IsComment - { - get; - } - - public abstract bool IsSystem - { - get; - } - - public abstract string LanguageKeyword - { - get; - } - - public abstract string[] GetTypeStrings(); - - public abstract void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value); - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DataProcessor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DataProcessor.cs.meta deleted file mode 100644 index 5273a49..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DataProcessor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ccc7c992b5573ae4fafd0d5706bdad48 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DataProcessorUtility.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DataProcessorUtility.cs deleted file mode 100644 index 07fac3d..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DataProcessorUtility.cs +++ /dev/null @@ -1,61 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using GameFramework; -using System; -using System.Collections.Generic; -using System.Reflection; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private static class DataProcessorUtility - { - private static readonly IDictionary s_DataProcessors = new SortedDictionary(StringComparer.Ordinal); - - static DataProcessorUtility() - { - System.Type dataProcessorBaseType = typeof(DataProcessor); - Assembly assembly = Assembly.GetExecutingAssembly(); - System.Type[] types = assembly.GetTypes(); - for (int i = 0; i < types.Length; i++) - { - if (!types[i].IsClass || types[i].IsAbstract) - { - continue; - } - - if (dataProcessorBaseType.IsAssignableFrom(types[i])) - { - DataProcessor dataProcessor = (DataProcessor)Activator.CreateInstance(types[i]); - foreach (string typeString in dataProcessor.GetTypeStrings()) - { - s_DataProcessors.Add(typeString.ToLowerInvariant(), dataProcessor); - } - } - } - } - - public static DataProcessor GetDataProcessor(string type) - { - if (type == null) - { - type = string.Empty; - } - - DataProcessor dataProcessor = null; - if (s_DataProcessors.TryGetValue(type.ToLowerInvariant(), out dataProcessor)) - { - return dataProcessor; - } - - throw new GameFrameworkException(Utility.Text.Format("Not supported data processor type '{0}'.", type)); - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DataProcessorUtility.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DataProcessorUtility.cs.meta deleted file mode 100644 index 4b62e43..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DataProcessorUtility.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 83d25f17cbb262649959b7952811f8c8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DateTimeProcessor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DateTimeProcessor.cs deleted file mode 100644 index cb098a7..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DateTimeProcessor.cs +++ /dev/null @@ -1,53 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System; -using System.IO; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private sealed class DateTimeProcessor : GenericDataProcessor - { - public override bool IsSystem - { - get - { - return true; - } - } - - public override string LanguageKeyword - { - get - { - return "DateTime"; - } - } - - public override string[] GetTypeStrings() - { - return new string[] - { - "datetime", - "system.datetime" - }; - } - - public override DateTime Parse(string value) - { - return DateTime.Parse(value); - } - - public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value) - { - binaryWriter.Write(Parse(value).Ticks); - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DateTimeProcessor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DateTimeProcessor.cs.meta deleted file mode 100644 index cfd722d..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DateTimeProcessor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4223bbe977dd5244a8611c6aad7f693e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DecimalProcessor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DecimalProcessor.cs deleted file mode 100644 index 1187dbf..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DecimalProcessor.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System.IO; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private sealed class DecimalProcessor : GenericDataProcessor - { - public override bool IsSystem - { - get - { - return true; - } - } - - public override string LanguageKeyword - { - get - { - return "decimal"; - } - } - - public override string[] GetTypeStrings() - { - return new string[] - { - "decimal", - "system.decimal" - }; - } - - public override decimal Parse(string value) - { - return decimal.Parse(value); - } - - public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value) - { - binaryWriter.Write(Parse(value)); - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DecimalProcessor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DecimalProcessor.cs.meta deleted file mode 100644 index 36756eb..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DecimalProcessor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ad6d6ba18487f7643830e156d300ee75 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DoubleProcessor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DoubleProcessor.cs deleted file mode 100644 index 92f34e5..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DoubleProcessor.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System.IO; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private sealed class DoubleProcessor : GenericDataProcessor - { - public override bool IsSystem - { - get - { - return true; - } - } - - public override string LanguageKeyword - { - get - { - return "double"; - } - } - - public override string[] GetTypeStrings() - { - return new string[] - { - "double", - "system.double" - }; - } - - public override double Parse(string value) - { - return double.Parse(value); - } - - public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value) - { - binaryWriter.Write(Parse(value)); - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DoubleProcessor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DoubleProcessor.cs.meta deleted file mode 100644 index fbe633b..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.DoubleProcessor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 44293fe0c3e108248bc98e8674238aed -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.GenericDataProcessor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.GenericDataProcessor.cs deleted file mode 100644 index d94476b..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.GenericDataProcessor.cs +++ /dev/null @@ -1,41 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - public abstract class GenericDataProcessor : DataProcessor - { - public override System.Type Type - { - get - { - return typeof(T); - } - } - - public override bool IsId - { - get - { - return false; - } - } - - public override bool IsComment - { - get - { - return false; - } - } - - public abstract T Parse(string value); - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.GenericDataProcessor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.GenericDataProcessor.cs.meta deleted file mode 100644 index d2a3178..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.GenericDataProcessor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 65dd2cb98d350654fb3df2ddfc4fa4b8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.IdProcessor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.IdProcessor.cs deleted file mode 100644 index 004a614..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.IdProcessor.cs +++ /dev/null @@ -1,70 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System.IO; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private sealed class IdProcessor : DataProcessor - { - public override System.Type Type - { - get - { - return typeof(int); - } - } - - public override bool IsId - { - get - { - return true; - } - } - - public override bool IsComment - { - get - { - return false; - } - } - - public override bool IsSystem - { - get - { - return false; - } - } - - public override string LanguageKeyword - { - get - { - return "int"; - } - } - - public override string[] GetTypeStrings() - { - return new string[] - { - "id" - }; - } - - public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value) - { - binaryWriter.Write7BitEncodedInt32(int.Parse(value)); - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.IdProcessor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.IdProcessor.cs.meta deleted file mode 100644 index c2575a3..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.IdProcessor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f4171c2dabb4ee9468f7297ab334ddf1 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Int16Processor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Int16Processor.cs deleted file mode 100644 index 2eb7e14..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Int16Processor.cs +++ /dev/null @@ -1,53 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System.IO; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private sealed class Int16Processor : GenericDataProcessor - { - public override bool IsSystem - { - get - { - return true; - } - } - - public override string LanguageKeyword - { - get - { - return "short"; - } - } - - public override string[] GetTypeStrings() - { - return new string[] - { - "short", - "int16", - "system.int16" - }; - } - - public override short Parse(string value) - { - return short.Parse(value); - } - - public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value) - { - binaryWriter.Write(Parse(value)); - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Int16Processor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Int16Processor.cs.meta deleted file mode 100644 index ea450fe..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Int16Processor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c1e3b1767ca81c343a31324956e5f032 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Int32Processor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Int32Processor.cs deleted file mode 100644 index e55d63e..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Int32Processor.cs +++ /dev/null @@ -1,53 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System.IO; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private sealed class Int32Processor : GenericDataProcessor - { - public override bool IsSystem - { - get - { - return true; - } - } - - public override string LanguageKeyword - { - get - { - return "int"; - } - } - - public override string[] GetTypeStrings() - { - return new string[] - { - "int", - "int32", - "system.int32" - }; - } - - public override int Parse(string value) - { - return int.Parse(value); - } - - public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value) - { - binaryWriter.Write7BitEncodedInt32(Parse(value)); - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Int32Processor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Int32Processor.cs.meta deleted file mode 100644 index a960179..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Int32Processor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 239560231c239b54f95c183913ec9cbf -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Int64Processor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Int64Processor.cs deleted file mode 100644 index 9d070d6..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Int64Processor.cs +++ /dev/null @@ -1,53 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System.IO; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private sealed class Int64Processor : GenericDataProcessor - { - public override bool IsSystem - { - get - { - return true; - } - } - - public override string LanguageKeyword - { - get - { - return "long"; - } - } - - public override string[] GetTypeStrings() - { - return new string[] - { - "long", - "int64", - "system.int64" - }; - } - - public override long Parse(string value) - { - return long.Parse(value); - } - - public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value) - { - binaryWriter.Write7BitEncodedInt64(Parse(value)); - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Int64Processor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Int64Processor.cs.meta deleted file mode 100644 index d7e5893..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Int64Processor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d6dadc699adc6744e898979b1e85d6cf -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.QuaternionProcessor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.QuaternionProcessor.cs deleted file mode 100644 index 8b91194..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.QuaternionProcessor.cs +++ /dev/null @@ -1,58 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System.IO; -using UnityEngine; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private sealed class QuaternionProcessor : GenericDataProcessor - { - public override bool IsSystem - { - get - { - return false; - } - } - - public override string LanguageKeyword - { - get - { - return "Quaternion"; - } - } - - public override string[] GetTypeStrings() - { - return new string[] - { - "quaternion", - "unityengine.quaternion" - }; - } - - public override Quaternion Parse(string value) - { - string[] splitedValue = value.Split(','); - return new Quaternion(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]), float.Parse(splitedValue[2]), float.Parse(splitedValue[3])); - } - - public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value) - { - Quaternion quaternion = Parse(value); - binaryWriter.Write(quaternion.x); - binaryWriter.Write(quaternion.y); - binaryWriter.Write(quaternion.z); - binaryWriter.Write(quaternion.w); - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.QuaternionProcessor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.QuaternionProcessor.cs.meta deleted file mode 100644 index 563017f..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.QuaternionProcessor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c288505f764c21149b9986dd3ebff1ac -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.RectProcessor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.RectProcessor.cs deleted file mode 100644 index bb2e313..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.RectProcessor.cs +++ /dev/null @@ -1,58 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System.IO; -using UnityEngine; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private sealed class RectProcessor : GenericDataProcessor - { - public override bool IsSystem - { - get - { - return false; - } - } - - public override string LanguageKeyword - { - get - { - return "Rect"; - } - } - - public override string[] GetTypeStrings() - { - return new string[] - { - "rect", - "unityengine.rect" - }; - } - - public override Rect Parse(string value) - { - string[] splitedValue = value.Split(','); - return new Rect(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]), float.Parse(splitedValue[2]), float.Parse(splitedValue[3])); - } - - public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value) - { - Rect rect = Parse(value); - binaryWriter.Write(rect.x); - binaryWriter.Write(rect.y); - binaryWriter.Write(rect.width); - binaryWriter.Write(rect.height); - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.RectProcessor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.RectProcessor.cs.meta deleted file mode 100644 index 147707a..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.RectProcessor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 235589b35d4744a4d8ef100da517e0ce -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.SByteProcessor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.SByteProcessor.cs deleted file mode 100644 index bb16e65..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.SByteProcessor.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System.IO; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private sealed class SByteProcessor : GenericDataProcessor - { - public override bool IsSystem - { - get - { - return true; - } - } - - public override string LanguageKeyword - { - get - { - return "sbyte"; - } - } - - public override string[] GetTypeStrings() - { - return new string[] - { - "sbyte", - "system.sbyte" - }; - } - - public override sbyte Parse(string value) - { - return sbyte.Parse(value); - } - - public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value) - { - binaryWriter.Write(Parse(value)); - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.SByteProcessor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.SByteProcessor.cs.meta deleted file mode 100644 index 5c07fd5..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.SByteProcessor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 49f8d16f80f1ec046bfcae38be8c96a7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.SingleProcessor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.SingleProcessor.cs deleted file mode 100644 index 60565aa..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.SingleProcessor.cs +++ /dev/null @@ -1,53 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System.IO; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private sealed class SingleProcessor : GenericDataProcessor - { - public override bool IsSystem - { - get - { - return true; - } - } - - public override string LanguageKeyword - { - get - { - return "float"; - } - } - - public override string[] GetTypeStrings() - { - return new string[] - { - "float", - "single", - "system.single" - }; - } - - public override float Parse(string value) - { - return float.Parse(value); - } - - public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value) - { - binaryWriter.Write(Parse(value)); - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.SingleProcessor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.SingleProcessor.cs.meta deleted file mode 100644 index 7210146..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.SingleProcessor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4c1502c70e1294543b14df45c7841a73 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.StringProcessor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.StringProcessor.cs deleted file mode 100644 index a8036ca..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.StringProcessor.cs +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System.IO; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private sealed class StringProcessor : GenericDataProcessor - { - public override bool IsSystem - { - get - { - return true; - } - } - - public override string LanguageKeyword - { - get - { - return "string"; - } - } - - public override string[] GetTypeStrings() - { - return new string[] - { - "string", - "system.string" - }; - } - - public override string Parse(string value) - { - return value; - } - - public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value) - { - binaryWriter.Write(Parse(value)); - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.StringProcessor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.StringProcessor.cs.meta deleted file mode 100644 index 9f1c1f4..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.StringProcessor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d502b9a1939b46246bd8e4c107b77744 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.UInt16Processor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.UInt16Processor.cs deleted file mode 100644 index b5ad678..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.UInt16Processor.cs +++ /dev/null @@ -1,53 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System.IO; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private sealed class UInt16Processor : GenericDataProcessor - { - public override bool IsSystem - { - get - { - return true; - } - } - - public override string LanguageKeyword - { - get - { - return "ushort"; - } - } - - public override string[] GetTypeStrings() - { - return new string[] - { - "ushort", - "uint16", - "system.uint16" - }; - } - - public override ushort Parse(string value) - { - return ushort.Parse(value); - } - - public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value) - { - binaryWriter.Write(Parse(value)); - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.UInt16Processor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.UInt16Processor.cs.meta deleted file mode 100644 index f334209..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.UInt16Processor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 20f758534f1981b4593f97deb2a5ae25 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.UInt32Processor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.UInt32Processor.cs deleted file mode 100644 index b089aca..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.UInt32Processor.cs +++ /dev/null @@ -1,53 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System.IO; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private sealed class UInt32Processor : GenericDataProcessor - { - public override bool IsSystem - { - get - { - return true; - } - } - - public override string LanguageKeyword - { - get - { - return "uint"; - } - } - - public override string[] GetTypeStrings() - { - return new string[] - { - "uint", - "uint32", - "system.uint32" - }; - } - - public override uint Parse(string value) - { - return uint.Parse(value); - } - - public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value) - { - binaryWriter.Write7BitEncodedUInt32(Parse(value)); - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.UInt32Processor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.UInt32Processor.cs.meta deleted file mode 100644 index aabf465..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.UInt32Processor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: fd3c289549d93924ea928ea558436a57 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.UInt64Processor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.UInt64Processor.cs deleted file mode 100644 index 03b93fc..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.UInt64Processor.cs +++ /dev/null @@ -1,53 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System.IO; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private sealed class UInt64Processor : GenericDataProcessor - { - public override bool IsSystem - { - get - { - return true; - } - } - - public override string LanguageKeyword - { - get - { - return "ulong"; - } - } - - public override string[] GetTypeStrings() - { - return new string[] - { - "ulong", - "uint64", - "system.uint64" - }; - } - - public override ulong Parse(string value) - { - return ulong.Parse(value); - } - - public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value) - { - binaryWriter.Write7BitEncodedUInt64(Parse(value)); - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.UInt64Processor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.UInt64Processor.cs.meta deleted file mode 100644 index 6d64997..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.UInt64Processor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 23d841306167268488c7c5a8bb8cf685 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Vector2Processor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Vector2Processor.cs deleted file mode 100644 index 4812ea4..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Vector2Processor.cs +++ /dev/null @@ -1,56 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System.IO; -using UnityEngine; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private sealed class Vector2Processor : GenericDataProcessor - { - public override bool IsSystem - { - get - { - return false; - } - } - - public override string LanguageKeyword - { - get - { - return "Vector2"; - } - } - - public override string[] GetTypeStrings() - { - return new string[] - { - "vector2", - "unityengine.vector2" - }; - } - - public override Vector2 Parse(string value) - { - string[] splitedValue = value.Split(','); - return new Vector2(float.Parse(splitedValue[0]), float.Parse(splitedValue[1])); - } - - public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value) - { - Vector2 vector2 = Parse(value); - binaryWriter.Write(vector2.x); - binaryWriter.Write(vector2.y); - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Vector2Processor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Vector2Processor.cs.meta deleted file mode 100644 index 37771b0..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Vector2Processor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 165df2a7d4a52984282f1c3bc87d5aaa -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Vector3Processor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Vector3Processor.cs deleted file mode 100644 index ef5ceda..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Vector3Processor.cs +++ /dev/null @@ -1,57 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System.IO; -using UnityEngine; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private sealed class Vector3Processor : GenericDataProcessor - { - public override bool IsSystem - { - get - { - return false; - } - } - - public override string LanguageKeyword - { - get - { - return "Vector3"; - } - } - - public override string[] GetTypeStrings() - { - return new string[] - { - "vector3", - "unityengine.vector3" - }; - } - - public override Vector3 Parse(string value) - { - string[] splitedValue = value.Split(','); - return new Vector3(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]), float.Parse(splitedValue[2])); - } - - public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value) - { - Vector3 vector3 = Parse(value); - binaryWriter.Write(vector3.x); - binaryWriter.Write(vector3.y); - binaryWriter.Write(vector3.z); - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Vector3Processor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Vector3Processor.cs.meta deleted file mode 100644 index a2dd42c..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Vector3Processor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d45ef71d28b25f047ab0f4d4acac8b42 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Vector4Processor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Vector4Processor.cs deleted file mode 100644 index 8147fe6..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Vector4Processor.cs +++ /dev/null @@ -1,58 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using System.IO; -using UnityEngine; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private sealed class Vector4Processor : GenericDataProcessor - { - public override bool IsSystem - { - get - { - return false; - } - } - - public override string LanguageKeyword - { - get - { - return "Vector4"; - } - } - - public override string[] GetTypeStrings() - { - return new string[] - { - "vector4", - "unityengine.vector4" - }; - } - - public override Vector4 Parse(string value) - { - string[] splitedValue = value.Split(','); - return new Vector4(float.Parse(splitedValue[0]), float.Parse(splitedValue[1]), float.Parse(splitedValue[2]), float.Parse(splitedValue[3])); - } - - public override void WriteToStream(DataTableProcessor dataTableProcessor, BinaryWriter binaryWriter, string value) - { - Vector4 vector4 = Parse(value); - binaryWriter.Write(vector4.x); - binaryWriter.Write(vector4.y); - binaryWriter.Write(vector4.z); - binaryWriter.Write(vector4.w); - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Vector4Processor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Vector4Processor.cs.meta deleted file mode 100644 index 25caf31..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.Vector4Processor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 40409bde40a898b48af91126d343c4ae -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.cs b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.cs deleted file mode 100644 index 0c34f3d..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.cs +++ /dev/null @@ -1,498 +0,0 @@ -//------------------------------------------------------------ -// Game Framework -// Copyright © 2013-2021 Jiang Yin. All rights reserved. -// Homepage: https://gameframework.cn/ -// Feedback: mailto:ellan@gameframework.cn -//------------------------------------------------------------ - -using GameFramework; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using UnityEngine; - -namespace StarForce.Editor.DataTableTools -{ - public sealed partial class DataTableProcessor - { - private const string CommentLineSeparator = "#"; - private static readonly char[] DataSplitSeparators = new char[] { '\t' }; - private static readonly char[] DataTrimSeparators = new char[] { '\"' }; - - private readonly string[] m_NameRow; - private readonly string[] m_TypeRow; - private readonly string[] m_DefaultValueRow; - private readonly string[] m_CommentRow; - private readonly int m_ContentStartRow; - private readonly int m_IdColumn; - - private readonly DataProcessor[] m_DataProcessor; - private readonly string[][] m_RawValues; - private readonly string[] m_Strings; - - private string m_CodeTemplate; - private DataTableCodeGenerator m_CodeGenerator; - - public DataTableProcessor(string dataTableFileName, Encoding encoding, int nameRow, int typeRow, int? defaultValueRow, int? commentRow, int contentStartRow, int idColumn) - { - if (string.IsNullOrEmpty(dataTableFileName)) - { - throw new GameFrameworkException("Data table file name is invalid."); - } - - if (!dataTableFileName.EndsWith(".txt", StringComparison.Ordinal)) - { - throw new GameFrameworkException(Utility.Text.Format("Data table file '{0}' is not a txt.", dataTableFileName)); - } - - if (!File.Exists(dataTableFileName)) - { - throw new GameFrameworkException(Utility.Text.Format("Data table file '{0}' is not exist.", dataTableFileName)); - } - - string[] lines = File.ReadAllLines(dataTableFileName, encoding); - int rawRowCount = lines.Length; - - int rawColumnCount = 0; - List rawValues = new List(); - for (int i = 0; i < lines.Length; i++) - { - string[] rawValue = lines[i].Split(DataSplitSeparators); - for (int j = 0; j < rawValue.Length; j++) - { - rawValue[j] = rawValue[j].Trim(DataTrimSeparators); - } - - if (i == 0) - { - rawColumnCount = rawValue.Length; - } - else if (rawValue.Length != rawColumnCount) - { - throw new GameFrameworkException(Utility.Text.Format("Data table file '{0}', raw Column is '{2}', but line '{1}' column is '{3}'.", dataTableFileName, i, rawColumnCount, rawValue.Length)); - } - - rawValues.Add(rawValue); - } - - m_RawValues = rawValues.ToArray(); - - if (nameRow < 0) - { - throw new GameFrameworkException(Utility.Text.Format("Name row '{0}' is invalid.", nameRow)); - } - - if (typeRow < 0) - { - throw new GameFrameworkException(Utility.Text.Format("Type row '{0}' is invalid.", typeRow)); - } - - if (contentStartRow < 0) - { - throw new GameFrameworkException(Utility.Text.Format("Content start row '{0}' is invalid.", contentStartRow)); - } - - if (idColumn < 0) - { - throw new GameFrameworkException(Utility.Text.Format("Id column '{0}' is invalid.", idColumn)); - } - - if (nameRow >= rawRowCount) - { - throw new GameFrameworkException(Utility.Text.Format("Name row '{0}' >= raw row count '{1}' is not allow.", nameRow, rawRowCount)); - } - - if (typeRow >= rawRowCount) - { - throw new GameFrameworkException(Utility.Text.Format("Type row '{0}' >= raw row count '{1}' is not allow.", typeRow, rawRowCount)); - } - - if (defaultValueRow.HasValue && defaultValueRow.Value >= rawRowCount) - { - throw new GameFrameworkException(Utility.Text.Format("Default value row '{0}' >= raw row count '{1}' is not allow.", defaultValueRow.Value, rawRowCount)); - } - - if (commentRow.HasValue && commentRow.Value >= rawRowCount) - { - throw new GameFrameworkException(Utility.Text.Format("Comment row '{0}' >= raw row count '{1}' is not allow.", commentRow.Value, rawRowCount)); - } - - if (contentStartRow > rawRowCount) - { - throw new GameFrameworkException(Utility.Text.Format("Content start row '{0}' > raw row count '{1}' is not allow.", contentStartRow, rawRowCount)); - } - - if (idColumn >= rawColumnCount) - { - throw new GameFrameworkException(Utility.Text.Format("Id column '{0}' >= raw column count '{1}' is not allow.", idColumn, rawColumnCount)); - } - - m_NameRow = m_RawValues[nameRow]; - m_TypeRow = m_RawValues[typeRow]; - m_DefaultValueRow = defaultValueRow.HasValue ? m_RawValues[defaultValueRow.Value] : null; - m_CommentRow = commentRow.HasValue ? m_RawValues[commentRow.Value] : null; - m_ContentStartRow = contentStartRow; - m_IdColumn = idColumn; - - m_DataProcessor = new DataProcessor[rawColumnCount]; - for (int i = 0; i < rawColumnCount; i++) - { - if (i == IdColumn) - { - m_DataProcessor[i] = DataProcessorUtility.GetDataProcessor("id"); - } - else - { - m_DataProcessor[i] = DataProcessorUtility.GetDataProcessor(m_TypeRow[i]); - } - } - - Dictionary strings = new Dictionary(StringComparer.Ordinal); - for (int i = contentStartRow; i < rawRowCount; i++) - { - if (IsCommentRow(i)) - { - continue; - } - - for (int j = 0; j < rawColumnCount; j++) - { - if (m_DataProcessor[j].LanguageKeyword != "string") - { - continue; - } - - string str = m_RawValues[i][j]; - if (strings.ContainsKey(str)) - { - strings[str]++; - } - else - { - strings[str] = 1; - } - } - } - - m_Strings = strings.OrderBy(value => value.Key).OrderByDescending(value => value.Value).Select(value => value.Key).ToArray(); - - m_CodeTemplate = null; - m_CodeGenerator = null; - } - - public int RawRowCount - { - get - { - return m_RawValues.Length; - } - } - - public int RawColumnCount - { - get - { - return m_RawValues.Length > 0 ? m_RawValues[0].Length : 0; - } - } - - public int StringCount - { - get - { - return m_Strings.Length; - } - } - - public int ContentStartRow - { - get - { - return m_ContentStartRow; - } - } - - public int IdColumn - { - get - { - return m_IdColumn; - } - } - - public bool IsIdColumn(int rawColumn) - { - if (rawColumn < 0 || rawColumn >= RawColumnCount) - { - throw new GameFrameworkException(Utility.Text.Format("Raw column '{0}' is out of range.", rawColumn)); - } - - return m_DataProcessor[rawColumn].IsId; - } - - public bool IsCommentRow(int rawRow) - { - if (rawRow < 0 || rawRow >= RawRowCount) - { - throw new GameFrameworkException(Utility.Text.Format("Raw row '{0}' is out of range.", rawRow)); - } - - return GetValue(rawRow, 0).StartsWith(CommentLineSeparator, StringComparison.Ordinal); - } - - public bool IsCommentColumn(int rawColumn) - { - if (rawColumn < 0 || rawColumn >= RawColumnCount) - { - throw new GameFrameworkException(Utility.Text.Format("Raw column '{0}' is out of range.", rawColumn)); - } - - return string.IsNullOrEmpty(GetName(rawColumn)) || m_DataProcessor[rawColumn].IsComment; - } - - public string GetName(int rawColumn) - { - if (rawColumn < 0 || rawColumn >= RawColumnCount) - { - throw new GameFrameworkException(Utility.Text.Format("Raw column '{0}' is out of range.", rawColumn)); - } - - if (IsIdColumn(rawColumn)) - { - return "Id"; - } - - return m_NameRow[rawColumn]; - } - - public bool IsSystem(int rawColumn) - { - if (rawColumn < 0 || rawColumn >= RawColumnCount) - { - throw new GameFrameworkException(Utility.Text.Format("Raw column '{0}' is out of range.", rawColumn)); - } - - return m_DataProcessor[rawColumn].IsSystem; - } - - public System.Type GetType(int rawColumn) - { - if (rawColumn < 0 || rawColumn >= RawColumnCount) - { - throw new GameFrameworkException(Utility.Text.Format("Raw column '{0}' is out of range.", rawColumn)); - } - - return m_DataProcessor[rawColumn].Type; - } - - public string GetLanguageKeyword(int rawColumn) - { - if (rawColumn < 0 || rawColumn >= RawColumnCount) - { - throw new GameFrameworkException(Utility.Text.Format("Raw column '{0}' is out of range.", rawColumn)); - } - - return m_DataProcessor[rawColumn].LanguageKeyword; - } - - public string GetDefaultValue(int rawColumn) - { - if (rawColumn < 0 || rawColumn >= RawColumnCount) - { - throw new GameFrameworkException(Utility.Text.Format("Raw column '{0}' is out of range.", rawColumn)); - } - - return m_DefaultValueRow != null ? m_DefaultValueRow[rawColumn] : null; - } - - public string GetComment(int rawColumn) - { - if (rawColumn < 0 || rawColumn >= RawColumnCount) - { - throw new GameFrameworkException(Utility.Text.Format("Raw column '{0}' is out of range.", rawColumn)); - } - - return m_CommentRow != null ? m_CommentRow[rawColumn] : null; - } - - public string GetValue(int rawRow, int rawColumn) - { - if (rawRow < 0 || rawRow >= RawRowCount) - { - throw new GameFrameworkException(Utility.Text.Format("Raw row '{0}' is out of range.", rawRow)); - } - - if (rawColumn < 0 || rawColumn >= RawColumnCount) - { - throw new GameFrameworkException(Utility.Text.Format("Raw column '{0}' is out of range.", rawColumn)); - } - - return m_RawValues[rawRow][rawColumn]; - } - - public string GetString(int index) - { - if (index < 0 || index >= StringCount) - { - throw new GameFrameworkException(Utility.Text.Format("String index '{0}' is out of range.", index)); - } - - return m_Strings[index]; - } - - public int GetStringIndex(string str) - { - for (int i = 0; i < StringCount; i++) - { - if (m_Strings[i] == str) - { - return i; - } - } - - return -1; - } - - public bool GenerateDataFile(string outputFileName) - { - if (string.IsNullOrEmpty(outputFileName)) - { - throw new GameFrameworkException("Output file name is invalid."); - } - - try - { - using (FileStream fileStream = new FileStream(outputFileName, FileMode.Create, FileAccess.Write)) - { - using (BinaryWriter binaryWriter = new BinaryWriter(fileStream, Encoding.UTF8)) - { - for (int rawRow = ContentStartRow; rawRow < RawRowCount; rawRow++) - { - if (IsCommentRow(rawRow)) - { - continue; - } - - byte[] bytes = GetRowBytes(outputFileName, rawRow); - binaryWriter.Write7BitEncodedInt32(bytes.Length); - binaryWriter.Write(bytes); - } - } - } - - Debug.Log(Utility.Text.Format("Parse data table '{0}' success.", outputFileName)); - return true; - } - catch (Exception exception) - { - Debug.LogError(Utility.Text.Format("Parse data table '{0}' failure, exception is '{1}'.", outputFileName, exception)); - return false; - } - } - - public bool SetCodeTemplate(string codeTemplateFileName, Encoding encoding) - { - try - { - m_CodeTemplate = File.ReadAllText(codeTemplateFileName, encoding); - Debug.Log(Utility.Text.Format("Set code template '{0}' success.", codeTemplateFileName)); - return true; - } - catch (Exception exception) - { - Debug.LogError(Utility.Text.Format("Set code template '{0}' failure, exception is '{1}'.", codeTemplateFileName, exception)); - return false; - } - } - - public void SetCodeGenerator(DataTableCodeGenerator codeGenerator) - { - m_CodeGenerator = codeGenerator; - } - - public bool GenerateCodeFile(string outputFileName, Encoding encoding, object userData = null) - { - if (string.IsNullOrEmpty(m_CodeTemplate)) - { - throw new GameFrameworkException("You must set code template first."); - } - - if (string.IsNullOrEmpty(outputFileName)) - { - throw new GameFrameworkException("Output file name is invalid."); - } - - try - { - StringBuilder stringBuilder = new StringBuilder(m_CodeTemplate); - if (m_CodeGenerator != null) - { - m_CodeGenerator(this, stringBuilder, userData); - } - - using (FileStream fileStream = new FileStream(outputFileName, FileMode.Create, FileAccess.Write)) - { - using (StreamWriter stream = new StreamWriter(fileStream, encoding)) - { - stream.Write(stringBuilder.ToString()); - } - } - - Debug.Log(Utility.Text.Format("Generate code file '{0}' success.", outputFileName)); - return true; - } - catch (Exception exception) - { - Debug.LogError(Utility.Text.Format("Generate code file '{0}' failure, exception is '{1}'.", outputFileName, exception)); - return false; - } - } - - private byte[] GetRowBytes(string outputFileName, int rawRow) - { - using (MemoryStream memoryStream = new MemoryStream()) - { - using (BinaryWriter binaryWriter = new BinaryWriter(memoryStream, Encoding.UTF8)) - { - for (int rawColumn = 0; rawColumn < RawColumnCount; rawColumn++) - { - if (IsCommentColumn(rawColumn)) - { - continue; - } - - try - { - m_DataProcessor[rawColumn].WriteToStream(this, binaryWriter, GetValue(rawRow, rawColumn)); - } - catch - { - if (m_DataProcessor[rawColumn].IsId || string.IsNullOrEmpty(GetDefaultValue(rawColumn))) - { - Debug.LogError(Utility.Text.Format("Parse raw value failure. OutputFileName='{0}' RawRow='{1}' RowColumn='{2}' Name='{3}' Type='{4}' RawValue='{5}'", outputFileName, rawRow, rawColumn, GetName(rawColumn), GetLanguageKeyword(rawColumn), GetValue(rawRow, rawColumn))); - return null; - } - else - { - Debug.LogWarning(Utility.Text.Format("Parse raw value failure, will try default value. OutputFileName='{0}' RawRow='{1}' RowColumn='{2}' Name='{3}' Type='{4}' RawValue='{5}'", outputFileName, rawRow, rawColumn, GetName(rawColumn), GetLanguageKeyword(rawColumn), GetValue(rawRow, rawColumn))); - try - { - m_DataProcessor[rawColumn].WriteToStream(this, binaryWriter, GetDefaultValue(rawColumn)); - } - catch - { - Debug.LogError(Utility.Text.Format("Parse default value failure. OutputFileName='{0}' RawRow='{1}' RowColumn='{2}' Name='{3}' Type='{4}' RawValue='{5}'", outputFileName, rawRow, rawColumn, GetName(rawColumn), GetLanguageKeyword(rawColumn), GetComment(rawColumn))); - return null; - } - } - } - } - - return memoryStream.ToArray(); - } - } - } - } -} diff --git a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.cs.meta b/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.cs.meta deleted file mode 100644 index 8b7a023..0000000 --- a/Assets/GameMain/Scripts/Editor/DataTableGenerator/DataTableProcessor.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 81b27209918096743b988ea62b39d109 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Editor/PlayerBuffConsoleWindow.cs b/Assets/GameMain/Scripts/Editor/PlayerBuffConsoleWindow.cs new file mode 100644 index 0000000..7bdc7dc --- /dev/null +++ b/Assets/GameMain/Scripts/Editor/PlayerBuffConsoleWindow.cs @@ -0,0 +1,278 @@ +#if UNITY_EDITOR +using System; +using System.Linq; +using CustomComponent; +using DataTable; +using Definition.DataStruct; +using Entity; +using Game.Utility; +using UnityEditor; +using UnityEngine; + +namespace StarForce.Editor +{ + public class PlayerBuffConsoleWindow : EditorWindow + { + private const string WindowTitle = "Player Buff Console"; + + private string _searchText = string.Empty; + private int _selectedIndex; + private int _addCount = 1; + private Vector2 _scroll; + private DRProp[] _allProps = Array.Empty(); + private DRProp[] _filteredProps = Array.Empty(); + private string[] _displayNames = Array.Empty(); + + private float _spawnRateScaleInput = 1f; + private float _extendDurationSeconds = 30f; + + [MenuItem("StarForce/Debug/Player Buff Console")] + private static void Open() + { + GetWindow(WindowTitle); + } + + private void OnEnable() + { + RefreshPropList(); + EditorApplication.playModeStateChanged += OnPlayModeStateChanged; + } + + private void OnDisable() + { + EditorApplication.playModeStateChanged -= OnPlayModeStateChanged; + } + + private void OnGUI() + { + EditorGUILayout.LabelField("Player Buff Console (Editor Only)", EditorStyles.boldLabel); + EditorGUILayout.Space(4f); + + using (new EditorGUI.DisabledScope(!EditorApplication.isPlaying)) + { + DrawBuffSection(); + + EditorGUILayout.Space(8f); + EditorGUILayout.LabelField(string.Empty, GUI.skin.horizontalSlider); + EditorGUILayout.Space(8f); + + DrawBattleControlSection(); + } + + if (!EditorApplication.isPlaying) + { + EditorGUILayout.HelpBox("Enter Play mode to use debug controls.", MessageType.Info); + } + } + + private void DrawBuffSection() + { + EditorGUILayout.LabelField("Buff Debug", EditorStyles.boldLabel); + DrawToolbar(); + DrawBuffSelector(); + DrawSelectedBuffPreview(); + DrawBuffActions(); + } + + private void DrawBattleControlSection() + { + EditorGUILayout.LabelField("Battle Debug", EditorStyles.boldLabel); + + EnemyManagerComponent enemyManager = GameEntry.EnemyManager; + Player player = FindPlayer(); + if (enemyManager == null) + { + EditorGUILayout.HelpBox("EnemyManager is unavailable.", MessageType.Warning); + return; + } + + EditorGUILayout.LabelField("Current Spawn Rate Scale", enemyManager.SpawnRateScale.ToString("F2")); + EditorGUILayout.LabelField("Battle Time", + $"{enemyManager.ElapsedBattleTime:F1}s / {enemyManager.BattleDuration:F1}s"); + + _spawnRateScaleInput = Mathf.Clamp(EditorGUILayout.FloatField("Spawn Rate Scale", _spawnRateScaleInput), 0.1f, + 50f); + _extendDurationSeconds = Mathf.Clamp(EditorGUILayout.FloatField("Add Duration (Seconds)", _extendDurationSeconds), + 1f, 3600f); + + EditorGUILayout.BeginHorizontal(); + if (GUILayout.Button("Apply Spawn Rate")) + { + enemyManager.SetSpawnRateScale(_spawnRateScaleInput); + ShowNotification(new GUIContent($"Spawn rate scale = {enemyManager.SpawnRateScale:F2}")); + } + + if (GUILayout.Button("x0.5")) + { + _spawnRateScaleInput = Mathf.Max(0.1f, enemyManager.SpawnRateScale * 0.5f); + enemyManager.SetSpawnRateScale(_spawnRateScaleInput); + } + + if (GUILayout.Button("x2")) + { + _spawnRateScaleInput = enemyManager.SpawnRateScale * 2f; + enemyManager.SetSpawnRateScale(_spawnRateScaleInput); + } + EditorGUILayout.EndHorizontal(); + + if (GUILayout.Button("Add Battle Duration")) + { + enemyManager.AddBattleDuration(_extendDurationSeconds); + ShowNotification(new GUIContent($"+{_extendDurationSeconds:F0}s Battle Duration")); + } + + EditorGUILayout.Space(6f); + EditorGUILayout.LabelField("Player Weapon", player == null ? "Player not found" : (player.WeaponEnabled ? "Enabled" : "Disabled")); + using (new EditorGUI.DisabledScope(player == null)) + { + EditorGUILayout.BeginHorizontal(); + if (GUILayout.Button("Disable Weapons")) + { + player.SetWeaponEnabled(false); + ShowNotification(new GUIContent("Player weapons disabled")); + } + + if (GUILayout.Button("Enable Weapons")) + { + player.SetWeaponEnabled(true); + ShowNotification(new GUIContent("Player weapons enabled")); + } + + EditorGUILayout.EndHorizontal(); + } + } + + private void DrawToolbar() + { + EditorGUILayout.BeginHorizontal(); + _searchText = EditorGUILayout.TextField("Search", _searchText); + if (GUILayout.Button("Refresh", GUILayout.Width(80f))) + { + RefreshPropList(); + } + + EditorGUILayout.EndHorizontal(); + } + + private void DrawBuffSelector() + { + ApplyFilter(_searchText); + + if (_displayNames.Length == 0) + { + EditorGUILayout.HelpBox("No Buff data found. Ensure data tables are loaded.", MessageType.Warning); + return; + } + + _selectedIndex = Mathf.Clamp(_selectedIndex, 0, _displayNames.Length - 1); + _selectedIndex = EditorGUILayout.Popup("Buff", _selectedIndex, _displayNames); + } + + private void DrawSelectedBuffPreview() + { + DRProp selectedProp = GetSelectedProp(); + if (selectedProp == null) return; + + _scroll = EditorGUILayout.BeginScrollView(_scroll, GUILayout.Height(120f)); + EditorGUILayout.LabelField("Title", selectedProp.Title); + EditorGUILayout.LabelField("Rarity", selectedProp.Rarity.ToString()); + EditorGUILayout.LabelField("Description"); + EditorGUILayout.HelpBox(ItemDescUtility.CreatePropDescription(selectedProp.Modifiers), MessageType.None); + EditorGUILayout.EndScrollView(); + } + + private void DrawBuffActions() + { + DRProp selectedProp = GetSelectedProp(); + if (selectedProp == null) return; + + _addCount = Mathf.Clamp(EditorGUILayout.IntField("Add Count", _addCount), 1, 99); + if (!GUILayout.Button("Add Buff To Player", GUILayout.Height(28f))) return; + + Player player = FindPlayer(); + if (player == null) + { + ShowNotification(new GUIContent("Player not found")); + return; + } + + for (int i = 0; i < _addCount; i++) + { + player.AddProp(new PropItem(selectedProp.Modifiers, selectedProp.Rarity, selectedProp.Title, + selectedProp.IconAssetName)); + } + + ShowNotification(new GUIContent($"Added Buff: {selectedProp.Title} x{_addCount}")); + } + + private void RefreshPropList() + { + if (!EditorApplication.isPlaying || GameEntry.DataTable == null) + { + _allProps = Array.Empty(); + _filteredProps = Array.Empty(); + _displayNames = Array.Empty(); + return; + } + + var table = GameEntry.DataTable.GetDataTable(); + _allProps = table != null ? table.ToArray() : Array.Empty(); + _selectedIndex = 0; + ApplyFilter(_searchText); + } + + private void ApplyFilter(string searchText) + { + if (_allProps == null || _allProps.Length == 0) + { + _filteredProps = Array.Empty(); + _displayNames = Array.Empty(); + return; + } + + if (string.IsNullOrWhiteSpace(searchText)) + { + _filteredProps = _allProps; + } + else + { + string keyword = searchText.Trim(); + _filteredProps = _allProps.Where(p => + p != null && + (p.Title?.IndexOf(keyword, StringComparison.OrdinalIgnoreCase) >= 0 || + p.Id.ToString().Contains(keyword))).ToArray(); + } + + _displayNames = _filteredProps.Select(p => $"[{p.Id}] {p.Title} ({p.Rarity})").ToArray(); + if (_displayNames.Length == 0) + { + _selectedIndex = 0; + return; + } + + _selectedIndex = Mathf.Clamp(_selectedIndex, 0, _displayNames.Length - 1); + } + + private DRProp GetSelectedProp() + { + if (_filteredProps == null || _filteredProps.Length == 0) return null; + _selectedIndex = Mathf.Clamp(_selectedIndex, 0, _filteredProps.Length - 1); + return _filteredProps[_selectedIndex]; + } + + private static Player FindPlayer() + { + return UnityEngine.Object.FindObjectOfType(); + } + + private void OnPlayModeStateChanged(PlayModeStateChange state) + { + if (state == PlayModeStateChange.EnteredPlayMode || state == PlayModeStateChange.EnteredEditMode) + { + RefreshPropList(); + Repaint(); + } + } + } +} +#endif diff --git a/Assets/GameMain/Scripts/Editor/PlayerBuffConsoleWindow.cs.meta b/Assets/GameMain/Scripts/Editor/PlayerBuffConsoleWindow.cs.meta new file mode 100644 index 0000000..be3f6ae --- /dev/null +++ b/Assets/GameMain/Scripts/Editor/PlayerBuffConsoleWindow.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e43be978219545f294fbc211e32e8196 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Entity/EntityData/Enemy/EnemyData.cs b/Assets/GameMain/Scripts/Entity/EntityData/Enemy/EnemyData.cs index 7c4e079..67041a7 100644 --- a/Assets/GameMain/Scripts/Entity/EntityData/Enemy/EnemyData.cs +++ b/Assets/GameMain/Scripts/Entity/EntityData/Enemy/EnemyData.cs @@ -16,11 +16,12 @@ namespace Entity.EntityData [SerializeField] private float _dropPercent = 0; - public EnemyData(int entityId, int typeId) : base( + public EnemyData(int entityId, int typeId, int level) : base( entityId, typeId, CampType.Enemy) { DREnemy enemyRow = GameEntry.DataTable.GetDataTableRow(typeId); - MaxHealthBase = enemyRow.MaxHealth; + int effectiveLevel = Mathf.Max(1, level); + MaxHealthBase = enemyRow.MaxHealth + enemyRow.HpAddPerLevel * (effectiveLevel - 1); SpeedBase = enemyRow.Speed; DropCoin = enemyRow.DropCoin; DropExp = enemyRow.DropExp; @@ -53,4 +54,4 @@ namespace Entity.EntityData set => _dropPercent = value; } } -} \ No newline at end of file +} diff --git a/Assets/GameMain/Scripts/Entity/EntityLogic/CoinEntity.cs b/Assets/GameMain/Scripts/Entity/EntityLogic/CoinEntity.cs index bb63722..272a98a 100644 --- a/Assets/GameMain/Scripts/Entity/EntityLogic/CoinEntity.cs +++ b/Assets/GameMain/Scripts/Entity/EntityLogic/CoinEntity.cs @@ -7,10 +7,12 @@ namespace Entity public class CoinEntity : EntityBase { private CoinData _coinData; + private bool _isCollected; protected override void OnShow(object userData) { base.OnShow(userData); + _isCollected = false; if (userData is CoinData coinData) { @@ -24,14 +26,25 @@ namespace Entity this.CachedTransform.localScale = new Vector3(0.3f, 0.3f, 0.3f); } + public bool TryCollect(Player player, float collectDistance = 0f) + { + if (_isCollected || player == null || !player.Available || _coinData == null) return false; + + if (collectDistance > 0f) + { + float distance = Vector3.Distance(player.CachedTransform.position, CachedTransform.position); + if (distance > collectDistance) return false; + } + + _isCollected = true; + player.Coin += _coinData.Value; + GameEntry.Entity.HideEntity(this); + return true; + } + private void OnTriggerEnter(Collider other) { - var player = other.GetComponent(); - if (player != null && player.Available) - { - player.Coin += _coinData.Value; - GameEntry.Entity.HideEntity(this); - } + TryCollect(other.GetComponent()); } } -} \ No newline at end of file +} diff --git a/Assets/GameMain/Scripts/Entity/EntityLogic/ExpEntity.cs b/Assets/GameMain/Scripts/Entity/EntityLogic/ExpEntity.cs index 2845522..1c87e98 100644 --- a/Assets/GameMain/Scripts/Entity/EntityLogic/ExpEntity.cs +++ b/Assets/GameMain/Scripts/Entity/EntityLogic/ExpEntity.cs @@ -7,10 +7,12 @@ namespace Entity public class ExpEntity:EntityBase { private ExpData _expData; + private bool _isCollected; protected override void OnShow(object userData) { base.OnShow(userData); + _isCollected = false; if (userData is ExpData expData) { @@ -23,14 +25,25 @@ namespace Entity this.CachedTransform.localScale = new Vector3(0.3f, 0.3f, 0.3f); } + public bool TryCollect(Player player, float collectDistance = 0f) + { + if (_isCollected || player == null || !player.Available || _expData == null) return false; + + if (collectDistance > 0f) + { + float distance = Vector3.Distance(player.CachedTransform.position, CachedTransform.position); + if (distance > collectDistance) return false; + } + + _isCollected = true; + player.Exp += _expData.Value; + GameEntry.Entity.HideEntity(this); + return true; + } + private void OnTriggerEnter(Collider other) { - var player = other.GetComponent(); - if (player != null && player.Available) - { - player.Exp += _expData.Value; - GameEntry.Entity.HideEntity(this); - } + TryCollect(other.GetComponent()); } } -} \ No newline at end of file +} diff --git a/Assets/GameMain/Scripts/Entity/EntityLogic/Player.cs b/Assets/GameMain/Scripts/Entity/EntityLogic/Player.cs index d3cfb61..d7c161e 100644 --- a/Assets/GameMain/Scripts/Entity/EntityLogic/Player.cs +++ b/Assets/GameMain/Scripts/Entity/EntityLogic/Player.cs @@ -15,6 +15,7 @@ namespace Entity private InputComponent _inputComponent; private MovementComponent _movementComponent; + private AbsorbComponent _absorbComponent; private StatComponent _statComponent; private BackpackComponent _backpackComponent; private PlayerData _playerData; @@ -44,6 +45,7 @@ namespace Entity /// 玩家是否启用。 /// private bool _enable; + private bool _weaponEnabled = true; public int Coin { @@ -95,11 +97,19 @@ namespace Entity if (value == _enable) return; _enable = value; _movementComponent.SetMove(value); - _backpackComponent.SetWeaponState(value); + _backpackComponent.SetWeaponState(value && _weaponEnabled); _inputComponent.SetListening(value); } } + public bool WeaponEnabled => _weaponEnabled; + + public void SetWeaponEnabled(bool enabled) + { + _weaponEnabled = enabled; + _backpackComponent?.SetWeaponState(_enable && _weaponEnabled); + } + public void InitRole(DRRole role) { // MovementComponent @@ -146,9 +156,15 @@ namespace Entity _inputComponent = GetComponent(); _movementComponent = GetComponent(); + _absorbComponent = GetComponent(); _statComponent = GetComponent(); _healthComponent = GetComponent(); _backpackComponent = GetComponent(); + + if (_absorbComponent == null) + { + _absorbComponent = gameObject.AddComponent(); + } } protected override void OnShow(object userData) @@ -166,6 +182,8 @@ namespace Entity _inputComponent.OnInit(); _inputComponent.SetListening(true); + _absorbComponent.OnInit(this, _statComponent); + _weaponEnabled = true; _currentLevel = 0; } @@ -178,6 +196,7 @@ namespace Entity _movementComponent.SetDirection(_inputComponent.Direction); _movementComponent.OnUpdate(elapseSeconds, realElapseSeconds); + _absorbComponent.OnUpdate(elapseSeconds, realElapseSeconds); } protected override void OnHide(bool isShutdown, object userData) @@ -187,6 +206,7 @@ namespace Entity _healthComponent.OnReset(); _statComponent.OnReset(); _backpackComponent.OnReset(); + _absorbComponent.OnReset(); base.OnHide(isShutdown, userData); } @@ -206,4 +226,4 @@ namespace Entity #endregion } -} \ No newline at end of file +} diff --git a/Assets/GameMain/Scripts/Entity/EntityLogic/Weapon/WeaponBase.cs b/Assets/GameMain/Scripts/Entity/EntityLogic/Weapon/WeaponBase.cs index 4610baf..c594bef 100644 --- a/Assets/GameMain/Scripts/Entity/EntityLogic/Weapon/WeaponBase.cs +++ b/Assets/GameMain/Scripts/Entity/EntityLogic/Weapon/WeaponBase.cs @@ -24,15 +24,15 @@ namespace Entity public abstract class WeaponBase : EntityBase { protected const string AttachPoint = "Weapon Point"; - + protected bool _isAttacking = false; - - protected bool _isEnabled = false; - + + [SerializeField] protected bool _isEnabled = false; + public WeaponData WeaponData; - + public bool IsAttacking => _isAttacking; - + protected WeaponStateBase _currentState; #region FSM diff --git a/Assets/GameMain/Scripts/Procedure/Base/ProcedurePreload.cs b/Assets/GameMain/Scripts/Procedure/Base/ProcedurePreload.cs index f675b69..fbeb920 100644 --- a/Assets/GameMain/Scripts/Procedure/Base/ProcedurePreload.cs +++ b/Assets/GameMain/Scripts/Procedure/Base/ProcedurePreload.cs @@ -37,7 +37,8 @@ namespace Procedure "Prop", "Role", "Level", - "LevelUpReward" + "LevelUpReward", + "LevelRarity" }; private Dictionary _loadedFlag = new Dictionary(); diff --git a/Assets/GameMain/Scripts/Procedure/Game/GameStateBattle.cs b/Assets/GameMain/Scripts/Procedure/Game/GameStateBattle.cs index 557cf92..927c079 100644 --- a/Assets/GameMain/Scripts/Procedure/Game/GameStateBattle.cs +++ b/Assets/GameMain/Scripts/Procedure/Game/GameStateBattle.cs @@ -50,7 +50,6 @@ namespace Procedure if (_levelOver) { - procedureOwner.SetData("CurrentLevel", (byte)(_currentLevel + 1)); _procedureGame.BattleToShopOrLevelUp(); } } diff --git a/Assets/GameMain/Scripts/Procedure/Game/ProcedureGame.cs b/Assets/GameMain/Scripts/Procedure/Game/ProcedureGame.cs index 83c47ba..10f58fe 100644 --- a/Assets/GameMain/Scripts/Procedure/Game/ProcedureGame.cs +++ b/Assets/GameMain/Scripts/Procedure/Game/ProcedureGame.cs @@ -53,6 +53,7 @@ namespace Procedure public void BattleToShopOrLevelUp() { + CurrentLevel++; if (_currentGameState == GameStateType.Shop || _currentGameState == GameStateType.LevelUp) return; _gameStates[_currentGameState].OnLeave(_procedureOwner); diff --git a/Assets/GameMain/Scripts/SpriteCache/SpriteCacheComponent.cs b/Assets/GameMain/Scripts/SpriteCache/SpriteCacheComponent.cs index 15bb660..44cd430 100644 --- a/Assets/GameMain/Scripts/SpriteCache/SpriteCacheComponent.cs +++ b/Assets/GameMain/Scripts/SpriteCache/SpriteCacheComponent.cs @@ -45,7 +45,7 @@ public class SpriteCacheComponent : GameFrameworkComponent new Rect(0, 0, texture.width, texture.height), _defaultPivot, _pixelsPerUnit); - _spriteCache.Add(assetName, newSprite); + _spriteCache.TryAdd(assetName, newSprite); callback?.Invoke(newSprite); } }, diff --git a/Assets/GameMain/Scripts/UI/GameScene/UseCase/LevelUpFormUseCase.cs b/Assets/GameMain/Scripts/UI/GameScene/UseCase/LevelUpFormUseCase.cs index 823353e..4901588 100644 --- a/Assets/GameMain/Scripts/UI/GameScene/UseCase/LevelUpFormUseCase.cs +++ b/Assets/GameMain/Scripts/UI/GameScene/UseCase/LevelUpFormUseCase.cs @@ -7,6 +7,8 @@ using Entity; using Procedure; using UnityEngine; using UnityGameFramework.Runtime; +using Game.Utility; +using GameFramework.DataTable; namespace UI { @@ -15,6 +17,9 @@ namespace UI private const int BaseRefreshPrice = 2; private readonly GameStateLevelUp _gameStateLevelUp; private readonly DRLevelUpReward[] _allRewards; + private readonly IDataTable _levelRarityTable; + private readonly Dictionary> _rewardsByRarity = new(); + private readonly List _validRewards = new(); private int _refreshCount; private LevelUpFormRawData _currentModel; @@ -26,6 +31,9 @@ namespace UI _player = player; _gameStateLevelUp = gameStateLevelUp; _allRewards = GameEntry.DataTable.GetDataTable().ToArray(); + _levelRarityTable = GameEntry.DataTable.GetDataTable(); + + BuildRewardRarityPools(); } public LevelUpFormRawData CreateInitialModel(int count = 4) @@ -99,10 +107,18 @@ namespace UI int finalCount = count > 0 ? System.Math.Min(count, _allRewards.Length) : _allRewards.Length; List selections = new List(finalCount); + int currentLevel = _player != null ? _player.CurrentLevel : 1; for (int i = 0; i < finalCount; i++) { - int index = Random.Range(0, _allRewards.Length); - selections.Add(_allRewards[index]); + ItemRarity rarity = RarityUtility.SelectRarityForLevel(_levelRarityTable, currentLevel); + DRLevelUpReward reward = PickRewardByRarity(rarity); + if (reward == null) + { + Log.Warning("LevelUpFormUseCase::BuildModel(): No available reward for selection."); + break; + } + + selections.Add(reward); } return new LevelUpFormRawData @@ -131,7 +147,49 @@ namespace UI return; } - _player.AddProp(new PropItem(reward.Modifiers, ItemRarity.White, reward.Title, reward.IconAssetName)); + _player.AddProp(new PropItem(reward.Modifiers, reward.Rarity, reward.Title, reward.IconAssetName)); + } + + private void BuildRewardRarityPools() + { + _rewardsByRarity.Clear(); + _validRewards.Clear(); + + if (_allRewards == null) return; + + foreach (DRLevelUpReward reward in _allRewards) + { + if (reward == null) + { + continue; + } + + ItemRarity rarity = reward.Rarity; + _validRewards.Add(reward); + + if (!_rewardsByRarity.TryGetValue(rarity, out List list)) + { + list = new List(); + _rewardsByRarity.Add(rarity, list); + } + + list.Add(reward); + } + } + + private DRLevelUpReward PickRewardByRarity(ItemRarity rarity) + { + if (_rewardsByRarity.TryGetValue(rarity, out List list) && list.Count > 0) + { + return list[Random.Range(0, list.Count)]; + } + + if (_validRewards.Count > 0) + { + return _validRewards[Random.Range(0, _validRewards.Count)]; + } + + return null; } } -} \ No newline at end of file +} diff --git a/Assets/GameMain/Scripts/UI/GameScene/UseCase/ShopFormUseCase.cs b/Assets/GameMain/Scripts/UI/GameScene/UseCase/ShopFormUseCase.cs index 2563aca..43732d5 100644 --- a/Assets/GameMain/Scripts/UI/GameScene/UseCase/ShopFormUseCase.cs +++ b/Assets/GameMain/Scripts/UI/GameScene/UseCase/ShopFormUseCase.cs @@ -33,6 +33,10 @@ namespace UI private readonly DRGoods[] _allGoods; private readonly IDataTable _propDataTable; private readonly IDataTable _weaponDataTable; + private readonly IDataTable _levelRarityTable; + + private readonly List _validGoods = new(); + private readonly Dictionary> _goodsByRarity = new(); private readonly List _selections = new(); private int _refreshTime; @@ -53,6 +57,9 @@ namespace UI _allGoods = GameEntry.DataTable.GetDataTable().ToArray(); _propDataTable = GameEntry.DataTable.GetDataTable(); _weaponDataTable = GameEntry.DataTable.GetDataTable(); + _levelRarityTable = GameEntry.DataTable.GetDataTable(); + + BuildGoodsRarityPools(); } public ShopFormRawData CreateInitialModel() @@ -148,10 +155,18 @@ namespace UI List goodsItems = new List(finalCount); _selections.Clear(); + int currentLevel = _procedureGame != null ? _procedureGame.CurrentLevel : 1; + for (int i = 0; i < finalCount; i++) { - int index = Random.Range(0, _allGoods.Length); - DRGoods drGoods = _allGoods[index]; + ItemRarity rarity = RarityUtility.SelectRarityForLevel(_levelRarityTable, currentLevel); + DRGoods drGoods = PickGoodsByRarity(rarity); + if (drGoods == null) + { + Log.Warning("ShopFormUseCase::BuildRandomGoodsItems: No available goods for selection."); + break; + } + GoodsItemContext goodsItem = new GoodsItemContext(); int price; @@ -208,6 +223,87 @@ namespace UI return goodsItems; } + private void BuildGoodsRarityPools() + { + _goodsByRarity.Clear(); + _validGoods.Clear(); + + if (_allGoods == null) return; + + foreach (DRGoods goods in _allGoods) + { + if (goods == null) continue; + + if (!TryGetGoodsRarity(goods, out ItemRarity rarity)) + { + continue; + } + + _validGoods.Add(goods); + + if (!_goodsByRarity.TryGetValue(rarity, out List list)) + { + list = new List(); + _goodsByRarity.Add(rarity, list); + } + + list.Add(goods); + } + } + + private DRGoods PickGoodsByRarity(ItemRarity rarity) + { + if (_goodsByRarity.TryGetValue(rarity, out List list) && list.Count > 0) + { + return list[Random.Range(0, list.Count)]; + } + + if (_validGoods.Count > 0) + { + return _validGoods[Random.Range(0, _validGoods.Count)]; + } + + return null; + } + + private bool TryGetGoodsRarity(DRGoods goods, out ItemRarity rarity) + { + rarity = ItemRarity.None; + if (goods == null) + { + return false; + } + + if (goods.GoodsType == GoodsType.Prop) + { + DRProp drProp = _propDataTable != null ? _propDataTable.GetDataRow(goods.GoodsTypeId) : null; + if (drProp == null) + { + Log.Warning($"ShopFormUseCase::TryGetGoodsRarity: Missing DRProp, id = {goods.GoodsTypeId}"); + return false; + } + + rarity = drProp.Rarity; + return true; + } + + if (goods.GoodsType == GoodsType.Weapon) + { + DRWeapon drWeapon = _weaponDataTable != null ? _weaponDataTable.GetDataRow(goods.GoodsTypeId) : null; + if (drWeapon == null) + { + Log.Warning($"ShopFormUseCase::TryGetGoodsRarity: Missing DRWeapon, id = {goods.GoodsTypeId}"); + return false; + } + + rarity = drWeapon.Rarity; + return true; + } + + Log.Warning($"ShopFormUseCase::TryGetGoodsRarity: Unsupported goods type = {goods.GoodsType}"); + return false; + } + private static int CalculateRandomizedPrice(int basePrice, float priceRandomPercent) { float normalizedPercent = priceRandomPercent > 1f ? priceRandomPercent / 100f : priceRandomPercent; diff --git a/Assets/GameMain/Scripts/Utility/RarityUtility.cs b/Assets/GameMain/Scripts/Utility/RarityUtility.cs new file mode 100644 index 0000000..1941625 --- /dev/null +++ b/Assets/GameMain/Scripts/Utility/RarityUtility.cs @@ -0,0 +1,89 @@ +using DataTable; +using Definition.Enum; +using GameFramework.DataTable; +using UnityEngine; + +namespace Game.Utility +{ + public static class RarityUtility + { + public static ItemRarity SelectRarityForLevel(IDataTable table, int level) + { + DRLevelRarity row = GetLevelRarityRow(table, level); + if (row == null) + { + return ItemRarity.White; + } + + int white = Mathf.Max(0, row.WhiteWeight); + int green = Mathf.Max(0, row.GreenWeight); + int blue = Mathf.Max(0, row.BlueWeight); + int purple = Mathf.Max(0, row.PurpleWeight); + int red = Mathf.Max(0, row.RedWeight); + + int total = white + green + blue + purple + red; + if (total <= 0) + { + return ItemRarity.White; + } + + int roll = Random.Range(1, total + 1); + if (roll <= white) return ItemRarity.White; + roll -= white; + if (roll <= green) return ItemRarity.Green; + roll -= green; + if (roll <= blue) return ItemRarity.Blue; + roll -= blue; + if (roll <= purple) return ItemRarity.Purple; + return ItemRarity.Red; + } + + private static DRLevelRarity GetLevelRarityRow(IDataTable table, int level) + { + if (table == null) + { + return null; + } + + DRLevelRarity[] rows = table.GetAllDataRows(); + if (rows == null || rows.Length == 0) + { + return null; + } + + int safeLevel = Mathf.Max(1, level); + DRLevelRarity below = null; + DRLevelRarity above = null; + + foreach (DRLevelRarity row in rows) + { + if (row == null) + { + continue; + } + + if (safeLevel >= row.LevelMin && safeLevel <= row.LevelMax) + { + return row; + } + + if (safeLevel < row.LevelMin) + { + if (above == null || row.LevelMin < above.LevelMin) + { + above = row; + } + } + else if (safeLevel > row.LevelMax) + { + if (below == null || row.LevelMax > below.LevelMax) + { + below = row; + } + } + } + + return above ?? below; + } + } +} diff --git a/Assets/GameMain/Scripts/Utility/RarityUtility.cs.meta b/Assets/GameMain/Scripts/Utility/RarityUtility.cs.meta new file mode 100644 index 0000000..c7bf09b --- /dev/null +++ b/Assets/GameMain/Scripts/Utility/RarityUtility.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d9186261c82d4f0b8270048f08158b0f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Settings.meta b/Assets/GameMain/Settings.meta similarity index 100% rename from Assets/Settings.meta rename to Assets/GameMain/Settings.meta diff --git a/Assets/Settings/SampleSceneProfile.asset b/Assets/GameMain/Settings/SampleSceneProfile.asset similarity index 100% rename from Assets/Settings/SampleSceneProfile.asset rename to Assets/GameMain/Settings/SampleSceneProfile.asset diff --git a/Assets/Settings/SampleSceneProfile.asset.meta b/Assets/GameMain/Settings/SampleSceneProfile.asset.meta similarity index 100% rename from Assets/Settings/SampleSceneProfile.asset.meta rename to Assets/GameMain/Settings/SampleSceneProfile.asset.meta diff --git a/Assets/Settings/URP-Balanced-Renderer.asset b/Assets/GameMain/Settings/URP-Balanced-Renderer.asset similarity index 100% rename from Assets/Settings/URP-Balanced-Renderer.asset rename to Assets/GameMain/Settings/URP-Balanced-Renderer.asset diff --git a/Assets/Settings/URP-Balanced-Renderer.asset.meta b/Assets/GameMain/Settings/URP-Balanced-Renderer.asset.meta similarity index 100% rename from Assets/Settings/URP-Balanced-Renderer.asset.meta rename to Assets/GameMain/Settings/URP-Balanced-Renderer.asset.meta diff --git a/Assets/Settings/URP-Balanced.asset b/Assets/GameMain/Settings/URP-Balanced.asset similarity index 76% rename from Assets/Settings/URP-Balanced.asset rename to Assets/GameMain/Settings/URP-Balanced.asset index 65bbfc8..aef05b8 100644 --- a/Assets/Settings/URP-Balanced.asset +++ b/Assets/GameMain/Settings/URP-Balanced.asset @@ -82,33 +82,33 @@ MonoBehaviour: m_Textures: blueNoise64LTex: {fileID: 2800000, guid: e3d24661c1e055f45a7560c033dbb837, type: 3} bayerMatrixTex: {fileID: 2800000, guid: f9ee4ed84c1d10c49aabb9b210b0fc44, type: 3} - m_PrefilteringModeMainLightShadows: 1 - m_PrefilteringModeAdditionalLight: 4 - m_PrefilteringModeAdditionalLightShadows: 1 - m_PrefilterXRKeywords: 0 - m_PrefilteringModeForwardPlus: 1 - m_PrefilteringModeDeferredRendering: 1 - m_PrefilteringModeScreenSpaceOcclusion: 1 - m_PrefilterDebugKeywords: 0 - m_PrefilterWriteRenderingLayers: 0 - m_PrefilterHDROutput: 0 - m_PrefilterSSAODepthNormals: 0 + m_PrefilteringModeMainLightShadows: 3 + m_PrefilteringModeAdditionalLight: 3 + m_PrefilteringModeAdditionalLightShadows: 0 + m_PrefilterXRKeywords: 1 + m_PrefilteringModeForwardPlus: 0 + m_PrefilteringModeDeferredRendering: 0 + m_PrefilteringModeScreenSpaceOcclusion: 2 + m_PrefilterDebugKeywords: 1 + m_PrefilterWriteRenderingLayers: 1 + m_PrefilterHDROutput: 1 + m_PrefilterSSAODepthNormals: 1 m_PrefilterSSAOSourceDepthLow: 0 - m_PrefilterSSAOSourceDepthMedium: 0 - m_PrefilterSSAOSourceDepthHigh: 0 + m_PrefilterSSAOSourceDepthMedium: 1 + m_PrefilterSSAOSourceDepthHigh: 1 m_PrefilterSSAOInterleaved: 0 - m_PrefilterSSAOBlueNoise: 0 + m_PrefilterSSAOBlueNoise: 1 m_PrefilterSSAOSampleCountLow: 0 - m_PrefilterSSAOSampleCountMedium: 0 - m_PrefilterSSAOSampleCountHigh: 0 - m_PrefilterDBufferMRT1: 0 - m_PrefilterDBufferMRT2: 0 - m_PrefilterDBufferMRT3: 0 - m_PrefilterSoftShadowsQualityLow: 0 - m_PrefilterSoftShadowsQualityMedium: 0 - m_PrefilterSoftShadowsQualityHigh: 0 + m_PrefilterSSAOSampleCountMedium: 1 + m_PrefilterSSAOSampleCountHigh: 1 + m_PrefilterDBufferMRT1: 1 + m_PrefilterDBufferMRT2: 1 + m_PrefilterDBufferMRT3: 1 + m_PrefilterSoftShadowsQualityLow: 1 + m_PrefilterSoftShadowsQualityMedium: 1 + m_PrefilterSoftShadowsQualityHigh: 1 m_PrefilterSoftShadows: 0 - m_PrefilterScreenCoord: 0 - m_PrefilterNativeRenderPass: 0 + m_PrefilterScreenCoord: 1 + m_PrefilterNativeRenderPass: 1 m_ShaderVariantLogLevel: 0 m_ShadowCascades: 0 diff --git a/Assets/Settings/URP-Balanced.asset.meta b/Assets/GameMain/Settings/URP-Balanced.asset.meta similarity index 100% rename from Assets/Settings/URP-Balanced.asset.meta rename to Assets/GameMain/Settings/URP-Balanced.asset.meta diff --git a/Assets/Settings/URP-HighFidelity-Renderer.asset b/Assets/GameMain/Settings/URP-HighFidelity-Renderer.asset similarity index 100% rename from Assets/Settings/URP-HighFidelity-Renderer.asset rename to Assets/GameMain/Settings/URP-HighFidelity-Renderer.asset diff --git a/Assets/Settings/URP-HighFidelity-Renderer.asset.meta b/Assets/GameMain/Settings/URP-HighFidelity-Renderer.asset.meta similarity index 100% rename from Assets/Settings/URP-HighFidelity-Renderer.asset.meta rename to Assets/GameMain/Settings/URP-HighFidelity-Renderer.asset.meta diff --git a/Assets/Settings/URP-HighFidelity.asset b/Assets/GameMain/Settings/URP-HighFidelity.asset similarity index 76% rename from Assets/Settings/URP-HighFidelity.asset rename to Assets/GameMain/Settings/URP-HighFidelity.asset index d526597..627e0eb 100644 --- a/Assets/Settings/URP-HighFidelity.asset +++ b/Assets/GameMain/Settings/URP-HighFidelity.asset @@ -82,33 +82,33 @@ MonoBehaviour: m_Textures: blueNoise64LTex: {fileID: 2800000, guid: e3d24661c1e055f45a7560c033dbb837, type: 3} bayerMatrixTex: {fileID: 2800000, guid: f9ee4ed84c1d10c49aabb9b210b0fc44, type: 3} - m_PrefilteringModeMainLightShadows: 1 - m_PrefilteringModeAdditionalLight: 4 - m_PrefilteringModeAdditionalLightShadows: 1 - m_PrefilterXRKeywords: 0 - m_PrefilteringModeForwardPlus: 1 - m_PrefilteringModeDeferredRendering: 1 - m_PrefilteringModeScreenSpaceOcclusion: 1 - m_PrefilterDebugKeywords: 0 - m_PrefilterWriteRenderingLayers: 0 - m_PrefilterHDROutput: 0 + m_PrefilteringModeMainLightShadows: 3 + m_PrefilteringModeAdditionalLight: 3 + m_PrefilteringModeAdditionalLightShadows: 2 + m_PrefilterXRKeywords: 1 + m_PrefilteringModeForwardPlus: 0 + m_PrefilteringModeDeferredRendering: 0 + m_PrefilteringModeScreenSpaceOcclusion: 2 + m_PrefilterDebugKeywords: 1 + m_PrefilterWriteRenderingLayers: 1 + m_PrefilterHDROutput: 1 m_PrefilterSSAODepthNormals: 0 - m_PrefilterSSAOSourceDepthLow: 0 - m_PrefilterSSAOSourceDepthMedium: 0 - m_PrefilterSSAOSourceDepthHigh: 0 + m_PrefilterSSAOSourceDepthLow: 1 + m_PrefilterSSAOSourceDepthMedium: 1 + m_PrefilterSSAOSourceDepthHigh: 1 m_PrefilterSSAOInterleaved: 0 - m_PrefilterSSAOBlueNoise: 0 - m_PrefilterSSAOSampleCountLow: 0 - m_PrefilterSSAOSampleCountMedium: 0 + m_PrefilterSSAOBlueNoise: 1 + m_PrefilterSSAOSampleCountLow: 1 + m_PrefilterSSAOSampleCountMedium: 1 m_PrefilterSSAOSampleCountHigh: 0 - m_PrefilterDBufferMRT1: 0 - m_PrefilterDBufferMRT2: 0 - m_PrefilterDBufferMRT3: 0 - m_PrefilterSoftShadowsQualityLow: 0 - m_PrefilterSoftShadowsQualityMedium: 0 - m_PrefilterSoftShadowsQualityHigh: 0 + m_PrefilterDBufferMRT1: 1 + m_PrefilterDBufferMRT2: 1 + m_PrefilterDBufferMRT3: 1 + m_PrefilterSoftShadowsQualityLow: 1 + m_PrefilterSoftShadowsQualityMedium: 1 + m_PrefilterSoftShadowsQualityHigh: 1 m_PrefilterSoftShadows: 0 - m_PrefilterScreenCoord: 0 - m_PrefilterNativeRenderPass: 0 + m_PrefilterScreenCoord: 1 + m_PrefilterNativeRenderPass: 1 m_ShaderVariantLogLevel: 0 m_ShadowCascades: 1 diff --git a/Assets/Settings/URP-HighFidelity.asset.meta b/Assets/GameMain/Settings/URP-HighFidelity.asset.meta similarity index 100% rename from Assets/Settings/URP-HighFidelity.asset.meta rename to Assets/GameMain/Settings/URP-HighFidelity.asset.meta diff --git a/Assets/Settings/URP-Performant-Renderer.asset b/Assets/GameMain/Settings/URP-Performant-Renderer.asset similarity index 100% rename from Assets/Settings/URP-Performant-Renderer.asset rename to Assets/GameMain/Settings/URP-Performant-Renderer.asset diff --git a/Assets/Settings/URP-Performant-Renderer.asset.meta b/Assets/GameMain/Settings/URP-Performant-Renderer.asset.meta similarity index 100% rename from Assets/Settings/URP-Performant-Renderer.asset.meta rename to Assets/GameMain/Settings/URP-Performant-Renderer.asset.meta diff --git a/Assets/Settings/URP-Performant.asset b/Assets/GameMain/Settings/URP-Performant.asset similarity index 74% rename from Assets/Settings/URP-Performant.asset rename to Assets/GameMain/Settings/URP-Performant.asset index 8650b69..05bb741 100644 --- a/Assets/Settings/URP-Performant.asset +++ b/Assets/GameMain/Settings/URP-Performant.asset @@ -82,33 +82,33 @@ MonoBehaviour: m_Textures: blueNoise64LTex: {fileID: 2800000, guid: e3d24661c1e055f45a7560c033dbb837, type: 3} bayerMatrixTex: {fileID: 2800000, guid: f9ee4ed84c1d10c49aabb9b210b0fc44, type: 3} - m_PrefilteringModeMainLightShadows: 1 - m_PrefilteringModeAdditionalLight: 4 - m_PrefilteringModeAdditionalLightShadows: 1 - m_PrefilterXRKeywords: 0 - m_PrefilteringModeForwardPlus: 1 - m_PrefilteringModeDeferredRendering: 1 - m_PrefilteringModeScreenSpaceOcclusion: 1 - m_PrefilterDebugKeywords: 0 - m_PrefilterWriteRenderingLayers: 0 - m_PrefilterHDROutput: 0 - m_PrefilterSSAODepthNormals: 0 - m_PrefilterSSAOSourceDepthLow: 0 - m_PrefilterSSAOSourceDepthMedium: 0 - m_PrefilterSSAOSourceDepthHigh: 0 - m_PrefilterSSAOInterleaved: 0 - m_PrefilterSSAOBlueNoise: 0 - m_PrefilterSSAOSampleCountLow: 0 - m_PrefilterSSAOSampleCountMedium: 0 - m_PrefilterSSAOSampleCountHigh: 0 - m_PrefilterDBufferMRT1: 0 - m_PrefilterDBufferMRT2: 0 - m_PrefilterDBufferMRT3: 0 - m_PrefilterSoftShadowsQualityLow: 0 - m_PrefilterSoftShadowsQualityMedium: 0 - m_PrefilterSoftShadowsQualityHigh: 0 + m_PrefilteringModeMainLightShadows: 0 + m_PrefilteringModeAdditionalLight: 0 + m_PrefilteringModeAdditionalLightShadows: 0 + m_PrefilterXRKeywords: 1 + m_PrefilteringModeForwardPlus: 0 + m_PrefilteringModeDeferredRendering: 0 + m_PrefilteringModeScreenSpaceOcclusion: 0 + m_PrefilterDebugKeywords: 1 + m_PrefilterWriteRenderingLayers: 1 + m_PrefilterHDROutput: 1 + m_PrefilterSSAODepthNormals: 1 + m_PrefilterSSAOSourceDepthLow: 1 + m_PrefilterSSAOSourceDepthMedium: 1 + m_PrefilterSSAOSourceDepthHigh: 1 + m_PrefilterSSAOInterleaved: 1 + m_PrefilterSSAOBlueNoise: 1 + m_PrefilterSSAOSampleCountLow: 1 + m_PrefilterSSAOSampleCountMedium: 1 + m_PrefilterSSAOSampleCountHigh: 1 + m_PrefilterDBufferMRT1: 1 + m_PrefilterDBufferMRT2: 1 + m_PrefilterDBufferMRT3: 1 + m_PrefilterSoftShadowsQualityLow: 1 + m_PrefilterSoftShadowsQualityMedium: 1 + m_PrefilterSoftShadowsQualityHigh: 1 m_PrefilterSoftShadows: 0 - m_PrefilterScreenCoord: 0 - m_PrefilterNativeRenderPass: 0 + m_PrefilterScreenCoord: 1 + m_PrefilterNativeRenderPass: 1 m_ShaderVariantLogLevel: 0 m_ShadowCascades: 0 diff --git a/Assets/Settings/URP-Performant.asset.meta b/Assets/GameMain/Settings/URP-Performant.asset.meta similarity index 100% rename from Assets/Settings/URP-Performant.asset.meta rename to Assets/GameMain/Settings/URP-Performant.asset.meta diff --git a/Assets/GameMain/UI/UIItems/DamageTextItem.prefab b/Assets/GameMain/UI/UIItems/DamageTextItem.prefab new file mode 100644 index 0000000..a3dc0c5 --- /dev/null +++ b/Assets/GameMain/UI/UIItems/DamageTextItem.prefab @@ -0,0 +1,166 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &8729657611800212236 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6585707618525138319} + - component: {fileID: 3880047934229121052} + - component: {fileID: 7710035529272699062} + - component: {fileID: 3312007461897115449} + - component: {fileID: 8516728773988177298} + m_Layer: 5 + m_Name: DamageTextItem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6585707618525138319 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8729657611800212236} + 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} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &3880047934229121052 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8729657611800212236} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 501e678f9cb14af6ac45e8d2050388d3, type: 3} + m_Name: + m_EditorClassIdentifier: + _cachedTransform: {fileID: 6585707618525138319} + _canvasGroup: {fileID: 8516728773988177298} + _text: {fileID: 3312007461897115449} +--- !u!222 &7710035529272699062 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8729657611800212236} + m_CullTransparentMesh: 1 +--- !u!114 &3312007461897115449 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8729657611800212236} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 100 + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 99d811b0183246646a2ce8df996f4bca, type: 2} + m_sharedMaterial: {fileID: -1106088975554028259, guid: 99d811b0183246646a2ce8df996f4bca, + type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4282077951 + m_fontColor: {r: 1, g: 0.32, b: 0.23, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 45 + m_fontSizeBase: 45 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 1 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!225 &8516728773988177298 +CanvasGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8729657611800212236} + m_Enabled: 1 + m_Alpha: 1 + m_Interactable: 1 + m_BlocksRaycasts: 1 + m_IgnoreParentGroups: 0 diff --git a/Assets/GameMain/UI/UIItems/DamageTextItem.prefab.meta b/Assets/GameMain/UI/UIItems/DamageTextItem.prefab.meta new file mode 100644 index 0000000..795fef8 --- /dev/null +++ b/Assets/GameMain/UI/UIItems/DamageTextItem.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 308577c72eb4cd14ca676aeee62b0ea5 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/UniversalRenderPipelineGlobalSettings.asset b/Assets/GameMain/UniversalRenderPipelineGlobalSettings.asset similarity index 100% rename from Assets/UniversalRenderPipelineGlobalSettings.asset rename to Assets/GameMain/UniversalRenderPipelineGlobalSettings.asset diff --git a/Assets/UniversalRenderPipelineGlobalSettings.asset.meta b/Assets/GameMain/UniversalRenderPipelineGlobalSettings.asset.meta similarity index 100% rename from Assets/UniversalRenderPipelineGlobalSettings.asset.meta rename to Assets/GameMain/UniversalRenderPipelineGlobalSettings.asset.meta diff --git a/Assets/Launcher.unity b/Assets/Launcher.unity index 4112299..fae577e 100644 --- a/Assets/Launcher.unity +++ b/Assets/Launcher.unity @@ -122,6 +122,89 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!1 &31248796 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 31248797} + - component: {fileID: 31248799} + - component: {fileID: 31248798} + m_Layer: 5 + m_Name: DamageText Instances + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &31248797 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 31248796} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 534968532} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!114 &31248798 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 31248796} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 1 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 2560, y: 1600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!223 &31248799 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 31248796} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 + m_AdditionalShaderChannelsFlag: 25 + m_UpdateRectTransformForStandalone: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 --- !u!1 &119167775 GameObject: m_ObjectHideFlags: 0 @@ -156,6 +239,7 @@ Transform: - {fileID: 1968988098} - {fileID: 472081678} - {fileID: 2050832067} + - {fileID: 534968532} m_Father: {fileID: 1852670053} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &120093239 @@ -248,143 +332,6 @@ MonoBehaviour: m_PointerBehavior: 0 m_CursorLockBehavior: 0 m_ScrollDeltaPerTick: 6 ---- !u!1 &278770807 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 278770808} - - component: {fileID: 278770811} - - component: {fileID: 278770810} - - component: {fileID: 278770809} - m_Layer: 0 - m_Name: Camera - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &278770808 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 278770807} - 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: 1852670053} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &278770809 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 278770807} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3} - m_Name: - m_EditorClassIdentifier: - m_RenderShadows: 1 - m_RequiresDepthTextureOption: 2 - m_RequiresOpaqueTextureOption: 2 - m_CameraType: 0 - m_Cameras: [] - m_RendererIndex: -1 - m_VolumeLayerMask: - serializedVersion: 2 - m_Bits: 1 - m_VolumeTrigger: {fileID: 0} - m_VolumeFrameworkUpdateModeOption: 2 - m_RenderPostProcessing: 0 - m_Antialiasing: 0 - m_AntialiasingQuality: 2 - m_StopNaN: 0 - m_Dithering: 0 - m_ClearDepth: 1 - m_AllowXRRendering: 1 - m_AllowHDROutput: 1 - m_UseScreenCoordOverride: 0 - m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0} - m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} - m_RequiresDepthTexture: 0 - m_RequiresColorTexture: 0 - m_Version: 2 - m_TaaSettings: - m_Quality: 3 - m_FrameInfluence: 0.1 - m_JitterScale: 1 - m_MipBias: 0 - m_VarianceClampScale: 0.9 - m_ContrastAdaptiveSharpening: 0 ---- !u!81 &278770810 -AudioListener: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 278770807} - m_Enabled: 1 ---- !u!20 &278770811 -Camera: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 278770807} - m_Enabled: 1 - serializedVersion: 2 - m_ClearFlags: 1 - m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} - m_projectionMatrixMode: 1 - m_GateFitMode: 2 - m_FOVAxisMode: 0 - m_Iso: 200 - m_ShutterSpeed: 0.005 - m_Aperture: 16 - m_FocusDistance: 10 - m_FocalLength: 50 - m_BladeCount: 5 - m_Curvature: {x: 2, y: 11} - m_BarrelClipping: 0.25 - m_Anamorphism: 0 - m_SensorSize: {x: 36, y: 24} - m_LensShift: {x: 0, y: 0} - m_NormalizedViewPortRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 - near clip plane: 0.3 - far clip plane: 1000 - field of view: 60 - orthographic: 0 - orthographic size: 5 - m_Depth: 0 - m_CullingMask: - serializedVersion: 2 - m_Bits: 4294967295 - m_RenderingPath: -1 - m_TargetTexture: {fileID: 0} - m_TargetDisplay: 0 - m_TargetEye: 3 - m_HDR: 1 - m_AllowMSAA: 1 - m_AllowDynamicResolution: 0 - m_ForceIntoRT: 0 - m_OcclusionCulling: 1 - m_StereoConvergence: 10 - m_StereoSeparation: 0.022 --- !u!1001 &343730742 PrefabInstance: m_ObjectHideFlags: 0 @@ -765,7 +712,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 11497722, guid: adb3eb1c35fcff14f89fba7b05c9d71c, type: 3} propertyPath: m_ResourceMode - value: 2 + value: 1 objectReference: {fileID: 0} - target: {fileID: 11499388, guid: adb3eb1c35fcff14f89fba7b05c9d71c, type: 3} propertyPath: m_FrameRate @@ -904,6 +851,57 @@ MonoBehaviour: type: 3} m_UpdateResourceFormTemplate: {fileID: 11487720, guid: a6c731de80e9d824d8f657301a357269, type: 3} +--- !u!1 &534968531 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 534968532} + - component: {fileID: 534968533} + m_Layer: 0 + m_Name: DamageText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &534968532 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 534968531} + 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: + - {fileID: 31248797} + m_Father: {fileID: 119167776} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &534968533 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 534968531} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 366eb88b821a4048891b7fb01a1b8d42, type: 3} + m_Name: + m_EditorClassIdentifier: + _instancePoolCapacity: 32 + _poolName: DamageTextItem + _instanceRoot: {fileID: 31248797} + _canvas: {fileID: 31248799} + _damageTextItemPrefab: {fileID: 8729657611800212236, guid: 308577c72eb4cd14ca676aeee62b0ea5, + type: 3} --- !u!1 &553656361 GameObject: m_ObjectHideFlags: 0 @@ -976,7 +974,7 @@ MonoBehaviour: m_ScaleFactor: 1 m_ReferenceResolution: {x: 2560, y: 1600} m_ScreenMatchMode: 0 - m_MatchWidthOrHeight: 0 + m_MatchWidthOrHeight: 0.6 m_PhysicalUnit: 3 m_FallbackScreenDPI: 96 m_DefaultSpriteDPI: 96 @@ -1232,7 +1230,6 @@ Transform: m_Children: - {fileID: 343730743} - {fileID: 119167776} - - {fileID: 278770808} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1852670054 diff --git a/Assets/StreamingAssets/.gitkeep b/Assets/StreamingAssets/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/ProjectSettings/BurstAotSettings_StandaloneWindows.json b/ProjectSettings/BurstAotSettings_StandaloneWindows.json index 2144f6d..34712b4 100644 --- a/ProjectSettings/BurstAotSettings_StandaloneWindows.json +++ b/ProjectSettings/BurstAotSettings_StandaloneWindows.json @@ -1,16 +1,18 @@ { "MonoBehaviour": { - "Version": 3, + "Version": 5, "EnableBurstCompilation": true, "EnableOptimisations": true, "EnableSafetyChecks": false, "EnableDebugInAllBuilds": false, - "UsePlatformSDKLinker": false, + "DebugDataKind": 0, + "EnableArmv9SecurityFeatures": false, "CpuMinTargetX32": 0, "CpuMaxTargetX32": 0, "CpuMinTargetX64": 0, "CpuMaxTargetX64": 0, "CpuTargetsX32": 6, - "CpuTargetsX64": 72 + "CpuTargetsX64": 72, + "OptimizeFor": 0 } } diff --git a/ProjectSettings/CommonBurstAotSettings.json b/ProjectSettings/CommonBurstAotSettings.json index 3dffdba..a6a6297 100644 --- a/ProjectSettings/CommonBurstAotSettings.json +++ b/ProjectSettings/CommonBurstAotSettings.json @@ -1,6 +1,6 @@ { "MonoBehaviour": { - "Version": 3, + "Version": 5, "DisabledWarnings": "" } } diff --git a/ProjectSettings/GraphicsSettings.asset b/ProjectSettings/GraphicsSettings.asset index 56859a2..d0b1054 100644 --- a/ProjectSettings/GraphicsSettings.asset +++ b/ProjectSettings/GraphicsSettings.asset @@ -3,7 +3,7 @@ --- !u!30 &1 GraphicsSettings: m_ObjectHideFlags: 0 - serializedVersion: 14 + serializedVersion: 15 m_Deferred: m_Mode: 1 m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} @@ -13,9 +13,6 @@ GraphicsSettings: m_ScreenSpaceShadows: m_Mode: 1 m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} - m_LegacyDeferred: - m_Mode: 1 - m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} m_DepthNormals: m_Mode: 1 m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} @@ -37,11 +34,15 @@ GraphicsSettings: - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 10783, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 4800000, guid: 68e6db2ebdc24f95958faec2be5558d6, type: 3} + - {fileID: 4800000, guid: 128e987d567d4e2c824d754223b3f3b0, type: 3} + - {fileID: 4800000, guid: fe393ace9b354375a9cb14cdbbc28be4, type: 3} + - {fileID: 4800000, guid: 1e3b057af24249748ff873be7fafee47, type: 3} m_PreloadedShaders: [] m_PreloadShadersBatchTimeLimit: -1 m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} - m_CustomRenderPipeline: {fileID: 11400000, guid: 7b7fd9122c28c4d15b667c7040e3b3fd, + m_CustomRenderPipeline: {fileID: 11400000, guid: e1260c1148f6143b28bae5ace5e9c5d1, type: 2} m_TransparencySortMode: 0 m_TransparencySortAxis: {x: 0, y: 0, z: 1} @@ -51,6 +52,7 @@ GraphicsSettings: m_LightmapStripping: 0 m_FogStripping: 0 m_InstancingStripping: 0 + m_BrgStripping: 0 m_LightmapKeepPlain: 1 m_LightmapKeepDirCombined: 1 m_LightmapKeepDynamicPlain: 1 @@ -68,3 +70,6 @@ GraphicsSettings: m_SRPDefaultSettings: UnityEngine.Rendering.Universal.UniversalRenderPipeline: {fileID: 11400000, guid: 18dc0cd2c080841dea60987a38ce93fa, type: 2} + m_LightProbeOutsideHullStrategy: 0 + m_CameraRelativeLightCulling: 0 + m_CameraRelativeShadowCulling: 0 diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 403c004..30ac6af 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -13,7 +13,7 @@ PlayerSettings: useOnDemandResources: 0 accelerometerFrequency: 60 companyName: DefaultCompany - productName: StarForce1 + productName: VampileLike defaultCursor: {fileID: 0} cursorHotspot: {x: 0, y: 0} m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} @@ -526,7 +526,7 @@ PlayerSettings: m_APIs: 10000000 m_Automatic: 1 - m_BuildTarget: AndroidPlayer - m_APIs: 150000000b000000 + m_APIs: 0b000000 m_Automatic: 0 m_BuildTargetVRSettings: [] m_DefaultShaderChunkSizeInMB: 16 @@ -935,7 +935,7 @@ PlayerSettings: hmiLogStartupTiming: 0 hmiCpuConfiguration: apiCompatibilityLevel: 6 - activeInputHandler: 2 + activeInputHandler: 1 windowsGamepadBackendHint: 0 cloudProjectId: framebufferDepthMemorylessMode: 0 diff --git a/TodoList.md b/TodoList.md index 59dbc7f..0c8ae14 100644 --- a/TodoList.md +++ b/TodoList.md @@ -114,6 +114,6 @@ ## 8. 交付物清单(每阶段都要有) - [ ] 设计文档(接口、数据结构、生命周期)。 -- [ ] Profiling 对比(改造前后同场景同参数)。 - [ ] 回归用例(至少战斗、关卡切换、商店、升级)。 +- [ ] Profiling 对比(改造前后同场景同参数)。 - [ ] 风险与回滚说明(特别是热更新与渲染链路)。 diff --git a/数据表/Enemy.txt b/数据表/Enemy.txt deleted file mode 100644 index 7ca14d2..0000000 --- a/数据表/Enemy.txt +++ /dev/null @@ -1,5 +0,0 @@ -# 敌人基础属性表 -# Id MaxHealth Speed CoinDrop ExpDrop DropPercent -# int int float int int float -# 实体编号 策划备注 最大生命 移动速度 金币掉落 经验掉落 掉落概率 - 101 近战敌人 20 3 2 1 0.3 diff --git a/数据表/Enemy.xlsx b/数据表/Enemy.xlsx index 0ed36d5..4c34885 100644 Binary files a/数据表/Enemy.xlsx and b/数据表/Enemy.xlsx differ diff --git a/数据表/Entity.txt b/数据表/Entity.txt deleted file mode 100644 index 499034d..0000000 --- a/数据表/Entity.txt +++ /dev/null @@ -1,11 +0,0 @@ -# 实体表 -# Id AssetName -# int string -# 实体编号 策划备注 资源名称 - 1001 测试玩家 Player - 101 近战敌人 MeleeEnemy - 102 远程敌人 RemoteEnemy - 11 跟随相机 FollowCamera - 201 武器小刀 WeaponKnife - 10001 金币实体 CoinEntity - 10002 经验实体 ExpEntity diff --git a/数据表/Goods.txt b/数据表/Goods.txt deleted file mode 100644 index 3d5237b..0000000 --- a/数据表/Goods.txt +++ /dev/null @@ -1,9 +0,0 @@ -# 商品表 -# Id GoodsType GoodsTypeId -# int GoodsType int -# 商品编号 策划备注 商品类型 商品对应物品Id - 101 道具:药 Prop 101 - 102 小刀 Weapon 201 - 103 Prop 102 - 104 Prop 103 - 105 Prop 104 diff --git a/数据表/Level.txt b/数据表/Level.txt deleted file mode 100644 index 914673d..0000000 --- a/数据表/Level.txt +++ /dev/null @@ -1,14 +0,0 @@ -# 关卡配置表 -# Id EntityIds EntityCounts Interval Duration -# int int[] int[] float[] int -# 关卡号 策划备注 实体编号 每次出怪数量 每次出怪间隔 关卡时间 - 1 第一关 [101] [5] [2] 60 - 2 第二关 [101] [10] [3] 60 - 3 第三关 [101] [10] [3] 60 - 4 第四关 [101] [10] [3] 60 - 5 第五关 [101] [10] [3] 60 - 6 第六关 [101] [10] [3] 60 - 7 第七关 [101] [10] [3] 60 - 8 第八关 [101] [10] [3] 60 - 9 第九关 [101] [10] [3] 60 - 10 第十关 [101] [10] [3] 60 diff --git a/数据表/LevelRarity.xlsx b/数据表/LevelRarity.xlsx new file mode 100644 index 0000000..85eaea7 Binary files /dev/null and b/数据表/LevelRarity.xlsx differ diff --git a/数据表/LevelUpReward.txt b/数据表/LevelUpReward.txt deleted file mode 100644 index b2eb50e..0000000 --- a/数据表/LevelUpReward.txt +++ /dev/null @@ -1,8 +0,0 @@ -# 道具表 -# Id Title IconAssetName Modifiers -# int string string StatModifier[] -# 奖励编号 策划备注 奖励名 图标资源名 道具属性 - 101 测试道具 肌肉 Almighty_Icon [{"StatType":"Attack","Value":0.05,"IsPercent":true}] - 102 牙齿 Almighty_Icon [{"StatType":"Attack","Value":0.05,"IsPercent":true}] - 103 脑 Almighty_Icon [{"StatType":"Attack","Value":0.05,"IsPercent":true}] - 104 鼻子 Almighty_Icon [{"StatType":"Attack","Value":0.05,"IsPercent":true}] diff --git a/数据表/LevelUpReward.xlsx b/数据表/LevelUpReward.xlsx index ffa763d..4875cd7 100644 Binary files a/数据表/LevelUpReward.xlsx and b/数据表/LevelUpReward.xlsx differ diff --git a/数据表/Music.txt b/数据表/Music.txt deleted file mode 100644 index c94009f..0000000 --- a/数据表/Music.txt +++ /dev/null @@ -1,7 +0,0 @@ -# 音乐配置表 -# Id AssetName -# int string -# 音乐编号 策划备注 资源名称 - 1 菜单音乐 music_menu - 2 战斗音乐 music_background - 3 关于音乐 music_about diff --git a/数据表/Prop.txt b/数据表/Prop.txt deleted file mode 100644 index 028dce3..0000000 --- a/数据表/Prop.txt +++ /dev/null @@ -1,24 +0,0 @@ -# 道具表 -# Id Title IconAssetName Rarity Price PriceRandomPercent Modifiers -# int string string RarityType int float StatModifier[] -# 道具编号 策划备注 道具名 图标资源名 道具品质 道具价格 价格浮动 道具属性 - 101 道具_1 Almighty_Icon White 119 0.0500000007450581 [{"StatType":"Attack","Value":10,"IsPercent":false},{"StatType":"Defense","Value":12,"IsPercent":false}] - 102 道具_2 Almighty_Icon Green 225 0.0799999982118607 [{"StatType":"MaxHealth","Value":53,"IsPercent":false},{"StatType":"AttackSpeed","Value":0.09,"IsPercent":true},{"StatType":"Attack","Value":11,"IsPercent":false}] - 103 道具_3 Almighty_Icon Blue 329 0.100000001490116 [{"StatType":"Critical","Value":15,"IsPercent":false},{"StatType":"CriticalDamage","Value":21,"IsPercent":false},{"StatType":"Defense","Value":23,"IsPercent":false}] - 104 道具_4 Almighty_Icon Red 423 0.119999997317791 [{"StatType":"Defense","Value":79,"IsPercent":false}] - 105 道具_5 Almighty_Icon White 120 0.0500000007450581 [{"StatType":"MovementSpeed","Value":0.8,"IsPercent":false},{"StatType":"Attack","Value":10,"IsPercent":false}] - 106 道具_6 Almighty_Icon Green 195 0.0799999982118607 [{"StatType":"Dodge","Value":10,"IsPercent":false},{"StatType":"Attack","Value":12,"IsPercent":false},{"StatType":"MaxHealth","Value":44,"IsPercent":false}] - 107 道具_7 Almighty_Icon Blue 335 0.100000001490116 [{"StatType":"Defense","Value":62,"IsPercent":false}] - 108 道具_8 Almighty_Icon Red 433 0.119999997317791 [{"StatType":"Attack","Value":44,"IsPercent":false},{"StatType":"Dodge","Value":27,"IsPercent":false}] - 109 道具_9 Almighty_Icon White 121 0.0500000007450581 [{"StatType":"MaxHealth","Value":32,"IsPercent":false},{"StatType":"Attack","Value":7,"IsPercent":false},{"StatType":"Defense","Value":8,"IsPercent":false}] - 110 道具_10 Almighty_Icon Green 198 0.0799999982118607 [{"StatType":"AttackSpeed","Value":0.19,"IsPercent":true}] - 111 道具_11 Almighty_Icon Blue 341 0.100000001490116 [{"StatType":"Attack","Value":57,"IsPercent":false}] - 112 道具_12 Almighty_Icon Red 443 0.119999997317791 [{"StatType":"MaxHealth","Value":139,"IsPercent":false},{"StatType":"Critical","Value":27,"IsPercent":false}] - 113 道具_13 Almighty_Icon White 122 0.0500000007450581 [{"StatType":"Critical","Value":5,"IsPercent":false},{"StatType":"Dodge","Value":7,"IsPercent":false},{"StatType":"MovementSpeed","Value":0.6,"IsPercent":false}] - 114 道具_14 Almighty_Icon Green 201 0.0799999982118607 [{"StatType":"Defense","Value":38,"IsPercent":false}] - 115 道具_15 Almighty_Icon Blue 346 0.100000001490116 [{"StatType":"MovementSpeed","Value":1.6,"IsPercent":false},{"StatType":"Defense","Value":32,"IsPercent":false}] - 116 道具_16 Almighty_Icon Red 454 0.119999997317791 [{"StatType":"Dodge","Value":28,"IsPercent":false},{"StatType":"Defense","Value":24,"IsPercent":false},{"StatType":"Attack","Value":24,"IsPercent":false}] - 117 道具_17 Almighty_Icon White 124 0.0500000007450581 [{"StatType":"Defense","Value":23,"IsPercent":false}] - 118 道具_18 Almighty_Icon Green 204 0.0799999982118607 [{"StatType":"Attack","Value":17,"IsPercent":false},{"StatType":"MaxHealth","Value":69,"IsPercent":false}] - 119 道具_19 Almighty_Icon Blue 352 0.100000001490116 [{"StatType":"MaxHealth","Value":74,"IsPercent":false},{"StatType":"Attack","Value":19,"IsPercent":false},{"StatType":"Dodge","Value":20,"IsPercent":false}] - 120 道具_20 Almighty_Icon Red 464 0.119999997317791 [{"StatType":"AttackSpeed","Value":0.15,"IsPercent":true},{"StatType":"Attack","Value":29,"IsPercent":false},{"StatType":"Defense","Value":27,"IsPercent":false}] diff --git a/数据表/Role.txt b/数据表/Role.txt deleted file mode 100644 index beceb9a..0000000 --- a/数据表/Role.txt +++ /dev/null @@ -1,6 +0,0 @@ -# 角色表 ROUND(100*(1.1^L3),0) -# Id RoleName IconAssetName MaxHp Speed Coin WeaponCapacity InitialProperty InitialItem Lv0 Lv1 Lv2 Lv3 Lv4 Lv5 Lv6 Lv7 Lv8 Lv9 Lv10 Lv11 Lv12 Lv13 Lv14 Lv15 Lv16 Lv17 Lv18 Lv19 Lv20 Lv21 Lv22 Lv23 Lv24 Lv25 Lv26 Lv27 Lv28 Lv29 Lv30 Lv31 Lv32 Lv33 Lv34 Lv35 Lv36 Lv37 Lv38 Lv39 Lv40 Lv41 Lv42 Lv43 Lv44 Lv45 Lv46 Lv47 Lv48 Lv49 Lv50 Lv51 Lv52 Lv53 Lv54 Lv55 Lv56 Lv57 Lv58 Lv59 Lv60 -# int string string int float int int Modifier[] Item[] 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 -# 角色编号 策划备注 角色名称 图标资源名 初始最大生命 初始速度 初始金币 最大持有武器数 初始额外属性 初始额外物品 每级升级所需经验 - 101 全能者 全能者 Almighty_Icon 100 6 10 6 [{"StatType":"MovementSpeed","Value":0.5,"IsPercent":false},{"StatType":"MaxHealth","Value":0.2,"IsPercent":true}] [] 100 110 121 133 146 161 177 195 214 236 259 285 314 345 380 418 459 505 556 612 673 740 814 895 985 1083 1192 1311 1442 1586 1745 1919 2111 2323 2555 2810 3091 3400 3740 4114 4526 4979 5476 6024 6626 7289 8018 8820 9702 10672 11739 12913 14204 15625 17187 18906 20797 22876 25164 27680 30448 - 102 老人 老人 Old_Man_Icon 200 4 5 6 [] [] 100 112 125 140 157 176 197 221 248 277 311 348 390 436 489 547 613 687 769 861 965 1080 1210 1355 1518 1700 1904 2132 2388 2675 2996 3356 3758 4209 4714 5280 5914 6623 7418 8308 9305 10422 11672 13073 14642 16399 18367 20571 23039 25804 28900 32368 36252 40603 45475 50932 57044 63889 71556 80143 89760 diff --git a/数据表/Scene.txt b/数据表/Scene.txt deleted file mode 100644 index aac4294..0000000 --- a/数据表/Scene.txt +++ /dev/null @@ -1,8 +0,0 @@ -# 场景配置表 -# Id AssetName BackgroundMusicId -# int string int -# 场景编号 备注 资源名称 背景音乐编号 - 1 菜单场景 Menu 1 - 2 战斗场景 Main 2 - 3 压力测试场景 StressTest 0 - 4 游戏主场景 Game 0 diff --git a/数据表/Sound.txt b/数据表/Sound.txt deleted file mode 100644 index 0d22e6d..0000000 --- a/数据表/Sound.txt +++ /dev/null @@ -1,9 +0,0 @@ -# 声音配置表 -# Id AssetName Priority Loop Volume SpatialBlend MaxDistance -# int string int bool float float float -# 声音编号 策划备注 资源名称 优先级(默认0,128最高,-128最低) 是否循环 音量(0~1) 声音空间混合量(0为2D,1为3D,中间值混合效果) 声音最大距离 - 10000 玩家子弹 weapon_player 0 False 1 0 100 - 10001 敌人子弹 weapon_enemy 0 False 1 0 100 - 20000 玩家爆炸 explosion_player 0 False 1 0 100 - 20001 敌人爆炸 explosion_enemy 0 False 1 0 100 - 20002 小行星爆炸 explosion_asteroid 0 False 1 0 100 diff --git a/数据表/UIForm.txt b/数据表/UIForm.txt deleted file mode 100644 index fb145ef..0000000 --- a/数据表/UIForm.txt +++ /dev/null @@ -1,14 +0,0 @@ -# 界面配置表 -# Id AssetName UIGroupName AllowMultiInstance PauseCoveredUIForm -# int string string bool bool -# 界面编号 策划备注 资源名称 界面组名称 是否允许多个界面实例 是否暂停被其覆盖的界面 - 1 弹出框 DialogForm Default True True - 100 主菜单 MenuForm Default False True - 101 设置 SettingForm Default False True - 102 关于 AboutForm Default False True - 200 开始菜单 StartMenuForm Default False True - 201 角色选择页 SelectRoleForm Default False True - 202 游戏商店页 ShopForm Default False True - 203 游戏HUD HudForm HUD False True - 204 角色升级奖励页 LevelUpForm Default False True - 205 物品信息展示 DisplayItemInfoForm Default False False diff --git a/数据表/UISound.txt b/数据表/UISound.txt deleted file mode 100644 index 87e1cd2..0000000 --- a/数据表/UISound.txt +++ /dev/null @@ -1,6 +0,0 @@ -# 声音配置表 -# Id AssetName Priority Volume -# int string int float -# 声音编号 策划备注 资源名称 优先级(默认0,128最高,-128最低) 音量(0~1) - 10000 选择音效 select 0 1 - 10001 点击音效 click 0 1 diff --git a/数据表/Weapon.txt b/数据表/Weapon.txt deleted file mode 100644 index 8e6d608..0000000 --- a/数据表/Weapon.txt +++ /dev/null @@ -1,6 +0,0 @@ -# 武器表 -# Id Title IconAssetName Rarity Price PriceRandomPercent Attack Cooldown AttackRange AttackSoundId Pramas Modifiers -# int string string RarityType int float int float float int string[] StatModifier[] -# 武器编号 策划备注 武器名 图标资源名 道具品质 武器价格 价格浮动 伤害 冷却 范围 攻击音效编号 额外参数 额外属性 - 201 玩家武器 小刀 Almighty_Icon White 120 0.05 100 1.5 3 10000 [] [] - 202 手枪 Almighty_Icon White 130 0.05 120 1 10 10000 [] [] diff --git a/数据表/Weapon.xlsx b/数据表/Weapon.xlsx index d49019c..ad34dd4 100644 Binary files a/数据表/Weapon.xlsx and b/数据表/Weapon.xlsx differ diff --git a/数据表/convert.py b/数据表/convert.py index 36ef9a8..bc22421 100644 --- a/数据表/convert.py +++ b/数据表/convert.py @@ -1,6 +1,5 @@ import pandas as pd import os -import shutil import csv def convert_excel_to_txt(folder_path='.'): @@ -21,8 +20,8 @@ def convert_excel_to_txt(folder_path='.'): continue if file_name.endswith(('.xlsx', '.xls')): file_path = os.path.join(scan_dir, file_name) - base_name = os.path.splitext(file_path)[0] - output_file = base_name.replace(os.path.basename(base_name), os.path.basename(base_name)) + '.txt' + base_name = os.path.splitext(file_name)[0] + output_file = os.path.join(target_dir, f"{base_name}.txt") print(f"正在处理: {file_name}...") @@ -47,12 +46,7 @@ def convert_excel_to_txt(folder_path='.'): escapechar='\\' ) - # 复制文件到目标目录 - target_file = os.path.join(target_dir, os.path.basename(output_file)) - shutil.copy2(output_file, target_file) - print(f"成功转换 -> {output_file}") - print(f"已复制到 -> {target_file}") count += 1 except Exception as e: