From f22be7a34627e665392ec6d0d13c924b0afcab70 Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Fri, 19 Jul 2024 15:17:26 +0800 Subject: [PATCH] 123 --- .../Assets/Prefabs/NesCoreProxy.prefab | 83 ++++++++++++++++++- .../Emu/InputManager/NesJoyController.cs | 1 - .../Assets/Script/Emu/UguiVideoProvider.cs | 27 ++++-- 3 files changed, 102 insertions(+), 9 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Prefabs/NesCoreProxy.prefab b/AxibugEmuOnline.Client/Assets/Prefabs/NesCoreProxy.prefab index ae1a6d5..4494fbd 100644 --- a/AxibugEmuOnline.Client/Assets/Prefabs/NesCoreProxy.prefab +++ b/AxibugEmuOnline.Client/Assets/Prefabs/NesCoreProxy.prefab @@ -1,5 +1,84 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &1575933574 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1575933575} + - component: {fileID: 1575933577} + - component: {fileID: 1575933576} + m_Layer: 5 + m_Name: notify + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1575933575 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1575933574} + 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: 8662582775439058149} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 160, y: 30} + m_Pivot: {x: 0, y: 0} +--- !u!222 &1575933577 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1575933574} + m_CullTransparentMesh: 1 +--- !u!114 &1575933576 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1575933574} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, 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_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 6 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: --- !u!1 &319390252125274553 GameObject: m_ObjectHideFlags: 0 @@ -95,7 +174,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8662582774585465456} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} m_Name: @@ -313,6 +392,7 @@ MonoBehaviour: m_coreProxy: {fileID: 8662582775964487075} m_drawCanvas: {fileID: 8662582774585465454} m_fpsText: {fileID: 8662582775359084754} + m_nofity: {fileID: 1575933576} --- !u!1 &8662582775359084756 GameObject: m_ObjectHideFlags: 0 @@ -424,6 +504,7 @@ RectTransform: m_Children: - {fileID: 8662582774585465455} - {fileID: 8662582775359084755} + - {fileID: 1575933575} m_Father: {fileID: 7667066390141474019} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/AxibugEmuOnline.Client/Assets/Script/Emu/InputManager/NesJoyController.cs b/AxibugEmuOnline.Client/Assets/Script/Emu/InputManager/NesJoyController.cs index fa1c17a..e2666e0 100644 --- a/AxibugEmuOnline.Client/Assets/Script/Emu/InputManager/NesJoyController.cs +++ b/AxibugEmuOnline.Client/Assets/Script/Emu/InputManager/NesJoyController.cs @@ -1,5 +1,4 @@ using MyNes.Core; -using Unity.VisualScripting.YamlDotNet.Core.Tokens; namespace AxibugEmuOnline.Client { diff --git a/AxibugEmuOnline.Client/Assets/Script/Emu/UguiVideoProvider.cs b/AxibugEmuOnline.Client/Assets/Script/Emu/UguiVideoProvider.cs index a943b30..1470ff6 100644 --- a/AxibugEmuOnline.Client/Assets/Script/Emu/UguiVideoProvider.cs +++ b/AxibugEmuOnline.Client/Assets/Script/Emu/UguiVideoProvider.cs @@ -22,12 +22,15 @@ namespace AxibugEmuOnline.Client private RawImage m_drawCanvas; [SerializeField] private Text m_fpsText; + [SerializeField] + private Text m_nofity; private Color[] m_texRawBuffer = new Color[256 * 240]; private Texture2D m_rawBufferWarper; private RenderTexture m_drawRT; private Color temp = Color.white; + private bool toggleOn; public void Initialize() { @@ -48,26 +51,35 @@ namespace AxibugEmuOnline.Client public void Update() { - var colors = m_texRawBuffer; - m_rawBufferWarper.SetPixels(colors); - m_rawBufferWarper.Apply(); - Graphics.Blit(m_rawBufferWarper, m_drawCanvas.texture as RenderTexture); + if (toggleOn) + { + if (!m_drawCanvas.enabled) m_drawCanvas.enabled = true; + var colors = m_texRawBuffer; + m_rawBufferWarper.SetPixels(colors); + m_rawBufferWarper.Apply(); + Graphics.Blit(m_rawBufferWarper, m_drawCanvas.texture as RenderTexture); - m_fpsText.text = $"fps:{m_coreProxy.AudioCom.FPS:00.00}"; + m_fpsText.text = $"fps:{m_coreProxy.AudioCom.FPS:00.00}"; + } + else + { + if (m_drawCanvas.enabled) m_drawCanvas.enabled = false; + } } public void WriteErrorNotification(string message, bool instant) { - + m_nofity.text = message; } public void WriteInfoNotification(string message, bool instant) { - + m_nofity.text = message; } public void WriteWarningNotification(string message, bool instant) { + m_nofity.text = message; } public void TakeSnapshotAs(string path, string format) @@ -86,6 +98,7 @@ namespace AxibugEmuOnline.Client public void SignalToggle(bool started) { + toggleOn = started; } public void SubmitFrame(ref int[] buffer)