diff --git a/Assets/Resources/Prefabs/UI/FrameITUI.prefab b/Assets/Resources/Prefabs/UI/FrameITUI.prefab index e570ddf7a13f5d0c5b183dc73e6280dbb6c15faa..9130e4e6374bc17fd304713b899dd27603fd17dc 100644 --- a/Assets/Resources/Prefabs/UI/FrameITUI.prefab +++ b/Assets/Resources/Prefabs/UI/FrameITUI.prefab @@ -406,12 +406,12 @@ PrefabInstance: - target: {fileID: 8553388048532215990, guid: 884ac57de337c364391b247761071fb1, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 8553388048532215990, guid: 884ac57de337c364391b247761071fb1, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 8553388048532215990, guid: 884ac57de337c364391b247761071fb1, type: 3} @@ -556,7 +556,7 @@ PrefabInstance: - target: {fileID: 6500467619489830996, guid: 292834880e6f0e54186b873acc62d3f2, type: 3} propertyPath: m_AnchoredPosition.y - value: 1080 + value: 3240 objectReference: {fileID: 0} - target: {fileID: 7849991042685492731, guid: 292834880e6f0e54186b873acc62d3f2, type: 3} @@ -606,7 +606,7 @@ PrefabInstance: - target: {fileID: 7989559431199338490, guid: 292834880e6f0e54186b873acc62d3f2, type: 3} propertyPath: m_AnchoredPosition.y - value: -59.999527 + value: -179.99953 objectReference: {fileID: 0} - target: {fileID: 8004702056544321748, guid: 292834880e6f0e54186b873acc62d3f2, type: 3} diff --git a/Assets/Resources/Prefabs/UI/Ingame/FrameITUI_mobile.prefab b/Assets/Resources/Prefabs/UI/Ingame/FrameITUI_mobile.prefab index 31d6d0d00310add6747878f091b56d3ab22e558d..2e886ae5333e176f29e917921215e5ec1cba871e 100644 --- a/Assets/Resources/Prefabs/UI/Ingame/FrameITUI_mobile.prefab +++ b/Assets/Resources/Prefabs/UI/Ingame/FrameITUI_mobile.prefab @@ -4952,7 +4952,7 @@ PrefabInstance: - target: {fileID: 7989559431199338490, guid: 292834880e6f0e54186b873acc62d3f2, type: 3} propertyPath: m_AnchoredPosition.y - value: -0.000045776367 + value: -100.000046 objectReference: {fileID: 0} - target: {fileID: 8004702056544321748, guid: 292834880e6f0e54186b873acc62d3f2, type: 3} @@ -5319,12 +5319,12 @@ PrefabInstance: - target: {fileID: 8553388048532215990, guid: 884ac57de337c364391b247761071fb1, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 8553388048532215990, guid: 884ac57de337c364391b247761071fb1, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 8553388048532215990, guid: 884ac57de337c364391b247761071fb1, type: 3} @@ -5339,7 +5339,7 @@ PrefabInstance: - target: {fileID: 8553388048532215990, guid: 884ac57de337c364391b247761071fb1, type: 3} propertyPath: m_AnchoredPosition.x - value: 650 + value: 30 objectReference: {fileID: 0} - target: {fileID: 8553388048532215990, guid: 884ac57de337c364391b247761071fb1, type: 3} diff --git a/Assets/Resources/Prefabs/UI/Ingame/HidingCanvas.prefab b/Assets/Resources/Prefabs/UI/Ingame/HidingCanvas.prefab index c6dd0370ab27d0b96ea4c9f7f7e8aacaf4e5a5f3..b64e98e9015c597c3951f1d8fb2df6887751ecae 100644 --- a/Assets/Resources/Prefabs/UI/Ingame/HidingCanvas.prefab +++ b/Assets/Resources/Prefabs/UI/Ingame/HidingCanvas.prefab @@ -35,7 +35,7 @@ RectTransform: 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: 14040} + m_AnchoredPosition: {x: 0, y: 0.0009765625} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 1, y: 1} --- !u!114 &6592514254180342026 @@ -109,10 +109,10 @@ RectTransform: m_Father: {fileID: 3853195430673864773} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 568.4, y: -208.64} + m_SizeDelta: {x: 1136.8, y: 217.28} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &8314331323416511131 CanvasRenderer: @@ -248,10 +248,10 @@ RectTransform: m_Father: {fileID: 3716020922907832516} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 578.4, y: -208.64} + m_SizeDelta: {x: 1156.8, y: 417.28} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &911570484790407906 CanvasRenderer: @@ -531,7 +531,7 @@ RectTransform: m_AnchorMin: {x: 0.5, y: 0} m_AnchorMax: {x: 0.5, y: 0} m_AnchoredPosition: {x: -0.008544922, y: 0.0002421254} - m_SizeDelta: {x: 1156.8, y: 0} + m_SizeDelta: {x: 1156.8, y: 417.28} m_Pivot: {x: 0.5, y: 0} --- !u!114 &6505282139119622248 MonoBehaviour: @@ -991,9 +991,9 @@ RectTransform: m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: -20} m_Pivot: {x: 0, y: 1} --- !u!222 &8004702056544321750 CanvasRenderer: @@ -1242,7 +1242,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 1} m_AnchorMax: {x: 0.5, y: 1} - m_AnchoredPosition: {x: 7478.3154, y: 0.000030517578} + m_AnchoredPosition: {x: 0, y: 0.000030517578} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 1} --- !u!114 &8004702056565720367 @@ -1454,7 +1454,7 @@ RectTransform: m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 20, y: 20} m_Pivot: {x: 0.5, y: 0.5} @@ -1617,8 +1617,8 @@ MonoBehaviour: m_TargetGraphic: {fileID: 8004702056618112985} m_HandleRect: {fileID: 8004702056618112982} m_Direction: 0 - m_Value: 1 - m_Size: 0.4705884 + m_Value: 0 + m_Size: 1 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: @@ -1924,7 +1924,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 8004702057932254677} - m_RootOrder: 7 + m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -2160,7 +2160,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &8004702057540368335 RectTransform: m_ObjectHideFlags: 0 @@ -2175,7 +2175,7 @@ RectTransform: m_Children: - {fileID: 8004702057798297439} m_Father: {fileID: 8004702057932254677} - m_RootOrder: 5 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -2852,6 +2852,7 @@ RectTransform: - {fileID: 8004702056565337459} - {fileID: 8004702057423300230} - {fileID: 8004702058016740899} + - {fileID: 154516623474793748} - {fileID: 8004702057540368335} - {fileID: 2050004651490542596} - {fileID: 8004702056853212489} @@ -2906,7 +2907,7 @@ MonoBehaviour: m_FallbackScreenDPI: 96 m_DefaultSpriteDPI: 96 m_DynamicPixelsPerUnit: 1 - m_PresetInfoIsWorld: 1 + m_PresetInfoIsWorld: 0 --- !u!114 &8004702057932254676 MonoBehaviour: m_ObjectHideFlags: 0 @@ -3398,6 +3399,168 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1001 &3129137578625191326 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 8004702057932254677} + m_Modifications: + - target: {fileID: 2459857651630437765, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + propertyPath: targetUrl + value: http://127.0.0.1:5500/scrollView.html + objectReference: {fileID: 0} + - target: {fileID: 2459857651630437765, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + propertyPath: headlessBrowser + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2974656142881083530, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + propertyPath: m_Pivot.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2974656142881083530, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + propertyPath: m_Pivot.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2974656142881083530, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + propertyPath: m_RootOrder + value: 5 + objectReference: {fileID: 0} + - target: {fileID: 2974656142881083530, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2974656142881083530, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2974656142881083530, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2974656142881083530, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2974656142881083530, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + propertyPath: m_SizeDelta.x + value: 600 + objectReference: {fileID: 0} + - target: {fileID: 2974656142881083530, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + propertyPath: m_SizeDelta.y + value: 600 + objectReference: {fileID: 0} + - target: {fileID: 2974656142881083530, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2974656142881083530, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2974656142881083530, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2974656142881083530, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2974656142881083530, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2974656142881083530, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2974656142881083530, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2974656142881083530, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2974656142881083530, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2974656142881083530, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2974656142881083530, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2974656142881083530, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8825460134736404412, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + propertyPath: m_Name + value: WebViewComponent + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 1e9d514b702f5784791a4df8d22e1866, type: 3} +--- !u!224 &154516623474793748 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 2974656142881083530, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + m_PrefabInstance: {fileID: 3129137578625191326} + m_PrefabAsset: {fileID: 0} +--- !u!1 &5843063412347785762 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 8825460134736404412, guid: 1e9d514b702f5784791a4df8d22e1866, + type: 3} + m_PrefabInstance: {fileID: 3129137578625191326} + m_PrefabAsset: {fileID: 0} +--- !u!114 &5494409561197319113 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5843063412347785762} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 534d25977ad35154781c29672ce2bb13, type: 3} + m_Name: + m_EditorClassIdentifier: + onFactAssignment: + m_PersistentCalls: + m_Calls: [] + onHintRequested: + m_PersistentCalls: + m_Calls: [] + onClick: + m_PersistentCalls: + m_Calls: [] --- !u!1001 &3298748675541104415 PrefabInstance: m_ObjectHideFlags: 0 @@ -3438,7 +3601,7 @@ PrefabInstance: - target: {fileID: 3581652732795482907, guid: 49deb83b881477047bfac0ee629a7ae9, type: 3} propertyPath: m_RootOrder - value: 6 + value: 7 objectReference: {fileID: 0} - target: {fileID: 3581652732795482907, guid: 49deb83b881477047bfac0ee629a7ae9, type: 3} @@ -3538,7 +3701,7 @@ PrefabInstance: - target: {fileID: 4838871000058222821, guid: 49deb83b881477047bfac0ee629a7ae9, type: 3} propertyPath: m_AnchoredPosition.y - value: -780 + value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 49deb83b881477047bfac0ee629a7ae9, type: 3} diff --git a/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactObjectUI.cs b/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactObjectUI.cs index 7a0449d0a3cb18953becd9dbff8b867262a9b32d..e90f6cc60b78d374a3a30f15d0c3fafee9fc2516 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactObjectUI.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/FactWrapper/FactObjectUI.cs @@ -1,7 +1,8 @@ +using bessw.Unity.WebView; using System.Linq; using UnityEngine.UI; -public class FactObjectUI : FactObject +public class FactObjectUI : FactObject, BrowserDropable { public Image[] Images; diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/Fact.cs b/Assets/Scripts/InteractionEngine/FactHandling/Facts/Fact.cs index f22e9f9752f5f8b5a919e688a1042efc2b3111f7..a0d84971568b3b45b097a3f8a107f8d7f9cf51bf 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Facts/Fact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/Fact.cs @@ -229,6 +229,7 @@ public string GetLabel(FactRecorder name_space) ? _CustomLabel : generateLabel(name_space)); } + [JsonProperty("Label")] protected internal string _LastLabel = "NaN"; public bool SetLabel(string value, FactRecorder name_space) diff --git a/Assets/Scripts/UI/InGame/WebViewController.cs b/Assets/Scripts/UI/InGame/WebViewController.cs new file mode 100644 index 0000000000000000000000000000000000000000..e006956323ed0e1a04e56b4efd35c9bf78926234 --- /dev/null +++ b/Assets/Scripts/UI/InGame/WebViewController.cs @@ -0,0 +1,138 @@ +using bessw.Unity.WebView; +using bessw.Unity.WebView.ChromeDevTools; +using bessw.Unity.WebView.ChromeDevTools.Protocol.DOM; +using MoreLinq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using UnityEngine.Events; + +public class WebViewController : MonoBehaviour +{ + + + // TODO: onFactAssignment event shoud hav a dropzone id and a fact id as parameters + public UnityEvent<DomNodeWrapper, string> onFactAssignment; + // TODO: implement onHintRequested event + public UnityEvent<DomNodeWrapper, string> onHintRequested; + // TODO: click events (option for custom buttons for a scroll) + public UnityEvent<DomNodeWrapper, string> onClick; + private WebViewComponent webViewComponent; + private DomNodeWrapper[] dropzones; + + private void Awake() + { + webViewComponent = GetComponent<WebViewComponent>(); + WebViewComponent.serializerSettings.Converters.Add(new FactObjectUIConverter()); + + // TODO: handle webViewComponent.onDomDocumentUpdated + + // TODO: remove this debug code + onFactAssignment.AddListener((DomNodeWrapper node, string factId) => { + Debug.LogWarning($"onFactAssignment: '{string.Join(", ", GetFactAssignments())}'"); + }); + } + + /// <summary> + /// sets or updates the content of the scroll container dom element + /// </summary> + /// <param name="scrollHTML"></param> + public async void SetScrollContent(string scrollHTML) + { + // update scroll container content + DomNodeWrapper scrollContainer = await DomNodeWrapper.requestNodeAsync(webViewComponent.tab, "scrollContainer"); + await scrollContainer.setNodeValueAsync(scrollHTML); + + // get the dropzones from the scroll and add the event handler to track when something is dropped + dropzones = await scrollContainer.querySelectorAllAsync("[dropzone='copy']"); + dropzones.ForEach(dropzone => dropzone.OnAttributeModified += DropzoneAttributeModifiedHandler); + } + + private void DropzoneAttributeModifiedHandler(attributeModifiedEvent attributeModifiedEvent) + { + Debug.LogWarning($"dropzoneAtrributeModifiedHandler: '{attributeModifiedEvent.name}'"); + + // call the onFactAssignment event if the data-fact-id attribute was modified + if (attributeModifiedEvent.name == "data-fact-id") + { + var node = webViewComponent.tab.domNodes.GetValueOrDefault(attributeModifiedEvent.nodeId); + onFactAssignment.Invoke(node, attributeModifiedEvent.value); + } + } + + public string[] GetFactAssignments() + { + return dropzones.Select(dropzone => dropzone.Node.attributes.GetValueOrDefault("data-fact-id", null)).ToArray(); + } + + private async void GetDropzoneStateAsync() + { + // alternative way to get the dropzone state + DomNodeWrapper document = await DomNodeWrapper.getDocumentAsync(webViewComponent.tab); + Debug.LogWarning($"dropzone 1: '{document}'"); + var dropzones = await document.querySelectorAllAsync("[dropzone='copy']"); + + Debug.LogWarning($"dropzone 2: '{dropzones.Index().Aggregate("", (currentString, dropzone) => $"{currentString}, {dropzone.Key}: {dropzone.Value.Node.attributes.GetValueOrDefault("data-fact-id")}")}'"); + + string[] factIDs = new string[dropzones.Length]; + + // get attributes for each dropzone + //for (int i = 0; i < dropzones.Length; i++) + //{ + // factIDs[i] = ( await dropzones[i].getAttributesAsync() ).GetValueOrDefault("data-fact-id", null); + //} + //Debug.LogWarning($"dropzone 3: '{string.Join(", ", factIDs)}'"); + } + + + /// <summary> + /// First try to get the dropzone state using coroutines. + /// Doesn't work because coroutines can't access method local temporary variables. + /// </summary> + /// <returns></returns> + [Obsolete("Use getDropzoneStateAsync instead")] + private IEnumerator GetDropzoneState() + { + Debug.LogWarning($"dropzone pre"); + + DomNodeWrapper doc = null; + yield return DomNodeWrapper.getDocument(webViewComponent.tab, (document) => { + Debug.LogWarning($"dropzone 1: '{document}'"); + doc = document; + + StartCoroutine(document.querySelectorAll("[dropzone='copy']", (dropzones) => { + foreach (var dropzone in dropzones) + { + Debug.LogWarning($"dropzone 2: Node is Null?: '{dropzone.Node == null}'"); + StartCoroutine(dropzone.getAttributes((attributes) => + { + Debug.LogWarning($"dropzone 3 getAttributes: '{string.Join(", ", attributes.Values)}'"); + })); + } + })); + }); + Debug.LogWarning($"dropzone post: '{doc}'"); + } +} + +public class FactObjectUIConverter : JsonConverter<FactObjectUI> +{ + public override void WriteJson(JsonWriter writer, FactObjectUI value, JsonSerializer serializer) + { + //serializer.Serialize(writer, value.Fact); + JObject o = JObject.FromObject(value.Fact, WebViewComponent.serializer); + o.AddFirst(new JProperty("id", value.Fact.Id)); + + o.WriteTo(writer); + } + public override FactObjectUI ReadJson(JsonReader reader, Type objectType, FactObjectUI existingValue, bool hasExistingValue, JsonSerializer serializer) + { + var factObject = new FactObjectUI(); + factObject.Fact = serializer.Deserialize<Fact>(reader); + return factObject; + } +} diff --git a/Assets/Scripts/UI/InGame/WebViewController.cs.meta b/Assets/Scripts/UI/InGame/WebViewController.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..89c76d258b39805e0515ab474f6103502c953732 --- /dev/null +++ b/Assets/Scripts/UI/InGame/WebViewController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 534d25977ad35154781c29672ce2bb13 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/manifest.json b/Packages/manifest.json index 2ea77ed2175bbce93eb2779feb3d7832e15c5ada..1232e6b5bf7a820e2334d47973270183f4470403 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -1,5 +1,6 @@ { "dependencies": { + "bessw.unity.webview": "file:D:/b-ess/SW/src/UNI/BrowserView", "com.github-glitchenzo.nugetforunity": "https://github.com/GlitchEnzo/NuGetForUnity.git?path=/src/NuGetForUnity", "com.unity.2d.sprite": "1.0.0", "com.unity.2d.tilemap": "1.0.0", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 46042a32bf9677b1bb0405eadd44bf65e83997ad..cb181e02ad240982bbd8ded63dc64c4584387dc6 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -1,5 +1,11 @@ { "dependencies": { + "bessw.unity.webview": { + "version": "file:D:/b-ess/SW/src/UNI/BrowserView", + "depth": 0, + "source": "local", + "dependencies": {} + }, "com.github-glitchenzo.nugetforunity": { "version": "https://github.com/GlitchEnzo/NuGetForUnity.git?path=/src/NuGetForUnity", "depth": 0,