Browse Source

修复season和产出

master
star\zhenghan 3 years ago
parent
commit
7576a5bc5f
  1. 2
      Config/InitialResourceConfigCategory.bytes
  2. 2
      Config/Resource/InitResource.json
  3. BIN
      Excel/InitialResourceConfig.xlsx
  4. 2
      Excel/Json/c/InitialResourceConfig.txt
  5. 2
      Excel/Json/s/InitialResourceConfig.txt
  6. 11
      Unity/Animancer.FSM.csproj
  7. 11
      Unity/Animancer.csproj
  8. 8
      Unity/Assets/Bundles/Building/Build_Base.prefab
  9. 2
      Unity/Assets/Bundles/Config/InitialResourceConfigCategory.bytes
  10. 18
      Unity/Assets/Bundles/People/People_1001.prefab
  11. 2
      Unity/Assets/Bundles/Resource/Resource_Base.prefab
  12. 46
      Unity/Assets/Res/Mat/2DLight.mat
  13. 8
      Unity/Assets/Res/Mat/2DLight.mat.meta
  14. 56
      Unity/Assets/Res/Mat/GameObject.mat
  15. 8
      Unity/Assets/Res/Mat/GameObject.mat.meta
  16. 56
      Unity/Assets/Res/Mat/GameObjectLit.mat
  17. 8
      Unity/Assets/Res/Mat/GameObjectLit.mat.meta
  18. 141
      Unity/Assets/Res/Shader/GameObject.shader
  19. 10
      Unity/Assets/Res/Shader/GameObject.shader.meta
  20. 334
      Unity/Assets/Res/Shader/GameObjectLit.shader
  21. 10
      Unity/Assets/Res/Shader/GameObjectLit.shader.meta
  22. 115
      Unity/Assets/Scenes/Game.unity
  23. 405
      Unity/Assets/Scenes/Test1.unity
  24. 41
      Unity/Assets/Scripts/Test/TestBounds.cs
  25. 4
      Unity/Codes/Hotfix/Demo/Resource/ResourcePointComponentSystem.cs
  26. 2
      Unity/Codes/Hotfix/Demo/Unit/UnitHelper.cs
  27. 33
      Unity/Codes/HotfixView/Demo/Building/BuildingViewComponentSystem.cs
  28. 2
      Unity/Codes/HotfixView/Demo/FUI/Logic/Building/FUIBuildingSelectWorkerWindowComponentSystem.cs
  29. 15
      Unity/Codes/HotfixView/Demo/FUI/Logic/Building/FUIFarmlandWindowComponentSystem.cs
  30. 30
      Unity/Codes/HotfixView/Demo/FUI/Logic/Main/FUIMainComponentSystem.cs
  31. 3
      Unity/Codes/HotfixView/Demo/FUI/Logic/People/FUILineupWindowComponentSystem.cs
  32. 3
      Unity/Codes/HotfixView/Demo/FUI/Logic/People/FUIPartnerListWindowComponentSystem.cs
  33. 3
      Unity/Codes/HotfixView/Demo/FUI/Logic/People/FUIPeopleListWindowComponentSystem.cs
  34. 16
      Unity/Codes/HotfixView/Demo/FUI/Logic/Resource/FUIResourceWindowComponentSystem.cs
  35. 4
      Unity/Codes/HotfixView/Demo/FUI/Logic/Resource/FUISelectWorkerWindowComponentSystem.cs
  36. 5
      Unity/Codes/ModelView/Demo/Building/BuildingViewComponent.cs
  37. 21
      Unity/Codes/ModelView/Demo/FUI/Logic/Building/FUIFarmlandWindow.cs
  38. 21
      Unity/Codes/ModelView/Demo/Util/MaterialHelper.cs
  39. 44
      Unity/Codes/ModelView/Demo/Util/SingletonBase.cs
  40. 5
      Unity/UserSettings/EditorUserSettings.asset

2
Config/InitialResourceConfigCategory.bytes

@ -1,2 +1,2 @@
dd d(d0d8d@éH
!dd d(d0d8d@@@@@@@H

2
Config/Resource/InitResource.json

@ -1 +1 @@
{"_t":"MainSceneInitResource","InitResourceItems":[{"_t":"InitResourceItem","ConfigId":1001,"PosX":-13,"PosY":4.5,"MonsterGroupConfigId":0,"RefreshType":1,"RefreshParameter":0},{"_t":"InitResourceItem","ConfigId":1002,"PosX":-17,"PosY":1.5,"MonsterGroupConfigId":0,"RefreshType":1,"RefreshParameter":0},{"_t":"InitResourceItem","ConfigId":2001,"PosX":18,"PosY":3,"MonsterGroupConfigId":0,"RefreshType":1,"RefreshParameter":0},{"_t":"InitResourceItem","ConfigId":2003,"PosX":6,"PosY":3,"MonsterGroupConfigId":1,"RefreshType":1,"RefreshParameter":0},{"_t":"InitResourceItem","ConfigId":2002,"PosX":-6,"PosY":0,"MonsterGroupConfigId":1,"RefreshType":1,"RefreshParameter":0},{"_t":"InitResourceItem","ConfigId":2004,"PosX":-1.5,"PosY":7.75,"MonsterGroupConfigId":0,"RefreshType":1,"RefreshParameter":0},{"_t":"InitResourceItem","ConfigId":2005,"PosX":6,"PosY":7.5,"MonsterGroupConfigId":1,"RefreshType":1,"RefreshParameter":0},{"_t":"InitResourceItem","ConfigId":2002,"PosX":-9,"PosY":-4.5,"MonsterGroupConfigId":1,"RefreshType":1,"RefreshParameter":0},{"_t":"InitResourceItem","ConfigId":2001,"PosX":10.5,"PosY":5.75,"MonsterGroupConfigId":0,"RefreshType":1,"RefreshParameter":0},{"_t":"InitResourceItem","ConfigId":2001,"PosX":6.5,"PosY":10.25,"MonsterGroupConfigId":1,"RefreshType":1,"RefreshParameter":0},{"_t":"InitResourceItem","ConfigId":2006,"PosX":12.5,"PosY":1.25,"MonsterGroupConfigId":1,"RefreshType":0,"RefreshParameter":0}]}
{"_t":"MainSceneInitResource","InitResourceItems":[{"_t":"InitResourceItem","ConfigId":1001,"PosX":-13,"PosY":4.5,"MonsterGroupConfigId":0,"RefreshType":1,"RefreshParameter":0},{"_t":"InitResourceItem","ConfigId":1002,"PosX":-17,"PosY":1.5,"MonsterGroupConfigId":0,"RefreshType":1,"RefreshParameter":0},{"_t":"InitResourceItem","ConfigId":2001,"PosX":18,"PosY":3,"MonsterGroupConfigId":0,"RefreshType":1,"RefreshParameter":0},{"_t":"InitResourceItem","ConfigId":2002,"PosX":-6,"PosY":0,"MonsterGroupConfigId":1,"RefreshType":1,"RefreshParameter":0},{"_t":"InitResourceItem","ConfigId":2002,"PosX":-9,"PosY":-4.5,"MonsterGroupConfigId":1,"RefreshType":1,"RefreshParameter":0},{"_t":"InitResourceItem","ConfigId":2001,"PosX":10.5,"PosY":5.75,"MonsterGroupConfigId":0,"RefreshType":1,"RefreshParameter":0},{"_t":"InitResourceItem","ConfigId":2001,"PosX":6.5,"PosY":10.25,"MonsterGroupConfigId":1,"RefreshType":1,"RefreshParameter":0}]}

BIN
Excel/InitialResourceConfig.xlsx

Binary file not shown.

2
Excel/Json/c/InitialResourceConfig.txt

@ -1,3 +1,3 @@
{"list":[
{"_t":"InitialResourceConfig","_id":1,"Food":100,"Water":100,"Wood":100,"Stone":100,"SilverTael":100,"GoldIngot":100,"Villagers":[1001,1002],"StartSeason":1,"StartTime":600},
{"_t":"InitialResourceConfig","_id":1,"Food":100,"Water":100,"Wood":100,"Stone":100,"SilverTael":100,"GoldIngot":100,"Villagers":[1,2,3,4,5,6,7],"StartSeason":1,"StartTime":600},
]}

2
Excel/Json/s/InitialResourceConfig.txt

@ -1,3 +1,3 @@
{"list":[
{"_t":"InitialResourceConfig","_id":1,"Food":100,"Water":100,"Wood":100,"Stone":100,"SilverTael":100,"GoldIngot":100,"Villagers":[1001,1002],"StartSeason":1,"StartTime":600},
{"_t":"InitialResourceConfig","_id":1,"Food":100,"Water":100,"Wood":100,"Stone":100,"SilverTael":100,"GoldIngot":100,"Villagers":[1,2,3,4,5,6,7],"StartSeason":1,"StartTime":600},
]}

11
Unity/Animancer.FSM.csproj

@ -53,7 +53,7 @@
<UnityVersion>2021.3.7f1c1</UnityVersion>
</PropertyGroup>
<ItemGroup>
<Analyzer Include="C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Extensions\Microsoft\Visual Studio Tools for Unity\Analyzers\Microsoft.Unity.Analyzers.dll" />
<Analyzer Include="D:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Extensions\Microsoft\Visual Studio Tools for Unity\Analyzers\Microsoft.Unity.Analyzers.dll" />
</ItemGroup>
<ItemGroup>
<Compile Include="Assets\ThirdParty\Animancer\Utilities\FSM\StateMachine1.StateSelector.cs" />
@ -310,6 +310,9 @@
<Reference Include="UnityEditor.Graphs">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\Managed\UnityEditor.Graphs.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.Android.Extensions">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\UnityEditor.Android.Extensions.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.WindowsStandalone.Extensions">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\WindowsStandaloneSupport\UnityEditor.WindowsStandalone.Extensions.dll</HintPath>
</Reference>
@ -346,6 +349,12 @@
<Reference Include="NCalc">
<HintPath>Assets\ThirdParty\NCalc\NCalc.dll</HintPath>
</Reference>
<Reference Include="Unity.Android.Types">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\Unity.Android.Types.dll</HintPath>
</Reference>
<Reference Include="Unity.Android.Gradle">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\Unity.Android.Gradle.dll</HintPath>
</Reference>
<Reference Include="mscorlib">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\UnityReferenceAssemblies\unity-4.8-api\mscorlib.dll</HintPath>
</Reference>

11
Unity/Animancer.csproj

@ -53,7 +53,7 @@
<UnityVersion>2021.3.7f1c1</UnityVersion>
</PropertyGroup>
<ItemGroup>
<Analyzer Include="C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Extensions\Microsoft\Visual Studio Tools for Unity\Analyzers\Microsoft.Unity.Analyzers.dll" />
<Analyzer Include="D:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Extensions\Microsoft\Visual Studio Tools for Unity\Analyzers\Microsoft.Unity.Analyzers.dll" />
</ItemGroup>
<ItemGroup>
<Compile Include="Assets\ThirdParty\Animancer\Internal\Editor\Transition Preview Window\TransitionPreviewWindow.Animations.cs" />
@ -447,6 +447,9 @@
<Reference Include="UnityEditor.Graphs">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\Managed\UnityEditor.Graphs.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.Android.Extensions">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\UnityEditor.Android.Extensions.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.WindowsStandalone.Extensions">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\WindowsStandaloneSupport\UnityEditor.WindowsStandalone.Extensions.dll</HintPath>
</Reference>
@ -483,6 +486,12 @@
<Reference Include="NCalc">
<HintPath>Assets\ThirdParty\NCalc\NCalc.dll</HintPath>
</Reference>
<Reference Include="Unity.Android.Types">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\Unity.Android.Types.dll</HintPath>
</Reference>
<Reference Include="Unity.Android.Gradle">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\Unity.Android.Gradle.dll</HintPath>
</Reference>
<Reference Include="mscorlib">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.7f1c1\Editor\Data\UnityReferenceAssemblies\unity-4.8-api\mscorlib.dll</HintPath>
</Reference>

8
Unity/Assets/Bundles/Building/Build_Base.prefab

@ -229,7 +229,7 @@ SpriteRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 2100000, guid: 760052f9f92321d44839e8d3342dac3c, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -250,15 +250,15 @@ SpriteRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 308a7bc7ea72ca849ae481ffd63b145d, type: 3}
m_Sprite: {fileID: 21300000, guid: 79c0c426ddec15a4ca0d0ced268e977c, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_Size: {x: 10.24, y: 10.24}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 1
--- !u!114 &4180406061585001571

2
Unity/Assets/Bundles/Config/InitialResourceConfigCategory.bytes

@ -1,2 +1,2 @@
dd d(d0d8d@éH
!dd d(d0d8d@@@@@@@H

18
Unity/Assets/Bundles/People/People_1001.prefab

@ -1016,32 +1016,32 @@ PrefabInstance:
type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
objectReference: {fileID: 2100000, guid: 760052f9f92321d44839e8d3342dac3c, type: 2}
- target: {fileID: 2241700298441535984, guid: 413bb15c31e26f947b838996fe528d53,
type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
objectReference: {fileID: 2100000, guid: 760052f9f92321d44839e8d3342dac3c, type: 2}
- target: {fileID: 2241700298441535986, guid: 413bb15c31e26f947b838996fe528d53,
type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
objectReference: {fileID: 2100000, guid: 760052f9f92321d44839e8d3342dac3c, type: 2}
- target: {fileID: 2241700298441535988, guid: 413bb15c31e26f947b838996fe528d53,
type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
objectReference: {fileID: 2100000, guid: 760052f9f92321d44839e8d3342dac3c, type: 2}
- target: {fileID: 2241700298441535990, guid: 413bb15c31e26f947b838996fe528d53,
type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
objectReference: {fileID: 2100000, guid: 760052f9f92321d44839e8d3342dac3c, type: 2}
- target: {fileID: 2241700298441535992, guid: 413bb15c31e26f947b838996fe528d53,
type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
objectReference: {fileID: 2100000, guid: 760052f9f92321d44839e8d3342dac3c, type: 2}
- target: {fileID: 2241700298441535994, guid: 413bb15c31e26f947b838996fe528d53,
type: 3}
propertyPath: m_FlipX
@ -1051,17 +1051,17 @@ PrefabInstance:
type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
objectReference: {fileID: 2100000, guid: 760052f9f92321d44839e8d3342dac3c, type: 2}
- target: {fileID: 2241700298441535996, guid: 413bb15c31e26f947b838996fe528d53,
type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
objectReference: {fileID: 2100000, guid: 760052f9f92321d44839e8d3342dac3c, type: 2}
- target: {fileID: 2241700298441535998, guid: 413bb15c31e26f947b838996fe528d53,
type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
objectReference: {fileID: 2100000, guid: 760052f9f92321d44839e8d3342dac3c, type: 2}
- target: {fileID: 2399695433351747915, guid: 413bb15c31e26f947b838996fe528d53,
type: 3}
propertyPath: m_Bounds.m_Center.x

2
Unity/Assets/Bundles/Resource/Resource_Base.prefab

@ -144,7 +144,7 @@ SpriteRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 2100000, guid: 760052f9f92321d44839e8d3342dac3c, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0

46
Unity/Assets/Res/Mat/2DLight.mat

@ -0,0 +1,46 @@
%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: 2DLight
m_Shader: {fileID: 4800000, guid: e260cfa7296ee7642b167f1eb5be5023, type: 3}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _AlphaTex:
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}
- _MaskTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _EnableExternalAlpha: 0
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Flip: {r: 1, g: 1, b: 1, a: 1}
- _RendererColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []

8
Unity/Assets/Res/Mat/2DLight.mat.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 374868c26a9f55b4397a7e73227f54f3
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

56
Unity/Assets/Res/Mat/GameObject.mat

@ -0,0 +1,56 @@
%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: GameObject
m_Shader: {fileID: 4800000, guid: ead99fbd6ac1a744a84dc3d90b426628, type: 3}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _AlphaTex:
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}
- _MaskTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _DetectAlpha: 0.1
- _EFFECT_EDGE: 0
- _EFFECT_HIGHLIGHT: 0
- _EFFECT_HiGHLIGHT: 0
- _EnableExternalAlpha: 0
- _HaveEdgeEffect: 1
- _ImageCullAlpha: 0.2
- _PixelSize: 5.46
- _Smooth: 5.92
- _SmoothAlphaBase: 0.678
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Flip: {r: 1, g: 1, b: 1, a: 1}
- _OutLineColor: {r: 1, g: 0.21058662, b: 0, a: 1}
- _RendererColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []

8
Unity/Assets/Res/Mat/GameObject.mat.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 802e1eafac60ee044aed8fc50fe0e7b1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

56
Unity/Assets/Res/Mat/GameObjectLit.mat

@ -0,0 +1,56 @@
%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: GameObjectLit
m_Shader: {fileID: 4800000, guid: 844b1f34770e3fe4aa7afbe4c622a6d0, type: 3}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _AlphaTex:
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}
- _MaskTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _DetectAlpha: 0.2
- _EFFECT_EDGE: 0
- _EFFECT_HIGHLIGHT: 0
- _EFFECT_HiGHLIGHT: 0
- _EnableExternalAlpha: 0
- _HaveEdgeEffect: 1
- _ImageCullAlpha: 0.718
- _PixelSize: 6
- _Smooth: 5.92
- _SmoothAlphaBase: 0.678
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Flip: {r: 1, g: 1, b: 1, a: 1}
- _OutLineColor: {r: 1, g: 0.21058662, b: 0, a: 1}
- _RendererColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []

8
Unity/Assets/Res/Mat/GameObjectLit.mat.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 760052f9f92321d44839e8d3342dac3c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

141
Unity/Assets/Res/Shader/GameObject.shader

@ -0,0 +1,141 @@
Shader "PeachValley/GameObject"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
[PerRendererData] _AlphaTex ("External Alpha", 2D) = "white" {}
[PerRendererData] _EnableExternalAlpha ("Enable External Alpha", Float) = 0
[Space]
[Header(Edge)]
[Toggle] _EFFECT_EDGE ("Enable Edge", Float) = 0
_OutLineColor ("Outline color", Color) = (0.804, 0.2, 0, 1)//描边颜色
_PixelSize ("Pixel Size", Range(0, 10)) = 6
_DetectAlpha ("DetectAlpha", Range(0, 0.2)) = 0.1 //四周的点算alpha平均,若大于则显示描边
_ImageCullAlpha ("ImageCullAlpha", Range(0, 1)) = 0.2 //当前所在的点若大于改值,则无条件原图
// _Smooth ("Smooth", Range(1, 10)) = 10
// _SmoothAlphaBase ("SmoothAlphaBase", Range(0, 1)) = 0.8
_HaveEdgeEffect ("HaveEdgeEffect", Range(0, 1)) = 1
[Space]
[Header(Highlight)]
[Toggle] _EFFECT_HIGHLIGHT("Enable Highlight", Float) = 0
}
SubShader
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
"PreviewType"="Plane"
"CanUseSpriteAtlas"="True"
}
Cull Off
Lighting Off
ZWrite Off
Blend One OneMinusSrcAlpha
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 2.0
#pragma multi_compile _ ETC1_EXTERNAL_ALPHA
#pragma multi_compile _EFFECT_EDGE _EFFECT_EDGE_ON
#pragma multi_compile _EFFECT_HIGHLIGHT _EFFECT_HIGHLIGHT_ON
#include "UnityCG.cginc"
struct appdata_t
{
float4 vertex : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
};
struct v2f
{
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
};
fixed4 _Color;
v2f vert(appdata_t IN)
{
v2f OUT;
OUT.vertex = UnityObjectToClipPos(IN.vertex);
OUT.texcoord = IN.texcoord;
OUT.color = IN.color * _Color;
#ifdef PIXELSNAP_ON
OUT.vertex = UnityPixelSnap (OUT.vertex);
#endif
return OUT;
}
sampler2D _MainTex;
sampler2D _AlphaTex;
// for edge
fixed4 _OutLineColor;
float _PixelSize;
float2 _MainTex_TexelSize;
float _DetectAlpha;
float _ImageCullAlpha;
// float _Smooth;
// float _SmoothAlphaBase;
half _HaveEdgeEffect;
void Edge(inout fixed4 outColor, half2 changedUV)
{
_PixelSize = _PixelSize * _MainTex_TexelSize;
// fixed4 color = tex2D(_MainTex, fixed2(changedUV.x, changedUV.y));
fixed color1 = tex2D(_MainTex, fixed2(changedUV.x + _PixelSize, changedUV.y + _PixelSize)).a;
fixed color2 = tex2D(_MainTex, fixed2(changedUV.x - _PixelSize, changedUV.y - _PixelSize)).a;
fixed color3 = tex2D(_MainTex, fixed2(changedUV.x + _PixelSize, changedUV.y - _PixelSize)).a;
fixed color4 = tex2D(_MainTex, fixed2(changedUV.x - _PixelSize, changedUV.y + _PixelSize)).a;
fixed a = (color1 + color2 + color3 + color4) / 4;
int if1 = step(outColor.a, _ImageCullAlpha);
int if2 = step(a, _DetectAlpha);
// outColor = outColor* (1 - _HaveEdgeEffect) + _HaveEdgeEffect *(if1 * (((1 - if2) * fixed4(_OutLineColor.rgb, pow(a + _SmoothAlphaBase, _Smooth) * _OutLineColor.a))) + color * (1 - if1));
outColor = outColor* (1 - _HaveEdgeEffect) + _HaveEdgeEffect *(if1 * (((1 - if2) * _OutLineColor)) + outColor * (1 - if1));
}
fixed4 SampleSpriteTexture (float2 uv)
{
fixed4 color = tex2D (_MainTex, uv);
#if ETC1_EXTERNAL_ALPHA
fixed4 alpha = tex2D (_AlphaTex, uv);
color.a = lerp (color.a, alpha.r, _EnableExternalAlpha);
#endif
return color;
}
fixed4 frag(v2f IN) : SV_Target
{
fixed4 c = SampleSpriteTexture (IN.texcoord) * IN.color;
#if _EFFECT_HIGHLIGHT_ON
c.rgb *= fixed3(1.3, 1.3, 1.3);
#endif
#if _EFFECT_EDGE_ON
Edge(c, IN.texcoord);
#endif
c.rgb *= c.a;
return c;
}
ENDCG
}
}
FallBack "Diffuse"
}

10
Unity/Assets/Res/Shader/GameObject.shader.meta

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: ead99fbd6ac1a744a84dc3d90b426628
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

334
Unity/Assets/Res/Shader/GameObjectLit.shader

@ -0,0 +1,334 @@
Shader "PeachValley/GameObjectLit"
{
Properties
{
_MainTex("Diffuse", 2D) = "white" {}
_MaskTex("Mask", 2D) = "white" {}
_NormalMap("Normal Map", 2D) = "bump" {}
// Legacy properties. They're here so that materials using this shader can gracefully fallback to the legacy sprite shader.
[HideInInspector] _Color("Tint", Color) = (1,1,1,1)
[HideInInspector] _RendererColor("RendererColor", Color) = (1,1,1,1)
[HideInInspector] _Flip("Flip", Vector) = (1,1,1,1)
[HideInInspector] _AlphaTex("External Alpha", 2D) = "white" {}
[HideInInspector] _EnableExternalAlpha("Enable External Alpha", Float) = 0
[Space]
[Header(Edge)]
[Toggle] _EFFECT_EDGE ("Enable Edge", Float) = 0
_OutLineColor ("Outline color", Color) = (0.804, 0.2, 0, 1)//描边颜色
_PixelSize ("Pixel Size", Range(0, 10)) = 6
_DetectAlpha ("DetectAlpha", Range(0, 0.2)) = 0.1 //四周的点算alpha平均,若大于则显示描边
_ImageCullAlpha ("ImageCullAlpha", Range(0, 1)) = 0.2 //当前所在的点若大于改值,则无条件原图
// _Smooth ("Smooth", Range(1, 10)) = 10
// _SmoothAlphaBase ("SmoothAlphaBase", Range(0, 1)) = 0.8
_HaveEdgeEffect ("HaveEdgeEffect", Range(0, 1)) = 1
[Space]
[Header(Highlight)]
[Toggle] _EFFECT_HIGHLIGHT("Enable Highlight", Float) = 0
}
SubShader
{
Tags {"Queue" = "Transparent" "RenderType" = "Transparent" "RenderPipeline" = "UniversalPipeline" }
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
Cull Off
ZWrite Off
Pass
{
Tags { "LightMode" = "Universal2D" }
HLSLPROGRAM
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#pragma vertex CombinedShapeLightVertex
#pragma fragment CombinedShapeLightFragment
#pragma multi_compile USE_SHAPE_LIGHT_TYPE_0 __
#pragma multi_compile USE_SHAPE_LIGHT_TYPE_1 __
#pragma multi_compile USE_SHAPE_LIGHT_TYPE_2 __
#pragma multi_compile USE_SHAPE_LIGHT_TYPE_3 __
#pragma multi_compile _ DEBUG_DISPLAY
#pragma multi_compile _EFFECT_EDGE _EFFECT_EDGE_ON
#pragma multi_compile _EFFECT_HIGHLIGHT _EFFECT_HIGHLIGHT_ON
struct Attributes
{
float3 positionOS : POSITION;
float4 color : COLOR;
float2 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct Varyings
{
float4 positionCS : SV_POSITION;
half4 color : COLOR;
float2 uv : TEXCOORD0;
half2 lightingUV : TEXCOORD1;
#if defined(DEBUG_DISPLAY)
float3 positionWS : TEXCOORD2;
#endif
UNITY_VERTEX_OUTPUT_STEREO
};
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/LightingUtility.hlsl"
TEXTURE2D(_MainTex);
SAMPLER(sampler_MainTex);
TEXTURE2D(_MaskTex);
SAMPLER(sampler_MaskTex);
half4 _MainTex_ST;
float4 _Color;
half4 _RendererColor;
#if USE_SHAPE_LIGHT_TYPE_0
SHAPE_LIGHT(0)
#endif
#if USE_SHAPE_LIGHT_TYPE_1
SHAPE_LIGHT(1)
#endif
#if USE_SHAPE_LIGHT_TYPE_2
SHAPE_LIGHT(2)
#endif
#if USE_SHAPE_LIGHT_TYPE_3
SHAPE_LIGHT(3)
#endif
Varyings CombinedShapeLightVertex(Attributes v)
{
Varyings o = (Varyings)0;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.positionCS = TransformObjectToHClip(v.positionOS);
#if defined(DEBUG_DISPLAY)
o.positionWS = TransformObjectToWorld(v.positionOS);
#endif
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
o.lightingUV = half2(ComputeScreenPos(o.positionCS / o.positionCS.w).xy);
o.color = v.color * _Color * _RendererColor;
return o;
}
// for edge
half4 _OutLineColor;
float _PixelSize;
float2 _MainTex_TexelSize;
float _DetectAlpha;
float _ImageCullAlpha;
// float _Smooth;
// float _SmoothAlphaBase;
half _HaveEdgeEffect;
void Edge(inout half4 outColor, half2 changedUV)
{
_PixelSize = _PixelSize * _MainTex_TexelSize;
// fixed4 color = tex2D(_MainTex, fixed2(changedUV.x, changedUV.y));
half color1 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, half2(changedUV.x + _PixelSize, changedUV.y + _PixelSize)).a;
half color2 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, half2(changedUV.x - _PixelSize, changedUV.y - _PixelSize)).a;
half color3 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, half2(changedUV.x + _PixelSize, changedUV.y - _PixelSize)).a;
half color4 = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, half2(changedUV.x - _PixelSize, changedUV.y + _PixelSize)).a;
half a = (color1 + color2 + color3 + color4) / 4;
int if1 = step(outColor.a, _ImageCullAlpha);
int if2 = step(a, _DetectAlpha);
// outColor = outColor* (1 - _HaveEdgeEffect) + _HaveEdgeEffect *(if1 * (((1 - if2) * fixed4(_OutLineColor.rgb, pow(a + _SmoothAlphaBase, _Smooth) * _OutLineColor.a))) + color * (1 - if1));
outColor = outColor* (1 - _HaveEdgeEffect) + _HaveEdgeEffect *(if1 * (((1 - if2) * _OutLineColor)) + outColor * (1 - if1));
}
void Outline(inout half4 outColor, half2 uv)
{
float totalAlpha = 1.0;
[unroll(16)]
for (int i = 1; i < _PixelSize + 1; i++) {
half4 pixelUp = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv + half2(0, i * _MainTex_TexelSize.y));
half4 pixelDown = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv - half2(0,i * _MainTex_TexelSize.y));
half4 pixelRight = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv + half2(i * _MainTex_TexelSize.x, 0));
half4 pixelLeft = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv - half2(i * _MainTex_TexelSize.x, 0));
totalAlpha = totalAlpha * pixelUp.a * pixelDown.a * pixelRight.a * pixelLeft.a;
}
if (totalAlpha == 0) {
outColor.rgba = half4(1, 1, 1, 1) * _OutLineColor;
}
}
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/CombinedShapeLightShared.hlsl"
half4 CombinedShapeLightFragment(Varyings i) : SV_Target
{
const half4 main = i.color * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv);
const half4 mask = SAMPLE_TEXTURE2D(_MaskTex, sampler_MaskTex, i.uv);
SurfaceData2D surfaceData;
InputData2D inputData;
InitializeSurfaceData(main.rgb, main.a, mask, surfaceData);
InitializeInputData(i.uv, i.lightingUV, inputData);
half4 outColor = CombinedShapeLightShared(surfaceData, inputData);
#if _EFFECT_HIGHLIGHT_ON
outColor.rgb *= half3(1.3, 1.3, 1.3);
#endif
#if _EFFECT_EDGE_ON
// Edge(outColor, i.uv);
Outline(outColor, i.uv);
#endif
return outColor;
}
ENDHLSL
}
Pass
{
Tags { "LightMode" = "NormalsRendering"}
HLSLPROGRAM
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#pragma vertex NormalsRenderingVertex
#pragma fragment NormalsRenderingFragment
struct Attributes
{
float3 positionOS : POSITION;
float4 color : COLOR;
float2 uv : TEXCOORD0;
float4 tangent : TANGENT;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct Varyings
{
float4 positionCS : SV_POSITION;
half4 color : COLOR;
float2 uv : TEXCOORD0;
half3 normalWS : TEXCOORD1;
half3 tangentWS : TEXCOORD2;
half3 bitangentWS : TEXCOORD3;
UNITY_VERTEX_OUTPUT_STEREO
};
TEXTURE2D(_MainTex);
SAMPLER(sampler_MainTex);
TEXTURE2D(_NormalMap);
SAMPLER(sampler_NormalMap);
half4 _NormalMap_ST; // Is this the right way to do this?
Varyings NormalsRenderingVertex(Attributes attributes)
{
Varyings o = (Varyings)0;
UNITY_SETUP_INSTANCE_ID(attributes);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.positionCS = TransformObjectToHClip(attributes.positionOS);
o.uv = TRANSFORM_TEX(attributes.uv, _NormalMap);
o.color = attributes.color;
o.normalWS = -GetViewForwardDir();
o.tangentWS = TransformObjectToWorldDir(attributes.tangent.xyz);
o.bitangentWS = cross(o.normalWS, o.tangentWS) * attributes.tangent.w;
return o;
}
#include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/NormalsRenderingShared.hlsl"
half4 NormalsRenderingFragment(Varyings i) : SV_Target
{
const half4 mainTex = i.color * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv);
const half3 normalTS = UnpackNormal(SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, i.uv));
return NormalsRenderingShared(mainTex, normalTS, i.tangentWS.xyz, i.bitangentWS.xyz, i.normalWS.xyz);
}
ENDHLSL
}
Pass
{
Tags { "LightMode" = "UniversalForward" "Queue"="Transparent" "RenderType"="Transparent"}
HLSLPROGRAM
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#pragma vertex UnlitVertex
#pragma fragment UnlitFragment
struct Attributes
{
float3 positionOS : POSITION;
float4 color : COLOR;
float2 uv : TEXCOORD0;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct Varyings
{
float4 positionCS : SV_POSITION;
float4 color : COLOR;
float2 uv : TEXCOORD0;
#if defined(DEBUG_DISPLAY)
float3 positionWS : TEXCOORD2;
#endif
UNITY_VERTEX_OUTPUT_STEREO
};
TEXTURE2D(_MainTex);
SAMPLER(sampler_MainTex);
float4 _MainTex_ST;
float4 _Color;
half4 _RendererColor;
Varyings UnlitVertex(Attributes attributes)
{
Varyings o = (Varyings)0;
UNITY_SETUP_INSTANCE_ID(attributes);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.positionCS = TransformObjectToHClip(attributes.positionOS);
#if defined(DEBUG_DISPLAY)
o.positionWS = TransformObjectToWorld(v.positionOS);
#endif
o.uv = TRANSFORM_TEX(attributes.uv, _MainTex);
o.color = attributes.color * _Color * _RendererColor;
return o;
}
float4 UnlitFragment(Varyings i) : SV_Target
{
float4 mainTex = i.color * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv);
#if defined(DEBUG_DISPLAY)
SurfaceData2D surfaceData;
InputData2D inputData;
half4 debugColor = 0;
InitializeSurfaceData(mainTex.rgb, mainTex.a, surfaceData);
InitializeInputData(i.uv, inputData);
SETUP_DEBUG_DATA_2D(inputData, i.positionWS);
if(CanDebugOverrideOutputColor(surfaceData, inputData, debugColor))
{
return debugColor;
}
#endif
return mainTex;
}
ENDHLSL
}
}
Fallback "Sprites/Default"
}

10
Unity/Assets/Res/Shader/GameObjectLit.shader.meta

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 844b1f34770e3fe4aa7afbe4c622a6d0
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

115
Unity/Assets/Scenes/Game.unity

@ -193,7 +193,7 @@ SpriteRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 2100000, guid: 760052f9f92321d44839e8d3342dac3c, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -1061,7 +1061,7 @@ SpriteRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 2100000, guid: 760052f9f92321d44839e8d3342dac3c, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -1270,6 +1270,117 @@ BoxCollider2D:
serializedVersion: 2
m_Size: {x: 68, y: 36}
m_EdgeRadius: 0
--- !u!1 &1716733311
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1716733313}
- component: {fileID: 1716733312}
m_Layer: 0
m_Name: GlobalLight
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1716733312
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1716733311}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 073797afb82c5a1438f328866b10b3f0, type: 3}
m_Name:
m_EditorClassIdentifier:
m_ComponentVersion: 1
m_LightType: 4
m_BlendStyleIndex: 0
m_FalloffIntensity: 0.5
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 1
m_LightVolumeIntensity: 1
m_LightVolumeIntensityEnabled: 0
m_ApplyToSortingLayers: 00000000
m_LightCookieSprite: {fileID: 0}
m_DeprecatedPointLightCookieSprite: {fileID: 0}
m_LightOrder: 0
m_AlphaBlendOnOverlap: 0
m_OverlapOperation: 0
m_NormalMapDistance: 3
m_NormalMapQuality: 2
m_UseNormalMap: 0
m_ShadowIntensityEnabled: 0
m_ShadowIntensity: 0.75
m_ShadowVolumeIntensityEnabled: 0
m_ShadowVolumeIntensity: 0.75
m_Vertices:
- position: {x: 0.9985302, y: 0.9985302, z: 0}
color: {r: 0.70710677, g: 0.70710677, b: 0, a: 0}
uv: {x: 0, y: 0}
- position: {x: 0.9985302, y: 0.9985302, z: 0}
color: {r: 0, g: 0, b: 0, a: 1}
uv: {x: 0, y: 0}
- position: {x: -0.9985302, y: 0.9985302, z: 0}
color: {r: -0.70710677, g: 0.70710677, b: 0, a: 0}
uv: {x: 0, y: 0}
- position: {x: -0.9985302, y: 0.9985302, z: 0}
color: {r: 0, g: 0, b: 0, a: 1}
uv: {x: 0, y: 0}
- position: {x: -0.99853003, y: -0.9985304, z: 0}
color: {r: -0.70710665, g: -0.7071069, b: 0, a: 0}
uv: {x: 0, y: 0}
- position: {x: -0.99853003, y: -0.9985304, z: 0}
color: {r: 0, g: 0, b: 0, a: 1}
uv: {x: 0, y: 0}
- position: {x: 0.99853003, y: -0.9985304, z: 0}
color: {r: 0.70710665, g: -0.7071069, b: 0, a: 0}
uv: {x: 0, y: 0}
- position: {x: 0.99853003, y: -0.9985304, z: 0}
color: {r: 0, g: 0, b: 0, a: 1}
uv: {x: 0, y: 0}
- position: {x: 0, y: 0, z: 0}
color: {r: 0, g: 0, b: 0, a: 1}
uv: {x: 0, y: 0}
m_Triangles: 030001000800020000000100030002000100050003000800040002000300050004000300070005000800060004000500070006000500010007000800000006000700010000000700
m_LocalBounds:
m_Center: {x: 0, y: -0.00000011920929, z: 0}
m_Extent: {x: 0.9985302, y: 0.99853027, z: 0}
m_PointLightInnerAngle: 360
m_PointLightOuterAngle: 360
m_PointLightInnerRadius: 0
m_PointLightOuterRadius: 1
m_ShapeLightParametricSides: 5
m_ShapeLightParametricAngleOffset: 0
m_ShapeLightParametricRadius: 1
m_ShapeLightFalloffSize: 0.5
m_ShapeLightFalloffOffset: {x: 0, y: 0}
m_ShapePath:
- {x: -0.5, y: -0.5, z: 0}
- {x: 0.5, y: -0.5, z: 0}
- {x: 0.5, y: 0.5, z: 0}
- {x: -0.5, y: 0.5, z: 0}
--- !u!4 &1716733313
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1716733311}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 14.737242, y: -6.2604756, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1745017813
GameObject:
m_ObjectHideFlags: 0

405
Unity/Assets/Scenes/Test1.unity

@ -129,20 +129,6 @@ GameObject:
type: 3}
m_PrefabInstance: {fileID: 495239127}
m_PrefabAsset: {fileID: 0}
--- !u!114 &163496198
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 163496197}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9d852fd958405824f8fe3160d0675dc7, type: 3}
m_Name:
m_EditorClassIdentifier:
Button: {fileID: 2100162353}
UICamera: {fileID: 1657489124}
--- !u!1 &182378385
GameObject:
m_ObjectHideFlags: 0
@ -329,7 +315,7 @@ SpriteRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 2100000, guid: 374868c26a9f55b4397a7e73227f54f3, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -855,6 +841,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_SendPointerHoverToParent: 1
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
@ -922,7 +909,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: badf0bc51a380c3459c4ed2208ace14c, type: 3}
m_Name:
m_EditorClassIdentifier:
agent: {fileID: 0}
agent: {fileID: 804818790}
showPath: 1
showAhead: 1
startPos: {x: -13, y: 13, z: 0}
@ -969,6 +956,90 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &820877422
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 820877424}
- component: {fileID: 820877423}
m_Layer: 0
m_Name: Square
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!212 &820877423
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 820877422}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 802e1eafac60ee044aed8fc50fe0e7b1, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 567e4e010f776a84992e60db2cefb3a5, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!4 &820877424
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 820877422}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 2.051148, y: 2.9641755, z: 0.13021202}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &881259395
GameObject:
m_ObjectHideFlags: 0
@ -1160,6 +1231,117 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 916373098}
m_PrefabAsset: {fileID: 0}
--- !u!1 &956136492
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 956136494}
- component: {fileID: 956136493}
m_Layer: 0
m_Name: Light 2D
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &956136493
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 956136492}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 073797afb82c5a1438f328866b10b3f0, type: 3}
m_Name:
m_EditorClassIdentifier:
m_ComponentVersion: 1
m_LightType: 4
m_BlendStyleIndex: 0
m_FalloffIntensity: 0.5
m_Color: {r: 0.5660378, g: 0.5326079, b: 0.018155891, a: 1}
m_Intensity: 1
m_LightVolumeIntensity: 1
m_LightVolumeIntensityEnabled: 0
m_ApplyToSortingLayers: 00000000
m_LightCookieSprite: {fileID: 0}
m_DeprecatedPointLightCookieSprite: {fileID: 0}
m_LightOrder: 0
m_AlphaBlendOnOverlap: 0
m_OverlapOperation: 0
m_NormalMapDistance: 3
m_NormalMapQuality: 2
m_UseNormalMap: 0
m_ShadowIntensityEnabled: 0
m_ShadowIntensity: 0.75
m_ShadowVolumeIntensityEnabled: 0
m_ShadowVolumeIntensity: 0.75
m_Vertices:
- position: {x: 0.9985302, y: 0.9985302, z: 0}
color: {r: 0.70710677, g: 0.70710677, b: 0, a: 0}
uv: {x: 0, y: 0}
- position: {x: 0.9985302, y: 0.9985302, z: 0}
color: {r: 0, g: 0, b: 0, a: 1}
uv: {x: 0, y: 0}
- position: {x: -0.9985302, y: 0.9985302, z: 0}
color: {r: -0.70710677, g: 0.70710677, b: 0, a: 0}
uv: {x: 0, y: 0}
- position: {x: -0.9985302, y: 0.9985302, z: 0}
color: {r: 0, g: 0, b: 0, a: 1}
uv: {x: 0, y: 0}
- position: {x: -0.99853003, y: -0.9985304, z: 0}
color: {r: -0.70710665, g: -0.7071069, b: 0, a: 0}
uv: {x: 0, y: 0}
- position: {x: -0.99853003, y: -0.9985304, z: 0}
color: {r: 0, g: 0, b: 0, a: 1}
uv: {x: 0, y: 0}
- position: {x: 0.99853003, y: -0.9985304, z: 0}
color: {r: 0.70710665, g: -0.7071069, b: 0, a: 0}
uv: {x: 0, y: 0}
- position: {x: 0.99853003, y: -0.9985304, z: 0}
color: {r: 0, g: 0, b: 0, a: 1}
uv: {x: 0, y: 0}
- position: {x: 0, y: 0, z: 0}
color: {r: 0, g: 0, b: 0, a: 1}
uv: {x: 0, y: 0}
m_Triangles: 030001000800020000000100030002000100050003000800040002000300050004000300070005000800060004000500070006000500010007000800000006000700010000000700
m_LocalBounds:
m_Center: {x: 0, y: -0.00000011920929, z: 0}
m_Extent: {x: 0.9985302, y: 0.99853027, z: 0}
m_PointLightInnerAngle: 360
m_PointLightOuterAngle: 360
m_PointLightInnerRadius: 0
m_PointLightOuterRadius: 1
m_ShapeLightParametricSides: 5
m_ShapeLightParametricAngleOffset: 0
m_ShapeLightParametricRadius: 1
m_ShapeLightFalloffSize: 0.5
m_ShapeLightFalloffOffset: {x: 0, y: 0}
m_ShapePath:
- {x: -0.5, y: -0.5, z: 0}
- {x: 0.5, y: -0.5, z: 0}
- {x: 0.5, y: 0.5, z: 0}
- {x: -0.5, y: 0.5, z: 0}
--- !u!4 &956136494
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 956136492}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -3.2926667, y: 9.756262, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &975978556
GameObject:
m_ObjectHideFlags: 0
@ -1320,6 +1502,80 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!1001 &1056434959
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 1245791165}
m_Modifications:
- target: {fileID: 2499420514611908718, guid: 7a8980f9cdf96e342b4535db35a06a19,
type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: 760052f9f92321d44839e8d3342dac3c, type: 2}
- target: {fileID: 5770049575758657344, guid: 7a8980f9cdf96e342b4535db35a06a19,
type: 3}
propertyPath: m_RootOrder
value: 6
objectReference: {fileID: 0}
- target: {fileID: 5770049575758657344, guid: 7a8980f9cdf96e342b4535db35a06a19,
type: 3}
propertyPath: m_LocalPosition.x
value: 13.87
objectReference: {fileID: 0}
- target: {fileID: 5770049575758657344, guid: 7a8980f9cdf96e342b4535db35a06a19,
type: 3}
propertyPath: m_LocalPosition.y
value: -10.4
objectReference: {fileID: 0}
- target: {fileID: 5770049575758657344, guid: 7a8980f9cdf96e342b4535db35a06a19,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5770049575758657344, guid: 7a8980f9cdf96e342b4535db35a06a19,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5770049575758657344, guid: 7a8980f9cdf96e342b4535db35a06a19,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5770049575758657344, guid: 7a8980f9cdf96e342b4535db35a06a19,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5770049575758657344, guid: 7a8980f9cdf96e342b4535db35a06a19,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5770049575758657344, guid: 7a8980f9cdf96e342b4535db35a06a19,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5770049575758657344, guid: 7a8980f9cdf96e342b4535db35a06a19,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5770049575758657344, guid: 7a8980f9cdf96e342b4535db35a06a19,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5770049575758657351, guid: 7a8980f9cdf96e342b4535db35a06a19,
type: 3}
propertyPath: m_Name
value: Build_1004 (1)
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 7a8980f9cdf96e342b4535db35a06a19, type: 3}
--- !u!1 &1109141519
GameObject:
m_ObjectHideFlags: 0
@ -1465,6 +1721,7 @@ Transform:
- {fileID: 1223508469}
- {fileID: 306966974}
- {fileID: 1109141520}
- {fileID: 1671077667}
m_Father: {fileID: 2124408459}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
@ -1538,7 +1795,7 @@ SpriteRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 2100000, guid: 374868c26a9f55b4397a7e73227f54f3, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -1773,7 +2030,7 @@ Camera:
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Bits: 32
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
@ -1954,6 +2211,32 @@ PlayableDirector:
value: {fileID: 1658377967}
m_ExposedReferences:
m_References: []
--- !u!1 &1671077666 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 5770049575758657351, guid: 7a8980f9cdf96e342b4535db35a06a19,
type: 3}
m_PrefabInstance: {fileID: 1056434959}
m_PrefabAsset: {fileID: 0}
--- !u!4 &1671077667 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 5770049575758657344, guid: 7a8980f9cdf96e342b4535db35a06a19,
type: 3}
m_PrefabInstance: {fileID: 1056434959}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1671077668
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1671077666}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9d852fd958405824f8fe3160d0675dc7, type: 3}
m_Name:
m_EditorClassIdentifier:
Button: {fileID: 432564911}
UICamera: {fileID: 1657489124}
--- !u!1001 &1762734888
PrefabInstance:
m_ObjectHideFlags: 0
@ -2023,6 +2306,90 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 7a8980f9cdf96e342b4535db35a06a19, type: 3}
--- !u!1 &1817334171
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1817334173}
- component: {fileID: 1817334172}
m_Layer: 0
m_Name: Square (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!212 &1817334172
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1817334171}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 802e1eafac60ee044aed8fc50fe0e7b1, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: cc09b59e5824fd5488c4f73b29ada014, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!4 &1817334173
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1817334171}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 2.051148, y: -0.54, z: 0.13021202}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &1966983756 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 5770049575758657344, guid: 146d2405be29b1e4497fb454ac830dc9,
@ -2299,7 +2666,7 @@ MonoBehaviour:
m_OverrideTileSize: 0
m_TileSize: 256
m_OverrideVoxelSize: 0
m_VoxelSize: 0.033333335
m_VoxelSize: 0.16666667
m_BuildHeightMesh: 0
m_HideEditorLogs: 0
m_NavMeshData: {fileID: 23800000, guid: d5619753999409f4b86af078c3f3050a, type: 2}

41
Unity/Assets/Scripts/Test/TestBounds.cs

@ -8,10 +8,22 @@ public class TestBounds : MonoBehaviour
private SpriteRenderer sprRender;
public GameObject Button;
public Camera UICamera;
private Material selectMat;
private Material sharedMat;
// Start is called before the first frame update
void Start()
{
sprRender = this.GetComponentInChildren<SpriteRenderer>();
sharedMat = sprRender.sharedMaterial;
selectMat = new Material(Shader.Find("PeachValley/GameObject"));
Debug.LogError($"mat same with ori shared:{selectMat == sharedMat }");
Debug.LogError($"shared same with mat:{selectMat == sprRender.sharedMaterial }");
// sprRender.material = sharedMat;
//Debug.LogError($"after sharedMat: {sprRender.material == sprRender.sharedMaterial }");
Debug.LogError("============");
//Debug.LogError(sprRender.sprite.border);
//Debug.LogError(sprRender.sprite.bounds);
//Debug.LogError(sprRender.bounds);
@ -21,13 +33,13 @@ public class TestBounds : MonoBehaviour
Vector2 minPos = sprRender.transform.TransformPoint(bounds.center - new Vector3(bounds.extents.x - border.x / sprRender.sprite.pixelsPerUnit, bounds.extents.y - border.y / sprRender.sprite.pixelsPerUnit));
Vector2 maxPos = sprRender.transform.TransformPoint(bounds.center + new Vector3(bounds.extents.x - border.z / sprRender.sprite.pixelsPerUnit, bounds.extents.y - border.w / sprRender.sprite.pixelsPerUnit));
Vector2 midPos = (minPos + maxPos) / 2;
Debug.LogError("worldPos:" + minPos + "|" + maxPos);
//Debug.LogError("worldPos:" + minPos + "|" + maxPos);
Vector2 midLeft = new Vector2(minPos.x, midPos.y);
//minPos = RectTransformUtility.WorldToScreenPoint(UICamera, minPos);
Debug.LogError("screenPos:" + minPos + "|" + maxPos);
//Debug.LogError("screenPos:" + minPos + "|" + maxPos);
// minPos = Canvas.transform.TransformPoint(minPos);
Debug.LogError("uiPos:" + minPos + "|" + maxPos);
//Debug.LogError("uiPos:" + minPos + "|" + maxPos);
var trans = Button.GetComponent<RectTransform>();
//trans.anchoredPosition = trans.InverseTransformPoint(minPos);
trans.position = midLeft;
@ -36,12 +48,31 @@ public class TestBounds : MonoBehaviour
// Update is called once per frame
void Update()
{
if (Input.GetKeyUp(KeyCode.K))
{
if (sprRender != null)
{
selectMat.EnableKeyword("_EFFECT_EDGE_ON");
sprRender.material = selectMat;
if (sprRender.material == selectMat)
{
Debug.LogError("Same mat");
}
// sprRender.material.EnableKeyword("_EFFECT_EDGE_ON");
}
}
if (Input.GetKeyUp(KeyCode.L))
{
// sprRender.material.DisableKeyword("_EFFECT_EDGE_ON");
sprRender.sharedMaterial = sharedMat;
}
}
void OnDrawGizmos()
{
sprRender = this.GetComponent<SpriteRenderer>();
// sprRender = this.GetComponent<SpriteRenderer>();
if (sprRender != null)
{
Bounds bounds = sprRender.sprite.bounds;

4
Unity/Codes/Hotfix/Demo/Resource/ResourcePointComponentSystem.cs

@ -72,6 +72,10 @@ namespace ET
List<ExtraOut> extraOuts = new List<ExtraOut>();
foreach (var v in resConfig.ExtraOut)
{
if (v == 0)
{
continue;
}
var extraoutConfig = ExtraOutputConfigCategory.Instance.Get(v);
if (extraoutConfig != null)
{

2
Unity/Codes/Hotfix/Demo/Unit/UnitHelper.cs

@ -73,7 +73,7 @@ namespace ET
List<NightEvent> nightEvents = null;
if (unit.EventSeed > 0)
{
SeasonConfig lastSeasonConfig = UnitOperate.GetSeasonConfigByDay(unit.Day-1);
SeasonConfig lastSeasonConfig = UnitOperate.GetSeasonConfigByDay(unit.Day-1, unit.Season);
int nightTime = UnitOperate.CheckMoonNightTime(unit.Day-1, lastSeasonConfig.DayTime[1]);
nightEvents = UnitOperate.NightEvent(unit, nightTime, unit.SeasonConfig.DayTime[0]);

33
Unity/Codes/HotfixView/Demo/Building/BuildingViewComponentSystem.cs

@ -1,4 +1,5 @@
using FairyGUI;
using ET.Util;
using FairyGUI;
using UnityEngine;
using UnityEngine.EventSystems;
@ -41,7 +42,7 @@ namespace ET
public static void CreateBuilding(this BuildingViewComponent self, Building buildingInfo)
{
self.buildingInfo = buildingInfo;
self.BuildingInfo = buildingInfo;
var buildingConfig = StructureConfigCategory.Instance.Get(buildingInfo.ConfigId);
// 在地图中创建建筑实例
@ -52,6 +53,8 @@ namespace ET
self.BuildingRoot = building;
var sprRender = self.BuildingRoot.transform.Find("Build_Base").GetComponent<SpriteRenderer>();
self.SharedMat = sprRender.sharedMaterial;
self.BuildingSprRenderer = sprRender;
Vector2Int size = mapComp.GetSizeBySpriteCollider(sprRender);
#if CLIENTTEST
var indicator = BuildingViewHelper.CreateOcupyPlaceInicator("OccupyPlaceInidcator", new Color(1, 0, 0, 0.3f));
@ -82,7 +85,7 @@ namespace ET
{
self.RemoveBuilding();
self.CreateBuilding(self.buildingInfo);
self.CreateBuilding(self.BuildingInfo);
}
public static void OnSpriteClicked(this BuildingViewComponent self, BuildingViewComponent buildingViewComponent)
@ -99,7 +102,7 @@ namespace ET
return;
}
var buildingInfo = buildingViewComponent.buildingInfo;
var buildingInfo = buildingViewComponent.BuildingInfo;
//根据不同的建筑类型打开不同的界面
StructureConfig structureConfig = StructureConfigCategory.Instance.Get(buildingInfo.ConfigId);
@ -148,6 +151,24 @@ namespace ET
{
return self.BuildingRoot.transform.position;
}
public static void HighlightBuilding(this BuildingViewComponent self, bool withEdge)
{
if (withEdge)
{
self.BuildingSprRenderer.material = MaterialHelper.Instance.EdgeHighlightMat;
}
else
{
self.BuildingSprRenderer.material = MaterialHelper.Instance.HighlightMat;
}
}
public static void NormalBuilding(this BuildingViewComponent self)
{
self.BuildingSprRenderer.sharedMaterial = self.SharedMat;
}
public static void Destroy(this BuildingViewComponent self)
{
@ -191,11 +212,11 @@ namespace ET
public static async ETTask CreateName(this BuildingViewComponent self)
{
FUI_BuildingName nameEntity =
await FUIHelper.CreateInstanceAsync<FUI_BuildingName>(self.buildingInfo, FUI_BuildingName.UIPackageName, FUI_BuildingName.UIResName);
await FUIHelper.CreateInstanceAsync<FUI_BuildingName>(self.BuildingInfo, FUI_BuildingName.UIPackageName, FUI_BuildingName.UIResName);
FUIUnitNamePanelComponent unitNamePanelComponent = FUIComponent.Instance.GetUI(FUI_UnitNamePanel.UIResName) as FUIUnitNamePanelComponent;
unitNamePanelComponent.FUIUnitNamePanel.FGComp.AddChild(nameEntity.FGComp);
var buildingConfig = StructureConfigCategory.Instance.Get(self.buildingInfo.ConfigId);
var buildingConfig = StructureConfigCategory.Instance.Get(self.BuildingInfo.ConfigId);
nameEntity.m_Name.text = buildingConfig.Name;
self.UnitName = nameEntity;

2
Unity/Codes/HotfixView/Demo/FUI/Logic/Building/FUIBuildingSelectWorkerWindowComponentSystem.cs

@ -55,7 +55,7 @@ namespace ET
BuildingWorkerItem item = (BuildingWorkerItem) list.AddItemFromPool();
item.SetName(people.Name);
var gender = people.GetGender();
var strength = people.GetStrength();
var strength = people.GetLabor();
item.SetIcon(PeopleViewHelper.GetHeadIconUrlByGender(gender));
item.SetStrength(strength);

15
Unity/Codes/HotfixView/Demo/FUI/Logic/Building/FUIFarmlandWindowComponentSystem.cs

@ -25,7 +25,9 @@ namespace ET
public static void Awake(this FUIFarmlandWindowComponent self)
{
self.FUIFarmlandWindow = self.Parent.GetComponent<FUI_FarmlandWindow>();
self.Window = new Window();
var win = new FUIFarmlandWindow();
win.OnWindowHide = self.OnHide;
self.Window = win;
self.Window.contentPane = self.FUIFarmlandWindow.FGComp;
UIObjectFactory.SetPackageItemExtension(FUIPackage.Building_PlantSeedItem, typeof(PlantSeedItem));
@ -51,6 +53,11 @@ namespace ET
Log.Error($"Building [{self.Building.Id}] doesn't have a Farmland");
return;
}
// highlight
var buildingView = self.Building.GetComponent<BuildingViewComponent>();
buildingView?.HighlightBuilding(true);
self.FUIFarmlandWindow.m_farmlandState.selectedIndex = self.Farmland.FarmlandState;
@ -333,6 +340,12 @@ namespace ET
self.Window.Hide();
}
public static void OnHide(this FUIFarmlandWindowComponent self)
{
var buildingView = self.Building.GetComponent<BuildingViewComponent>();
buildingView?.NormalBuilding();
}
public static void OnCloseButtonClick(this FUIFarmlandWindowComponent self)
{
self.Window.Hide();

30
Unity/Codes/HotfixView/Demo/FUI/Logic/Main/FUIMainComponentSystem.cs

@ -139,9 +139,7 @@ namespace ET
var seasonBtn = self.FUIMain.m_SeasonBtn;
int season = unit.Season;
SeasonConfig seasonConfig = SeasonConfigCategory.Instance.Get(season);
int DaysCountOfYear = SeasonConfigCategory.Instance.Get(1).Duration +
SeasonConfigCategory.Instance.Get(2).Duration + SeasonConfigCategory.Instance.Get(3).Duration +
SeasonConfigCategory.Instance.Get(4).Duration;
int seasonDay = WorldParametersConfigCategory.Instance.Get(WorldParam.SeasonDay).Value[0];
string seasonName = seasonConfig.Name; ;
string fColor = string.Empty;
@ -174,13 +172,9 @@ namespace ET
ColorUtility.TryParseHtmlString(bColor, out Color backColor);
seasonBtn.m_Back.color = backColor;
seasonBtn.m_Name.text = seasonName;
int seasonDayRemain = (unit.Day - 1) % DaysCountOfYear;
int seasonPassDays = 0;
for(int i = 1; i < season; i++)
{
seasonPassDays += SeasonConfigCategory.Instance.Get(i).Duration;
}
float fillAmount = (float)(seasonDayRemain - seasonPassDays) / (float)seasonConfig.Duration;
int seasonDayRemain = seasonDay - (unit.Day - 1) % seasonDay;
float fillAmount = (float)(seasonDayRemain) / seasonDay;
seasonBtn.m_Front.fillAmount = 1 - fillAmount;
}
@ -224,9 +218,7 @@ namespace ET
var seasonBtn = com.m_SeasonBtn;
int season = unit.Season;
SeasonConfig seasonConfig = SeasonConfigCategory.Instance.Get(season);
int DaysCountOfYear = SeasonConfigCategory.Instance.Get(1).Duration +
SeasonConfigCategory.Instance.Get(2).Duration + SeasonConfigCategory.Instance.Get(3).Duration +
SeasonConfigCategory.Instance.Get(4).Duration;
int seasonDay = WorldParametersConfigCategory.Instance.Get(WorldParam.SeasonDay).Value[0];
string seasonName = seasonConfig.Name; ;
@ -261,17 +253,13 @@ namespace ET
seasonBtn.m_Back.color = backColor;
seasonBtn.m_Name.text = seasonName;
int seasonDayRemain = (unit.Day - 1) % DaysCountOfYear;
int seasonPassDays = 0;
for (int i = 1; i < season; i++)
{
seasonPassDays += SeasonConfigCategory.Instance.Get(i).Duration;
}
float fillAmount = (float)(seasonDayRemain - seasonPassDays) / (float)seasonConfig.Duration;
int seasonDayRemain = seasonDay - (unit.Day - 1) % seasonDay;
float fillAmount = seasonDayRemain / (float)seasonDay;
seasonBtn.m_Front.fillAmount = 1 - fillAmount;
com.m_closeBtn.FGComp.onClick.Set(() => { com.Visible = false; });
com.m_SeasonChangeRemainTxt.SetVar("value", (seasonConfig.Duration - (seasonDayRemain - seasonPassDays)).ToString()).FlushVars();
com.m_SeasonChangeRemainTxt.SetVar("value", (seasonDayRemain).ToString()).FlushVars();
var crops = CropConfigCategory.Instance.GetAllSeasonCrop(season);
com.m_ItemList.RemoveChildrenToPool();
foreach(var c in crops)

3
Unity/Codes/HotfixView/Demo/FUI/Logic/People/FUILineupWindowComponentSystem.cs

@ -122,8 +122,7 @@ namespace ET
item.SetName(people.Name);
item.SetIcon(PeopleViewHelper.GetHeadIconUrlByGender(people.GetGender()));
var numeric = people.GetComponent<NumericComponent>();
int strengh = numeric.GetAsInt(NumericType.Strength);
item.SetFightPoint(strengh);
item.SetFightPoint(people.Labor);
if (fightSeatMap.ContainsKey(people.Id))
{

3
Unity/Codes/HotfixView/Demo/FUI/Logic/People/FUIPartnerListWindowComponentSystem.cs

@ -77,8 +77,7 @@ namespace ET
var numeric = people.GetComponent<NumericComponent>();
int age = numeric.GetAsInt(NumericType.Age);
item.SetAge(age);
int strengh = numeric.GetAsInt(NumericType.Strength);
item.SetStrength(strengh);
item.SetStrength(people.Labor);
}
self.FUIPartnerListWindow.m_PeopleNum.text = peopleComp.Children.Count.ToString();

3
Unity/Codes/HotfixView/Demo/FUI/Logic/People/FUIPeopleListWindowComponentSystem.cs

@ -74,8 +74,7 @@ namespace ET
var numeric = people.GetComponent<NumericComponent>();
int age = numeric.GetAsInt(NumericType.Age);
item.SetAge(age);
int strengh = numeric.GetAsInt(NumericType.Strength);
item.SetStrength(strengh);
item.SetStrength(people.Labor);
}
self.FUIPeopleListWindow.m_PeopleNum.text = peopleComp.Children.Count.ToString();

16
Unity/Codes/HotfixView/Demo/FUI/Logic/Resource/FUIResourceWindowComponentSystem.cs

@ -171,18 +171,20 @@ namespace ET
}
// 額外產出
if (resourceConfig.ExtraOut > 0)
if (resourceConfig.ExtraOut.Length > 0)
{
var dropConfig = DropGroupConfigCategory.Instance.Get(resourceConfig.ExtraOut);
for (int i = 0; i < dropConfig.ItemId.Length; i++)
for (int i = 0; i < resourceConfig.ExtraOut.Length; i++)
{
var itemId = dropConfig.ItemId[i];
var extraOutputConfig = ExtraOutputConfigCategory.Instance.Get(resourceConfig.ExtraOut[i]);
// var dropConfig = DropGroupConfigCategory.Instance.Get(extraOutputConfig.ItemId);
var itemId = extraOutputConfig.ItemId;
var itemData = AllItemConfigCategory.Instance.Get(itemId);
var item = (ProduceItem) list.AddItemFromPool();
item.SetIcon($"ui://AllItem/{itemData.Icon}");
item.SetDropRate(dropConfig.DropDescription[i]);
item.SetDropRate(extraOutputConfig.DropDescription);
}
}

4
Unity/Codes/HotfixView/Demo/FUI/Logic/Resource/FUISelectWorkerWindowComponentSystem.cs

@ -83,7 +83,7 @@ namespace ET
FUIResource.PeopleItem item = (FUIResource.PeopleItem) list.AddItemFromPool();
item.SetName(people.Name);
item.SetIcon(PeopleViewHelper.GetHeadIconUrlByGender(people.GetGender()));
item.SetStrength(people.GetStrength());
item.SetStrength(people.Labor);
item.WorkingCheckBox.data = people.Id;
item.WorkingCheckBox.onClick.Remove(self.OnPeopleItemCheckBoxClick);
@ -120,7 +120,7 @@ namespace ET
return -1;
}
if (x.GetStrength() > y.GetStrength())
if (x.Labor > y.Labor)
{
return -1;
}

5
Unity/Codes/ModelView/Demo/Building/BuildingViewComponent.cs

@ -1,4 +1,5 @@
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.UI;
namespace ET
@ -8,7 +9,9 @@ namespace ET
public class BuildingViewComponent : Entity, IAwake, IDestroy
{
public GameObject BuildingRoot;
public Building buildingInfo;
public Building BuildingInfo;
public FUI_BuildingName UnitName;
public Material SharedMat;
public SpriteRenderer BuildingSprRenderer;
}
}

21
Unity/Codes/ModelView/Demo/FUI/Logic/Building/FUIFarmlandWindow.cs

@ -0,0 +1,21 @@
using System;
using FairyGUI;
namespace ET
{
public class FUIFarmlandWindow: Window
{
public Action OnWindowShow;
public Action OnWindowHide;
protected override void OnShown()
{
this.OnWindowShow?.Invoke();
}
protected override void OnHide()
{
this.OnWindowHide?.Invoke();
}
}
}

21
Unity/Codes/ModelView/Demo/Util/MaterialHelper.cs

@ -0,0 +1,21 @@
using UnityEngine;
namespace ET.Util
{
public class MaterialHelper : SingletonBase<MaterialHelper>
{
public Material EdgeHighlightMat { get; }
public Material HighlightMat { get; }
public MaterialHelper()
{
this.EdgeHighlightMat = new Material(Shader.Find("PeachValley/GameObject"));
this.EdgeHighlightMat.EnableKeyword("_EFFECT_EDGE_ON");
this.EdgeHighlightMat.EnableKeyword("_EFFECT_HIGHLIGHT_ON");
this.HighlightMat = new Material(Shader.Find("PeachValley/GameObject"));
this.HighlightMat.EnableKeyword("_EFFECT_HIGHLIGHT_ON");
}
}
}

44
Unity/Codes/ModelView/Demo/Util/SingletonBase.cs

@ -0,0 +1,44 @@
namespace ET.Util
{
using System;
/// <summary>
/// A base class for the singleton design pattern.
/// https://www.codeproject.com/Articles/572263/A-Reusable-Base-Class-for-the-Singleton-Pattern-in
/// </summary>
/// <typeparam name="T">Class type of the singleton</typeparam>
public abstract class SingletonBase<T> where T : class
{
#region Members
/// <summary>
/// Static instance. Needs to use lambda expression
/// to construct an instance (since constructor is private).
/// </summary>
private static readonly Lazy<T> sInstance = new Lazy<T>(() => CreateInstanceOfT());
#endregion
#region Properties
/// <summary>
/// Gets the instance of this singleton.
/// </summary>
public static T Instance { get { return sInstance.Value; } }
#endregion
#region Methods
/// <summary>
/// Creates an instance of T via reflection since T's constructor is expected to be private.
/// </summary>
/// <returns></returns>
private static T CreateInstanceOfT()
{
return Activator.CreateInstance(typeof(T)) as T;
//return new T();
}
#endregion
}
}

5
Unity/UserSettings/EditorUserSettings.asset

@ -6,9 +6,12 @@ EditorUserSettings:
serializedVersion: 4
m_ConfigSettings:
RecentlyUsedSceneGuid-0:
value: 515250075c0c595e5f5a5e71122159444e4e4a2f7a7d7f602f284d66b4b76661
value: 5300035f500d0a5e095e5f7743710744104e4179782d7536787c4a62e4b76660
flags: 0
RecentlyUsedSceneGuid-1:
value: 515250075c0c595e5f5a5e71122159444e4e4a2f7a7d7f602f284d66b4b76661
flags: 0
RecentlyUsedSceneGuid-2:
value: 060150505c040858550d5d2640770a441416487d7c707f352c714f63e7b16c39
flags: 0
RecentlyUsedScenePath-0:

Loading…
Cancel
Save