1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- using System;
- using System.Collections;
- using UnityEngine;
- namespace ICODES.STUDIO.WWebView
- {
- public sealed class WWebViewSystem : MonoBehaviour
- {
- public void Initialize()
- {
- this.InitializeWinPlayer();
- }
- private void InitializeWinPlayer()
- {
- WWebViewWin32.ModifyStyle(WWebViewWin32.FindUnityPlayerWindow(), 0L, 33554432L, 0U);
- WWebViewWin32.SubclassWindow();
- base.StartCoroutine("DispatchMessage");
- }
- private IEnumerator DispatchMessage()
- {
- for (;;)
- {
- yield return new WaitForFixedUpdate();
- WWebViewWin32.DispatchMessage();
- }
- yield break;
- }
- public bool HoloLensVR
- {
- get
- {
- return false;
- }
- }
- private void OnDestroy()
- {
- WWebViewSystem.instance = null;
- }
- private void OnApplicationQuit()
- {
- WWebViewPlugin.Release();
- }
- public static string EscapeJsonText(string data)
- {
- return data.Replace("\\", "\\\\").Replace("\"", "\\\"").Replace("/", "\\/");
- }
- public static WWebViewSystem Instance
- {
- get
- {
- if (WWebViewSystem.instance == null)
- {
- WWebViewSystem.instance = (UnityEngine.Object.FindObjectOfType(typeof(WWebViewSystem)) as WWebViewSystem);
- if (WWebViewSystem.instance == null)
- {
- GameObject gameObject = new GameObject("WWebViewSystem");
- UnityEngine.Object.DontDestroyOnLoad(gameObject);
- WWebViewSystem.instance = gameObject.AddComponent<WWebViewSystem>();
- }
- }
- return WWebViewSystem.instance;
- }
- }
- private static WWebViewSystem instance;
- }
- }
|