forked from sin365/AxibugEmuOnline
Merge pull request 'master' (#35) from Alienjack/AxibugEmuOnline:master into master
Reviewed-on: sin365/AxibugEmuOnline#35
This commit is contained in:
commit
3927b897a2
@ -0,0 +1,50 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1963501579241001457
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1963501579241001456}
|
||||
- component: {fileID: 6933127467485204299}
|
||||
m_Layer: 5
|
||||
m_Name: InGameUI
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1963501579241001456
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1963501579241001457}
|
||||
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: 0}
|
||||
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: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &6933127467485204299
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1963501579241001457}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 6c4cbb81b8f22ed499382b6eb9e6299e, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 334eee9f85f308347844f8f5e99167c3
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -85,9 +85,9 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: fb4f275956ba18440b061e92278f13cd, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_menuItemRoot: {fileID: 7102897325704768026}
|
||||
PulseInvoke_Delay: 0.4
|
||||
PulseInvoke_Interval: 0.05
|
||||
m_menuItemRoot: {fileID: 7102897325704768026}
|
||||
GroupRoot: {fileID: 5247317738185020566}
|
||||
Template: {fileID: 2502609279043838113, guid: ece591129eb9bcc48bd83ec153c98018, type: 3}
|
||||
MenuSetting:
|
||||
@ -227,7 +227,7 @@ RectTransform:
|
||||
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_SizeDelta: {x: 0.00012207031, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &1639091783724093861
|
||||
CanvasRenderer:
|
||||
@ -319,6 +319,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
MainMenuRoot: {fileID: 1924338507}
|
||||
MainMenu: {fileID: 4533431376032812611}
|
||||
BG: {fileID: 1639091783724093860}
|
||||
m_detailLayoutPosition: {x: 55, y: -140}
|
||||
m_LayoutChangeSpeed: 1000
|
||||
--- !u!1 &3732356966700017678
|
||||
|
@ -377,7 +377,7 @@ MonoBehaviour:
|
||||
m_Right: 20
|
||||
m_Top: 20
|
||||
m_Bottom: 20
|
||||
m_ChildAlignment: 4
|
||||
m_ChildAlignment: 3
|
||||
m_Spacing: 12
|
||||
m_ChildForceExpandWidth: 0
|
||||
m_ChildForceExpandHeight: 0
|
||||
@ -494,7 +494,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: 400
|
||||
m_MinWidth: 300
|
||||
m_MinHeight: -1
|
||||
m_PreferredWidth: -1
|
||||
m_PreferredHeight: -1
|
||||
|
@ -1107,6 +1107,11 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3}
|
||||
--- !u!224 &1318590597 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 1963501579241001456, guid: 334eee9f85f308347844f8f5e99167c3, type: 3}
|
||||
m_PrefabInstance: {fileID: 1963501580473600373}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &1335662458
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -1305,7 +1310,7 @@ Canvas:
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_AdditionalShaderChannelsFlag: 1
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
m_SortingOrder: 1
|
||||
m_TargetDisplay: 0
|
||||
--- !u!224 &1599240741
|
||||
RectTransform:
|
||||
@ -1320,6 +1325,7 @@ RectTransform:
|
||||
m_Children:
|
||||
- {fileID: 1983793178}
|
||||
- {fileID: 246947326}
|
||||
- {fileID: 1318590597}
|
||||
m_Father: {fileID: 1335662459}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@ -1416,6 +1422,103 @@ RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3}
|
||||
m_PrefabInstance: {fileID: 730698711}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1001 &1963501580473600373
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 1599240741}
|
||||
m_Modifications:
|
||||
- target: {fileID: 1963501579241001456, guid: 334eee9f85f308347844f8f5e99167c3, type: 3}
|
||||
propertyPath: m_Pivot.x
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1963501579241001456, guid: 334eee9f85f308347844f8f5e99167c3, type: 3}
|
||||
propertyPath: m_Pivot.y
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1963501579241001456, guid: 334eee9f85f308347844f8f5e99167c3, type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1963501579241001456, guid: 334eee9f85f308347844f8f5e99167c3, type: 3}
|
||||
propertyPath: m_AnchorMax.x
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1963501579241001456, guid: 334eee9f85f308347844f8f5e99167c3, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1963501579241001456, guid: 334eee9f85f308347844f8f5e99167c3, type: 3}
|
||||
propertyPath: m_AnchorMin.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1963501579241001456, guid: 334eee9f85f308347844f8f5e99167c3, type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1963501579241001456, guid: 334eee9f85f308347844f8f5e99167c3, type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1963501579241001456, guid: 334eee9f85f308347844f8f5e99167c3, type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1963501579241001456, guid: 334eee9f85f308347844f8f5e99167c3, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1963501579241001456, guid: 334eee9f85f308347844f8f5e99167c3, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1963501579241001456, guid: 334eee9f85f308347844f8f5e99167c3, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1963501579241001456, guid: 334eee9f85f308347844f8f5e99167c3, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1963501579241001456, guid: 334eee9f85f308347844f8f5e99167c3, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1963501579241001456, guid: 334eee9f85f308347844f8f5e99167c3, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1963501579241001456, guid: 334eee9f85f308347844f8f5e99167c3, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1963501579241001456, guid: 334eee9f85f308347844f8f5e99167c3, type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1963501579241001456, guid: 334eee9f85f308347844f8f5e99167c3, type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1963501579241001456, guid: 334eee9f85f308347844f8f5e99167c3, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1963501579241001456, guid: 334eee9f85f308347844f8f5e99167c3, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1963501579241001456, guid: 334eee9f85f308347844f8f5e99167c3, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1963501579241001457, guid: 334eee9f85f308347844f8f5e99167c3, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: InGameUI
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 334eee9f85f308347844f8f5e99167c3, type: 3}
|
||||
--- !u!1001 &4478785627007410708
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -1587,5 +1690,17 @@ PrefabInstance:
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7896211045508186424, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
|
||||
propertyPath: m_Color.b
|
||||
value: 0.3773585
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7896211045508186424, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
|
||||
propertyPath: m_Color.g
|
||||
value: 0.16444026
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7896211045508186424, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
|
||||
propertyPath: m_Color.r
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
|
||||
|
@ -136,34 +136,5 @@ namespace AxibugEmuOnline.Client.ClientCore
|
||||
Debug.Log("[AxibugEmuOnline]:" + msg);
|
||||
}
|
||||
|
||||
private static RomFile m_currentGame;
|
||||
public static void BeginGame(RomFile romFile)
|
||||
{
|
||||
if (m_currentGame != null) return;
|
||||
|
||||
m_currentGame = romFile;
|
||||
|
||||
switch (romFile.Platform)
|
||||
{
|
||||
case EnumPlatform.NES:
|
||||
SceneLoader.BeginLoad("Scene/Emu_NES", () =>
|
||||
{
|
||||
LaunchUI.Instance.HideMainMenu();
|
||||
var nesEmu = GameObject.FindObjectOfType<NesEmulator>();
|
||||
nesEmu.StartGame(romFile);
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void StopGame()
|
||||
{
|
||||
if (m_currentGame == null) return;
|
||||
|
||||
SceneLoader.BeginLoad("Scene/AxibugEmuOnline.Client", () =>
|
||||
{
|
||||
LaunchUI.Instance.ShowMainMenu();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,38 @@
|
||||
namespace AxibugEmuOnline.Client.Manager
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AxibugEmuOnline.Client.Manager
|
||||
{
|
||||
public class AppEmu
|
||||
{
|
||||
public void BeginGame(RomFile romFile)
|
||||
{
|
||||
if (InGameUI.Instance.Enable) return;
|
||||
|
||||
switch (romFile.Platform)
|
||||
{
|
||||
case EnumPlatform.NES:
|
||||
App.SceneLoader.BeginLoad("Scene/Emu_NES", () =>
|
||||
{
|
||||
var nesEmu = GameObject.FindObjectOfType<NesEmulator>();
|
||||
nesEmu.StartGame(romFile);
|
||||
|
||||
LaunchUI.Instance.HideMainMenu();
|
||||
InGameUI.Instance.Show(romFile, nesEmu);
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void StopGame()
|
||||
{
|
||||
if (!InGameUI.Instance.enabled) return;
|
||||
|
||||
App.SceneLoader.BeginLoad("Scene/AxibugEmuOnline.Client", () =>
|
||||
{
|
||||
InGameUI.Instance.Hide();
|
||||
LaunchUI.Instance.ShowMainMenu();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,14 @@ namespace AxibugEmuOnline.Client
|
||||
|
||||
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdPing, OnCmdPing);
|
||||
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdPong, OnCmdPong);
|
||||
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorApplication.playModeStateChanged += (state) =>
|
||||
{
|
||||
if (state == UnityEditor.PlayModeStateChange.ExitingPlayMode)
|
||||
OnApplicationQuit();
|
||||
};
|
||||
#endif
|
||||
}
|
||||
float LastPingTime;
|
||||
private void Update()
|
||||
@ -46,11 +54,11 @@ namespace AxibugEmuOnline.Client
|
||||
{
|
||||
App.log.Debug("OnApplicationQuit");
|
||||
App.network.bAutoReConnect = false;
|
||||
|
||||
if (App.network.isConnected)
|
||||
{
|
||||
App.network.CloseConntect();
|
||||
}
|
||||
App.network.CancelReConnect();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,19 +1,18 @@
|
||||
using UnityEngine;
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using VirtualNes.Core.Debug;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public class CoreDebuger : IDebugerImpl
|
||||
{
|
||||
|
||||
public void Log(string message)
|
||||
{
|
||||
Debug.Log(message);
|
||||
App.log.Info(message);
|
||||
}
|
||||
|
||||
public void LogError(string message)
|
||||
{
|
||||
Debug.LogError(message);
|
||||
App.log.Error(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ namespace AxibugEmuOnline.Client
|
||||
public VideoProvider VideoProvider;
|
||||
public AudioProvider AudioProvider;
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Application.targetFrameRate = 60;
|
||||
@ -85,13 +86,6 @@ namespace AxibugEmuOnline.Client
|
||||
UnityEditor.EditorUtility.SetDirty(db);
|
||||
UnityEditor.AssetDatabase.SaveAssets();
|
||||
}
|
||||
|
||||
[ContextMenu("GetState")]
|
||||
public void GetState()
|
||||
{
|
||||
var state = NesCore.GetState();
|
||||
var bytes = state.ToBytes();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,6 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: a6a09b6a4cf4c2d4f994a13fd7e89d6f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
NesEmu: {fileID: 4232056521131536012}
|
||||
m_as: {fileID: 8726979175317618791}
|
||||
--- !u!82 &8726979175317618791
|
||||
AudioSource:
|
||||
@ -258,6 +257,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
NesEmu: {fileID: 4232056521131536012}
|
||||
DrawCanvas: {fileID: 4232056520494431724}
|
||||
Image: {fileID: 4232056521759880274}
|
||||
--- !u!1 &4232056520494431712
|
||||
GameObject:
|
||||
@ -308,7 +308,7 @@ Canvas:
|
||||
m_GameObject: {fileID: 4232056520494431712}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_RenderMode: 0
|
||||
m_RenderMode: 1
|
||||
m_Camera: {fileID: 0}
|
||||
m_PlaneDistance: 100
|
||||
m_PixelPerfect: 0
|
||||
@ -409,7 +409,6 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
VideoProvider: {fileID: 4232056520112715744}
|
||||
AudioProvider: {fileID: 9003897287163669553}
|
||||
RomName:
|
||||
--- !u!1 &4232056521759880276
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -8,6 +8,7 @@ namespace AxibugEmuOnline.Client
|
||||
public class VideoProvider : MonoBehaviour
|
||||
{
|
||||
public NesEmulator NesEmu;
|
||||
public Canvas DrawCanvas;
|
||||
|
||||
public RawImage Image;
|
||||
|
||||
@ -18,6 +19,11 @@ namespace AxibugEmuOnline.Client
|
||||
|
||||
private Texture2D pPal;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
DrawCanvas.worldCamera = Camera.main;
|
||||
}
|
||||
|
||||
public void SetDrawData(uint[] screenData, byte[] lineColorMode, int screenWidth, int screenHeight)
|
||||
{
|
||||
if (wrapTex == null)
|
||||
|
@ -109,15 +109,7 @@ namespace AxibugEmuOnline.Client.Network
|
||||
ReConnect();
|
||||
}
|
||||
|
||||
CancellationTokenSource cts;
|
||||
Task ReConnectTask;
|
||||
public void CancelReConnect()
|
||||
{
|
||||
App.log.Debug("CancelReConnect");
|
||||
cts?.Cancel();
|
||||
cts = null;
|
||||
ReConnectTask = null;
|
||||
}
|
||||
Thread ReConnectTask = null;
|
||||
/// <summary>
|
||||
/// 自动重连
|
||||
/// </summary>
|
||||
@ -125,8 +117,7 @@ namespace AxibugEmuOnline.Client.Network
|
||||
{
|
||||
if (ReConnectTask != null)
|
||||
return;
|
||||
cts = new CancellationTokenSource();
|
||||
ReConnectTask = new Task(() =>
|
||||
ReConnectTask = new Thread(() =>
|
||||
{
|
||||
bool bflagDone = false;
|
||||
do
|
||||
@ -142,10 +133,17 @@ namespace AxibugEmuOnline.Client.Network
|
||||
App.log.Info($"触发重连后的自动逻辑!");
|
||||
OnReConnected?.Invoke();
|
||||
}
|
||||
} while (!bflagDone);
|
||||
} while (!bflagDone && App.network.bAutoReConnect);
|
||||
|
||||
if (!App.network.bAutoReConnect)
|
||||
{
|
||||
if (App.network.isConnected)
|
||||
{
|
||||
App.network.CloseConntect();
|
||||
}
|
||||
}
|
||||
ReConnectTask = null;
|
||||
cts = null;
|
||||
}, cts.Token);
|
||||
});
|
||||
ReConnectTask.Start();
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
executionOrder: -50
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
|
8
AxibugEmuOnline.Client/Assets/Script/UI/InGameUI.meta
Normal file
8
AxibugEmuOnline.Client/Assets/Script/UI/InGameUI.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f12f7770db8ede41906b080df9cbec0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
56
AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI.cs
Normal file
56
AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI.cs
Normal file
@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public class InGameUI : CommandExecuter
|
||||
{
|
||||
|
||||
public static InGameUI Instance { get; private set; }
|
||||
|
||||
public RomFile RomFile => m_rom;
|
||||
public override bool Enable => gameObject.activeInHierarchy;
|
||||
private RomFile m_rom;
|
||||
private object m_core;
|
||||
|
||||
private InGameUI_SaveState m_saveMenu;
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
gameObject.SetActiveEx(false);
|
||||
base.Awake();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
|
||||
public T GetCore<T>() => (T)m_core;
|
||||
|
||||
public void Show(RomFile currentRom, object core)
|
||||
{
|
||||
m_saveMenu = new InGameUI_SaveState(this);
|
||||
CommandDispatcher.Instance.RegistController(this);
|
||||
|
||||
m_rom = currentRom;
|
||||
m_core = core;
|
||||
gameObject.SetActiveEx(true);
|
||||
}
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
CommandDispatcher.Instance.UnRegistController(this);
|
||||
|
||||
m_rom = null;
|
||||
m_core = null;
|
||||
gameObject.SetActiveEx(false);
|
||||
}
|
||||
|
||||
protected override void OnCmdOptionMenu()
|
||||
{
|
||||
OptionUI.Instance.Pop(new List<OptionMenu> { m_saveMenu });
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6c4cbb81b8f22ed499382b6eb9e6299e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,29 @@
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public class InGameUI_SaveState : ExecuteMenu
|
||||
{
|
||||
private InGameUI m_gameUI;
|
||||
|
||||
public InGameUI_SaveState(InGameUI gameUI) : base("괏닸우亮", null)
|
||||
{
|
||||
m_gameUI = gameUI;
|
||||
}
|
||||
|
||||
public override void OnExcute()
|
||||
{
|
||||
Stopwatch sw = Stopwatch.StartNew();
|
||||
switch (m_gameUI.RomFile.Platform)
|
||||
{
|
||||
case EnumPlatform.NES:
|
||||
var state = m_gameUI.GetCore<NesEmulator>().NesCore.GetState();
|
||||
App.log.Info($"{m_gameUI.RomFile.Platform}===>우亮댕鬼{state.ToBytes().Length}");
|
||||
break;
|
||||
}
|
||||
sw.Stop();
|
||||
App.log.Info($"{m_gameUI.RomFile.Platform}====>삿혤우亮봬珂:{sw.Elapsed.TotalMilliseconds}ms");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a9b3cce3fed9054d9bcf411a142f9d7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -3,6 +3,7 @@ using DG.Tweening;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
@ -12,6 +13,8 @@ namespace AxibugEmuOnline.Client
|
||||
RectTransform MainMenuRoot;
|
||||
[SerializeField]
|
||||
MainMenuController MainMenu;
|
||||
[SerializeField]
|
||||
Image BG;
|
||||
|
||||
Vector2 m_mainLayoutPosition;
|
||||
[SerializeField]
|
||||
@ -26,19 +29,19 @@ namespace AxibugEmuOnline.Client
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
DontDestroyOnLoad(this);
|
||||
DontDestroyOnLoad(Camera.main.gameObject);
|
||||
m_mainLayoutPosition = MainMenuRoot.anchoredPosition;
|
||||
MainMenu.ListenControlAction = true;
|
||||
}
|
||||
|
||||
public void HideMainMenu()
|
||||
{
|
||||
BG.gameObject.SetActiveEx(false);
|
||||
MainMenuRoot.gameObject.SetActiveEx(false);
|
||||
}
|
||||
|
||||
public void ShowMainMenu()
|
||||
{
|
||||
BG.gameObject.SetActiveEx(true);
|
||||
MainMenuRoot.gameObject.SetActiveEx(true);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
using DG.Tweening;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
@ -23,7 +22,7 @@ namespace AxibugEmuOnline.Client
|
||||
public override bool Enable => m_bPoped;
|
||||
|
||||
private bool m_bPoped = false;
|
||||
private List<MonoBehaviour> m_runtimeMenuItems = new List<MonoBehaviour>();
|
||||
private List<OptionUI_MenuItem> m_runtimeMenuItems = new List<OptionUI_MenuItem>();
|
||||
|
||||
private int m_selectIndex = -1;
|
||||
public int SelectIndex
|
||||
@ -36,7 +35,9 @@ namespace AxibugEmuOnline.Client
|
||||
|
||||
m_selectIndex = value;
|
||||
|
||||
var itemUIRect = m_runtimeMenuItems[m_selectIndex].transform as RectTransform;
|
||||
OptionUI_MenuItem optionUI_MenuItem = m_runtimeMenuItems[m_selectIndex];
|
||||
optionUI_MenuItem.OnFocus();
|
||||
var itemUIRect = optionUI_MenuItem.transform as RectTransform;
|
||||
SelectBorder.pivot = itemUIRect.pivot;
|
||||
SelectBorder.sizeDelta = itemUIRect.rect.size;
|
||||
DOTween.To(() => SelectBorder.position, (value) => SelectBorder.position = value, itemUIRect.position, 0.125f);
|
||||
@ -61,21 +62,7 @@ namespace AxibugEmuOnline.Client
|
||||
MenuRoot.anchoredPosition = temp;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.T))
|
||||
{
|
||||
if (m_bPoped) Hide();
|
||||
else Pop(new List<OptionMenu>
|
||||
{
|
||||
new ExecuteMenu("²âÊԲ˵¥1"),
|
||||
new ExecuteMenu("Copilot"),
|
||||
new ExecuteMenu("ChatGPT 4o"),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void Pop(IEnumerable<OptionMenu> menus)
|
||||
public void Pop(List<OptionMenu> menus, int defaultIndex = 0)
|
||||
{
|
||||
ReleaseRuntimeMenus();
|
||||
foreach (var menu in menus) CreateRuntimeMenuItem(menu);
|
||||
@ -85,7 +72,9 @@ namespace AxibugEmuOnline.Client
|
||||
Canvas.ForceUpdateCanvases();
|
||||
|
||||
m_selectIndex = 0;
|
||||
var itemUIRect = m_runtimeMenuItems[m_selectIndex].transform as RectTransform;
|
||||
OptionUI_MenuItem optionUI_MenuItem = m_runtimeMenuItems[defaultIndex];
|
||||
optionUI_MenuItem.OnFocus();
|
||||
var itemUIRect = optionUI_MenuItem.transform as RectTransform;
|
||||
SelectBorder.pivot = itemUIRect.pivot;
|
||||
SelectBorder.position = itemUIRect.position;
|
||||
SelectBorder.sizeDelta = itemUIRect.rect.size;
|
||||
@ -161,6 +150,18 @@ namespace AxibugEmuOnline.Client
|
||||
{
|
||||
SelectIndex--;
|
||||
}
|
||||
|
||||
protected override void OnCmdBack()
|
||||
{
|
||||
Hide();
|
||||
}
|
||||
|
||||
protected override bool OnCmdEnter()
|
||||
{
|
||||
m_runtimeMenuItems[SelectIndex].OnExecute();
|
||||
Hide();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class OptionMenu
|
||||
|
@ -1,22 +1,14 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public class OptionUI_ExecuteItem : MonoBehaviour
|
||||
public class OptionUI_ExecuteItem : OptionUI_MenuItem<ExecuteMenu>
|
||||
{
|
||||
[SerializeField] Text m_MenuNameTxt;
|
||||
[SerializeField] Image m_Icon;
|
||||
public override void OnExecute()
|
||||
{
|
||||
MenuData.OnExcute();
|
||||
}
|
||||
|
||||
public void SetData(ExecuteMenu executeMenu)
|
||||
public override void OnFocus()
|
||||
{
|
||||
m_MenuNameTxt.text = executeMenu.Name;
|
||||
if (executeMenu.Icon == null) m_Icon.gameObject.SetActiveEx(false);
|
||||
else
|
||||
{
|
||||
m_Icon.gameObject.SetActiveEx(true);
|
||||
m_Icon.sprite = executeMenu.Icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public abstract class OptionUI_MenuItem : MonoBehaviour
|
||||
{
|
||||
[SerializeField] Text m_MenuNameTxt;
|
||||
[SerializeField] Image m_Icon;
|
||||
|
||||
protected OptionMenu m_Menu;
|
||||
|
||||
public void SetData(OptionMenu menuData)
|
||||
{
|
||||
m_Menu = menuData;
|
||||
m_MenuNameTxt.text = menuData.Name;
|
||||
if (menuData.Icon == null) m_Icon.gameObject.SetActiveEx(false);
|
||||
else
|
||||
{
|
||||
m_Icon.gameObject.SetActiveEx(true);
|
||||
m_Icon.sprite = menuData.Icon;
|
||||
}
|
||||
|
||||
OnSetData(menuData);
|
||||
}
|
||||
|
||||
protected virtual void OnSetData(OptionMenu menuData) { }
|
||||
|
||||
public abstract void OnExecute();
|
||||
public abstract void OnFocus();
|
||||
}
|
||||
|
||||
public abstract class OptionUI_MenuItem<T> : OptionUI_MenuItem
|
||||
where T : OptionMenu
|
||||
{
|
||||
protected T MenuData => m_Menu as T;
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8bba0d5ebcd10fb459209fb11e4d274d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -82,7 +82,7 @@ namespace AxibugEmuOnline.Client
|
||||
}
|
||||
else
|
||||
{
|
||||
App.BeginGame(m_romfile);
|
||||
App.emu.BeginGame(m_romfile);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -2,18 +2,22 @@
|
||||
{
|
||||
public struct BLOCKHDR : IStateBufferObject
|
||||
{
|
||||
public readonly bool Valid => !string.IsNullOrEmpty(ID);
|
||||
public string ID;
|
||||
public ushort Reserved;
|
||||
public ushort BlockVersion;
|
||||
public uint BlockSize;
|
||||
|
||||
public readonly void SaveState(StateBuffer buffer)
|
||||
{
|
||||
if (Valid)
|
||||
{
|
||||
buffer.Write(ID);
|
||||
buffer.Write(Reserved);
|
||||
buffer.Write(BlockVersion);
|
||||
buffer.Write(BlockSize);
|
||||
}
|
||||
}
|
||||
|
||||
public readonly uint GetSize()
|
||||
{
|
||||
|
@ -42,35 +42,59 @@ namespace VirtualNes.Core
|
||||
|
||||
HEADER.SaveState(buffer);
|
||||
|
||||
if (regBLOCK.Valid)
|
||||
{
|
||||
regBLOCK.SaveState(buffer);
|
||||
reg.SaveState(buffer);
|
||||
}
|
||||
|
||||
if (regBLOCK.Valid)
|
||||
{
|
||||
ramBLOCK.SaveState(buffer);
|
||||
ram.SaveState(buffer);
|
||||
}
|
||||
|
||||
if (WRAM != null) buffer.Write(WRAM);
|
||||
|
||||
if (mmuBLOCK.Valid)
|
||||
{
|
||||
mmuBLOCK.SaveState(buffer);
|
||||
mmu.SaveState(buffer);
|
||||
buffer.Write(CPU_MEM_BANK.ToArray());
|
||||
buffer.Write(VRAM);
|
||||
buffer.Write(CRAM.ToArray());
|
||||
}
|
||||
|
||||
if (mmcBLOCK.Valid)
|
||||
{
|
||||
mmcBLOCK.SaveState(buffer);
|
||||
mmc.SaveState(buffer);
|
||||
}
|
||||
|
||||
if (ctrBLOCK.Valid)
|
||||
{
|
||||
ctrBLOCK.SaveState(buffer);
|
||||
ctr.SaveState(buffer);
|
||||
}
|
||||
|
||||
if (sndBLOCK.Valid)
|
||||
{
|
||||
sndBLOCK.SaveState(buffer);
|
||||
snd.SaveState(buffer);
|
||||
}
|
||||
|
||||
if (dskBLOCK.Valid)
|
||||
{
|
||||
dskBLOCK.SaveState(buffer);
|
||||
dsk.SaveState(buffer);
|
||||
buffer.Write(dskdata);
|
||||
}
|
||||
|
||||
if (exctrBLOCK.Valid)
|
||||
{
|
||||
exctrBLOCK.SaveState(buffer);
|
||||
exctr.SaveState(buffer);
|
||||
}
|
||||
|
||||
return buffer.Data.ToArray();
|
||||
}
|
||||
|
@ -56,6 +56,8 @@ namespace VirtualNes.Core
|
||||
}
|
||||
public void Write(string value)
|
||||
{
|
||||
if (value == null) return;
|
||||
|
||||
Write(Encoding.ASCII.GetBytes(value));
|
||||
}
|
||||
public void Write(double value)
|
||||
|
Loading…
Reference in New Issue
Block a user