コード例 #1
0
        private void OpenURL()
        {
            this.uniWebView = (UniWebView)this.Target.GetComponent <UniWebView>();
            if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.uniWebView, (UnityEngine.Object)null))
            {
                this.uniWebView = (UniWebView)this.Target.AddComponent <UniWebView>();
            }
            this.uniWebView.OnLoadComplete            += new UniWebView.LoadCompleteDelegate(this.OnLoadComplete);
            this.uniWebView.OnReceivedMessage         += new UniWebView.ReceivedMessageDelegate(this.OnReceivedMessage);
            this.uniWebView.InsetsForScreenOreitation += new UniWebView.InsetsForScreenOreitationDelegate(this.InsetsForScreenOreitation);
            this.uniWebView.insets = new UniWebViewEdgeInsets(0, 0, 0, 0);
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            GsccBridge.SetWebViewHeaders(new Action <string, string>(dictionary.Add));
            using (Dictionary <string, string> .Enumerator enumerator = dictionary.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    KeyValuePair <string, string> current = enumerator.Current;
                    this.uniWebView.SetHeaderField(current.Key, current.Value);
                }
            }
            this.uniWebView.SetShowSpinnerWhenLoading(true);
            this.uniWebView.url = MonoSingleton <GameManager> .Instance.FgGAuthHost;
            this.uniWebView.Load();
        }
コード例 #2
0
        private void Start()
        {
            if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.Target, (UnityEngine.Object)null))
            {
                return;
            }
            string text = FlowNode_Variable.Get("SHARED_WEBWINDOW_TITLE");

            if (!string.IsNullOrEmpty(text))
            {
                this.Target.SetTitleText(text);
            }
            string url = FlowNode_Variable.Get("SHARED_WEBWINDOW_URL");

            if (!string.IsNullOrEmpty(url))
            {
                if (this.usegAuth)
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    GsccBridge.SetWebViewHeaders(new Action <string, string>(dictionary.Add));
                    using (Dictionary <string, string> .Enumerator enumerator = dictionary.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            KeyValuePair <string, string> current = enumerator.Current;
                            this.Target.SetHeaderField(current.Key, current.Value);
                        }
                    }
                }
                this.Target.OpenURL(url);
                FlowNode_Variable.Set("SHARED_WEBWINDOW_URL", string.Empty);
            }
            else
            {
                this.Caution.SetActive(true);
            }
        }
コード例 #3
0
        private void Create()
        {
            GameObject gameObject = AssetManager.Load <GameObject>("UI/WebView");

            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)gameObject, (UnityEngine.Object)null))
            {
                this.webView = (WebView)((GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)gameObject)).GetComponent <WebView>();
                if (this.useVariable)
                {
                    string str1 = FlowNode_Variable.Get(this.URL);
                    if (!string.IsNullOrEmpty(str1))
                    {
                        this.URL = str1;
                    }
                    string str2 = FlowNode_Variable.Get(this.Title);
                    if (!string.IsNullOrEmpty(str2))
                    {
                        this.Title = str2;
                    }
                }
                this.webView.OnClose = new UIUtility.DialogResultEvent(this.OnClose);
                this.webView.Text_Title.set_text(LocalizedText.Get(this.Title));
                if (this.usegAuth)
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    GsccBridge.SetWebViewHeaders(new Action <string, string>(dictionary.Add));
                    using (Dictionary <string, string> .Enumerator enumerator = dictionary.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            KeyValuePair <string, string> current = enumerator.Current;
                            this.webView.SetHeaderField(current.Key, current.Value);
                        }
                    }
                }
                if (this.URL.StartsWith("http://") || this.URL.StartsWith("https://"))
                {
                    this.webView.OpenURL(this.URL);
                }
                else if (this.URLMode == FlowNode_WebView.URL_Mode.APIHost)
                {
                    this.webView.OpenURL(Network.Host + this.URL);
                }
                else if (this.URLMode == FlowNode_WebView.URL_Mode.SiteHost)
                {
                    this.webView.OpenURL(Network.SiteHost + this.URL);
                }
                else
                {
                    if (this.URLMode != FlowNode_WebView.URL_Mode.NewsHost)
                    {
                        return;
                    }
                    this.webView.OpenURL(Network.NewsHost + this.URL);
                }
            }
            else
            {
                Debug.Log((object)"Prefab not Found");
            }
        }