private void OnActivityQQShare(Dictionary <string, object> dict)
    {
        IUiUtility @interface = XSingleton <XInterfaceMgr> .singleton.GetInterface <IUiUtility>(XSingleton <XCommon> .singleton.XHash("IUiUtility"));

        if (@interface != null && [email protected]())
        {
            XSingleton <XDebug> .singleton.AddGreenLog("Pandora qqshare not installed", null, null, null, null, null);

            return;
        }
        object sceneObj;

        if (!dict.TryGetValue("scene", out sceneObj))
        {
            return;
        }
        object titleObj;

        dict.TryGetValue("title", out titleObj);
        object summaryObj;

        dict.TryGetValue("summary", out summaryObj);
        object targetUrlObj;

        dict.TryGetValue("targetUrl", out targetUrlObj);
        object obj;

        dict.TryGetValue("imageUrl", out obj);
        if (obj != null)
        {
            base.StartCoroutine(this.DownloadPic(obj.ToString(), delegate(string filepath)
            {
                if (!string.IsNullOrEmpty(filepath))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    dictionary["scene"]     = ((sceneObj != null) ? sceneObj.ToString() : string.Empty);
                    dictionary["title"]     = ((titleObj != null) ? titleObj.ToString() : string.Empty);
                    dictionary["summary"]   = ((summaryObj != null) ? summaryObj.ToString() : string.Empty);
                    dictionary["targetUrl"] = ((targetUrlObj != null) ? targetUrlObj.ToString() : string.Empty);
                    dictionary["imageUrl"]  = filepath;
                    string text             = MiniJSON.Json.Serialize(dictionary);
                    XSingleton <XDebug> .singleton.AddGreenLog("Pandora pandoraShareQQ json = " + text, null, null, null, null, null);
                    XPlatform component = this.gameObject.GetComponent <XPlatform>();
                    if (component != null)
                    {
                        this.isSharing = true;
                        component.SendGameExData("share_send_to_struct_qq", text);
                    }
                }
            }));
        }
    }
    private void DoSahre()
    {
        XPlatform component = BroadcastManager.m_gameobject.GetComponent <XPlatform>();
        Dictionary <string, string> dictionary = new Dictionary <string, string>();

        dictionary["scene"]       = "Session";
        dictionary["targetUrl"]   = BroadcastManager.m_shareContent.targetUrl;
        dictionary["imageUrl"]    = BroadcastManager.m_shareContent.imageUrl;
        dictionary["title"]       = BroadcastManager.m_shareContent.title;
        dictionary["description"] = BroadcastManager.m_shareContent.description;
        dictionary["summary"]     = string.Empty;
        string json = Json.Serialize(dictionary);

        component.SendGameExData("share_send_to_struct_qq", json);
    }
    private void OnActivityWeChatShare(Dictionary <string, object> dict)
    {
        IUiUtility @interface = XSingleton <XInterfaceMgr> .singleton.GetInterface <IUiUtility>(XSingleton <XCommon> .singleton.XHash("IUiUtility"));

        if (@interface != null && [email protected]())
        {
            XSingleton <XDebug> .singleton.AddGreenLog("Pandora wx not installed", null, null, null, null, null);

            return;
        }
        object sceneObj;

        if (!dict.TryGetValue("scene", out sceneObj))
        {
            return;
        }
        object titleObj;

        dict.TryGetValue("title", out titleObj);
        object descObj;

        dict.TryGetValue("desc", out descObj);
        object urlObj;

        dict.TryGetValue("url", out urlObj);
        object mediaTagNameObj;

        dict.TryGetValue("mediaTagName", out mediaTagNameObj);
        object obj;

        dict.TryGetValue("filePath", out obj);
        object messageExtObj;

        dict.TryGetValue("messageExt", out messageExtObj);
        if (obj != null)
        {
            base.StartCoroutine(this.DownloadPic(obj.ToString(), delegate(string filepath)
            {
                if (!string.IsNullOrEmpty(filepath))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    dictionary["scene"]        = ((sceneObj != null) ? sceneObj.ToString() : string.Empty);
                    dictionary["title"]        = ((titleObj != null) ? titleObj.ToString() : string.Empty);
                    dictionary["desc"]         = ((descObj != null) ? descObj.ToString() : string.Empty);
                    dictionary["url"]          = ((urlObj != null) ? urlObj.ToString() : string.Empty);
                    dictionary["mediaTagName"] = ((mediaTagNameObj != null) ? mediaTagNameObj.ToString() : string.Empty);
                    dictionary["filePath"]     = filepath;
                    dictionary["messageExt"]   = ((messageExtObj != null) ? messageExtObj.ToString() : string.Empty);
                    string text = MiniJSON.Json.Serialize(dictionary);
                    XSingleton <XDebug> .singleton.AddGreenLog("Pandora pandoraShareWX json = " + text, null, null, null, null, null);
                    XPlatform component = this.gameObject.GetComponent <XPlatform>();
                    if (component != null)
                    {
                        XSingleton <XDebug> .singleton.AddGreenLog("Pandora share_send_to_with_url_wx json = " + text, null, null, null, null, null);
                        this.isSharing = true;
                        component.SendGameExData("share_send_to_with_url_wx", text);
                    }
                }
            }));
        }
    }
Exemple #4
0
 private void OnReceivedMessage(UniWebView webView, UniWebViewMessage message)
 {
     UnityEngine.Debug.Log("OnReceivedMessage");
     UnityEngine.Debug.Log(message.rawMessage);
     if (string.Equals(message.path, "webview"))
     {
         Vector3 zero = Vector3.zero;
         if (message.args.ContainsKey("funcname"))
         {
             if (string.Equals(message.args["funcname"], "dnqueryuserinfo"))
             {
                 if (message.args.ContainsKey("callback"))
                 {
                     UnityEngine.Debug.Log("Will callback");
                     string arg = message.args["callback"];
                     Dictionary <string, object> dictionary = new Dictionary <string, object>();
                     dictionary["appid"]        = this.mAppId;
                     dictionary["openid"]       = this.mOpenid;
                     dictionary["access_token"] = this.mToken;
                     dictionary["partition"]    = this.mServerid;
                     dictionary["roleid"]       = this.mRoleid;
                     dictionary["entertime"]    = this.mOpenTime;
                     dictionary["nickname"]     = this.mNickName;
                     string arg2 = Json.Serialize(dictionary);
                     string text = string.Format("{0}({1})", arg, arg2);
                     UnityEngine.Debug.Log(text);
                     webView.EvaluatingJavaScript(text);
                 }
             }
             else if (string.Equals(message.args["funcname"], "dnclosewebview"))
             {
                 this.CloseWebView(webView);
             }
             else if (string.Equals(message.args["funcname"], "dniswifi"))
             {
                 if (message.args.ContainsKey("callback"))
                 {
                     UnityEngine.Debug.Log("Will dniswifi callback");
                     string arg3  = message.args["callback"];
                     bool   flag  = Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork;
                     int    num   = (!flag) ? 0 : 1;
                     string text2 = string.Format("{0}({1})", arg3, num);
                     UnityEngine.Debug.Log(text2);
                     webView.EvaluatingJavaScript(text2);
                 }
             }
             else if (string.Equals(message.args["funcname"], "dnisbgopen"))
             {
                 if (message.args.ContainsKey("callback"))
                 {
                     UnityEngine.Debug.Log("Will dnisbgopen callback");
                     string arg4  = message.args["callback"];
                     int    num2  = (!this._is_bgopen) ? 0 : 1;
                     string text3 = string.Format("{0}({1})", arg4, num2);
                     UnityEngine.Debug.Log(text3);
                     webView.EvaluatingJavaScript(text3);
                 }
             }
             else if (string.Equals(message.args["funcname"], "dnopenbg"))
             {
                 this._is_bgopen = true;
                 UniWeb.m_uiUtility.OnSetBg(true);
             }
             else if (string.Equals(message.args["funcname"], "dnclosebg"))
             {
                 this._is_bgopen = false;
                 UniWeb.m_uiUtility.OnSetBg(false);
             }
             else if (string.Equals(message.args["funcname"], "dnchangemenu"))
             {
                 if (message.args.ContainsKey("menutype"))
                 {
                     int menutype = int.Parse(message.args["menutype"]);
                     UniWeb.m_uiUtility.OnSetWebViewMenu(menutype);
                 }
             }
             else if (string.Equals(message.args["funcname"], "dnbackgame"))
             {
                 if (message.args.ContainsKey("backtype"))
                 {
                     int menutype2 = int.Parse(message.args["backtype"]);
                     UniWeb.m_uiUtility.OnSetWebViewMenu(menutype2);
                 }
                 if (message.args.ContainsKey("callback"))
                 {
                     UnityEngine.Debug.Log("Will dnbackgame callback");
                     string arg5  = message.args["callback"];
                     string text4 = string.Format("{0}()", arg5);
                     UnityEngine.Debug.Log(text4);
                     webView.EvaluatingJavaScript(text4);
                 }
             }
             else if (string.Equals(message.args["funcname"], "dnrefreshredpoint"))
             {
                 if (message.args.ContainsKey("args"))
                 {
                     string text5 = WWW.UnEscapeURL(message.args["args"]);
                     UnityEngine.Debug.Log("dnrefreshredpoint" + text5);
                     UniWeb.m_uiUtility.OnWebViewRefershRefPoint(text5);
                 }
             }
             else if (string.Equals(message.args["funcname"], "dnsetheaderinfo"))
             {
                 if (message.args.ContainsKey("args"))
                 {
                     string text6 = WWW.UnEscapeURL(message.args["args"]);
                     UnityEngine.Debug.Log("dnsetheaderinfo" + text6);
                     UniWeb.m_uiUtility.OnWebViewSetheaderInfo(text6);
                 }
             }
             else if (string.Equals(message.args["funcname"], "dnshownav"))
             {
                 if (message.args.ContainsKey("type"))
                 {
                     int num3 = int.Parse(message.args["type"]);
                     if (num3 == 1)
                     {
                         this._gap = this.GetGap();
                     }
                     else
                     {
                         this._gap = 0;
                     }
                     this._webView.ForceResize();
                 }
             }
             else if (string.Equals(message.args["funcname"], "dncloseloading"))
             {
                 if (message.args.ContainsKey("show"))
                 {
                     int num4 = int.Parse(message.args["show"]);
                     UnityEngine.Debug.Log("dncloseloading: " + message.args["show"]);
                     UniWeb.m_uiUtility.OnWebViewCloseLoading(num4);
                     if (num4 == 1)
                     {
                         this._webView.Hide();
                     }
                     else
                     {
                         this._webView.Show();
                     }
                 }
             }
             else if (string.Equals(message.args["funcname"], "dnshowreconnect"))
             {
                 if (message.args.ContainsKey("show"))
                 {
                     int num5 = int.Parse(message.args["show"]);
                     UnityEngine.Debug.Log("dnshowreconnect: " + message.args["show"]);
                     UniWeb.m_uiUtility.OnWebViewShowReconnect(num5);
                     if (num5 == 1)
                     {
                         this._webView.Hide();
                     }
                     else
                     {
                         this._webView.Show();
                     }
                 }
             }
             else if (string.Equals(message.args["funcname"], "dnsetlivetab"))
             {
                 UniWeb.m_uiUtility.OnWebViewLiveTab();
             }
             else if (string.Equals(message.args["funcname"], "dnbackhistory"))
             {
                 this._webView.GoBack();
             }
             else if (string.Equals(message.args["funcname"], "dnsetshareinfo"))
             {
                 string json = WWW.UnEscapeURL(message.args["args"]);
                 Dictionary <string, object> dictionary2 = Json.Deserialize(json) as Dictionary <string, object>;
                 XPlatform platf = base.gameObject.GetComponent <XPlatform>();
                 object    title;
                 dictionary2.TryGetValue("title", out title);
                 object obj;
                 dictionary2.TryGetValue("imgurl", out obj);
                 object desc;
                 dictionary2.TryGetValue("desc", out desc);
                 object url;
                 dictionary2.TryGetValue("url", out url);
                 object type;
                 dictionary2.TryGetValue("type", out type);
                 if (type.Equals("qq") || type.Equals("qzone"))
                 {
                     Dictionary <string, string> dictionary3 = new Dictionary <string, string>();
                     dictionary3["scene"] = ((!type.Equals("qq")) ? "QZone" : "Session");
                     if (url != null)
                     {
                         dictionary3["targetUrl"] = "https:" + url.ToString();
                     }
                     if (obj != null)
                     {
                         dictionary3["imageUrl"] = obj.ToString();
                     }
                     if (title != null)
                     {
                         dictionary3["title"] = title.ToString();
                     }
                     if (desc != null)
                     {
                         dictionary3["description"] = desc.ToString();
                     }
                     dictionary3["summary"] = string.Empty;
                     string json2 = Json.Serialize(dictionary3);
                     platf.SendGameExData("share_send_to_struct_qq", json2);
                 }
                 else if (type.Equals("weixin") || type.Equals("timeline"))
                 {
                     if (!base.gameObject.activeSelf)
                     {
                         return;
                     }
                     base.StartCoroutine(this.DownloadPic(obj.ToString(), delegate(string filepath)
                     {
                         if (!string.IsNullOrEmpty(filepath))
                         {
                             Dictionary <string, string> dictionary4 = new Dictionary <string, string>();
                             dictionary4["scene"] = ((!type.Equals("weixin")) ? "Timeline" : "Session");
                             if (title != null)
                             {
                                 dictionary4["title"] = title.ToString();
                             }
                             if (desc != null)
                             {
                                 dictionary4["desc"] = desc.ToString();
                             }
                             if (url != null)
                             {
                                 dictionary4["url"] = url.ToString();
                             }
                             dictionary4["mediaTagName"] = "MSG_INVITE";
                             dictionary4["filePath"]     = filepath;
                             dictionary4["messageExt"]   = "ShareUrlWithWeixin";
                             string json3 = Json.Serialize(dictionary4);
                             platf.SendGameExData("share_send_to_with_url_wx", json3);
                         }
                     }));
                 }
                 else
                 {
                     UnityEngine.Debug.LogError("err type: " + type);
                 }
             }
         }
     }
 }