forked from sin365/AxibugEmuOnline
接入自己的MAME.Core平台,单人游玩功能
This commit is contained in:
parent
5a9e472c1b
commit
c48ac38f00
Binary file not shown.
557
AxibugEmuOnline.Client/Assets/Resources/MAME/UMAME.prefab
Normal file
557
AxibugEmuOnline.Client/Assets/Resources/MAME/UMAME.prefab
Normal file
@ -0,0 +1,557 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &3471319444171359706
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 3471319444171359701}
|
||||||
|
- component: {fileID: 3471319444171359703}
|
||||||
|
- component: {fileID: 3471319444171359700}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: Game
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &3471319444171359701
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3471319444171359706}
|
||||||
|
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:
|
||||||
|
- {fileID: 3471319446025011658}
|
||||||
|
- {fileID: 3471319444327146586}
|
||||||
|
m_Father: {fileID: 3471319444310732615}
|
||||||
|
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 &3471319444171359703
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3471319444171359706}
|
||||||
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!114 &3471319444171359700
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3471319444171359706}
|
||||||
|
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 &3471319444260926850
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 3471319444260926876}
|
||||||
|
- component: {fileID: 3471319444260926877}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: UMAME
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &3471319444260926876
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3471319444260926850}
|
||||||
|
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:
|
||||||
|
- {fileID: 3471319446102792544}
|
||||||
|
- {fileID: 3471319445075249870}
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &3471319444260926877
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3471319444260926850}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 49349ac585d920c4f937c48232c8dfd7, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
mUniVideoPlayer: {fileID: 0}
|
||||||
|
mFPS: {fileID: 0}
|
||||||
|
bQuickTestRom: 0
|
||||||
|
mQuickTestRom:
|
||||||
|
--- !u!1 &3471319444310732612
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 3471319444310732615}
|
||||||
|
- component: {fileID: 3471319444310732608}
|
||||||
|
- component: {fileID: 3471319444310732609}
|
||||||
|
- component: {fileID: 3471319444310732614}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: Canvas
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &3471319444310732615
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3471319444310732612}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children:
|
||||||
|
- {fileID: 3471319444171359701}
|
||||||
|
m_Father: {fileID: 3471319446102792544}
|
||||||
|
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: 0, y: 0}
|
||||||
|
m_Pivot: {x: 0, y: 0}
|
||||||
|
--- !u!223 &3471319444310732608
|
||||||
|
Canvas:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3471319444310732612}
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 3
|
||||||
|
m_RenderMode: 1
|
||||||
|
m_Camera: {fileID: 0}
|
||||||
|
m_PlaneDistance: 100
|
||||||
|
m_PixelPerfect: 0
|
||||||
|
m_ReceivesEvents: 1
|
||||||
|
m_OverrideSorting: 0
|
||||||
|
m_OverridePixelPerfect: 0
|
||||||
|
m_SortingBucketNormalizedSize: 0
|
||||||
|
m_VertexColorAlwaysGammaSpace: 0
|
||||||
|
m_AdditionalShaderChannelsFlag: 0
|
||||||
|
m_UpdateRectTransformForStandalone: 0
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
m_TargetDisplay: 0
|
||||||
|
--- !u!114 &3471319444310732609
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3471319444310732612}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_UiScaleMode: 0
|
||||||
|
m_ReferencePixelsPerUnit: 100
|
||||||
|
m_ScaleFactor: 1
|
||||||
|
m_ReferenceResolution: {x: 800, y: 600}
|
||||||
|
m_ScreenMatchMode: 0
|
||||||
|
m_MatchWidthOrHeight: 0
|
||||||
|
m_PhysicalUnit: 3
|
||||||
|
m_FallbackScreenDPI: 96
|
||||||
|
m_DefaultSpriteDPI: 96
|
||||||
|
m_DynamicPixelsPerUnit: 1
|
||||||
|
m_PresetInfoIsWorld: 0
|
||||||
|
--- !u!114 &3471319444310732614
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3471319444310732612}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_IgnoreReversedGraphics: 1
|
||||||
|
m_BlockingObjects: 0
|
||||||
|
m_BlockingMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
--- !u!1 &3471319444327146587
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 3471319444327146586}
|
||||||
|
- component: {fileID: 3471319444327146580}
|
||||||
|
- component: {fileID: 3471319444327146581}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: FPS
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &3471319444327146586
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3471319444327146587}
|
||||||
|
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: 3471319444171359701}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0, y: 1}
|
||||||
|
m_AnchorMax: {x: 0, y: 1}
|
||||||
|
m_AnchoredPosition: {x: 454.963, y: -46.19702}
|
||||||
|
m_SizeDelta: {x: 871.1646, y: 70.007}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!222 &3471319444327146580
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3471319444327146587}
|
||||||
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!114 &3471319444327146581
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3471319444327146587}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
m_RaycastTarget: 0
|
||||||
|
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
m_Maskable: 1
|
||||||
|
m_OnCullStateChanged:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
m_FontData:
|
||||||
|
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_FontSize: 41
|
||||||
|
m_FontStyle: 0
|
||||||
|
m_BestFit: 0
|
||||||
|
m_MinSize: 10
|
||||||
|
m_MaxSize: 107
|
||||||
|
m_Alignment: 0
|
||||||
|
m_AlignByGeometry: 0
|
||||||
|
m_RichText: 1
|
||||||
|
m_HorizontalOverflow: 0
|
||||||
|
m_VerticalOverflow: 0
|
||||||
|
m_LineSpacing: 1
|
||||||
|
m_Text: fps
|
||||||
|
--- !u!1 &3471319445075249871
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 3471319445075249870}
|
||||||
|
- component: {fileID: 3471319445075249864}
|
||||||
|
- component: {fileID: 3471319445075249865}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Audio
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &3471319445075249870
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3471319445075249871}
|
||||||
|
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: 3471319444260926876}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!82 &3471319445075249864
|
||||||
|
AudioSource:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3471319445075249871}
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 4
|
||||||
|
OutputAudioMixerGroup: {fileID: 0}
|
||||||
|
m_audioClip: {fileID: 0}
|
||||||
|
m_Resource: {fileID: 0}
|
||||||
|
m_PlayOnAwake: 0
|
||||||
|
m_Volume: 1
|
||||||
|
m_Pitch: 1
|
||||||
|
Loop: 1
|
||||||
|
Mute: 0
|
||||||
|
Spatialize: 0
|
||||||
|
SpatializePostEffects: 0
|
||||||
|
Priority: 128
|
||||||
|
DopplerLevel: 1
|
||||||
|
MinDistance: 1
|
||||||
|
MaxDistance: 500
|
||||||
|
Pan2D: 0
|
||||||
|
rolloffMode: 0
|
||||||
|
BypassEffects: 0
|
||||||
|
BypassListenerEffects: 0
|
||||||
|
BypassReverbZones: 0
|
||||||
|
rolloffCustomCurve:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Curve:
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0
|
||||||
|
value: 1
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 1
|
||||||
|
value: 0
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
m_PreInfinity: 2
|
||||||
|
m_PostInfinity: 2
|
||||||
|
m_RotationOrder: 4
|
||||||
|
panLevelCustomCurve:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Curve:
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0
|
||||||
|
value: 0
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
m_PreInfinity: 2
|
||||||
|
m_PostInfinity: 2
|
||||||
|
m_RotationOrder: 4
|
||||||
|
spreadCustomCurve:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Curve:
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0
|
||||||
|
value: 0
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
m_PreInfinity: 2
|
||||||
|
m_PostInfinity: 2
|
||||||
|
m_RotationOrder: 4
|
||||||
|
reverbZoneMixCustomCurve:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Curve:
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0
|
||||||
|
value: 1
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 0
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
m_PreInfinity: 2
|
||||||
|
m_PostInfinity: 2
|
||||||
|
m_RotationOrder: 4
|
||||||
|
--- !u!114 &3471319445075249865
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3471319445075249871}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 89abab1d3b1020340a147d74e60751ce, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_as: {fileID: 3471319445075249864}
|
||||||
|
--- !u!1 &3471319446025011659
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 3471319446025011658}
|
||||||
|
- component: {fileID: 3471319446025011652}
|
||||||
|
- component: {fileID: 3471319446025011653}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: GameRawImage
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &3471319446025011658
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3471319446025011659}
|
||||||
|
m_LocalRotation: {x: 1, y: 0, z: 0, w: 0}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 3471319444171359701}
|
||||||
|
m_LocalEulerAnglesHint: {x: 180, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0.5, y: 0}
|
||||||
|
m_AnchorMax: {x: 0.5, y: 1}
|
||||||
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
|
m_SizeDelta: {x: 1862.1006, y: -20}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!222 &3471319446025011652
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3471319446025011659}
|
||||||
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!114 &3471319446025011653
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3471319446025011659}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_Color: {r: 0, g: 0, b: 0, a: 1}
|
||||||
|
m_RaycastTarget: 0
|
||||||
|
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
m_Maskable: 1
|
||||||
|
m_OnCullStateChanged:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_UVRect:
|
||||||
|
serializedVersion: 2
|
||||||
|
x: 0
|
||||||
|
y: 0
|
||||||
|
width: 1
|
||||||
|
height: 1
|
||||||
|
--- !u!1 &3471319446102792545
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 3471319446102792544}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Video
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &3471319446102792544
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3471319446102792545}
|
||||||
|
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:
|
||||||
|
- {fileID: 3471319444310732615}
|
||||||
|
m_Father: {fileID: 3471319444260926876}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
File diff suppressed because it is too large
Load Diff
@ -13,21 +13,4 @@ public class UniMAMESetting
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static UniMAMESetting mInstance;
|
private static UniMAMESetting mInstance;
|
||||||
|
|
||||||
const string KEY_LASTGAMEROM = "MAME_LASTGAMEROM";
|
|
||||||
|
|
||||||
public string LastGameRom
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (PlayerPrefs.HasKey(KEY_LASTGAMEROM))
|
|
||||||
return PlayerPrefs.GetString(KEY_LASTGAMEROM);
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
PlayerPrefs.SetString(KEY_LASTGAMEROM, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,71 +0,0 @@
|
|||||||
using UnityEngine;
|
|
||||||
using UnityEngine.EventSystems;
|
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
public class FloatingJoystick : Joystick
|
|
||||||
{
|
|
||||||
public Image mImgBg;
|
|
||||||
public Image mImgHandle;
|
|
||||||
public Image mImgArrow;
|
|
||||||
|
|
||||||
public bool mIsMounseDown = false;
|
|
||||||
|
|
||||||
public static Color ShowColor = new Color(1F, 1f, 1F, 0.7f);
|
|
||||||
public static Color HideColor = new Color(1F, 1f, 1F, 0.3f);
|
|
||||||
|
|
||||||
//一次新的摇杆移动
|
|
||||||
public static bool bNewTouchWithSkill = false;
|
|
||||||
|
|
||||||
private void OnEnable()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Start()
|
|
||||||
{
|
|
||||||
base.Start();
|
|
||||||
mImgBg = background.transform.GetComponent<Image>();
|
|
||||||
mImgHandle = background.transform.Find("Handle").GetComponent<Image>();
|
|
||||||
mArrow = transform.Find("Background/Arrow").GetComponent<RectTransform>();
|
|
||||||
mImgArrow = transform.Find("Background/Arrow/imgArrow").GetComponent<Image>();
|
|
||||||
mArrow.gameObject.SetActive(false);
|
|
||||||
//background.gameObject.SetActive(false);
|
|
||||||
background.gameObject.SetActive(true);
|
|
||||||
background.transform.localPosition = new Vector3(256f, 256f, 0);
|
|
||||||
mImgBg.color = HideColor;
|
|
||||||
mImgHandle.color = HideColor;
|
|
||||||
mImgArrow.color = HideColor;
|
|
||||||
mIsMounseDown = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnPointerDown(PointerEventData eventData)
|
|
||||||
{
|
|
||||||
//background.anchoredPosition = ScreenPointToAnchoredPosition(eventData.position);
|
|
||||||
//background.gameObject.SetActive(true);
|
|
||||||
mImgBg.color = ShowColor;
|
|
||||||
mImgHandle.color = ShowColor;
|
|
||||||
mImgArrow.color = ShowColor;
|
|
||||||
mIsMounseDown = true;
|
|
||||||
base.OnPointerDown(eventData);
|
|
||||||
bNewTouchWithSkill = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnPointerUp(PointerEventData eventData)
|
|
||||||
{
|
|
||||||
//background.gameObject.SetActive(false);
|
|
||||||
PointerUp();
|
|
||||||
bNewTouchWithSkill = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void PointerUp()
|
|
||||||
{
|
|
||||||
if (background == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
background.transform.localPosition = new Vector3(256f, 256f, 0);
|
|
||||||
mImgBg.color = HideColor;
|
|
||||||
mImgHandle.color = HideColor;
|
|
||||||
mIsMounseDown = false;
|
|
||||||
base.PointerUp();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 7a47f546fc70ec8428172694e78e4288
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,167 +0,0 @@
|
|||||||
using UnityEngine;
|
|
||||||
using UnityEngine.EventSystems;
|
|
||||||
|
|
||||||
public class Joystick : MonoBehaviour, IPointerDownHandler, IDragHandler, IPointerUpHandler
|
|
||||||
{
|
|
||||||
|
|
||||||
public Vector2Int RawInputV2
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return InputForEmu;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public float HandleRange
|
|
||||||
{
|
|
||||||
get { return handleRange; }
|
|
||||||
set { handleRange = Mathf.Abs(value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public float DeadZone
|
|
||||||
{
|
|
||||||
get { return deadZone; }
|
|
||||||
set { deadZone = Mathf.Abs(value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public AxisOptions AxisOptions { get { return AxisOptions; } set { axisOptions = value; } }
|
|
||||||
|
|
||||||
[SerializeField] private float handleRange = 1;
|
|
||||||
[SerializeField] private float deadZone = 0f;
|
|
||||||
[SerializeField] private AxisOptions axisOptions = AxisOptions.Both;
|
|
||||||
[SerializeField] private bool snapX = false;
|
|
||||||
[SerializeField] private bool snapY = false;
|
|
||||||
|
|
||||||
[SerializeField] protected RectTransform background = null;
|
|
||||||
[SerializeField] private RectTransform handle = null;
|
|
||||||
[SerializeField] protected RectTransform mArrow;
|
|
||||||
private RectTransform baseRect = null;
|
|
||||||
|
|
||||||
private Canvas canvas;
|
|
||||||
private Camera cam;
|
|
||||||
|
|
||||||
private Vector2 input = Vector2.zero;
|
|
||||||
public Vector2Int InputForEmu = Vector2Int.zero;
|
|
||||||
|
|
||||||
public static Joystick joystickInstance;
|
|
||||||
|
|
||||||
|
|
||||||
protected virtual void Start()
|
|
||||||
{
|
|
||||||
|
|
||||||
HandleRange = handleRange;
|
|
||||||
DeadZone = deadZone;
|
|
||||||
baseRect = GetComponent<RectTransform>();
|
|
||||||
canvas = GetComponentInParent<Canvas>();
|
|
||||||
if (canvas == null)
|
|
||||||
Debug.LogError("The Joystick is not placed inside a canvas");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (cam == null)
|
|
||||||
{
|
|
||||||
if (canvas.renderMode == RenderMode.ScreenSpaceCamera)
|
|
||||||
cam = canvas.worldCamera;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector2 center = new Vector2(0.5f, 0.5f);
|
|
||||||
background.pivot = center;
|
|
||||||
handle.anchorMin = center;
|
|
||||||
handle.anchorMax = center;
|
|
||||||
handle.pivot = center;
|
|
||||||
handle.anchoredPosition = Vector2.zero;
|
|
||||||
|
|
||||||
joystickInstance = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void OnPointerDown(PointerEventData eventData)
|
|
||||||
{
|
|
||||||
OnDrag(eventData);
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector2 mArrowTop = new Vector2(0,1);
|
|
||||||
public void OnDrag(PointerEventData eventData)
|
|
||||||
{
|
|
||||||
if (cam == null)
|
|
||||||
{
|
|
||||||
if (canvas.renderMode == RenderMode.ScreenSpaceCamera)
|
|
||||||
cam = canvas.worldCamera;
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector2 position = RectTransformUtility.WorldToScreenPoint(cam, background.position);
|
|
||||||
Vector2 radius = background.sizeDelta / 2;
|
|
||||||
input = (eventData.position - position) / (radius * canvas.scaleFactor);
|
|
||||||
//FormatInput();
|
|
||||||
HandleInput(input.magnitude, input.normalized, radius, cam);
|
|
||||||
handle.anchoredPosition = input * radius * handleRange;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void HandleInput(float magnitude, Vector2 normalised, Vector2 radius, Camera cam)
|
|
||||||
{
|
|
||||||
if (magnitude > deadZone)
|
|
||||||
{
|
|
||||||
if (magnitude > 1)
|
|
||||||
{
|
|
||||||
input = normalised;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
input = Vector2.zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (magnitude > deadZone && input != Vector2.zero)
|
|
||||||
{
|
|
||||||
if (!mArrow.gameObject.activeSelf) mArrow.gameObject.SetActive(true);
|
|
||||||
float angle = Vector2.Angle(mArrowTop, input.normalized);
|
|
||||||
|
|
||||||
if (input.x > 0)
|
|
||||||
angle *= -1;
|
|
||||||
mArrow.rotation = Quaternion.Euler(0, 0, angle);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (mArrow.gameObject.activeSelf) mArrow.gameObject.SetActive(false);
|
|
||||||
|
|
||||||
|
|
||||||
if (input.x < -1 * deadZone)
|
|
||||||
InputForEmu.x = -1;
|
|
||||||
else if (input.x > deadZone)
|
|
||||||
InputForEmu.x = 1;
|
|
||||||
else
|
|
||||||
InputForEmu.x = 0;
|
|
||||||
|
|
||||||
if (input.y < -1 * deadZone)
|
|
||||||
InputForEmu.y = -1;
|
|
||||||
else if (input.y > deadZone)
|
|
||||||
InputForEmu.y = 1;
|
|
||||||
else
|
|
||||||
InputForEmu.y = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void OnPointerUp(PointerEventData eventData)
|
|
||||||
{
|
|
||||||
PointerUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void PointerUp()
|
|
||||||
{
|
|
||||||
input = Vector2.zero;
|
|
||||||
InputForEmu = Vector2Int.zero;
|
|
||||||
handle.anchoredPosition = Vector2.zero;
|
|
||||||
mArrow.gameObject.SetActive(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Vector2 ScreenPointToAnchoredPosition(Vector2 screenPosition)
|
|
||||||
{
|
|
||||||
Vector2 localPoint = Vector2.zero;
|
|
||||||
if (RectTransformUtility.ScreenPointToLocalPointInRectangle(baseRect, screenPosition, cam, out localPoint))
|
|
||||||
{
|
|
||||||
Vector2 pivotOffset = baseRect.pivot * baseRect.sizeDelta;
|
|
||||||
return localPoint - (background.anchorMax * baseRect.sizeDelta) + pivotOffset;
|
|
||||||
}
|
|
||||||
return Vector2.zero;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum AxisOptions { Both, Horizontal, Vertical }
|
|
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: b9fca4100a7477741b3973b4ff2c405f
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,25 +0,0 @@
|
|||||||
using MAME.Core;
|
|
||||||
using UnityEngine.EventSystems;
|
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
public class UILongClickButton : Button
|
|
||||||
{
|
|
||||||
public bool bHotKey { get; private set; } = false;
|
|
||||||
public long[] Key;
|
|
||||||
protected override void OnEnable()
|
|
||||||
{
|
|
||||||
base.OnEnable();
|
|
||||||
bHotKey = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnPointerDown(PointerEventData eventData)
|
|
||||||
{
|
|
||||||
base.OnPointerDown(eventData);
|
|
||||||
bHotKey = true;
|
|
||||||
}
|
|
||||||
public override void OnPointerUp(PointerEventData eventData)
|
|
||||||
{
|
|
||||||
base.OnPointerUp(eventData);
|
|
||||||
bHotKey = false;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: ce5791c690e1b11489049aab664fb925
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -3,13 +3,18 @@ using MAME.Core;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using AxibugEmuOnline.Client;
|
||||||
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
|
using AxibugProtobuf;
|
||||||
|
using static AxibugEmuOnline.Client.NesControllerMapper;
|
||||||
|
using VirtualNes.Core;
|
||||||
|
using System.Linq;
|
||||||
|
using AxibugEmuOnline.Client.Event;
|
||||||
|
|
||||||
public class UMAME : MonoBehaviour
|
public class UMAME : MonoBehaviour, IEmuCore
|
||||||
{
|
{
|
||||||
public static UMAME instance { get; private set; }
|
public static UMAME instance { get; private set; }
|
||||||
public MAMEEmu emu { get; private set; }
|
public MAMEEmu emu { get; private set; }
|
||||||
@ -20,15 +25,9 @@ public class UMAME : MonoBehaviour
|
|||||||
UniSoundPlayer mUniSoundPlayer;
|
UniSoundPlayer mUniSoundPlayer;
|
||||||
UniKeyboard mUniKeyboard;
|
UniKeyboard mUniKeyboard;
|
||||||
UniResources mUniResources;
|
UniResources mUniResources;
|
||||||
|
|
||||||
public Text mFPS;
|
public Text mFPS;
|
||||||
public Button btnStop;
|
private Canvas mCanvas;
|
||||||
public Button btnStart;
|
|
||||||
public Button btnRePlay;
|
|
||||||
public Button btnRePayySave;
|
|
||||||
public Button btnRomDir;
|
|
||||||
public Button btnSaveState;
|
|
||||||
public Button btnLoadState;
|
|
||||||
public Dictionary<string, RomInfo> ALLGame;
|
|
||||||
public List<RomInfo> HadGameList = new List<RomInfo>();
|
public List<RomInfo> HadGameList = new List<RomInfo>();
|
||||||
string mChangeRomName = string.Empty;
|
string mChangeRomName = string.Empty;
|
||||||
public UniTimeSpan mTimeSpan;
|
public UniTimeSpan mTimeSpan;
|
||||||
@ -37,34 +36,27 @@ public class UMAME : MonoBehaviour
|
|||||||
public ReplayWriter mReplayWriter;
|
public ReplayWriter mReplayWriter;
|
||||||
public ReplayReader mReplayReader;
|
public ReplayReader mReplayReader;
|
||||||
public long currEmuFrame => emu.currEmuFrame;
|
public long currEmuFrame => emu.currEmuFrame;
|
||||||
|
|
||||||
Dropdown optionDropdown;
|
|
||||||
|
|
||||||
public static System.Diagnostics.Stopwatch sw = System.Diagnostics.Stopwatch.StartNew();
|
public static System.Diagnostics.Stopwatch sw = System.Diagnostics.Stopwatch.StartNew();
|
||||||
public static bool bInGame { get; private set; }
|
public static bool bInGame { get; private set; }
|
||||||
|
public static bool bLogicUpdatePause { get; private set; }
|
||||||
|
public string EmuDataPath { get { return App.PersistentDataPath(Platform); } }
|
||||||
#if UNITY_EDITOR_WIN
|
public string RomPath => EmuDataPath + "/RemoteRoms/";
|
||||||
public static string EmuDataPath => "G:/MAME.Core";
|
public string SavePath => EmuDataPath + "/sav/";
|
||||||
#elif UNITY_ANDROID
|
public RomPlatformType Platform { get { return mPlatform; } }
|
||||||
public static string EmuDataPath => Application.persistentDataPath;
|
RomPlatformType mPlatform = RomPlatformType.Cps1;
|
||||||
#elif UNITY_PSP2
|
public uint Frame => (uint)emu.currEmuFrame;
|
||||||
public static string EmuDataPath => "ux0:data/MAME.Unity";
|
void Awake()
|
||||||
#else
|
|
||||||
public static string EmuDataPath => Application.persistentDataPath;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
public static string RomPath => EmuDataPath + "/roms/";
|
|
||||||
public static string SavePath => EmuDataPath + "/sav/";
|
|
||||||
|
|
||||||
private void Awake()
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
//设为60帧
|
||||||
|
Application.targetFrameRate = 60;
|
||||||
// 强制横屏
|
// 强制横屏
|
||||||
Screen.orientation = ScreenOrientation.LandscapeLeft;
|
Screen.orientation = ScreenOrientation.LandscapeLeft;
|
||||||
|
|
||||||
instance = this;
|
instance = this;
|
||||||
mFPS = GameObject.Find("FPS").GetComponent<Text>();
|
mFPS = GameObject.Find("FPS").GetComponent<Text>();
|
||||||
optionDropdown = GameObject.Find("optionDropdown").GetComponent<Dropdown>();
|
mCanvas = GameObject.Find("Canvas").GetComponent<Canvas>();
|
||||||
|
mCanvas.worldCamera = Camera.main;
|
||||||
emu = new MAMEEmu();
|
emu = new MAMEEmu();
|
||||||
mUniLog = new UniLog();
|
mUniLog = new UniLog();
|
||||||
mUniMouse = this.gameObject.AddComponent<UniMouse>();
|
mUniMouse = this.gameObject.AddComponent<UniMouse>();
|
||||||
@ -72,49 +64,70 @@ public class UMAME : MonoBehaviour
|
|||||||
mUniSoundPlayer = GameObject.Find("Audio").transform.GetComponent<UniSoundPlayer>();
|
mUniSoundPlayer = GameObject.Find("Audio").transform.GetComponent<UniSoundPlayer>();
|
||||||
mUniKeyboard = this.gameObject.AddComponent<UniKeyboard>();
|
mUniKeyboard = this.gameObject.AddComponent<UniKeyboard>();
|
||||||
mUniResources = new UniResources();
|
mUniResources = new UniResources();
|
||||||
mChangeRomName = UniMAMESetting.instance.LastGameRom;
|
mChangeRomName = string.Empty;
|
||||||
mTimeSpan = new UniTimeSpan();
|
mTimeSpan = new UniTimeSpan();
|
||||||
|
|
||||||
emu.Init(RomPath, mUniLog, mUniResources, mUniVideoPlayer, mUniSoundPlayer, mUniKeyboard, mUniMouse, mTimeSpan);
|
emu.Init(RomPath, mUniLog, mUniResources, mUniVideoPlayer, mUniSoundPlayer, mUniKeyboard, mUniMouse, mTimeSpan);
|
||||||
ALLGame = emu.GetGameList();
|
|
||||||
|
|
||||||
Debug.Log($"ALLGame:{ALLGame.Count}");
|
|
||||||
|
|
||||||
#if !UNITY_EDITOR
|
|
||||||
bQuickTestRom = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (bQuickTestRom)
|
|
||||||
mChangeRomName = mQuickTestRom;
|
|
||||||
|
|
||||||
GetHadRomList();
|
|
||||||
|
|
||||||
if (bQuickTestRom)
|
|
||||||
LoadGame();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnEnable()
|
void OnEnable()
|
||||||
{
|
{
|
||||||
btnStop.onClick.AddListener(StopGame);
|
|
||||||
btnStart.onClick.AddListener(() => { LoadGame(false); });
|
|
||||||
btnRePlay.onClick.AddListener(() => { LoadGame(true); });
|
|
||||||
btnRePayySave.onClick.AddListener(() => SaveReplay());
|
|
||||||
btnSaveState.onClick.AddListener(SaveState);
|
|
||||||
btnLoadState.onClick.AddListener(LoadState);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDisable()
|
void OnDisable()
|
||||||
{
|
{
|
||||||
StopGame();
|
StopGame();
|
||||||
}
|
}
|
||||||
|
#region 实现接口
|
||||||
void LoadGame(bool bReplay = false)
|
public object GetState()
|
||||||
|
{
|
||||||
|
return SaveState();
|
||||||
|
}
|
||||||
|
public byte[] GetStateBytes()
|
||||||
|
{
|
||||||
|
return SaveState();
|
||||||
|
}
|
||||||
|
public void LoadState(object state)
|
||||||
|
{
|
||||||
|
LoadState((byte[])state);
|
||||||
|
}
|
||||||
|
public void LoadStateFromBytes(byte[] data)
|
||||||
|
{
|
||||||
|
LoadState(data);
|
||||||
|
}
|
||||||
|
public void Pause()
|
||||||
|
{
|
||||||
|
bLogicUpdatePause = false;
|
||||||
|
}
|
||||||
|
public void Resume()
|
||||||
|
{
|
||||||
|
bLogicUpdatePause = true;
|
||||||
|
}
|
||||||
|
public MsgBool StartGame(RomFile romFile)
|
||||||
|
{
|
||||||
|
mPlatform = romFile.Platform;
|
||||||
|
mTimeSpan.InitStandTime();
|
||||||
|
if (LoadGame(romFile.FileName, false))
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return "Rom加载失败";
|
||||||
|
}
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
StopGame();
|
||||||
|
}
|
||||||
|
public void DoReset()
|
||||||
|
{
|
||||||
|
StopGame();
|
||||||
|
LoadGame(mChangeRomName, false);
|
||||||
|
}
|
||||||
|
public IControllerSetuper GetControllerSetuper()
|
||||||
|
{
|
||||||
|
return mUniKeyboard.ControllerMapper;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
bool LoadGame(string loadRom, bool bReplay = false)
|
||||||
{
|
{
|
||||||
//Application.targetFrameRate = 60;
|
//Application.targetFrameRate = 60;
|
||||||
|
|
||||||
mReplayWriter = new ReplayWriter(mChangeRomName, "fuck", ReplayData.ReplayFormat.FM32IP64, Encoding.UTF8);
|
mReplayWriter = new ReplayWriter(mChangeRomName, "fuck", ReplayData.ReplayFormat.FM32IP64, Encoding.UTF8);
|
||||||
mChangeRomName = HadGameList[optionDropdown.value].Name;
|
mChangeRomName = loadRom;
|
||||||
UniMAMESetting.instance.LastGameRom = mChangeRomName;
|
|
||||||
StopGame();
|
StopGame();
|
||||||
//读取ROM
|
//读取ROM
|
||||||
emu.LoadRom(mChangeRomName);
|
emu.LoadRom(mChangeRomName);
|
||||||
@ -131,20 +144,22 @@ public class UMAME : MonoBehaviour
|
|||||||
//读取ROM之后获得宽高初始化画面
|
//读取ROM之后获得宽高初始化画面
|
||||||
int _width; int _height; IntPtr _framePtr;
|
int _width; int _height; IntPtr _framePtr;
|
||||||
emu.GetGameScreenSize(out _width, out _height, out _framePtr);
|
emu.GetGameScreenSize(out _width, out _height, out _framePtr);
|
||||||
Debug.Log($"_width->{_width}, _height->{_height}, _framePtr->{_framePtr}");
|
App.log.Debug($"_width->{_width}, _height->{_height}, _framePtr->{_framePtr}");
|
||||||
mUniVideoPlayer.Initialize(_width, _height, _framePtr);
|
mUniVideoPlayer.Initialize(_width, _height, _framePtr);
|
||||||
//初始化音频
|
//初始化音频
|
||||||
mUniSoundPlayer.Initialize();
|
mUniSoundPlayer.Initialize();
|
||||||
//开始游戏
|
//开始游戏
|
||||||
emu.StartGame();
|
emu.StartGame();
|
||||||
bInGame = true;
|
bInGame = true;
|
||||||
|
bLogicUpdatePause = true;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.Log($"ROM加载失败");
|
App.log.Debug($"ROM加载失败");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
mFPS.text = ($"fpsv {mUniVideoPlayer.videoFPS.ToString("F2")} fpsa {mUniSoundPlayer.audioFPS.ToString("F2")}");
|
mFPS.text = ($"fpsv {mUniVideoPlayer.videoFPS.ToString("F2")} fpsa {mUniSoundPlayer.audioFPS.ToString("F2")}");
|
||||||
@ -152,35 +167,26 @@ public class UMAME : MonoBehaviour
|
|||||||
if (!bInGame)
|
if (!bInGame)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//采集本帧Input
|
if (bLogicUpdatePause)
|
||||||
mUniKeyboard.UpdateInputKey();
|
|
||||||
//放行下一帧
|
|
||||||
//emu.UnlockNextFreme();
|
|
||||||
//推帧
|
|
||||||
emu.UpdateFrame();
|
|
||||||
|
|
||||||
if (Input.GetKeyDown(KeyCode.F1))
|
|
||||||
{
|
{
|
||||||
SaveReplay();
|
//采集本帧Input
|
||||||
|
mUniKeyboard.UpdateInputKey();
|
||||||
|
//放行下一帧
|
||||||
|
//emu.UnlockNextFreme();
|
||||||
|
//推帧
|
||||||
|
emu.UpdateFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input.GetKeyDown(KeyCode.F2))
|
mUniVideoPlayer.ApplyFilterEffect();
|
||||||
{
|
mUniVideoPlayer.ApplyScreenScaler();
|
||||||
string Path = SavePath + Machine.sName + ".rp";
|
|
||||||
string dbgPath = SavePath + Machine.sName + ".rpread";
|
|
||||||
mReplayReader = new ReplayReader(Path, true, dbgPath);
|
|
||||||
mUniKeyboard.Init(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
public void SaveReplay()
|
||||||
void SaveReplay()
|
|
||||||
{
|
{
|
||||||
string Path = SavePath + Machine.sName + ".rp";
|
string Path = SavePath + Machine.sName + ".rp";
|
||||||
string dbgPath = SavePath + Machine.sName + ".rpwrite";
|
string dbgPath = SavePath + Machine.sName + ".rpwrite";
|
||||||
mReplayWriter.SaveData(Path, true, dbgPath);
|
mReplayWriter.SaveData(Path, true, dbgPath);
|
||||||
}
|
}
|
||||||
|
public void StopGame()
|
||||||
void StopGame()
|
|
||||||
{
|
{
|
||||||
if (bInGame)
|
if (bInGame)
|
||||||
{
|
{
|
||||||
@ -188,75 +194,36 @@ public class UMAME : MonoBehaviour
|
|||||||
mUniVideoPlayer.StopVideo();
|
mUniVideoPlayer.StopVideo();
|
||||||
mUniSoundPlayer.StopPlay();
|
mUniSoundPlayer.StopPlay();
|
||||||
bInGame = false;
|
bInGame = false;
|
||||||
|
bLogicUpdatePause = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
byte[] SaveState()
|
||||||
void GetHadRomList()
|
|
||||||
{
|
|
||||||
HadGameList.Clear();
|
|
||||||
optionDropdown.options.Clear();
|
|
||||||
|
|
||||||
Debug.Log($"GetHadRomList:{RomPath}");
|
|
||||||
string[] directoryEntries = Directory.GetDirectories(RomPath);
|
|
||||||
for (int i = 0; i < directoryEntries.Length; i++)
|
|
||||||
{
|
|
||||||
string path = directoryEntries[i];
|
|
||||||
string dirName = Path.GetFileName(path);
|
|
||||||
if (ALLGame.ContainsKey(dirName))
|
|
||||||
{
|
|
||||||
HadGameList.Add(ALLGame[dirName]);
|
|
||||||
optionDropdown.options.Add(new Dropdown.OptionData(dirName));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Debug.Log($"HadGameList:{HadGameList.Count}");
|
|
||||||
|
|
||||||
RomInfo tempCurrRom = HadGameList.Where(w => w.Name == mChangeRomName).FirstOrDefault();
|
|
||||||
if (tempCurrRom != null)
|
|
||||||
{
|
|
||||||
optionDropdown.value = HadGameList.IndexOf(tempCurrRom);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
optionDropdown.value = 0;
|
|
||||||
}
|
|
||||||
optionDropdown.RefreshShownValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OpenFolderRomPath()
|
|
||||||
{
|
|
||||||
System.Diagnostics.Process.Start("explorer.exe", "/select," + RomPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SaveState()
|
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(SavePath))
|
if (!Directory.Exists(SavePath))
|
||||||
Directory.CreateDirectory(SavePath);
|
Directory.CreateDirectory(SavePath);
|
||||||
|
|
||||||
FileStream fs = new FileStream(SavePath + Machine.sName + ".sta", FileMode.Create);
|
MemoryStream ms = new MemoryStream();
|
||||||
BinaryWriter bw = new BinaryWriter(fs);
|
BinaryWriter bw = new BinaryWriter(ms);
|
||||||
emu.SaveState(bw);
|
emu.SaveState(bw);
|
||||||
|
byte[] data = ms.ToArray();
|
||||||
bw.Close();
|
bw.Close();
|
||||||
fs.Close();
|
ms.Close();
|
||||||
|
|
||||||
byte[] screenData = UMAME.instance.mUniVideoPlayer.GetScreenImg();
|
return data;
|
||||||
|
|
||||||
FileStream fsImg = new FileStream(SavePath + Machine.sName + ".jpg", FileMode.Create);
|
|
||||||
fsImg.Write(screenData, 0, screenData.Length);
|
//byte[] screenData = UMAME.instance.mUniVideoPlayer.GetScreenImg();
|
||||||
fsImg.Close();
|
|
||||||
|
//FileStream fsImg = new FileStream(SavePath + Machine.sName + ".jpg", FileMode.Create);
|
||||||
|
//fsImg.Write(screenData, 0, screenData.Length);
|
||||||
|
//fsImg.Close();
|
||||||
}
|
}
|
||||||
void LoadState()
|
void LoadState(byte[] data)
|
||||||
{
|
{
|
||||||
string Path = SavePath + Machine.sName + ".sta";
|
MemoryStream fs = new MemoryStream(data);
|
||||||
if (!File.Exists(Path))
|
|
||||||
{
|
|
||||||
Debug.Log($"文件不存在{Path}");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
FileStream fs = new FileStream(Path, FileMode.Open, FileAccess.Read);
|
|
||||||
BinaryReader br = new BinaryReader(fs);
|
BinaryReader br = new BinaryReader(fs);
|
||||||
emu.LoadState(br);
|
emu.LoadState(br);
|
||||||
br.Close();
|
br.Close();
|
||||||
fs.Close();
|
fs.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
using AxibugEmuOnline.Client.Event;
|
||||||
using MAME.Core;
|
using MAME.Core;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -5,94 +6,25 @@ using UnityEngine;
|
|||||||
|
|
||||||
public class UniKeyboard : MonoBehaviour, IKeyboard
|
public class UniKeyboard : MonoBehaviour, IKeyboard
|
||||||
{
|
{
|
||||||
#region UIButton
|
public MameControllerMapper ControllerMapper { get; private set; }
|
||||||
public UILongClickButton btnP1;
|
|
||||||
public UILongClickButton btnCoin1;
|
|
||||||
public UILongClickButton btnA;
|
|
||||||
public UILongClickButton btnB;
|
|
||||||
public UILongClickButton btnC;
|
|
||||||
public UILongClickButton btnD;
|
|
||||||
//public UILongClickButton btnE;
|
|
||||||
//public UILongClickButton btnF;
|
|
||||||
public UILongClickButton btnAB;
|
|
||||||
public UILongClickButton btnCD;
|
|
||||||
public UILongClickButton btnABC;
|
|
||||||
public Transform tfKeyPad;
|
|
||||||
public FloatingJoystick mJoystick;
|
|
||||||
public List<UILongClickButton> mUIBtns = new List<UILongClickButton>();
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
public static Dictionary<KeyCode, MotionKey> dictKeyCfgs = new Dictionary<KeyCode, MotionKey>();
|
|
||||||
public static KeyCode[] CheckList;
|
|
||||||
bool bReplayMode;
|
bool bReplayMode;
|
||||||
PlayMode mPlayMode;
|
PlayMode mPlayMode;
|
||||||
ReplayMode mReplayMode;
|
ReplayMode mReplayMode;
|
||||||
ulong last_CurryInpuAllData_test = 0;
|
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
mJoystick = GameObject.Find("tfJoystick").GetComponent<FloatingJoystick>();
|
ControllerMapper = new MameControllerMapper();
|
||||||
tfKeyPad = GameObject.Find("tfKeyPad").transform;
|
|
||||||
btnP1 = GameObject.Find("btnP1").GetComponent<UILongClickButton>();
|
|
||||||
btnCoin1 = GameObject.Find("btnCoin1").GetComponent<UILongClickButton>();
|
|
||||||
btnA = GameObject.Find("btnA").GetComponent<UILongClickButton>();
|
|
||||||
btnB = GameObject.Find("btnB").GetComponent<UILongClickButton>();
|
|
||||||
btnC = GameObject.Find("btnC").GetComponent<UILongClickButton>();
|
|
||||||
btnD = GameObject.Find("btnD").GetComponent<UILongClickButton>();
|
|
||||||
//btnE = GameObject.Find("btnE")?.GetComponent<UILongClickButton>();
|
|
||||||
//btnF = GameObject.Find("btnF")?.GetComponent<UILongClickButton>();
|
|
||||||
btnAB = GameObject.Find("btnAB").GetComponent<UILongClickButton>();
|
|
||||||
btnCD = GameObject.Find("btnCD").GetComponent<UILongClickButton>();
|
|
||||||
btnABC = GameObject.Find("btnABC").GetComponent<UILongClickButton>();
|
|
||||||
|
|
||||||
mUIBtns.Add(btnP1);
|
|
||||||
mUIBtns.Add(btnCoin1);
|
|
||||||
mUIBtns.Add(btnA);
|
|
||||||
mUIBtns.Add(btnB);
|
|
||||||
mUIBtns.Add(btnC);
|
|
||||||
mUIBtns.Add(btnD);
|
|
||||||
mUIBtns.Add(btnAB);
|
|
||||||
mUIBtns.Add(btnCD);
|
|
||||||
mUIBtns.Add(btnABC);
|
|
||||||
|
|
||||||
//if (btnE != null)
|
|
||||||
//{
|
|
||||||
// mUIBtns.Add(btnE);
|
|
||||||
// btnE.gameObject.SetActive(false);
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// mUIBtns.Add(btnF);
|
|
||||||
// btnF.gameObject.SetActive(false);
|
|
||||||
//}
|
|
||||||
|
|
||||||
#if UNITY_STANDALONE_WIN || UNITY_EDITOR
|
|
||||||
tfKeyPad.gameObject.SetActive(false);
|
|
||||||
#endif
|
|
||||||
Init(false);
|
Init(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MotionKey[] GetPressedKeys()
|
public ulong GetPressedKeys()
|
||||||
{
|
{
|
||||||
MotionKey[] currkey;
|
|
||||||
ulong InputData;
|
ulong InputData;
|
||||||
if (!bReplayMode)
|
if (!bReplayMode)
|
||||||
currkey = mPlayMode.GetPressedKeys(out InputData);
|
InputData = mPlayMode.GetPressedKeys();
|
||||||
else
|
else
|
||||||
currkey = mReplayMode.GetPressedKeys(out InputData);
|
InputData = mReplayMode.GetPressedKeys();
|
||||||
#if UNITY_EDITOR
|
return InputData;
|
||||||
if (last_CurryInpuAllData_test != InputData)
|
|
||||||
{
|
|
||||||
string TempStr = "";
|
|
||||||
foreach (var item in currkey)
|
|
||||||
{
|
|
||||||
TempStr += $"{item.ToString()}|";
|
|
||||||
}
|
|
||||||
Debug.Log($"{UMAME.instance.mUniVideoPlayer.mFrame} | {EmuTimer.get_current_time().attoseconds} |{EmuTimer.get_current_time().seconds} | {InputData} | {TempStr}");
|
|
||||||
last_CurryInpuAllData_test = InputData;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return currkey;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateInputKey()
|
public void UpdateInputKey()
|
||||||
@ -110,42 +42,6 @@ public class UniKeyboard : MonoBehaviour, IKeyboard
|
|||||||
public void Init(bool IsReplay)
|
public void Init(bool IsReplay)
|
||||||
{
|
{
|
||||||
bReplayMode = IsReplay;
|
bReplayMode = IsReplay;
|
||||||
dictKeyCfgs.Clear();
|
|
||||||
//dictKeyCfgs.Add(KeyCode.P, MotionKey.EMU_PAUSED);
|
|
||||||
dictKeyCfgs.Add(KeyCode.Alpha1, MotionKey.P1_GAMESTART);
|
|
||||||
dictKeyCfgs.Add(KeyCode.Alpha5, MotionKey.P1_INSERT_COIN);
|
|
||||||
dictKeyCfgs.Add(KeyCode.W, MotionKey.P1_UP);
|
|
||||||
dictKeyCfgs.Add(KeyCode.S, MotionKey.P1_DOWN);
|
|
||||||
dictKeyCfgs.Add(KeyCode.A, MotionKey.P1_LEFT);
|
|
||||||
dictKeyCfgs.Add(KeyCode.D, MotionKey.P1_RIGHT);
|
|
||||||
dictKeyCfgs.Add(KeyCode.J, MotionKey.P1_BTN_1);
|
|
||||||
dictKeyCfgs.Add(KeyCode.K, MotionKey.P1_BTN_2);
|
|
||||||
dictKeyCfgs.Add(KeyCode.L, MotionKey.P1_BTN_3);
|
|
||||||
dictKeyCfgs.Add(KeyCode.U, MotionKey.P1_BTN_4);
|
|
||||||
dictKeyCfgs.Add(KeyCode.KeypadDivide, MotionKey.P2_GAMESTART);
|
|
||||||
dictKeyCfgs.Add(KeyCode.KeypadMultiply, MotionKey.P2_INSERT_COIN);
|
|
||||||
dictKeyCfgs.Add(KeyCode.UpArrow, MotionKey.P2_UP);
|
|
||||||
dictKeyCfgs.Add(KeyCode.DownArrow, MotionKey.P2_DOWN);
|
|
||||||
dictKeyCfgs.Add(KeyCode.LeftArrow, MotionKey.P2_LEFT);
|
|
||||||
dictKeyCfgs.Add(KeyCode.RightArrow, MotionKey.P2_RIGHT);
|
|
||||||
dictKeyCfgs.Add(KeyCode.Keypad1, MotionKey.P2_BTN_1);
|
|
||||||
dictKeyCfgs.Add(KeyCode.Keypad2, MotionKey.P2_BTN_2);
|
|
||||||
dictKeyCfgs.Add(KeyCode.Keypad3, MotionKey.P2_BTN_3);
|
|
||||||
dictKeyCfgs.Add(KeyCode.Keypad4, MotionKey.P2_BTN_4);
|
|
||||||
CheckList = dictKeyCfgs.Keys.ToArray();
|
|
||||||
|
|
||||||
btnP1.Key = new long[] { (long)MotionKey.P1_GAMESTART };
|
|
||||||
btnCoin1.Key = new long[] { (long)MotionKey.P1_INSERT_COIN };
|
|
||||||
btnA.Key = new long[] { (long)MotionKey.P1_BTN_1 };
|
|
||||||
btnB.Key = new long[] { (long)MotionKey.P1_BTN_2 };
|
|
||||||
btnC.Key = new long[] { (long)MotionKey.P1_BTN_3 };
|
|
||||||
btnD.Key = new long[] { (long)MotionKey.P1_BTN_4 };
|
|
||||||
//btnE.Key = new long[] { (long)MotionKey.P1_BTN_5 };
|
|
||||||
//btnF.Key = new long[] { (long)MotionKey.P1_BTN_6 };
|
|
||||||
btnAB.Key = new long[] { (long)MotionKey.P1_BTN_1, (long)MotionKey.P1_BTN_2 };
|
|
||||||
btnCD.Key = new long[] { (long)MotionKey.P1_BTN_3, (long)MotionKey.P1_BTN_4 };
|
|
||||||
btnABC.Key = new long[] { (long)MotionKey.P1_BTN_1, (long)MotionKey.P1_BTN_2, (long)MotionKey.P1_BTN_3 };
|
|
||||||
|
|
||||||
mPlayMode = new PlayMode(this);
|
mPlayMode = new PlayMode(this);
|
||||||
mReplayMode = new ReplayMode();
|
mReplayMode = new ReplayMode();
|
||||||
}
|
}
|
||||||
@ -157,13 +53,9 @@ public class UniKeyboard : MonoBehaviour, IKeyboard
|
|||||||
}
|
}
|
||||||
public class PlayMode
|
public class PlayMode
|
||||||
{
|
{
|
||||||
Dictionary<KeyCode, MotionKey> dictKeyCfgs => UniKeyboard.dictKeyCfgs;
|
|
||||||
UniKeyboard mUniKeyboard;
|
UniKeyboard mUniKeyboard;
|
||||||
KeyCode[] CheckList => UniKeyboard.CheckList;
|
|
||||||
ulong tempInputAllData = 0;
|
ulong tempInputAllData = 0;
|
||||||
List<MotionKey> temp = new List<MotionKey>();
|
|
||||||
public ulong CurryInpuAllData = 0;
|
public ulong CurryInpuAllData = 0;
|
||||||
public MotionKey[] mCurrKey = new MotionKey[0];
|
|
||||||
|
|
||||||
public PlayMode(UniKeyboard uniKeyboard)
|
public PlayMode(UniKeyboard uniKeyboard)
|
||||||
{
|
{
|
||||||
@ -173,127 +65,322 @@ public class UniKeyboard : MonoBehaviour, IKeyboard
|
|||||||
public void UpdateLogic()
|
public void UpdateLogic()
|
||||||
{
|
{
|
||||||
tempInputAllData = 0;
|
tempInputAllData = 0;
|
||||||
temp.Clear();
|
tempInputAllData |= mUniKeyboard.ControllerMapper.Controller0.GetSingleAllInput();
|
||||||
for (int i = 0; i < CheckList.Length; i++)
|
tempInputAllData |= mUniKeyboard.ControllerMapper.Controller1.GetSingleAllInput();
|
||||||
{
|
tempInputAllData |= mUniKeyboard.ControllerMapper.Controller2.GetSingleAllInput();
|
||||||
if (Input.GetKey(CheckList[i]))
|
tempInputAllData |= mUniKeyboard.ControllerMapper.Controller3.GetSingleAllInput();
|
||||||
{
|
|
||||||
MotionKey mk = dictKeyCfgs[CheckList[i]];
|
|
||||||
temp.Add(mk);
|
|
||||||
tempInputAllData |= (ulong)mk;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < mUniKeyboard.mUIBtns.Count; i++)
|
|
||||||
{
|
|
||||||
if (mUniKeyboard.mUIBtns[i].bHotKey)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < mUniKeyboard.mUIBtns[i].Key.Length; j++)
|
|
||||||
{
|
|
||||||
MotionKey mk = (MotionKey)mUniKeyboard.mUIBtns[i].Key[j];
|
|
||||||
temp.Add(mk);
|
|
||||||
tempInputAllData |= (ulong)mk;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector2Int inputV2 = mUniKeyboard.mJoystick.RawInputV2;
|
|
||||||
//Debug.Log($"{inputV2.x},{inputV2.y}");
|
|
||||||
if (inputV2.x > 0)
|
|
||||||
{
|
|
||||||
temp.Add(MotionKey.P1_RIGHT);
|
|
||||||
tempInputAllData |= (ulong)MotionKey.P1_RIGHT;
|
|
||||||
}
|
|
||||||
else if (inputV2.x < 0)
|
|
||||||
{
|
|
||||||
temp.Add(MotionKey.P1_LEFT);
|
|
||||||
tempInputAllData |= (ulong)MotionKey.P1_LEFT;
|
|
||||||
}
|
|
||||||
if (inputV2.y > 0)
|
|
||||||
{
|
|
||||||
temp.Add(MotionKey.P1_UP);
|
|
||||||
tempInputAllData |= (ulong)MotionKey.P1_UP;
|
|
||||||
}
|
|
||||||
else if (inputV2.y < 0)
|
|
||||||
{
|
|
||||||
temp.Add(MotionKey.P1_DOWN);
|
|
||||||
tempInputAllData |= (ulong)MotionKey.P1_DOWN;
|
|
||||||
}
|
|
||||||
CurryInpuAllData = tempInputAllData;
|
CurryInpuAllData = tempInputAllData;
|
||||||
mCurrKey = temp.ToArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MotionKey[] GetPressedKeys(out ulong InputData)
|
public ulong GetPressedKeys()
|
||||||
{
|
{
|
||||||
//UMAME.instance.mReplayWriter.NextFramebyFrameIdx((int)UMAME.instance.mUniVideoPlayer.mFrame, CurryInpuAllData);
|
|
||||||
UMAME.instance.mReplayWriter.NextFramebyFrameIdx((int)UMAME.instance.mUniVideoPlayer.mFrame, CurryInpuAllData);
|
UMAME.instance.mReplayWriter.NextFramebyFrameIdx((int)UMAME.instance.mUniVideoPlayer.mFrame, CurryInpuAllData);
|
||||||
InputData = CurryInpuAllData;
|
return CurryInpuAllData;
|
||||||
return mCurrKey;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class ReplayMode
|
public class ReplayMode
|
||||||
{
|
{
|
||||||
public MotionKey[] mCurrKey = new MotionKey[0];
|
|
||||||
MotionKey[] ReplayCheckKey;
|
|
||||||
ulong currInputData;
|
ulong currInputData;
|
||||||
List<MotionKey> temp = new List<MotionKey>();
|
|
||||||
|
|
||||||
public ReplayMode()
|
public ReplayMode()
|
||||||
{
|
{
|
||||||
ReplayCheckKey = dictKeyCfgs.Values.ToArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MotionKey[] GetPressedKeys(out ulong InputData)
|
public ulong GetPressedKeys()
|
||||||
{
|
{
|
||||||
//有变化
|
|
||||||
//if (UMAME.instance.mReplayReader.NextFrame(out AxiReplay.ReplayStep stepData))
|
|
||||||
int targetFrame = (int)UMAME.instance.mUniVideoPlayer.mFrame;
|
int targetFrame = (int)UMAME.instance.mUniVideoPlayer.mFrame;
|
||||||
//if (UMAME.instance.mReplayReader.NextFramebyFrameIdx(targetFrame, out AxiReplay.ReplayStep stepData))
|
|
||||||
//{
|
|
||||||
// temp.Clear();
|
|
||||||
// //有数据
|
|
||||||
// for (int i = 0; i < ReplayCheckKey.Length; i++)
|
|
||||||
// {
|
|
||||||
// if ((stepData.InPut & (ulong)ReplayCheckKey[i]) > 0)
|
|
||||||
// temp.Add(ReplayCheckKey[i]);
|
|
||||||
// }
|
|
||||||
// mCurrKey = temp.ToArray();
|
|
||||||
//}
|
|
||||||
AxiReplay.ReplayStep stepData;
|
AxiReplay.ReplayStep stepData;
|
||||||
|
//有变化
|
||||||
if (UMAME.instance.mReplayReader.NextFramebyFrameIdx(targetFrame, out stepData))
|
if (UMAME.instance.mReplayReader.NextFramebyFrameIdx(targetFrame, out stepData))
|
||||||
{
|
{
|
||||||
temp.Clear();
|
|
||||||
//List<MotionKey> temp = new List<MotionKey>();
|
|
||||||
//temp.Clear();
|
|
||||||
////有数据
|
|
||||||
//for (int i = 0; i < ReplayCheckKey.Length; i++)
|
|
||||||
//{
|
|
||||||
// if ((stepData.InPut & (ulong)ReplayCheckKey[i]) > 0)
|
|
||||||
// temp.Add(ReplayCheckKey[i]);
|
|
||||||
//}
|
|
||||||
//mCurrKey = temp.ToArray();
|
|
||||||
foreach (MotionKey key in GetStepDataToMotionKey(stepData))
|
|
||||||
{
|
|
||||||
temp.Add(key);
|
|
||||||
}
|
|
||||||
mCurrKey = temp.ToArray();
|
|
||||||
currInputData = stepData.InPut;
|
currInputData = stepData.InPut;
|
||||||
}
|
}
|
||||||
InputData = currInputData;
|
return currInputData;
|
||||||
return mCurrKey;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerable<MotionKey> GetStepDataToMotionKey(AxiReplay.ReplayStep stepData)
|
|
||||||
{
|
|
||||||
//有数据
|
|
||||||
for (int i = 0; i < ReplayCheckKey.Length; i++)
|
|
||||||
{
|
|
||||||
if ((stepData.InPut & (ulong)ReplayCheckKey[i]) > 0)
|
|
||||||
yield return ReplayCheckKey[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class MameControllerMapper : IControllerSetuper
|
||||||
|
{
|
||||||
|
public MameSingleConoller Controller0 { get; } = new MameSingleConoller(0);
|
||||||
|
public MameSingleConoller Controller1 { get; } = new MameSingleConoller(1);
|
||||||
|
public MameSingleConoller Controller2 { get; } = new MameSingleConoller(2);
|
||||||
|
public MameSingleConoller Controller3 { get; } = new MameSingleConoller(3);
|
||||||
|
|
||||||
|
ulong mCurrAllInput;
|
||||||
|
|
||||||
|
public void SetConnect(uint? con0ToSlot = null,
|
||||||
|
uint? con1ToSlot = null,
|
||||||
|
uint? con2ToSlot = null,
|
||||||
|
uint? con3ToSlot = null)
|
||||||
|
{
|
||||||
|
Controller0.ConnectSlot = con0ToSlot;
|
||||||
|
Controller1.ConnectSlot = con1ToSlot;
|
||||||
|
Controller2.ConnectSlot = con2ToSlot;
|
||||||
|
Controller3.ConnectSlot = con3ToSlot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int? GetSlotConnectingControllerIndex(int slotIndex)
|
||||||
|
{
|
||||||
|
if (Controller0.ConnectSlot.HasValue && Controller0.ConnectSlot.Value == slotIndex) return 0;
|
||||||
|
else if (Controller1.ConnectSlot.HasValue && Controller1.ConnectSlot.Value == slotIndex) return 1;
|
||||||
|
else if (Controller2.ConnectSlot.HasValue && Controller2.ConnectSlot.Value == slotIndex) return 2;
|
||||||
|
else if (Controller3.ConnectSlot.HasValue && Controller3.ConnectSlot.Value == slotIndex) return 3;
|
||||||
|
else return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IController GetSlotConnectingController(int slotIndex)
|
||||||
|
{
|
||||||
|
if (Controller0.ConnectSlot.HasValue && Controller0.ConnectSlot.Value == slotIndex) return Controller0;
|
||||||
|
else if (Controller1.ConnectSlot.HasValue && Controller1.ConnectSlot.Value == slotIndex) return Controller1;
|
||||||
|
else if (Controller2.ConnectSlot.HasValue && Controller2.ConnectSlot.Value == slotIndex) return Controller2;
|
||||||
|
else if (Controller3.ConnectSlot.HasValue && Controller3.ConnectSlot.Value == slotIndex) return Controller3;
|
||||||
|
else return null;
|
||||||
|
}
|
||||||
|
static HashSet<uint> s_temp = new HashSet<uint>();
|
||||||
|
public uint? GetFreeSlotIndex()
|
||||||
|
{
|
||||||
|
s_temp.Clear();
|
||||||
|
s_temp.Add(0);
|
||||||
|
s_temp.Add(1);
|
||||||
|
s_temp.Add(2);
|
||||||
|
s_temp.Add(3);
|
||||||
|
|
||||||
|
if (Controller0.ConnectSlot.HasValue) s_temp.Remove(Controller0.ConnectSlot.Value);
|
||||||
|
if (Controller1.ConnectSlot.HasValue) s_temp.Remove(Controller1.ConnectSlot.Value);
|
||||||
|
if (Controller2.ConnectSlot.HasValue) s_temp.Remove(Controller2.ConnectSlot.Value);
|
||||||
|
if (Controller3.ConnectSlot.HasValue) s_temp.Remove(Controller3.ConnectSlot.Value);
|
||||||
|
|
||||||
|
if (s_temp.Count > 0) return s_temp.First();
|
||||||
|
else return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void LetControllerConnect(int conIndex, uint slotIndex)
|
||||||
|
{
|
||||||
|
MameSingleConoller targetController;
|
||||||
|
switch (conIndex)
|
||||||
|
{
|
||||||
|
case 0: targetController = Controller0; break;
|
||||||
|
case 1: targetController = Controller1; break;
|
||||||
|
case 2: targetController = Controller2; break;
|
||||||
|
case 3: targetController = Controller3; break;
|
||||||
|
default:
|
||||||
|
throw new System.Exception($"Not Allowed conIndex Range: {conIndex}");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (targetController.ConnectSlot.HasValue) return;
|
||||||
|
|
||||||
|
targetController.ConnectSlot = slotIndex;
|
||||||
|
Eventer.Instance.PostEvent(EEvent.OnControllerConnectChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// MAME控制器
|
||||||
|
/// </summary>
|
||||||
|
public class MameSingleConoller : IController
|
||||||
|
{
|
||||||
|
public KeyCode INSERT_COIN, GAMESTART,
|
||||||
|
UP, DOWN, LEFT, RIGHT,
|
||||||
|
BTN_A, BTN_B, BTN_C, BTN_D, BTN_E, BTN_F;
|
||||||
|
|
||||||
|
public MotionKey tg_INSERT_COIN, tg_GAMESTART,
|
||||||
|
tg_UP, tg_DOWN, tg_LEFT, tg_RIGHT,
|
||||||
|
tg_BTN_A, tg_BTN_B, tg_BTN_C, tg_BTN_D, tg_BTN_E, tg_BTN_F;
|
||||||
|
|
||||||
|
ulong mTempSingleAllInput;
|
||||||
|
|
||||||
|
int mControllerIndex;
|
||||||
|
uint? mConnectSlot;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 指示该手柄连接的手柄插槽
|
||||||
|
/// <para><c>这个值代表了该手柄在实际游戏中控制的Player</c></para>
|
||||||
|
/// <value>[0,3] 例外:为空代表未连接</value>
|
||||||
|
/// </summary>
|
||||||
|
public uint? ConnectSlot
|
||||||
|
{
|
||||||
|
get { return mConnectSlot; }
|
||||||
|
set { mConnectSlot = value; this.ResetTargetMotionKey(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 控制器编号
|
||||||
|
/// <para><c>此编号并非对应游戏中的player1,player2,player3,player4,仅仅作为本地4个手柄的实例</c></para>
|
||||||
|
/// <value>[0,3]</value>
|
||||||
|
/// </summary>
|
||||||
|
public int ControllerIndex
|
||||||
|
{
|
||||||
|
get { return mControllerIndex; }
|
||||||
|
set { mControllerIndex = value; this.LoadControlKeyForConfig(); }
|
||||||
|
}
|
||||||
|
public MameSingleConoller(int controllerIndex)
|
||||||
|
{
|
||||||
|
ControllerIndex = controllerIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AnyButtonDown()
|
||||||
|
{
|
||||||
|
//if (Input.GetKeyDown(INSERT_COIN)) return true;
|
||||||
|
//if (Input.GetKeyDown(GAMESTART)) return true;
|
||||||
|
//if (Input.GetKeyDown(UP)) return true;
|
||||||
|
//if (Input.GetKeyDown(DOWN)) return true;
|
||||||
|
//if (Input.GetKeyDown(LEFT)) return true;
|
||||||
|
//if (Input.GetKeyDown(RIGHT)) return true;
|
||||||
|
//if (Input.GetKeyDown(BTN_A)) return true;
|
||||||
|
//if (Input.GetKeyDown(BTN_B)) return true;
|
||||||
|
//if (Input.GetKeyDown(BTN_C)) return true;
|
||||||
|
//if (Input.GetKeyDown(BTN_D)) return true;
|
||||||
|
//if (Input.GetKeyDown(BTN_E)) return true;
|
||||||
|
//if (Input.GetKeyDown(BTN_F)) return true;
|
||||||
|
return mTempSingleAllInput > 0;
|
||||||
|
}
|
||||||
|
public ulong GetSingleAllInput()
|
||||||
|
{
|
||||||
|
if (!ConnectSlot.HasValue)
|
||||||
|
return 0;
|
||||||
|
mTempSingleAllInput = 0;
|
||||||
|
if (Input.GetKey(INSERT_COIN)) return mTempSingleAllInput |= (ulong)tg_INSERT_COIN;
|
||||||
|
if (Input.GetKey(GAMESTART)) return mTempSingleAllInput |= (ulong)tg_GAMESTART;
|
||||||
|
if (Input.GetKey(UP)) return mTempSingleAllInput |= (ulong)tg_UP;
|
||||||
|
if (Input.GetKey(DOWN)) return mTempSingleAllInput |= (ulong)tg_DOWN;
|
||||||
|
if (Input.GetKey(LEFT)) return mTempSingleAllInput |= (ulong)tg_LEFT;
|
||||||
|
if (Input.GetKey(RIGHT)) return mTempSingleAllInput |= (ulong)tg_RIGHT;
|
||||||
|
if (Input.GetKey(BTN_A)) return mTempSingleAllInput |= (ulong)tg_BTN_A;
|
||||||
|
if (Input.GetKey(BTN_B)) return mTempSingleAllInput |= (ulong)tg_BTN_B;
|
||||||
|
if (Input.GetKey(BTN_C)) return mTempSingleAllInput |= (ulong)tg_BTN_C;
|
||||||
|
if (Input.GetKey(BTN_D)) return mTempSingleAllInput |= (ulong)tg_BTN_D;
|
||||||
|
if (Input.GetKey(BTN_E)) return mTempSingleAllInput |= (ulong)tg_BTN_E;
|
||||||
|
if (Input.GetKey(BTN_F)) return mTempSingleAllInput |= (ulong)tg_BTN_F;
|
||||||
|
return mTempSingleAllInput;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class MameSingleControllSetter
|
||||||
|
{
|
||||||
|
public static void LoadControlKeyForConfig(this MameSingleConoller singlecontrol)
|
||||||
|
{
|
||||||
|
//TODO 等待支持配置,或统一
|
||||||
|
switch (singlecontrol.ControllerIndex)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
singlecontrol.INSERT_COIN = KeyCode.Alpha5;
|
||||||
|
singlecontrol.GAMESTART = KeyCode.Alpha1;
|
||||||
|
singlecontrol.UP = KeyCode.W;
|
||||||
|
singlecontrol.DOWN = KeyCode.S;
|
||||||
|
singlecontrol.LEFT = KeyCode.A;
|
||||||
|
singlecontrol.RIGHT = KeyCode.D;
|
||||||
|
singlecontrol.BTN_A = KeyCode.J;
|
||||||
|
singlecontrol.BTN_B = KeyCode.K;
|
||||||
|
singlecontrol.BTN_C = KeyCode.L;
|
||||||
|
singlecontrol.BTN_D = KeyCode.U;
|
||||||
|
singlecontrol.BTN_E = KeyCode.I;
|
||||||
|
singlecontrol.BTN_F = KeyCode.O;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
singlecontrol.INSERT_COIN = KeyCode.KeypadMultiply;
|
||||||
|
singlecontrol.GAMESTART = KeyCode.KeypadDivide;
|
||||||
|
singlecontrol.UP = KeyCode.UpArrow;
|
||||||
|
singlecontrol.DOWN = KeyCode.DownArrow;
|
||||||
|
singlecontrol.LEFT = KeyCode.LeftArrow;
|
||||||
|
singlecontrol.RIGHT = KeyCode.RightArrow;
|
||||||
|
singlecontrol.BTN_A = KeyCode.Keypad1;
|
||||||
|
singlecontrol.BTN_B = KeyCode.Keypad2;
|
||||||
|
singlecontrol.BTN_C = KeyCode.Keypad3;
|
||||||
|
singlecontrol.BTN_D = KeyCode.Keypad4;
|
||||||
|
singlecontrol.BTN_E = KeyCode.Keypad5;
|
||||||
|
singlecontrol.BTN_F = KeyCode.Keypad6;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ResetTargetMotionKey(this MameSingleConoller singlecontrol)
|
||||||
|
{
|
||||||
|
if (!singlecontrol.ConnectSlot.HasValue)
|
||||||
|
{
|
||||||
|
singlecontrol.tg_INSERT_COIN
|
||||||
|
= singlecontrol.tg_GAMESTART
|
||||||
|
= singlecontrol.tg_UP
|
||||||
|
= singlecontrol.tg_DOWN
|
||||||
|
= singlecontrol.tg_LEFT
|
||||||
|
= singlecontrol.tg_RIGHT
|
||||||
|
= singlecontrol.tg_BTN_A
|
||||||
|
= singlecontrol.tg_BTN_B
|
||||||
|
= singlecontrol.tg_BTN_C
|
||||||
|
= singlecontrol.tg_BTN_D
|
||||||
|
= singlecontrol.tg_BTN_E
|
||||||
|
= singlecontrol.tg_BTN_F
|
||||||
|
= MotionKey.FinalKey;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (singlecontrol.ConnectSlot.Value)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
singlecontrol.tg_INSERT_COIN = MotionKey.P1_INSERT_COIN;
|
||||||
|
singlecontrol.tg_GAMESTART = MotionKey.P1_GAMESTART;
|
||||||
|
singlecontrol.tg_UP = MotionKey.P1_UP;
|
||||||
|
singlecontrol.tg_DOWN = MotionKey.P1_DOWN;
|
||||||
|
singlecontrol.tg_LEFT = MotionKey.P1_LEFT;
|
||||||
|
singlecontrol.tg_RIGHT = MotionKey.P1_RIGHT;
|
||||||
|
singlecontrol.tg_BTN_A = MotionKey.P1_BTN_1;
|
||||||
|
singlecontrol.tg_BTN_B = MotionKey.P1_BTN_2;
|
||||||
|
singlecontrol.tg_BTN_C = MotionKey.P1_BTN_3;
|
||||||
|
singlecontrol.tg_BTN_D = MotionKey.P1_BTN_4;
|
||||||
|
singlecontrol.tg_BTN_E = MotionKey.P1_BTN_5;
|
||||||
|
singlecontrol.tg_BTN_F = MotionKey.P1_BTN_6;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
singlecontrol.tg_INSERT_COIN = MotionKey.P2_INSERT_COIN;
|
||||||
|
singlecontrol.tg_GAMESTART = MotionKey.P2_GAMESTART;
|
||||||
|
singlecontrol.tg_UP = MotionKey.P2_UP;
|
||||||
|
singlecontrol.tg_DOWN = MotionKey.P2_DOWN;
|
||||||
|
singlecontrol.tg_LEFT = MotionKey.P2_LEFT;
|
||||||
|
singlecontrol.tg_RIGHT = MotionKey.P2_RIGHT;
|
||||||
|
singlecontrol.tg_BTN_A = MotionKey.P2_BTN_1;
|
||||||
|
singlecontrol.tg_BTN_B = MotionKey.P2_BTN_2;
|
||||||
|
singlecontrol.tg_BTN_C = MotionKey.P2_BTN_3;
|
||||||
|
singlecontrol.tg_BTN_D = MotionKey.P2_BTN_4;
|
||||||
|
singlecontrol.tg_BTN_E = MotionKey.P2_BTN_5;
|
||||||
|
singlecontrol.tg_BTN_F = MotionKey.P2_BTN_6;
|
||||||
|
break;
|
||||||
|
//后续修改后 支持P3 P4
|
||||||
|
case 2:
|
||||||
|
singlecontrol.tg_INSERT_COIN = MotionKey.FinalKey;
|
||||||
|
singlecontrol.tg_GAMESTART = MotionKey.FinalKey;
|
||||||
|
singlecontrol.tg_UP = MotionKey.FinalKey;
|
||||||
|
singlecontrol.tg_DOWN = MotionKey.FinalKey;
|
||||||
|
singlecontrol.tg_LEFT = MotionKey.FinalKey;
|
||||||
|
singlecontrol.tg_RIGHT = MotionKey.FinalKey;
|
||||||
|
singlecontrol.tg_BTN_A = MotionKey.FinalKey;
|
||||||
|
singlecontrol.tg_BTN_B = MotionKey.FinalKey;
|
||||||
|
singlecontrol.tg_BTN_C = MotionKey.FinalKey;
|
||||||
|
singlecontrol.tg_BTN_D = MotionKey.FinalKey;
|
||||||
|
singlecontrol.tg_BTN_E = MotionKey.FinalKey;
|
||||||
|
singlecontrol.tg_BTN_F = MotionKey.FinalKey;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
singlecontrol.tg_INSERT_COIN = MotionKey.FinalKey;
|
||||||
|
singlecontrol.tg_GAMESTART = MotionKey.FinalKey;
|
||||||
|
singlecontrol.tg_UP = MotionKey.FinalKey;
|
||||||
|
singlecontrol.tg_DOWN = MotionKey.FinalKey;
|
||||||
|
singlecontrol.tg_LEFT = MotionKey.FinalKey;
|
||||||
|
singlecontrol.tg_RIGHT = MotionKey.FinalKey;
|
||||||
|
singlecontrol.tg_BTN_A = MotionKey.FinalKey;
|
||||||
|
singlecontrol.tg_BTN_B = MotionKey.FinalKey;
|
||||||
|
singlecontrol.tg_BTN_C = MotionKey.FinalKey;
|
||||||
|
singlecontrol.tg_BTN_D = MotionKey.FinalKey;
|
||||||
|
singlecontrol.tg_BTN_E = MotionKey.FinalKey;
|
||||||
|
singlecontrol.tg_BTN_F = MotionKey.FinalKey;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
using MAME.Core;
|
using MAME.Core;
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
public class UniLog : ILog
|
public class UniLog : ILog
|
||||||
{
|
{
|
||||||
public void Log(string msg)
|
public void Log(string msg)
|
||||||
{
|
{
|
||||||
Debug.Log(msg);
|
App.log.Debug(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,37 @@
|
|||||||
using MAME.Core;
|
using MAME.Core;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
public class UniTimeSpan : ITimeSpan
|
public class UniTimeSpan : ITimeSpan
|
||||||
{
|
{
|
||||||
public ulong tick;
|
public ulong tick;
|
||||||
double tickDetailus = 16666.666667;
|
double startUs;
|
||||||
|
//double tickDetailus = 16666.666667;
|
||||||
|
double tickDetailus = 16.666667;//16΢Ãë £¨Ô½Ð¡Ô½¾ö¶¨tick¾«¶ÈԽС£©
|
||||||
object tickLock = new object();
|
object tickLock = new object();
|
||||||
|
|
||||||
|
public void InitStandTime()
|
||||||
|
{
|
||||||
|
startUs = GetCurrUs();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// »ñÈ¡µ±Ç°ºÁÃë
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public double GetCurrUs()
|
||||||
|
{
|
||||||
|
return (double)UMAME.sw.ElapsedTicks * 1000000 / Stopwatch.Frequency;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// »ñÈ¡µ±Ç°ºÁÃë
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public double GetRunUs()
|
||||||
|
{
|
||||||
|
return ((double)UMAME.sw.ElapsedTicks * 1000000 / Stopwatch.Frequency) - startUs;
|
||||||
|
}
|
||||||
|
|
||||||
public void SetTick(ulong nexttick)
|
public void SetTick(ulong nexttick)
|
||||||
{
|
{
|
||||||
//lock (tickLock)
|
//lock (tickLock)
|
||||||
@ -28,7 +54,8 @@ public class UniTimeSpan : ITimeSpan
|
|||||||
{
|
{
|
||||||
lock (tickLock)
|
lock (tickLock)
|
||||||
{
|
{
|
||||||
lpPerformanceCount = (long)tick;
|
//lpPerformanceCount = (long)tick;
|
||||||
|
lpPerformanceCount = (long)(GetRunUs() / tickDetailus);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
|
using AxibugProtobuf;
|
||||||
using MAME.Core;
|
using MAME.Core;
|
||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -5,10 +7,7 @@ using UnityEngine.UI;
|
|||||||
|
|
||||||
public class UniVideoPlayer : MonoBehaviour, IVideoPlayer
|
public class UniVideoPlayer : MonoBehaviour, IVideoPlayer
|
||||||
{
|
{
|
||||||
[SerializeField]
|
public Vector2Int mScreenSize { get; private set; }
|
||||||
private int mWidth;
|
|
||||||
[SerializeField]
|
|
||||||
private int mHeight;
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private int mDataLenght;
|
private int mDataLenght;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
@ -36,14 +35,13 @@ public class UniVideoPlayer : MonoBehaviour, IVideoPlayer
|
|||||||
{
|
{
|
||||||
m_drawCanvas.color = Color.white;
|
m_drawCanvas.color = Color.white;
|
||||||
|
|
||||||
if (m_rawBufferWarper == null || mWidth != width || mHeight != height)
|
if (m_rawBufferWarper == null || mScreenSize.x != width || mScreenSize.y != height)
|
||||||
{
|
{
|
||||||
mWidth = width;
|
mScreenSize = new Vector2Int(width, height);
|
||||||
mHeight = height;
|
|
||||||
mDataLenght = width * height * 4;
|
mDataLenght = width * height * 4;
|
||||||
//mFrameData = new int[mWidth * mHeight];
|
//mFrameData = new int[mWidth * mHeight];
|
||||||
//MAMEÀ´µÄÊÇBGRA32£¬ºÃºÃºÃ BGRA->RGBA
|
//MAMEÀ´µÄÊÇBGRA32£¬ºÃºÃºÃ BGRA->RGBA
|
||||||
m_rawBufferWarper = new Texture2D(mWidth, mHeight, TextureFormat.RGBA32, false);
|
m_rawBufferWarper = new Texture2D(mScreenSize.x, mScreenSize.y, TextureFormat.RGBA32, false);
|
||||||
m_rawBufferWarper.filterMode = FilterMode.Point;
|
m_rawBufferWarper.filterMode = FilterMode.Point;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,8 +49,8 @@ public class UniVideoPlayer : MonoBehaviour, IVideoPlayer
|
|||||||
m_drawCanvas.texture = m_rawBufferWarper;
|
m_drawCanvas.texture = m_rawBufferWarper;
|
||||||
bInit = true;
|
bInit = true;
|
||||||
|
|
||||||
float targetWidth = ((float)mWidth / mHeight) * m_drawCanvasrect.rect.height ;
|
//float targetWidth = ((float)mScreenSize.x/ mScreenSize.y) * m_drawCanvasrect.rect.height ;
|
||||||
m_drawCanvasrect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, targetWidth);
|
//m_drawCanvasrect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, targetWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StopVideo()
|
public void StopVideo()
|
||||||
@ -61,12 +59,12 @@ public class UniVideoPlayer : MonoBehaviour, IVideoPlayer
|
|||||||
m_drawCanvas.color = new Color(0,0,0,0);
|
m_drawCanvas.color = new Color(0,0,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update()
|
//void Update()
|
||||||
{
|
//{
|
||||||
if (!bInit) return;
|
// if (!bInit) return;
|
||||||
m_rawBufferWarper.LoadRawTextureData(mFrameDataPtr, mDataLenght);
|
// //m_rawBufferWarper.LoadRawTextureData(mFrameDataPtr, mDataLenght);
|
||||||
m_rawBufferWarper.Apply();
|
// //m_rawBufferWarper.Apply();
|
||||||
}
|
//}
|
||||||
|
|
||||||
public void SubmitVideo(int[] data, long frame_number)
|
public void SubmitVideo(int[] data, long frame_number)
|
||||||
{
|
{
|
||||||
@ -79,10 +77,24 @@ public class UniVideoPlayer : MonoBehaviour, IVideoPlayer
|
|||||||
//mFrameData = data;
|
//mFrameData = data;
|
||||||
|
|
||||||
//Debug.Log($"frame_number -> {frame_number}");
|
//Debug.Log($"frame_number -> {frame_number}");
|
||||||
|
m_rawBufferWarper.LoadRawTextureData(mFrameDataPtr, mDataLenght);
|
||||||
|
m_rawBufferWarper.Apply();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] GetScreenImg()
|
public byte[] GetScreenImg()
|
||||||
{
|
{
|
||||||
return (m_drawCanvas.texture as Texture2D).EncodeToJPG();
|
return (m_drawCanvas.texture as Texture2D).EncodeToJPG();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void ApplyFilterEffect()
|
||||||
|
{
|
||||||
|
App.settings.Filter.ExecuteFilterRender(m_rawBufferWarper, m_drawCanvas);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ApplyScreenScaler()
|
||||||
|
{
|
||||||
|
App.settings.ScreenScaler.CalcScale(m_drawCanvas, UMAME.instance.Platform);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,12 @@ namespace AxibugEmuOnline.Client.Manager
|
|||||||
{
|
{
|
||||||
case RomPlatformType.Nes:
|
case RomPlatformType.Nes:
|
||||||
m_emuCore = GameObject.Instantiate(Resources.Load<GameObject>("NES/NesEmulator")).GetComponent<IEmuCore>();
|
m_emuCore = GameObject.Instantiate(Resources.Load<GameObject>("NES/NesEmulator")).GetComponent<IEmuCore>();
|
||||||
|
break;
|
||||||
|
case RomPlatformType.Cps1:
|
||||||
|
case RomPlatformType.Cps2:
|
||||||
|
case RomPlatformType.Igs:
|
||||||
|
case RomPlatformType.Neogeo:
|
||||||
|
m_emuCore = GameObject.Instantiate(Resources.Load<GameObject>("MAME/UMAME")).GetComponent<IEmuCore>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,6 +106,11 @@ namespace AxibugEmuOnline.Client
|
|||||||
switch (platform)
|
switch (platform)
|
||||||
{
|
{
|
||||||
case RomPlatformType.Nes: return new Vector2Int(256, 240);
|
case RomPlatformType.Nes: return new Vector2Int(256, 240);
|
||||||
|
case RomPlatformType.Cps1:
|
||||||
|
case RomPlatformType.Cps2:
|
||||||
|
case RomPlatformType.Neogeo:
|
||||||
|
case RomPlatformType.Igs:
|
||||||
|
return UMAME.instance.mUniVideoPlayer.mScreenSize;
|
||||||
default: throw new System.NotImplementedException($"未实现的平台:{platform}");
|
default: throw new System.NotImplementedException($"未实现的平台:{platform}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user