迭代
This commit is contained in:
parent
63f65b89c9
commit
4a7b6c1458
@ -1,65 +1,65 @@
|
||||
#define TRACE
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MyNes.Core
|
||||
{
|
||||
public sealed class Tracer
|
||||
{
|
||||
public static event EventHandler<TracerEventArgs> EventRaised;
|
||||
public static event EventHandler<TracerEventArgs> EventRaised;
|
||||
|
||||
public static void WriteLine(string message)
|
||||
{
|
||||
Tracer.EventRaised?.Invoke(null, new TracerEventArgs(message, TracerStatus.Normal));
|
||||
Trace.WriteLine(message);
|
||||
}
|
||||
public static void WriteLine(string message)
|
||||
{
|
||||
Tracer.EventRaised?.Invoke(null, new TracerEventArgs(message, TracerStatus.Normal));
|
||||
Debug.Log(message);
|
||||
}
|
||||
|
||||
public static void WriteLine(string message, string category)
|
||||
{
|
||||
Tracer.EventRaised?.Invoke(null, new TracerEventArgs($"{category}: {message}", TracerStatus.Normal));
|
||||
Trace.WriteLine($"{category}: {message}");
|
||||
}
|
||||
public static void WriteLine(string message, string category)
|
||||
{
|
||||
Tracer.EventRaised?.Invoke(null, new TracerEventArgs($"{category}: {message}", TracerStatus.Normal));
|
||||
Debug.Log(message);
|
||||
}
|
||||
|
||||
public static void WriteLine(string message, TracerStatus status)
|
||||
{
|
||||
Tracer.EventRaised?.Invoke(null, new TracerEventArgs(message, status));
|
||||
Trace.WriteLine(message);
|
||||
}
|
||||
public static void WriteLine(string message, TracerStatus status)
|
||||
{
|
||||
Tracer.EventRaised?.Invoke(null, new TracerEventArgs(message, status));
|
||||
Debug.Log(message);
|
||||
}
|
||||
|
||||
public static void WriteLine(string message, string category, TracerStatus status)
|
||||
{
|
||||
Tracer.EventRaised?.Invoke(null, new TracerEventArgs($"{category}: {message}", status));
|
||||
Trace.WriteLine($"{category}: {message}");
|
||||
}
|
||||
public static void WriteLine(string message, string category, TracerStatus status)
|
||||
{
|
||||
Tracer.EventRaised?.Invoke(null, new TracerEventArgs($"{category}: {message}", status));
|
||||
Debug.Log($"{category}:{message}");
|
||||
}
|
||||
|
||||
public static void WriteError(string message)
|
||||
{
|
||||
WriteLine(message, TracerStatus.Error);
|
||||
}
|
||||
public static void WriteError(string message)
|
||||
{
|
||||
WriteLine(message, TracerStatus.Error);
|
||||
}
|
||||
|
||||
public static void WriteError(string message, string category)
|
||||
{
|
||||
WriteLine(message, category, TracerStatus.Error);
|
||||
}
|
||||
public static void WriteError(string message, string category)
|
||||
{
|
||||
WriteLine(message, category, TracerStatus.Error);
|
||||
}
|
||||
|
||||
public static void WriteWarning(string message)
|
||||
{
|
||||
WriteLine(message, TracerStatus.Warning);
|
||||
}
|
||||
public static void WriteWarning(string message)
|
||||
{
|
||||
WriteLine(message, TracerStatus.Warning);
|
||||
}
|
||||
|
||||
public static void WriteWarning(string message, string category)
|
||||
{
|
||||
WriteLine(message, category, TracerStatus.Warning);
|
||||
}
|
||||
public static void WriteWarning(string message, string category)
|
||||
{
|
||||
WriteLine(message, category, TracerStatus.Warning);
|
||||
}
|
||||
|
||||
public static void WriteInformation(string message)
|
||||
{
|
||||
WriteLine(message, TracerStatus.Infromation);
|
||||
}
|
||||
public static void WriteInformation(string message)
|
||||
{
|
||||
WriteLine(message, TracerStatus.Infromation);
|
||||
}
|
||||
|
||||
public static void WriteInformation(string message, string category)
|
||||
{
|
||||
WriteLine(message, category, TracerStatus.Infromation);
|
||||
}
|
||||
public static void WriteInformation(string message, string category)
|
||||
{
|
||||
WriteLine(message, category, TracerStatus.Infromation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -122,6 +122,50 @@ NavMeshSettings:
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &258485946
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 258485947}
|
||||
- component: {fileID: 258485948}
|
||||
m_Layer: 0
|
||||
m_Name: NesCoreProxy
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &258485947
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 258485946}
|
||||
serializedVersion: 2
|
||||
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: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &258485948
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 258485946}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ac8cd27a180bf3e489b2ca27c821bffe, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &708549044
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -314,3 +358,4 @@ SceneRoots:
|
||||
m_Roots:
|
||||
- {fileID: 1232273654}
|
||||
- {fileID: 708549046}
|
||||
- {fileID: 258485947}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "AxibugEmuOnline.Client",
|
||||
"rootNamespace": "",
|
||||
"rootNamespace": "AxibugEmuOnline.Client",
|
||||
"references": [
|
||||
"GUID:0c194730510bd1b4fad0398ccfe4235b"
|
||||
],
|
||||
|
@ -11,146 +11,12 @@ namespace AxibugEmuOnline.Client.Manager
|
||||
{
|
||||
public class AppEmu
|
||||
{
|
||||
INes _nes;
|
||||
|
||||
public static WINSettings Settings { get; private set; }
|
||||
|
||||
private bool isMaxing;
|
||||
|
||||
private bool isMoving;
|
||||
|
||||
private bool pausedByMainWindow;
|
||||
|
||||
private bool isMouseVisible;
|
||||
|
||||
private int mouseHiderCounter;
|
||||
|
||||
private const int mouseHiderReload = 1;
|
||||
|
||||
private bool gameLoaded;
|
||||
|
||||
private IContainer components;
|
||||
|
||||
public AppEmu()
|
||||
{
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
_nes = new INes();
|
||||
MyNesMain.Initialize(setupRenderers: false);
|
||||
MyNesMain.SetVideoProvider();
|
||||
MyNesMain.SetAudioProvider();
|
||||
MyNesMain.SetRenderingMethods();
|
||||
}
|
||||
|
||||
internal void LoadGame(string filePath)
|
||||
{
|
||||
bool success = false;
|
||||
switch (Path.GetExtension(filePath).ToLower())
|
||||
{
|
||||
case ".nes":
|
||||
NesEmu.LoadGame(filePath, out success);
|
||||
break;
|
||||
case ".7z":
|
||||
case ".zip":
|
||||
case ".rar":
|
||||
case ".gzip":
|
||||
case ".tar":
|
||||
case ".bzip2":
|
||||
case ".xz":
|
||||
{
|
||||
string text = filePath;
|
||||
string text2 = Path.GetTempPath() + "\\MYNES\\";
|
||||
SevenZipExtractor sevenZipExtractor;
|
||||
try
|
||||
{
|
||||
sevenZipExtractor = new SevenZipExtractor(text);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(Resources.Message35 + ": \n" + ex.Message);
|
||||
return;
|
||||
}
|
||||
if (sevenZipExtractor.ArchiveFileData.Count == 1)
|
||||
{
|
||||
if (sevenZipExtractor.ArchiveFileData[0].FileName.Substring(sevenZipExtractor.ArchiveFileData[0].FileName.Length - 4, 4).ToLower() == ".nes")
|
||||
{
|
||||
sevenZipExtractor.ExtractArchive(text2);
|
||||
text = text2 + sevenZipExtractor.ArchiveFileData[0].FileName;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
foreach (ArchiveFileInfo archiveFileDatum in sevenZipExtractor.ArchiveFileData)
|
||||
{
|
||||
list.Add(archiveFileDatum.FileName);
|
||||
}
|
||||
FormFilesList formFilesList = new FormFilesList(list.ToArray());
|
||||
if (formFilesList.ShowDialog(this) != DialogResult.OK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string[] fileNames = new string[1] { formFilesList.SelectedRom };
|
||||
sevenZipExtractor.ExtractFiles(text2, fileNames);
|
||||
text = text2 + formFilesList.SelectedRom;
|
||||
}
|
||||
|
||||
NesEmu.LoadGame(text, out success);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (success)
|
||||
{
|
||||
if (Settings.Misc_RecentFiles == null)
|
||||
{
|
||||
Settings.Misc_RecentFiles = new string[0];
|
||||
}
|
||||
List<string> list2 = new List<string>(Settings.Misc_RecentFiles);
|
||||
if (list2.Contains(filePath))
|
||||
{
|
||||
list2.Remove(filePath);
|
||||
}
|
||||
list2.Insert(0, filePath);
|
||||
if (list2.Count > 19)
|
||||
{
|
||||
list2.RemoveAt(list2.Count - 1);
|
||||
}
|
||||
Settings.Misc_RecentFiles = list2.ToArray();
|
||||
gameLoaded = true;
|
||||
if (Settings.Win_StartInFullscreen)
|
||||
{
|
||||
if (base.WindowState != FormWindowState.Maximized)
|
||||
{
|
||||
MyNesMain.VideoProvider.ResizeBegin();
|
||||
Thread.Sleep(100);
|
||||
MyNesMain.RendererSettings.Vid_Fullscreen = true;
|
||||
base.FormBorderStyle = FormBorderStyle.None;
|
||||
menuStrip1.Visible = false;
|
||||
base.WindowState = FormWindowState.Maximized;
|
||||
MyNesMain.VideoProvider.ResizeEnd();
|
||||
}
|
||||
}
|
||||
else if (MyNesMain.RendererSettings.Vid_AutoStretch)
|
||||
{
|
||||
ApplyStretch(applyRegion: true);
|
||||
}
|
||||
}
|
||||
ApplyWindowTitle();
|
||||
}
|
||||
|
||||
|
||||
#region Setting
|
||||
|
||||
internal void LoadSettings()
|
||||
{
|
||||
base.Location = new Point(Program.Settings.Win_Location_X, Program.Settings.Win_Location_Y);
|
||||
base.Size = new Size(Program.Settings.Win_Size_W, Program.Settings.Win_Size_H);
|
||||
for (int i = 0; i < Program.SupportedLanguages.Length / 3; i++)
|
||||
{
|
||||
ToolStripMenuItem toolStripMenuItem = new ToolStripMenuItem();
|
||||
toolStripMenuItem.Text = Program.SupportedLanguages[i, 2];
|
||||
toolStripMenuItem.Checked = Program.SupportedLanguages[i, 0] == Program.Settings.InterfaceLanguage;
|
||||
interfaceLanguageToolStripMenuItem.DropDownItems.Add(toolStripMenuItem);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
17
AxibugEmuOnline.Client/Assets/Script/NesCoreProxy.cs
Normal file
17
AxibugEmuOnline.Client/Assets/Script/NesCoreProxy.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using AxibugEmuOnline.Client.Manager;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public class NesCoreProxy : MonoBehaviour
|
||||
{
|
||||
private AppEmu m_appEnum = new AppEmu();
|
||||
|
||||
private void Start()
|
||||
{
|
||||
m_appEnum.Init();
|
||||
}
|
||||
}
|
||||
}
|
11
AxibugEmuOnline.Client/Assets/Script/NesCoreProxy.cs.meta
Normal file
11
AxibugEmuOnline.Client/Assets/Script/NesCoreProxy.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ac8cd27a180bf3e489b2ca27c821bffe
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user