增加画面比例修改功能,以及配套的设置界面
This commit is contained in:
parent
f998fe6b76
commit
d5626f7a94
@ -97,6 +97,7 @@ RectTransform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 6774190055201401942}
|
||||
- {fileID: 7813729344275964042}
|
||||
- {fileID: 4804966765082268001}
|
||||
m_Father: {fileID: 5169543666820693527}
|
||||
@ -492,6 +493,81 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 4471d8231d16ba3469228e09d4cb3a81, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &8553047206489589253
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6774190055201401942}
|
||||
- component: {fileID: 3110729603451971289}
|
||||
- component: {fileID: 454445332755738332}
|
||||
m_Layer: 5
|
||||
m_Name: black
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &6774190055201401942
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8553047206489589253}
|
||||
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_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 8545038260809852605}
|
||||
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 &3110729603451971289
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8553047206489589253}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &454445332755738332
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8553047206489589253}
|
||||
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: 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: 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 &9087746359628224422
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -143,6 +143,81 @@ AudioSource:
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
--- !u!1 &1832378132020391456
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8057614414535643033}
|
||||
- component: {fileID: 377334483991090399}
|
||||
- component: {fileID: 4271988797887364570}
|
||||
m_Layer: 5
|
||||
m_Name: bg
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &8057614414535643033
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1832378132020391456}
|
||||
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_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4232056520494431727}
|
||||
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_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &377334483991090399
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1832378132020391456}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &4271988797887364570
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1832378132020391456}
|
||||
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: 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: 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 &3297772745682094737
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -346,6 +421,7 @@ RectTransform:
|
||||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 8057614414535643033}
|
||||
- {fileID: 4232056521759880275}
|
||||
- {fileID: 1038087993597378172}
|
||||
m_Father: {fileID: 4232056521131536011}
|
||||
|
@ -45,7 +45,7 @@ namespace AxibugEmuOnline.Client.ClientCore
|
||||
#else
|
||||
public static string PersistentDataPath => Application.persistentDataPath;
|
||||
#endif
|
||||
public static void Init(Initer initer, bool isTest = false, string testSrvIP = "")
|
||||
public static void Init( bool isTest = false, string testSrvIP = "")
|
||||
{
|
||||
//其他平台必要的初始化
|
||||
if (UnityEngine.Application.platform == RuntimePlatform.PSP2)
|
||||
@ -53,7 +53,7 @@ namespace AxibugEmuOnline.Client.ClientCore
|
||||
PSP2Init();
|
||||
}
|
||||
|
||||
settings = new AppSettings(initer);
|
||||
settings = new AppSettings();
|
||||
|
||||
log = new LogManager();
|
||||
LogManager.OnLog += OnNoSugarNetLog;
|
||||
@ -64,7 +64,7 @@ namespace AxibugEmuOnline.Client.ClientCore
|
||||
emu = new AppEmu();
|
||||
//netgame = new AppNetGame();
|
||||
httpAPI = new HttpAPI();
|
||||
nesRomLib = new RomLib(EnumPlatform.NES);
|
||||
nesRomLib = new RomLib(EnumSupportEmuPlatform.NES);
|
||||
CacheMgr = new CacheManager();
|
||||
roomMgr = new AppRoom();
|
||||
share = new AppShare();
|
||||
|
@ -17,9 +17,8 @@ namespace AxibugEmuOnline.Client
|
||||
void DoReset();
|
||||
IControllerSetuper GetControllerSetuper();
|
||||
|
||||
EnumPlatform Platform { get; }
|
||||
EnumSupportEmuPlatform Platform { get; }
|
||||
uint Frame { get; }
|
||||
Vector2Int GetRawResolution();
|
||||
}
|
||||
|
||||
public static class IEnumCoreTool
|
||||
|
@ -5,15 +5,15 @@ namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public class Initer : MonoBehaviour
|
||||
{
|
||||
public CanvasGroup FilterPreview => m_refs.FilterPreview;
|
||||
public CanvasGroup XMBBg => m_refs.XMBBg;
|
||||
static GlobalRef m_refs;
|
||||
public static CanvasGroup FilterPreview => m_refs.FilterPreview;
|
||||
public static CanvasGroup XMBBg => m_refs.XMBBg;
|
||||
|
||||
public static string dev_UUID;
|
||||
|
||||
[SerializeField]
|
||||
GameObject IMPORTENT;
|
||||
|
||||
GlobalRef m_refs;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public bool bTest = false;
|
||||
@ -21,16 +21,21 @@ namespace AxibugEmuOnline.Client
|
||||
#endif
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
m_refs = Instantiate(IMPORTENT, transform).GetComponent<GlobalRef>();
|
||||
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
App.Init(this, bTest, mTestSrvIP);
|
||||
App.Init(bTest, mTestSrvIP);
|
||||
#else
|
||||
App.Init(this);
|
||||
#endif
|
||||
dev_UUID = SystemInfo.deviceUniqueIdentifier;
|
||||
|
||||
m_refs = Instantiate(IMPORTENT, transform).GetComponent<GlobalRef>();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
App.settings.Filter.ShutDownFilterPreview();
|
||||
App.settings.Filter.ShutDownFilter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ namespace AxibugEmuOnline.Client.Manager
|
||||
if (!m_emuCore.IsNull()) StopGame();
|
||||
|
||||
var roomInfo = App.roomMgr.mineRoomMiniInfo;
|
||||
roomInfo.FetchRomFileInRoomInfo(EnumPlatform.NES, (_, romFile) =>
|
||||
roomInfo.FetchRomFileInRoomInfo(EnumSupportEmuPlatform.NES, (_, romFile) =>
|
||||
{
|
||||
if (!romFile.RomReady) //这个rom并没有下载,所以取消进入房间
|
||||
{
|
||||
@ -51,7 +51,7 @@ namespace AxibugEmuOnline.Client.Manager
|
||||
|
||||
switch (romFile.Platform)
|
||||
{
|
||||
case EnumPlatform.NES:
|
||||
case EnumSupportEmuPlatform.NES:
|
||||
m_emuCore = GameObject.Instantiate(Resources.Load<GameObject>("NES/NesEmulator")).GetComponent<IEmuCore>();
|
||||
break;
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
using static AxibugEmuOnline.Client.FilterManager;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public class AppSettings
|
||||
{
|
||||
@ -8,11 +6,14 @@ namespace AxibugEmuOnline.Client
|
||||
public BgColorSettings BgColor { get; private set; }
|
||||
/// <summary> 滤镜设置 </summary>
|
||||
public FilterManager Filter { get; private set; }
|
||||
/// <summary> 画面比例设置 </summary>
|
||||
public ScreenScaler ScreenScaler { get; private set; }
|
||||
|
||||
public AppSettings(Initer initer)
|
||||
public AppSettings()
|
||||
{
|
||||
BgColor = new BgColorSettings();
|
||||
Filter = new FilterManager(initer.FilterPreview, initer.XMBBg);
|
||||
Filter = new FilterManager();
|
||||
ScreenScaler = new ScreenScaler();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using Sony.Vita.Dialog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -12,7 +13,8 @@ namespace AxibugEmuOnline.Client
|
||||
public class FilterManager
|
||||
{
|
||||
private List<Filter> m_filters;
|
||||
private Dictionary<EnumPlatform, Filter> m_filterPlatforms = new Dictionary<EnumPlatform, Filter>();
|
||||
private Dictionary<EnumSupportEmuPlatform, Filter> m_filterPlatforms = new Dictionary<EnumSupportEmuPlatform, Filter>();
|
||||
|
||||
private AlphaWraper m_previewFilterWraper;
|
||||
FilterRomSetting m_filterRomSetting;
|
||||
/// <summary>
|
||||
@ -20,15 +22,11 @@ namespace AxibugEmuOnline.Client
|
||||
/// </summary>
|
||||
public IReadOnlyList<Filter> Filters => m_filters;
|
||||
|
||||
public FilterManager(CanvasGroup filterPreview, CanvasGroup mainBg)
|
||||
public FilterManager()
|
||||
{
|
||||
loadFilters();
|
||||
var json = PlayerPrefs.GetString(nameof(FilterRomSetting));
|
||||
m_filterRomSetting = JsonUtility.FromJson<FilterRomSetting>(json) ?? new FilterRomSetting();
|
||||
|
||||
m_previewFilterWraper = new AlphaWraper(mainBg, filterPreview, false);
|
||||
ShutDownFilterPreview();
|
||||
ShutDownFilter();
|
||||
}
|
||||
|
||||
private void loadFilters()
|
||||
@ -99,8 +97,8 @@ namespace AxibugEmuOnline.Client
|
||||
Vector2 topRight = RectTransformUtility.WorldToScreenPoint(rawImage.canvas.worldCamera, corners[2]);
|
||||
|
||||
// 计算宽度和高度
|
||||
float width = topRight.x - bottomLeft.x;
|
||||
float height = topRight.y - bottomLeft.y;
|
||||
float width = Mathf.Abs(topRight.x - bottomLeft.x);
|
||||
float height = Mathf.Abs(topRight.y - bottomLeft.y);
|
||||
|
||||
return new Vector2(width, height);
|
||||
}
|
||||
@ -109,12 +107,14 @@ namespace AxibugEmuOnline.Client
|
||||
/// <summary> 关闭滤镜预览 </summary>
|
||||
public void ShutDownFilterPreview()
|
||||
{
|
||||
if (m_previewFilterWraper == null) m_previewFilterWraper = new AlphaWraper(Initer.XMBBg, Initer.FilterPreview, false);
|
||||
m_previewFilterWraper.On = false;
|
||||
}
|
||||
|
||||
/// <summary> 开启滤镜预览 </summary>
|
||||
public void EnableFilterPreview()
|
||||
{
|
||||
if (m_previewFilterWraper == null) m_previewFilterWraper = new AlphaWraper(Initer.XMBBg, Initer.FilterPreview, false);
|
||||
m_previewFilterWraper.On = true;
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@ public class UIFilterPreviewer : MonoBehaviour
|
||||
|
||||
private void Update()
|
||||
{
|
||||
App.settings.ScreenScaler.CalcScale(m_rawImg);
|
||||
App.settings.Filter.ExecuteFilterRender(m_src, m_rawImg);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,112 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
/// <summary>
|
||||
/// 实现模拟器输出画面的比例调整类
|
||||
/// </summary>
|
||||
public class ScreenScaler
|
||||
{
|
||||
/// <summary>
|
||||
/// 全局设置的缩放模式
|
||||
/// </summary>
|
||||
public EnumScalerMode GlobalMode
|
||||
{
|
||||
get => (EnumScalerMode)PlayerPrefs.GetInt($"{nameof(ScreenScaler)}.GlobalMode", 0);
|
||||
set => PlayerPrefs.SetInt($"{nameof(ScreenScaler)}.GlobalMode", (int)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得指定平台设置的缩放模式
|
||||
/// </summary>
|
||||
/// <param name="platform"></param>
|
||||
/// <returns></returns>
|
||||
public EnumScalerMode GetMode(EnumSupportEmuPlatform platform)
|
||||
{
|
||||
int setVal = PlayerPrefs.GetInt($"{nameof(ScreenScaler)}.PlatMode.{platform}", -1);
|
||||
if (setVal == -1)
|
||||
return GlobalMode;
|
||||
else
|
||||
return (EnumScalerMode)setVal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据缩放模式设置UI的缩放
|
||||
/// </summary>
|
||||
/// <param name="m_rawImg"></param>
|
||||
/// <param name="platform">不指定模拟器平台时,使用全局设置的缩放模式</param>
|
||||
public void CalcScale(RawImage rawImg, EnumSupportEmuPlatform? platform = null)
|
||||
{
|
||||
var targetMode = platform == null ? GlobalMode : GetMode(platform.Value);
|
||||
var resolution = GetRawResolution(platform == null ? EnumSupportEmuPlatform.NES : platform.Value);
|
||||
var canvasRect = (rawImg.canvas.transform as RectTransform).rect;
|
||||
switch (targetMode)
|
||||
{
|
||||
case EnumScalerMode.Raw:
|
||||
{
|
||||
float width = resolution.x / rawImg.canvas.pixelRect.width * canvasRect.width;
|
||||
float height = resolution.y / rawImg.canvas.pixelRect.height * canvasRect.height;
|
||||
rawImg.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, width);
|
||||
rawImg.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, height);
|
||||
}
|
||||
break;
|
||||
case EnumScalerMode.Fix:
|
||||
{
|
||||
bool stretchWidth = rawImg.canvas.pixelRect.width <= rawImg.canvas.pixelRect.height;
|
||||
//bool stretchWidth = Mathf.Abs(resolution.x - rawImg.canvas.pixelRect.width) <= Mathf.Abs(resolution.y - rawImg.canvas.pixelRect.height);
|
||||
if (stretchWidth)
|
||||
{
|
||||
var needWidth = rawImg.canvas.pixelRect.width;
|
||||
var factor = needWidth / resolution.x;
|
||||
resolution.x = (int)needWidth;
|
||||
resolution.y = (int)(resolution.y * factor);
|
||||
}
|
||||
else
|
||||
{
|
||||
var needHeight = rawImg.canvas.pixelRect.height;
|
||||
var factor = needHeight / resolution.y;
|
||||
resolution.y = (int)needHeight;
|
||||
resolution.x = (int)(resolution.x * factor);
|
||||
}
|
||||
|
||||
float width = resolution.x / rawImg.canvas.pixelRect.width * canvasRect.width;
|
||||
float height = resolution.y / rawImg.canvas.pixelRect.height * canvasRect.height;
|
||||
rawImg.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, width);
|
||||
rawImg.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, height);
|
||||
}
|
||||
break;
|
||||
case EnumScalerMode.FullScreen:
|
||||
{
|
||||
rawImg.rectTransform.pivot = new Vector2(0.5f, 0.5f);
|
||||
rawImg.rectTransform.anchorMin = new Vector2(0, 0);
|
||||
rawImg.rectTransform.anchorMax = new Vector2(1, 1);
|
||||
rawImg.rectTransform.sizeDelta = new Vector2(0, 0);
|
||||
rawImg.rectTransform.anchoredPosition = new Vector2(0, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector2Int GetRawResolution(EnumSupportEmuPlatform platform)
|
||||
{
|
||||
switch (platform)
|
||||
{
|
||||
case EnumSupportEmuPlatform.NES: return new Vector2Int(256, 240);
|
||||
default: return new Vector2Int(256, 240);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> 缩放模式 </summary>
|
||||
public enum EnumScalerMode
|
||||
{
|
||||
/// <summary> 全屏 </summary>
|
||||
FullScreen,
|
||||
/// <summary> 适应 </summary>
|
||||
Fix,
|
||||
/// <summary> 原始 </summary>
|
||||
Raw
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8341bf735cdfe6e49b3fa43b9a42d711
|
@ -1,6 +1,6 @@
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public enum EnumPlatform
|
||||
public enum EnumSupportEmuPlatform
|
||||
{
|
||||
NES
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using ICSharpCode.SharpZipLib.Zip;
|
||||
using System;
|
||||
using System.Collections;
|
||||
@ -13,7 +13,7 @@ namespace AxibugEmuOnline.Client
|
||||
{
|
||||
private HttpAPI.Resp_RomInfo webData;
|
||||
private bool hasLocalFile;
|
||||
private EnumPlatform platform;
|
||||
private EnumSupportEmuPlatform platform;
|
||||
//private UnityWebRequest downloadRequest;
|
||||
private AxiHttpProxy.SendDownLoadProxy downloadRequest;
|
||||
|
||||
@ -36,7 +36,7 @@ namespace AxibugEmuOnline.Client
|
||||
public float Progress => IsDownloading ? downloadRequest.downloadHandler.DownLoadPr : 0;
|
||||
|
||||
|
||||
public EnumPlatform Platform => platform;
|
||||
public EnumSupportEmuPlatform Platform => platform;
|
||||
/// <summary> 指示该Rom信息是否已填充 </summary>
|
||||
public bool InfoReady => webData != null;
|
||||
/// <summary> 唯一标识 </summary>
|
||||
@ -61,7 +61,7 @@ namespace AxibugEmuOnline.Client
|
||||
public event Action<RomFile> OnDownloadOver;
|
||||
public event Action OnInfoFilled;
|
||||
|
||||
public RomFile(EnumPlatform platform, int index, int insidePage)
|
||||
public RomFile(EnumSupportEmuPlatform platform, int index, int insidePage)
|
||||
{
|
||||
this.platform = platform;
|
||||
Index = index;
|
||||
@ -181,7 +181,7 @@ namespace AxibugEmuOnline.Client
|
||||
}
|
||||
|
||||
private RomFile() { }
|
||||
public static RomFile CreateExistRom(EnumPlatform platform, string fileName)
|
||||
public static RomFile CreateExistRom(EnumSupportEmuPlatform platform, string fileName)
|
||||
{
|
||||
var res = new RomFile();
|
||||
res.IsUserRom = true;
|
||||
|
@ -19,14 +19,14 @@ namespace AxibugEmuOnline.Client
|
||||
private Dictionary<string, RomFile> nesRomFileNameMapper = new Dictionary<string, RomFile>();
|
||||
private HttpAPI.GetRomListAPI m_romGetFunc;
|
||||
private HttpAPI.SearchRomListAPI m_romSearchFunc;
|
||||
private EnumPlatform m_platform;
|
||||
private EnumSupportEmuPlatform m_platform;
|
||||
|
||||
public RomLib(EnumPlatform platform)
|
||||
public RomLib(EnumSupportEmuPlatform platform)
|
||||
{
|
||||
m_platform = platform;
|
||||
switch (platform)
|
||||
{
|
||||
case EnumPlatform.NES:
|
||||
case EnumSupportEmuPlatform.NES:
|
||||
m_romGetFunc = App.httpAPI.GetNesRomList;
|
||||
m_romSearchFunc = App.httpAPI.SearchNesRomList;
|
||||
break;
|
||||
|
@ -52,12 +52,13 @@ namespace AxibugEmuOnline.Client
|
||||
|
||||
var screenBuffer = NesCore.ppu.GetScreenPtr();
|
||||
VideoProvider.SetDrawData(screenBuffer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
VideoProvider.ApplyScreenScaler();
|
||||
VideoProvider.ApplyFilterEffect();
|
||||
}
|
||||
|
||||
public EnumPlatform Platform => EnumPlatform.NES;
|
||||
public EnumSupportEmuPlatform Platform => EnumSupportEmuPlatform.NES;
|
||||
private CoreSupporter m_coreSupporter;
|
||||
/// <summary>
|
||||
/// 指定ROM开始游戏
|
||||
@ -217,10 +218,5 @@ namespace AxibugEmuOnline.Client
|
||||
{
|
||||
return ControllerMapper;
|
||||
}
|
||||
|
||||
public Vector2Int GetRawResolution()
|
||||
{
|
||||
return new Vector2Int(256, 240);
|
||||
}
|
||||
}
|
||||
}
|
@ -82,6 +82,11 @@ namespace AxibugEmuOnline.Client
|
||||
App.settings.Filter.ExecuteFilterRender(rt_gpu, Image);
|
||||
}
|
||||
|
||||
public void ApplyScreenScaler()
|
||||
{
|
||||
App.settings.ScreenScaler.CalcScale(Image, EnumSupportEmuPlatform.NES);
|
||||
}
|
||||
|
||||
private unsafe void PrepareUI(uint* screenData)
|
||||
{
|
||||
if (GPUTurbo)
|
||||
|
@ -6,17 +6,6 @@ namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public class ScreenScalerListMenuItem : VirtualSubMenuItem
|
||||
{
|
||||
/// <summary> 缩放模式 </summary>
|
||||
public enum EnumScalerMode
|
||||
{
|
||||
/// <summary> 全屏 </summary>
|
||||
FullScreen,
|
||||
/// <summary> 适应 </summary>
|
||||
Fix,
|
||||
/// <summary> 原始 </summary>
|
||||
Raw
|
||||
};
|
||||
|
||||
public override bool OnEnterItem()
|
||||
{
|
||||
App.settings.Filter.EnableFilterPreview();
|
||||
@ -34,7 +23,7 @@ namespace AxibugEmuOnline.Client
|
||||
protected override void GetVirtualListDatas(Action<object> datas)
|
||||
{
|
||||
List<object> list = new List<object>();
|
||||
foreach (var enumValue in Enum.GetValues(typeof(EnumScalerMode))) list.Add(enumValue);
|
||||
foreach (var enumValue in Enum.GetValues(typeof(ScreenScaler.EnumScalerMode))) list.Add(enumValue);
|
||||
datas.Invoke(list);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AxibugEmuOnline.Client.UI;
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using AxibugEmuOnline.Client.UI;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
@ -8,27 +9,26 @@ namespace AxibugEmuOnline.Client
|
||||
public class UI_ScalerModeItem : MenuItem, IVirtualItem
|
||||
{
|
||||
public int Index { get; set; }
|
||||
public ScreenScalerListMenuItem.EnumScalerMode Datacontext { get; private set; }
|
||||
public ScreenScaler.EnumScalerMode Datacontext { get; private set; }
|
||||
|
||||
public void SetData(object data)
|
||||
{
|
||||
Datacontext = (ScreenScalerListMenuItem.EnumScalerMode)data;
|
||||
Datacontext = (ScreenScaler.EnumScalerMode)data;
|
||||
|
||||
UpdateView();
|
||||
}
|
||||
|
||||
private void UpdateView()
|
||||
{
|
||||
|
||||
switch (Datacontext)
|
||||
{
|
||||
case ScreenScalerListMenuItem.EnumScalerMode.FullScreen:
|
||||
case ScreenScaler.EnumScalerMode.FullScreen:
|
||||
SetBaseInfo("全屏", "模拟器输出画面将拉伸到全屏", null);
|
||||
break;
|
||||
case ScreenScalerListMenuItem.EnumScalerMode.Raw:
|
||||
case ScreenScaler.EnumScalerMode.Raw:
|
||||
SetBaseInfo("原始尺寸", "将保持模拟器输出画面的原始分辨率", null);
|
||||
break;
|
||||
case ScreenScalerListMenuItem.EnumScalerMode.Fix:
|
||||
case ScreenScaler.EnumScalerMode.Fix:
|
||||
SetBaseInfo("适应", "在保持原始画面比例的情况下适配到全屏", null);
|
||||
break;
|
||||
}
|
||||
@ -37,6 +37,12 @@ namespace AxibugEmuOnline.Client
|
||||
public void SetDependencyProperty(object data)
|
||||
{
|
||||
SetSelectState(data is ThirdMenuRoot && ((ThirdMenuRoot)data).SelectIndex == Index);
|
||||
|
||||
if (m_select)
|
||||
{
|
||||
App.settings.Filter.EnableFilterPreview();
|
||||
App.settings.ScreenScaler.GlobalMode = Datacontext;
|
||||
}
|
||||
}
|
||||
|
||||
public void Release() { }
|
||||
|
@ -8,7 +8,7 @@ namespace AxibugEmuOnline.Client
|
||||
public class RomListMenuItem : VirtualSubMenuItem
|
||||
{
|
||||
[SerializeField]
|
||||
protected EnumPlatform Platform;
|
||||
protected EnumSupportEmuPlatform Platform;
|
||||
|
||||
private RomLib RomLib
|
||||
{
|
||||
@ -16,7 +16,7 @@ namespace AxibugEmuOnline.Client
|
||||
{
|
||||
switch (Platform)
|
||||
{
|
||||
case EnumPlatform.NES:
|
||||
case EnumSupportEmuPlatform.NES:
|
||||
return App.nesRomLib;
|
||||
default:
|
||||
throw new System.NotImplementedException($"未实现的平台 {Platform}");
|
||||
|
@ -1,4 +1,4 @@
|
||||
using DG.Tweening;
|
||||
using DG.Tweening;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
using UnityEngine;
|
||||
|
@ -86,7 +86,7 @@ namespace AxibugEmuOnline.Client
|
||||
SetBaseInfo("--", $"<b>{hostNick}</b>的房间", $"{cur}/{max}");
|
||||
SetIcon(null);
|
||||
|
||||
roomInfo.FetchRomFileInRoomInfo(EnumPlatform.NES, (room, romFile) =>
|
||||
roomInfo.FetchRomFileInRoomInfo(EnumSupportEmuPlatform.NES, (room, romFile) =>
|
||||
{
|
||||
if (room.RoomID != RoomID) return;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using AxibugProtobuf;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -34,7 +34,7 @@ namespace AxibugEmuOnline.Client
|
||||
}
|
||||
|
||||
private static Dictionary<int, RomFile> s_RomFileCahcesInRoomInfo = new Dictionary<int, RomFile>();
|
||||
public static void FetchRomFileInRoomInfo(this Protobuf_Room_MiniInfo roomInfo, EnumPlatform platform, Action<Protobuf_Room_MiniInfo, RomFile> callback)
|
||||
public static void FetchRomFileInRoomInfo(this Protobuf_Room_MiniInfo roomInfo, EnumSupportEmuPlatform platform, Action<Protobuf_Room_MiniInfo, RomFile> callback)
|
||||
{
|
||||
RomFile romFile;
|
||||
|
||||
@ -45,10 +45,10 @@ namespace AxibugEmuOnline.Client
|
||||
}
|
||||
switch (platform)
|
||||
{
|
||||
case EnumPlatform.NES:
|
||||
case EnumSupportEmuPlatform.NES:
|
||||
App.StartCoroutine(App.httpAPI.GetNesRomInfo(roomInfo.GameRomID, (romWebData) =>
|
||||
{
|
||||
RomFile _romFile = new RomFile(EnumPlatform.NES, 0, 0);
|
||||
RomFile _romFile = new RomFile(EnumSupportEmuPlatform.NES, 0, 0);
|
||||
_romFile.SetWebData(romWebData);
|
||||
s_RomFileCahcesInRoomInfo[roomInfo.GameRomID] = _romFile;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user