Compare commits
5 Commits
fe616214a9
...
e9428e2cc6
Author | SHA1 | Date | |
---|---|---|---|
e9428e2cc6 | |||
|
c5ff8fd4ae | ||
|
7123103fd6 | ||
|
839a711637 | ||
|
0506120ede |
@ -1,5 +1,6 @@
|
|||||||
using AxibugEmuOnline.Client.ClientCore;
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
using AxibugEmuOnline.Client.Event;
|
using AxibugEmuOnline.Client.Event;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace AxibugEmuOnline.Client
|
namespace AxibugEmuOnline.Client
|
||||||
@ -11,7 +12,7 @@ namespace AxibugEmuOnline.Client
|
|||||||
public RomFile RomFile => m_rom;
|
public RomFile RomFile => m_rom;
|
||||||
public override bool Enable => gameObject.activeInHierarchy;
|
public override bool Enable => gameObject.activeInHierarchy;
|
||||||
|
|
||||||
/// <summary> 指示该游戏实例是否处于联机模式 </summary>
|
/// <summary> 指示该游戏实例是否处于联机模式 </summary>
|
||||||
public bool IsNetPlay
|
public bool IsNetPlay
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -53,13 +54,13 @@ namespace AxibugEmuOnline.Client
|
|||||||
base.OnDestroy();
|
base.OnDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> 保存快速快照 </summary>
|
/// <summary> 保存快速快照 </summary>
|
||||||
public void SaveQuickState(object state)
|
public void SaveQuickState(object state)
|
||||||
{
|
{
|
||||||
m_state = state;
|
m_state = state;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 读取快速快照
|
/// 读取快速快照
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
@ -68,21 +69,31 @@ namespace AxibugEmuOnline.Client
|
|||||||
return m_state;
|
return m_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool m_delayCreateRoom;
|
||||||
public void Show(RomFile currentRom, IEmuCore core)
|
public void Show(RomFile currentRom, IEmuCore core)
|
||||||
{
|
{
|
||||||
m_state = null;//清空游戏快照
|
m_delayCreateRoom = false;
|
||||||
|
m_state = null;//清空游戏快照
|
||||||
CommandDispatcher.Instance.RegistController(this);
|
CommandDispatcher.Instance.RegistController(this);
|
||||||
|
|
||||||
m_rom = currentRom;
|
m_rom = currentRom;
|
||||||
Core = core;
|
Core = core;
|
||||||
m_stepPerformer.Reset();
|
m_stepPerformer.Reset();
|
||||||
|
|
||||||
if (App.user.IsLoggedIn && !App.roomMgr.InRoom)
|
if (!App.roomMgr.InRoom)
|
||||||
{
|
{
|
||||||
App.roomMgr.SendCreateRoom(m_rom.ID, 0, m_rom.Hash);
|
if (App.user.IsLoggedIn)
|
||||||
|
App.roomMgr.SendCreateRoom(m_rom.ID, 0, m_rom.Hash);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_delayCreateRoom = true;
|
||||||
|
OverlayManager.PopTip("稍后将会建立房间");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Eventer.Instance.RegisterEvent(EEvent.OnLoginSucceed, OnLoggedIn);
|
||||||
Eventer.Instance.RegisterEvent<int>(EEvent.OnRoomWaitStepChange, OnServerStepUpdate);
|
Eventer.Instance.RegisterEvent<int>(EEvent.OnRoomWaitStepChange, OnServerStepUpdate);
|
||||||
|
Eventer.Instance.RegisterEvent(EEvent.OnMineJoinRoom, OnRoomJoin);
|
||||||
|
|
||||||
gameObject.SetActiveEx(true);
|
gameObject.SetActiveEx(true);
|
||||||
|
|
||||||
@ -97,6 +108,19 @@ namespace AxibugEmuOnline.Client
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnRoomJoin()
|
||||||
|
{
|
||||||
|
m_delayCreateRoom = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnLoggedIn()
|
||||||
|
{
|
||||||
|
if (m_delayCreateRoom)
|
||||||
|
{
|
||||||
|
App.roomMgr.SendCreateRoom(m_rom.ID, 0, m_rom.Hash);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void OnServerStepUpdate(int step)
|
private void OnServerStepUpdate(int step)
|
||||||
{
|
{
|
||||||
m_stepPerformer.Perform(step);
|
m_stepPerformer.Perform(step);
|
||||||
@ -114,23 +138,21 @@ namespace AxibugEmuOnline.Client
|
|||||||
{
|
{
|
||||||
OverlayManager.PopSideBar(menus, 0, PopMenu_OnHide);
|
OverlayManager.PopSideBar(menus, 0, PopMenu_OnHide);
|
||||||
|
|
||||||
if (!IsNetPlay)//单人模式暂停模拟器
|
if (!IsNetPlay)//单人模式暂停模拟器
|
||||||
{
|
|
||||||
Core.Pause();
|
Core.Pause();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//菜单关闭时候
|
//菜单关闭时候
|
||||||
private void PopMenu_OnHide()
|
private void PopMenu_OnHide()
|
||||||
{
|
{
|
||||||
if (!IsNetPlay)//单人模式恢复模拟器的暂停
|
if (!IsNetPlay)//单人模式恢复模拟器的暂停
|
||||||
Core.Resume();
|
Core.Resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void QuitGame()
|
public void QuitGame()
|
||||||
{
|
{
|
||||||
Eventer.Instance.UnregisterEvent<int>(EEvent.OnRoomWaitStepChange, OnServerStepUpdate);
|
Eventer.Instance.UnregisterEvent<int>(EEvent.OnRoomWaitStepChange, OnServerStepUpdate);
|
||||||
|
Eventer.Instance.UnregisterEvent(EEvent.OnLoginSucceed, OnLoggedIn);
|
||||||
|
Eventer.Instance.UnregisterEvent(EEvent.OnMineJoinRoom, OnRoomJoin);
|
||||||
App.roomMgr.SendLeavnRoom();
|
App.roomMgr.SendLeavnRoom();
|
||||||
App.emu.StopGame();
|
App.emu.StopGame();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
using AxibugEmuOnline.Client.ClientCore;
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using UnityEditor.Presets;
|
||||||
|
using UnityEngine;
|
||||||
|
using VirtualNes.Core;
|
||||||
using static AxibugEmuOnline.Client.FilterManager;
|
using static AxibugEmuOnline.Client.FilterManager;
|
||||||
|
|
||||||
namespace AxibugEmuOnline.Client
|
namespace AxibugEmuOnline.Client
|
||||||
@ -9,14 +12,34 @@ namespace AxibugEmuOnline.Client
|
|||||||
{
|
{
|
||||||
private InGameUI m_gameUI;
|
private InGameUI m_gameUI;
|
||||||
|
|
||||||
public InGameUI_FilterSetting(InGameUI gameUI) : base("Â˾µ", null)
|
public InGameUI_FilterSetting(InGameUI gameUI) : base("滤镜", null)
|
||||||
{
|
{
|
||||||
m_gameUI = gameUI;
|
m_gameUI = gameUI;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override List<OptionMenu> GetOptionMenus()
|
protected override List<OptionMenu> GetOptionMenus()
|
||||||
{
|
{
|
||||||
return App.filter.Filters.Select(f => new FilterMenu(m_gameUI.RomFile, f) as OptionMenu).ToList();
|
List<OptionMenu> menus = new List<OptionMenu>();
|
||||||
|
menus.Add(new FilterNone(m_gameUI.RomFile));
|
||||||
|
menus.AddRange(App.filter.Filters.Select(f => new FilterMenu(m_gameUI.RomFile, f) as OptionMenu));
|
||||||
|
return menus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FilterNone : ExecuteMenu
|
||||||
|
{
|
||||||
|
private RomFile m_rom;
|
||||||
|
|
||||||
|
public FilterNone(RomFile rom) : base("取消滤镜", null)
|
||||||
|
{
|
||||||
|
m_rom = rom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnExcute(OptionUI optionUI, ref bool cancelHide)
|
||||||
|
{
|
||||||
|
App.filter.ShutDownFilter();
|
||||||
|
|
||||||
|
App.filter.SetupFilter(m_rom, null, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FilterMenu : ExpandMenu
|
public class FilterMenu : ExpandMenu
|
||||||
|
Loading…
Reference in New Issue
Block a user