Compare commits

...

7 Commits

Author SHA1 Message Date
bf028d6302 Merge pull request 'master' (#32) from Alienjack/AxibugEmuOnline:master into master
Reviewed-on: #32
2024-09-11 18:12:50 +08:00
ALIENJACK\alien
95bcf0e5bf Merge branch 'master' of http://git.axibug.com/sin365/AxibugEmuOnline
# Conflicts:
#	AxibugEmuOnline.Client/Assets/Plugins/Demigiant/DOTween/DOTween.dll.meta
2024-09-11 18:12:08 +08:00
ALIENJACK\alien
8dea4ccee1 dotween dll 提交 2024-09-11 18:11:23 +08:00
ALIENJACK\alien
c3804940a9 增加了移除Cache和Rom文件的api 2024-09-11 16:48:23 +08:00
ALIENJACK\alien
f36ec11af8 Merge branch 'master' of http://git.axibug.com/sin365/AxibugEmuOnline 2024-09-11 16:34:01 +08:00
ALIENJACK\alien
c0585283a7 UI迭代 2024-09-11 16:33:48 +08:00
ALIENJACK\alien
8f23ef3b19 dotween dll meta 2024-09-04 11:39:22 +08:00
21 changed files with 690 additions and 80 deletions

View File

@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: a811bde74b26b53498b4f6d872b09b6d
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

View File

@ -222,6 +222,157 @@ Animator:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0
--- !u!1 &1252956242765037133
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 88397014911048519}
- component: {fileID: 3360692256366003092}
- component: {fileID: 6259552039526853317}
m_Layer: 5
m_Name: Downloading
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &88397014911048519
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1252956242765037133}
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:
- {fileID: 1356745056984945386}
m_Father: {fileID: 8105925540140519754}
m_RootOrder: 2
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 &3360692256366003092
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1252956242765037133}
m_CullTransparentMesh: 1
--- !u!114 &6259552039526853317
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1252956242765037133}
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: 0.53333336}
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 &1760891290906570025
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7286174480513024547}
- component: {fileID: 8465840075520521938}
- component: {fileID: 5960295925543634495}
m_Layer: 5
m_Name: Background
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7286174480513024547
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1760891290906570025}
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: 1356745056984945386}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.25}
m_AnchorMax: {x: 1, y: 0.75}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8465840075520521938
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1760891290906570025}
m_CullTransparentMesh: 1
--- !u!114 &5960295925543634495
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1760891290906570025}
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.6556604, g: 0.8499731, b: 1, 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: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
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 &1776357407830023228
GameObject:
m_ObjectHideFlags: 0
@ -297,6 +448,117 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &2160152188869765819
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8088221278067224827}
- component: {fileID: 7021285932952529020}
- component: {fileID: 373824653597363199}
m_Layer: 5
m_Name: Fill
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8088221278067224827
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2160152188869765819}
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: 4825215963562112837}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 10, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7021285932952529020
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2160152188869765819}
m_CullTransparentMesh: 1
--- !u!114 &373824653597363199
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2160152188869765819}
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.39235067, b: 1, 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: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
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 &2807279088801569631
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4825215963562112837}
m_Layer: 5
m_Name: Fill Area
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &4825215963562112837
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2807279088801569631}
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:
- {fileID: 8088221278067224827}
m_Father: {fileID: 1356745056984945386}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.25}
m_AnchorMax: {x: 1, y: 0.75}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -10, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &3189920797946144379
GameObject:
m_ObjectHideFlags: 0
@ -357,6 +619,9 @@ MonoBehaviour:
SelectScale: 1
UnSelectScale: 0.8
m_romImage: {fileID: 67125096702760250}
DownloadingFlag: {fileID: 1252956242765037133}
DownProgress: {fileID: 1484915906009859069}
FileReadyFlag: {fileID: 6316945668089981796}
--- !u!114 &5700455559359757662
MonoBehaviour:
m_ObjectHideFlags: 0
@ -524,6 +789,8 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 6087025893861054323}
- {fileID: 1361359478345282377}
- {fileID: 88397014911048519}
m_Father: {fileID: 8754483333502849411}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -649,6 +916,170 @@ MonoBehaviour:
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: NAME
--- !u!1 &5537066628246125853
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1356745056984945386}
- component: {fileID: 1484915906009859069}
m_Layer: 5
m_Name: Slider
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1356745056984945386
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5537066628246125853}
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:
- {fileID: 7286174480513024547}
- {fileID: 4825215963562112837}
m_Father: {fileID: 88397014911048519}
m_RootOrder: 0
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.0001}
m_SizeDelta: {x: 160, y: 68.2756}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1484915906009859069
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5537066628246125853}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 67db9e8f0e2ae9c40bc1e2b64352a6b4, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 0
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 0
m_TargetGraphic: {fileID: 0}
m_FillRect: {fileID: 8088221278067224827}
m_HandleRect: {fileID: 0}
m_Direction: 0
m_MinValue: 0
m_MaxValue: 1
m_WholeNumbers: 0
m_Value: 0
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
--- !u!1 &6316945668089981796
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1361359478345282377}
- component: {fileID: 1381140245428399030}
- component: {fileID: 7474552512404188589}
m_Layer: 5
m_Name: RomReady
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1361359478345282377
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6316945668089981796}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -2}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 8105925540140519754}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -12, y: -21}
m_SizeDelta: {x: 48.3195, y: 40.7695}
m_Pivot: {x: 1, y: 1}
--- !u!222 &1381140245428399030
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6316945668089981796}
m_CullTransparentMesh: 1
--- !u!114 &7474552512404188589
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6316945668089981796}
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.22587347, b: 1, 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: 734113830533174147, guid: d518d00d4940e854bbe45d9ef891401a, type: 3}
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 &8290338740711049006
GameObject:
m_ObjectHideFlags: 0

View File

@ -194,9 +194,29 @@ PrefabInstance:
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: 256
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

View File

@ -87,5 +87,35 @@ 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();
});
}
}
}

View File

@ -9,9 +9,8 @@ namespace AxibugEmuOnline.Client
{
public class AppSceneLoader
{
public LoadTask CurrentTask { get; private set; }
Queue<LoadTask> m_tasks = new Queue<LoadTask>();
Coroutine m_coroutine;
public void BeginLoad(string scenePath, Action callback)
@ -65,7 +64,7 @@ namespace AxibugEmuOnline.Client
{
State = EnumTaskState.Complete;
}
return true;
}
else

View File

@ -18,6 +18,13 @@ namespace AxibugEmuOnline.Client
GetCacheData(url, TextureCacheDirPath, callback);
}
/// <summary> 移除文件缓存 </summary>
public void ClearCaches()
{
if (Directory.Exists(CacheDirPath))
Directory.Delete(CacheDirPath, true);
}
IEnumerator DownloadFromURL(string url, string path, Action<byte[]> callback)
{
var request = UnityWebRequest.Get($"{AppAxibugEmuOnline.httpAPI.DownSite}/{url}");
@ -39,6 +46,7 @@ namespace AxibugEmuOnline.Client
if (cachesInMemory.TryGetValue(url, out var cacheObj) && cacheObj is T obj)
{
callback.Invoke(obj, url);
return;
}
var fileName = $"{url.GetHashCode()}";

View File

@ -3,7 +3,6 @@ using ICSharpCode.SharpZipLib.Zip;
using System;
using System.Collections;
using System.IO;
using UnityEngine;
using UnityEngine.Networking;
namespace AxibugEmuOnline.Client
@ -14,14 +13,17 @@ namespace AxibugEmuOnline.Client
private bool hasLocalFile;
private string fileName;
private EnumPlatform platform;
private UnityWebRequest downloadRequest;
/// <summary> 指示该Rom文件的存放路径 </summary>
public string LocalFilePath => $"{AppAxibugEmuOnline.PersistentDataPath}/RemoteRoms/{platform}/{fileName}";
/// <summary> 指示该Rom文件是否已下载完毕 </summary>
public bool RomReady => hasLocalFile;
/// <summary> 指示是否正在下载Rom文件 </summary>
public bool IsDownloading { get; private set; }
public bool IsDownloading => downloadRequest != null && downloadRequest.result == UnityWebRequest.Result.InProgress;
public float Progress => IsDownloading ? downloadRequest.downloadProgress : 0;
public EnumPlatform Platform => platform;
/// <summary> 指示该Rom信息是否已填充 </summary>
public bool InfoReady => webData != null;
/// <summary> 唯一标识 </summary>
@ -55,11 +57,8 @@ namespace AxibugEmuOnline.Client
if (RomReady) return;
if (IsDownloading) return;
IsDownloading = true;
AppAxibugEmuOnline.StartCoroutine(DownloadRemoteRom((bytes) =>
{
IsDownloading = false;
if (bytes != null)
{
var directPath = Path.GetDirectoryName(LocalFilePath);
@ -107,16 +106,16 @@ namespace AxibugEmuOnline.Client
private IEnumerator DownloadRemoteRom(Action<byte[]> callback)
{
UnityWebRequest uwr = UnityWebRequest.Get($"{AppAxibugEmuOnline.httpAPI.DownSite}/{webData.url}");
yield return uwr.SendWebRequest();
downloadRequest = UnityWebRequest.Get($"{AppAxibugEmuOnline.httpAPI.DownSite}/{webData.url}");
yield return downloadRequest.SendWebRequest();
if (uwr.result != UnityWebRequest.Result.Success)
if (downloadRequest.result != UnityWebRequest.Result.Success)
{
callback(null);
}
else
{
callback(uwr.downloadHandler.data);
callback(downloadRequest.downloadHandler.data);
}
}

View File

@ -1,6 +1,8 @@
using AxibugEmuOnline.Client.ClientCore;
using Codice.Client.Common;
using System;
using System.Collections.Generic;
using System.IO;
using static AxibugEmuOnline.Client.HttpAPI;
namespace AxibugEmuOnline.Client
@ -36,6 +38,20 @@ namespace AxibugEmuOnline.Client
return romFile;
}
/// <summary> 清除所有下载的Rom文件 </summary>
public void ClearRomFile()
{
var path = $"{AppAxibugEmuOnline.PersistentDataPath}/RemoteRoms/{m_platform}";
if (Directory.Exists(path)) Directory.Delete(path, true);
}
/// <summary> 移除一个已下载的Rom </summary>
public void RemoveOneRomFile(RomFile romFile)
{
if (romFile.RomReady)
File.Delete(romFile.LocalFilePath);
}
/// <summary>
/// 获得所有Rom文件
/// </summary>

View File

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using UnityEngine;
@ -50,23 +49,32 @@ namespace AxibugEmuOnline.Client
m_register.Remove(menuItemController);
}
readonly List<MenuItemController> oneFrameRegister = new List<MenuItemController>();
private void Update()
{
foreach (var item in m_keyMapper)
{
if (Input.GetKeyDown(item.Key))
{
for (int i = 0; i < m_register.Count; i++)
oneFrameRegister.Clear();
oneFrameRegister.AddRange(m_register);
for (int i = 0; i < oneFrameRegister.Count; i++)
{
var controller = m_register[i];
var controller = oneFrameRegister[i];
if (!controller.enabled) continue;
controller.ExecuteCommand(item.Value, false);
}
}
if (Input.GetKeyUp(item.Key))
{
for (int i = 0; i < m_register.Count; i++)
oneFrameRegister.Clear();
oneFrameRegister.AddRange(m_register);
for (int i = 0; i < oneFrameRegister.Count; i++)
{
var controller = m_register[i];
var controller = oneFrameRegister[i];
if (!controller.enabled) continue;
controller.ExecuteCommand(item.Value, true);
}
}

View File

@ -3,7 +3,6 @@ using DG.Tweening;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
using UnityEngine;
using static Codice.Client.BaseCommands.Import.Commit;
using App = AxibugEmuOnline.Client.ClientCore.AppAxibugEmuOnline;
namespace AxibugEmuOnline.Client
@ -39,7 +38,7 @@ namespace AxibugEmuOnline.Client
});
}
public override void OnEnterItem()
public override bool OnEnterItem()
{
RomGroupRoot.gameObject.SetActive(true);
RomGroupRoot.alpha = 0;
@ -51,6 +50,8 @@ namespace AxibugEmuOnline.Client
}
m_showTween = DOTween.To(() => RomGroupRoot.alpha, (x) => RomGroupRoot.alpha = x, 1, 0.2f);
var thirdMenuGroup = SubMenuItemGroup as ThirdMenuRoot;
thirdMenuGroup.itemGroup.Clear();
App.nesRomLib.FetchRomCount((roms) =>
{
var thirdMenuGroup = SubMenuItemGroup as ThirdMenuRoot;
@ -61,9 +62,11 @@ namespace AxibugEmuOnline.Client
});
if (SubMenuItemGroup != null) SubMenuItemGroup.SetSelect(true);
return true;
}
public override void OnExitItem()
public override bool OnExitItem()
{
if (m_showTween != null)
{
@ -77,6 +80,8 @@ namespace AxibugEmuOnline.Client
});
if (SubMenuItemGroup != null) SubMenuItemGroup.SetSelect(false);
return true;
}
}
}

View File

@ -535,7 +535,7 @@ public class ItemPresent : GridLayoutGroup, IVirtualLayout
{
_scrollRect = GetComponentInParent<ScrollRect>();
}
if (_scrollRect != null) MoveToScrollViewCenter(_scrollRect, dataIndex);
//if (_scrollRect != null) MoveToScrollViewCenter(_scrollRect, dataIndex);
return this.GetItemUIIfExist(dataIndex);
}

View File

@ -2,8 +2,6 @@ using AxibugEmuOnline.Client.UI;
using DG.Tweening;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace AxibugEmuOnline.Client
@ -34,6 +32,15 @@ namespace AxibugEmuOnline.Client
MainMenu.ListenControlAction = true;
}
public void HideMainMenu()
{
MainMenuRoot.gameObject.SetActiveEx(false);
}
public void ShowMainMenu()
{
MainMenuRoot.gameObject.SetActiveEx(true);
}
public void ToDetailMenuLayout()
{

View File

@ -32,11 +32,25 @@ namespace AxibugEmuOnline.Client.UI
protected bool m_select;
protected TweenerCore<float, float, FloatOptions> progressTween;
protected float m_progress;
private void Awake()
public void SetData(MenuData data)
{
Reset();
SetBaseInfo(data.Name, data.Description);
SetIcon(data.Icon);
if (SubMenuItemGroup != null) SubMenuItemGroup.Init(data.SubMenus);
}
protected void Reset()
{
m_select = false;
m_progress = 0f;
if (InfoNode != null) InfoNode.alpha = 0;
Root.localScale = Vector3.one * UnSelectScale;
if (progressTween != null) { progressTween.Kill(); progressTween = null; }
if (ShadowIcon != null) ShadowIcon.gameObject.SetActive(false);
if (InfoNode != null) InfoNode.alpha = 0;
@ -44,13 +58,6 @@ namespace AxibugEmuOnline.Client.UI
if (SubMenuItemGroup != null) SubMenuItemGroup.SetSelect(false);
}
public void SetData(MenuData data)
{
SetBaseInfo(data.Name, data.Description);
SetIcon(data.Icon);
if (SubMenuItemGroup != null) SubMenuItemGroup.Init(data.SubMenus);
}
protected void SetBaseInfo(string name, string descript)
{
this.name = name;
@ -85,8 +92,8 @@ namespace AxibugEmuOnline.Client.UI
});
}
public virtual void OnEnterItem() { }
public virtual bool OnEnterItem() => true;
public virtual void OnExitItem() { }
public virtual bool OnExitItem() => true;
}
}

View File

@ -26,7 +26,7 @@ namespace AxibugEmuOnline.Client
private PulseInvoker m_pulsInvoker_Right;
private PulseInvoker m_pulsInvoker_Up;
private PulseInvoker m_pulsInvoker_Down;
MenuItem m_enteredItem = null;
private MenuItem m_enteredItem = null;
[SerializeField]
float PulseInvoke_Delay = 0.4f;
@ -84,43 +84,36 @@ namespace AxibugEmuOnline.Client
switch (cmd)
{
case EnumCommand.SelectItemLeft:
if (m_enteredItem == null)
{
m_pulsInvoker_Left.SetActive();
OnCmdSelectItemLeft();
}
m_pulsInvoker_Left.SetActive();
OnCmdSelectItemLeft();
break;
case EnumCommand.SelectItemRight:
if (m_enteredItem == null)
{
m_pulsInvoker_Right.SetActive();
OnCmdSelectItemRight();
}
m_pulsInvoker_Right.SetActive();
OnCmdSelectItemRight();
break;
case EnumCommand.SelectItemUp:
if (m_enteredItem == null)
{
m_pulsInvoker_Up.SetActive();
OnCmdSelectItemUp();
}
m_pulsInvoker_Up.SetActive();
OnCmdSelectItemUp();
break;
case EnumCommand.SelectItemDown:
if (m_enteredItem == null)
{
m_pulsInvoker_Down.SetActive();
OnCmdSelectItemDown();
}
m_pulsInvoker_Down.SetActive();
OnCmdSelectItemDown();
break;
case EnumCommand.Enter:
if (m_enteredItem == null)
{
m_enteredItem = m_runtimeMenuUI[SelectIndex];
OnCmdEnter(m_enteredItem);
var willEnterItem = GetItemUIByIndex(SelectIndex);
bool res = OnCmdEnter(willEnterItem);
if (res)
{
m_enteredItem = willEnterItem;
m_pulsInvoker_Left.DisActive();
m_pulsInvoker_Right.DisActive();
m_pulsInvoker_Up.DisActive();
m_pulsInvoker_Down.DisActive();
}
m_pulsInvoker_Left.DisActive();
m_pulsInvoker_Right.DisActive();
m_pulsInvoker_Up.DisActive();
m_pulsInvoker_Down.DisActive();
}
break;
case EnumCommand.Back:
@ -151,6 +144,11 @@ namespace AxibugEmuOnline.Client
}
}
protected virtual MenuItem GetItemUIByIndex(int index)
{
return m_runtimeMenuUI[SelectIndex];
}
protected virtual void OnCmdSelectItemLeft() { }
protected virtual void OnCmdSelectItemRight() { }
@ -160,8 +158,8 @@ namespace AxibugEmuOnline.Client
protected virtual void OnCmdSelectItemDown() { }
protected virtual void OnCmdOptionMenu() { }
protected virtual void OnCmdEnter(MenuItem item) { item.OnEnterItem(); }
protected virtual void OnCmdBack(MenuItem item) { item.OnExitItem(); }
protected virtual bool OnCmdEnter(MenuItem item) => item.OnEnterItem();
protected virtual bool OnCmdBack(MenuItem item) => item.OnExitItem();
protected abstract void OnSelectMenuChanged();
}
@ -194,7 +192,7 @@ namespace AxibugEmuOnline.Client
}
}

View File

@ -1,18 +1,22 @@
using AxibugEmuOnline.Client.ClientCore;
using AxibugEmuOnline.Client.UI;
using System;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
namespace AxibugEmuOnline.Client
{
public class RomItem : MenuItem, IVirtualItem, IPointerClickHandler
public class RomItem : MenuItem, IVirtualItem
{
[SerializeField]
Image m_romImage;
[SerializeField]
GameObject DownloadingFlag;
[SerializeField]
Slider DownProgress;
[SerializeField]
GameObject FileReadyFlag;
public int Index { get; set; }
private RomLib m_romlib => AppAxibugEmuOnline.nesRomLib;
@ -20,6 +24,8 @@ namespace AxibugEmuOnline.Client
public void SetData(object data)
{
Reset();
m_romfile = (RomFile)data;
m_romfile.OnInfoFilled += OnRomInfoFilled;
m_romImage.sprite = null;
@ -67,17 +73,37 @@ namespace AxibugEmuOnline.Client
}
}
public void OnPointerClick(PointerEventData eventData)
public override bool OnEnterItem()
{
if (!m_romfile.RomReady)
{
m_romfile.BeginDownload();
return false;
}
else
{
AppAxibugEmuOnline.SceneLoader.BeginLoad("Scene/EmuTest", () =>
{
var nesEmu = GameObject.FindObjectOfType<NesEmulator>();
nesEmu.StartGame(m_romfile);
});
AppAxibugEmuOnline.BeginGame(m_romfile);
return false;
}
}
private void Update()
{
DownloadingFlag.SetActiveEx(false);
FileReadyFlag.SetActiveEx(false);
if (m_romfile == null) return;
if (!m_romfile.InfoReady) return;
if (m_romfile.IsDownloading)
{
DownloadingFlag.SetActiveEx(true);
DownProgress.value = m_romfile.Progress;
}
else if (m_romfile.RomReady)
{
FileReadyFlag.SetActiveEx(true);
}
}
}

View File

@ -22,10 +22,10 @@ namespace AxibugEmuOnline.Client
private TweenerCore<int, int, NoOptions> rollTween;
private void Awake()
protected virtual void Awake()
{
m_selected = false;
alphaGroup.alpha = 0;
if (alphaGroup != null) alphaGroup.alpha = 0;
}
public override void Init(List<MenuData> menuDataList)
@ -62,18 +62,22 @@ namespace AxibugEmuOnline.Client
}
}
protected override void OnCmdEnter(MenuItem item)
protected override bool OnCmdEnter(MenuItem item)
{
LaunchUI.Instance.ToDetailMenuLayout();
item.SetSelectState(false);
base.OnCmdEnter(item);
return true;
}
protected override void OnCmdBack(MenuItem item)
protected override bool OnCmdBack(MenuItem item)
{
LaunchUI.Instance.ToMainMenuLayout();
item.SetSelectState(true);
base.OnCmdBack(item);
return true;
}
protected override void OnCmdSelectItemUp()

View File

@ -39,10 +39,29 @@ namespace AxibugEmuOnline.Client
}
}
private void Awake()
protected override MenuItem GetItemUIByIndex(int index)
{
return itemGroup.GetItemUIByDataIndex(index).GetComponent<MenuItem>();
}
protected override void Awake()
{
m_rect = transform as RectTransform;
m_parent = transform.parent as RectTransform;
base.Awake();
}
public override void Init(List<MenuData> menuDataList) { }
protected override bool OnCmdEnter(MenuItem item)
{
return item.OnEnterItem();
}
protected override bool OnCmdBack(MenuItem item)
{
return item.OnExitItem();
}
private void LateUpdate()

View File

@ -9,6 +9,6 @@ EditorBuildSettings:
path: Assets/Scene/AxibugEmuOnline.Client.unity
guid: eb0c18a619175384d95147898a43054b
- enabled: 1
path: Assets/Scene/EmuTest.unity
path: Assets/Scene/Emu_NES.unity
guid: 3dba71db67877594a9b5b77059205ec8
m_configObjects: {}