修改Nes进入游戏流程
This commit is contained in:
parent
ee01724738
commit
70fcef886f
@ -441,10 +441,10 @@ RectTransform:
|
||||
m_Father: {fileID: 4232056520494431727}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 180, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 272, y: 240}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4232056521759880273
|
||||
CanvasRenderer:
|
||||
@ -466,7 +466,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Material: {fileID: 2100000, guid: 07e28fcb992bc124e986f9d8ff3beb97, 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}
|
||||
@ -474,7 +474,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Texture: {fileID: 8400000, guid: ffe34aaf87e4b9942b4c2ac05943d444, type: 2}
|
||||
m_Texture: {fileID: 0}
|
||||
m_UVRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
@ -229,7 +229,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 204, y: 488}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2800056879890978085
|
||||
|
@ -174,53 +174,9 @@ PrefabInstance:
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4232056521131536012, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
|
||||
propertyPath: RomName
|
||||
value: mario.nes
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4232056521131536013, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: NesEmulator
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4232056521759880274, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
|
||||
propertyPath: m_Enabled
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4232056521759880274, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
|
||||
propertyPath: m_Texture
|
||||
value:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4232056521759880274, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
|
||||
propertyPath: m_Material
|
||||
value:
|
||||
objectReference: {fileID: 2100000, guid: 07e28fcb992bc124e986f9d8ff3beb97, type: 2}
|
||||
- target: {fileID: 4232056521759880275, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
|
||||
propertyPath: m_AnchorMax.x
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4232056521759880275, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4232056521759880275, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
|
||||
propertyPath: m_AnchorMin.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4232056521759880275, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4232056521759880275, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4232056521759880275, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4232056521759880276, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: f8bea3f8aa351bb46ada33b2274729ea, type: 3}
|
||||
|
@ -5,34 +5,33 @@ namespace AxibugEmuOnline.Client.Manager
|
||||
{
|
||||
public class AppEmu
|
||||
{
|
||||
private GameObject m_emuInstance;
|
||||
|
||||
public void BeginGame(RomFile romFile)
|
||||
{
|
||||
if (InGameUI.Instance.Enable) return;
|
||||
if (m_emuInstance != null) return;
|
||||
|
||||
switch (romFile.Platform)
|
||||
{
|
||||
case EnumPlatform.NES:
|
||||
App.SceneLoader.BeginLoad("Scene/Emu_NES", () =>
|
||||
{
|
||||
var nesEmu = GameObject.FindObjectOfType<NesEmulator>();
|
||||
nesEmu.StartGame(romFile);
|
||||
var nesEmu = GameObject.Instantiate(Resources.Load<GameObject>("NES/NesEmulator")).GetComponent<NesEmulator>();
|
||||
m_emuInstance = nesEmu.gameObject;
|
||||
|
||||
LaunchUI.Instance.HideMainMenu();
|
||||
InGameUI.Instance.Show(romFile, nesEmu);
|
||||
});
|
||||
nesEmu.StartGame(romFile);
|
||||
LaunchUI.Instance.HideMainMenu();
|
||||
InGameUI.Instance.Show(romFile, nesEmu);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void StopGame()
|
||||
{
|
||||
if (!InGameUI.Instance.enabled) return;
|
||||
if (m_emuInstance == null) return;
|
||||
GameObject.Destroy(m_emuInstance);
|
||||
m_emuInstance = null;
|
||||
|
||||
App.SceneLoader.BeginLoad("Scene/AxibugEmuOnline.Client", () =>
|
||||
{
|
||||
InGameUI.Instance.Hide();
|
||||
LaunchUI.Instance.ShowMainMenu();
|
||||
});
|
||||
InGameUI.Instance.Hide();
|
||||
LaunchUI.Instance.ShowMainMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using AxibugEmuOnline.Client.Manager;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@ -9,17 +11,24 @@ namespace AxibugEmuOnline.Client
|
||||
|
||||
public RomFile RomFile => m_rom;
|
||||
public override bool Enable => gameObject.activeInHierarchy;
|
||||
|
||||
/// <summary> 指示该游戏实例是否处于联网模式 </summary>
|
||||
public bool IsOnline { get; private set; }
|
||||
|
||||
private RomFile m_rom;
|
||||
private object m_core;
|
||||
private object m_state;
|
||||
|
||||
private InGameUI_SaveState m_saveStateMenu;
|
||||
private InGameUI_LoadState m_loadStateMenu;
|
||||
private List<OptionMenu> menus = new List<OptionMenu>();
|
||||
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
gameObject.SetActiveEx(false);
|
||||
menus.Add(new InGameUI_SaveState(this));
|
||||
menus.Add(new InGameUI_LoadState(this));
|
||||
menus.Add(new InGameUI_QuitGame(this));
|
||||
base.Awake();
|
||||
}
|
||||
|
||||
@ -56,16 +65,12 @@ namespace AxibugEmuOnline.Client
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Show(RomFile currentRom, object core)
|
||||
{
|
||||
CommandDispatcher.Instance.RegistController(this);
|
||||
|
||||
m_saveStateMenu = new InGameUI_SaveState(this);
|
||||
m_loadStateMenu = new InGameUI_LoadState(this);
|
||||
|
||||
m_rom = currentRom;
|
||||
m_core = core;
|
||||
|
||||
@ -81,7 +86,12 @@ namespace AxibugEmuOnline.Client
|
||||
|
||||
protected override void OnCmdOptionMenu()
|
||||
{
|
||||
OptionUI.Instance.Pop(new List<OptionMenu> { m_saveStateMenu, m_loadStateMenu });
|
||||
OptionUI.Instance.Pop(menus);
|
||||
}
|
||||
|
||||
public void QuitGame()
|
||||
{
|
||||
App.emu.StopGame();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ namespace AxibugEmuOnline.Client
|
||||
public class InGameUI_LoadState : ExecuteMenu
|
||||
{
|
||||
private InGameUI m_gameUI;
|
||||
public override bool Visible => !m_gameUI.IsOnline;
|
||||
|
||||
public InGameUI_LoadState(InGameUI gameUI) : base("뗍혤우亮", null)
|
||||
{
|
||||
|
@ -0,0 +1,18 @@
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public class InGameUI_QuitGame : ExecuteMenu
|
||||
{
|
||||
private InGameUI m_gameUI;
|
||||
|
||||
|
||||
public InGameUI_QuitGame(InGameUI gameUI) : base("ÍËłö", null)
|
||||
{
|
||||
m_gameUI = gameUI;
|
||||
}
|
||||
|
||||
public override void OnExcute()
|
||||
{
|
||||
m_gameUI.QuitGame();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7689fa8f7ddd5654f914b93a4f0efada
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -9,6 +9,8 @@ namespace AxibugEmuOnline.Client
|
||||
{
|
||||
private InGameUI m_gameUI;
|
||||
|
||||
public override bool Visible => !m_gameUI.IsOnline;
|
||||
|
||||
public InGameUI_SaveState(InGameUI gameUI) : base("괏닸우亮", null)
|
||||
{
|
||||
m_gameUI = gameUI;
|
||||
|
@ -62,6 +62,54 @@ namespace AxibugEmuOnline.Client
|
||||
MenuRoot.anchoredPosition = temp;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
UpdateMenuState();
|
||||
}
|
||||
|
||||
private void UpdateMenuState()
|
||||
{
|
||||
bool dirty = false;
|
||||
foreach (var menuItem in m_runtimeMenuItems)
|
||||
{
|
||||
if (menuItem.gameObject.activeSelf != menuItem.Visible)
|
||||
{
|
||||
dirty = true;
|
||||
menuItem.gameObject.SetActive(menuItem.Visible);
|
||||
}
|
||||
}
|
||||
if (dirty)
|
||||
{
|
||||
if (m_runtimeMenuItems[SelectIndex].Visible == false)
|
||||
{
|
||||
bool find = false;
|
||||
int currentSelect = SelectIndex;
|
||||
while (currentSelect >= 0)
|
||||
{
|
||||
currentSelect--;
|
||||
if (m_runtimeMenuItems[currentSelect].Visible)
|
||||
{
|
||||
find = true;
|
||||
}
|
||||
}
|
||||
if (!find)
|
||||
{
|
||||
currentSelect = SelectIndex;
|
||||
while (currentSelect < m_runtimeMenuItems.Count)
|
||||
{
|
||||
if (m_runtimeMenuItems[currentSelect].Visible)
|
||||
{
|
||||
find = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (find)
|
||||
SelectIndex = currentSelect;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Pop(List<OptionMenu> menus, int defaultIndex = 0)
|
||||
{
|
||||
ReleaseRuntimeMenus();
|
||||
|
@ -12,6 +12,8 @@ namespace AxibugEmuOnline.Client
|
||||
[SerializeField] Text m_MenuNameTxt;
|
||||
[SerializeField] Image m_Icon;
|
||||
|
||||
public bool Visible => m_Menu.Visible;
|
||||
|
||||
protected OptionMenu m_Menu;
|
||||
|
||||
public void SetData(OptionMenu menuData)
|
||||
|
Loading…
Reference in New Issue
Block a user