Merge pull request 'master' (#62) from Alienjack/AxibugEmuOnline:master into master

Reviewed-on: #62
This commit is contained in:
sin365 2024-12-12 09:47:11 +08:00
commit bdc26c7fe5
255 changed files with 10723 additions and 8782 deletions

1
.gitignore vendored
View File

@ -17,3 +17,4 @@
/virtuanessrc097-master
/AxibugEmuOnline.Server/config.cfg
/AxibugEmuOnline.Server/bin/
/AxibugEmuOnline.Client/.editorconfig

View File

@ -3,7 +3,7 @@ guid: b12ca21105df97a469be3cf97a4f5fc1
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
@ -20,10 +20,12 @@ TextureImporter:
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
@ -47,7 +49,7 @@ TextureImporter:
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteBorder: {x: 100, y: 128, z: 85, w: 89}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
@ -62,8 +64,10 @@ TextureImporter:
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 1
platformSettings:
- serializedVersion: 3
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
@ -73,9 +77,10 @@ TextureImporter:
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
@ -85,9 +90,10 @@ TextureImporter:
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
@ -97,24 +103,28 @@ TextureImporter:
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
internalID: 1537655665
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1476,7 +1476,7 @@ MonoBehaviour:
m_MinHeight: -1
m_PreferredWidth: -1
m_PreferredHeight: -1
m_FlexibleWidth: 20
m_FlexibleWidth: 5
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!1 &6998597834321643812
@ -1612,7 +1612,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 20, y: 0}
m_SizeDelta: {x: 20, y: -20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2285457357903007277
CanvasRenderer:
@ -1642,8 +1642,8 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10913, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 0
m_Sprite: {fileID: 10911, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
@ -1936,16 +1936,16 @@ MonoBehaviour:
m_Font: {fileID: 12800000, guid: 33a3bdf8f6bd1ec4eba7c4bc58183212, type: 3}
m_FontSize: 20
m_FontStyle: 0
m_BestFit: 0
m_BestFit: 1
m_MinSize: 2
m_MaxSize: 40
m_Alignment: 3
m_MaxSize: 20
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: 99
m_Text: 0
--- !u!114 &5172613673109503612
MonoBehaviour:
m_ObjectHideFlags: 0
@ -1961,9 +1961,9 @@ MonoBehaviour:
m_IgnoreLayout: 0
m_MinWidth: -1
m_MinHeight: -1
m_PreferredWidth: -1
m_PreferredWidth: 50
m_PreferredHeight: -1
m_FlexibleWidth: 1
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!1 &8884391103430529053

View File

@ -31,6 +31,7 @@ RectTransform:
m_Children:
- {fileID: 3531919738411886375}
- {fileID: 3531919739979819162}
- {fileID: 8368317206160511790}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
@ -52,6 +53,172 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_InputUI: {fileID: 3531919739979819165}
m_OptionUI: {fileID: 3531919738411886374}
m_popTipsUI: {fileID: 5244143219655022973}
--- !u!1001 &286598211728911619
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 3531919739338806919}
m_Modifications:
- target: {fileID: 3567888507220032771, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3567888507220032771, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3567888507220032771, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3567888507220032771, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3567888507220032771, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3567888507220032771, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3567888507220032771, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3567888507220032771, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3702320671699488055, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3702320671699488055, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3702320671699488055, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3702320671699488055, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6578361594179096223, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_Name
value: PopTipsUI
objectReference: {fileID: 0}
- target: {fileID: 7161016329433304235, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8635669497356860973, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 8635669497356860973, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 8635669497356860973, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_AnchorMax.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8635669497356860973, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8635669497356860973, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8635669497356860973, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8635669497356860973, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8635669497356860973, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8635669497356860973, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8635669497356860973, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8635669497356860973, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8635669497356860973, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8635669497356860973, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8635669497356860973, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8635669497356860973, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8635669497356860973, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8635669497356860973, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8635669497356860973, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8635669497356860973, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8635669497356860973, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
--- !u!114 &5244143219655022973 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5421423517701944446, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
m_PrefabInstance: {fileID: 286598211728911619}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 33e643184eab7b943af134e9bd6d2a4d, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!224 &8368317206160511790 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 8635669497356860973, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
m_PrefabInstance: {fileID: 286598211728911619}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &1091051462859282637
PrefabInstance:
m_ObjectHideFlags: 0
@ -60,6 +227,78 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 3531919739338806919}
m_Modifications:
- target: {fileID: 278706555072840209, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 278706555072840209, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 278706555072840209, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 278706555072840209, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 278706555072840209, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 278706555072840209, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 278706555072840209, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 278706555072840209, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 368344292915322445, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 368344292915322445, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 816049057894123782, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 816049057894123782, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 816049057894123782, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 816049057894123782, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 816049057894123782, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 816049057894123782, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 816049057894123782, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 816049057894123782, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1471584936616359931, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMax.y
value: 1
@ -80,6 +319,62 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1486903153852188972, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1486903153852188972, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1486903153852188972, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1486903153852188972, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1486903153852188972, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1486903153852188972, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1486903153852188972, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1609320592060400513, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1609320592060400513, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1609320592060400513, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1609320592060400513, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1609320592060400513, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1609320592060400513, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1609320592060400513, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1714682891259844147, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMax.y
value: 0
@ -96,6 +391,10 @@ PrefabInstance:
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1714682891259844147, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1714682891259844147, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
@ -104,6 +403,38 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2450201408575734812, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2450201408575734812, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2450201408575734812, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2450201408575734812, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2450201408575734812, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2450201408575734812, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2450201408575734812, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2450201408575734812, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2780569438310375802, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMax.y
value: 0
@ -120,6 +451,14 @@ PrefabInstance:
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2780569438310375802, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2780569438310375802, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2780569438310375802, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
@ -128,10 +467,62 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3877041774025625573, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3877041774025625573, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3877041774025625573, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3877041774025625573, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3877041774025625573, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3877041774025625573, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3877041774025625573, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4264754383554125665, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4264754383554125665, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4264754383554125665, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4264754383554125665, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4264754383554125665, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4264754383554125665, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4264754383554125665, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4478785627166277609, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_Name
value: OptionUI
@ -252,6 +643,30 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6100013163502236362, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6100013163502236362, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6100013163502236362, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6100013163502236362, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6100013163502236362, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6100013163502236362, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6503369113137645357, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMax.y
value: 0
@ -268,6 +683,10 @@ PrefabInstance:
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6503369113137645357, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6503369113137645357, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
@ -276,6 +695,74 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7216060871118576844, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7216060871118576844, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7216060871118576844, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7216060871118576844, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7216060871118576844, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7216060871118576844, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7216060871118576844, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7216060871118576844, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7336691093202081882, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7336691093202081882, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7336691093202081882, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7336691093202081882, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7336691093202081882, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7336691093202081882, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7336691093202081882, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8431569032797679710, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8431569032797679710, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []

View File

@ -0,0 +1,325 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &6544052317793826322
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3702320671699488055}
- component: {fileID: 2115938225093092953}
- component: {fileID: 7081568093111909217}
- component: {fileID: 4438747400990922354}
m_Layer: 5
m_Name: PopItemTemplate
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3702320671699488055
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6544052317793826322}
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: 7161016329433304235}
- {fileID: 3567888507220032771}
m_Father: {fileID: 8635669497356860973}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -108.00003}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!114 &2115938225093092953
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6544052317793826322}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8dfc260cbc58a6e4ebcd8c156a946b25, type: 3}
m_Name:
m_EditorClassIdentifier:
m_msgText: {fileID: 4253545256053581529}
OutTime: 0.5
OutEase: 9
StandTime: 5
InTime: 0.5
InEase: 28
--- !u!114 &7081568093111909217
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6544052317793826322}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 120
m_Right: 100
m_Top: 80
m_Bottom: 80
m_ChildAlignment: 5
m_Spacing: 0
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 1
m_ChildControlWidth: 1
m_ChildControlHeight: 1
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!114 &4438747400990922354
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6544052317793826322}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalFit: 2
m_VerticalFit: 2
--- !u!1 &6578361594179096223
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8635669497356860973}
- component: {fileID: 5421423517701944446}
m_Layer: 5
m_Name: PopTipsUI
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8635669497356860973
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6578361594179096223}
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: 3702320671699488055}
m_Father: {fileID: 0}
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!114 &5421423517701944446
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6578361594179096223}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 33e643184eab7b943af134e9bd6d2a4d, type: 3}
m_Name:
m_EditorClassIdentifier:
m_itemTemplate: {fileID: 2115938225093092953}
--- !u!1 &7629852205384748626
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3567888507220032771}
- component: {fileID: 7161685837075545011}
- component: {fileID: 4253545256053581529}
m_Layer: 5
m_Name: Msg
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3567888507220032771
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7629852205384748626}
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: 3702320671699488055}
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.5, y: 0.5}
--- !u!222 &7161685837075545011
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7629852205384748626}
m_CullTransparentMesh: 1
--- !u!114 &4253545256053581529
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7629852205384748626}
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: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: 33a3bdf8f6bd1ec4eba7c4bc58183212, type: 3}
m_FontSize: 23
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 2
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: Make XMB Great Again !
--- !u!1 &8986536818905873058
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7161016329433304235}
- component: {fileID: 2618396739512140295}
- component: {fileID: 702824300661072389}
- component: {fileID: 8367553699093472508}
m_Layer: 5
m_Name: bg
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7161016329433304235
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8986536818905873058}
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: 3702320671699488055}
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!114 &2618396739512140295
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8986536818905873058}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreLayout: 1
m_MinWidth: -1
m_MinHeight: -1
m_PreferredWidth: -1
m_PreferredHeight: -1
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!222 &702824300661072389
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8986536818905873058}
m_CullTransparentMesh: 1
--- !u!114 &8367553699093472508
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8986536818905873058}
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.13207549, g: 0.13207549, b: 0.13207549, 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_Sprite: {fileID: 21300000, guid: b12ca21105df97a469be3cf97a4f5fc1, type: 3}
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

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 838819c4b387d384c8f75f1919261c58
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -15143,6 +15143,8 @@ MonoBehaviour:
m_filterVolume: {fileID: 1475480930}
m_filterPreview: {fileID: 1124446961}
m_xmbBg: {fileID: 730698712}
bTest: 0
mTestSrvIP: 192.168.0.47
--- !u!1 &1427887268
GameObject:
m_ObjectHideFlags: 0
@ -15800,6 +15802,30 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 1599240741}
m_Modifications:
- target: {fileID: 231194784974113132, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 231194784974113132, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 231194784974113132, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 231194784974113132, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 231194784974113132, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 231194784974113132, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 321727879374672331, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_AnchorMax.y
value: 0
@ -15832,6 +15858,38 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 391878975413806388, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 391878975413806388, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 391878975413806388, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 391878975413806388, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 391878975413806388, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 391878975413806388, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 391878975413806388, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 391878975413806388, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 736530578155193984, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_AnchorMax.x
value: 0
@ -15896,6 +15954,10 @@ PrefabInstance:
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1796925837646122750, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1796925837646122750, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
@ -15984,6 +16046,14 @@ PrefabInstance:
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3004640554767743415, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3004640554767743415, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3004640554767743415, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
@ -16008,6 +16078,14 @@ PrefabInstance:
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3252985094363962577, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3252985094363962577, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3252985094363962577, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
@ -16044,10 +16122,22 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3502527855892815924, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3502527855892815924, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3531919738411886375, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3531919738411886375, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3531919739338806916, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_Name
value: Overlay
@ -16136,6 +16226,38 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3637109970695180288, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3637109970695180288, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3637109970695180288, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3637109970695180288, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3637109970695180288, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3637109970695180288, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3637109970695180288, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3637109970695180288, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3750163693177751468, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_AnchorMax.y
value: 0
@ -16236,6 +16358,10 @@ PrefabInstance:
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6153230212222214112, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6153230212222214112, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
@ -16272,6 +16398,10 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6961221314035704232, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7133445375245133773, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
propertyPath: m_AnchorMax.y
value: 0

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bad0f9bf28f67de428fed5977006db1a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,183 +1,183 @@
using AxibugEmuOnline.Client.Manager;
using AxibugEmuOnline.Client.Network;
using System.Collections;
using System.IO;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.Networking;
using static AxibugEmuOnline.Client.HttpAPI;
using static AxibugEmuOnline.Client.Manager.LogManager;
namespace AxibugEmuOnline.Client.ClientCore
{
public static class App
{
public static string TokenStr;
public static string IP;
public static int Port;
public static LogManager log;
public static NetworkHelper network;
public static AppLogin login;
public static AppChat chat;
public static UserDataManager user;
//public static AppNetGame netgame;
public static AppEmu emu;
public static RomLib nesRomLib;
public static HttpAPI httpAPI;
public static CacheManager CacheMgr;
public static AppRoom roomMgr;
public static AppSettings settings;
public static FilterManager filter;
public static AppShare share;
static bool bTest;
static string mTestSrvIP;
#region Mono
public static TickLoop tickLoop;
private static CoroutineRunner coRunner;
#endregion
#if UNITY_PSP2
public static string PersistentDataPath => "ux0:data/AxibugEmu";
#else
public static string PersistentDataPath => Application.persistentDataPath;
#endif
public static void Init(Initer initer,bool isTest = false,string testSrvIP = "")
{
settings = new AppSettings();
log = new LogManager();
LogManager.OnLog += OnNoSugarNetLog;
network = new NetworkHelper();
login = new AppLogin();
chat = new AppChat();
user = new UserDataManager();
emu = new AppEmu();
//netgame = new AppNetGame();
httpAPI = new HttpAPI();
nesRomLib = new RomLib(EnumPlatform.NES);
CacheMgr = new CacheManager();
roomMgr = new AppRoom();
share = new AppShare();
filter = new FilterManager(initer.m_filterVolume, initer.m_filterPreview, initer.m_xmbBg);
bTest = isTest;
mTestSrvIP = testSrvIP;
var go = new GameObject("[AppAxibugEmuOnline]");
GameObject.DontDestroyOnLoad(go);
tickLoop = go.AddComponent<TickLoop>();
coRunner = go.AddComponent<CoroutineRunner>();
if (UnityEngine.Application.platform == RuntimePlatform.PSP2)
{
//PSV 等平台需要手动创建目录
PersistentDataPathDir();
}
var importNode = GameObject.Find("IMPORTENT");
if (importNode != null) GameObject.DontDestroyOnLoad(importNode);
StartCoroutine(AppTickFlow());
RePullNetInfo();
}
private static void PersistentDataPathDir()
{
if (!Directory.Exists(PersistentDataPath))
{
Directory.CreateDirectory(PersistentDataPath);
}
}
private static IEnumerator AppTickFlow()
{
while (true)
{
Tick();
yield return null;
}
}
public static void RePullNetInfo()
{
StartCoroutine(StartNetInit());
}
static IEnumerator StartNetInit()
{
if (App.network.isConnected)
yield break;
int platform = 0;
if (bTest)
{
yield return null;
Connect(mTestSrvIP, 10492);
yield break;
}
UnityWebRequest request = UnityWebRequest.Get($"{App.httpAPI.WebSiteApi}/CheckStandInfo?platform={platform}&version={Application.version}");
yield return request.SendWebRequest();
if (request.result != UnityWebRequest.Result.Success)
yield break;
App.log.Debug($"ApiResp => {request.downloadHandler.text}");
Resp_CheckStandInfo resp = JsonUtility.FromJson<Resp_CheckStandInfo>(request.downloadHandler.text);
//需要更新
if (resp.needUpdateClient == 1)
{
//TODO
}
yield return null;
//Connect("127.0.0.1", 10492);
Connect(resp.serverIp, resp.serverPort);
}
private static void Tick()
{
nesRomLib.ExecuteFetchRomInfo();
}
public static Coroutine StartCoroutine(IEnumerator itor)
{
return coRunner.StartCoroutine(itor);
}
public static void StopCoroutine(Coroutine cor)
{
coRunner.StopCoroutine(cor);
}
public static void Connect(string IP, int port)
{
Task task = new Task(() =>
{
network.Init(IP, port);
});
task.Start();
}
public static void Close()
{
App.log.Info("停止");
}
static void OnNoSugarNetLog(int LogLevel, string msg)
{
E_LogType logType = (E_LogType)LogLevel;
switch (logType)
{
case E_LogType.Debug:
case E_LogType.Info:
Debug.Log("[AxiEmu]:" + msg);
break;
case E_LogType.Warning:
Debug.LogWarning("[AxiEmu]:" + msg);
break;
case E_LogType.Error:
Debug.LogError("[AxiEmu]:" + msg);
break;
}
}
}
using AxibugEmuOnline.Client.Manager;
using AxibugEmuOnline.Client.Network;
using System.Collections;
using System.IO;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.Networking;
using static AxibugEmuOnline.Client.HttpAPI;
using static AxibugEmuOnline.Client.Manager.LogManager;
namespace AxibugEmuOnline.Client.ClientCore
{
public static class App
{
public static string TokenStr;
public static string IP;
public static int Port;
public static LogManager log;
public static NetworkHelper network;
public static AppLogin login;
public static AppChat chat;
public static UserDataManager user;
//public static AppNetGame netgame;
public static AppEmu emu;
public static RomLib nesRomLib;
public static HttpAPI httpAPI;
public static CacheManager CacheMgr;
public static AppRoom roomMgr;
public static AppSettings settings;
public static FilterManager filter;
public static AppShare share;
static bool bTest;
static string mTestSrvIP;
#region Mono
public static TickLoop tickLoop;
private static CoroutineRunner coRunner;
#endregion
#if UNITY_PSP2
public static string PersistentDataPath => "ux0:data/AxibugEmu";
#else
public static string PersistentDataPath => Application.persistentDataPath;
#endif
public static void Init(Initer initer, bool isTest = false, string testSrvIP = "")
{
settings = new AppSettings();
log = new LogManager();
LogManager.OnLog += OnNoSugarNetLog;
network = new NetworkHelper();
login = new AppLogin();
chat = new AppChat();
user = new UserDataManager();
emu = new AppEmu();
//netgame = new AppNetGame();
httpAPI = new HttpAPI();
nesRomLib = new RomLib(EnumPlatform.NES);
CacheMgr = new CacheManager();
roomMgr = new AppRoom();
share = new AppShare();
filter = new FilterManager(initer.m_filterVolume, initer.m_filterPreview, initer.m_xmbBg);
bTest = isTest;
mTestSrvIP = testSrvIP;
var go = new GameObject("[AppAxibugEmuOnline]");
GameObject.DontDestroyOnLoad(go);
tickLoop = go.AddComponent<TickLoop>();
coRunner = go.AddComponent<CoroutineRunner>();
if (UnityEngine.Application.platform == RuntimePlatform.PSP2)
{
//PSV 等平台需要手动创建目录
PersistentDataPathDir();
}
var importNode = GameObject.Find("IMPORTENT");
if (importNode != null) GameObject.DontDestroyOnLoad(importNode);
StartCoroutine(AppTickFlow());
RePullNetInfo();
}
private static void PersistentDataPathDir()
{
if (!Directory.Exists(PersistentDataPath))
{
Directory.CreateDirectory(PersistentDataPath);
}
}
private static IEnumerator AppTickFlow()
{
while (true)
{
Tick();
yield return null;
}
}
public static void RePullNetInfo()
{
StartCoroutine(StartNetInit());
}
static IEnumerator StartNetInit()
{
if (App.network.isConnected)
yield break;
int platform = 0;
if (bTest)
{
yield return null;
Connect(mTestSrvIP, 10492);
yield break;
}
UnityWebRequest request = UnityWebRequest.Get($"{App.httpAPI.WebSiteApi}/CheckStandInfo?platform={platform}&version={Application.version}");
yield return request.SendWebRequest();
if (request.result != UnityWebRequest.Result.Success)
yield break;
App.log.Debug($"ApiResp => {request.downloadHandler.text}");
Resp_CheckStandInfo resp = JsonUtility.FromJson<Resp_CheckStandInfo>(request.downloadHandler.text);
//需要更新
if (resp.needUpdateClient == 1)
{
//TODO
}
yield return null;
//Connect("127.0.0.1", 10492);
Connect(resp.serverIp, resp.serverPort);
}
private static void Tick()
{
nesRomLib.ExecuteFetchRomInfo();
}
public static Coroutine StartCoroutine(IEnumerator itor)
{
return coRunner.StartCoroutine(itor);
}
public static void StopCoroutine(Coroutine cor)
{
coRunner.StopCoroutine(cor);
}
public static void Connect(string IP, int port)
{
Task task = new Task(() =>
{
network.Init(IP, port);
});
task.Start();
}
public static void Close()
{
App.log.Info("停止");
}
static void OnNoSugarNetLog(int LogLevel, string msg)
{
E_LogType logType = (E_LogType)LogLevel;
switch (logType)
{
case E_LogType.Debug:
case E_LogType.Info:
Debug.Log("[AxiEmu]:" + msg);
break;
case E_LogType.Warning:
Debug.LogWarning("[AxiEmu]:" + msg);
break;
case E_LogType.Error:
Debug.LogError("[AxiEmu]:" + msg);
break;
}
}
}
}

View File

@ -1,10 +1,10 @@
namespace AxibugEmuOnline.Client
{
public static class EventInvoker
{
public delegate void OnFilterPresetRemovedHandle(FilterManager.Filter filter, FilterManager.FilterPreset removedPreset);
public static event OnFilterPresetRemovedHandle OnFilterPresetRemoved;
public static void RaiseFilterPresetRemoved(FilterManager.Filter filter, FilterManager.FilterPreset removedPreset)
=> OnFilterPresetRemoved.Invoke(filter, removedPreset);
}
}
namespace AxibugEmuOnline.Client
{
public static class EventInvoker
{
public delegate void OnFilterPresetRemovedHandle(FilterManager.Filter filter, FilterManager.FilterPreset removedPreset);
public static event OnFilterPresetRemovedHandle OnFilterPresetRemoved;
public static void RaiseFilterPresetRemoved(FilterManager.Filter filter, FilterManager.FilterPreset removedPreset)
=> OnFilterPresetRemoved.Invoke(filter, removedPreset);
}
}

View File

@ -1,96 +1,96 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
namespace AxibugEmuOnline.Client
{
public abstract class FilterEffect : PostProcessEffectSettings
{
private List<EditableParamerter> m_editableParamList;
public IReadOnlyCollection<EditableParamerter> EditableParam => m_editableParamList.AsReadOnly();
public abstract string Name { get; }
public FilterEffect()
{
GetEditableFilterParamters();
}
protected void GetEditableFilterParamters()
{
var parameters = (from t in GetType().GetFields(BindingFlags.Instance | BindingFlags.Public)
where t.FieldType.IsSubclassOf(typeof(ParameterOverride))
where t.DeclaringType.IsSubclassOf(typeof(FilterEffect))
orderby t.MetadataToken
select t);
m_editableParamList = new List<EditableParamerter>();
foreach (var param in parameters)
{
var paramObj = (ParameterOverride)param.GetValue(this);
var rangeAtt = param.GetCustomAttribute<RangeAttribute>();
float min = 0;
float max = 10;
if (rangeAtt != null)
{
min = rangeAtt.min; max = rangeAtt.max;
}
var editableParam = new EditableParamerter(param.Name, paramObj, min, max);
m_editableParamList.Add(editableParam);
}
}
public class EditableParamerter
{
private ParameterOverride m_paramObject;
private FieldInfo valueFieldInfo;
public Type ValueType { get; private set; }
public string Name { get; private set; }
public object Value
{
get => valueFieldInfo.GetValue(m_paramObject);
set
{
valueFieldInfo.SetValue(m_paramObject, value);
m_paramObject.overrideState = true;
}
}
public object MinValue { get; private set; }
public object MaxValue { get; private set; }
public EditableParamerter(string name, ParameterOverride paramObject, object minValue, object maxValue)
{
m_paramObject = paramObject;
Name = name;
var paramType = paramObject.GetType();
valueFieldInfo = paramType.GetField("value", BindingFlags.Public | BindingFlags.Instance);
if (valueFieldInfo != null)
{
ValueType = valueFieldInfo.FieldType;
}
else
{
ValueType = typeof(object);
}
MinValue = minValue;
MaxValue = maxValue;
}
public void ResetToDefault() => m_paramObject.overrideState = false;
public void Apply(object overrideValue)
{
Value = overrideValue;
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
namespace AxibugEmuOnline.Client
{
public abstract class FilterEffect : PostProcessEffectSettings
{
private List<EditableParamerter> m_editableParamList;
public IReadOnlyCollection<EditableParamerter> EditableParam => m_editableParamList.AsReadOnly();
public abstract string Name { get; }
public FilterEffect()
{
GetEditableFilterParamters();
}
protected void GetEditableFilterParamters()
{
var parameters = (from t in GetType().GetFields(BindingFlags.Instance | BindingFlags.Public)
where t.FieldType.IsSubclassOf(typeof(ParameterOverride))
where t.DeclaringType.IsSubclassOf(typeof(FilterEffect))
orderby t.MetadataToken
select t);
m_editableParamList = new List<EditableParamerter>();
foreach (var param in parameters)
{
var paramObj = (ParameterOverride)param.GetValue(this);
var rangeAtt = param.GetCustomAttribute<RangeAttribute>();
float min = 0;
float max = 10;
if (rangeAtt != null)
{
min = rangeAtt.min; max = rangeAtt.max;
}
var editableParam = new EditableParamerter(param.Name, paramObj, min, max);
m_editableParamList.Add(editableParam);
}
}
public class EditableParamerter
{
private ParameterOverride m_paramObject;
private FieldInfo valueFieldInfo;
public Type ValueType { get; private set; }
public string Name { get; private set; }
public object Value
{
get => valueFieldInfo.GetValue(m_paramObject);
set
{
valueFieldInfo.SetValue(m_paramObject, value);
m_paramObject.overrideState = true;
}
}
public object MinValue { get; private set; }
public object MaxValue { get; private set; }
public EditableParamerter(string name, ParameterOverride paramObject, object minValue, object maxValue)
{
m_paramObject = paramObject;
Name = name;
var paramType = paramObject.GetType();
valueFieldInfo = paramType.GetField("value", BindingFlags.Public | BindingFlags.Instance);
if (valueFieldInfo != null)
{
ValueType = valueFieldInfo.FieldType;
}
else
{
ValueType = typeof(object);
}
MinValue = minValue;
MaxValue = maxValue;
}
public void ResetToDefault() => m_paramObject.overrideState = false;
public void Apply(object overrideValue)
{
Value = overrideValue;
}
}
}
}

View File

@ -1,106 +1,106 @@
using AxibugEmuOnline.Client;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
[System.Serializable]
[PostProcess(typeof(FixingPixelArtGrilleRenderer), PostProcessEvent.BeforeStack, "Filter/FixingPixelArtGrille")]
public sealed class FixingPixelArtGrille : FilterEffect
{
public override string Name => nameof(FixingPixelArtGrille);
public ParameterOverride<EnumMaskStyle> MaskStyle = new ParameterOverride<EnumMaskStyle> { value = EnumMaskStyle.ApertureGrille };
[Tooltip("Emulated input resolution\nOptimize for resize")]
public Vector2Parameter DrawResolution = new Vector2Parameter
{
value = new Vector2(272, 240)
};
[Tooltip("Hardness of scanline")]
[Range(-32, 0)]
public FloatParameter HardScan = new FloatParameter { value = -10 };
[Tooltip("Hardness of pixels in scanline")]
[Range(-6, 0)]
public FloatParameter HardPix = new FloatParameter { value = -2 };
[Tooltip("Hardness of short vertical bloom")]
[Range(-8, 0)]
public FloatParameter HardBloomScan = new FloatParameter { value = -4.0f };
[Tooltip("Hardness of short horizontal bloom")]
[Range(-4, 0)]
public FloatParameter HardBloomPix = new FloatParameter { value = -1.5f };
[Tooltip("Amount of small bloom effect")]
[Range(0, 1)]
public FloatParameter BloomAmount = new FloatParameter { value = 1 / 16f };
[Tooltip("Display warp")]
public Vector2Parameter Warp = new Vector2Parameter { value = new Vector2(1f / 64f, 1f / 24f) };
[Tooltip("Amount of shadow mask Light")]
[Range(1, 3)]
public FloatParameter MaskLight = new FloatParameter { value = 1.5f };
[Range(0.1f, 1)]
[Tooltip("Amount of shadow mask Dark")]
public FloatParameter MaskDrak = new FloatParameter { value = 0.5f };
public enum EnumMaskStyle
{
TVStyle,
ApertureGrille,
StretchedVGA,
VGAStyle
}
}
public sealed class FixingPixelArtGrilleRenderer : PostProcessEffectRenderer<FixingPixelArtGrille>
{
private Shader shader;
private Material material;
public override void Init()
{
shader = Shader.Find("PostEffect/FixingPixcelArtGrille");
material = new Material(shader);
}
public override void Render(PostProcessRenderContext context)
{
material.SetVector("_iResolution", new Vector4(Screen.width, Screen.height, 0, 0));
var res = settings.DrawResolution;
material.SetVector("_res", new Vector4(res.value.x, res.value.y, 0, 0));
material.SetFloat("_hardScan", settings.HardScan.value);
material.SetFloat("_hardPix", settings.HardPix.value);
material.SetFloat("_hardBloomScan", settings.HardBloomScan.value);
material.SetFloat("_hardBloomPix", settings.HardBloomPix.value);
material.SetFloat("_bloomAmount", settings.BloomAmount.value);
material.SetVector("_warp", settings.Warp.value);
material.SetFloat("_maskDark", settings.MaskDrak.value);
material.SetFloat("_maskLight", settings.MaskLight.value);
material.DisableKeyword("_MASKSTYLE_VGASTYLE");
material.DisableKeyword("_MASKSTYLE_TVSTYLE");
material.DisableKeyword("_MASKSTYLE_APERTUREGRILLE");
material.DisableKeyword("_MASKSTYLE_STRETCHEDVGA");
switch (settings.MaskStyle.value)
{
case FixingPixelArtGrille.EnumMaskStyle.VGAStyle:
material.EnableKeyword("_MASKSTYLE_VGASTYLE");
break;
case FixingPixelArtGrille.EnumMaskStyle.TVStyle:
material.EnableKeyword("_MASKSTYLE_TVSTYLE");
break;
case FixingPixelArtGrille.EnumMaskStyle.ApertureGrille:
material.EnableKeyword("_MASKSTYLE_APERTUREGRILLE");
break;
case FixingPixelArtGrille.EnumMaskStyle.StretchedVGA:
material.EnableKeyword("_MASKSTYLE_STRETCHEDVGA");
break;
}
context.command.Blit(context.source, context.destination, material);
}
using AxibugEmuOnline.Client;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
[System.Serializable]
[PostProcess(typeof(FixingPixelArtGrilleRenderer), PostProcessEvent.BeforeStack, "Filter/FixingPixelArtGrille")]
public sealed class FixingPixelArtGrille : FilterEffect
{
public override string Name => nameof(FixingPixelArtGrille);
public ParameterOverride<EnumMaskStyle> MaskStyle = new ParameterOverride<EnumMaskStyle> { value = EnumMaskStyle.ApertureGrille };
[Tooltip("Emulated input resolution\nOptimize for resize")]
public Vector2Parameter DrawResolution = new Vector2Parameter
{
value = new Vector2(272, 240)
};
[Tooltip("Hardness of scanline")]
[Range(-32, 0)]
public FloatParameter HardScan = new FloatParameter { value = -10 };
[Tooltip("Hardness of pixels in scanline")]
[Range(-6, 0)]
public FloatParameter HardPix = new FloatParameter { value = -2 };
[Tooltip("Hardness of short vertical bloom")]
[Range(-8, 0)]
public FloatParameter HardBloomScan = new FloatParameter { value = -4.0f };
[Tooltip("Hardness of short horizontal bloom")]
[Range(-4, 0)]
public FloatParameter HardBloomPix = new FloatParameter { value = -1.5f };
[Tooltip("Amount of small bloom effect")]
[Range(0, 1)]
public FloatParameter BloomAmount = new FloatParameter { value = 1 / 16f };
[Tooltip("Display warp")]
public Vector2Parameter Warp = new Vector2Parameter { value = new Vector2(1f / 64f, 1f / 24f) };
[Tooltip("Amount of shadow mask Light")]
[Range(1, 3)]
public FloatParameter MaskLight = new FloatParameter { value = 1.5f };
[Range(0.1f, 1)]
[Tooltip("Amount of shadow mask Dark")]
public FloatParameter MaskDrak = new FloatParameter { value = 0.5f };
public enum EnumMaskStyle
{
TVStyle,
ApertureGrille,
StretchedVGA,
VGAStyle
}
}
public sealed class FixingPixelArtGrilleRenderer : PostProcessEffectRenderer<FixingPixelArtGrille>
{
private Shader shader;
private Material material;
public override void Init()
{
shader = Shader.Find("PostEffect/FixingPixcelArtGrille");
material = new Material(shader);
}
public override void Render(PostProcessRenderContext context)
{
material.SetVector("_iResolution", new Vector4(Screen.width, Screen.height, 0, 0));
var res = settings.DrawResolution;
material.SetVector("_res", new Vector4(res.value.x, res.value.y, 0, 0));
material.SetFloat("_hardScan", settings.HardScan.value);
material.SetFloat("_hardPix", settings.HardPix.value);
material.SetFloat("_hardBloomScan", settings.HardBloomScan.value);
material.SetFloat("_hardBloomPix", settings.HardBloomPix.value);
material.SetFloat("_bloomAmount", settings.BloomAmount.value);
material.SetVector("_warp", settings.Warp.value);
material.SetFloat("_maskDark", settings.MaskDrak.value);
material.SetFloat("_maskLight", settings.MaskLight.value);
material.DisableKeyword("_MASKSTYLE_VGASTYLE");
material.DisableKeyword("_MASKSTYLE_TVSTYLE");
material.DisableKeyword("_MASKSTYLE_APERTUREGRILLE");
material.DisableKeyword("_MASKSTYLE_STRETCHEDVGA");
switch (settings.MaskStyle.value)
{
case FixingPixelArtGrille.EnumMaskStyle.VGAStyle:
material.EnableKeyword("_MASKSTYLE_VGASTYLE");
break;
case FixingPixelArtGrille.EnumMaskStyle.TVStyle:
material.EnableKeyword("_MASKSTYLE_TVSTYLE");
break;
case FixingPixelArtGrille.EnumMaskStyle.ApertureGrille:
material.EnableKeyword("_MASKSTYLE_APERTUREGRILLE");
break;
case FixingPixelArtGrille.EnumMaskStyle.StretchedVGA:
material.EnableKeyword("_MASKSTYLE_STRETCHEDVGA");
break;
}
context.command.Blit(context.source, context.destination, material);
}
}

View File

@ -1,293 +1,293 @@
Shader "PostEffect/FixingPixcelArtGrille"
{
Properties
{
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader
{
Pass
{
CGPROGRAM
#pragma shader_feature_local _MASKSTYLE_TVSTYLE _MASKSTYLE_APERTUREGRILLE _MASKSTYLE_STRETCHEDVGA _MASKSTYLE_VGASTYLE
#pragma vertex vert_img
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _MainTex;
float4 _MainTex_TexelSize;
//
// PUBLIC DOMAIN CRT STYLED SCAN-LINE SHADER
//
// by Timothy Lottes
//
// This is more along the style of a really good CGA arcade monitor.
// With RGB inputs instead of NTSC.
// The shadow mask example has the mask rotated 90 degrees for less chromatic aberration.
//
// Left it unoptimized to show the theory behind the algorithm.
//
// It is an example what I personally would want as a display option for pixel art games.
// Please take and use, change, or whatever.
//
float2 _iResolution = float2(1920,1080);
// Emulated input resolution.
// Optimize for resize.
float2 _res = float2(272.0,240.0);
// Hardness of scanline.
// -8.0 = soft
// -16.0 = medium
float _hardScan = -10.0;
// Hardness of pixels in scanline.
// -2.0 = soft
// -4.0 = hard
float _hardPix =-2.0;
// Hardness of short vertical bloom.
// -1.0 = wide to the point of clipping (bad)
// -1.5 = wide
// -4.0 = not very wide at all
float _hardBloomScan = -4.0;
// Hardness of short horizontal bloom.
// -0.5 = wide to the point of clipping (bad)
// -1.0 = wide
// -2.0 = not very wide at all
float _hardBloomPix = -1.5;
// Amount of small bloom effect.
// 1.0/1.0 = only bloom
// 1.0/16.0 = what I think is a good amount of small bloom
// 0.0 = no bloom
float _bloomAmount = 1.0/16.0;
// Display warp.
// 0.0 = none
// 1.0/8.0 = extreme
float2 _warp = float2(1.0/64.0,1.0/24.0);
// Amount of shadow mask.
float _maskDark = 0.5;
float _maskLight = 1.5;
//------------------------------------------------------------------------
float fract(float x){
return x-floor(x);
}
// sRGB to Linear.
// Assuing using sRGB typed textures this should not be needed.
float ToLinear1(float c){return(c<=0.04045)?c/12.92:pow((c+0.055)/1.055,2.4);}
float3 ToLinear(float3 c){return float3(ToLinear1(c.r),ToLinear1(c.g),ToLinear1(c.b));}
// Linear to sRGB.
// Assuing using sRGB typed textures this should not be needed.
float ToSrgb1(float c){return(c<0.0031308?c*12.92:1.055*pow(c,0.41666)-0.055);}
float3 ToSrgb(float3 c){return float3(ToSrgb1(c.r),ToSrgb1(c.g),ToSrgb1(c.b));}
float3 Test(float3 c){return c*(1.0/64.0)+c*c*c;}
// Nearest emulated sample given floating point position and texel offset.
// Also zero's off screen.
float3 Fetch( float2 pos,float2 off){
pos=floor(pos*_res+off)/_res;
if(max(abs(pos.x-0.5),abs(pos.y-0.5))>0.5)return float3(0.0,0.0,0.0);
return Test(ToLinear(tex2D(_MainTex,pos.xy).rgb));}
// Distance in emulated pixels to nearest texel.
float2 Dist(float2 pos){pos=pos*_res;return -((pos-floor(pos))-float2(0.5,0.5));}
// 1D Gaussian.
float Gaus(float pos,float scale){return exp2(scale*pos*pos);}
// 3-tap Gaussian filter along horz line.
float3 Horz3(float2 pos,float off){
float3 b=Fetch(pos,float2(-1.0,off));
float3 c=Fetch(pos,float2( 0.0,off));
float3 d=Fetch(pos,float2( 1.0,off));
float dst=Dist(pos).x;
// Convert distance to weight.
float scale=_hardPix;
float wb=Gaus(dst-1.0,scale);
float wc=Gaus(dst+0.0,scale);
float wd=Gaus(dst+1.0,scale);
// Return filtered sample.
return (b*wb+c*wc+d*wd)/(wb+wc+wd);}
// 5-tap Gaussian filter along horz line.
float3 Horz5(float2 pos,float off){
float3 a=Fetch(pos,float2(-2.0,off));
float3 b=Fetch(pos,float2(-1.0,off));
float3 c=Fetch(pos,float2( 0.0,off));
float3 d=Fetch(pos,float2( 1.0,off));
float3 e=Fetch(pos,float2( 2.0,off));
float dst=Dist(pos).x;
// Convert distance to weight.
float scale=_hardPix;
float wa=Gaus(dst-2.0,scale);
float wb=Gaus(dst-1.0,scale);
float wc=Gaus(dst+0.0,scale);
float wd=Gaus(dst+1.0,scale);
float we=Gaus(dst+2.0,scale);
// Return filtered sample.
return (a*wa+b*wb+c*wc+d*wd+e*we)/(wa+wb+wc+wd+we);}
// 7-tap Gaussian filter along horz line.
float3 Horz7(float2 pos,float off){
float3 a=Fetch(pos,float2(-3.0,off));
float3 b=Fetch(pos,float2(-2.0,off));
float3 c=Fetch(pos,float2(-1.0,off));
float3 d=Fetch(pos,float2( 0.0,off));
float3 e=Fetch(pos,float2( 1.0,off));
float3 f=Fetch(pos,float2( 2.0,off));
float3 g=Fetch(pos,float2( 3.0,off));
float dst=Dist(pos).x;
// Convert distance to weight.
float scale=_hardBloomPix;
float wa=Gaus(dst-3.0,scale);
float wb=Gaus(dst-2.0,scale);
float wc=Gaus(dst-1.0,scale);
float wd=Gaus(dst+0.0,scale);
float we=Gaus(dst+1.0,scale);
float wf=Gaus(dst+2.0,scale);
float wg=Gaus(dst+3.0,scale);
// Return filtered sample.
return (a*wa+b*wb+c*wc+d*wd+e*we+f*wf+g*wg)/(wa+wb+wc+wd+we+wf+wg);}
// Return scanline weight.
float Scan(float2 pos,float off){
float dst=Dist(pos).y;
return Gaus(dst+off,_hardScan);}
// Return scanline weight for bloom.
float BloomScan(float2 pos,float off){
float dst=Dist(pos).y;
return Gaus(dst+off,_hardBloomScan);}
// Allow nearest three lines to effect pixel.
float3 Tri(float2 pos){
float3 a=Horz3(pos,-1.0);
float3 b=Horz5(pos, 0.0);
float3 c=Horz3(pos, 1.0);
float wa=Scan(pos,-1.0);
float wb=Scan(pos, 0.0);
float wc=Scan(pos, 1.0);
return a*wa+b*wb+c*wc;}
// Small bloom.
float3 Bloom(float2 pos){
float3 a=Horz5(pos,-2.0);
float3 b=Horz7(pos,-1.0);
float3 c=Horz7(pos, 0.0);
float3 d=Horz7(pos, 1.0);
float3 e=Horz5(pos, 2.0);
float wa=BloomScan(pos,-2.0);
float wb=BloomScan(pos,-1.0);
float wc=BloomScan(pos, 0.0);
float wd=BloomScan(pos, 1.0);
float we=BloomScan(pos, 2.0);
return a*wa+b*wb+c*wc+d*wd+e*we;}
// Distortion of scanlines, and end of screen alpha.
float2 Warp(float2 pos){
pos=pos*2.0-1.0;
pos*=float2(1.0+(pos.y*pos.y)*_warp.x,1.0+(pos.x*pos.x)*_warp.y);
return pos*0.5+0.5;}
#if defined(_MASKSTYLE_TVSTYLE)
// Very compressed TV style shadow mask.
float3 Mask(float2 pos){
float lineee=_maskLight;
float odd=0.0;
if(fract(pos.x/6.0)<0.5)odd=1.0;
if(fract((pos.y+odd)/2.0)<0.5) lineee=_maskDark;
pos.x=fract(pos.x/3.0);
float3 mask=float3(_maskDark,_maskDark,_maskDark);
if(pos.x<0.333)mask.r=_maskLight;
else if(pos.x<0.666)mask.g=_maskLight;
else mask.b=_maskLight;
mask*=lineee;
return mask;
}
#elif defined(_MASKSTYLE_APERTUREGRILLE)
// Aperture-grille.
float3 Mask(float2 pos){
pos.x=fract(pos.x/3.0);
float3 mask=float3(_maskDark,_maskDark,_maskDark);
if(pos.x<0.333)mask.r=_maskLight;
else if(pos.x<0.666)mask.g=_maskLight;
else mask.b=_maskLight;
return mask;}
#elif defined(_MASKSTYLE_STRETCHEDVGA)
// Stretched VGA style shadow mask (same as prior shaders).
float3 Mask(float2 pos){
pos.x+=pos.y*3.0;
float3 mask=float3(_maskDark,_maskDark,_maskDark);
pos.x=fract(pos.x/6.0);
if(pos.x<0.333)mask.r=_maskLight;
else if(pos.x<0.666)mask.g=_maskLight;
else mask.b=_maskLight;
return mask;}
#elif defined(_MASKSTYLE_VGASTYLE)
// VGA style shadow mask.
float3 Mask(float2 pos){
pos.xy=floor(pos.xy*float2(1.0,0.5));
pos.x+=pos.y*3.0;
float3 mask=float3(_maskDark,_maskDark,_maskDark);
pos.x=fract(pos.x/6.0);
if(pos.x<0.333)mask.r=_maskLight;
else if(pos.x<0.666)mask.g=_maskLight;
else mask.b=_maskLight;
return mask;}
#endif
// Draw dividing bars.
float Bar(float pos,float bar){pos-=bar;return pos*pos<4.0?0.0:1.0;}
// Entry.
float4 mainImage(float2 fragCoord){
float4 fragColor = float4(1,1,1,1);
float2 pos=Warp(fragCoord.xy/_iResolution.xy);
fragColor.rgb=Tri(pos)*Mask(fragCoord.xy);
fragColor.rgb+=Bloom(pos)*_bloomAmount;
fragColor.a=1.0;
fragColor.rgb=ToSrgb(fragColor.rgb);
return fragColor;
}
struct v2f
{
float4 pos : POSITION;
float2 uv : TEXCOORD0;
};
fixed4 frag (v2f i) : SV_Target
{
float2 pos = _iResolution.xy*i.uv;
fixed4 col = mainImage(pos);
return col;
}
ENDCG
}
}
}
Shader "PostEffect/FixingPixcelArtGrille"
{
Properties
{
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader
{
Pass
{
CGPROGRAM
#pragma shader_feature_local _MASKSTYLE_TVSTYLE _MASKSTYLE_APERTUREGRILLE _MASKSTYLE_STRETCHEDVGA _MASKSTYLE_VGASTYLE
#pragma vertex vert_img
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _MainTex;
float4 _MainTex_TexelSize;
//
// PUBLIC DOMAIN CRT STYLED SCAN-LINE SHADER
//
// by Timothy Lottes
//
// This is more along the style of a really good CGA arcade monitor.
// With RGB inputs instead of NTSC.
// The shadow mask example has the mask rotated 90 degrees for less chromatic aberration.
//
// Left it unoptimized to show the theory behind the algorithm.
//
// It is an example what I personally would want as a display option for pixel art games.
// Please take and use, change, or whatever.
//
float2 _iResolution = float2(1920,1080);
// Emulated input resolution.
// Optimize for resize.
float2 _res = float2(272.0,240.0);
// Hardness of scanline.
// -8.0 = soft
// -16.0 = medium
float _hardScan = -10.0;
// Hardness of pixels in scanline.
// -2.0 = soft
// -4.0 = hard
float _hardPix =-2.0;
// Hardness of short vertical bloom.
// -1.0 = wide to the point of clipping (bad)
// -1.5 = wide
// -4.0 = not very wide at all
float _hardBloomScan = -4.0;
// Hardness of short horizontal bloom.
// -0.5 = wide to the point of clipping (bad)
// -1.0 = wide
// -2.0 = not very wide at all
float _hardBloomPix = -1.5;
// Amount of small bloom effect.
// 1.0/1.0 = only bloom
// 1.0/16.0 = what I think is a good amount of small bloom
// 0.0 = no bloom
float _bloomAmount = 1.0/16.0;
// Display warp.
// 0.0 = none
// 1.0/8.0 = extreme
float2 _warp = float2(1.0/64.0,1.0/24.0);
// Amount of shadow mask.
float _maskDark = 0.5;
float _maskLight = 1.5;
//------------------------------------------------------------------------
float fract(float x){
return x-floor(x);
}
// sRGB to Linear.
// Assuing using sRGB typed textures this should not be needed.
float ToLinear1(float c){return(c<=0.04045)?c/12.92:pow((c+0.055)/1.055,2.4);}
float3 ToLinear(float3 c){return float3(ToLinear1(c.r),ToLinear1(c.g),ToLinear1(c.b));}
// Linear to sRGB.
// Assuing using sRGB typed textures this should not be needed.
float ToSrgb1(float c){return(c<0.0031308?c*12.92:1.055*pow(c,0.41666)-0.055);}
float3 ToSrgb(float3 c){return float3(ToSrgb1(c.r),ToSrgb1(c.g),ToSrgb1(c.b));}
float3 Test(float3 c){return c*(1.0/64.0)+c*c*c;}
// Nearest emulated sample given floating point position and texel offset.
// Also zero's off screen.
float3 Fetch( float2 pos,float2 off){
pos=floor(pos*_res+off)/_res;
if(max(abs(pos.x-0.5),abs(pos.y-0.5))>0.5)return float3(0.0,0.0,0.0);
return Test(ToLinear(tex2D(_MainTex,pos.xy).rgb));}
// Distance in emulated pixels to nearest texel.
float2 Dist(float2 pos){pos=pos*_res;return -((pos-floor(pos))-float2(0.5,0.5));}
// 1D Gaussian.
float Gaus(float pos,float scale){return exp2(scale*pos*pos);}
// 3-tap Gaussian filter along horz line.
float3 Horz3(float2 pos,float off){
float3 b=Fetch(pos,float2(-1.0,off));
float3 c=Fetch(pos,float2( 0.0,off));
float3 d=Fetch(pos,float2( 1.0,off));
float dst=Dist(pos).x;
// Convert distance to weight.
float scale=_hardPix;
float wb=Gaus(dst-1.0,scale);
float wc=Gaus(dst+0.0,scale);
float wd=Gaus(dst+1.0,scale);
// Return filtered sample.
return (b*wb+c*wc+d*wd)/(wb+wc+wd);}
// 5-tap Gaussian filter along horz line.
float3 Horz5(float2 pos,float off){
float3 a=Fetch(pos,float2(-2.0,off));
float3 b=Fetch(pos,float2(-1.0,off));
float3 c=Fetch(pos,float2( 0.0,off));
float3 d=Fetch(pos,float2( 1.0,off));
float3 e=Fetch(pos,float2( 2.0,off));
float dst=Dist(pos).x;
// Convert distance to weight.
float scale=_hardPix;
float wa=Gaus(dst-2.0,scale);
float wb=Gaus(dst-1.0,scale);
float wc=Gaus(dst+0.0,scale);
float wd=Gaus(dst+1.0,scale);
float we=Gaus(dst+2.0,scale);
// Return filtered sample.
return (a*wa+b*wb+c*wc+d*wd+e*we)/(wa+wb+wc+wd+we);}
// 7-tap Gaussian filter along horz line.
float3 Horz7(float2 pos,float off){
float3 a=Fetch(pos,float2(-3.0,off));
float3 b=Fetch(pos,float2(-2.0,off));
float3 c=Fetch(pos,float2(-1.0,off));
float3 d=Fetch(pos,float2( 0.0,off));
float3 e=Fetch(pos,float2( 1.0,off));
float3 f=Fetch(pos,float2( 2.0,off));
float3 g=Fetch(pos,float2( 3.0,off));
float dst=Dist(pos).x;
// Convert distance to weight.
float scale=_hardBloomPix;
float wa=Gaus(dst-3.0,scale);
float wb=Gaus(dst-2.0,scale);
float wc=Gaus(dst-1.0,scale);
float wd=Gaus(dst+0.0,scale);
float we=Gaus(dst+1.0,scale);
float wf=Gaus(dst+2.0,scale);
float wg=Gaus(dst+3.0,scale);
// Return filtered sample.
return (a*wa+b*wb+c*wc+d*wd+e*we+f*wf+g*wg)/(wa+wb+wc+wd+we+wf+wg);}
// Return scanline weight.
float Scan(float2 pos,float off){
float dst=Dist(pos).y;
return Gaus(dst+off,_hardScan);}
// Return scanline weight for bloom.
float BloomScan(float2 pos,float off){
float dst=Dist(pos).y;
return Gaus(dst+off,_hardBloomScan);}
// Allow nearest three lines to effect pixel.
float3 Tri(float2 pos){
float3 a=Horz3(pos,-1.0);
float3 b=Horz5(pos, 0.0);
float3 c=Horz3(pos, 1.0);
float wa=Scan(pos,-1.0);
float wb=Scan(pos, 0.0);
float wc=Scan(pos, 1.0);
return a*wa+b*wb+c*wc;}
// Small bloom.
float3 Bloom(float2 pos){
float3 a=Horz5(pos,-2.0);
float3 b=Horz7(pos,-1.0);
float3 c=Horz7(pos, 0.0);
float3 d=Horz7(pos, 1.0);
float3 e=Horz5(pos, 2.0);
float wa=BloomScan(pos,-2.0);
float wb=BloomScan(pos,-1.0);
float wc=BloomScan(pos, 0.0);
float wd=BloomScan(pos, 1.0);
float we=BloomScan(pos, 2.0);
return a*wa+b*wb+c*wc+d*wd+e*we;}
// Distortion of scanlines, and end of screen alpha.
float2 Warp(float2 pos){
pos=pos*2.0-1.0;
pos*=float2(1.0+(pos.y*pos.y)*_warp.x,1.0+(pos.x*pos.x)*_warp.y);
return pos*0.5+0.5;}
#if defined(_MASKSTYLE_TVSTYLE)
// Very compressed TV style shadow mask.
float3 Mask(float2 pos){
float lineee=_maskLight;
float odd=0.0;
if(fract(pos.x/6.0)<0.5)odd=1.0;
if(fract((pos.y+odd)/2.0)<0.5) lineee=_maskDark;
pos.x=fract(pos.x/3.0);
float3 mask=float3(_maskDark,_maskDark,_maskDark);
if(pos.x<0.333)mask.r=_maskLight;
else if(pos.x<0.666)mask.g=_maskLight;
else mask.b=_maskLight;
mask*=lineee;
return mask;
}
#elif defined(_MASKSTYLE_APERTUREGRILLE)
// Aperture-grille.
float3 Mask(float2 pos){
pos.x=fract(pos.x/3.0);
float3 mask=float3(_maskDark,_maskDark,_maskDark);
if(pos.x<0.333)mask.r=_maskLight;
else if(pos.x<0.666)mask.g=_maskLight;
else mask.b=_maskLight;
return mask;}
#elif defined(_MASKSTYLE_STRETCHEDVGA)
// Stretched VGA style shadow mask (same as prior shaders).
float3 Mask(float2 pos){
pos.x+=pos.y*3.0;
float3 mask=float3(_maskDark,_maskDark,_maskDark);
pos.x=fract(pos.x/6.0);
if(pos.x<0.333)mask.r=_maskLight;
else if(pos.x<0.666)mask.g=_maskLight;
else mask.b=_maskLight;
return mask;}
#elif defined(_MASKSTYLE_VGASTYLE)
// VGA style shadow mask.
float3 Mask(float2 pos){
pos.xy=floor(pos.xy*float2(1.0,0.5));
pos.x+=pos.y*3.0;
float3 mask=float3(_maskDark,_maskDark,_maskDark);
pos.x=fract(pos.x/6.0);
if(pos.x<0.333)mask.r=_maskLight;
else if(pos.x<0.666)mask.g=_maskLight;
else mask.b=_maskLight;
return mask;}
#endif
// Draw dividing bars.
float Bar(float pos,float bar){pos-=bar;return pos*pos<4.0?0.0:1.0;}
// Entry.
float4 mainImage(float2 fragCoord){
float4 fragColor = float4(1,1,1,1);
float2 pos=Warp(fragCoord.xy/_iResolution.xy);
fragColor.rgb=Tri(pos)*Mask(fragCoord.xy);
fragColor.rgb+=Bloom(pos)*_bloomAmount;
fragColor.a=1.0;
fragColor.rgb=ToSrgb(fragColor.rgb);
return fragColor;
}
struct v2f
{
float4 pos : POSITION;
float2 uv : TEXCOORD0;
};
fixed4 frag (v2f i) : SV_Target
{
float2 pos = _iResolution.xy*i.uv;
fixed4 col = mainImage(pos);
return col;
}
ENDCG
}
}
}

View File

@ -1,28 +1,28 @@
using AxibugEmuOnline.Client;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
[System.Serializable]
[PostProcess(typeof(MattiasCRTRenderer), PostProcessEvent.BeforeStack, "Filter/MattiasCRT")]
public sealed class MattiasCRT : FilterEffect
{
public override string Name => nameof(MattiasCRT);
}
public sealed class MattiasCRTRenderer : PostProcessEffectRenderer<MattiasCRT>
{
private Shader shader;
private Material material;
public override void Init()
{
shader = Shader.Find("Filter/MattiasCRT");
material = new Material(shader);
}
public override void Render(PostProcessRenderContext context)
{
material.SetVector("_iResolution", new Vector4(Screen.width, Screen.height, 0, 0));
context.command.Blit(context.source, context.destination, material);
}
using AxibugEmuOnline.Client;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
[System.Serializable]
[PostProcess(typeof(MattiasCRTRenderer), PostProcessEvent.BeforeStack, "Filter/MattiasCRT")]
public sealed class MattiasCRT : FilterEffect
{
public override string Name => nameof(MattiasCRT);
}
public sealed class MattiasCRTRenderer : PostProcessEffectRenderer<MattiasCRT>
{
private Shader shader;
private Material material;
public override void Init()
{
shader = Shader.Find("Filter/MattiasCRT");
material = new Material(shader);
}
public override void Render(PostProcessRenderContext context)
{
material.SetVector("_iResolution", new Vector4(Screen.width, Screen.height, 0, 0));
context.command.Blit(context.source, context.destination, material);
}
}

View File

@ -1,98 +1,98 @@
Shader "Filter/MattiasCRT"
{
Properties
{
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader
{
Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _MainTex;
float4 _MainTex_TexelSize;
float2 _iResolution;
float2 curve(float2 uv)
{
uv = (uv - 0.5) * 2.0;
uv *= 1.1;
uv.x *= 1.0 + pow((abs(uv.y) / 5.0), 2.0);
uv.y *= 1.0 + pow((abs(uv.x) / 4.0), 2.0);
uv = (uv / 2.0) + 0.5;
uv = uv *0.92 + 0.04;
return uv;
}
float4 mainImage( float2 fragCoord )
{
float4 fragColor = float4(0,0,0,1);
float2 q = fragCoord.xy / _iResolution.xy;
float2 uv = q;
uv = curve( uv );
float3 oricol = tex2D(_MainTex,uv).xyz;
float3 col;
float x = sin(0.3*_Time+uv.y*21.0)*sin(0.7*_Time+uv.y*29.0)*sin(0.3+0.33*_Time+uv.y*31.0)*0.0017;
col.r = tex2D(_MainTex,float2(x+uv.x+0.001,uv.y+0.001)).x+0.05;
col.g = tex2D(_MainTex,float2(x+uv.x+0.000,uv.y-0.002)).y+0.05;
col.b = tex2D(_MainTex,float2(x+uv.x-0.002,uv.y+0.000)).z+0.05;
col.r += 0.08*tex2D(_MainTex,0.75*float2(x+0.025, -0.027)+float2(uv.x+0.001,uv.y+0.001)).x;
col.g += 0.05*tex2D(_MainTex,0.75*float2(x+-0.022, -0.02)+float2(uv.x+0.000,uv.y-0.002)).y;
col.b += 0.08*tex2D(_MainTex,0.75*float2(x+-0.02, -0.018)+float2(uv.x-0.002,uv.y+0.000)).z;
col = clamp(col*0.6+0.4*col*col*1.0,0.0,1.0);
float vig = (0.0 + 1.0*16.0*uv.x*uv.y*(1.0-uv.x)*(1.0-uv.y));
col *= pow(vig,0.3);
col *= float3(0.95,1.05,0.95);
col *= 2.8;
float scans = clamp( 0.35+0.35*sin(3.5*_Time+uv.y*_iResolution.y*1.5), 0.0, 1.0);
float s = pow(scans,1.7);
col = col*( 0.4+0.7*s) ;
col *= 1.0+0.01*sin(110.0*_Time);
if (uv.x < 0.0 || uv.x > 1.0)
col *= 0.0;
if (uv.y < 0.0 || uv.y > 1.0)
col *= 0.0;
col*=1.0-0.65*clamp((fragCoord.x % 2.0 -1.0 )*2.0,0.0,1.0);
float comp = smoothstep( 0.1, 0.9, sin(_Time) );
fragColor = float4(col,1.0);
return fragColor;
}
struct v2f
{
float4 pos : POSITION;
float2 uv : TEXCOORD0;
};
fixed4 frag (v2f i) : SV_Target
{
float2 pos = _iResolution.xy*i.uv;
fixed4 col = mainImage(pos);
return col;
}
ENDCG
}
}
}
Shader "Filter/MattiasCRT"
{
Properties
{
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader
{
Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _MainTex;
float4 _MainTex_TexelSize;
float2 _iResolution;
float2 curve(float2 uv)
{
uv = (uv - 0.5) * 2.0;
uv *= 1.1;
uv.x *= 1.0 + pow((abs(uv.y) / 5.0), 2.0);
uv.y *= 1.0 + pow((abs(uv.x) / 4.0), 2.0);
uv = (uv / 2.0) + 0.5;
uv = uv *0.92 + 0.04;
return uv;
}
float4 mainImage( float2 fragCoord )
{
float4 fragColor = float4(0,0,0,1);
float2 q = fragCoord.xy / _iResolution.xy;
float2 uv = q;
uv = curve( uv );
float3 oricol = tex2D(_MainTex,uv).xyz;
float3 col;
float x = sin(0.3*_Time+uv.y*21.0)*sin(0.7*_Time+uv.y*29.0)*sin(0.3+0.33*_Time+uv.y*31.0)*0.0017;
col.r = tex2D(_MainTex,float2(x+uv.x+0.001,uv.y+0.001)).x+0.05;
col.g = tex2D(_MainTex,float2(x+uv.x+0.000,uv.y-0.002)).y+0.05;
col.b = tex2D(_MainTex,float2(x+uv.x-0.002,uv.y+0.000)).z+0.05;
col.r += 0.08*tex2D(_MainTex,0.75*float2(x+0.025, -0.027)+float2(uv.x+0.001,uv.y+0.001)).x;
col.g += 0.05*tex2D(_MainTex,0.75*float2(x+-0.022, -0.02)+float2(uv.x+0.000,uv.y-0.002)).y;
col.b += 0.08*tex2D(_MainTex,0.75*float2(x+-0.02, -0.018)+float2(uv.x-0.002,uv.y+0.000)).z;
col = clamp(col*0.6+0.4*col*col*1.0,0.0,1.0);
float vig = (0.0 + 1.0*16.0*uv.x*uv.y*(1.0-uv.x)*(1.0-uv.y));
col *= pow(vig,0.3);
col *= float3(0.95,1.05,0.95);
col *= 2.8;
float scans = clamp( 0.35+0.35*sin(3.5*_Time+uv.y*_iResolution.y*1.5), 0.0, 1.0);
float s = pow(scans,1.7);
col = col*( 0.4+0.7*s) ;
col *= 1.0+0.01*sin(110.0*_Time);
if (uv.x < 0.0 || uv.x > 1.0)
col *= 0.0;
if (uv.y < 0.0 || uv.y > 1.0)
col *= 0.0;
col*=1.0-0.65*clamp((fragCoord.x % 2.0 -1.0 )*2.0,0.0,1.0);
float comp = smoothstep( 0.1, 0.9, sin(_Time) );
fragColor = float4(col,1.0);
return fragColor;
}
struct v2f
{
float4 pos : POSITION;
float2 uv : TEXCOORD0;
};
fixed4 frag (v2f i) : SV_Target
{
float2 pos = _iResolution.xy*i.uv;
fixed4 col = mainImage(pos);
return col;
}
ENDCG
}
}
}

View File

@ -1,30 +1,30 @@
using UnityEngine;
namespace AxibugEmuOnline.Client
{
public interface IEmuCore
{
GameObject gameObject { get; }
object GetState();
byte[] GetStateBytes();
void LoadState(object state);
void LoadStateFromBytes(byte[] data);
void Pause();
void Resume();
void SetupScheme();
void StartGame(RomFile romFile);
void DoReset();
EnumPlatform Platform { get; }
uint Frame { get; }
}
public static class IEnumCoreTool
{
public static bool IsNull(this IEmuCore core)
{
if (core == null) return true;
return core.Equals(null);
}
}
}
using UnityEngine;
namespace AxibugEmuOnline.Client
{
public interface IEmuCore
{
GameObject gameObject { get; }
object GetState();
byte[] GetStateBytes();
void LoadState(object state);
void LoadStateFromBytes(byte[] data);
void Pause();
void Resume();
void SetupScheme();
void StartGame(RomFile romFile);
void DoReset();
EnumPlatform Platform { get; }
uint Frame { get; }
}
public static class IEnumCoreTool
{
public static bool IsNull(this IEmuCore core)
{
if (core == null) return true;
return core.Equals(null);
}
}
}

View File

@ -1,8 +1,8 @@
namespace AxibugEmuOnline.Client
{
public abstract class CommandChanger : IKeyMapperChanger
{
public string Name => GetType().Name;
public abstract object GetConfig();
}
}
namespace AxibugEmuOnline.Client
{
public abstract class CommandChanger : IKeyMapperChanger
{
public string Name => GetType().Name;
public abstract object GetConfig();
}
}

View File

@ -1,26 +1,26 @@
using System.Collections.Generic;
using UnityEngine;
namespace AxibugEmuOnline.Client
{
public class GamingChanger : CommandChanger
{
Dictionary<KeyCode, EnumCommand> m_uiKeyMapper = new Dictionary<KeyCode, EnumCommand>();
public GamingChanger()
{
m_uiKeyMapper[KeyCode.Escape] = EnumCommand.OptionMenu;
if (Application.platform == RuntimePlatform.PSP2)
{
m_uiKeyMapper[Common.PSVitaKey.L] = EnumCommand.OptionMenu;
m_uiKeyMapper[Common.PSVitaKey.R] = EnumCommand.OptionMenu;
}
//PC XBOX
m_uiKeyMapper[Common.PC_XBOXKEY.Y] = EnumCommand.OptionMenu;
}
public override object GetConfig() => m_uiKeyMapper;
}
}
using System.Collections.Generic;
using UnityEngine;
namespace AxibugEmuOnline.Client
{
public class GamingChanger : CommandChanger
{
Dictionary<KeyCode, EnumCommand> m_uiKeyMapper = new Dictionary<KeyCode, EnumCommand>();
public GamingChanger()
{
m_uiKeyMapper[KeyCode.Escape] = EnumCommand.OptionMenu;
if (Application.platform == RuntimePlatform.PSP2)
{
m_uiKeyMapper[Common.PSVitaKey.L] = EnumCommand.OptionMenu;
m_uiKeyMapper[Common.PSVitaKey.R] = EnumCommand.OptionMenu;
}
//PC XBOX
m_uiKeyMapper[Common.PC_XBOXKEY.Y] = EnumCommand.OptionMenu;
}
public override object GetConfig() => m_uiKeyMapper;
}
}

View File

@ -1,54 +1,54 @@
using System.Collections.Generic;
using UnityEngine;
namespace AxibugEmuOnline.Client
{
public class NormalChanger : CommandChanger
{
Dictionary<KeyCode, EnumCommand> m_uiKeyMapper = new Dictionary<KeyCode, EnumCommand>();
public NormalChanger()
{
m_uiKeyMapper[KeyCode.A] = EnumCommand.SelectItemLeft;
m_uiKeyMapper[KeyCode.D] = EnumCommand.SelectItemRight;
m_uiKeyMapper[KeyCode.W] = EnumCommand.SelectItemUp;
m_uiKeyMapper[KeyCode.S] = EnumCommand.SelectItemDown;
m_uiKeyMapper[KeyCode.K] = EnumCommand.Enter;
m_uiKeyMapper[KeyCode.L] = EnumCommand.Back;
m_uiKeyMapper[KeyCode.I] = EnumCommand.OptionMenu;
m_uiKeyMapper[KeyCode.LeftArrow] = EnumCommand.SelectItemLeft;
m_uiKeyMapper[KeyCode.RightArrow] = EnumCommand.SelectItemRight;
m_uiKeyMapper[KeyCode.UpArrow] = EnumCommand.SelectItemUp;
m_uiKeyMapper[KeyCode.DownArrow] = EnumCommand.SelectItemDown;
m_uiKeyMapper[KeyCode.Return] = EnumCommand.Enter;
m_uiKeyMapper[KeyCode.Escape] = EnumCommand.Back;
m_uiKeyMapper[KeyCode.RightShift] = EnumCommand.OptionMenu;
m_uiKeyMapper[KeyCode.LeftShift] = EnumCommand.OptionMenu;
if (Application.platform == RuntimePlatform.PSP2)
{
m_uiKeyMapper[Common.PSVitaKey.Left] = EnumCommand.SelectItemLeft;
m_uiKeyMapper[Common.PSVitaKey.Right] = EnumCommand.SelectItemRight;
m_uiKeyMapper[Common.PSVitaKey.Up] = EnumCommand.SelectItemUp;
m_uiKeyMapper[Common.PSVitaKey.Down] = EnumCommand.SelectItemDown;
m_uiKeyMapper[Common.PSVitaKey.Circle] = EnumCommand.Enter;
m_uiKeyMapper[Common.PSVitaKey.Cross] = EnumCommand.Back;
m_uiKeyMapper[Common.PSVitaKey.Triangle] = EnumCommand.OptionMenu;
}
//PC XBOX
//m_uiKeyMapper[Common.PC_XBOXKEY.Left] = EnumCommand.SelectItemLeft;
//m_uiKeyMapper[Common.PSVitaKey.Right] = EnumCommand.SelectItemRight;
//m_uiKeyMapper[Common.PSVitaKey.Up] = EnumCommand.SelectItemUp;
//m_uiKeyMapper[Common.PSVitaKey.Down] = EnumCommand.SelectItemDown;
m_uiKeyMapper[Common.PC_XBOXKEY.MenuBtn] = EnumCommand.Enter;
m_uiKeyMapper[Common.PC_XBOXKEY.ViewBtn] = EnumCommand.Back;
m_uiKeyMapper[Common.PC_XBOXKEY.Y] = EnumCommand.OptionMenu;
}
public override object GetConfig() => m_uiKeyMapper;
}
}
using System.Collections.Generic;
using UnityEngine;
namespace AxibugEmuOnline.Client
{
public class NormalChanger : CommandChanger
{
Dictionary<KeyCode, EnumCommand> m_uiKeyMapper = new Dictionary<KeyCode, EnumCommand>();
public NormalChanger()
{
m_uiKeyMapper[KeyCode.A] = EnumCommand.SelectItemLeft;
m_uiKeyMapper[KeyCode.D] = EnumCommand.SelectItemRight;
m_uiKeyMapper[KeyCode.W] = EnumCommand.SelectItemUp;
m_uiKeyMapper[KeyCode.S] = EnumCommand.SelectItemDown;
m_uiKeyMapper[KeyCode.K] = EnumCommand.Enter;
m_uiKeyMapper[KeyCode.L] = EnumCommand.Back;
m_uiKeyMapper[KeyCode.I] = EnumCommand.OptionMenu;
m_uiKeyMapper[KeyCode.LeftArrow] = EnumCommand.SelectItemLeft;
m_uiKeyMapper[KeyCode.RightArrow] = EnumCommand.SelectItemRight;
m_uiKeyMapper[KeyCode.UpArrow] = EnumCommand.SelectItemUp;
m_uiKeyMapper[KeyCode.DownArrow] = EnumCommand.SelectItemDown;
m_uiKeyMapper[KeyCode.Return] = EnumCommand.Enter;
m_uiKeyMapper[KeyCode.Escape] = EnumCommand.Back;
m_uiKeyMapper[KeyCode.RightShift] = EnumCommand.OptionMenu;
m_uiKeyMapper[KeyCode.LeftShift] = EnumCommand.OptionMenu;
if (Application.platform == RuntimePlatform.PSP2)
{
m_uiKeyMapper[Common.PSVitaKey.Left] = EnumCommand.SelectItemLeft;
m_uiKeyMapper[Common.PSVitaKey.Right] = EnumCommand.SelectItemRight;
m_uiKeyMapper[Common.PSVitaKey.Up] = EnumCommand.SelectItemUp;
m_uiKeyMapper[Common.PSVitaKey.Down] = EnumCommand.SelectItemDown;
m_uiKeyMapper[Common.PSVitaKey.Circle] = EnumCommand.Enter;
m_uiKeyMapper[Common.PSVitaKey.Cross] = EnumCommand.Back;
m_uiKeyMapper[Common.PSVitaKey.Triangle] = EnumCommand.OptionMenu;
}
//PC XBOX
//m_uiKeyMapper[Common.PC_XBOXKEY.Left] = EnumCommand.SelectItemLeft;
//m_uiKeyMapper[Common.PSVitaKey.Right] = EnumCommand.SelectItemRight;
//m_uiKeyMapper[Common.PSVitaKey.Up] = EnumCommand.SelectItemUp;
//m_uiKeyMapper[Common.PSVitaKey.Down] = EnumCommand.SelectItemDown;
m_uiKeyMapper[Common.PC_XBOXKEY.MenuBtn] = EnumCommand.Enter;
m_uiKeyMapper[Common.PC_XBOXKEY.ViewBtn] = EnumCommand.Back;
m_uiKeyMapper[Common.PC_XBOXKEY.Y] = EnumCommand.OptionMenu;
}
public override object GetConfig() => m_uiKeyMapper;
}
}

View File

@ -1,29 +1,29 @@
using AxibugEmuOnline.Client.ClientCore;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
namespace AxibugEmuOnline.Client
{
public class Initer : MonoBehaviour
{
public PostProcessVolume m_filterVolume;
public CanvasGroup m_filterPreview;
public CanvasGroup m_xmbBg;
public static string dev_UUID;
#if UNITY_EDITOR
public bool bTest = false;
public string mTestSrvIP = "192.168.0.47";
#endif
private void Awake()
{
#if UNITY_EDITOR
App.Init(this, bTest, mTestSrvIP);
#else
App.Init(this);
#endif
dev_UUID = SystemInfo.deviceUniqueIdentifier;
}
}
}
using AxibugEmuOnline.Client.ClientCore;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
namespace AxibugEmuOnline.Client
{
public class Initer : MonoBehaviour
{
public PostProcessVolume m_filterVolume;
public CanvasGroup m_filterPreview;
public CanvasGroup m_xmbBg;
public static string dev_UUID;
#if UNITY_EDITOR
public bool bTest = false;
public string mTestSrvIP = "192.168.0.47";
#endif
private void Awake()
{
#if UNITY_EDITOR
App.Init(this, bTest, mTestSrvIP);
#else
App.Init(this);
#endif
dev_UUID = SystemInfo.deviceUniqueIdentifier;
}
}
}

View File

@ -1,80 +1,80 @@
using AxibugEmuOnline.Client.ClientCore;
using AxibugEmuOnline.Client.Event;
using UnityEngine;
namespace AxibugEmuOnline.Client.Manager
{
public class AppEmu
{
/// <summary>
/// unity的c#实现有bug,以接口类型保存的monobehaviour引用,!=和==运算符没有调用到monobehaviour重写过的运算符
/// 但是Equals方法可以,所以,这个接口判断为空请使用Equals
/// </summary>
private IEmuCore m_emuCore;
/// <summary>
/// unity的c#实现有bug,以接口类型保存的monobehaviour引用,!=和==运算符没有调用到monobehaviour重写过的运算符
/// 但是Equals方法可以,所以,这个接口判断为空请使用Equals
/// </summary>
public IEmuCore Core => m_emuCore;
public AppEmu()
{
Eventer.Instance.RegisterEvent(EEvent.OnMineJoinRoom, OnSelfJoinRoom);
}
private void OnSelfJoinRoom()
{
//如果当前正在游戏中,就先结束游戏
if (!m_emuCore.IsNull()) StopGame();
var roomInfo = App.roomMgr.mineRoomMiniInfo;
roomInfo.FetchRomFileInRoomInfo(EnumPlatform.NES, (room, romFile) =>
{
if (!romFile.RomReady) //这个rom并没有下载,所以取消进入房间
{
App.roomMgr.SendLeavnRoom();
}
else
{
BeginGame(romFile);
}
});
}
public void BeginGame(RomFile romFile)
{
if (!m_emuCore.IsNull()) return;
switch (romFile.Platform)
{
case EnumPlatform.NES:
m_emuCore = GameObject.Instantiate(Resources.Load<GameObject>("NES/NesEmulator")).GetComponent<IEmuCore>();
break;
}
m_emuCore.StartGame(romFile);
LaunchUI.Instance.HideMainMenu();
InGameUI.Instance.Show(romFile, m_emuCore);
m_emuCore.SetupScheme();
}
public void StopGame()
{
if (m_emuCore.IsNull()) return;
GameObject.Destroy(m_emuCore.gameObject);
m_emuCore = null;
InGameUI.Instance.Hide();
LaunchUI.Instance.ShowMainMenu();
}
public void ResetGame()
{
if (m_emuCore.IsNull()) return;
m_emuCore.DoReset();
}
}
}
using AxibugEmuOnline.Client.ClientCore;
using AxibugEmuOnline.Client.Event;
using UnityEngine;
namespace AxibugEmuOnline.Client.Manager
{
public class AppEmu
{
/// <summary>
/// unity的c#实现有bug,以接口类型保存的monobehaviour引用,!=和==运算符没有调用到monobehaviour重写过的运算符
/// 但是Equals方法可以,所以,这个接口判断为空请使用Equals
/// </summary>
private IEmuCore m_emuCore;
/// <summary>
/// unity的c#实现有bug,以接口类型保存的monobehaviour引用,!=和==运算符没有调用到monobehaviour重写过的运算符
/// 但是Equals方法可以,所以,这个接口判断为空请使用Equals
/// </summary>
public IEmuCore Core => m_emuCore;
public AppEmu()
{
Eventer.Instance.RegisterEvent(EEvent.OnMineJoinRoom, OnSelfJoinRoom);
}
private void OnSelfJoinRoom()
{
//如果当前正在游戏中,就先结束游戏
if (!m_emuCore.IsNull()) StopGame();
var roomInfo = App.roomMgr.mineRoomMiniInfo;
roomInfo.FetchRomFileInRoomInfo(EnumPlatform.NES, (room, romFile) =>
{
if (!romFile.RomReady) //这个rom并没有下载,所以取消进入房间
{
App.roomMgr.SendLeavnRoom();
}
else
{
BeginGame(romFile);
}
});
}
public void BeginGame(RomFile romFile)
{
if (!m_emuCore.IsNull()) return;
switch (romFile.Platform)
{
case EnumPlatform.NES:
m_emuCore = GameObject.Instantiate(Resources.Load<GameObject>("NES/NesEmulator")).GetComponent<IEmuCore>();
break;
}
m_emuCore.StartGame(romFile);
LaunchUI.Instance.HideMainMenu();
InGameUI.Instance.Show(romFile, m_emuCore);
m_emuCore.SetupScheme();
}
public void StopGame()
{
if (m_emuCore.IsNull()) return;
GameObject.Destroy(m_emuCore.gameObject);
m_emuCore = null;
InGameUI.Instance.Hide();
LaunchUI.Instance.ShowMainMenu();
}
public void ResetGame()
{
if (m_emuCore.IsNull()) return;
m_emuCore.DoReset();
}
}
}

View File

@ -203,27 +203,27 @@ namespace AxibugEmuOnline.Client.Manager
{
App.log.Debug("单个房间状态更新");
Protobuf_Room_Update_RESP msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_Update_RESP>(reqData);
if (msg.UpdateType == 0)
{
if (AddOrUpdateRoomList(msg.RoomMiniInfo))
{
Eventer.Instance.PostEvent(EEvent.OnRoomListSingleAdd, msg.RoomMiniInfo.RoomID);
if (msg.UpdateType == 0)
{
if (AddOrUpdateRoomList(msg.RoomMiniInfo))
{
Eventer.Instance.PostEvent(EEvent.OnRoomListSingleAdd, msg.RoomMiniInfo.RoomID);
}
else
else
{
Eventer.Instance.PostEvent(EEvent.OnRoomListSingleUpdate, msg.RoomMiniInfo.RoomID);
}
}
else
else
{
RemoveRoomList(msg.RoomMiniInfo.RoomID);
Eventer.Instance.PostEvent(EEvent.OnRoomListSingleClose, msg.RoomMiniInfo.RoomID);
}
}
}
/// <summary>
/// 获取房间画面快照
/// </summary>
/// <summary>
/// 获取房间画面快照
/// </summary>
/// <param name="RoomID"></param>
public void SendGetRoomScreen(int RoomID)
{
@ -238,8 +238,8 @@ namespace AxibugEmuOnline.Client.Manager
void RecvRoomGetScreen(byte[] reqData)
{
App.log.Debug("单个房间状态更新");
Protobuf_Room_Get_Screen_RESP msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_Get_Screen_RESP>(reqData);
//解压
Protobuf_Room_Get_Screen_RESP msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_Get_Screen_RESP>(reqData);
//解压
byte[] data = Helper.DecompressByteArray(msg.RawBitmap.ToArray());
Eventer.Instance.PostEvent(EEvent.OnRoomGetRoomScreen, msg.RoomID, data);
}
@ -304,8 +304,8 @@ namespace AxibugEmuOnline.Client.Manager
/// <param name="RoomID"></param>
public void SendLeavnRoom()
{
if (!InRoom)
return;
if (!InRoom)
return;
_Protobuf_Room_Leave.RoomID = mineRoomMiniInfo.RoomID;
App.log.Info($"LeavnRoom");
App.network.SendToServer((int)CommandID.CmdRoomLeave, ProtoBufHelper.Serizlize(_Protobuf_Room_Leave));
@ -410,8 +410,8 @@ namespace AxibugEmuOnline.Client.Manager
void RecvHostSyn_RoomFrameAllInputData(byte[] reqData)
{
Protobuf_Room_Syn_RoomFrameAllInputData msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_Syn_RoomFrameAllInputData>(reqData);
if (TestAllData != msg.InputData)
{
if (TestAllData != msg.InputData)
{
TestAllData = msg.InputData;
App.log.Debug($"ServerFrameID->{msg.ServerFrameID} FrameID->{msg.FrameID} ClientFrame->{netReplay.mCurrClientFrameIdx} InputData->{msg.InputData}");
}
@ -432,26 +432,26 @@ namespace AxibugEmuOnline.Client.Manager
Protobuf_Screnn_Frame msg = ProtoBufHelper.DeSerizlize<Protobuf_Screnn_Frame>(reqData);
//解压
byte[] data = Helper.DecompressByteArray(msg.RawBitmap.ToArray());
}
}
public static class RoomEX
{
/// <summary>
/// 获取房间空闲席位下标 (返回True表示由余位
/// </summary>
/// <param name="roomMiniInfo"></param>
/// <param name="freeSlots"></param>
/// <returns></returns>
public static bool GetFreeSlot(this Protobuf_Room_MiniInfo roomMiniInfo, out int[] freeSlots)
{
List<int> temp = new List<int>();
if (roomMiniInfo.Player1UID <= 0) temp.Add(0);
if (roomMiniInfo.Player2UID <= 0) temp.Add(1);
if (roomMiniInfo.Player3UID <= 0) temp.Add(2);
if (roomMiniInfo.Player4UID <= 0) temp.Add(3);
freeSlots = temp.ToArray();
return freeSlots.Length > 0;
}
}
}
}
public static class RoomEX
{
/// <summary>
/// 获取房间空闲席位下标 (返回True表示由余位
/// </summary>
/// <param name="roomMiniInfo"></param>
/// <param name="freeSlots"></param>
/// <returns></returns>
public static bool GetFreeSlot(this Protobuf_Room_MiniInfo roomMiniInfo, out int[] freeSlots)
{
List<int> temp = new List<int>();
if (roomMiniInfo.Player1UID <= 0) temp.Add(0);
if (roomMiniInfo.Player2UID <= 0) temp.Add(1);
if (roomMiniInfo.Player3UID <= 0) temp.Add(2);
if (roomMiniInfo.Player4UID <= 0) temp.Add(3);
freeSlots = temp.ToArray();
return freeSlots.Length > 0;
}
}
}

View File

@ -1,8 +1,8 @@
namespace AxibugEmuOnline.Client
{
public class AppSettings
{
/// <summary> 背景颜色设定 </summary>
public BgColorSettings BgColor { get; set; } = new BgColorSettings();
}
}
namespace AxibugEmuOnline.Client
{
public class AppSettings
{
/// <summary> 背景颜色设定 </summary>
public BgColorSettings BgColor { get; set; } = new BgColorSettings();
}
}

View File

@ -1,83 +1,83 @@
using System.Collections.Generic;
using UnityEngine;
namespace AxibugEmuOnline.Client
{
/// <summary> 颜色设置 </summary>
public class BgColorSettings
{
public delegate void OnColorChangedHandle(XMBColor color);
public event OnColorChangedHandle OnColorChanged;
/// <summary> 当前颜色 </summary>
public XMBColor CurrentColor
{
get
{
var color1 = PlayerPrefs.GetString($"{nameof(BgColorSettings)}.{nameof(CurrentColor)}.{nameof(CurrentColor.color1)}", null);
var color2 = PlayerPrefs.GetString($"{nameof(BgColorSettings)}.{nameof(CurrentColor)}.{nameof(CurrentColor.color2)}", null);
var name = PlayerPrefs.GetString($"{nameof(BgColorSettings)}.{nameof(CurrentColor)}.{nameof(CurrentColor.Name)}", null);
if (string.IsNullOrWhiteSpace(color1) || string.IsNullOrWhiteSpace(color2) || string.IsNullOrWhiteSpace(name))
return DEFAULT;
else
return new XMBColor(name, color1, color2);
}
set
{
PlayerPrefs.SetString($"{nameof(BgColorSettings)}.{nameof(CurrentColor)}.{nameof(CurrentColor.color1)}", $"#{ColorUtility.ToHtmlStringRGB(value.color1)}");
PlayerPrefs.SetString($"{nameof(BgColorSettings)}.{nameof(CurrentColor)}.{nameof(CurrentColor.color2)}", $"#{ColorUtility.ToHtmlStringRGB(value.color2)}");
PlayerPrefs.SetString($"{nameof(BgColorSettings)}.{nameof(CurrentColor)}.{nameof(CurrentColor.Name)}", value.Name);
OnColorChanged?.Invoke(value);
}
}
private static readonly XMBColor DEFAULT = new XMBColor("蓝", "#020754", "#0ab1dc");
public List<XMBColor> Presets { get; private set; } = new List<XMBColor>()
{
DEFAULT,
new XMBColor("白","#8a9fb2","#4e9eb6"),
new XMBColor("黄","#987500","#d1a813"),
new XMBColor("绿","#3e962b","#7ac25e"),
new XMBColor("粉","#e65a8b","#c7acc6"),
new XMBColor("墨绿","#00421a","#1c951f"),
new XMBColor("紫","#633f93","#8763cc"),
new XMBColor("天蓝","#038baa","#0ca2c2"),
new XMBColor("红","#9c120e","#d73611"),
};
}
public struct XMBColor
{
public string Name;
public Color color1;
public Color color2;
public XMBColor(string name, string colorCodeStr1, string colorCodeStr2)
{
Name = name;
ColorUtility.TryParseHtmlString(colorCodeStr1, out color1);
ColorUtility.TryParseHtmlString(colorCodeStr2, out color2);
}
public static XMBColor Lerp(XMBColor start, XMBColor endColor, float t)
{
var result = new XMBColor();
result.Name = endColor.Name;
result.color1 = Color.Lerp(start.color1, endColor.color1, t);
result.color2 = Color.Lerp(start.color2, endColor.color2, t);
return result;
}
public override int GetHashCode()
{
int hash = 17;
hash = hash * 23 + (Name != null ? Name.GetHashCode() : 0);
hash = hash * 23 + color1.GetHashCode();
hash = hash * 23 + color2.GetHashCode();
return hash;
}
}
}
using System.Collections.Generic;
using UnityEngine;
namespace AxibugEmuOnline.Client
{
/// <summary> 颜色设置 </summary>
public class BgColorSettings
{
public delegate void OnColorChangedHandle(XMBColor color);
public event OnColorChangedHandle OnColorChanged;
/// <summary> 当前颜色 </summary>
public XMBColor CurrentColor
{
get
{
var color1 = PlayerPrefs.GetString($"{nameof(BgColorSettings)}.{nameof(CurrentColor)}.{nameof(CurrentColor.color1)}", null);
var color2 = PlayerPrefs.GetString($"{nameof(BgColorSettings)}.{nameof(CurrentColor)}.{nameof(CurrentColor.color2)}", null);
var name = PlayerPrefs.GetString($"{nameof(BgColorSettings)}.{nameof(CurrentColor)}.{nameof(CurrentColor.Name)}", null);
if (string.IsNullOrWhiteSpace(color1) || string.IsNullOrWhiteSpace(color2) || string.IsNullOrWhiteSpace(name))
return DEFAULT;
else
return new XMBColor(name, color1, color2);
}
set
{
PlayerPrefs.SetString($"{nameof(BgColorSettings)}.{nameof(CurrentColor)}.{nameof(CurrentColor.color1)}", $"#{ColorUtility.ToHtmlStringRGB(value.color1)}");
PlayerPrefs.SetString($"{nameof(BgColorSettings)}.{nameof(CurrentColor)}.{nameof(CurrentColor.color2)}", $"#{ColorUtility.ToHtmlStringRGB(value.color2)}");
PlayerPrefs.SetString($"{nameof(BgColorSettings)}.{nameof(CurrentColor)}.{nameof(CurrentColor.Name)}", value.Name);
OnColorChanged?.Invoke(value);
}
}
private static readonly XMBColor DEFAULT = new XMBColor("蓝", "#020754", "#0ab1dc");
public List<XMBColor> Presets { get; private set; } = new List<XMBColor>()
{
DEFAULT,
new XMBColor("白","#8a9fb2","#4e9eb6"),
new XMBColor("黄","#987500","#d1a813"),
new XMBColor("绿","#3e962b","#7ac25e"),
new XMBColor("粉","#e65a8b","#c7acc6"),
new XMBColor("墨绿","#00421a","#1c951f"),
new XMBColor("紫","#633f93","#8763cc"),
new XMBColor("天蓝","#038baa","#0ca2c2"),
new XMBColor("红","#9c120e","#d73611"),
};
}
public struct XMBColor
{
public string Name;
public Color color1;
public Color color2;
public XMBColor(string name, string colorCodeStr1, string colorCodeStr2)
{
Name = name;
ColorUtility.TryParseHtmlString(colorCodeStr1, out color1);
ColorUtility.TryParseHtmlString(colorCodeStr2, out color2);
}
public static XMBColor Lerp(XMBColor start, XMBColor endColor, float t)
{
var result = new XMBColor();
result.Name = endColor.Name;
result.color1 = Color.Lerp(start.color1, endColor.color1, t);
result.color2 = Color.Lerp(start.color2, endColor.color2, t);
return result;
}
public override int GetHashCode()
{
int hash = 17;
hash = hash * 23 + (Name != null ? Name.GetHashCode() : 0);
hash = hash * 23 + color1.GetHashCode();
hash = hash * 23 + color2.GetHashCode();
return hash;
}
}
}

View File

@ -1,103 +1,103 @@
using AxibugEmuOnline.Client.ClientCore;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.Networking;
namespace AxibugEmuOnline.Client
{
public class CacheManager
{
static readonly string CacheDirPath = $"{App.PersistentDataPath}/Caches";
static readonly string TextureCacheDirPath = $"{CacheDirPath}/Texture";
public void GetSpriteCache(string url, Action<Sprite, string> callback)
{
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($"{App.httpAPI.WebHost}/{url}");
yield return request.SendWebRequest();
if (request.result == UnityWebRequest.Result.Success)
{
Directory.CreateDirectory(path);
File.WriteAllBytes($"{path}/{url.GetHashCode()}", request.downloadHandler.data);
callback.Invoke(request.downloadHandler.data);
}
else
callback.Invoke(null);
}
private Dictionary<string, object> cachesInMemory = new Dictionary<string, object>();
void GetCacheData<T>(string url, string path, Action<T, string> callback) where T : class
{
if (cachesInMemory.TryGetValue(url, out var cacheObj) && cacheObj is T obj)
{
callback.Invoke(obj, url);
return;
}
var fileName = $"{url.GetHashCode()}";
byte[] rawData = null;
var filePath = $"{path}/{fileName}";
if (File.Exists(filePath))
{
rawData = File.ReadAllBytes(filePath);
var @out = RawDataConvert<T>(rawData);
cachesInMemory[url] = @out;
callback.Invoke(@out, url);
}
else
{
App.StartCoroutine(DownloadFromURL(url, path, (data) =>
{
var @out = RawDataConvert<T>(data);
cachesInMemory[url] = @out;
callback.Invoke(@out, url);
}));
}
}
Type t_texture2d = typeof(Texture2D);
Type t_sprite = typeof(Sprite);
Type t_byteArray = typeof(byte[]);
Type t_object = typeof(object);
T RawDataConvert<T>(byte[] data) where T : class
{
var vt = typeof(T);
if (vt == t_texture2d || vt == t_sprite)
{
Texture2D texture = new Texture2D(2, 2);
texture.LoadImage(data);
if (vt == t_texture2d) return texture as T;
else return Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f)) as T;
}
else if (vt == t_byteArray)
{
return data as T;
}
else
{
return data as T;
}
throw new NotImplementedException($"{vt.Name}");
}
}
}
using AxibugEmuOnline.Client.ClientCore;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.Networking;
namespace AxibugEmuOnline.Client
{
public class CacheManager
{
static readonly string CacheDirPath = $"{App.PersistentDataPath}/Caches";
static readonly string TextureCacheDirPath = $"{CacheDirPath}/Texture";
public void GetSpriteCache(string url, Action<Sprite, string> callback)
{
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($"{App.httpAPI.WebHost}/{url}");
yield return request.SendWebRequest();
if (request.result == UnityWebRequest.Result.Success)
{
Directory.CreateDirectory(path);
File.WriteAllBytes($"{path}/{url.GetHashCode()}", request.downloadHandler.data);
callback.Invoke(request.downloadHandler.data);
}
else
callback.Invoke(null);
}
private Dictionary<string, object> cachesInMemory = new Dictionary<string, object>();
void GetCacheData<T>(string url, string path, Action<T, string> callback) where T : class
{
if (cachesInMemory.TryGetValue(url, out var cacheObj) && cacheObj is T obj)
{
callback.Invoke(obj, url);
return;
}
var fileName = $"{url.GetHashCode()}";
byte[] rawData = null;
var filePath = $"{path}/{fileName}";
if (File.Exists(filePath))
{
rawData = File.ReadAllBytes(filePath);
var @out = RawDataConvert<T>(rawData);
cachesInMemory[url] = @out;
callback.Invoke(@out, url);
}
else
{
App.StartCoroutine(DownloadFromURL(url, path, (data) =>
{
var @out = RawDataConvert<T>(data);
cachesInMemory[url] = @out;
callback.Invoke(@out, url);
}));
}
}
Type t_texture2d = typeof(Texture2D);
Type t_sprite = typeof(Sprite);
Type t_byteArray = typeof(byte[]);
Type t_object = typeof(object);
T RawDataConvert<T>(byte[] data) where T : class
{
var vt = typeof(T);
if (vt == t_texture2d || vt == t_sprite)
{
Texture2D texture = new Texture2D(2, 2);
texture.LoadImage(data);
if (vt == t_texture2d) return texture as T;
else return Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f)) as T;
}
else if (vt == t_byteArray)
{
return data as T;
}
else
{
return data as T;
}
throw new NotImplementedException($"{vt.Name}");
}
}
}

View File

@ -1,8 +1,8 @@
using UnityEngine;
namespace AxibugEmuOnline.Client
{
public class CoroutineRunner : MonoBehaviour
{
}
}
using UnityEngine;
namespace AxibugEmuOnline.Client
{
public class CoroutineRunner : MonoBehaviour
{
}
}

View File

@ -1,343 +1,343 @@
using AxibugEmuOnline.Client.ClientCore;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
using static AxibugEmuOnline.Client.FilterEffect;
namespace AxibugEmuOnline.Client
{
public class FilterManager
{
private PostProcessProfile m_filterPorfile;
private List<Filter> m_filters;
private Dictionary<EnumPlatform, Filter> m_filterPlatforms = new Dictionary<EnumPlatform, Filter>();
private AlphaWraper m_previewFilterWraper;
FilterRomSetting m_filterRomSetting;
/// <summary>
/// 滤镜列表
/// </summary>
public IReadOnlyList<Filter> Filters => m_filters;
public FilterManager(PostProcessVolume filterVolume, CanvasGroup filterPreview, CanvasGroup mainBg)
{
m_filterPorfile = filterVolume.profile;
m_filters = m_filterPorfile.settings.Where(setting => setting is FilterEffect).Select(setting => new Filter(setting as FilterEffect)).ToList();
var json = PlayerPrefs.GetString(nameof(FilterRomSetting));
m_filterRomSetting = JsonUtility.FromJson<FilterRomSetting>(json) ?? new FilterRomSetting();
m_previewFilterWraper = new AlphaWraper(mainBg, filterPreview, false);
ShutDownFilterPreview();
ShutDownFilter();
}
/// <summary> 关闭滤镜预览 </summary>
public void ShutDownFilterPreview()
{
m_previewFilterWraper.On = false;
}
/// <summary> 开启滤镜预览 </summary>
public void EnableFilterPreview()
{
m_previewFilterWraper.On = true;
}
/// <summary>
/// 打开滤镜
/// </summary>
/// <param name="filter"></param>
public void EnableFilter(Filter filter)
{
foreach (var selfFiler in Filters)
{
if (selfFiler != filter) selfFiler.m_setting.enabled.Override(false);
else selfFiler.m_setting.enabled.Override(true);
}
}
/// <summary>
/// 关闭滤镜效果
/// </summary>
public void ShutDownFilter()
{
//关闭所有后处理效果
foreach (var setting in m_filterPorfile.settings)
setting.enabled.Override(false);
}
/// <summary>
/// 为指定rom设置滤镜以及滤镜的预设
/// </summary>
/// <param name="rom">rom对象</param>
/// <param name="filter">滤镜</param>
/// <param name="preset">滤镜预设</param>
public void SetupFilter(RomFile rom, Filter filter, FilterPreset preset)
{
m_filterRomSetting.Setup(rom, filter, preset);
string json = m_filterRomSetting.ToJson();
PlayerPrefs.SetString(nameof(FilterRomSetting), json);
}
/// <summary>
/// 获得指定rom配置的滤镜设置
/// </summary>
/// <param name="rom">rom对象</param>
/// <returns>此元组任意内任意成员都有可能为空</returns>
public (Filter filter, FilterPreset preset) GetFilterSetting(RomFile rom)
{
var value = m_filterRomSetting.Get(rom);
Filter filter = null;
FilterPreset preset = null;
filter = Filters.FirstOrDefault(f => f.Name == value.filterName);
if (filter != null)
{
string presetName = value.presetName;
preset = filter.Presets.FirstOrDefault(p => p.Name == presetName);
}
return (filter, preset);
}
public class Filter
{
public string Name => m_setting.Name;
public IReadOnlyCollection<EditableParamerter> Paramerters => m_setting.EditableParam;
/// <summary> 滤镜预设 </summary>
public List<FilterPreset> Presets = new List<FilterPreset>();
/// <summary> 滤镜默认预设 </summary>
public FilterPreset DefaultPreset = new FilterPreset("DEFAULT");
internal FilterEffect m_setting;
public Filter(FilterEffect setting)
{
m_setting = setting;
loadPresets();
}
private void loadPresets()
{
var json = PlayerPrefs.GetString($"Filter_{Name}_PresetList", string.Empty);
var loadedPresets = JsonUtility.FromJson<FilterPresetList>(json);
if (loadedPresets == null) return;
else Presets = loadedPresets.presets;
}
public void SavePresets()
{
var json = JsonUtility.ToJson(new FilterPresetList(Presets));
PlayerPrefs.SetString($"Filter_{Name}_PresetList", json);
}
public MsgBool CreatePreset(string presetName, out FilterPreset newPreset)
{
newPreset = null;
if (string.IsNullOrWhiteSpace(presetName)) return "名称不能为空";
if (Presets.Count(p => p.Name == presetName) != 0) return "名称重复";
newPreset = new FilterPreset(presetName);
Presets.Add(newPreset);
SavePresets();
return true;
}
public void RemovePreset(FilterPreset preset)
{
if (!Presets.Remove(preset)) return;
SavePresets();
EventInvoker.RaiseFilterPresetRemoved(this, preset);
}
public void ResetPreset()
{
foreach (var param in Paramerters)
{
param.ResetToDefault();
}
}
public void ApplyPreset(FilterPreset preset)
{
foreach (var param in Paramerters)
{
var value = preset.GetParamValue(param.Name, param.ValueType);
if (value == null)
param.ResetToDefault();
else
param.Apply(value);
}
}
}
[Serializable]
private class FilterPresetList
{
public List<FilterPreset> presets;
public FilterPresetList(List<FilterPreset> presets)
{
this.presets = presets;
foreach (var preset in presets)
{
preset.ReadyForJson();
}
}
}
[Serializable]
public class FilterPreset
{
[SerializeField]
public string Name;
[SerializeField]
private List<string> m_paramName = new List<string>();
[SerializeField]
private List<string> m_valueJson = new List<string>();
private bool m_cacheReady = false;
private Dictionary<string, string> m_paramName2ValueJson;
public FilterPreset(string presetName)
{
Name = presetName;
}
public void ReadyForJson()
{
prepareCache();
m_paramName = m_paramName2ValueJson.Keys.ToList();
m_valueJson = m_paramName2ValueJson.Values.ToList();
}
public string GetParamValueJson(string paramName)
{
prepareCache();
m_paramName2ValueJson.TryGetValue(paramName, out var value);
return value;
}
public object GetParamValue(string paramName, Type valueType)
{
var rawStr = GetParamValueJson(paramName);
if (rawStr == null) return null;
if (valueType == typeof(float))
{
float.TryParse(rawStr, out var floatVal);
return floatVal;
}
else if (valueType.IsEnum)
{
var names = Enum.GetNames(valueType);
var values = Enum.GetValues(valueType);
for (int i = 0; i < names.Length; i++)
{
if (names[i].Equals(rawStr))
{
return values.GetValue(i);
}
}
return null;
}
else
{
App.log.Error($"尚未支持的滤镜参数类型{valueType}");
return null;
}
}
public void SetParamValue(string paramName, Type valueType, object value)
{
prepareCache();
m_paramName2ValueJson[paramName] = value.ToString();
}
private void prepareCache()
{
if (m_cacheReady) return;
m_paramName2ValueJson = new Dictionary<string, string>();
for (int i = 0; i < m_paramName.Count; i++)
{
m_paramName2ValueJson[m_paramName[i]] = m_valueJson[i];
}
m_cacheReady = true;
}
}
[Serializable]
public class FilterRomSetting
{
[SerializeField]
private List<int> m_romID;
[SerializeField]
private List<Item> m_items;
bool m_cacheReady = false;
Dictionary<int, Item> m_cache;
public void Setup(RomFile rom, Filter filter, FilterPreset preset)
{
prepareCache();
if (filter == null)
m_cache.Remove(rom.ID);
else
m_cache[rom.ID] = new Item { FilterName = filter.Name, PresetName = preset != null ? preset.Name : null };
}
public string ToJson()
{
prepareCache();
m_romID = m_cache.Keys.ToList();
m_items = m_cache.Values.ToList();
return JsonUtility.ToJson(this);
}
public (string filterName, string presetName) Get(RomFile rom)
{
prepareCache();
m_cache.TryGetValue(rom.ID, out var item);
return (item.FilterName, item.PresetName);
}
private void prepareCache()
{
if (m_cacheReady) return;
if (m_items == null) m_items = new List<Item>();
if (m_romID == null) m_romID = new List<int>();
m_cache = new Dictionary<int, Item>();
for (int i = 0; i < m_romID.Count && i < m_items.Count; i++)
{
m_cache[m_romID[i]] = m_items[i];
}
m_cacheReady = true;
}
[Serializable]
struct Item
{
public string FilterName;
public string PresetName;
}
}
}
}
using AxibugEmuOnline.Client.ClientCore;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
using static AxibugEmuOnline.Client.FilterEffect;
namespace AxibugEmuOnline.Client
{
public class FilterManager
{
private PostProcessProfile m_filterPorfile;
private List<Filter> m_filters;
private Dictionary<EnumPlatform, Filter> m_filterPlatforms = new Dictionary<EnumPlatform, Filter>();
private AlphaWraper m_previewFilterWraper;
FilterRomSetting m_filterRomSetting;
/// <summary>
/// 滤镜列表
/// </summary>
public IReadOnlyList<Filter> Filters => m_filters;
public FilterManager(PostProcessVolume filterVolume, CanvasGroup filterPreview, CanvasGroup mainBg)
{
m_filterPorfile = filterVolume.profile;
m_filters = m_filterPorfile.settings.Where(setting => setting is FilterEffect).Select(setting => new Filter(setting as FilterEffect)).ToList();
var json = PlayerPrefs.GetString(nameof(FilterRomSetting));
m_filterRomSetting = JsonUtility.FromJson<FilterRomSetting>(json) ?? new FilterRomSetting();
m_previewFilterWraper = new AlphaWraper(mainBg, filterPreview, false);
ShutDownFilterPreview();
ShutDownFilter();
}
/// <summary> 关闭滤镜预览 </summary>
public void ShutDownFilterPreview()
{
m_previewFilterWraper.On = false;
}
/// <summary> 开启滤镜预览 </summary>
public void EnableFilterPreview()
{
m_previewFilterWraper.On = true;
}
/// <summary>
/// 打开滤镜
/// </summary>
/// <param name="filter"></param>
public void EnableFilter(Filter filter)
{
foreach (var selfFiler in Filters)
{
if (selfFiler != filter) selfFiler.m_setting.enabled.Override(false);
else selfFiler.m_setting.enabled.Override(true);
}
}
/// <summary>
/// 关闭滤镜效果
/// </summary>
public void ShutDownFilter()
{
//关闭所有后处理效果
foreach (var setting in m_filterPorfile.settings)
setting.enabled.Override(false);
}
/// <summary>
/// 为指定rom设置滤镜以及滤镜的预设
/// </summary>
/// <param name="rom">rom对象</param>
/// <param name="filter">滤镜</param>
/// <param name="preset">滤镜预设</param>
public void SetupFilter(RomFile rom, Filter filter, FilterPreset preset)
{
m_filterRomSetting.Setup(rom, filter, preset);
string json = m_filterRomSetting.ToJson();
PlayerPrefs.SetString(nameof(FilterRomSetting), json);
}
/// <summary>
/// 获得指定rom配置的滤镜设置
/// </summary>
/// <param name="rom">rom对象</param>
/// <returns>此元组任意内任意成员都有可能为空</returns>
public (Filter filter, FilterPreset preset) GetFilterSetting(RomFile rom)
{
var value = m_filterRomSetting.Get(rom);
Filter filter = null;
FilterPreset preset = null;
filter = Filters.FirstOrDefault(f => f.Name == value.filterName);
if (filter != null)
{
string presetName = value.presetName;
preset = filter.Presets.FirstOrDefault(p => p.Name == presetName);
}
return (filter, preset);
}
public class Filter
{
public string Name => m_setting.Name;
public IReadOnlyCollection<EditableParamerter> Paramerters => m_setting.EditableParam;
/// <summary> 滤镜预设 </summary>
public List<FilterPreset> Presets = new List<FilterPreset>();
/// <summary> 滤镜默认预设 </summary>
public FilterPreset DefaultPreset = new FilterPreset("DEFAULT");
internal FilterEffect m_setting;
public Filter(FilterEffect setting)
{
m_setting = setting;
loadPresets();
}
private void loadPresets()
{
var json = PlayerPrefs.GetString($"Filter_{Name}_PresetList", string.Empty);
var loadedPresets = JsonUtility.FromJson<FilterPresetList>(json);
if (loadedPresets == null) return;
else Presets = loadedPresets.presets;
}
public void SavePresets()
{
var json = JsonUtility.ToJson(new FilterPresetList(Presets));
PlayerPrefs.SetString($"Filter_{Name}_PresetList", json);
}
public MsgBool CreatePreset(string presetName, out FilterPreset newPreset)
{
newPreset = null;
if (string.IsNullOrWhiteSpace(presetName)) return "名称不能为空";
if (Presets.Count(p => p.Name == presetName) != 0) return "名称重复";
newPreset = new FilterPreset(presetName);
Presets.Add(newPreset);
SavePresets();
return true;
}
public void RemovePreset(FilterPreset preset)
{
if (!Presets.Remove(preset)) return;
SavePresets();
EventInvoker.RaiseFilterPresetRemoved(this, preset);
}
public void ResetPreset()
{
foreach (var param in Paramerters)
{
param.ResetToDefault();
}
}
public void ApplyPreset(FilterPreset preset)
{
foreach (var param in Paramerters)
{
var value = preset.GetParamValue(param.Name, param.ValueType);
if (value == null)
param.ResetToDefault();
else
param.Apply(value);
}
}
}
[Serializable]
private class FilterPresetList
{
public List<FilterPreset> presets;
public FilterPresetList(List<FilterPreset> presets)
{
this.presets = presets;
foreach (var preset in presets)
{
preset.ReadyForJson();
}
}
}
[Serializable]
public class FilterPreset
{
[SerializeField]
public string Name;
[SerializeField]
private List<string> m_paramName = new List<string>();
[SerializeField]
private List<string> m_valueJson = new List<string>();
private bool m_cacheReady = false;
private Dictionary<string, string> m_paramName2ValueJson;
public FilterPreset(string presetName)
{
Name = presetName;
}
public void ReadyForJson()
{
prepareCache();
m_paramName = m_paramName2ValueJson.Keys.ToList();
m_valueJson = m_paramName2ValueJson.Values.ToList();
}
public string GetParamValueJson(string paramName)
{
prepareCache();
m_paramName2ValueJson.TryGetValue(paramName, out var value);
return value;
}
public object GetParamValue(string paramName, Type valueType)
{
var rawStr = GetParamValueJson(paramName);
if (rawStr == null) return null;
if (valueType == typeof(float))
{
float.TryParse(rawStr, out var floatVal);
return floatVal;
}
else if (valueType.IsEnum)
{
var names = Enum.GetNames(valueType);
var values = Enum.GetValues(valueType);
for (int i = 0; i < names.Length; i++)
{
if (names[i].Equals(rawStr))
{
return values.GetValue(i);
}
}
return null;
}
else
{
App.log.Error($"尚未支持的滤镜参数类型{valueType}");
return null;
}
}
public void SetParamValue(string paramName, Type valueType, object value)
{
prepareCache();
m_paramName2ValueJson[paramName] = value.ToString();
}
private void prepareCache()
{
if (m_cacheReady) return;
m_paramName2ValueJson = new Dictionary<string, string>();
for (int i = 0; i < m_paramName.Count; i++)
{
m_paramName2ValueJson[m_paramName[i]] = m_valueJson[i];
}
m_cacheReady = true;
}
}
[Serializable]
public class FilterRomSetting
{
[SerializeField]
private List<int> m_romID;
[SerializeField]
private List<Item> m_items;
bool m_cacheReady = false;
Dictionary<int, Item> m_cache;
public void Setup(RomFile rom, Filter filter, FilterPreset preset)
{
prepareCache();
if (filter == null)
m_cache.Remove(rom.ID);
else
m_cache[rom.ID] = new Item { FilterName = filter.Name, PresetName = preset != null ? preset.Name : null };
}
public string ToJson()
{
prepareCache();
m_romID = m_cache.Keys.ToList();
m_items = m_cache.Values.ToList();
return JsonUtility.ToJson(this);
}
public (string filterName, string presetName) Get(RomFile rom)
{
prepareCache();
m_cache.TryGetValue(rom.ID, out var item);
return (item.FilterName, item.PresetName);
}
private void prepareCache()
{
if (m_cacheReady) return;
if (m_items == null) m_items = new List<Item>();
if (m_romID == null) m_romID = new List<int>();
m_cache = new Dictionary<int, Item>();
for (int i = 0; i < m_romID.Count && i < m_items.Count; i++)
{
m_cache[m_romID[i]] = m_items[i];
}
m_cacheReady = true;
}
[Serializable]
struct Item
{
public string FilterName;
public string PresetName;
}
}
}
}

View File

@ -1,131 +1,131 @@
using AxibugEmuOnline.Client.ClientCore;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
namespace AxibugEmuOnline.Client
{
public class HttpAPI
{
public string WebHost = "http://emu.axibug.com";
public string WebSiteApi => WebHost + "/api";
public delegate void GetRomListAPI(Action<Resp_GameList> callback, int page, int pageSize = 10);
public delegate void SearchRomListAPI(Action<Resp_GameList> callback, string searchKey, int page, int pageSize = 10);
public void GetNesRomList(Action<Resp_GameList> callback, int page, int pageSize = 10)
{
App.StartCoroutine(GetNesRomListFlow(page, pageSize, callback));
}
public void SearchNesRomList(Action<Resp_GameList> callback, string searchKey, int page, int pageSize = 10)
{
App.StartCoroutine(SearchNesRomListFlow(searchKey, page, pageSize, callback));
}
private IEnumerator SearchNesRomListFlow(string searchKey, int page, int pageSize, Action<Resp_GameList> callback)
{
UnityWebRequest request = UnityWebRequest.Get($"{WebSiteApi}/NesRomList?Page={page}&PageSize={pageSize}&SearchKey={searchKey}");
yield return request.SendWebRequest();
if (request.result != UnityWebRequest.Result.Success)
{
callback.Invoke(null);
yield break;
}
var resp = JsonUtility.FromJson<Resp_GameList>(request.downloadHandler.text);
callback.Invoke(resp);
}
private IEnumerator GetNesRomListFlow(int page, int pageSize, Action<Resp_GameList> callback)
{
UnityWebRequest request = UnityWebRequest.Get($"{WebSiteApi}/NesRomList?Page={page}&PageSize={pageSize}");
yield return request.SendWebRequest();
if (request.result != UnityWebRequest.Result.Success)
{
callback.Invoke(null);
yield break;
}
var resp = JsonUtility.FromJson<Resp_GameList>(request.downloadHandler.text);
callback.Invoke(resp);
}
public IEnumerator GetNesRomInfo(int RomID, Action<Resp_RomInfo> callback)
{
UnityWebRequest request = UnityWebRequest.Get($"{WebSiteApi}/RomInfo?PType={PlatformType.Nes}&RomID={RomID}");
yield return request.SendWebRequest();
if (request.result != UnityWebRequest.Result.Success)
{
callback.Invoke(null);
yield break;
}
var resp = JsonUtility.FromJson<Resp_RomInfo>(request.downloadHandler.text);
callback.Invoke(resp);
}
enum PlatformType : byte
{
All = 0,
Nes = 1,
}
enum GameType : byte
{
NONE = 0,
ACT,
ARPG,
AVG,
ETC,
FTG,
PUZ,
RAC,
RPG,
SLG,
SPG,
SRPG,
STG,
TAB,
/// <summary>
/// 合卡
/// </summary>
ALLINONE,
}
[Serializable]
public class Resp_GameList
{
public int page;
public int maxPage;
public int resultAllCount;
public List<Resp_RomInfo> gameList;
}
[Serializable]
public class Resp_RomInfo
{
public int orderid;
public int id;
public string romName;
public string gType;
public string desc;
public string url;
public string imgUrl;
public string hash;
public int stars;
}
[Serializable]
public class Resp_CheckStandInfo
{
public int needUpdateClient;
public string serverIp;
public ushort serverPort;
public string clientVersion;
public string downLoadUrl;
}
}
}
using AxibugEmuOnline.Client.ClientCore;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
namespace AxibugEmuOnline.Client
{
public class HttpAPI
{
public string WebHost = "http://emu.axibug.com";
public string WebSiteApi => WebHost + "/api";
public delegate void GetRomListAPI(Action<Resp_GameList> callback, int page, int pageSize = 10);
public delegate void SearchRomListAPI(Action<Resp_GameList> callback, string searchKey, int page, int pageSize = 10);
public void GetNesRomList(Action<Resp_GameList> callback, int page, int pageSize = 10)
{
App.StartCoroutine(GetNesRomListFlow(page, pageSize, callback));
}
public void SearchNesRomList(Action<Resp_GameList> callback, string searchKey, int page, int pageSize = 10)
{
App.StartCoroutine(SearchNesRomListFlow(searchKey, page, pageSize, callback));
}
private IEnumerator SearchNesRomListFlow(string searchKey, int page, int pageSize, Action<Resp_GameList> callback)
{
UnityWebRequest request = UnityWebRequest.Get($"{WebSiteApi}/NesRomList?Page={page}&PageSize={pageSize}&SearchKey={searchKey}");
yield return request.SendWebRequest();
if (request.result != UnityWebRequest.Result.Success)
{
callback.Invoke(null);
yield break;
}
var resp = JsonUtility.FromJson<Resp_GameList>(request.downloadHandler.text);
callback.Invoke(resp);
}
private IEnumerator GetNesRomListFlow(int page, int pageSize, Action<Resp_GameList> callback)
{
UnityWebRequest request = UnityWebRequest.Get($"{WebSiteApi}/NesRomList?Page={page}&PageSize={pageSize}");
yield return request.SendWebRequest();
if (request.result != UnityWebRequest.Result.Success)
{
callback.Invoke(null);
yield break;
}
var resp = JsonUtility.FromJson<Resp_GameList>(request.downloadHandler.text);
callback.Invoke(resp);
}
public IEnumerator GetNesRomInfo(int RomID, Action<Resp_RomInfo> callback)
{
UnityWebRequest request = UnityWebRequest.Get($"{WebSiteApi}/RomInfo?PType={PlatformType.Nes}&RomID={RomID}");
yield return request.SendWebRequest();
if (request.result != UnityWebRequest.Result.Success)
{
callback.Invoke(null);
yield break;
}
var resp = JsonUtility.FromJson<Resp_RomInfo>(request.downloadHandler.text);
callback.Invoke(resp);
}
enum PlatformType : byte
{
All = 0,
Nes = 1,
}
enum GameType : byte
{
NONE = 0,
ACT,
ARPG,
AVG,
ETC,
FTG,
PUZ,
RAC,
RPG,
SLG,
SPG,
SRPG,
STG,
TAB,
/// <summary>
/// 合卡
/// </summary>
ALLINONE,
}
[Serializable]
public class Resp_GameList
{
public int page;
public int maxPage;
public int resultAllCount;
public List<Resp_RomInfo> gameList;
}
[Serializable]
public class Resp_RomInfo
{
public int orderid;
public int id;
public string romName;
public string gType;
public string desc;
public string url;
public string imgUrl;
public string hash;
public int stars;
}
[Serializable]
public class Resp_CheckStandInfo
{
public int needUpdateClient;
public string serverIp;
public ushort serverPort;
public string clientVersion;
public string downLoadUrl;
}
}
}

View File

@ -1,7 +1,7 @@
namespace AxibugEmuOnline.Client
{
public enum EnumPlatform
{
NES
}
}
namespace AxibugEmuOnline.Client
{
public enum EnumPlatform
{
NES
}
}

View File

@ -1,166 +1,166 @@
using AxibugEmuOnline.Client.ClientCore;
using ICSharpCode.SharpZipLib.Zip;
using System;
using System.Collections;
using System.IO;
using UnityEngine.Networking;
namespace AxibugEmuOnline.Client
{
public class RomFile
{
private HttpAPI.Resp_RomInfo webData;
private bool hasLocalFile;
private EnumPlatform platform;
private UnityWebRequest downloadRequest;
public bool IsUserRom { get; private set; }
/// <summary> 指示该Rom文件的存放路径 </summary>
public string LocalFilePath =>
IsUserRom ?
$"{App.PersistentDataPath}/UserRoms/{platform}/{FileName}" :
$"{App.PersistentDataPath}/RemoteRoms/{platform}/{FileName}";
/// <summary> 指示该Rom文件是否已下载完毕 </summary>
public bool RomReady => hasLocalFile;
/// <summary> 指示是否正在下载Rom文件 </summary>
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>
public int ID => webData != null ? webData.id : -1;
/// <summary> 别名 </summary>
public string Alias => IsUserRom ? Path.GetFileNameWithoutExtension(FileName) : webData.romName;
/// <summary> 描述 </summary>
public string Descript => IsUserRom ? string.Empty : webData.desc;
/// <summary> 游戏类型 </summary>
public string GameTypeDes => IsUserRom ? string.Empty : webData.gType;
/// <summary> 小图URL </summary>
public string ImageURL => IsUserRom ? string.Empty : webData.imgUrl;
/// <summary> 文件名 </summary>
public string FileName { get; private set; }
/// <summary> 在查询结果中的索引 </summary>
public int Index { get; private set; }
/// <summary> 在查询结果中的所在页 </summary>
public int Page { get; private set; }
public string Hash => webData != null ? webData.hash : string.Empty;
public event Action<RomFile> OnDownloadOver;
public event Action OnInfoFilled;
public RomFile(EnumPlatform platform, int index, int insidePage)
{
this.platform = platform;
Index = index;
Page = insidePage;
}
public void BeginDownload()
{
if (RomReady) return;
if (IsDownloading) return;
App.StartCoroutine(DownloadRemoteRom((bytes) =>
{
if (bytes != null)
{
var directPath = Path.GetDirectoryName(LocalFilePath);
Directory.CreateDirectory(directPath);
File.WriteAllBytes(LocalFilePath, bytes);
hasLocalFile = true;
}
OnDownloadOver?.Invoke(this);
}));
}
public byte[] GetRomFileData()
{
if (!IsUserRom && webData == null) throw new Exception("Not Valid Rom");
if (!RomReady) throw new Exception("Rom File Not Downloaded");
var bytes = File.ReadAllBytes(LocalFilePath);
if (Path.GetExtension(LocalFilePath).ToLower() == ".zip")
{
var zip = new ZipInputStream(new MemoryStream(bytes));
while (zip.GetNextEntry() is ZipEntry entry)
{
if (!entry.Name.ToLower().EndsWith(".nes")) continue;
var buffer = new byte[1024];
MemoryStream output = new MemoryStream();
while (true)
{
var size = zip.Read(buffer, 0, buffer.Length);
if (size == 0) break;
else output.Write(buffer, 0, size);
}
output.Flush();
return output.ToArray();
}
}
else
{
return bytes;
}
throw new Exception("Not Valid Rom Data");
}
private IEnumerator DownloadRemoteRom(Action<byte[]> callback)
{
downloadRequest = UnityWebRequest.Get($"{App.httpAPI.WebHost}/{webData.url}");
yield return downloadRequest.SendWebRequest();
var request = downloadRequest;
downloadRequest = null;
if (request.result != UnityWebRequest.Result.Success)
{
callback(null);
}
else
{
callback(request.downloadHandler.data);
}
}
public void SetWebData(HttpAPI.Resp_RomInfo resp_RomInfo)
{
webData = resp_RomInfo;
FileName = Path.GetFileName(webData.url);
FileName = System.Net.WebUtility.UrlDecode(FileName);
if (File.Exists(LocalFilePath))
{
var fileBytes = File.ReadAllBytes(LocalFilePath);
var localHash = RomLib.CalcHash(fileBytes);
hasLocalFile = localHash == webData.hash;
if (!hasLocalFile)
File.Delete(LocalFilePath);
}
else
{
hasLocalFile = false;
}
OnInfoFilled?.Invoke();
}
private RomFile() { }
public static RomFile CreateExistRom(EnumPlatform platform, string fileName)
{
var res = new RomFile();
res.IsUserRom = true;
res.FileName = fileName;
res.hasLocalFile = File.Exists(res.LocalFilePath);
return res;
}
}
}
using AxibugEmuOnline.Client.ClientCore;
using ICSharpCode.SharpZipLib.Zip;
using System;
using System.Collections;
using System.IO;
using UnityEngine.Networking;
namespace AxibugEmuOnline.Client
{
public class RomFile
{
private HttpAPI.Resp_RomInfo webData;
private bool hasLocalFile;
private EnumPlatform platform;
private UnityWebRequest downloadRequest;
public bool IsUserRom { get; private set; }
/// <summary> 指示该Rom文件的存放路径 </summary>
public string LocalFilePath =>
IsUserRom ?
$"{App.PersistentDataPath}/UserRoms/{platform}/{FileName}" :
$"{App.PersistentDataPath}/RemoteRoms/{platform}/{FileName}";
/// <summary> 指示该Rom文件是否已下载完毕 </summary>
public bool RomReady => hasLocalFile;
/// <summary> 指示是否正在下载Rom文件 </summary>
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>
public int ID => webData != null ? webData.id : -1;
/// <summary> 别名 </summary>
public string Alias => IsUserRom ? Path.GetFileNameWithoutExtension(FileName) : webData.romName;
/// <summary> 描述 </summary>
public string Descript => IsUserRom ? string.Empty : webData.desc;
/// <summary> 游戏类型 </summary>
public string GameTypeDes => IsUserRom ? string.Empty : webData.gType;
/// <summary> 小图URL </summary>
public string ImageURL => IsUserRom ? string.Empty : webData.imgUrl;
/// <summary> 文件名 </summary>
public string FileName { get; private set; }
/// <summary> 在查询结果中的索引 </summary>
public int Index { get; private set; }
/// <summary> 在查询结果中的所在页 </summary>
public int Page { get; private set; }
public string Hash => webData != null ? webData.hash : string.Empty;
public event Action<RomFile> OnDownloadOver;
public event Action OnInfoFilled;
public RomFile(EnumPlatform platform, int index, int insidePage)
{
this.platform = platform;
Index = index;
Page = insidePage;
}
public void BeginDownload()
{
if (RomReady) return;
if (IsDownloading) return;
App.StartCoroutine(DownloadRemoteRom((bytes) =>
{
if (bytes != null)
{
var directPath = Path.GetDirectoryName(LocalFilePath);
Directory.CreateDirectory(directPath);
File.WriteAllBytes(LocalFilePath, bytes);
hasLocalFile = true;
}
OnDownloadOver?.Invoke(this);
}));
}
public byte[] GetRomFileData()
{
if (!IsUserRom && webData == null) throw new Exception("Not Valid Rom");
if (!RomReady) throw new Exception("Rom File Not Downloaded");
var bytes = File.ReadAllBytes(LocalFilePath);
if (Path.GetExtension(LocalFilePath).ToLower() == ".zip")
{
var zip = new ZipInputStream(new MemoryStream(bytes));
while (zip.GetNextEntry() is ZipEntry entry)
{
if (!entry.Name.ToLower().EndsWith(".nes")) continue;
var buffer = new byte[1024];
MemoryStream output = new MemoryStream();
while (true)
{
var size = zip.Read(buffer, 0, buffer.Length);
if (size == 0) break;
else output.Write(buffer, 0, size);
}
output.Flush();
return output.ToArray();
}
}
else
{
return bytes;
}
throw new Exception("Not Valid Rom Data");
}
private IEnumerator DownloadRemoteRom(Action<byte[]> callback)
{
downloadRequest = UnityWebRequest.Get($"{App.httpAPI.WebHost}/{webData.url}");
yield return downloadRequest.SendWebRequest();
var request = downloadRequest;
downloadRequest = null;
if (request.result != UnityWebRequest.Result.Success)
{
callback(null);
}
else
{
callback(request.downloadHandler.data);
}
}
public void SetWebData(HttpAPI.Resp_RomInfo resp_RomInfo)
{
webData = resp_RomInfo;
FileName = Path.GetFileName(webData.url);
FileName = System.Net.WebUtility.UrlDecode(FileName);
if (File.Exists(LocalFilePath))
{
var fileBytes = File.ReadAllBytes(LocalFilePath);
var localHash = RomLib.CalcHash(fileBytes);
hasLocalFile = localHash == webData.hash;
if (!hasLocalFile)
File.Delete(LocalFilePath);
}
else
{
hasLocalFile = false;
}
OnInfoFilled?.Invoke();
}
private RomFile() { }
public static RomFile CreateExistRom(EnumPlatform platform, string fileName)
{
var res = new RomFile();
res.IsUserRom = true;
res.FileName = fileName;
res.hasLocalFile = File.Exists(res.LocalFilePath);
return res;
}
}
}

View File

@ -1,153 +1,153 @@
using AxibugEmuOnline.Client.ClientCore;
using AxibugEmuOnline.Client.Common;
using System;
using System.Collections.Generic;
using System.IO;
using static AxibugEmuOnline.Client.HttpAPI;
namespace AxibugEmuOnline.Client
{
public class RomLib
{
/// <summary> Rom请求,一页的大小 </summary>
private const int PAGE_SIZE = 10;
/// <summary> 请求指令 </summary>
private HashSet<int> FetchPageCmd = new HashSet<int>();
private RomFile[] nesRomFetchList;
private Dictionary<int, RomFile> nesRomFileIdMapper = new Dictionary<int, RomFile>();
private Dictionary<string, RomFile> nesRomFileNameMapper = new Dictionary<string, RomFile>();
private HttpAPI.GetRomListAPI m_romGetFunc;
private HttpAPI.SearchRomListAPI m_romSearchFunc;
private EnumPlatform m_platform;
public RomLib(EnumPlatform platform)
{
m_platform = platform;
switch (platform)
{
case EnumPlatform.NES:
m_romGetFunc = App.httpAPI.GetNesRomList;
m_romSearchFunc = App.httpAPI.SearchNesRomList;
break;
}
}
public RomFile GetExistRom(string fileName)
{
var res = RomFile.CreateExistRom(m_platform, fileName);
nesRomFileNameMapper[res.FileName] = res;
return res;
}
public RomFile GetRomFile(string romFileName)
{
RomFile romFile;
nesRomFileNameMapper.TryGetValue(romFileName, out romFile);
return romFile;
}
/// <summary> 清除所有下载的Rom文件 </summary>
public void ClearRomFile()
{
var path = $"{App.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>
/// <param name="callback"></param>
public void FetchRomCount(Action<RomFile[]> callback, string searchKey = null)
{
if (string.IsNullOrWhiteSpace(searchKey))
{
m_romGetFunc((romList) =>
{
FetchPageCmd.Clear();
nesRomFileIdMapper.Clear();
nesRomFileNameMapper.Clear();
nesRomFetchList = new RomFile[romList.resultAllCount];
for (int i = 0; i < nesRomFetchList.Length; i++)
{
//以后考虑用对象池实例化RomFile
nesRomFetchList[i] = new RomFile(m_platform, i, i / PAGE_SIZE);
}
SaveRomInfoFromWeb(romList);
callback.Invoke(nesRomFetchList);
}, 0, PAGE_SIZE);
}
else
{
m_romSearchFunc((romList) =>
{
FetchPageCmd.Clear();
nesRomFileIdMapper.Clear();
nesRomFileNameMapper.Clear();
nesRomFetchList = new RomFile[romList.resultAllCount];
for (int i = 0; i < nesRomFetchList.Length; i++)
{
//以后考虑用对象池实例化RomFile
nesRomFetchList[i] = new RomFile(m_platform, i, i / PAGE_SIZE);
}
SaveRomInfoFromWeb(romList);
callback.Invoke(nesRomFetchList);
}, searchKey, 0, PAGE_SIZE);
}
}
public void BeginFetchRomInfo(RomFile romFile)
{
if (romFile.InfoReady) return;
FetchPageCmd.Add(romFile.Page);
}
public void ExecuteFetchRomInfo()
{
if (FetchPageCmd.Count == 0) return;
foreach (var pageNo in FetchPageCmd)
{
m_romGetFunc(SaveRomInfoFromWeb, pageNo, PAGE_SIZE);
}
FetchPageCmd.Clear();
}
private void SaveRomInfoFromWeb(Resp_GameList resp)
{
for (int i = 0; i < resp.gameList.Count; i++)
{
var webData = resp.gameList[i];
RomFile targetRomFile = nesRomFetchList[webData.orderid];
targetRomFile.SetWebData(webData);
nesRomFileIdMapper[webData.id] = nesRomFetchList[webData.orderid];
nesRomFileNameMapper[targetRomFile.FileName] = targetRomFile;
}
}
public static string CalcHash(byte[] data)
{
return Helper.FileMD5Hash(data);
}
public void AddRomFile(RomFile rom)
{
nesRomFileNameMapper[rom.FileName] = rom;
}
}
}
using AxibugEmuOnline.Client.ClientCore;
using AxibugEmuOnline.Client.Common;
using System;
using System.Collections.Generic;
using System.IO;
using static AxibugEmuOnline.Client.HttpAPI;
namespace AxibugEmuOnline.Client
{
public class RomLib
{
/// <summary> Rom请求,一页的大小 </summary>
private const int PAGE_SIZE = 10;
/// <summary> 请求指令 </summary>
private HashSet<int> FetchPageCmd = new HashSet<int>();
private RomFile[] nesRomFetchList;
private Dictionary<int, RomFile> nesRomFileIdMapper = new Dictionary<int, RomFile>();
private Dictionary<string, RomFile> nesRomFileNameMapper = new Dictionary<string, RomFile>();
private HttpAPI.GetRomListAPI m_romGetFunc;
private HttpAPI.SearchRomListAPI m_romSearchFunc;
private EnumPlatform m_platform;
public RomLib(EnumPlatform platform)
{
m_platform = platform;
switch (platform)
{
case EnumPlatform.NES:
m_romGetFunc = App.httpAPI.GetNesRomList;
m_romSearchFunc = App.httpAPI.SearchNesRomList;
break;
}
}
public RomFile GetExistRom(string fileName)
{
var res = RomFile.CreateExistRom(m_platform, fileName);
nesRomFileNameMapper[res.FileName] = res;
return res;
}
public RomFile GetRomFile(string romFileName)
{
RomFile romFile;
nesRomFileNameMapper.TryGetValue(romFileName, out romFile);
return romFile;
}
/// <summary> 清除所有下载的Rom文件 </summary>
public void ClearRomFile()
{
var path = $"{App.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>
/// <param name="callback"></param>
public void FetchRomCount(Action<RomFile[]> callback, string searchKey = null)
{
if (string.IsNullOrWhiteSpace(searchKey))
{
m_romGetFunc((romList) =>
{
FetchPageCmd.Clear();
nesRomFileIdMapper.Clear();
nesRomFileNameMapper.Clear();
nesRomFetchList = new RomFile[romList.resultAllCount];
for (int i = 0; i < nesRomFetchList.Length; i++)
{
//以后考虑用对象池实例化RomFile
nesRomFetchList[i] = new RomFile(m_platform, i, i / PAGE_SIZE);
}
SaveRomInfoFromWeb(romList);
callback.Invoke(nesRomFetchList);
}, 0, PAGE_SIZE);
}
else
{
m_romSearchFunc((romList) =>
{
FetchPageCmd.Clear();
nesRomFileIdMapper.Clear();
nesRomFileNameMapper.Clear();
nesRomFetchList = new RomFile[romList.resultAllCount];
for (int i = 0; i < nesRomFetchList.Length; i++)
{
//以后考虑用对象池实例化RomFile
nesRomFetchList[i] = new RomFile(m_platform, i, i / PAGE_SIZE);
}
SaveRomInfoFromWeb(romList);
callback.Invoke(nesRomFetchList);
}, searchKey, 0, PAGE_SIZE);
}
}
public void BeginFetchRomInfo(RomFile romFile)
{
if (romFile.InfoReady) return;
FetchPageCmd.Add(romFile.Page);
}
public void ExecuteFetchRomInfo()
{
if (FetchPageCmd.Count == 0) return;
foreach (var pageNo in FetchPageCmd)
{
m_romGetFunc(SaveRomInfoFromWeb, pageNo, PAGE_SIZE);
}
FetchPageCmd.Clear();
}
private void SaveRomInfoFromWeb(Resp_GameList resp)
{
for (int i = 0; i < resp.gameList.Count; i++)
{
var webData = resp.gameList[i];
RomFile targetRomFile = nesRomFetchList[webData.orderid];
targetRomFile.SetWebData(webData);
nesRomFileIdMapper[webData.id] = nesRomFetchList[webData.orderid];
nesRomFileNameMapper[targetRomFile.FileName] = targetRomFile;
}
}
public static string CalcHash(byte[] data)
{
return Helper.FileMD5Hash(data);
}
public void AddRomFile(RomFile rom)
{
nesRomFileNameMapper[rom.FileName] = rom;
}
}
}

View File

@ -26,16 +26,16 @@ namespace AxibugEmuOnline.Client
private void Awake()
{
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdPing, OnCmdPing);
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdPong, OnCmdPong);
LoopAction_3s += Ping;
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdPong, OnCmdPong);
LoopAction_3s += Ping;
#if UNITY_EDITOR
UnityEditor.EditorApplication.playModeStateChanged += (state) =>
{
if (state == UnityEditor.PlayModeStateChange.ExitingPlayMode)
OnApplicationQuit();
};
UnityEditor.EditorApplication.playModeStateChanged += (state) =>
{
if (state == UnityEditor.PlayModeStateChange.ExitingPlayMode)
OnApplicationQuit();
};
#endif
}
float LastLoopTime_1s;
@ -44,14 +44,14 @@ namespace AxibugEmuOnline.Client
{
NetMsg.Instance.DequeueNesMsg();
LoopAction_tick?.Invoke();
LoopAction_tick?.Invoke();
if (Time.time - LastLoopTime_1s > 1)
{
LastLoopTime_1s = Time.time;
LastLoopTime_1s = Time.time;
LoopAction_1s?.Invoke();
}
}
if (Time.time - LastLoopTime_3s > 3)
{
LastLoopTime_3s = Time.time;
@ -61,7 +61,7 @@ namespace AxibugEmuOnline.Client
void OnApplicationQuit()
{
App.log.Debug("OnApplicationQuit");
App.log.Debug("OnApplicationQuit");
App.network.bAutoReConnect = false;
if (App.network.isConnected)

View File

@ -1,45 +1,45 @@
/// <summary>
/// StringºÍBoolµÄ·ìºÏ¹Ö
/// </summary>
public struct MsgBool
{
public string ErrorMsg;
public bool Value;
public override readonly string ToString()
{
if (Value)
{
return true.ToString();
}
else
{
return ErrorMsg;
}
}
public static implicit operator MsgBool(string errorMsg)
{
return new MsgBool { Value = false, ErrorMsg = errorMsg };
}
public static implicit operator MsgBool(bool value)
{
return new MsgBool { Value = value };
}
public static implicit operator bool(MsgBool msgBool)
{
return msgBool.Value;
}
public static implicit operator (bool, string)(MsgBool msgBool)
{
return (msgBool.Value, msgBool.ErrorMsg);
}
public static implicit operator string(MsgBool msgBool)
{
return msgBool.ToString();
}
}
/// <summary>
/// StringºÍBoolµÄ·ìºÏ¹Ö
/// </summary>
public struct MsgBool
{
public string ErrorMsg;
public bool Value;
public override readonly string ToString()
{
if (Value)
{
return true.ToString();
}
else
{
return ErrorMsg;
}
}
public static implicit operator MsgBool(string errorMsg)
{
return new MsgBool { Value = false, ErrorMsg = errorMsg };
}
public static implicit operator MsgBool(bool value)
{
return new MsgBool { Value = value };
}
public static implicit operator bool(MsgBool msgBool)
{
return msgBool.Value;
}
public static implicit operator (bool, string)(MsgBool msgBool)
{
return (msgBool.Value, msgBool.ErrorMsg);
}
public static implicit operator string(MsgBool msgBool)
{
return msgBool.ToString();
}
}

View File

@ -1,52 +1,52 @@
using UnityEngine;
using VirtualNes.Core;
namespace AxibugEmuOnline.Client
{
public class AudioProvider : MonoBehaviour
{
public NesEmulator NesEmu { get; set; }
[SerializeField]
private AudioSource m_as;
private SoundBuffer _buffer = new SoundBuffer(4096);
public void Start()
{
var dummy = AudioClip.Create("dummy", 1, 1, AudioSettings.outputSampleRate, false);
dummy.SetData(new float[] { 1 }, 0);
m_as.clip = dummy; //just to let unity play the audiosource
m_as.loop = true;
m_as.spatialBlend = 1;
m_as.Play();
}
void OnAudioFilterRead(float[] data, int channels)
{
int step = channels;
if (NesEmu == null || NesEmu.NesCore == null) return;
if (NesEmu.IsPause) return;
ProcessSound(NesEmu.NesCore, (uint)(data.Length / channels));
for (int i = 0; i < data.Length; i += step)
{
float rawFloat = 0;
byte rawData;
if (_buffer.TryRead(out rawData))
rawFloat = rawData / 255f;
data[i] = rawFloat;
for (int fill = 1; fill < step; fill++)
data[i + fill] = rawFloat;
}
}
void ProcessSound(NES nes, uint feedCount)
{
nes.apu.Process(_buffer, feedCount);
}
}
using UnityEngine;
using VirtualNes.Core;
namespace AxibugEmuOnline.Client
{
public class AudioProvider : MonoBehaviour
{
public NesEmulator NesEmu { get; set; }
[SerializeField]
private AudioSource m_as;
private SoundBuffer _buffer = new SoundBuffer(4096);
public void Start()
{
var dummy = AudioClip.Create("dummy", 1, 1, AudioSettings.outputSampleRate, false);
dummy.SetData(new float[] { 1 }, 0);
m_as.clip = dummy; //just to let unity play the audiosource
m_as.loop = true;
m_as.spatialBlend = 1;
m_as.Play();
}
void OnAudioFilterRead(float[] data, int channels)
{
int step = channels;
if (NesEmu == null || NesEmu.NesCore == null) return;
if (NesEmu.IsPause) return;
ProcessSound(NesEmu.NesCore, (uint)(data.Length / channels));
for (int i = 0; i < data.Length; i += step)
{
float rawFloat = 0;
byte rawData;
if (_buffer.TryRead(out rawData))
rawFloat = rawData / 255f;
data[i] = rawFloat;
for (int fill = 1; fill < step; fill++)
data[i + fill] = rawFloat;
}
}
void ProcessSound(NES nes, uint feedCount)
{
nes.apu.Process(_buffer, feedCount);
}
}
}

View File

@ -1,18 +1,18 @@
using AxibugEmuOnline.Client.ClientCore;
using VirtualNes.Core.Debug;
namespace AxibugEmuOnline.Client
{
public class CoreDebuger : IDebugerImpl
{
public void Log(string message)
{
App.log.Info(message);
}
public void LogError(string message)
{
App.log.Error(message);
}
}
}
using AxibugEmuOnline.Client.ClientCore;
using VirtualNes.Core.Debug;
namespace AxibugEmuOnline.Client
{
public class CoreDebuger : IDebugerImpl
{
public void Log(string message)
{
App.log.Info(message);
}
public void LogError(string message)
{
App.log.Error(message);
}
}
}

Some files were not shown because too many files have changed in this diff Show More