You've already forked FateViewer
							
							Compare commits
	
		
			4 Commits
		
	
	
		
			30adab4978
			...
			master
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| a41f50f138 | |||
| a3e3cc450a | |||
| 07e2c4d88c | |||
| 3b4ec2ba92 | 
							
								
								
									
										8
									
								
								Assets/KeyboardWebGL.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/KeyboardWebGL.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: ab2a82f202d82c54a827e95523f38850 | ||||
| folderAsset: yes | ||||
| DefaultImporter: | ||||
|   externalObjects: {} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
| @@ -38,7 +38,7 @@ RenderSettings: | ||||
|   m_ReflectionIntensity: 1 | ||||
|   m_CustomReflection: {fileID: 0} | ||||
|   m_Sun: {fileID: 0} | ||||
|   m_IndirectSpecularColor: {r: 0.1839229, g: 0.22907549, b: 0.303225, a: 1} | ||||
|   m_IndirectSpecularColor: {r: 0.18386838, g: 0.22901553, b: 0.30311254, a: 1} | ||||
|   m_UseRadianceAmbientProbe: 0 | ||||
| --- !u!157 &3 | ||||
| LightmapSettings: | ||||
| @@ -1852,6 +1852,41 @@ CanvasRenderer: | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 168637574} | ||||
|   m_CullTransparentMesh: 1 | ||||
| --- !u!1 &168833443 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   serializedVersion: 6 | ||||
|   m_Component: | ||||
|   - component: {fileID: 168833444} | ||||
|   m_Layer: 5 | ||||
|   m_Name: Handle Slide Area | ||||
|   m_TagString: Untagged | ||||
|   m_Icon: {fileID: 0} | ||||
|   m_NavMeshLayer: 0 | ||||
|   m_StaticEditorFlags: 0 | ||||
|   m_IsActive: 1 | ||||
| --- !u!224 &168833444 | ||||
| RectTransform: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 168833443} | ||||
|   m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} | ||||
|   m_LocalPosition: {x: 0, y: 0, z: 0} | ||||
|   m_LocalScale: {x: 1, y: 1, z: 1} | ||||
|   m_Children: [] | ||||
|   m_Father: {fileID: 834154608} | ||||
|   m_RootOrder: 2 | ||||
|   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||||
|   m_AnchorMin: {x: 0, y: 0} | ||||
|   m_AnchorMax: {x: 1, y: 1} | ||||
|   m_AnchoredPosition: {x: 0, y: 0} | ||||
|   m_SizeDelta: {x: -20, y: 0} | ||||
|   m_Pivot: {x: 0.5, y: 0.5} | ||||
| --- !u!1 &175956194 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
| @@ -2376,6 +2411,81 @@ CanvasRenderer: | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 240971854} | ||||
|   m_CullTransparentMesh: 1 | ||||
| --- !u!1 &252697933 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   serializedVersion: 6 | ||||
|   m_Component: | ||||
|   - component: {fileID: 252697934} | ||||
|   - component: {fileID: 252697936} | ||||
|   - component: {fileID: 252697935} | ||||
|   m_Layer: 5 | ||||
|   m_Name: Background | ||||
|   m_TagString: Untagged | ||||
|   m_Icon: {fileID: 0} | ||||
|   m_NavMeshLayer: 0 | ||||
|   m_StaticEditorFlags: 0 | ||||
|   m_IsActive: 1 | ||||
| --- !u!224 &252697934 | ||||
| RectTransform: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 252697933} | ||||
|   m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} | ||||
|   m_LocalPosition: {x: 0, y: 0, z: 0} | ||||
|   m_LocalScale: {x: 1, y: 1, z: 1} | ||||
|   m_Children: [] | ||||
|   m_Father: {fileID: 834154608} | ||||
|   m_RootOrder: 0 | ||||
|   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||||
|   m_AnchorMin: {x: 0, y: 0.25} | ||||
|   m_AnchorMax: {x: 1, y: 0.75} | ||||
|   m_AnchoredPosition: {x: 0, y: 0} | ||||
|   m_SizeDelta: {x: 0, y: 0} | ||||
|   m_Pivot: {x: 0.5, y: 0.5} | ||||
| --- !u!114 &252697935 | ||||
| MonoBehaviour: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 252697933} | ||||
|   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: 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_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} | ||||
|   m_Type: 1 | ||||
|   m_PreserveAspect: 0 | ||||
|   m_FillCenter: 1 | ||||
|   m_FillMethod: 4 | ||||
|   m_FillAmount: 1 | ||||
|   m_FillClockwise: 1 | ||||
|   m_FillOrigin: 0 | ||||
|   m_UseSpriteMesh: 0 | ||||
|   m_PixelsPerUnitMultiplier: 1 | ||||
| --- !u!222 &252697936 | ||||
| CanvasRenderer: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 252697933} | ||||
|   m_CullTransparentMesh: 1 | ||||
| --- !u!1 &255280555 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
| @@ -3667,6 +3777,81 @@ CanvasRenderer: | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 322154411} | ||||
|   m_CullTransparentMesh: 1 | ||||
| --- !u!1 &358173615 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   serializedVersion: 6 | ||||
|   m_Component: | ||||
|   - component: {fileID: 358173616} | ||||
|   - component: {fileID: 358173618} | ||||
|   - component: {fileID: 358173617} | ||||
|   m_Layer: 5 | ||||
|   m_Name: Fill | ||||
|   m_TagString: Untagged | ||||
|   m_Icon: {fileID: 0} | ||||
|   m_NavMeshLayer: 0 | ||||
|   m_StaticEditorFlags: 0 | ||||
|   m_IsActive: 1 | ||||
| --- !u!224 &358173616 | ||||
| RectTransform: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 358173615} | ||||
|   m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} | ||||
|   m_LocalPosition: {x: 0, y: 0, z: 0} | ||||
|   m_LocalScale: {x: 1, y: 1, z: 1} | ||||
|   m_Children: [] | ||||
|   m_Father: {fileID: 815202162} | ||||
|   m_RootOrder: 0 | ||||
|   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||||
|   m_AnchorMin: {x: 0, y: 0} | ||||
|   m_AnchorMax: {x: 0, y: 1} | ||||
|   m_AnchoredPosition: {x: 0, y: 0} | ||||
|   m_SizeDelta: {x: 0, y: 0} | ||||
|   m_Pivot: {x: 0.5, y: 0.5} | ||||
| --- !u!114 &358173617 | ||||
| MonoBehaviour: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 358173615} | ||||
|   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: 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_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} | ||||
|   m_Type: 1 | ||||
|   m_PreserveAspect: 0 | ||||
|   m_FillCenter: 1 | ||||
|   m_FillMethod: 4 | ||||
|   m_FillAmount: 1 | ||||
|   m_FillClockwise: 1 | ||||
|   m_FillOrigin: 0 | ||||
|   m_UseSpriteMesh: 0 | ||||
|   m_PixelsPerUnitMultiplier: 1 | ||||
| --- !u!222 &358173618 | ||||
| CanvasRenderer: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 358173615} | ||||
|   m_CullTransparentMesh: 1 | ||||
| --- !u!1 &393246413 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
| @@ -12320,6 +12505,7 @@ GameObject: | ||||
|   - component: {fileID: 683251589} | ||||
|   - component: {fileID: 683251588} | ||||
|   - component: {fileID: 683251587} | ||||
|   - component: {fileID: 683251590} | ||||
|   m_Layer: 5 | ||||
|   m_Name: GifHeight | ||||
|   m_TagString: Untagged | ||||
| @@ -12483,6 +12669,19 @@ CanvasRenderer: | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 683251585} | ||||
|   m_CullTransparentMesh: 1 | ||||
| --- !u!114 &683251590 | ||||
| MonoBehaviour: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 683251585} | ||||
|   m_Enabled: 1 | ||||
|   m_EditorHideFlags: 0 | ||||
|   m_Script: {fileID: 11500000, guid: cc33a39070010f94fb1c2dd721c1286d, type: 3} | ||||
|   m_Name:  | ||||
|   m_EditorClassIdentifier:  | ||||
|   showHtmlElement: 0 | ||||
| --- !u!1 &697543529 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
| @@ -13679,6 +13878,42 @@ CanvasRenderer: | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 814772307} | ||||
|   m_CullTransparentMesh: 1 | ||||
| --- !u!1 &815202161 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   serializedVersion: 6 | ||||
|   m_Component: | ||||
|   - component: {fileID: 815202162} | ||||
|   m_Layer: 5 | ||||
|   m_Name: Fill Area | ||||
|   m_TagString: Untagged | ||||
|   m_Icon: {fileID: 0} | ||||
|   m_NavMeshLayer: 0 | ||||
|   m_StaticEditorFlags: 0 | ||||
|   m_IsActive: 1 | ||||
| --- !u!224 &815202162 | ||||
| RectTransform: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 815202161} | ||||
|   m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} | ||||
|   m_LocalPosition: {x: 0, y: 0, z: 0} | ||||
|   m_LocalScale: {x: 1, y: 1, z: 1} | ||||
|   m_Children: | ||||
|   - {fileID: 358173616} | ||||
|   m_Father: {fileID: 834154608} | ||||
|   m_RootOrder: 1 | ||||
|   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||||
|   m_AnchorMin: {x: 0, y: 0.25} | ||||
|   m_AnchorMax: {x: 1, y: 0.75} | ||||
|   m_AnchoredPosition: {x: 0, y: 0} | ||||
|   m_SizeDelta: {x: 0, y: 0} | ||||
|   m_Pivot: {x: 0.5, y: 0.5} | ||||
| --- !u!1 &817349587 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
| @@ -14160,6 +14395,96 @@ CanvasRenderer: | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 829969186} | ||||
|   m_CullTransparentMesh: 1 | ||||
| --- !u!1 &834154607 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   serializedVersion: 6 | ||||
|   m_Component: | ||||
|   - component: {fileID: 834154608} | ||||
|   - component: {fileID: 834154609} | ||||
|   m_Layer: 5 | ||||
|   m_Name: Slider | ||||
|   m_TagString: Untagged | ||||
|   m_Icon: {fileID: 0} | ||||
|   m_NavMeshLayer: 0 | ||||
|   m_StaticEditorFlags: 0 | ||||
|   m_IsActive: 1 | ||||
| --- !u!224 &834154608 | ||||
| RectTransform: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 834154607} | ||||
|   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | ||||
|   m_LocalPosition: {x: 0, y: 0, z: 0} | ||||
|   m_LocalScale: {x: 1, y: 1, z: 1} | ||||
|   m_Children: | ||||
|   - {fileID: 252697934} | ||||
|   - {fileID: 815202162} | ||||
|   - {fileID: 168833444} | ||||
|   m_Father: {fileID: 923374609} | ||||
|   m_RootOrder: 0 | ||||
|   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||||
|   m_AnchorMin: {x: 0, y: 0} | ||||
|   m_AnchorMax: {x: 1, y: 0} | ||||
|   m_AnchoredPosition: {x: 0, y: 0} | ||||
|   m_SizeDelta: {x: -40, y: 80} | ||||
|   m_Pivot: {x: 0.5, y: 0} | ||||
| --- !u!114 &834154609 | ||||
| MonoBehaviour: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 834154607} | ||||
|   m_Enabled: 1 | ||||
|   m_EditorHideFlags: 0 | ||||
|   m_Script: {fileID: 11500000, guid: 67db9e8f0e2ae9c40bc1e2b64352a6b4, type: 3} | ||||
|   m_Name:  | ||||
|   m_EditorClassIdentifier:  | ||||
|   m_Navigation: | ||||
|     m_Mode: 3 | ||||
|     m_WrapAround: 0 | ||||
|     m_SelectOnUp: {fileID: 0} | ||||
|     m_SelectOnDown: {fileID: 0} | ||||
|     m_SelectOnLeft: {fileID: 0} | ||||
|     m_SelectOnRight: {fileID: 0} | ||||
|   m_Transition: 1 | ||||
|   m_Colors: | ||||
|     m_NormalColor: {r: 1, g: 1, b: 1, a: 1} | ||||
|     m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} | ||||
|     m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} | ||||
|     m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} | ||||
|     m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} | ||||
|     m_ColorMultiplier: 1 | ||||
|     m_FadeDuration: 0.1 | ||||
|   m_SpriteState: | ||||
|     m_HighlightedSprite: {fileID: 0} | ||||
|     m_PressedSprite: {fileID: 0} | ||||
|     m_SelectedSprite: {fileID: 0} | ||||
|     m_DisabledSprite: {fileID: 0} | ||||
|   m_AnimationTriggers: | ||||
|     m_NormalTrigger: Normal | ||||
|     m_HighlightedTrigger: Highlighted | ||||
|     m_PressedTrigger: Pressed | ||||
|     m_SelectedTrigger: Selected | ||||
|     m_DisabledTrigger: Disabled | ||||
|   m_Interactable: 1 | ||||
|   m_TargetGraphic: {fileID: 0} | ||||
|   m_FillRect: {fileID: 358173616} | ||||
|   m_HandleRect: {fileID: 0} | ||||
|   m_Direction: 0 | ||||
|   m_MinValue: 0 | ||||
|   m_MaxValue: 1 | ||||
|   m_WholeNumbers: 0 | ||||
|   m_Value: 0 | ||||
|   m_OnValueChanged: | ||||
|     m_PersistentCalls: | ||||
|       m_Calls: [] | ||||
| --- !u!1 &835771903 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
| @@ -15166,6 +15491,98 @@ CanvasRenderer: | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 922663354} | ||||
|   m_CullTransparentMesh: 1 | ||||
| --- !u!1 &923374608 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   serializedVersion: 6 | ||||
|   m_Component: | ||||
|   - component: {fileID: 923374609} | ||||
|   - component: {fileID: 923374611} | ||||
|   - component: {fileID: 923374610} | ||||
|   - component: {fileID: 923374612} | ||||
|   m_Layer: 5 | ||||
|   m_Name: DownloadProgress | ||||
|   m_TagString: Untagged | ||||
|   m_Icon: {fileID: 0} | ||||
|   m_NavMeshLayer: 0 | ||||
|   m_StaticEditorFlags: 0 | ||||
|   m_IsActive: 0 | ||||
| --- !u!224 &923374609 | ||||
| RectTransform: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 923374608} | ||||
|   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | ||||
|   m_LocalPosition: {x: 0, y: 0, z: 0} | ||||
|   m_LocalScale: {x: 1, y: 1, z: 1} | ||||
|   m_Children: | ||||
|   - {fileID: 834154608} | ||||
|   - {fileID: 1345195447} | ||||
|   m_Father: {fileID: 1795849913} | ||||
|   m_RootOrder: 10 | ||||
|   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||||
|   m_AnchorMin: {x: 0.5, y: 0} | ||||
|   m_AnchorMax: {x: 0.5, y: 0} | ||||
|   m_AnchoredPosition: {x: 0, y: 110} | ||||
|   m_SizeDelta: {x: 800, y: 140} | ||||
|   m_Pivot: {x: 0.5, y: 0} | ||||
| --- !u!114 &923374610 | ||||
| MonoBehaviour: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 923374608} | ||||
|   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: 1, g: 1, b: 1, a: 0.392} | ||||
|   m_RaycastTarget: 1 | ||||
|   m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} | ||||
|   m_Maskable: 1 | ||||
|   m_OnCullStateChanged: | ||||
|     m_PersistentCalls: | ||||
|       m_Calls: [] | ||||
|   m_Sprite: {fileID: 0} | ||||
|   m_Type: 1 | ||||
|   m_PreserveAspect: 0 | ||||
|   m_FillCenter: 1 | ||||
|   m_FillMethod: 4 | ||||
|   m_FillAmount: 1 | ||||
|   m_FillClockwise: 1 | ||||
|   m_FillOrigin: 0 | ||||
|   m_UseSpriteMesh: 0 | ||||
|   m_PixelsPerUnitMultiplier: 1 | ||||
| --- !u!222 &923374611 | ||||
| CanvasRenderer: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 923374608} | ||||
|   m_CullTransparentMesh: 1 | ||||
| --- !u!114 &923374612 | ||||
| MonoBehaviour: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 923374608} | ||||
|   m_Enabled: 1 | ||||
|   m_EditorHideFlags: 0 | ||||
|   m_Script: {fileID: 11500000, guid: 69eb9a32154d0fb47a8cead9419d7a24, type: 3} | ||||
|   m_Name:  | ||||
|   m_EditorClassIdentifier:  | ||||
|   ProgressLabel: {fileID: 1345195448} | ||||
|   ProgressSlider: {fileID: 834154609} | ||||
| --- !u!1 &925091078 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
| @@ -19447,6 +19864,7 @@ GameObject: | ||||
|   - component: {fileID: 1337976897} | ||||
|   - component: {fileID: 1337976896} | ||||
|   - component: {fileID: 1337976895} | ||||
|   - component: {fileID: 1337976898} | ||||
|   m_Layer: 5 | ||||
|   m_Name: SSHeight | ||||
|   m_TagString: Untagged | ||||
| @@ -19610,6 +20028,19 @@ CanvasRenderer: | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 1337976893} | ||||
|   m_CullTransparentMesh: 1 | ||||
| --- !u!114 &1337976898 | ||||
| MonoBehaviour: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 1337976893} | ||||
|   m_Enabled: 1 | ||||
|   m_EditorHideFlags: 0 | ||||
|   m_Script: {fileID: 11500000, guid: cc33a39070010f94fb1c2dd721c1286d, type: 3} | ||||
|   m_Name:  | ||||
|   m_EditorClassIdentifier:  | ||||
|   showHtmlElement: 0 | ||||
| --- !u!1 &1340416476 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
| @@ -19622,6 +20053,7 @@ GameObject: | ||||
|   - component: {fileID: 1340416480} | ||||
|   - component: {fileID: 1340416479} | ||||
|   - component: {fileID: 1340416478} | ||||
|   - component: {fileID: 1340416481} | ||||
|   m_Layer: 5 | ||||
|   m_Name: GifWidth | ||||
|   m_TagString: Untagged | ||||
| @@ -19785,6 +20217,153 @@ CanvasRenderer: | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 1340416476} | ||||
|   m_CullTransparentMesh: 1 | ||||
| --- !u!114 &1340416481 | ||||
| MonoBehaviour: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 1340416476} | ||||
|   m_Enabled: 1 | ||||
|   m_EditorHideFlags: 0 | ||||
|   m_Script: {fileID: 11500000, guid: cc33a39070010f94fb1c2dd721c1286d, type: 3} | ||||
|   m_Name:  | ||||
|   m_EditorClassIdentifier:  | ||||
|   showHtmlElement: 0 | ||||
| --- !u!1 &1345195446 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   serializedVersion: 6 | ||||
|   m_Component: | ||||
|   - component: {fileID: 1345195447} | ||||
|   - component: {fileID: 1345195449} | ||||
|   - component: {fileID: 1345195448} | ||||
|   m_Layer: 5 | ||||
|   m_Name: Text (TMP) | ||||
|   m_TagString: Untagged | ||||
|   m_Icon: {fileID: 0} | ||||
|   m_NavMeshLayer: 0 | ||||
|   m_StaticEditorFlags: 0 | ||||
|   m_IsActive: 1 | ||||
| --- !u!224 &1345195447 | ||||
| RectTransform: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 1345195446} | ||||
|   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | ||||
|   m_LocalPosition: {x: 0, y: 0, z: 0} | ||||
|   m_LocalScale: {x: 1, y: 1, z: 1} | ||||
|   m_Children: [] | ||||
|   m_Father: {fileID: 923374609} | ||||
|   m_RootOrder: 1 | ||||
|   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: 40} | ||||
|   m_SizeDelta: {x: 0, y: -80} | ||||
|   m_Pivot: {x: 0.5, y: 0.5} | ||||
| --- !u!114 &1345195448 | ||||
| MonoBehaviour: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 1345195446} | ||||
|   m_Enabled: 1 | ||||
|   m_EditorHideFlags: 0 | ||||
|   m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, 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_text: 'Downloading: <filename>' | ||||
|   m_isRightToLeft: 0 | ||||
|   m_fontAsset: {fileID: 11400000, guid: 38f9c70d045080845a18307715f00e15, type: 2} | ||||
|   m_sharedMaterial: {fileID: 3861585161733349673, guid: 38f9c70d045080845a18307715f00e15, type: 2} | ||||
|   m_fontSharedMaterials: [] | ||||
|   m_fontMaterial: {fileID: 0} | ||||
|   m_fontMaterials: [] | ||||
|   m_fontColor32: | ||||
|     serializedVersion: 2 | ||||
|     rgba: 4281479730 | ||||
|   m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} | ||||
|   m_enableVertexGradient: 0 | ||||
|   m_colorMode: 3 | ||||
|   m_fontColorGradient: | ||||
|     topLeft: {r: 1, g: 1, b: 1, a: 1} | ||||
|     topRight: {r: 1, g: 1, b: 1, a: 1} | ||||
|     bottomLeft: {r: 1, g: 1, b: 1, a: 1} | ||||
|     bottomRight: {r: 1, g: 1, b: 1, a: 1} | ||||
|   m_fontColorGradientPreset: {fileID: 0} | ||||
|   m_spriteAsset: {fileID: 0} | ||||
|   m_tintAllSprites: 0 | ||||
|   m_StyleSheet: {fileID: 0} | ||||
|   m_TextStyleHashCode: -1183493901 | ||||
|   m_overrideHtmlColors: 0 | ||||
|   m_faceColor: | ||||
|     serializedVersion: 2 | ||||
|     rgba: 4294967295 | ||||
|   m_fontSize: 36 | ||||
|   m_fontSizeBase: 36 | ||||
|   m_fontWeight: 400 | ||||
|   m_enableAutoSizing: 0 | ||||
|   m_fontSizeMin: 18 | ||||
|   m_fontSizeMax: 72 | ||||
|   m_fontStyle: 0 | ||||
|   m_HorizontalAlignment: 2 | ||||
|   m_VerticalAlignment: 1024 | ||||
|   m_textAlignment: 65535 | ||||
|   m_characterSpacing: 0 | ||||
|   m_wordSpacing: 0 | ||||
|   m_lineSpacing: 0 | ||||
|   m_lineSpacingMax: 0 | ||||
|   m_paragraphSpacing: 0 | ||||
|   m_charWidthMaxAdj: 0 | ||||
|   m_enableWordWrapping: 1 | ||||
|   m_wordWrappingRatios: 0.4 | ||||
|   m_overflowMode: 0 | ||||
|   m_linkedTextComponent: {fileID: 0} | ||||
|   parentLinkedComponent: {fileID: 0} | ||||
|   m_enableKerning: 1 | ||||
|   m_enableExtraPadding: 0 | ||||
|   checkPaddingRequired: 0 | ||||
|   m_isRichText: 1 | ||||
|   m_parseCtrlCharacters: 1 | ||||
|   m_isOrthographic: 1 | ||||
|   m_isCullingEnabled: 0 | ||||
|   m_horizontalMapping: 0 | ||||
|   m_verticalMapping: 0 | ||||
|   m_uvLineOffset: 0 | ||||
|   m_geometrySortingOrder: 0 | ||||
|   m_IsTextObjectScaleStatic: 0 | ||||
|   m_VertexBufferAutoSizeReduction: 0 | ||||
|   m_useMaxVisibleDescender: 1 | ||||
|   m_pageToDisplay: 1 | ||||
|   m_margin: {x: 0, y: 0, z: 0, w: 0} | ||||
|   m_isUsingLegacyAnimationComponent: 0 | ||||
|   m_isVolumetricText: 0 | ||||
|   m_hasFontAssetChanged: 0 | ||||
|   m_baseMaterial: {fileID: 0} | ||||
|   m_maskOffset: {x: 0, y: 0, z: 0, w: 0} | ||||
| --- !u!222 &1345195449 | ||||
| CanvasRenderer: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 1345195446} | ||||
|   m_CullTransparentMesh: 1 | ||||
| --- !u!1 &1347856242 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
| @@ -22715,6 +23294,7 @@ MonoBehaviour: | ||||
|   LoadedCharaButton: {fileID: 6579709008394472268} | ||||
|   BackgroundDropdown: {fileID: 1464018681} | ||||
|   BodyAnimationDropdown: {fileID: 2082327791} | ||||
|   DownloadProgress: {fileID: 923374612} | ||||
|   MeshesListContent: {fileID: 6144536939855760294} | ||||
|   ServantList: {fileID: 5584442607537429347} | ||||
|   EnemiesList: {fileID: 1924500984} | ||||
| @@ -24520,6 +25100,7 @@ RectTransform: | ||||
|   - {fileID: 1030230481} | ||||
|   - {fileID: 83053481} | ||||
|   - {fileID: 922663355} | ||||
|   - {fileID: 923374609} | ||||
|   m_Father: {fileID: 1269587798} | ||||
|   m_RootOrder: 1 | ||||
|   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||||
| @@ -25387,6 +25968,7 @@ GameObject: | ||||
|   - component: {fileID: 1934371275} | ||||
|   - component: {fileID: 1934371274} | ||||
|   - component: {fileID: 1934371273} | ||||
|   - component: {fileID: 1934371276} | ||||
|   m_Layer: 5 | ||||
|   m_Name: SSWidth | ||||
|   m_TagString: Untagged | ||||
| @@ -25550,6 +26132,19 @@ CanvasRenderer: | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 1934371271} | ||||
|   m_CullTransparentMesh: 1 | ||||
| --- !u!114 &1934371276 | ||||
| MonoBehaviour: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 1934371271} | ||||
|   m_Enabled: 1 | ||||
|   m_EditorHideFlags: 0 | ||||
|   m_Script: {fileID: 11500000, guid: cc33a39070010f94fb1c2dd721c1286d, type: 3} | ||||
|   m_Name:  | ||||
|   m_EditorClassIdentifier:  | ||||
|   showHtmlElement: 0 | ||||
| --- !u!1 &1936480421 | ||||
| GameObject: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   | ||||
| @@ -56,7 +56,14 @@ public class CameraOrbit3D : MonoBehaviour | ||||
|         Vector2 touchDelta = Vector2.zero; | ||||
|         lastMouse = mouse; | ||||
|  | ||||
|         TargetCenter = Vector3.zero; | ||||
|         if (eventSystem.currentSelectedGameObject == null) | ||||
|         { | ||||
|             var x = Input.GetAxis("Horizontal"); | ||||
|             var y = Input.GetAxis("Vertical"); | ||||
|             var delta = (transform.up * y + transform.right * x) * Time.deltaTime; | ||||
|             TargetCenter += delta; | ||||
|             transform.position += delta; | ||||
|         } | ||||
|  | ||||
|         cam.fieldOfView = fov; | ||||
|         Vector3 position = transform.position; | ||||
|   | ||||
| @@ -31,10 +31,18 @@ public class FateAssetManager : MonoBehaviour | ||||
|         callback(outTex); | ||||
|     } | ||||
|  | ||||
|     public static IEnumerator DownloadText(string url, System.Action<string> callback) | ||||
|     public static IEnumerator DownloadText(string url, System.Action<string> callback, System.Action<float> onProgress = null) | ||||
|     { | ||||
|         UnityWebRequest www = UnityWebRequest.Get(url); | ||||
|         yield return www.SendWebRequest(); | ||||
|  | ||||
|         var request = www.SendWebRequest(); | ||||
|  | ||||
|         while (!request.isDone) | ||||
|         { | ||||
|             onProgress?.Invoke(request.progress); | ||||
|             yield return 0; | ||||
|         } | ||||
|  | ||||
|         if (www.result != UnityWebRequest.Result.Success) | ||||
|         { | ||||
|             Debug.Log(url); | ||||
| @@ -48,22 +56,29 @@ public class FateAssetManager : MonoBehaviour | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static IEnumerator DownloadBundle(string url, System.Action<AssetBundle> callback) | ||||
|     public static IEnumerator DownloadBundle(string url, System.Action<AssetBundle> callback, System.Action<float> onProgress = null) | ||||
|     { | ||||
|         Error.Log(Color.green, $"Downloading bundle from {url}"); | ||||
|         UnityWebRequest www = UnityWebRequestAssetBundle.GetAssetBundle(url); | ||||
|         yield return www.SendWebRequest(); | ||||
|         AssetBundle bundlea = null; | ||||
|         UnityWebRequest www = UnityWebRequest.Get(url); | ||||
|  | ||||
|         var request = www.SendWebRequest(); | ||||
|  | ||||
|         while (!request.isDone) | ||||
|         { | ||||
|             onProgress?.Invoke(request.progress); | ||||
|             yield return 0; | ||||
|         } | ||||
|  | ||||
|         if (www.result != UnityWebRequest.Result.Success) | ||||
|         { | ||||
|             Error.Log(Color.red, www.error); | ||||
|             Debug.Log(url); | ||||
|             Debug.Log(www.error); | ||||
|             callback(null); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             bundlea = DownloadHandlerAssetBundle.GetContent(www); | ||||
|             var bytes = www.downloadHandler.data; | ||||
|             callback(AssetBundle.LoadFromMemory(bytes)); | ||||
|         } | ||||
|  | ||||
|         callback(bundlea); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -53,10 +53,17 @@ public class FateModelBuilder : MonoBehaviour | ||||
|         AssetBundle assetBundle = null; | ||||
|         string url = $"{urlBase}/{idNum}"; | ||||
|  | ||||
|         yield return FateAssetManager.DownloadBundle(url, (cb) => | ||||
|         { | ||||
|             assetBundle = cb; | ||||
|         }); | ||||
|         yield return FateAssetManager.DownloadBundle(url,  | ||||
|             (cb) => | ||||
|             { | ||||
|                 assetBundle = cb; | ||||
|                 UIController.Instance.DownloadProgress.SetProgress($"", 1); | ||||
|             }, | ||||
|             (progress) => | ||||
|             { | ||||
|                 UIController.Instance.DownloadProgress.SetProgress($"Servants/{idNum}", progress); | ||||
|             } | ||||
|         ); | ||||
|  | ||||
|         if (assetBundle == null) | ||||
|         { | ||||
| @@ -121,32 +128,38 @@ public class FateModelBuilder : MonoBehaviour | ||||
|         foreach (var asset in assetBundle.LoadAllAssets()) | ||||
|         { | ||||
|             if (asset == null) { continue; } | ||||
|             else if (asset.GetType() == typeof(GameObject)) | ||||
|             switch (asset) | ||||
|             { | ||||
|                 if((asset as GameObject).name == "chr") | ||||
|                 { | ||||
|                     servant.BodyMain = asset as GameObject; | ||||
|                 } | ||||
|             } | ||||
|             else if (asset.GetType() == typeof(Texture2D)) | ||||
|             { | ||||
|                 Texture2D tex = asset as Texture2D; | ||||
|                 servant.Textures.Add(tex); | ||||
|             } | ||||
|             else if (asset.GetType() == typeof(Material)) | ||||
|             { | ||||
|                 servant.Materials.Add(asset as Material); | ||||
|             } | ||||
|             else if (asset.GetType() == typeof(TextAsset)) | ||||
|             { | ||||
|             } | ||||
|             else if (asset.GetType() == typeof(AnimationClip)) | ||||
|             { | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 //Error.Log(Color.yellow, asset.GetType().ToString()); | ||||
|                 //Debug.LogWarning(asset.GetType()); | ||||
|                 case GameObject go: | ||||
|                     { | ||||
|                         if (go.name == "chr") | ||||
|                         { | ||||
|                             servant.BodyMain = go; | ||||
|                         } | ||||
|                         break; | ||||
|                     } | ||||
|                 case Texture2D tex: | ||||
|                     { | ||||
|                         servant.Textures.Add(tex); | ||||
|                         break; | ||||
|                     } | ||||
|                 case Material mat: | ||||
|                     { | ||||
|                         servant.Materials.Add(mat); | ||||
|                         if(mat.name == "9945400") | ||||
|                         { | ||||
|                             mat.mainTexture.wrapMode = TextureWrapMode.Repeat; | ||||
|                             mat.mainTextureOffset = new Vector2(0.2f, 0.78f); | ||||
|                             mat.mainTextureScale = new Vector2(10000, 10000); | ||||
|                         } | ||||
|                         break; | ||||
|                     } | ||||
|                 case TextAsset text: | ||||
|                 case AnimationClip anim: | ||||
|                 default: | ||||
|                     //Error.Log(Color.yellow, asset.GetType().ToString()); | ||||
|                     //Debug.LogWarning(asset.GetType()); | ||||
|                     break; | ||||
|             } | ||||
|         } | ||||
|  | ||||
| @@ -186,7 +199,6 @@ public class FateModelBuilder : MonoBehaviour | ||||
|                 mat.SetFloat("_Cutoff", 0.91f); | ||||
|                 UIController.Instance.CutoffSlider?.onValueChanged.AddListener((value) => { temp.SetFloat("_Cutoff", value / 100);}); | ||||
|             } | ||||
|  | ||||
|         } | ||||
|  | ||||
|         if(servant.BodyMain == null) | ||||
| @@ -198,6 +210,15 @@ public class FateModelBuilder : MonoBehaviour | ||||
|         } | ||||
|  | ||||
|         servant.BodyMain = Instantiate(servant.BodyMain, servant.transform); | ||||
|         servant.BodyMain.transform.eulerAngles = Vector3.zero; | ||||
|  | ||||
|         var root = servant.BodyMain.transform.Find("joint_all_Base"); | ||||
|         if (root != null) | ||||
|         { | ||||
|             Debug.Log("Not null"); | ||||
|             root.localPosition = Vector3.zero; | ||||
|         } | ||||
|  | ||||
|         servant.InstantiatedObjects.Add(servant.BodyMain); | ||||
|         var simpleAnimation = servant.GetComponentInChildren<SimpleAnimation>(); | ||||
|         simpleAnimation.enabled = false; | ||||
| @@ -269,36 +290,38 @@ public class FateModelBuilder : MonoBehaviour | ||||
|         foreach (var asset in assetBundle.LoadAllAssets()) | ||||
|         { | ||||
|             if (asset == null) { continue; } | ||||
|             else if (asset.GetType() == typeof(GameObject)) | ||||
|             switch (asset) | ||||
|             { | ||||
|                 if (asset.name.StartsWith("chr_")) | ||||
|                 { | ||||
|                     servant.BodyMain = asset as GameObject; | ||||
|                 } | ||||
|                 else if (asset.name.StartsWith("model_")) | ||||
|                 { | ||||
|                     Instantiate(asset, servant.transform); | ||||
|                 } | ||||
|             } | ||||
|             else if (asset.GetType() == typeof(Texture2D)) | ||||
|             { | ||||
|                 Texture2D tex = asset as Texture2D; | ||||
|                 servant.Textures.Add(tex); | ||||
|             } | ||||
|             else if (asset.GetType() == typeof(Material)) | ||||
|             { | ||||
|                 servant.Materials.Add(asset as Material); | ||||
|             } | ||||
|             else if (asset.GetType() == typeof(TextAsset)) | ||||
|             { | ||||
|             } | ||||
|             else if (asset.GetType() == typeof(AnimationClip)) | ||||
|             { | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 Error.Log(Color.yellow, asset.GetType().ToString()); | ||||
|                 Debug.LogWarning(asset.GetType()); | ||||
|                 case GameObject go: | ||||
|                     { | ||||
|                         if (asset.name.StartsWith("chr_")) | ||||
|                         { | ||||
|                             servant.BodyMain = go; | ||||
|                         } | ||||
|                         else if (asset.name.StartsWith("model_")) | ||||
|                         { | ||||
|                             Instantiate(asset, servant.transform); | ||||
|                         } | ||||
|                         break; | ||||
|                     } | ||||
|                 case Texture2D tex: | ||||
|                     { | ||||
|                         servant.Textures.Add(tex); | ||||
|                         break; | ||||
|                     } | ||||
|                 case Material mat: | ||||
|                     { | ||||
|                         servant.Materials.Add(mat); | ||||
|                         break; | ||||
|                     } | ||||
|                 case TextAsset tex: | ||||
|                 case AnimationClip anim: | ||||
|                 default: | ||||
|                     { | ||||
|                         Error.Log(Color.yellow, asset.GetType().ToString()); | ||||
|                         Debug.LogWarning(asset.GetType()); | ||||
|                         break; | ||||
|                     } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -130,7 +130,7 @@ public class FateServantContainer : MonoBehaviour | ||||
|         } | ||||
|         for (int i = Textures.Count - 1; i >= 0; i--) | ||||
|         { | ||||
|             Destroy(Textures[i]); | ||||
|             DestroyImmediate(Textures[i], true); | ||||
|         } | ||||
|         for (int i = InstantiatedObjects.Count - 1; i >= 0; i--) | ||||
|         { | ||||
|   | ||||
| @@ -161,23 +161,30 @@ public class FateViewerMain : MonoBehaviour | ||||
|         { | ||||
|             url = $"{AAAPI}NA/basic_servant.json"; | ||||
|         } | ||||
|         yield return FateAssetManager.DownloadText(url, (txt) => | ||||
|         { | ||||
|             txt = $"{{\"Entries\": {txt} }}"; | ||||
|             Servants = Newtonsoft.Json.JsonConvert.DeserializeObject<BasicServant>(txt); | ||||
|             foreach (var servant in Servants.Entries) | ||||
|         yield return FateAssetManager.DownloadText(url, | ||||
|             (txt) => | ||||
|             { | ||||
|                 servant.costumes = servant.costume.Select(c => c.Value).ToList(); | ||||
|                 if (servant.costumes.FirstOrDefault(c => c.battleCharaId == servant.id) == null) | ||||
|                     servant.costumes.Insert(0, new BasicServant.Costume() | ||||
|                     { | ||||
|                         battleCharaId = servant.id, | ||||
|                         id = 0, | ||||
|                         shortName = servant.name, | ||||
|                     }); | ||||
|                 txt = $"{{\"Entries\": {txt} }}"; | ||||
|                 Servants = Newtonsoft.Json.JsonConvert.DeserializeObject<BasicServant>(txt); | ||||
|                 foreach (var servant in Servants.Entries) | ||||
|                 { | ||||
|                     servant.costumes = servant.costume.Select(c => c.Value).ToList(); | ||||
|                     if (servant.costumes.FirstOrDefault(c => c.battleCharaId == servant.id) == null) | ||||
|                         servant.costumes.Insert(0, new BasicServant.Costume() | ||||
|                         { | ||||
|                             battleCharaId = servant.id, | ||||
|                             id = 0, | ||||
|                             shortName = servant.name, | ||||
|                         }); | ||||
|                 } | ||||
|                 Servants.Entries = Servants.Entries.OrderBy(e => e.collectionNo).ToList(); | ||||
|                 UIController.Instance.DownloadProgress.SetProgress("", 1); | ||||
|             }, | ||||
|             (progress) => | ||||
|             { | ||||
|                 UIController.Instance.DownloadProgress.SetProgress("servant list", progress); | ||||
|             } | ||||
|             Servants.Entries = Servants.Entries.OrderBy(e => e.collectionNo).ToList(); | ||||
|         }); | ||||
|         ); | ||||
|  | ||||
|         if (Servants.Entries.Count > 0) | ||||
|         { | ||||
| @@ -201,36 +208,43 @@ public class FateViewerMain : MonoBehaviour | ||||
|     { | ||||
|         string url = $"{AAAPI}JP/basic_svt_lang_en.json"; | ||||
|         Dictionary<string, List<BasicServant.Costume>> entries = new Dictionary<string, List<BasicServant.Costume>>(); | ||||
|         yield return FateAssetManager.DownloadText(url, (txt) => | ||||
|         { | ||||
|             txt = $"{{\"Entries\": {txt} }}"; | ||||
|             Enemies = Newtonsoft.Json.JsonConvert.DeserializeObject<BasicServant>(txt); | ||||
|             Enemies.Entries = Enemies.Entries.Where(e => e.type == "enemy").ToList(); | ||||
|             Enemies.Entries = Enemies.Entries.OrderBy(e => e.name).ToList(); | ||||
|             foreach (var enemy in Enemies.Entries) | ||||
|         yield return FateAssetManager.DownloadText(url, | ||||
|             (txt) => | ||||
|             { | ||||
|                 enemy.costumes = enemy.costume.Select(c => c.Value).ToList(); | ||||
|                 foreach (var costume in enemy.costumes) | ||||
|                 txt = $"{{\"Entries\": {txt} }}"; | ||||
|                 Enemies = Newtonsoft.Json.JsonConvert.DeserializeObject<BasicServant>(txt); | ||||
|                 Enemies.Entries = Enemies.Entries.Where(e => e.type == "enemy").ToList(); | ||||
|                 Enemies.Entries = Enemies.Entries.OrderBy(e => e.name).ToList(); | ||||
|                 foreach (var enemy in Enemies.Entries) | ||||
|                 { | ||||
|                     var cos = new BasicServant.Costume() | ||||
|                     enemy.costumes = enemy.costume.Select(c => c.Value).ToList(); | ||||
|                     foreach (var costume in enemy.costumes) | ||||
|                     { | ||||
|                         name = costume.name, | ||||
|                         shortName = costume.shortName, | ||||
|                         id = costume.id, | ||||
|                         battleCharaId = costume.battleCharaId | ||||
|                     }; | ||||
|                     if (entries.ContainsKey(enemy.name)) | ||||
|                     { | ||||
|                         if (!entries[enemy.name].Any(c => c.battleCharaId == costume.battleCharaId)) | ||||
|                             entries[enemy.name].Add(cos); | ||||
|                     } | ||||
|                     else | ||||
|                     { | ||||
|                         entries[enemy.name] = new List<BasicServant.Costume>() { cos }; | ||||
|                         var cos = new BasicServant.Costume() | ||||
|                         { | ||||
|                             name = costume.name, | ||||
|                             shortName = costume.shortName, | ||||
|                             id = costume.id, | ||||
|                             battleCharaId = costume.battleCharaId | ||||
|                         }; | ||||
|                         if (entries.ContainsKey(enemy.name)) | ||||
|                         { | ||||
|                             if (!entries[enemy.name].Any(c => c.battleCharaId == costume.battleCharaId)) | ||||
|                                 entries[enemy.name].Add(cos); | ||||
|                         } | ||||
|                         else | ||||
|                         { | ||||
|                             entries[enemy.name] = new List<BasicServant.Costume>() { cos }; | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|                 UIController.Instance.DownloadProgress.SetProgress("", 1); | ||||
|             }, | ||||
|             (progress) => | ||||
|             { | ||||
|                 UIController.Instance.DownloadProgress.SetProgress("enemy list", progress); | ||||
|             } | ||||
|         }); | ||||
|         ); | ||||
|  | ||||
|         if (entries.Count() > 0) | ||||
|         { | ||||
| @@ -263,6 +277,7 @@ public class FateViewerMain : MonoBehaviour | ||||
|         { | ||||
|             Cam.GetComponent<CameraOrbit>().enabled = false; | ||||
|             Cam.GetComponent<Camera>().orthographic = false; | ||||
|             Cam.GetComponent<CameraOrbit3D>().TargetCenter = Vector3.zero; | ||||
|             Cam.GetComponent<CameraOrbit3D>().enabled = true; | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -15,6 +15,7 @@ public class UIController : MonoBehaviour | ||||
|     public GameObject LoadedCharaButton; | ||||
|     public Dropdown BackgroundDropdown; | ||||
|     public Dropdown BodyAnimationDropdown; | ||||
|     public UIDownloadProgress DownloadProgress; | ||||
|     public Transform MeshesListContent; | ||||
|     public ScrollRect ServantList; | ||||
|     public ScrollRect EnemiesList; | ||||
|   | ||||
							
								
								
									
										22
									
								
								Assets/Scripts/UIDownloadProgress.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								Assets/Scripts/UIDownloadProgress.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| using UnityEngine; | ||||
| using UnityEngine.UI; | ||||
|  | ||||
| public class UIDownloadProgress : MonoBehaviour | ||||
| { | ||||
|     public TMPro.TMP_Text ProgressLabel; | ||||
|     public Slider ProgressSlider; | ||||
|  | ||||
|     public void SetProgress(string itemName, float progress) | ||||
|     { | ||||
|         if(progress == 1) | ||||
|         { | ||||
|             gameObject.SetActive(false); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             gameObject.SetActive(true); | ||||
|             ProgressLabel.text = "Downloading: " + itemName; | ||||
|             ProgressSlider.value = progress; | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										11
									
								
								Assets/Scripts/UIDownloadProgress.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/UIDownloadProgress.cs.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: 69eb9a32154d0fb47a8cead9419d7a24 | ||||
| MonoImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   defaultReferences: [] | ||||
|   executionOrder: 0 | ||||
|   icon: {instanceID: 0} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
							
								
								
									
										8
									
								
								Assets/Scripts/WebGLSupport.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/Scripts/WebGLSupport.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: cd9908edcf916f6488a97c001cd54c32 | ||||
| folderAsset: yes | ||||
| DefaultImporter: | ||||
|   externalObjects: {} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
							
								
								
									
										8
									
								
								Assets/Scripts/WebGLSupport/WebGLInput.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/Scripts/WebGLSupport/WebGLInput.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: 23d83eab8f753b04fb7f1384ac6676a0 | ||||
| folderAsset: yes | ||||
| DefaultImporter: | ||||
|   externalObjects: {} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
							
								
								
									
										8
									
								
								Assets/Scripts/WebGLSupport/WebGLInput/Detail.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/Scripts/WebGLSupport/WebGLInput/Detail.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: dd840bb14379149498902237a63bb794 | ||||
| folderAsset: yes | ||||
| DefaultImporter: | ||||
|   externalObjects: {} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
| @@ -0,0 +1,64 @@ | ||||
| using System.Collections; | ||||
| using System.Collections.Generic; | ||||
| using UnityEngine; | ||||
|  | ||||
| namespace WebGLSupport.Detail | ||||
| { | ||||
|     public class RebuildChecker | ||||
|     { | ||||
|         IInputField input; | ||||
|  | ||||
|         string beforeString; | ||||
|         int beforeCaretPosition; | ||||
|         int beforeSelectionFocusPosition; | ||||
|         int beforeSelectionAnchorPosition; | ||||
|         //Vector2 anchoredPosition; | ||||
|  | ||||
|         public RebuildChecker(IInputField input) | ||||
|         { | ||||
|             this.input = input; | ||||
|         } | ||||
|  | ||||
|         public bool NeedRebuild(bool debug = false) | ||||
|         { | ||||
|             var res = false; | ||||
|  | ||||
|             // any not same | ||||
|             if (beforeString != input.text) | ||||
|             { | ||||
|                 if(debug) Debug.Log(string.Format("beforeString : {0} != {1}", beforeString, input.text)); | ||||
|                 beforeString = input.text; | ||||
|                 res = true; | ||||
|             } | ||||
|  | ||||
|             if (beforeCaretPosition != input.caretPosition) | ||||
|             { | ||||
|                 if (debug) Debug.Log(string.Format("beforeCaretPosition : {0} != {1}", beforeCaretPosition, input.caretPosition)); | ||||
|                 beforeCaretPosition = input.caretPosition; | ||||
|                 res = true; | ||||
|             } | ||||
|  | ||||
|             if (beforeSelectionFocusPosition != input.selectionFocusPosition) | ||||
|             { | ||||
|                 if (debug) Debug.Log(string.Format("beforeSelectionFocusPosition : {0} != {1}", beforeSelectionFocusPosition, input.selectionFocusPosition)); | ||||
|                 beforeSelectionFocusPosition = input.selectionFocusPosition; | ||||
|                 res = true; | ||||
|             } | ||||
|  | ||||
|             if (beforeSelectionAnchorPosition != input.selectionAnchorPosition) | ||||
|             { | ||||
|                 if (debug) Debug.Log(string.Format("beforeSelectionAnchorPosition : {0} != {1}", beforeSelectionAnchorPosition, input.selectionAnchorPosition)); | ||||
|                 beforeSelectionAnchorPosition = input.selectionAnchorPosition; | ||||
|                 res = true; | ||||
|             } | ||||
|  | ||||
|             //if (anchoredPosition != input.TextComponentRectTransform().anchoredPosition) | ||||
|             //{ | ||||
|             //    if (debug) Debug.Log(string.Format("anchoredPosition : {0} != {1}", anchoredPosition, input.TextComponentRectTransform().anchoredPosition)); | ||||
|             //    anchoredPosition = input.TextComponentRectTransform().anchoredPosition; | ||||
|             //    res = true; | ||||
|             //} | ||||
|             return res; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,11 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: 3cb8b49a6bee2384b888ba951eb2bdbd | ||||
| MonoImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   defaultReferences: [] | ||||
|   executionOrder: 0 | ||||
|   icon: {instanceID: 0} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
							
								
								
									
										8
									
								
								Assets/Scripts/WebGLSupport/WebGLInput/Mobile.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/Scripts/WebGLSupport/WebGLInput/Mobile.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: 8fcb4aaeec72ef54486eff0172891c0b | ||||
| folderAsset: yes | ||||
| DefaultImporter: | ||||
|   externalObjects: {} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
| @@ -0,0 +1,87 @@ | ||||
| using System.Collections; | ||||
| using System.Collections.Generic; | ||||
| using UnityEngine; | ||||
| using UnityEngine.EventSystems; | ||||
| using System.Runtime.InteropServices; // for DllImport | ||||
| using AOT; | ||||
| using System; | ||||
|  | ||||
| namespace WebGLSupport | ||||
| { | ||||
|     class WebGLInputMobilePlugin | ||||
|     { | ||||
| #if UNITY_WEBGL && !UNITY_EDITOR | ||||
|         [DllImport("__Internal")] | ||||
|         public static extern int WebGLInputMobileRegister(Action<int> OnTouchEnd); | ||||
|  | ||||
|         [DllImport("__Internal")] | ||||
|         public static extern void WebGLInputMobileOnFocusOut(int id, Action<int> OnFocusOut); | ||||
| #else | ||||
|         /// <summary> | ||||
|         /// ID を割り振り | ||||
|         /// </summary> | ||||
|         /// <returns></returns> | ||||
|         public static int WebGLInputMobileRegister(Action<int> OnTouchEnd) { return 0; } | ||||
|  | ||||
|         public static void WebGLInputMobileOnFocusOut(int id, Action<int> OnFocusOut) {} | ||||
| #endif | ||||
|     } | ||||
|  | ||||
|     public class WebGLInputMobile : MonoBehaviour, IPointerDownHandler | ||||
|     { | ||||
|         static Dictionary<int, WebGLInputMobile> instances = new Dictionary<int, WebGLInputMobile>(); | ||||
|  | ||||
|         int id = -1; | ||||
|  | ||||
|         private void Awake() | ||||
|         { | ||||
| #if !(UNITY_WEBGL && !UNITY_EDITOR) | ||||
|             // WebGL 以外、更新メソッドは動作しないようにします | ||||
|             enabled = false; | ||||
| #endif | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 押されたら、touchend イベントを登録する | ||||
|         /// </summary> | ||||
|         /// <param name="eventData"></param> | ||||
|         public void OnPointerDown(PointerEventData eventData) | ||||
|         { | ||||
|             if (id != -1) return; | ||||
|             id = WebGLInputMobilePlugin.WebGLInputMobileRegister(OnTouchEnd); | ||||
|             instances[id] = this; | ||||
|         } | ||||
|  | ||||
|         [MonoPInvokeCallback(typeof(Action<int>))] | ||||
|         static void OnTouchEnd(int id) | ||||
|         { | ||||
|             var @this = instances[id]; | ||||
|             @this.GetComponent<WebGLInput>().OnSelect(); | ||||
|             @this.StartCoroutine(RegisterOnFocusOut(id)); | ||||
|         } | ||||
|  | ||||
|         static IEnumerator RegisterOnFocusOut(int id) | ||||
|         { | ||||
|             yield return null;  // wait one frame. | ||||
|             WebGLInputMobilePlugin.WebGLInputMobileOnFocusOut(id, OnFocusOut); | ||||
|         } | ||||
|  | ||||
|         [MonoPInvokeCallback(typeof(Action<int>))] | ||||
|         static void OnFocusOut(int id) | ||||
|         { | ||||
|             var @this = instances[id]; | ||||
|             @this.StartCoroutine(ExecFocusOut(id)); | ||||
|         } | ||||
|  | ||||
|         static IEnumerator ExecFocusOut(int id) | ||||
|         { | ||||
|             yield return null;  // wait one frame. | ||||
|             var @this = instances[id]; | ||||
|             @this.GetComponent<WebGLInput>().DeactivateInputField(); | ||||
|             // release | ||||
|             @this.id = -1; | ||||
|             instances.Remove(id); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -0,0 +1,11 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: 56393f797a0f7e94e95547f5052052a4 | ||||
| MonoImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   defaultReferences: [] | ||||
|   executionOrder: 0 | ||||
|   icon: {instanceID: 0} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
| @@ -0,0 +1,23 @@ | ||||
| var WebGLInputMobile = { | ||||
|     $instances: [], | ||||
|  | ||||
|     WebGLInputMobileRegister: function (touchend) { | ||||
|         var id = instances.push(null) - 1; | ||||
|  | ||||
|         document.body.addEventListener("touchend", function () { | ||||
|             document.body.removeEventListener("touchend", arguments.callee); | ||||
|             Runtime.dynCall("vi", touchend, [id]); | ||||
|         }); | ||||
|  | ||||
|         return id; | ||||
|     }, | ||||
|     WebGLInputMobileOnFocusOut: function (id, focusout) { | ||||
|         document.body.addEventListener("focusout", function () { | ||||
|             document.body.removeEventListener("focusout", arguments.callee); | ||||
|             Runtime.dynCall("vi", focusout, [id]); | ||||
|         }); | ||||
|     }, | ||||
| } | ||||
|  | ||||
| autoAddDeps(WebGLInputMobile, '$instances'); | ||||
| mergeInto(LibraryManager.library, WebGLInputMobile); | ||||
| @@ -0,0 +1,34 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: 4df3633103619754fb77d82a1d683868 | ||||
| PluginImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   iconMap: {} | ||||
|   executionOrder: {} | ||||
|   isPreloaded: 0 | ||||
|   isOverridable: 0 | ||||
|   platformData: | ||||
|   - first: | ||||
|       Any:  | ||||
|     second: | ||||
|       enabled: 0 | ||||
|       settings: {} | ||||
|   - first: | ||||
|       Editor: Editor | ||||
|     second: | ||||
|       enabled: 0 | ||||
|       settings: | ||||
|         DefaultValueInitialized: true | ||||
|   - first: | ||||
|       Facebook: WebGL | ||||
|     second: | ||||
|       enabled: 1 | ||||
|       settings: {} | ||||
|   - first: | ||||
|       WebGL: WebGL | ||||
|     second: | ||||
|       enabled: 1 | ||||
|       settings: {} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
							
								
								
									
										460
									
								
								Assets/Scripts/WebGLSupport/WebGLInput/WebGLInput.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										460
									
								
								Assets/Scripts/WebGLSupport/WebGLInput/WebGLInput.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,460 @@ | ||||
| #if UNITY_2018_2_OR_NEWER | ||||
| #define TMP_WEBGL_SUPPORT | ||||
| #endif | ||||
|  | ||||
| using System.Collections.Generic; | ||||
| using UnityEngine; | ||||
| using UnityEngine.UI; | ||||
| using System; | ||||
| using AOT; | ||||
| using System.Runtime.InteropServices; // for DllImport | ||||
| using System.Collections; | ||||
| using UnityEngine.EventSystems; | ||||
|  | ||||
| namespace WebGLSupport | ||||
| { | ||||
|     internal class WebGLInputPlugin | ||||
|     { | ||||
| #if UNITY_WEBGL && !UNITY_EDITOR | ||||
|         [DllImport("__Internal")] | ||||
|         public static extern void WebGLInputInit(); | ||||
|         [DllImport("__Internal")] | ||||
|         public static extern int WebGLInputCreate(string canvasId, int x, int y, int width, int height, int fontsize, string text, string placeholder, bool isMultiLine, bool isPassword, bool isHidden, bool isMobile); | ||||
|  | ||||
|         [DllImport("__Internal")] | ||||
|         public static extern void WebGLInputEnterSubmit(int id, bool flag); | ||||
|  | ||||
|         [DllImport("__Internal")] | ||||
|         public static extern void WebGLInputTab(int id, Action<int, int> cb); | ||||
|  | ||||
|         [DllImport("__Internal")] | ||||
|         public static extern void WebGLInputFocus(int id); | ||||
|  | ||||
|         [DllImport("__Internal")] | ||||
|         public static extern void WebGLInputOnFocus(int id, Action<int> cb); | ||||
|  | ||||
|         [DllImport("__Internal")] | ||||
|         public static extern void WebGLInputOnBlur(int id, Action<int> cb); | ||||
|  | ||||
|         [DllImport("__Internal")] | ||||
|         public static extern void WebGLInputOnValueChange(int id, Action<int, string> cb); | ||||
|          | ||||
|         [DllImport("__Internal")] | ||||
|         public static extern void WebGLInputOnEditEnd(int id, Action<int, string> cb); | ||||
|  | ||||
|         [DllImport("__Internal")] | ||||
|         public static extern int WebGLInputSelectionStart(int id); | ||||
|  | ||||
|         [DllImport("__Internal")] | ||||
|         public static extern int WebGLInputSelectionEnd(int id); | ||||
|  | ||||
|         [DllImport("__Internal")] | ||||
|         public static extern int WebGLInputSelectionDirection(int id); | ||||
|  | ||||
|         [DllImport("__Internal")] | ||||
|         public static extern void WebGLInputSetSelectionRange(int id, int start, int end); | ||||
|  | ||||
|         [DllImport("__Internal")] | ||||
|         public static extern void WebGLInputMaxLength(int id, int maxlength); | ||||
|  | ||||
|         [DllImport("__Internal")] | ||||
|         public static extern void WebGLInputText(int id, string text); | ||||
|  | ||||
|         [DllImport("__Internal")] | ||||
|         public static extern bool WebGLInputIsFocus(int id); | ||||
|  | ||||
|         [DllImport("__Internal")] | ||||
|         public static extern void WebGLInputDelete(int id); | ||||
|  | ||||
|         [DllImport("__Internal")] | ||||
|         public static extern void WebGLInputForceBlur(int id); | ||||
|  | ||||
| #if WEBGLINPUT_TAB | ||||
|         [DllImport("__Internal")] | ||||
|         public static extern void WebGLInputEnableTabText(int id, bool enable); | ||||
| #endif | ||||
| #else | ||||
|         public static void WebGLInputInit() {} | ||||
|         public static int WebGLInputCreate(string canvasId, int x, int y, int width, int height, int fontsize, string text, string placeholder, bool isMultiLine, bool isPassword, bool isHidden, bool isMobile) { return 0; } | ||||
|         public static void WebGLInputEnterSubmit(int id, bool flag) { } | ||||
|         public static void WebGLInputTab(int id, Action<int, int> cb) { } | ||||
|         public static void WebGLInputFocus(int id) { } | ||||
|         public static void WebGLInputOnFocus(int id, Action<int> cb) { } | ||||
|         public static void WebGLInputOnBlur(int id, Action<int> cb) { } | ||||
|         public static void WebGLInputOnValueChange(int id, Action<int, string> cb) { } | ||||
|         public static void WebGLInputOnEditEnd(int id, Action<int, string> cb) { } | ||||
|         public static int WebGLInputSelectionStart(int id) { return 0; } | ||||
|         public static int WebGLInputSelectionEnd(int id) { return 0; } | ||||
|         public static int WebGLInputSelectionDirection(int id) { return 0; } | ||||
|         public static void WebGLInputSetSelectionRange(int id, int start, int end) { } | ||||
|         public static void WebGLInputMaxLength(int id, int maxlength) { } | ||||
|         public static void WebGLInputText(int id, string text) { } | ||||
|         public static bool WebGLInputIsFocus(int id) { return false; } | ||||
|         public static void WebGLInputDelete(int id) { } | ||||
|         public static void WebGLInputForceBlur(int id) { } | ||||
|  | ||||
| #if WEBGLINPUT_TAB | ||||
|         public static void WebGLInputEnableTabText(int id, bool enable) { } | ||||
| #endif | ||||
|  | ||||
| #endif | ||||
|     } | ||||
|  | ||||
|     public class WebGLInput : MonoBehaviour, IComparable<WebGLInput> | ||||
|     { | ||||
|         static Dictionary<int, WebGLInput> instances = new Dictionary<int, WebGLInput>(); | ||||
|         public static string CanvasId { get; set; } | ||||
|  | ||||
| #if WEBGLINPUT_TAB | ||||
|         public bool enableTabText = false; | ||||
| #endif | ||||
|  | ||||
|         static WebGLInput() | ||||
|         { | ||||
| #if UNITY_2020_1_OR_NEWER | ||||
|             WebGLInput.CanvasId = "unity-container"; | ||||
| #elif UNITY_2019_1_OR_NEWER | ||||
|             WebGLInput.CanvasId = "unityContainer"; | ||||
| #else | ||||
|             WebGLInput.CanvasId = "gameContainer"; | ||||
| #endif | ||||
|             WebGLInputPlugin.WebGLInputInit(); | ||||
|         } | ||||
|         public int Id { get { return id; } } | ||||
|         internal int id = -1; | ||||
|         public IInputField input; | ||||
|         bool blurBlock = false; | ||||
|  | ||||
|         [TooltipAttribute("show input element on canvas. this will make you select text by drag.")] | ||||
|         public bool showHtmlElement = false; | ||||
|  | ||||
|         private IInputField Setup() | ||||
|         { | ||||
|             if (GetComponent<InputField>()) return new WrappedInputField(GetComponent<InputField>()); | ||||
| #if TMP_WEBGL_SUPPORT | ||||
|             if (GetComponent<TMPro.TMP_InputField>()) return new WrappedTMPInputField(GetComponent<TMPro.TMP_InputField>()); | ||||
| #endif // TMP_WEBGL_SUPPORT | ||||
|             throw new Exception("Can not Setup WebGLInput!!"); | ||||
|         } | ||||
|  | ||||
|         private void Awake() | ||||
|         { | ||||
|             input = Setup(); | ||||
| #if !(UNITY_WEBGL && !UNITY_EDITOR) | ||||
|             // WebGL 以外、更新メソッドは動作しないようにします | ||||
|             enabled = false; | ||||
| #endif | ||||
|             // モバイルの入力対応 | ||||
|             if (Application.isMobilePlatform) | ||||
|             { | ||||
|                 gameObject.AddComponent<WebGLInputMobile>(); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Get the element rect of input | ||||
|         /// </summary> | ||||
|         /// <returns></returns> | ||||
|         RectInt GetElemetRect() | ||||
|         { | ||||
|             var rect = GetScreenCoordinates(input.RectTransform()); | ||||
|             // モバイルの場合、強制表示する | ||||
|             if (showHtmlElement || Application.isMobilePlatform) | ||||
|             { | ||||
|                 var x = (int)(rect.x); | ||||
|                 var y = (int)(Screen.height - (rect.y + rect.height)); | ||||
|                 return new RectInt(x, y, (int)rect.width, (int)rect.height); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 var x = (int)(rect.x); | ||||
|                 var y = (int)(Screen.height - (rect.y)); | ||||
|                 return new RectInt(x, y, (int)rect.width, (int)1); | ||||
|             } | ||||
|         } | ||||
|         /// <summary> | ||||
|         /// 対象が選択されたとき | ||||
|         /// </summary> | ||||
|         /// <param name="eventData"></param> | ||||
|         public void OnSelect() | ||||
|         { | ||||
|             if (id != -1) throw new Exception("OnSelect : id != -1"); | ||||
|  | ||||
|             var rect = GetElemetRect(); | ||||
|             bool isPassword = input.contentType == ContentType.Password; | ||||
|  | ||||
|             var fontSize = Mathf.Max(14, input.fontSize); // limit font size : 14 !! | ||||
|  | ||||
|             // モバイルの場合、強制表示する | ||||
|             var isHidden = !(showHtmlElement || Application.isMobilePlatform); | ||||
|             id = WebGLInputPlugin.WebGLInputCreate(WebGLInput.CanvasId, rect.x, rect.y, rect.width, rect.height, fontSize, input.text, input.placeholder, input.lineType != LineType.SingleLine, isPassword, isHidden, Application.isMobilePlatform); | ||||
|  | ||||
|             instances[id] = this; | ||||
|             WebGLInputPlugin.WebGLInputEnterSubmit(id, input.lineType != LineType.MultiLineNewline); | ||||
|             WebGLInputPlugin.WebGLInputOnFocus(id, OnFocus); | ||||
|             WebGLInputPlugin.WebGLInputOnBlur(id, OnBlur); | ||||
|             WebGLInputPlugin.WebGLInputOnValueChange(id, OnValueChange); | ||||
|             WebGLInputPlugin.WebGLInputOnEditEnd(id, OnEditEnd); | ||||
|             WebGLInputPlugin.WebGLInputTab(id, OnTab); | ||||
|             // default value : https://www.w3schools.com/tags/att_input_maxlength.asp | ||||
|             WebGLInputPlugin.WebGLInputMaxLength(id, (input.characterLimit > 0) ? input.characterLimit : 524288); | ||||
|             WebGLInputPlugin.WebGLInputFocus(id); | ||||
| #if WEBGLINPUT_TAB | ||||
|             WebGLInputPlugin.WebGLInputEnableTabText(id, enableTabText); | ||||
| #endif | ||||
|             if (input.OnFocusSelectAll) | ||||
|             { | ||||
|                 WebGLInputPlugin.WebGLInputSetSelectionRange(id, 0, input.text.Length); | ||||
|             } | ||||
|  | ||||
|             WebGLWindow.OnBlurEvent += OnWindowBlur; | ||||
|         } | ||||
|  | ||||
|         void OnWindowBlur() | ||||
|         { | ||||
|             blurBlock = true; | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 画面内の描画範囲を取得する | ||||
|         /// </summary> | ||||
|         /// <param name="uiElement"></param> | ||||
|         /// <returns></returns> | ||||
|         Rect GetScreenCoordinates(RectTransform uiElement) | ||||
|         { | ||||
|             var worldCorners = new Vector3[4]; | ||||
|             uiElement.GetWorldCorners(worldCorners); | ||||
|  | ||||
|             // try to support RenderMode:WorldSpace | ||||
|             var canvas = uiElement.GetComponentInParent<Canvas>(); | ||||
|             var useCamera = (canvas.renderMode != RenderMode.ScreenSpaceOverlay); | ||||
|             if (canvas && useCamera) | ||||
|             { | ||||
|                 var camera = canvas.worldCamera; | ||||
|                 if (!camera) camera = Camera.main; | ||||
|  | ||||
|                 for (var i = 0; i < worldCorners.Length; i++) | ||||
|                 { | ||||
|                     worldCorners[i] = camera.WorldToScreenPoint(worldCorners[i]); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             var min = new Vector3(float.MaxValue, float.MaxValue); | ||||
|             var max = new Vector3(float.MinValue, float.MinValue); | ||||
|             for (var i = 0; i < worldCorners.Length; i++) | ||||
|             { | ||||
|                 min.x = Mathf.Min(min.x, worldCorners[i].x); | ||||
|                 min.y = Mathf.Min(min.y, worldCorners[i].y); | ||||
|                 max.x = Mathf.Max(max.x, worldCorners[i].x); | ||||
|                 max.y = Mathf.Max(max.y, worldCorners[i].y); | ||||
|             } | ||||
|  | ||||
|             return new Rect(min.x, min.y, max.x - min.x, max.y - min.y); | ||||
|         } | ||||
|  | ||||
|         internal void DeactivateInputField() | ||||
|         { | ||||
|             if (!instances.ContainsKey(id)) return; | ||||
|  | ||||
|             WebGLInputPlugin.WebGLInputDelete(id); | ||||
|             input.DeactivateInputField(); | ||||
|             instances.Remove(id); | ||||
|             id = -1;    // reset id to -1; | ||||
|             WebGLWindow.OnBlurEvent -= OnWindowBlur; | ||||
|         } | ||||
|  | ||||
|         [MonoPInvokeCallback(typeof(Action<int>))] | ||||
|         static void OnFocus(int id) | ||||
|         { | ||||
| #if UNITY_WEBGL && !UNITY_EDITOR | ||||
|             Input.ResetInputAxes(); // Inputの状態リセット | ||||
|             UnityEngine.WebGLInput.captureAllKeyboardInput = false; | ||||
| #endif | ||||
|         } | ||||
|  | ||||
|         [MonoPInvokeCallback(typeof(Action<int>))] | ||||
|         static void OnBlur(int id) | ||||
|         { | ||||
| #if UNITY_WEBGL && !UNITY_EDITOR | ||||
|             UnityEngine.WebGLInput.captureAllKeyboardInput = true; | ||||
|             Input.ResetInputAxes(); // Inputの状態リセット | ||||
| #endif | ||||
|             instances[id].StartCoroutine(Blur(id)); | ||||
|         } | ||||
|  | ||||
|         static IEnumerator Blur(int id) | ||||
|         { | ||||
|             yield return null; | ||||
|             if (!instances.ContainsKey(id)) yield break; | ||||
|  | ||||
|             var block = instances[id].blurBlock;    // get blur block state | ||||
|             instances[id].blurBlock = false;        // reset instalce block state | ||||
|             if (block) yield break;                 // if block. break it!! | ||||
|             instances[id].DeactivateInputField(); | ||||
|         } | ||||
|  | ||||
|         [MonoPInvokeCallback(typeof(Action<int, string>))] | ||||
|         static void OnValueChange(int id, string value) | ||||
|         { | ||||
|             if (!instances.ContainsKey(id)) return; | ||||
|  | ||||
|             var instance = instances[id]; | ||||
|             if (!instance.input.ReadOnly) | ||||
|             { | ||||
|                 instance.input.text = value; | ||||
|             } | ||||
|  | ||||
|             // InputField.ContentType.Name が Name の場合、先頭文字が強制的大文字になるため小文字にして比べる | ||||
|             if (instance.input.contentType == ContentType.Name) | ||||
|             { | ||||
|                 if (string.Compare(instance.input.text, value, true) == 0) | ||||
|                 { | ||||
|                     value = instance.input.text; | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             // InputField の ContentType による整形したテキストを HTML の input に再設定します | ||||
|             if (value != instance.input.text) | ||||
|             { | ||||
|                 var start = WebGLInputPlugin.WebGLInputSelectionStart(id); | ||||
|                 var end = WebGLInputPlugin.WebGLInputSelectionEnd(id); | ||||
|                 // take the offset.when char remove from input. | ||||
|                 var offset = instance.input.text.Length - value.Length; | ||||
|  | ||||
|                 WebGLInputPlugin.WebGLInputText(id, instance.input.text); | ||||
|                 // reset the input element selection range!! | ||||
|                 WebGLInputPlugin.WebGLInputSetSelectionRange(id, start + offset, end + offset); | ||||
|             } | ||||
|         } | ||||
|         [MonoPInvokeCallback(typeof(Action<int, string>))] | ||||
|         static void OnEditEnd(int id, string value) | ||||
|         { | ||||
|             if (!instances[id].input.ReadOnly) | ||||
|             { | ||||
|                 instances[id].input.text = value; | ||||
|             } | ||||
|         } | ||||
|         [MonoPInvokeCallback(typeof(Action<int, int>))] | ||||
|         static void OnTab(int id, int value) | ||||
|         { | ||||
|             WebGLInputTabFocus.OnTab(instances[id], value); | ||||
|         } | ||||
|  | ||||
|         void Update() | ||||
|         { | ||||
|             if (input == null || !input.isFocused) | ||||
|             { | ||||
|                 CheckOutFocus(); | ||||
|                 return; | ||||
|             } | ||||
|  | ||||
|             // 未登録の場合、選択する | ||||
|             if (!instances.ContainsKey(id)) | ||||
|             { | ||||
|                 if (Application.isMobilePlatform) | ||||
|                 { | ||||
|                     return; | ||||
|                 } else | ||||
|                 { | ||||
|                     OnSelect(); | ||||
|                 } | ||||
|             } | ||||
|             else if (!WebGLInputPlugin.WebGLInputIsFocus(id)) | ||||
|             { | ||||
|                 if (Application.isMobilePlatform) | ||||
|                 { | ||||
|                     //input.DeactivateInputField(); | ||||
|                     return; | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     // focus this id | ||||
|                     WebGLInputPlugin.WebGLInputFocus(id); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             var start = WebGLInputPlugin.WebGLInputSelectionStart(id); | ||||
|             var end = WebGLInputPlugin.WebGLInputSelectionEnd(id); | ||||
|             // 選択方向によって設定します | ||||
|             if (WebGLInputPlugin.WebGLInputSelectionDirection(id) == -1) | ||||
|             { | ||||
|                 input.selectionFocusPosition = start; | ||||
|                 input.selectionAnchorPosition = end; | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 input.selectionFocusPosition = end; | ||||
|                 input.selectionAnchorPosition = start; | ||||
|             } | ||||
|  | ||||
|             input.Rebuild(); | ||||
|         } | ||||
|  | ||||
|         private void OnDestroy() | ||||
|         { | ||||
|             if (!instances.ContainsKey(id)) return; | ||||
|  | ||||
| #if UNITY_WEBGL && !UNITY_EDITOR | ||||
|             UnityEngine.WebGLInput.captureAllKeyboardInput = true; | ||||
|             Input.ResetInputAxes(); // Inputの状態リセット | ||||
| #endif | ||||
|             DeactivateInputField(); | ||||
|         } | ||||
|  | ||||
|         private void OnEnable() | ||||
|         { | ||||
|             WebGLInputTabFocus.Add(this); | ||||
|         } | ||||
|         private void OnDisable() | ||||
|         { | ||||
|             WebGLInputTabFocus.Remove(this); | ||||
|         } | ||||
|         public int CompareTo(WebGLInput other) | ||||
|         { | ||||
|             var a = GetScreenCoordinates(input.RectTransform()); | ||||
|             var b = GetScreenCoordinates(other.input.RectTransform()); | ||||
|             var res = b.y.CompareTo(a.y); | ||||
|             if (res == 0) res = a.x.CompareTo(b.x); | ||||
|             return res; | ||||
|         } | ||||
|  | ||||
|         public void CheckOutFocus() | ||||
|         { | ||||
|             if (!Application.isMobilePlatform) return; | ||||
|             if (!instances.ContainsKey(id)) return; | ||||
|             var current = EventSystem.current.currentSelectedGameObject; | ||||
|             if (current != null) return; | ||||
|             WebGLInputPlugin.WebGLInputForceBlur(id);   // Input ではないし、キーボードを閉じる | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// to manage tab focus | ||||
|         /// base on scene position | ||||
|         /// </summary> | ||||
|         static class WebGLInputTabFocus | ||||
|         { | ||||
|             static List<WebGLInput> inputs = new List<WebGLInput>(); | ||||
|  | ||||
|             public static void Add(WebGLInput input) | ||||
|             { | ||||
|                 inputs.Add(input); | ||||
|                 inputs.Sort(); | ||||
|             } | ||||
|  | ||||
|             public static void Remove(WebGLInput input) | ||||
|             { | ||||
|                 inputs.Remove(input); | ||||
|             } | ||||
|  | ||||
|             public static void OnTab(WebGLInput input, int value) | ||||
|             { | ||||
|                 if (inputs.Count <= 1) return; | ||||
|                 var index = inputs.IndexOf(input); | ||||
|                 index += value; | ||||
|                 if (index < 0) index = inputs.Count - 1; | ||||
|                 else if (index >= inputs.Count) index = 0; | ||||
|                 inputs[index].input.ActivateInputField(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										11
									
								
								Assets/Scripts/WebGLSupport/WebGLInput/WebGLInput.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/WebGLSupport/WebGLInput/WebGLInput.cs.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: cc33a39070010f94fb1c2dd721c1286d | ||||
| MonoImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   defaultReferences: [] | ||||
|   executionOrder: 0 | ||||
|   icon: {instanceID: 0} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
							
								
								
									
										184
									
								
								Assets/Scripts/WebGLSupport/WebGLInput/WebGLInput.jslib
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										184
									
								
								Assets/Scripts/WebGLSupport/WebGLInput/WebGLInput.jslib
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,184 @@ | ||||
| var WebGLInput = { | ||||
|     $instances: [], | ||||
| 	WebGLInputInit : function() { | ||||
| 		// Remove the `Runtime` object from "v1.37.27: 12/24/2017" | ||||
| 		// if Runtime not defined. create and add functon!! | ||||
| 		if(typeof Runtime === "undefined") Runtime = { dynCall : dynCall } | ||||
| 	}, | ||||
|     WebGLInputCreate: function (canvasId, x, y, width, height, fontsize, text, placeholder, isMultiLine, isPassword, isHidden, isMobile) { | ||||
|  | ||||
|         var container = document.getElementById(UTF8ToString(canvasId)); | ||||
|         var canvas = document.getElementsByTagName('canvas')[0]; | ||||
|  | ||||
|         // if container is null and have canvas | ||||
|         if (!container && canvas) | ||||
|         { | ||||
|             // set the container to canvas.parentNode | ||||
|             container = canvas.parentNode; | ||||
|         } | ||||
|  | ||||
| 		if(canvas) | ||||
| 		{ | ||||
| 			var scaleX = container.offsetWidth / canvas.width; | ||||
| 			var scaleY = container.offsetHeight / canvas.height; | ||||
|  | ||||
| 			if(scaleX && scaleY) | ||||
| 			{ | ||||
| 				x *= scaleX; | ||||
| 				width *= scaleX; | ||||
| 				y *= scaleY; | ||||
| 				height *= scaleY; | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
|         var input = document.createElement(isMultiLine?"textarea":"input"); | ||||
|         input.style.position = "absolute"; | ||||
|  | ||||
| 		if(isMobile) { | ||||
| 			input.style.bottom = 1 + "vh"; | ||||
| 			input.style.left = 5 + "vw"; | ||||
| 			input.style.width = 90 + "vw"; | ||||
| 			input.style.height = (isMultiLine? 18 : 10) + "vh"; | ||||
| 			input.style.fontSize = 5 + "vh"; | ||||
| 			input.style.borderWidth = 5 + "px"; | ||||
| 			input.style.borderColor = "#000000"; | ||||
| 		} else { | ||||
| 			input.style.top = y + "px"; | ||||
| 			input.style.left = x + "px"; | ||||
| 			input.style.width = width + "px"; | ||||
| 			input.style.height = height + "px"; | ||||
| 			input.style.fontSize = fontsize + "px"; | ||||
| 		} | ||||
|  | ||||
| 		input.style.outlineWidth = 1 + 'px'; | ||||
| 		input.style.opacity = isHidden?0:1; | ||||
| 		input.style.resize = 'none'; // for textarea | ||||
| 		input.style.padding = '0px 1px'; | ||||
| 		input.style.cursor = "default"; | ||||
| 		input.style.touchAction = 'manipulation'; // for mobile | ||||
|  | ||||
| 		input.spellcheck = false; | ||||
| 		input.value = UTF8ToString(text); | ||||
| 		input.placeholder = UTF8ToString(placeholder); | ||||
| 		 | ||||
| 		if(isPassword){ | ||||
| 			input.type = 'password'; | ||||
| 		} | ||||
|  | ||||
| 		if(isMobile) { | ||||
| 			document.body.appendChild(input); | ||||
| 		} else { | ||||
| 	        container.appendChild(input); | ||||
| 		} | ||||
|         return instances.push(input) - 1; | ||||
|     }, | ||||
| 	WebGLInputEnterSubmit: function(id, falg){ | ||||
| 		var input = instances[id]; | ||||
| 		// for enter key | ||||
| 		input.addEventListener('keydown', function(e) { | ||||
| 			if ((e.which && e.which === 13) || (e.keyCode && e.keyCode === 13)) { | ||||
| 				if(falg) | ||||
| 				{ | ||||
| 					e.preventDefault(); | ||||
| 					input.blur(); | ||||
| 				} | ||||
| 			} | ||||
| 		}); | ||||
|     }, | ||||
| 	WebGLInputTab:function(id, cb) { | ||||
| 		var input = instances[id]; | ||||
| 		// for tab key | ||||
|         input.addEventListener('keydown', function (e) { | ||||
|             if ((e.which && e.which === 9) || (e.keyCode && e.keyCode === 9)) { | ||||
|                 e.preventDefault(); | ||||
|  | ||||
| 				// if enable tab text | ||||
| 				if(input.enableTabText){ | ||||
|                     var val = input.value; | ||||
|                     var start = input.selectionStart; | ||||
|                     var end = input.selectionEnd; | ||||
|                     input.value = val.substr(0, start) + '\t' + val.substr(end, val.length); | ||||
|                     input.setSelectionRange(start + 1, start + 1); | ||||
|                     input.oninput();	// call oninput to exe ValueChange function!! | ||||
| 				} else { | ||||
| 				    Runtime.dynCall("vii", cb, [id, e.shiftKey ? -1 : 1]); | ||||
| 				} | ||||
|             } | ||||
| 		}); | ||||
| 	}, | ||||
| 	WebGLInputFocus: function(id){ | ||||
| 		var input = instances[id]; | ||||
| 		input.focus(); | ||||
|     }, | ||||
|     WebGLInputOnFocus: function (id, cb) { | ||||
|         var input = instances[id]; | ||||
|         input.onfocus = function () { | ||||
|             Runtime.dynCall("vi", cb, [id]); | ||||
|         }; | ||||
|     }, | ||||
|     WebGLInputOnBlur: function (id, cb) { | ||||
|         var input = instances[id]; | ||||
|         input.onblur = function () { | ||||
|             Runtime.dynCall("vi", cb, [id]); | ||||
|         }; | ||||
|     }, | ||||
| 	WebGLInputIsFocus: function (id) { | ||||
| 		return instances[id] === document.activeElement; | ||||
| 	}, | ||||
| 	WebGLInputOnValueChange:function(id, cb){ | ||||
|         var input = instances[id]; | ||||
|         input.oninput = function () { | ||||
| 			var intArray = intArrayFromString(input.value); | ||||
|             var value = (allocate.length <= 2) ? allocate(intArray, ALLOC_NORMAL):allocate(intArray, 'i8', ALLOC_NORMAL); | ||||
|             Runtime.dynCall("vii", cb, [id,value]); | ||||
|         }; | ||||
|     }, | ||||
| 	WebGLInputOnEditEnd:function(id, cb){ | ||||
|         var input = instances[id]; | ||||
|         input.onchange = function () { | ||||
| 			var intArray = intArrayFromString(input.value); | ||||
|             var value = (allocate.length <= 2) ? allocate(intArray, ALLOC_NORMAL):allocate(intArray, 'i8', ALLOC_NORMAL); | ||||
|             Runtime.dynCall("vii", cb, [id,value]); | ||||
|         }; | ||||
|     }, | ||||
| 	WebGLInputSelectionStart:function(id){ | ||||
|         var input = instances[id]; | ||||
| 		return input.selectionStart; | ||||
| 	}, | ||||
| 	WebGLInputSelectionEnd:function(id){ | ||||
|         var input = instances[id]; | ||||
| 		return input.selectionEnd; | ||||
| 	}, | ||||
| 	WebGLInputSelectionDirection:function(id){ | ||||
|         var input = instances[id]; | ||||
| 		return (input.selectionDirection == "backward")?-1:1; | ||||
| 	}, | ||||
| 	WebGLInputSetSelectionRange:function(id, start, end){ | ||||
| 		var input = instances[id]; | ||||
| 		input.setSelectionRange(start, end); | ||||
| 	}, | ||||
| 	WebGLInputMaxLength:function(id, maxlength){ | ||||
|         var input = instances[id]; | ||||
| 		input.maxLength = maxlength; | ||||
| 	}, | ||||
| 	WebGLInputText:function(id, text){ | ||||
|         var input = instances[id]; | ||||
| 		input.value = UTF8ToString(text); | ||||
| 	}, | ||||
| 	WebGLInputDelete:function(id){ | ||||
|         var input = instances[id]; | ||||
|         input.parentNode.removeChild(input); | ||||
|         instances[id] = null; | ||||
|     }, | ||||
| 	WebGLInputEnableTabText:function(id, enable) { | ||||
|         var input = instances[id]; | ||||
| 		input.enableTabText = enable; | ||||
| 	}, | ||||
| 	WebGLInputForceBlur:function(id) { | ||||
|         var input = instances[id]; | ||||
| 		input.blur(); | ||||
| 	}, | ||||
| } | ||||
|  | ||||
| autoAddDeps(WebGLInput, '$instances'); | ||||
| mergeInto(LibraryManager.library, WebGLInput); | ||||
							
								
								
									
										34
									
								
								Assets/Scripts/WebGLSupport/WebGLInput/WebGLInput.jslib.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								Assets/Scripts/WebGLSupport/WebGLInput/WebGLInput.jslib.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,34 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: 7df541bf7b903fb45b24fab892876393 | ||||
| PluginImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   iconMap: {} | ||||
|   executionOrder: {} | ||||
|   isPreloaded: 0 | ||||
|   isOverridable: 0 | ||||
|   platformData: | ||||
|   - first: | ||||
|       Any:  | ||||
|     second: | ||||
|       enabled: 0 | ||||
|       settings: {} | ||||
|   - first: | ||||
|       Editor: Editor | ||||
|     second: | ||||
|       enabled: 0 | ||||
|       settings: | ||||
|         DefaultValueInitialized: true | ||||
|   - first: | ||||
|       Facebook: WebGL | ||||
|     second: | ||||
|       enabled: 1 | ||||
|       settings: {} | ||||
|   - first: | ||||
|       WebGL: WebGL | ||||
|     second: | ||||
|       enabled: 1 | ||||
|       settings: {} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
							
								
								
									
										8
									
								
								Assets/Scripts/WebGLSupport/WebGLInput/Wrapper.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/Scripts/WebGLSupport/WebGLInput/Wrapper.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: dfaa1fbdc36ec0d45b321b02a2089b55 | ||||
| folderAsset: yes | ||||
| DefaultImporter: | ||||
|   externalObjects: {} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
| @@ -0,0 +1,45 @@ | ||||
| using UnityEngine; | ||||
| using UnityEngine.UI; | ||||
|  | ||||
| namespace WebGLSupport | ||||
| { | ||||
|     public enum ContentType | ||||
|     { | ||||
|         Standard = 0, | ||||
|         Autocorrected = 1, | ||||
|         IntegerNumber = 2, | ||||
|         DecimalNumber = 3, | ||||
|         Alphanumeric = 4, | ||||
|         Name = 5, | ||||
|         EmailAddress = 6, | ||||
|         Password = 7, | ||||
|         Pin = 8, | ||||
|         Custom = 9 | ||||
|     } | ||||
|     public enum LineType | ||||
|     { | ||||
|         SingleLine = 0, | ||||
|         MultiLineSubmit = 1, | ||||
|         MultiLineNewline = 2 | ||||
|     } | ||||
|     public interface IInputField | ||||
|     { | ||||
|         ContentType contentType { get; } | ||||
|         LineType lineType { get; } | ||||
|         int fontSize { get; } | ||||
|         string text { get; set; } | ||||
|         string placeholder { get; } | ||||
|         int characterLimit { get; } | ||||
|         int caretPosition { get; } | ||||
|         bool isFocused { get; } | ||||
|         int selectionFocusPosition { get; set; } | ||||
|         int selectionAnchorPosition { get; set; } | ||||
|         bool ReadOnly { get; } | ||||
|         bool OnFocusSelectAll { get; } | ||||
|  | ||||
|         RectTransform RectTransform(); | ||||
|         void ActivateInputField(); | ||||
|         void DeactivateInputField(); | ||||
|         void Rebuild(); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,11 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: 8be52c4f26f76e04fbae3cb86e539bdb | ||||
| MonoImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   defaultReferences: [] | ||||
|   executionOrder: 0 | ||||
|   icon: {instanceID: 0} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
| @@ -0,0 +1,110 @@ | ||||
| using UnityEngine; | ||||
| using UnityEngine.UI; | ||||
| using WebGLSupport.Detail; | ||||
|  | ||||
| namespace WebGLSupport | ||||
| { | ||||
|     /// <summary> | ||||
|     /// Wrapper for UnityEngine.UI.InputField | ||||
|     /// </summary> | ||||
|     class WrappedInputField : IInputField | ||||
|     { | ||||
|         InputField input; | ||||
|         RebuildChecker checker; | ||||
|  | ||||
|         public bool ReadOnly { get { return input.readOnly; } } | ||||
|  | ||||
|         public string text | ||||
|         { | ||||
|             get { return input.text; } | ||||
|             set { input.text = value; } | ||||
|         } | ||||
|  | ||||
|         public string placeholder | ||||
|         { | ||||
|             get | ||||
|             { | ||||
|                 if (!input.placeholder) return ""; | ||||
|                 var text = input.placeholder.GetComponent<Text>(); | ||||
|                 return text ? text.text : ""; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         public int fontSize | ||||
|         { | ||||
|             get { return input.textComponent.fontSize; } | ||||
|         } | ||||
|  | ||||
|         public ContentType contentType | ||||
|         { | ||||
|             get { return (ContentType)input.contentType; } | ||||
|         } | ||||
|  | ||||
|         public LineType lineType | ||||
|         { | ||||
|             get { return (LineType)input.lineType; } | ||||
|         } | ||||
|  | ||||
|         public int characterLimit | ||||
|         { | ||||
|             get { return input.characterLimit; } | ||||
|         } | ||||
|  | ||||
|         public int caretPosition | ||||
|         { | ||||
|             get { return input.caretPosition; } | ||||
|         } | ||||
|  | ||||
|         public bool isFocused | ||||
|         { | ||||
|             get { return input.isFocused; } | ||||
|         } | ||||
|  | ||||
|         public int selectionFocusPosition | ||||
|         { | ||||
|             get { return input.selectionFocusPosition; } | ||||
|             set { input.selectionFocusPosition = value; } | ||||
|         } | ||||
|  | ||||
|         public int selectionAnchorPosition | ||||
|         { | ||||
|             get { return input.selectionAnchorPosition; } | ||||
|             set { input.selectionAnchorPosition = value; } | ||||
|         } | ||||
|  | ||||
|         public bool OnFocusSelectAll | ||||
|         { | ||||
|             get { return true; } | ||||
|         } | ||||
|  | ||||
|         public WrappedInputField(InputField input) | ||||
|         { | ||||
|             this.input = input; | ||||
|             checker = new RebuildChecker(this); | ||||
|         } | ||||
|  | ||||
|         public RectTransform RectTransform() | ||||
|         { | ||||
|             return input.GetComponent<RectTransform>(); | ||||
|         } | ||||
|  | ||||
|         public void ActivateInputField() | ||||
|         { | ||||
|             input.ActivateInputField(); | ||||
|         } | ||||
|  | ||||
|         public void DeactivateInputField() | ||||
|         { | ||||
|             input.DeactivateInputField(); | ||||
|         } | ||||
|  | ||||
|         public void Rebuild() | ||||
|         { | ||||
|             if (checker.NeedRebuild()) | ||||
|             { | ||||
|                 input.textComponent.SetAllDirty(); | ||||
|                 input.Rebuild(CanvasUpdate.LatePreRender); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,11 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: 0c8464791034e144ca224c37c1816e37 | ||||
| MonoImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   defaultReferences: [] | ||||
|   executionOrder: 0 | ||||
|   icon: {instanceID: 0} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
| @@ -0,0 +1,167 @@ | ||||
| #if UNITY_2018_2_OR_NEWER | ||||
| #define TMP_WEBGL_SUPPORT | ||||
| #endif | ||||
|  | ||||
| #if TMP_WEBGL_SUPPORT | ||||
| using UnityEngine; | ||||
| using TMPro; | ||||
| using WebGLSupport.Detail; | ||||
| using UnityEngine.UI; | ||||
|  | ||||
| namespace WebGLSupport | ||||
| { | ||||
|     /// <summary> | ||||
|     /// Wrapper for TMPro.TMP_InputField | ||||
|     /// </summary> | ||||
|     class WrappedTMPInputField : IInputField | ||||
|     { | ||||
|         TMP_InputField input; | ||||
|         RebuildChecker checker; | ||||
|         Coroutine delayedGraphicRebuild; | ||||
|  | ||||
|         public bool ReadOnly { get { return input.readOnly; } } | ||||
|  | ||||
|         public string text | ||||
|         { | ||||
|             get { return input.text; } | ||||
|             set { input.text = value; } | ||||
|         } | ||||
|         public string placeholder | ||||
|         { | ||||
|             get | ||||
|             { | ||||
|                 if (!input.placeholder) return ""; | ||||
|                 var text = input.placeholder.GetComponent<TMP_Text>(); | ||||
|                 return text ? text.text : ""; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         public int fontSize | ||||
|         { | ||||
|             get { return (int)input.textComponent.fontSize; } | ||||
|         } | ||||
|  | ||||
|         public ContentType contentType | ||||
|         { | ||||
|             get { return (ContentType)input.contentType; } | ||||
|         } | ||||
|  | ||||
|         public LineType lineType | ||||
|         { | ||||
|             get { return (LineType)input.lineType; } | ||||
|         } | ||||
|  | ||||
|         public int characterLimit | ||||
|         { | ||||
|             get { return input.characterLimit; } | ||||
|         } | ||||
|  | ||||
|         public int caretPosition | ||||
|         { | ||||
|             get { return input.caretPosition; } | ||||
|         } | ||||
|  | ||||
|         public bool isFocused | ||||
|         { | ||||
|             get { return input.isFocused; } | ||||
|         } | ||||
|  | ||||
|         public int selectionFocusPosition | ||||
|         { | ||||
|             get { return input.selectionStringFocusPosition; } | ||||
|             set { input.selectionStringFocusPosition = value; } | ||||
|         } | ||||
|  | ||||
|         public int selectionAnchorPosition | ||||
|         { | ||||
|             get { return input.selectionStringAnchorPosition; } | ||||
|             set { input.selectionStringAnchorPosition = value; } | ||||
|         } | ||||
|  | ||||
|         public bool OnFocusSelectAll | ||||
|         { | ||||
|             get { return input.onFocusSelectAll; } | ||||
|         } | ||||
|  | ||||
|         public WrappedTMPInputField(TMP_InputField input) | ||||
|         { | ||||
|             this.input = input; | ||||
|             checker = new RebuildChecker(this); | ||||
|         } | ||||
|  | ||||
|         public RectTransform RectTransform() | ||||
|         { | ||||
|             // 表示範囲 | ||||
|             // MEMO : | ||||
|             //  TMP では textComponent を移動させてクリッピングするため、 | ||||
|             //  表示範囲外になる場合があるので、自分の範囲を返す | ||||
|             return input.GetComponent<RectTransform>(); | ||||
|         } | ||||
|  | ||||
|         public void ActivateInputField() | ||||
|         { | ||||
|             input.ActivateInputField(); | ||||
|         } | ||||
|  | ||||
|         public void DeactivateInputField() | ||||
|         { | ||||
|             input.DeactivateInputField(); | ||||
|         } | ||||
|  | ||||
|         public void Rebuild() | ||||
|         { | ||||
| #if UNITY_2020_1_OR_NEWER | ||||
|             if (checker.NeedRebuild()) | ||||
|             { | ||||
|                 input.textComponent.SetVerticesDirty(); | ||||
|                 input.textComponent.SetLayoutDirty(); | ||||
|                 input.Rebuild(CanvasUpdate.LatePreRender); | ||||
|             } | ||||
| #else | ||||
|             if (input.textComponent.enabled && checker.NeedRebuild()) | ||||
|             { | ||||
|                 //================================ | ||||
|                 // fix bug for tmp | ||||
|                 // TMPの不具合で、正しく座標を設定されてなかったため、試しに対応する | ||||
|                 var rt = input.textComponent.GetComponent<RectTransform>(); | ||||
|                 var size = input.textComponent.GetPreferredValues(); | ||||
|                 if (size.x < rt.rect.xMax) | ||||
|                 { | ||||
|                     // textComponent の座標を更新 | ||||
|                     var pos = rt.anchoredPosition; | ||||
|                     pos.x = 0; | ||||
|                     rt.anchoredPosition = pos; | ||||
|  | ||||
|                     // caret の座標更新 | ||||
|                     var caret = input.GetComponentInChildren<TMP_SelectionCaret>(); | ||||
|                     var caretRect = caret.GetComponent<RectTransform>(); | ||||
|                     caretRect.anchoredPosition = rt.anchoredPosition; | ||||
|                 } | ||||
|                 //============================== | ||||
|  | ||||
|                 // HACK : 1フレーム無効にする | ||||
|                 // MEMO : 他にいい方法Rebuildがあれば対応する | ||||
|                 // LayoutRebuilder.ForceRebuildLayoutImmediate(); で試してダメでした | ||||
|                 input.textComponent.enabled = rectOverlaps(input.textComponent.rectTransform, input.textViewport); | ||||
|                 input.textComponent.SetAllDirty(); | ||||
|                 input.Rebuild(CanvasUpdate.LatePreRender); | ||||
|                 //Debug.Log(input.textComponent.enabled); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 input.textComponent.enabled = true; | ||||
|             } | ||||
| #endif | ||||
|         } | ||||
|  | ||||
|         bool rectOverlaps(RectTransform rectTrans1, RectTransform rectTrans2) | ||||
|         { | ||||
|             Rect rect1 = new Rect(rectTrans1.localPosition.x, rectTrans1.localPosition.y, rectTrans1.rect.width, rectTrans1.rect.height); | ||||
|             Rect rect2 = new Rect(rectTrans2.localPosition.x, rectTrans2.localPosition.y, rectTrans2.rect.width, rectTrans2.rect.height); | ||||
|  | ||||
|             return rect1.Overlaps(rect2); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| #endif // TMP_WEBGL_SUPPORT | ||||
| @@ -0,0 +1,11 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: e1629c3a135d89a45aca880fa8052f5d | ||||
| MonoImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   defaultReferences: [] | ||||
|   executionOrder: 0 | ||||
|   icon: {instanceID: 0} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
							
								
								
									
										8
									
								
								Assets/Scripts/WebGLSupport/WebGLWindow.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Assets/Scripts/WebGLSupport/WebGLWindow.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: ef582d6b11c3602438e4a301923e45dc | ||||
| folderAsset: yes | ||||
| DefaultImporter: | ||||
|   externalObjects: {} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
							
								
								
									
										74
									
								
								Assets/Scripts/WebGLSupport/WebGLWindow/WebGLWindow.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								Assets/Scripts/WebGLSupport/WebGLWindow/WebGLWindow.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,74 @@ | ||||
| using System; | ||||
| using AOT; | ||||
| using System.Runtime.InteropServices; // for DllImport | ||||
| using UnityEngine; | ||||
|  | ||||
| namespace WebGLSupport | ||||
| { | ||||
|     static class WebGLWindowPlugin | ||||
|     { | ||||
| #if UNITY_WEBGL && !UNITY_EDITOR | ||||
|         [DllImport("__Internal")] | ||||
|         public static extern void WebGLWindowOnFocus(Action cb); | ||||
|  | ||||
|         [DllImport("__Internal")] | ||||
|         public static extern void WebGLWindowOnBlur(Action cb); | ||||
|  | ||||
|         [DllImport("__Internal")] | ||||
|         public static extern void WebGLWindowOnResize(Action cb); | ||||
|  | ||||
|         [DllImport("__Internal")] | ||||
|         public static extern void WebGLWindowInjectFullscreen(); | ||||
| #else | ||||
|         public static void WebGLWindowOnFocus(Action cb) { } | ||||
|         public static void WebGLWindowOnBlur(Action cb) { } | ||||
|         public static void WebGLWindowOnResize(Action cb) { } | ||||
|         public static void WebGLWindowInjectFullscreen() { } | ||||
| #endif | ||||
|  | ||||
|     } | ||||
|  | ||||
|     public static class WebGLWindow | ||||
|     { | ||||
|         public static bool Focus { get; private set; } | ||||
|         public static event Action OnFocusEvent = () => { }; | ||||
|         public static event Action OnBlurEvent = () => { }; | ||||
|         public static event Action OnResizeEvent = () => { }; | ||||
|  | ||||
|         static string ViewportContent; | ||||
|         static void Init() | ||||
|         { | ||||
|             Focus = true; | ||||
|             WebGLWindowPlugin.WebGLWindowOnFocus(OnWindowFocus); | ||||
|             WebGLWindowPlugin.WebGLWindowOnBlur(OnWindowBlur); | ||||
|             WebGLWindowPlugin.WebGLWindowOnResize(OnWindowResize); | ||||
|             WebGLWindowPlugin.WebGLWindowInjectFullscreen(); | ||||
|         } | ||||
|  | ||||
|         [MonoPInvokeCallback(typeof(Action))] | ||||
|         static void OnWindowFocus() | ||||
|         { | ||||
|             Focus = true; | ||||
|             OnFocusEvent(); | ||||
|         } | ||||
|  | ||||
|         [MonoPInvokeCallback(typeof(Action))] | ||||
|         static void OnWindowBlur() | ||||
|         { | ||||
|             Focus = false; | ||||
|             OnBlurEvent(); | ||||
|         } | ||||
|  | ||||
|         [MonoPInvokeCallback(typeof(Action))] | ||||
|         static void OnWindowResize() | ||||
|         { | ||||
|             OnResizeEvent(); | ||||
|         } | ||||
|  | ||||
|         [RuntimeInitializeOnLoadMethod] | ||||
|         static void RuntimeInitializeOnLoadMethod() | ||||
|         { | ||||
|             Init(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										11
									
								
								Assets/Scripts/WebGLSupport/WebGLWindow/WebGLWindow.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/WebGLSupport/WebGLWindow/WebGLWindow.cs.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: 5fcbb4f34ed8e894896251ff74a4633d | ||||
| MonoImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   defaultReferences: [] | ||||
|   executionOrder: 0 | ||||
|   icon: {instanceID: 0} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
							
								
								
									
										92
									
								
								Assets/Scripts/WebGLSupport/WebGLWindow/WebGLWindow.jslib
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										92
									
								
								Assets/Scripts/WebGLSupport/WebGLWindow/WebGLWindow.jslib
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,92 @@ | ||||
| var WebGLWindow = { | ||||
|     WebGLWindowOnFocus: function (cb) { | ||||
|         window.addEventListener('focus', function () { | ||||
|             Runtime.dynCall("v", cb, []); | ||||
|         }); | ||||
|     }, | ||||
|     WebGLWindowOnBlur: function (cb) { | ||||
|         window.addEventListener('blur', function () { | ||||
|             Runtime.dynCall("v", cb, []); | ||||
|         }); | ||||
|     }, | ||||
| 	WebGLWindowOnResize: function(cb) { | ||||
|         window.addEventListener('resize', function () { | ||||
|             Runtime.dynCall("v", cb, []); | ||||
|         }); | ||||
| 	}, | ||||
| 	WebGLWindowInjectFullscreen : function () { | ||||
|         document.makeFullscreen = function (id, keepAspectRatio) { | ||||
|             // get fullscreen object | ||||
|             var getFullScreenObject = function () { | ||||
|                 var doc = window.document; | ||||
|                 var objFullScreen = doc.fullscreenElement || doc.mozFullScreenElement || doc.webkitFullscreenElement || doc.msFullscreenElement; | ||||
|                 return (objFullScreen); | ||||
|             } | ||||
|  | ||||
|             // handle fullscreen event | ||||
|             var eventFullScreen = function (callback) { | ||||
|                 document.addEventListener("fullscreenchange", callback, false); | ||||
|                 document.addEventListener("webkitfullscreenchange", callback, false); | ||||
|                 document.addEventListener("mozfullscreenchange", callback, false); | ||||
|                 document.addEventListener("MSFullscreenChange", callback, false); | ||||
|             } | ||||
|  | ||||
|             var removeEventFullScreen = function (callback) { | ||||
|                 document.removeEventListener("fullscreenchange", callback, false); | ||||
|                 document.removeEventListener("webkitfullscreenchange", callback, false); | ||||
|                 document.removeEventListener("mozfullscreenchange", callback, false); | ||||
|                 document.removeEventListener("MSFullscreenChange", callback, false); | ||||
|             } | ||||
|  | ||||
|             var div = document.createElement("div"); | ||||
|             document.body.appendChild(div); | ||||
|  | ||||
|             var canvas = document.getElementById(id); | ||||
|             var beforeParent = canvas.parentNode; | ||||
|             var beforeStyle = window.getComputedStyle(canvas); | ||||
|             var beforeWidth = parseInt(beforeStyle.width); | ||||
|             var beforeHeight = parseInt(beforeStyle.height); | ||||
|  | ||||
|             // to keep element index after fullscreen | ||||
|             var index = Array.from(beforeParent.children).findIndex(function (v) { return v == canvas; }); | ||||
|             div.appendChild(canvas); | ||||
|  | ||||
|             // recv fullscreen function | ||||
|             var fullscreenFunc = function () { | ||||
|                 if (getFullScreenObject()) { | ||||
|                     if (keepAspectRatio) { | ||||
|                         var ratio = Math.min(window.screen.width / beforeWidth, window.screen.height / beforeHeight); | ||||
|                         var width = Math.floor(beforeWidth * ratio); | ||||
|                         var height = Math.floor(beforeHeight * ratio); | ||||
|  | ||||
|                         canvas.style.width = width + 'px'; | ||||
|                         canvas.style.height = height + 'px';; | ||||
|                     } else { | ||||
|                         canvas.style.width = window.screen.width + 'px';; | ||||
|                         canvas.style.height = window.screen.height + 'px';; | ||||
|                     } | ||||
|  | ||||
|                 } else { | ||||
| 					canvas.style.width = beforeWidth + 'px';; | ||||
|                     canvas.style.height = beforeHeight + 'px';; | ||||
|                     beforeParent.insertBefore(canvas, Array.from(beforeParent.children)[index]); | ||||
|  | ||||
|                     div.parentNode.removeChild(div); | ||||
|  | ||||
|                     // remove this function | ||||
|                     removeEventFullScreen(fullscreenFunc); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             // listener fullscreen event | ||||
|             eventFullScreen(fullscreenFunc); | ||||
|  | ||||
|             if (div.mozRequestFullScreen) div.mozRequestFullScreen(); | ||||
|             else if (div.webkitRequestFullScreen) div.webkitRequestFullScreen(); | ||||
|             else if (div.msRequestFullscreen) div.msRequestFullscreen(); | ||||
|             else if (div.requestFullscreen) div.requestFullscreen(); | ||||
| 		} | ||||
| 	}, | ||||
| } | ||||
|  | ||||
| mergeInto(LibraryManager.library, WebGLWindow); | ||||
| @@ -0,0 +1,34 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: 5edef37b75c044e41a013a62fec2e1ff | ||||
| PluginImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   iconMap: {} | ||||
|   executionOrder: {} | ||||
|   isPreloaded: 0 | ||||
|   isOverridable: 0 | ||||
|   platformData: | ||||
|   - first: | ||||
|       Any:  | ||||
|     second: | ||||
|       enabled: 0 | ||||
|       settings: {} | ||||
|   - first: | ||||
|       Editor: Editor | ||||
|     second: | ||||
|       enabled: 0 | ||||
|       settings: | ||||
|         DefaultValueInitialized: true | ||||
|   - first: | ||||
|       Facebook: WebGL | ||||
|     second: | ||||
|       enabled: 1 | ||||
|       settings: {} | ||||
|   - first: | ||||
|       WebGL: WebGL | ||||
|     second: | ||||
|       enabled: 1 | ||||
|       settings: {} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
| @@ -36,6 +36,7 @@ Shader "FateShader3Compatible" { | ||||
| 			}; | ||||
| 				 | ||||
| 			sampler2D _MainTex; | ||||
| 			float4 _MainTex_ST; | ||||
| 			sampler2D _Alpha; | ||||
| 			fixed4 _Color; | ||||
| 			fixed4 _AddColor; | ||||
| @@ -47,7 +48,7 @@ Shader "FateShader3Compatible" { | ||||
| 				v2f o; | ||||
| 				o.vertex = UnityObjectToClipPos(v.vertex); | ||||
| 				o.color = v.color; | ||||
| 				o.uv = v.uv; | ||||
| 				o.uv = TRANSFORM_TEX(v.uv, _MainTex); | ||||
| 				return o; | ||||
| 			} | ||||
|  | ||||
| @@ -62,57 +63,7 @@ Shader "FateShader3Compatible" { | ||||
| 			} | ||||
| 			ENDCG | ||||
| 		} | ||||
| 		//Pass  //Line 428 Cutoff Transparency (0.5) | ||||
| 		//{ | ||||
| 		//	Tags { "IGNOREPROJECTOR" = "true" "RenderType" = "TransparentCutout" } | ||||
| 		//	Cull Off | ||||
| 		//	ColorMask 0 | ||||
| 		//	CGPROGRAM | ||||
| 		//	#pragma vertex vert | ||||
| 		//	#pragma fragment frag | ||||
| 		//	#include "UnityCG.cginc" | ||||
| 		 | ||||
| 		//	struct appdata | ||||
| 		//	{ | ||||
| 		//		float4 vertex : POSITION0; | ||||
| 		//		float2 uv : TEXCOORD0; | ||||
| 		//		float4 color : COLOR0; | ||||
| 		//	}; | ||||
|  | ||||
| 		//	struct v2f | ||||
| 		//	{ | ||||
| 		//		float2 uv : TEXCOORD0; | ||||
| 		//		float4 vertex : POSITION0; | ||||
| 		//		float4 color : COLOR0; | ||||
| 		//	}; | ||||
| 				 | ||||
| 		//	sampler2D _MainTex; | ||||
| 		//	sampler2D _Alpha; | ||||
| 		//	fixed4 _Color; | ||||
| 		//	fixed4 _AddColor; | ||||
| 		//	float _Cutoff; | ||||
| 		//	float4 u_xlat0; | ||||
| 		//	float4 u_xlat1; | ||||
|  | ||||
| 		//	v2f vert(appdata v) | ||||
| 		//	{ | ||||
| 		//		v2f o; | ||||
| 		//		o.color = fixed4(0,0,0,1); | ||||
| 		//		o.uv = v.uv; | ||||
| 		//		u_xlat0 = mul(unity_ObjectToWorld, v.vertex.xyz); | ||||
| 		//		o.vertex = UnityObjectToClipPos(u_xlat0); | ||||
| 		//		return o; | ||||
| 		//	} | ||||
| 			 | ||||
| 		//	fixed4 frag(v2f i) : SV_Target | ||||
| 		//	{ | ||||
| 		//		fixed4 col = tex2D(_MainTex, i.uv); | ||||
| 		//		col = _Color * col + _AddColor; | ||||
| 		//		clip(col.a - _Cutoff); | ||||
| 		//		return col; | ||||
| 		//	} | ||||
| 		//	ENDCG | ||||
| 		//} | ||||
| 		Pass //ADD COLORS | ||||
| 		{ | ||||
| 			Cull Off // make double sided | ||||
| @@ -137,6 +88,7 @@ Shader "FateShader3Compatible" { | ||||
| 			}; | ||||
|  | ||||
| 			sampler2D _MainTex; | ||||
| 			float4 _MainTex_ST; | ||||
| 			sampler2D _Alpha; | ||||
| 			fixed4 _ColorTint; | ||||
| 			float _Cutoff; | ||||
| @@ -146,7 +98,7 @@ Shader "FateShader3Compatible" { | ||||
| 			{ | ||||
| 				v2f o; | ||||
| 				o.vertex = UnityObjectToClipPos(v.vertex); | ||||
| 				o.uv = v.uv; // just pass through with no scale/offset | ||||
| 				o.uv = TRANSFORM_TEX(v.uv, _MainTex); | ||||
| 				return o; | ||||
| 			} | ||||
|  | ||||
|   | ||||
| @@ -3,7 +3,7 @@ guid: 606c8ef44552e594c8ba1b9ae8a7e46e | ||||
| TextureImporter: | ||||
|   internalIDToNameTable: [] | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 11 | ||||
|   serializedVersion: 12 | ||||
|   mipmaps: | ||||
|     mipMapMode: 0 | ||||
|     enableMipMap: 0 | ||||
| @@ -62,6 +62,7 @@ TextureImporter: | ||||
|   textureFormatSet: 0 | ||||
|   ignorePngGamma: 0 | ||||
|   applyGammaDecoding: 0 | ||||
|   cookieLightType: 1 | ||||
|   platformSettings: | ||||
|   - serializedVersion: 3 | ||||
|     buildTarget: DefaultTexturePlatform | ||||
| @@ -99,6 +100,18 @@ TextureImporter: | ||||
|     overridden: 0 | ||||
|     androidETC2FallbackOverride: 0 | ||||
|     forceMaximumCompressionQuality_BC6H_BC7: 0 | ||||
|   - serializedVersion: 3 | ||||
|     buildTarget: Android | ||||
|     maxTextureSize: 256 | ||||
|     resizeAlgorithm: 0 | ||||
|     textureFormat: -1 | ||||
|     textureCompression: 1 | ||||
|     compressionQuality: 50 | ||||
|     crunchedCompression: 0 | ||||
|     allowsAlphaSplitting: 0 | ||||
|     overridden: 0 | ||||
|     androidETC2FallbackOverride: 0 | ||||
|     forceMaximumCompressionQuality_BC6H_BC7: 0 | ||||
|   spriteSheet: | ||||
|     serializedVersion: 2 | ||||
|     sprites: [] | ||||
|   | ||||
| @@ -1,10 +1,10 @@ | ||||
| { | ||||
|   "dependencies": { | ||||
|     "com.unity.collab-proxy": "1.17.0", | ||||
|     "com.unity.ide.rider": "2.0.7", | ||||
|     "com.unity.ide.visualstudio": "2.0.16", | ||||
|     "com.unity.collab-proxy": "2.0.4", | ||||
|     "com.unity.ide.rider": "3.0.21", | ||||
|     "com.unity.ide.visualstudio": "2.0.18", | ||||
|     "com.unity.ide.vscode": "1.2.5", | ||||
|     "com.unity.test-framework": "1.1.31", | ||||
|     "com.unity.test-framework": "1.1.33", | ||||
|     "com.unity.textmeshpro": "3.0.6", | ||||
|     "com.unity.timeline": "1.4.8", | ||||
|     "com.unity.ugui": "1.0.0", | ||||
|   | ||||
| @@ -1,12 +1,10 @@ | ||||
| { | ||||
|   "dependencies": { | ||||
|     "com.unity.collab-proxy": { | ||||
|       "version": "1.17.0", | ||||
|       "version": "2.0.4", | ||||
|       "depth": 0, | ||||
|       "source": "registry", | ||||
|       "dependencies": { | ||||
|         "com.unity.services.core": "1.0.1" | ||||
|       }, | ||||
|       "dependencies": {}, | ||||
|       "url": "https://packages.unity.com" | ||||
|     }, | ||||
|     "com.unity.ext.nunit": { | ||||
| @@ -17,16 +15,16 @@ | ||||
|       "url": "https://packages.unity.com" | ||||
|     }, | ||||
|     "com.unity.ide.rider": { | ||||
|       "version": "2.0.7", | ||||
|       "version": "3.0.21", | ||||
|       "depth": 0, | ||||
|       "source": "registry", | ||||
|       "dependencies": { | ||||
|         "com.unity.test-framework": "1.1.1" | ||||
|         "com.unity.ext.nunit": "1.0.6" | ||||
|       }, | ||||
|       "url": "https://packages.unity.com" | ||||
|     }, | ||||
|     "com.unity.ide.visualstudio": { | ||||
|       "version": "2.0.16", | ||||
|       "version": "2.0.18", | ||||
|       "depth": 0, | ||||
|       "source": "registry", | ||||
|       "dependencies": { | ||||
| @@ -41,17 +39,8 @@ | ||||
|       "dependencies": {}, | ||||
|       "url": "https://packages.unity.com" | ||||
|     }, | ||||
|     "com.unity.services.core": { | ||||
|       "version": "1.0.1", | ||||
|       "depth": 1, | ||||
|       "source": "registry", | ||||
|       "dependencies": { | ||||
|         "com.unity.modules.unitywebrequest": "1.0.0" | ||||
|       }, | ||||
|       "url": "https://packages.unity.com" | ||||
|     }, | ||||
|     "com.unity.test-framework": { | ||||
|       "version": "1.1.31", | ||||
|       "version": "1.1.33", | ||||
|       "depth": 0, | ||||
|       "source": "registry", | ||||
|       "dependencies": { | ||||
|   | ||||
| @@ -3,7 +3,7 @@ | ||||
| --- !u!129 &1 | ||||
| PlayerSettings: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   serializedVersion: 22 | ||||
|   serializedVersion: 23 | ||||
|   productGUID: 6b0381207982d8f4d9fbf1024de2a6af | ||||
|   AndroidProfiler: 0 | ||||
|   AndroidFilterTouchesWhenObscured: 0 | ||||
| @@ -134,7 +134,7 @@ PlayerSettings: | ||||
|     16:10: 1 | ||||
|     16:9: 1 | ||||
|     Others: 1 | ||||
|   bundleVersion: 2.4.2 | ||||
|   bundleVersion: 2.4.4 | ||||
|   preloadedAssets: [] | ||||
|   metroInputSource: 0 | ||||
|   wsaTransparentSwapchain: 0 | ||||
| @@ -155,7 +155,7 @@ PlayerSettings: | ||||
|   androidMaxAspectRatio: 2.1 | ||||
|   applicationIdentifier: | ||||
|     Android: com.DefaultCompany.FateAnimationViewer | ||||
|     Standalone: com.Katboi01.FateAnimationViewer | ||||
|     Standalone: com.Katworks.Fate-Animation-Viewer | ||||
|   buildNumber: | ||||
|     Standalone: 0 | ||||
|     iPhone: 0 | ||||
| @@ -532,6 +532,7 @@ PlayerSettings: | ||||
|   switchNetworkInterfaceManagerInitializeEnabled: 1 | ||||
|   switchPlayerConnectionEnabled: 1 | ||||
|   switchUseNewStyleFilepaths: 0 | ||||
|   switchUseLegacyFmodPriorities: 1 | ||||
|   switchUseMicroSleepForYield: 1 | ||||
|   switchEnableRamDiskSupport: 0 | ||||
|   switchMicroSleepForYieldTime: 25 | ||||
| @@ -724,6 +725,7 @@ PlayerSettings: | ||||
|     m_VersionName:  | ||||
|   apiCompatibilityLevel: 6 | ||||
|   activeInputHandler: 0 | ||||
|   windowsGamepadBackendHint: 0 | ||||
|   cloudProjectId:  | ||||
|   framebufferDepthMemorylessMode: 0 | ||||
|   qualitySettingsNames: [] | ||||
|   | ||||
| @@ -1,2 +1,2 @@ | ||||
| m_EditorVersion: 2020.3.37f1 | ||||
| m_EditorVersionWithRevision: 2020.3.37f1 (8c66806a0c04) | ||||
| m_EditorVersion: 2020.3.48f1 | ||||
| m_EditorVersionWithRevision: 2020.3.48f1 (b805b124c6b7) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user