From 4ca053f62447aa3b07910584182759eded540b16 Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Thu, 14 Nov 2024 17:14:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E8=83=8C=E6=99=AF=E9=A2=9C?= =?UTF-8?q?=E8=89=B2=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Resources/Materials.meta | 8 + .../Materials}/XMBBackGround.mat | 2 +- .../Materials}/XMBBackGround.mat.meta | 0 .../Materials/XMBBackGroundPreview.mat | 53 ++ .../Materials/XMBBackGroundPreview.mat.meta | 8 + .../Resources/UIPrefabs/LaunchUI.prefab | 16 +- .../Resources/UIPrefabs/OptionUI.prefab | 6 +- .../Background_Template.prefab | 17 +- ...ab => BgSetting_Color_ItemTemplate.prefab} | 454 +----------------- ... BgSetting_Color_ItemTemplate.prefab.meta} | 0 AxibugEmuOnline.Client/Assets/Script/App.cs | 9 +- .../Assets/Script/Manager/AppSceneLoader.cs | 89 ---- .../Assets/Script/Manager/AppSettings.meta | 8 + .../Script/Manager/AppSettings/AppSettings.cs | 8 + .../AppSettings.cs.meta} | 2 +- .../Manager/AppSettings/BgColorSettings.cs | 72 +++ .../AppSettings/BgColorSettings.cs.meta | 11 + .../UI/BgSettingsUI/BackgroundListMenuItem.cs | 8 +- .../Script/UI/BgSettingsUI/BgSettingItem.cs | 21 - .../Script/UI/BgSettingsUI/BgSetting_Color.cs | 80 +++ ...ngItem.cs.meta => BgSetting_Color.cs.meta} | 0 .../UI/BgSettingsUI/SettingItemSelector.cs | 13 + .../BgSettingsUI/SettingItemSelector.cs.meta | 11 + .../UI/CommandDispatcher/CommandExcuter.cs | 2 - .../Script/UI/ItemPresent/ItemPresent.cs | 13 +- .../Assets/Script/UI/ItemPresent/ItemProxy.cs | 14 +- .../Script/UI/ItemPresent/ItemSelector.cs | 16 + .../UI/ItemPresent/ItemSelector.cs.meta | 11 + .../Assets/Script/UI/OptionUI/OptionUI.cs | 27 +- .../UI/OptionUI/OptionUI_ExecuteItem.cs | 4 - .../Script/UI/OptionUI/OptionUI_MenuItem.cs | 15 +- .../Assets/Script/UI/UITool.cs | 33 ++ .../Assets/Script/UI/UITool.cs.meta | 11 + .../Script/UI/XMBBackGroundPreview.shader | 190 ++++++++ .../UI/XMBBackGroundPreview.shader.meta | 10 + .../Assets/Script/UI/XMBBgChanger.cs | 33 ++ .../Assets/Script/UI/XMBBgChanger.cs.meta | 11 + 37 files changed, 690 insertions(+), 596 deletions(-) create mode 100644 AxibugEmuOnline.Client/Assets/Resources/Materials.meta rename AxibugEmuOnline.Client/Assets/{Script/UI => Resources/Materials}/XMBBackGround.mat (96%) rename AxibugEmuOnline.Client/Assets/{Script/UI => Resources/Materials}/XMBBackGround.mat.meta (100%) create mode 100644 AxibugEmuOnline.Client/Assets/Resources/Materials/XMBBackGroundPreview.mat create mode 100644 AxibugEmuOnline.Client/Assets/Resources/Materials/XMBBackGroundPreview.mat.meta rename AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/VirtualItemTemplates/{BgSetting_ItemTemplate.prefab => BgSetting_Color_ItemTemplate.prefab} (63%) rename AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/VirtualItemTemplates/{BgSetting_ItemTemplate.prefab.meta => BgSetting_Color_ItemTemplate.prefab.meta} (100%) delete mode 100644 AxibugEmuOnline.Client/Assets/Script/Manager/AppSceneLoader.cs create mode 100644 AxibugEmuOnline.Client/Assets/Script/Manager/AppSettings.meta create mode 100644 AxibugEmuOnline.Client/Assets/Script/Manager/AppSettings/AppSettings.cs rename AxibugEmuOnline.Client/Assets/Script/Manager/{AppSceneLoader.cs.meta => AppSettings/AppSettings.cs.meta} (83%) create mode 100644 AxibugEmuOnline.Client/Assets/Script/Manager/AppSettings/BgColorSettings.cs create mode 100644 AxibugEmuOnline.Client/Assets/Script/Manager/AppSettings/BgColorSettings.cs.meta delete mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/BgSettingsUI/BgSettingItem.cs create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/BgSettingsUI/BgSetting_Color.cs rename AxibugEmuOnline.Client/Assets/Script/UI/BgSettingsUI/{BgSettingItem.cs.meta => BgSetting_Color.cs.meta} (100%) create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/BgSettingsUI/SettingItemSelector.cs create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/BgSettingsUI/SettingItemSelector.cs.meta create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/ItemPresent/ItemSelector.cs create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/ItemPresent/ItemSelector.cs.meta create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/UITool.cs create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/UITool.cs.meta create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/XMBBackGroundPreview.shader create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/XMBBackGroundPreview.shader.meta create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/XMBBgChanger.cs create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/XMBBgChanger.cs.meta diff --git a/AxibugEmuOnline.Client/Assets/Resources/Materials.meta b/AxibugEmuOnline.Client/Assets/Resources/Materials.meta new file mode 100644 index 0000000..07e2829 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Resources/Materials.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8c10da27661263d4d91d515ca5a3a0e2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/XMBBackGround.mat b/AxibugEmuOnline.Client/Assets/Resources/Materials/XMBBackGround.mat similarity index 96% rename from AxibugEmuOnline.Client/Assets/Script/UI/XMBBackGround.mat rename to AxibugEmuOnline.Client/Assets/Resources/Materials/XMBBackGround.mat index a7ed85f..f4174e5 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/XMBBackGround.mat +++ b/AxibugEmuOnline.Client/Assets/Resources/Materials/XMBBackGround.mat @@ -49,5 +49,5 @@ Material: m_Colors: - _Color: {r: 1, g: 1, b: 1, a: 1} - _Color1: {r: 0, g: 0.4, b: 1, a: 1} - - _Color2: {r: 0, g: 0.7, b: 1, a: 1} + - _Color2: {r: 0, g: 0.69803923, b: 1, a: 1} m_BuildTextureStacks: [] diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/XMBBackGround.mat.meta b/AxibugEmuOnline.Client/Assets/Resources/Materials/XMBBackGround.mat.meta similarity index 100% rename from AxibugEmuOnline.Client/Assets/Script/UI/XMBBackGround.mat.meta rename to AxibugEmuOnline.Client/Assets/Resources/Materials/XMBBackGround.mat.meta diff --git a/AxibugEmuOnline.Client/Assets/Resources/Materials/XMBBackGroundPreview.mat b/AxibugEmuOnline.Client/Assets/Resources/Materials/XMBBackGroundPreview.mat new file mode 100644 index 0000000..4579367 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Resources/Materials/XMBBackGroundPreview.mat @@ -0,0 +1,53 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: XMBBackGroundPreview + m_Shader: {fileID: 4800000, guid: 424d88aff12857f4aab1911fdb6e02e9, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _ColorMask: 15 + - _Frequency1: 2 + - _Frequency2: 2.1 + - _MaxHeight1: 0.5 + - _MaxHeight2: 0.54 + - _MidHeight1: 0.4 + - _MidHeight2: 0.42 + - _Power1: 50 + - _Power2: 50 + - _Speed1: 0.4 + - _Speed2: 0.3 + - _Stencil: 0 + - _StencilComp: 8 + - _StencilOp: 0 + - _StencilReadMask: 255 + - _StencilWriteMask: 255 + - _UseUIAlphaClip: 0 + - _WaveFrequency1: 4 + - _WaveMaxHeight1: 0.02 + - _WaveMidHeight1: 0 + - _WaveSpd1: 0.02 + - _WaveX1: 0 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _Color1: {r: 0, g: 0.4, b: 1, a: 1} + - _Color2: {r: 0, g: 0.69803923, b: 1, a: 1} + m_BuildTextureStacks: [] diff --git a/AxibugEmuOnline.Client/Assets/Resources/Materials/XMBBackGroundPreview.mat.meta b/AxibugEmuOnline.Client/Assets/Resources/Materials/XMBBackGroundPreview.mat.meta new file mode 100644 index 0000000..a9ac198 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Resources/Materials/XMBBackGroundPreview.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fd41a1a4bc40bb240866d8e33adfa66f +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/LaunchUI.prefab b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/LaunchUI.prefab index 69341ef..df74286 100644 --- a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/LaunchUI.prefab +++ b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/LaunchUI.prefab @@ -85,8 +85,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: fb4f275956ba18440b061e92278f13cd, type: 3} m_Name: m_EditorClassIdentifier: - PulseInvoke_Delay: 0.4 - PulseInvoke_Interval: 0.05 m_menuItemRoot: {fileID: 7102897325704768026} GroupRoot: {fileID: 5247317738185020566} Template: {fileID: 2502609279043838113, guid: ece591129eb9bcc48bd83ec153c98018, type: 3} @@ -134,6 +132,7 @@ GameObject: - component: {fileID: 1639091783724093883} - component: {fileID: 1639091783724093861} - component: {fileID: 1639091783724093860} + - component: {fileID: 3473513813641582791} m_Layer: 5 m_Name: bg m_TagString: Untagged @@ -198,6 +197,19 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!114 &3473513813641582791 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1639091783724093882} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 34f3a870b3a425c4daead53193dcd9c2, type: 3} + m_Name: + m_EditorClassIdentifier: + imgUI: {fileID: 1639091783724093860} --- !u!1 &1639091784002085451 GameObject: m_ObjectHideFlags: 0 diff --git a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OptionUI.prefab b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OptionUI.prefab index 8cef0dd..6b39fd6 100644 --- a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OptionUI.prefab +++ b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OptionUI.prefab @@ -375,8 +375,8 @@ MonoBehaviour: m_Padding: m_Left: 20 m_Right: 20 - m_Top: 20 - m_Bottom: 20 + m_Top: 10 + m_Bottom: 10 m_ChildAlignment: 3 m_Spacing: 12 m_ChildForceExpandWidth: 0 @@ -550,8 +550,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: d9077edba700447499a21395109542df, type: 3} m_Name: m_EditorClassIdentifier: - PulseInvoke_Delay: 0.4 - PulseInvoke_Interval: 0.05 MenuRoot: {fileID: 5397686940312333149} SelectBorder: {fileID: 2404013603202822047} TEMPLATE_EXECUTEITEM: {fileID: 3721725547312714320} diff --git a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/SubMenuItemTemplates/Background_Template.prefab b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/SubMenuItemTemplates/Background_Template.prefab index 39ff049..43c10b3 100644 --- a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/SubMenuItemTemplates/Background_Template.prefab +++ b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/SubMenuItemTemplates/Background_Template.prefab @@ -961,6 +961,7 @@ GameObject: - component: {fileID: 8865437771338118001} - component: {fileID: 6055880809428073973} - component: {fileID: 1286529697012677180} + - component: {fileID: 1434074089467284101} m_Layer: 5 m_Name: SettingGroup m_TagString: Untagged @@ -1011,7 +1012,7 @@ MonoBehaviour: m_Spacing: {x: 0, y: 20} m_Constraint: 1 m_ConstraintCount: 1 - ItemTemplate: {fileID: 1998281097548910301, guid: 2e8fa6342641dc4418cd5c71f89d112c, type: 3} + ItemTemplate: {fileID: 0} ViewRect: {fileID: 2303118795734916657} PauseUpdateView: 0 --- !u!114 &1286529697012677180 @@ -1028,6 +1029,20 @@ MonoBehaviour: m_EditorClassIdentifier: m_HorizontalFit: 0 m_VerticalFit: 2 +--- !u!114 &1434074089467284101 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6164337287601107676} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6e7f64bad63ce024eadbd9ddff940eee, type: 3} + m_Name: + m_EditorClassIdentifier: + ItemList: + - {fileID: 1998281097548910301, guid: 2e8fa6342641dc4418cd5c71f89d112c, type: 3} --- !u!1 &8290338740711049006 GameObject: m_ObjectHideFlags: 0 diff --git a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/VirtualItemTemplates/BgSetting_ItemTemplate.prefab b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/VirtualItemTemplates/BgSetting_Color_ItemTemplate.prefab similarity index 63% rename from AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/VirtualItemTemplates/BgSetting_ItemTemplate.prefab rename to AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/VirtualItemTemplates/BgSetting_Color_ItemTemplate.prefab index c32b755..547e210 100644 --- a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/VirtualItemTemplates/BgSetting_ItemTemplate.prefab +++ b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/VirtualItemTemplates/BgSetting_Color_ItemTemplate.prefab @@ -114,11 +114,11 @@ RectTransform: m_Father: {fileID: 8754483333502849411} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: -150, y: 0} - m_SizeDelta: {x: -296, y: 4} - m_Pivot: {x: 0.5, y: 0.5} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 0, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0, y: 0.5} --- !u!222 &5792146190930927166 CanvasRenderer: m_ObjectHideFlags: 0 @@ -222,157 +222,6 @@ Animator: m_HasTransformHierarchy: 1 m_AllowConstantClipSamplingOptimization: 1 m_KeepAnimatorControllerStateOnDisable: 0 ---- !u!1 &1252956242765037133 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 88397014911048519} - - component: {fileID: 3360692256366003092} - - component: {fileID: 6259552039526853317} - m_Layer: 5 - m_Name: Downloading - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 0 ---- !u!224 &88397014911048519 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1252956242765037133} - 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_Children: - - {fileID: 1356745056984945386} - m_Father: {fileID: 8105925540140519754} - m_RootOrder: 2 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &3360692256366003092 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1252956242765037133} - m_CullTransparentMesh: 1 ---- !u!114 &6259552039526853317 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1252956242765037133} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 0, g: 0, b: 0, a: 0.53333336} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 0} - m_Type: 0 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 1 ---- !u!1 &1760891290906570025 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7286174480513024547} - - component: {fileID: 8465840075520521938} - - component: {fileID: 5960295925543634495} - m_Layer: 5 - m_Name: Background - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &7286174480513024547 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1760891290906570025} - 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_Children: [] - m_Father: {fileID: 1356745056984945386} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0.25} - m_AnchorMax: {x: 1, y: 0.75} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &8465840075520521938 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1760891290906570025} - m_CullTransparentMesh: 1 ---- !u!114 &5960295925543634495 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1760891290906570025} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 0.6556604, g: 0.8499731, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} - m_Type: 1 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 1 --- !u!1 &1776357407830023228 GameObject: m_ObjectHideFlags: 0 @@ -430,7 +279,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} m_Name: m_EditorClassIdentifier: - m_Material: {fileID: 0} + m_Material: {fileID: 2100000, guid: fd41a1a4bc40bb240866d8e33adfa66f, type: 2} m_Color: {r: 1, g: 1, b: 1, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} @@ -438,7 +287,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Sprite: {fileID: 0} m_Type: 1 m_PreserveAspect: 0 m_FillCenter: 0 @@ -448,117 +297,6 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 ---- !u!1 &2160152188869765819 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 8088221278067224827} - - component: {fileID: 7021285932952529020} - - component: {fileID: 373824653597363199} - m_Layer: 5 - m_Name: Fill - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &8088221278067224827 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2160152188869765819} - 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_Children: [] - m_Father: {fileID: 4825215963562112837} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 10, y: 0} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &7021285932952529020 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2160152188869765819} - m_CullTransparentMesh: 1 ---- !u!114 &373824653597363199 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2160152188869765819} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 0, g: 0.39235067, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} - m_Type: 1 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 1 ---- !u!1 &2807279088801569631 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 4825215963562112837} - m_Layer: 5 - m_Name: Fill Area - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &4825215963562112837 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2807279088801569631} - 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_Children: - - {fileID: 8088221278067224827} - m_Father: {fileID: 1356745056984945386} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0.25} - m_AnchorMax: {x: 1, y: 0.75} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: -10, y: 0} - m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &3189920797946144379 GameObject: m_ObjectHideFlags: 0 @@ -571,7 +309,7 @@ GameObject: - component: {fileID: 5700455559359757662} - component: {fileID: -3212218113140324734} m_Layer: 5 - m_Name: BgSetting_ItemTemplate + m_Name: BgSetting_Color_ItemTemplate m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -595,7 +333,7 @@ RectTransform: 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: 500, y: 200} + m_SizeDelta: {x: 500, y: 100} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &5700455559359757662 MonoBehaviour: @@ -629,8 +367,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: f287ccd26d5f14b46b7afb8912daa2e8, type: 3} m_Name: m_EditorClassIdentifier: - PulseInvoke_Delay: 0.4 - PulseInvoke_Interval: 0.05 Icon: {fileID: 6771349210554360888} Txt: {fileID: 991446423622995247} Descript: {fileID: 3380485461544738227} @@ -679,7 +415,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 200, y: 0} + m_AnchoredPosition: {x: 100, y: 0} m_SizeDelta: {x: 600, y: 0} m_Pivot: {x: 0, y: 0.5} --- !u!114 &3252398029444565139 @@ -788,15 +524,13 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 6087025893861054323} - - {fileID: 1361359478345282377} - - {fileID: 88397014911048519} m_Father: {fileID: 8754483333502849411} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 0, y: 0.5} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 200, y: 200} + m_SizeDelta: {x: 100, y: 100} m_Pivot: {x: 0, y: 0.5} --- !u!222 &1377401926964550360 CanvasRenderer: @@ -819,7 +553,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Color: {r: 1, g: 1, b: 1, a: 0} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 @@ -931,170 +665,6 @@ MonoBehaviour: m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5} m_EffectDistance: {x: 1.5, y: 1.5} m_UseGraphicAlpha: 1 ---- !u!1 &5537066628246125853 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1356745056984945386} - - component: {fileID: 1484915906009859069} - m_Layer: 5 - m_Name: Slider - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &1356745056984945386 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5537066628246125853} - 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_Children: - - {fileID: 7286174480513024547} - - {fileID: 4825215963562112837} - m_Father: {fileID: 88397014911048519} - m_RootOrder: 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.0001} - m_SizeDelta: {x: 160, y: 68.2756} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &1484915906009859069 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5537066628246125853} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 67db9e8f0e2ae9c40bc1e2b64352a6b4, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Navigation: - m_Mode: 3 - m_WrapAround: 0 - m_SelectOnUp: {fileID: 0} - m_SelectOnDown: {fileID: 0} - m_SelectOnLeft: {fileID: 0} - m_SelectOnRight: {fileID: 0} - m_Transition: 0 - m_Colors: - m_NormalColor: {r: 1, g: 1, b: 1, a: 1} - m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} - m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} - m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} - m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} - m_ColorMultiplier: 1 - m_FadeDuration: 0.1 - m_SpriteState: - m_HighlightedSprite: {fileID: 0} - m_PressedSprite: {fileID: 0} - m_SelectedSprite: {fileID: 0} - m_DisabledSprite: {fileID: 0} - m_AnimationTriggers: - m_NormalTrigger: Normal - m_HighlightedTrigger: Highlighted - m_PressedTrigger: Pressed - m_SelectedTrigger: Selected - m_DisabledTrigger: Disabled - m_Interactable: 0 - m_TargetGraphic: {fileID: 0} - m_FillRect: {fileID: 8088221278067224827} - m_HandleRect: {fileID: 0} - m_Direction: 0 - m_MinValue: 0 - m_MaxValue: 1 - m_WholeNumbers: 0 - m_Value: 0 - m_OnValueChanged: - m_PersistentCalls: - m_Calls: [] ---- !u!1 &6316945668089981796 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1361359478345282377} - - component: {fileID: 1381140245428399030} - - component: {fileID: 7474552512404188589} - m_Layer: 5 - m_Name: RomReady - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 0 ---- !u!224 &1361359478345282377 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6316945668089981796} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: -2} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 8105925540140519754} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 1, y: 1} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: -12, y: -21} - m_SizeDelta: {x: 48.3195, y: 40.7695} - m_Pivot: {x: 1, y: 1} ---- !u!222 &1381140245428399030 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6316945668089981796} - m_CullTransparentMesh: 1 ---- !u!114 &7474552512404188589 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6316945668089981796} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 0, g: 0.22587347, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 734113830533174147, guid: d518d00d4940e854bbe45d9ef891401a, type: 3} - m_Type: 0 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 1 --- !u!1 &6688216270065609628 GameObject: m_ObjectHideFlags: 0 diff --git a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/VirtualItemTemplates/BgSetting_ItemTemplate.prefab.meta b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/VirtualItemTemplates/BgSetting_Color_ItemTemplate.prefab.meta similarity index 100% rename from AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/VirtualItemTemplates/BgSetting_ItemTemplate.prefab.meta rename to AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/VirtualItemTemplates/BgSetting_Color_ItemTemplate.prefab.meta diff --git a/AxibugEmuOnline.Client/Assets/Script/App.cs b/AxibugEmuOnline.Client/Assets/Script/App.cs index 9f0994f..6ec7b73 100644 --- a/AxibugEmuOnline.Client/Assets/Script/App.cs +++ b/AxibugEmuOnline.Client/Assets/Script/App.cs @@ -25,9 +25,8 @@ namespace AxibugEmuOnline.Client.ClientCore public static RomLib nesRomLib; public static HttpAPI httpAPI; public static CacheManager CacheMgr; - public static AppSceneLoader SceneLoader; public static AppRoom roomMgr; - + public static AppSettings settings; #region Mono public static TickLoop tickLoop; private static CoroutineRunner coRunner; @@ -39,9 +38,11 @@ namespace AxibugEmuOnline.Client.ClientCore public static string PersistentDataPath => Application.persistentDataPath; #endif - [RuntimeInitializeOnLoadMethod] + [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)] static void Init() { + settings = new AppSettings(); + log = new LogManager(); LogManager.OnLog += OnNoSugarNetLog; network = new NetworkHelper(); @@ -53,9 +54,7 @@ namespace AxibugEmuOnline.Client.ClientCore httpAPI = new HttpAPI(); nesRomLib = new RomLib(EnumPlatform.NES); CacheMgr = new CacheManager(); - SceneLoader = new AppSceneLoader(); roomMgr = new AppRoom(); - var go = new GameObject("[AppAxibugEmuOnline]"); GameObject.DontDestroyOnLoad(go); tickLoop = go.AddComponent(); diff --git a/AxibugEmuOnline.Client/Assets/Script/Manager/AppSceneLoader.cs b/AxibugEmuOnline.Client/Assets/Script/Manager/AppSceneLoader.cs deleted file mode 100644 index 8bea1f0..0000000 --- a/AxibugEmuOnline.Client/Assets/Script/Manager/AppSceneLoader.cs +++ /dev/null @@ -1,89 +0,0 @@ -using AxibugEmuOnline.Client.ClientCore; -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.SceneManagement; - -namespace AxibugEmuOnline.Client -{ - public class AppSceneLoader - { - public LoadTask CurrentTask { get; private set; } - - Queue m_tasks = new Queue(); - Coroutine m_coroutine; - public void BeginLoad(string scenePath, Action callback) - { - m_tasks.Enqueue(new LoadTask(scenePath, callback)); - if (m_coroutine == null) - m_coroutine = App.StartCoroutine(TaskFlow()); - } - - private IEnumerator TaskFlow() - { - while (m_tasks.Count > 0) - { - CurrentTask = m_tasks.Dequeue(); - - while (CurrentTask.MoveNext()) yield return null; - - CurrentTask.Callback(); - } - - CurrentTask = null; - m_coroutine = null; - } - - public class LoadTask - { - public EnumTaskState State { get; private set; } = EnumTaskState.Idle; - public float Progress => m_loadingOp != null ? m_loadingOp.progress : 0; - - private AsyncOperation m_loadingOp; - private string m_scenePath; - private Action m_callback; - public LoadTask(string scenePath, Action callback) - { - m_scenePath = scenePath; - m_callback = callback; - } - - public bool MoveNext() - { - if (State == EnumTaskState.Idle) - { - State = EnumTaskState.Running; - m_loadingOp = SceneManager.LoadSceneAsync(m_scenePath, LoadSceneMode.Single); - return true; - } - else if (State == EnumTaskState.Running) - { - m_loadingOp.allowSceneActivation = true; - if (m_loadingOp.isDone) - { - State = EnumTaskState.Complete; - } - - return true; - } - else - { - return false; - } - } - - public void Callback() - { - m_callback?.Invoke(); - } - } - - public enum EnumTaskState - { - Idle, - Running, - Complete - } - } -} diff --git a/AxibugEmuOnline.Client/Assets/Script/Manager/AppSettings.meta b/AxibugEmuOnline.Client/Assets/Script/Manager/AppSettings.meta new file mode 100644 index 0000000..df05012 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/Manager/AppSettings.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 978f10f110fddd548b3f110c5e700a58 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/Manager/AppSettings/AppSettings.cs b/AxibugEmuOnline.Client/Assets/Script/Manager/AppSettings/AppSettings.cs new file mode 100644 index 0000000..7816fb6 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/Manager/AppSettings/AppSettings.cs @@ -0,0 +1,8 @@ +namespace AxibugEmuOnline.Client +{ + public class AppSettings + { + /// 背景颜色设定 + public BgColorSettings BgColor { get; set; } = new BgColorSettings(); + } +} diff --git a/AxibugEmuOnline.Client/Assets/Script/Manager/AppSceneLoader.cs.meta b/AxibugEmuOnline.Client/Assets/Script/Manager/AppSettings/AppSettings.cs.meta similarity index 83% rename from AxibugEmuOnline.Client/Assets/Script/Manager/AppSceneLoader.cs.meta rename to AxibugEmuOnline.Client/Assets/Script/Manager/AppSettings/AppSettings.cs.meta index e9929a3..4a107e4 100644 --- a/AxibugEmuOnline.Client/Assets/Script/Manager/AppSceneLoader.cs.meta +++ b/AxibugEmuOnline.Client/Assets/Script/Manager/AppSettings/AppSettings.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 31fee02299bfd5141aefb2bbfb0555a9 +guid: f3173e9925c703b4aa648e7e65ac4260 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/AxibugEmuOnline.Client/Assets/Script/Manager/AppSettings/BgColorSettings.cs b/AxibugEmuOnline.Client/Assets/Script/Manager/AppSettings/BgColorSettings.cs new file mode 100644 index 0000000..a29d8fd --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/Manager/AppSettings/BgColorSettings.cs @@ -0,0 +1,72 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace AxibugEmuOnline.Client +{ + public class BgColorSettings + { + public delegate void OnColorChangedHandle(XMBColor color); + public event OnColorChangedHandle OnColorChanged; + + /// 当前颜色 + public XMBColor CurrentColor + { + get + { + var color1 = PlayerPrefs.GetString($"{nameof(BgColorSettings)}.{nameof(CurrentColor)}.{nameof(CurrentColor.color1)}", null); + var color2 = PlayerPrefs.GetString($"{nameof(BgColorSettings)}.{nameof(CurrentColor)}.{nameof(CurrentColor.color2)}", null); + var name = PlayerPrefs.GetString($"{nameof(BgColorSettings)}.{nameof(CurrentColor)}.{nameof(CurrentColor.Name)}", null); + if (color1 == null || color2 == null || name == null) + return DEFAULT; + else + return new XMBColor(name, color1, color2); + } + set + { + PlayerPrefs.SetString($"{nameof(BgColorSettings)}.{nameof(CurrentColor)}.{nameof(CurrentColor.color1)}", $"#{ColorUtility.ToHtmlStringRGB(value.color1)}"); + PlayerPrefs.SetString($"{nameof(BgColorSettings)}.{nameof(CurrentColor)}.{nameof(CurrentColor.color2)}", $"#{ColorUtility.ToHtmlStringRGB(value.color2)}"); + PlayerPrefs.SetString($"{nameof(BgColorSettings)}.{nameof(CurrentColor)}.{nameof(CurrentColor.Name)}", value.Name); + + OnColorChanged?.Invoke(value); + } + } + + private static readonly XMBColor DEFAULT = new XMBColor("蓝", "#020754", "#0ab1dc"); + public List Presets { get; private set; } = new List() + { + DEFAULT, + new XMBColor("白","#8a9fb2","#4e9eb6"), + new XMBColor("黄","#d5a916","#d1a813"), + new XMBColor("绿","#3e962b","#7ac25e"), + new XMBColor("粉","#e65a8b","#c7acc6"), + new XMBColor("墨绿","#00421a","#1c951f"), + new XMBColor("紫","#633f93","#8763cc"), + new XMBColor("天蓝","#038baa","#0ca2c2"), + new XMBColor("红","#9c120e","#d73611"), + }; + } + + + public struct XMBColor + { + public string Name; + public Color color1; + public Color color2; + + public XMBColor(string name, string colorCodeStr1, string colorCodeStr2) + { + Name = name; + ColorUtility.TryParseHtmlString(colorCodeStr1, out color1); + ColorUtility.TryParseHtmlString(colorCodeStr2, out color2); + } + + public override int GetHashCode() + { + int hash = 17; + hash = hash * 23 + (Name != null ? Name.GetHashCode() : 0); + hash = hash * 23 + color1.GetHashCode(); + hash = hash * 23 + color2.GetHashCode(); + return hash; + } + } +} diff --git a/AxibugEmuOnline.Client/Assets/Script/Manager/AppSettings/BgColorSettings.cs.meta b/AxibugEmuOnline.Client/Assets/Script/Manager/AppSettings/BgColorSettings.cs.meta new file mode 100644 index 0000000..f94dc42 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/Manager/AppSettings/BgColorSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 84a76f8dddc2a6045bb73b2ee9887cd3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/BgSettingsUI/BackgroundListMenuItem.cs b/AxibugEmuOnline.Client/Assets/Script/UI/BgSettingsUI/BackgroundListMenuItem.cs index 7a66c85..4cff095 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/BgSettingsUI/BackgroundListMenuItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/BgSettingsUI/BackgroundListMenuItem.cs @@ -1,4 +1,6 @@ +using AxibugEmuOnline.Client.ClientCore; using System; +using System.Collections.Generic; namespace AxibugEmuOnline.Client { @@ -6,7 +8,11 @@ namespace AxibugEmuOnline.Client { protected override void GetVirtualListDatas(Action datas) { - return; + List list = new List() + { + App.settings.BgColor, + }; + datas.Invoke(list); } } } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/BgSettingsUI/BgSettingItem.cs b/AxibugEmuOnline.Client/Assets/Script/UI/BgSettingsUI/BgSettingItem.cs deleted file mode 100644 index d7d8026..0000000 --- a/AxibugEmuOnline.Client/Assets/Script/UI/BgSettingsUI/BgSettingItem.cs +++ /dev/null @@ -1,21 +0,0 @@ -using AxibugEmuOnline.Client.UI; - -namespace AxibugEmuOnline.Client -{ - public class BgSettingItem : MenuItem, IVirtualItem - { - public int Index { get; set; } - - public void SetData(object data) - { - } - - public void SetDependencyProperty(object data) - { - } - - public void Release() - { - } - } -} diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/BgSettingsUI/BgSetting_Color.cs b/AxibugEmuOnline.Client/Assets/Script/UI/BgSettingsUI/BgSetting_Color.cs new file mode 100644 index 0000000..637fb0e --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/BgSettingsUI/BgSetting_Color.cs @@ -0,0 +1,80 @@ +using AxibugEmuOnline.Client.ClientCore; +using AxibugEmuOnline.Client.UI; +using System.Linq; +using UnityEngine; + +namespace AxibugEmuOnline.Client +{ + public class BgSetting_Color : MenuItem, IVirtualItem + { + public int Index { get; set; } + public BgColorSettings Datacontext { get; private set; } + + public void SetData(object data) + { + Datacontext = (BgColorSettings)data; + Datacontext.OnColorChanged += Setting_OnColorChanged; + + UpdateView(); + } + + private void Setting_OnColorChanged(XMBColor color) + { + UpdateView(); + } + + private void UpdateView() + { + var color = Datacontext.CurrentColor; + Icon.GetMaterial().SetColor("_Color1", color.color1); + Icon.GetMaterial().SetColor("_Color2", color.color2); + SetBaseInfo("ɫ", color.Name); + } + + public void SetDependencyProperty(object data) + { + SetSelectState(data is ThirdMenuRoot tr && tr.SelectIndex == Index); + } + + public void Release() + { + Datacontext.OnColorChanged -= Setting_OnColorChanged; + } + public override bool OnEnterItem() + { + var options = Datacontext.Presets.Select(preset => new ColorOption(preset)).ToList(); + var currentColor = Datacontext.CurrentColor; + var index = options.FindIndex(op => op.Color.GetHashCode() == currentColor.GetHashCode()); + OptionUI.Instance.Pop(options, Mathf.Clamp(index, 0, options.Count - 1)); + return false; + } + + public class ColorOption : ExecuteMenu + { + public XMBColor Color; + + public ColorOption(XMBColor color) : base(color.Name) + { + Color = color; + } + + public override void OnShow(OptionUI_MenuItem ui) + { + ui.IconUI.gameObject.SetActiveEx(true); + ui.IconUI.SetMaterial(Resources.Load("Materials/XMBBackGroundPreview")); + ui.IconUI.GetMaterial().SetColor("_Color1", Color.color1); + ui.IconUI.GetMaterial().SetColor("_Color2", Color.color2); + } + + public override void OnFocus() + { + App.settings.BgColor.CurrentColor = Color; + } + + public override void OnExcute() + { + + } + } + } +} diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/BgSettingsUI/BgSettingItem.cs.meta b/AxibugEmuOnline.Client/Assets/Script/UI/BgSettingsUI/BgSetting_Color.cs.meta similarity index 100% rename from AxibugEmuOnline.Client/Assets/Script/UI/BgSettingsUI/BgSettingItem.cs.meta rename to AxibugEmuOnline.Client/Assets/Script/UI/BgSettingsUI/BgSetting_Color.cs.meta diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/BgSettingsUI/SettingItemSelector.cs b/AxibugEmuOnline.Client/Assets/Script/UI/BgSettingsUI/SettingItemSelector.cs new file mode 100644 index 0000000..ed0569b --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/BgSettingsUI/SettingItemSelector.cs @@ -0,0 +1,13 @@ +using UnityEngine; + +namespace AxibugEmuOnline.Client +{ + public class SettingItemSelector : ItemSelector + { + protected override RectTransform OnGetTemplate(object data) + { + if (data is BgColorSettings) return ItemList[0]; + else return null; + } + } +} diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/BgSettingsUI/SettingItemSelector.cs.meta b/AxibugEmuOnline.Client/Assets/Script/UI/BgSettingsUI/SettingItemSelector.cs.meta new file mode 100644 index 0000000..1cb1d85 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/BgSettingsUI/SettingItemSelector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6e7f64bad63ce024eadbd9ddff940eee +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandExcuter.cs b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandExcuter.cs index ce71d3c..68f1825 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandExcuter.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandExcuter.cs @@ -12,9 +12,7 @@ namespace AxibugEmuOnline.Client private PulseInvoker m_pulsInvoker_Up; private PulseInvoker m_pulsInvoker_Down; - [SerializeField] float PulseInvoke_Delay = 0.4f; - [SerializeField] float PulseInvoke_Interval = 0.05f; public abstract bool Enable { get; } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/ItemPresent/ItemPresent.cs b/AxibugEmuOnline.Client/Assets/Script/UI/ItemPresent/ItemPresent.cs index 93f3eb8..f2ea41b 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/ItemPresent/ItemPresent.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/ItemPresent/ItemPresent.cs @@ -49,7 +49,7 @@ public class ItemPresent : GridLayoutGroup, IVirtualLayout { for (int i = 0; i < gap; i++) { - ItemProxy item = new ItemProxy(ItemTemplate, this); + ItemProxy item = new ItemProxy(this); children.Add(item); item.Width = cellSize.x; item.Height = cellSize.y; @@ -74,6 +74,11 @@ public class ItemPresent : GridLayoutGroup, IVirtualLayout private List handleChildren = new List(); private bool m_dataDirty; + private ItemSelector m_itemSelector; + protected override void Awake() + { + m_itemSelector = gameObject.GetComponent(); + } public override void CalculateLayoutInputHorizontal() { @@ -540,4 +545,10 @@ public class ItemPresent : GridLayoutGroup, IVirtualLayout return this.GetItemUIIfExist(dataIndex); } + + public RectTransform GetTemplate(object data) + { + if (m_itemSelector == null) return ItemTemplate; + else return m_itemSelector.GetItemTemplate(data); + } } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/ItemPresent/ItemProxy.cs b/AxibugEmuOnline.Client/Assets/Script/UI/ItemPresent/ItemProxy.cs index fe55287..6f60218 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/ItemPresent/ItemProxy.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/ItemPresent/ItemProxy.cs @@ -11,7 +11,7 @@ public interface IVirtualLayout public List DataList { get; } public object DependencyProperty { get; } public RectTransform RectTransform { get; } - + public RectTransform GetTemplate(object data); public Vector2 GetItemAnchorePos(int index); public RectTransform GetItemUIIfExist(int index); @@ -36,7 +36,7 @@ public class ItemProxy private IVirtualLayout _parent; - private RectTransform _template; + private RectTransform _template => _parent.GetTemplate(_parent.DataList[Index]); private RectTransform _runtimeInstance; private LayoutGroup _layoutElement; @@ -71,15 +71,11 @@ public class ItemProxy return lfi; } - private Vector2? _forcePivot; - public ItemProxy(RectTransform Template, IVirtualLayout parent, Vector2? forcePivot = null) + public ItemProxy(IVirtualLayout parent) { - _template = Template; _parent = parent; - _forcePivot = forcePivot; } - public void Dispose() { if (_runtimeInstance != null) @@ -140,10 +136,6 @@ public class ItemProxy _runtimeInstance.gameObject.SetActive(true); _runtimeInstance.anchorMax = Vector2.up; _runtimeInstance.anchorMin = Vector2.up; - if (_forcePivot != null) - { - _runtimeInstance.pivot = _forcePivot.Value; - } _runtimeInstance.anchoredPosition = AnchoredPosition; _runtimeInstance.sizeDelta = new Vector2(Width, Height); } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/ItemPresent/ItemSelector.cs b/AxibugEmuOnline.Client/Assets/Script/UI/ItemPresent/ItemSelector.cs new file mode 100644 index 0000000..9292bc6 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/ItemPresent/ItemSelector.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using UnityEngine; + +public abstract class ItemSelector : MonoBehaviour +{ + [SerializeField] + protected List ItemList; + + public RectTransform GetItemTemplate(object data) + { + return OnGetTemplate(data); + } + + protected abstract RectTransform OnGetTemplate(object data); +} + diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/ItemPresent/ItemSelector.cs.meta b/AxibugEmuOnline.Client/Assets/Script/UI/ItemPresent/ItemSelector.cs.meta new file mode 100644 index 0000000..71ee5a6 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/ItemPresent/ItemSelector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2c1183d0b3c0c5a4a8d3c4cf4c412ab9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs index 7f59fb4..1c2d95b 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs @@ -3,6 +3,8 @@ using System; using System.Collections.Generic; using System.Linq; using UnityEngine; +using UnityEngine.UI; +using static UnityEditor.Graphs.Styles; namespace AxibugEmuOnline.Client { @@ -126,7 +128,7 @@ namespace AxibugEmuOnline.Client } ControlScheme m_lastCS; - public void Pop(List menus, int defaultIndex = 0) + public void Pop(List menus, int defaultIndex = 0) where T : OptionMenu { ReleaseRuntimeMenus(); foreach (var menu in menus) CreateRuntimeMenuItem(menu); @@ -258,6 +260,9 @@ namespace AxibugEmuOnline.Client Name = name; Icon = icon; } + + public virtual void OnFocus() { } + public virtual void OnShow(OptionUI_MenuItem ui) { } } public abstract class ExecuteMenu : OptionMenu @@ -267,15 +272,6 @@ namespace AxibugEmuOnline.Client public abstract void OnExcute(); } - public abstract class ValueSetMenu : OptionMenu - { - public ValueSetMenu(string name) : base(name) { } - - public abstract Type ValueType { get; } - public abstract object ValueRaw { get; } - public abstract void OnValueChanged(object newValue); - } - public class ValueSetMenu : ValueSetMenu { public sealed override Type ValueType => typeof(T); @@ -290,4 +286,15 @@ namespace AxibugEmuOnline.Client } protected ValueSetMenu(string name) : base(name) { } } + + public abstract class ValueSetMenu : OptionMenu + { + public ValueSetMenu(string name) : base(name) { } + + public abstract Type ValueType { get; } + public abstract object ValueRaw { get; } + public abstract void OnValueChanged(object newValue); + } + + } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI_ExecuteItem.cs b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI_ExecuteItem.cs index b06669c..3069f47 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI_ExecuteItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI_ExecuteItem.cs @@ -6,9 +6,5 @@ namespace AxibugEmuOnline.Client { MenuData.OnExcute(); } - - public override void OnFocus() - { - } } } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI_MenuItem.cs b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI_MenuItem.cs index 7115085..7cf884e 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI_MenuItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI_MenuItem.cs @@ -12,6 +12,8 @@ namespace AxibugEmuOnline.Client [SerializeField] Text m_MenuNameTxt; [SerializeField] Image m_Icon; + public Image IconUI => m_Icon; + public bool Visible => m_Menu.Visible; protected OptionMenu m_Menu; @@ -24,13 +26,14 @@ namespace AxibugEmuOnline.Client else { m_Icon.gameObject.SetActiveEx(true); + m_Icon.SetMaterial(null); m_Icon.sprite = menuData.Icon; } OnSetData(menuData); } - protected virtual void OnSetData(OptionMenu menuData) { } + protected abstract void OnSetData(OptionMenu menuData); public abstract void OnExecute(); public abstract void OnFocus(); @@ -40,5 +43,15 @@ namespace AxibugEmuOnline.Client where T : OptionMenu { protected T MenuData => m_Menu as T; + + protected override void OnSetData(OptionMenu menuData) + { + MenuData.OnShow(this); + } + + public override void OnFocus() + { + MenuData.OnFocus(); + } } } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/UITool.cs b/AxibugEmuOnline.Client/Assets/Script/UI/UITool.cs new file mode 100644 index 0000000..0034716 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/UITool.cs @@ -0,0 +1,33 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +namespace AxibugEmuOnline.Client +{ + public static class UITool + { + private static Dictionary _caches = new Dictionary(); + + public static Material GetMaterial(this Graphic graphic) + { + if (_caches.TryGetValue(graphic, out var material)) + { + return material; + } + else + { + var cloneMat = Material.Instantiate(graphic.material); + _caches[graphic] = cloneMat; + graphic.material = cloneMat; + return cloneMat; + } + } + + public static void SetMaterial(this Graphic graphic, Material material) + { + graphic.material = material; + _caches.Remove(graphic); + } + } +} diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/UITool.cs.meta b/AxibugEmuOnline.Client/Assets/Script/UI/UITool.cs.meta new file mode 100644 index 0000000..6a5951b --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/UITool.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6afcd2bba4414a74db17de9347dbbcef +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/XMBBackGroundPreview.shader b/AxibugEmuOnline.Client/Assets/Script/UI/XMBBackGroundPreview.shader new file mode 100644 index 0000000..29e7079 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/XMBBackGroundPreview.shader @@ -0,0 +1,190 @@ +Shader "AxibugEmuOnline/XMBBackGroundPreview" +{ + Properties + { + _MainTex ("Sprite Texture", 2D) = "white" {} + _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 + + _ColorMask ("Color Mask", Float) = 15 + + + [Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0 + + [Space(10)] + _Color1("Color1",Color) = (0,0.4,1,1) + _Color2("Color2",Color) = (0,0.7,1,1) + + [Header(Wave1)] + _MidHeight1("MidHeight",Float) = 0.4 + _MaxHeight1("MaxHeigh",Float) = 0.5 + _Power1("Power",Float)=50.0 + _Frequency1("Frequency",Float)=2.0 + _Speed1("Speed",Float)=0.4 + + [Header(Wave2)] + _MidHeight2("MidHeight",Float) = 0.42 + _MaxHeight2("MaxHeigh",Float) = 0.54 + _Power2("Power",Float)=50.0 + _Frequency2("Frequency",Float)=2.1 + _Speed2("Speed",Float)=0.3 + } + + SubShader + { + Tags + { + "Queue"="Transparent" + "IgnoreProjector"="True" + "RenderType"="Transparent" + "PreviewType"="Plane" + "CanUseSpriteAtlas"="True" + } + + Stencil + { + Ref [_Stencil] + Comp [_StencilComp] + Pass [_StencilOp] + ReadMask [_StencilReadMask] + WriteMask [_StencilWriteMask] + } + + Cull Off + 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_local _ UNITY_UI_CLIP_RECT + #pragma multi_compile_local _ 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 + }; + + fixed4 _Color; + fixed4 _TextureSampleAdd; + float4 _ClipRect; + sampler2D _MainTex; + + float wave(float x, float frequency, float speed, float midHeight, float maxHeight) + { + return (sin(frequency * (x + speed * (((1. - (pow(cos(0.002 * (_Time.y + 400.)), 2.) + 1.) / 2.) + .1) * 2048.))) * (maxHeight - midHeight)) + midHeight; + } + float percentHigh(float currentY, float waveHeight, float maxHeight, float power) + { + float percentWave = max(waveHeight - currentY, 0.0) / maxHeight; + return pow(1.0 - percentWave, power); + } + float waveColor(float2 uv, float waveHeight, float maxHeight, float frequency, float power) + { + float percentWave = percentHigh(uv.y, waveHeight, maxHeight, power); + return clamp(percentWave + 0.8, 0.0, 1.0); + } + + 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 =v.texcoord; + + OUT.color = v.color * _Color; + return OUT; + } + + float3 _Color1; + float3 _Color2; + + float _MidHeight1; + float _MaxHeight1; + float _Power1; + float _Frequency1; + float _Speed1; + + float _MidHeight2; + float _MaxHeight2; + float _Power2; + float _Frequency2; + float _Speed2; + + fixed4 frag(v2f IN) : SV_Target + { + float2 uv= IN.texcoord; + // Lerped background + + float amount = (uv.x + uv.y) / 2.0; + float3 bg = lerp(_Color2, _Color1, amount); + + // Overlayed sine waves + float maxHeight1 = _MaxHeight1 + wave(0, 4.0,0.02, 0.0, 0.02); + float power1 = _Power1; //Higher power means thinner line + float frequency1 = _Frequency1 + wave(0.0, 3.0, 0.03, 0.0, 0.02); + float speed1 = _Speed1 + wave(0.0, 2.2, 0.04, 0.0, 0.01); + float waveHeight1 = wave(uv.x, frequency1, speed1, _MidHeight1, maxHeight1); + float waveCol1 = waveColor(uv, waveHeight1, maxHeight1, frequency1, power1); + + float midHeight2 = _MidHeight2; + float maxHeight2 = _MaxHeight2 + wave(0.0, 3.0, 0.04, 0.0, 0.02); + float power2 = _Power2; //Higher power means thinner line + float frequency2 = _Frequency2 + wave(0.0, 4.0, 0.05, 0.0, 0.02); + float speed2 = _Speed2 + wave(0.0, 2.0, 0.02, 0.0, 0.01); + float waveHeight2 = wave(uv.x, frequency2, speed2, midHeight2, maxHeight2); + float waveCol2 = waveColor(uv, waveHeight2, maxHeight2, frequency2, power2); + + float3 col = bg; + col = lerp(col, waveCol1 * col, step(uv.y, waveHeight1)); + col = lerp(col, waveCol2 * col, step(uv.y, waveHeight2)); + + // Output to screen + fixed4 fragColor = float4(col,1.0); + + #ifdef UNITY_UI_CLIP_RECT + fragColor.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect); + #endif + + #ifdef UNITY_UI_ALPHACLIP + clip (fragColor.a - 0.001); + #endif + + return fragColor; + } + + + + ENDCG + } + } +} \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/XMBBackGroundPreview.shader.meta b/AxibugEmuOnline.Client/Assets/Script/UI/XMBBackGroundPreview.shader.meta new file mode 100644 index 0000000..87eeb81 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/XMBBackGroundPreview.shader.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 424d88aff12857f4aab1911fdb6e02e9 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/XMBBgChanger.cs b/AxibugEmuOnline.Client/Assets/Script/UI/XMBBgChanger.cs new file mode 100644 index 0000000..414e2ba --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/XMBBgChanger.cs @@ -0,0 +1,33 @@ +using AxibugEmuOnline.Client.ClientCore; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; +using static UnityEditor.Graphs.Styles; + +namespace AxibugEmuOnline.Client +{ + public class XMBBgChanger : MonoBehaviour + { + public Image imgUI; + + private void OnEnable() + { + App.settings.BgColor.OnColorChanged += BgColor_OnColorChanged; + + imgUI.GetMaterial().SetColor("_Color1", App.settings.BgColor.CurrentColor.color1); + imgUI.GetMaterial().SetColor("_Color2", App.settings.BgColor.CurrentColor.color2); + } + + private void OnDisable() + { + App.settings.BgColor.OnColorChanged -= BgColor_OnColorChanged; + } + + private void BgColor_OnColorChanged(XMBColor color) + { + imgUI.GetMaterial().SetColor("_Color1", color.color1); + imgUI.GetMaterial().SetColor("_Color2", color.color2); + } + } +} diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/XMBBgChanger.cs.meta b/AxibugEmuOnline.Client/Assets/Script/UI/XMBBgChanger.cs.meta new file mode 100644 index 0000000..f8f33df --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/XMBBgChanger.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 34f3a870b3a425c4daead53193dcd9c2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: