Exemplo n.º 1
0
    public void OnCancel()
    {
        KDTLWebView.removeWebView();
#if  UNITY_ANDROID
        WebMediator.HideWebView();
#endif
    }
    public static void purchaseItem(string strID, string strName, string strPrice, int nNum)
    {
        string strGameID          = GAMEID;
        string strGameName        = GAMENAME;
        string strGroupID         = "0";
        string strGroupName       = SplashController.serverName;
        string strItemRealPrice   = strPrice;
        string strItemmarketPrice = strPrice;
        string strUID             = "";
        {
            strUID = AccountManager.Instance.GetCurEmail();
        }

        string strPurchaseInfo = string.Format("{0}:{1}:{2}:{3}:{4}:{5}:{6}:{7}:{8}:{9}",
                                               strGameID,
                                               strGameName,
                                               strGroupID,
                                               strGroupName,
                                               strID,
                                               strName,
                                               nNum.ToString(),
                                               strItemRealPrice,
                                               strItemmarketPrice,
                                               strUID);

        WebMediator.OpenCyouPayWindow(strPurchaseInfo);
        //using (AndroidJavaClass cls_UnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
        //{

        //    using (AndroidJavaObject obj_Activity = cls_UnityPlayer.GetStatic<AndroidJavaObject>("currentActivity"))
        //    {
        //        obj_Activity.Call("openPayWindow", strPurchaseInfo);
        //    }
        //}
    }
Exemplo n.º 3
0
    public void OpenRauderWeb()
    {
#if UNITY_IPHONE
        //InitPosition(iPhoneSettings.generation);
        InitPositionByScale();
        WebMediator.LoadUrl(url);
        WebMediator.SetMargin(left, top, right, bottom);
        WebMediator.Show();
#elif  UNITY_ANDROID
        if (isActivityWebview)
        {
            InitPosition();
            WebMediator.LoadUrl(url);
            WebMediator.SetMargin(left, top, right, bottom);
            WebMediator.Show();
        }
        else
        {
            WebMediator.ShowWebView(url);
        }
#endif
#if UNITY_IPHONE
        DefaultPanel.SetActive(false);
        NoticePanel.SetActive(false);
        RaiderPanel.SetActive(true);
#elif UNITY_ANDROID
        DefaultPanel.SetActive(false);
        NoticePanel.SetActive(false);
        RaiderPanel.SetActive(false);
#endif
        //Debug.Log("Enter OpenWeb!");
        //Debug.Log("In OpenWeb : url="+url);
        //Debug.Log("In OpenWeb : top="+top+" ; bottom="+bottom+" ; left="+left+" ; right="+right);
    }
Exemplo n.º 4
0
 void Update()
 {
     if (Input.GetKeyUp(KeyCode.Escape))
     {
         WebMediator.ShowExitPanel();
     }
 }
    //------------save end------------
    //------------Get Mac Address start------------
    public static string getMacAddress()
    {
#if UNITY_EDITOR
        return("00000000");
#elif UNITY_ANDROID
        string macAddress = WebMediator.GetMacAddress();
        return(macAddress);       //
#else
        string             macAddress = "00000000";
        NetworkInterface[] nics       = NetworkInterface.GetAllNetworkInterfaces();
        if (nics == null)
        {
            return("00000000");
        }
        foreach (NetworkInterface adapter in nics)
        {
            PhysicalAddress address = adapter.GetPhysicalAddress();
            if (address.ToString() != "")
            {
                macAddress = address.ToString();
                return(macAddress);
            }
        }
        return(macAddress);
#endif
    }
    public static string GetNetworkState()
    {
#if UNITY_ANDROID
        return(WebMediator.GetNetworkType());
#else
        int state = Application.platform == RuntimePlatform.IPhonePlayer ? _getNetworkState() : 3;

        if (state <= 0)
        {
            return("disconnect");
        }
        else if (state == 1)
        {
            return("wwlan");
        }
        else if (state == 2)
        {
            return("wifi");
        }
        else
        {
            return("unknown");
        }
#endif
    }
 private void AndroidVarifyResult(bool bSuccess)
 {
     if (bSuccess == true)
     {
         /*
          * 0:  验证成功,且billingserver订单状态改为已加钱,客户端不需处理。 客户端删除订单
          * 1:  订单存在但未加钱,客户端删除订单
          * -1: 订单验证失败,订单删除。
          * -2: 平台错误下单暂时不成功,稍后重试。客户端删除订单
          * -3:  重复订单,订单已加钱。 客户端删除订单
          * -4:  参数不完整。客户端需要重新发起,并检查参数是否正确。订单重发                                                                                订单重发
          */
         Debug.Log("pllog_VarifyResult PayVarifyResult=" + PayVarifyResult + " PayVarifyResultOrderID=" + PayVarifyResultOrderID);
         if (PayVarifyResult == -4 || PayVarifyResult == -2)
         {
             //订单重发,什么处理都不用做,系统会每分钟轮训
             //订单发送次数-4,每个订单最多发送20次。
             Debug.Log("pllog_VarifyResult MinusOncePayLog");
             WebMediator.MinusOncePayLog(PayVarifyResultOrderID);
         }
         else if (PayVarifyResult == 0 ||
                  PayVarifyResult == 1 ||
                  PayVarifyResult == -1 ||
                  PayVarifyResult == -3
                  )
         {
             //删除订单
             WebMediator.RemovePayLog(PayVarifyResultOrderID);
         }
     }
 }
    public static string GetUserLocale()
    {
#if UNITY_ANDROID
        return(WebMediator.GetArea());
#else
        return(Application.platform == RuntimePlatform.IPhonePlayer ? _getUserLocale() : "");
#endif
    }
    public static string GetDeviceName()
    {
#if UNITY_ANDROID
        return(WebMediator.GetModel());
#else
        return(Application.platform == RuntimePlatform.IPhonePlayer ? _getDeviceName() : "");
#endif
    }
Exemplo n.º 10
0
    public static string GetMacAddress()
    {
#if UNITY_ANDROID
        return(WebMediator.GetMacAddress());
#else
        return(Application.platform == RuntimePlatform.IPhonePlayer ? _getMacAddress() : Utils.TestMacAddress());
#endif
    }
Exemplo n.º 11
0
    public static string GetNetWorkProvider()
    {
#if UNITY_ANDROID
        return(WebMediator.GetOperator());
#else
        return(Application.platform == RuntimePlatform.IPhonePlayer ? _getNetworkProvider() : "UNKNOWN");
#endif
    }
Exemplo n.º 12
0
    public static void PreWebView(string url)
    {
#if UNITY_EDITOR
#else
        WebMediator.LoadUrl(url);
        WebMediator.Hide();
#endif
    }
Exemplo n.º 13
0
    public static void ShowExitDialog()
    {
#if UNITY_IPHONE
        _showExitDialog("title", "message");
#elif UNITY_ANDROID
        WebMediator.ShowExitPanel();
#endif
    }
Exemplo n.º 14
0
    public void OpenPublicNoticeWeb()
    {
/*
 *      WebViewHeightType hType = WebViewHeightType.HEIGHT_1136;
 #if UNITY_IPHONE
 *      hType = GetCurrentHeightTyp(iPhoneSettings.generation);
 #elif  UNITY_ANDROID
 *              //hType = GetCurrentHeightTyp();
 #endif
 *      Rect rt = GetWebViewRect(hType, WebViewType.NOTICE);
 #if UNITY_IPHONE
 *      WebMediator.LoadUrl(url);
 *      WebMediator.SetMargin((int)rt.xMin, (int)rt.yMin, (int)rt.width, (int)rt.height);
 *          WebMediator.Show();
 #elif  UNITY_ANDROID
 *              if(isActivityWebview)
 *              {
 *                      WebMediator.LoadUrl(url);
 *          WebMediator.SetMargin((int)rt.xMin, (int)rt.yMin, (int)rt.width, (int)rt.height);
 *              WebMediator.Show();
 *              }
 *              else
 *              {
 *                      WebMediator.ShowWebView(url);
 *              }
 #endif
 */
#if UNITY_IPHONE
        //InitPosition(iPhoneSettings.generation);
        InitPositionByScale();
        WebMediator.LoadUrl(url);
        WebMediator.SetMargin(left, top, right, bottom);
        WebMediator.Show();
#elif  UNITY_ANDROID
        if (isActivityWebview)
        {
            InitPosition();
            WebMediator.LoadUrl(url);
            WebMediator.SetMargin(left, top, right, bottom);
            WebMediator.Show();
        }
        else
        {
            WebMediator.ShowWebView(url);
        }
#endif

#if UNITY_IPHONE
        NoticePanel.SetActive(true);
        DefaultPanel.SetActive(false);
        RaiderPanel.SetActive(false);
#elif UNITY_ANDROID
        DefaultPanel.SetActive(false);
        NoticePanel.SetActive(false);
        RaiderPanel.SetActive(false);
#endif
    }
Exemplo n.º 15
0
 public void ActivateWebView()
 {
     Klikajka = true;
     aaa      = true;
     Int32.TryParse(EventSystem.current.currentSelectedGameObject.name, out organizations);
     WebMediator.LoadUrl(Link[organizations]);
     WebMediator.SetMargin(12, Screen.height / 8 + 12, 12, 12);
     WebMediator.Show();
 }
Exemplo n.º 16
0
    public static void OpenUMFeed()
    {
#if UNITY_ANDROID
        WebMediator.OpenFeedBack();
#else
        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            _openUMFeed();
        }
#endif
    }
Exemplo n.º 17
0
 private void ProcessMessages()
 {
     while (true)
     {
         WebMediator.WebMediatorMessage message = WebMediator.PollMessage();
         if (message == null)
         {
             break;
         }
     }
 }
Exemplo n.º 18
0
    // Install the plugin.
    // Call this at least once before using the plugin.
    public static void Install()
    {
        if (instance == null)
        {
            GameObject master = new GameObject("WebMediator");
            DontDestroyOnLoad(master);
            instance = master.AddComponent <WebMediator>();

            InstallPlatform();
        }
    }
Exemplo n.º 19
0
 // Update is called once per frame
 void Update()
 {
     if (WebMediator.IsVisible())
     {
         ProcessMessages();
     }
     else if (Input.GetButtonDown("Fire1") && Input.mousePosition.y < Screen.height / 2)
     {
         ActivateWebView();
     }
 }
Exemplo n.º 20
0
    // Process messages coming from the web view.
    private void ProcessMessages()
    {
        while (true)
        {
            // Poll a message or break.
            WebMediator.WebMediatorMessage message = WebMediator.PollMessage();
            if (message == null)
            {
                break;
            }

            if (message.path == "/spawn")
            {
                GameObject prefab = null;

                // "spawn" message.
                if (message.args.ContainsKey("color"))
                {
                    prefab = (message.args["color"] == "red") ? redBoxPrefab : blueBoxPrefab;
                }
                else
                {
                    prefab = Random.value < 0.5 ? redBoxPrefab : blueBoxPrefab;
                }

                var box = Instantiate(prefab, redBoxPrefab.transform.position, Random.rotation) as GameObject;
                if (message.args.ContainsKey("scale"))
                {
                    box.transform.localScale = Vector3.one * float.Parse(message.args["scale"] as string);
                }
            }
            else if (message.path == "/note")
            {
                // "note" message.
                note = message.args["text"] as string;
            }
            else if (message.path == "/print")
            {
                // "print" message.
                var text = message.args["line1"] as string;
                if (message.args.ContainsKey("line2"))
                {
                    text += "\n" + message.args["line2"] as string;
                }
                Debug.Log(text);
                Debug.Log("(" + text.Length + " chars)");
            }
            else if (message.path == "/close")
            {
                // "close" message.
                DeactivateWebView();
            }
        }
    }
Exemplo n.º 21
0
    // Use this for initialization
    void Start()
    {
        if (PlayerPrefs.HasKey("InGameBackLogin"))        //标记玩家是否在游戏中返回登录 -- 影响快速登录显示绑定界面
        {
            PlayerPrefs.DeleteKey("InGameBackLogin");
        }

#if UNITY_EDITOR
#elif UNITY_ANDROID
#else
        WebMediator.Install();
#endif
        //Application.LoadLevel("mainUI");
    }
 public static bool versionWrong(string version)
 {
     if (string.IsNullOrEmpty(version) || version.Contains("null"))
     {
         return(false);
     }
     Debug.Log("--version = " + version);
     if (true)        //如果有渠道不需要更新 在这里添加
     {
         WebMediator.ShowUpdate(version);
         return(true);
     }
     return(false);
 }
Exemplo n.º 23
0
    public void HideWebView()
    {
#if UNITY_IPHONE
        //InitPosition(iPhoneSettings.generation);
        InitPositionByScale();
        WebMediator.SetMargin(left, top, right, bottom);
        WebMediator.Show();
#endif

#if UNITY_IPHONE
        NoticePanel.SetActive(true);
        DefaultPanel.SetActive(false);
        RaiderPanel.SetActive(false);
        sprite.SetActive(true);
#endif
    }
Exemplo n.º 24
0
    void OnDisable()
    {
#if UNITY_IPHONE
        WebMediator.Hide();
        // Clear the state of the web view (by loading a blank page).
        WebMediator.LoadUrl("about:blank");
#elif UNITY_ANDROID
        if (isActivityWebview)
        {
            WebMediator.Hide();
            WebMediator.LoadUrl("about:blank");
        }
        else
        {
            WebMediator.HideWebView();
        }
#endif
    }
Exemplo n.º 25
0
 void Update()
 {
     if (WebMediator.IsVisible())
     {
         ProcessMessages();
     }
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         DeactivateWebView();
         aaa = false;
         StartCoroutine(klikacz());
     }
     if (Input.GetButtonDown("Fire1") && Input.mousePosition.y > Screen.height / 8 + 12)
     {
         DeactivateWebView();
         aaa = false;
         StartCoroutine(klikacz());
     }
 }
    public static string GetServerListUrl()
    {
        //Debug.Log("ServerListUrl = "+WebMediator.GetServerListUrl());
        return(WebMediator.GetServerListUrl());

        /*
         * if(AndroidConfig.isUCChannel()){
         *      //return "http://219.232.242.229:8081/XJGameServer/servers.txt";// UC测试 //
         *      //return "http://files2.changyou.com/tlydand_uc/servers.txt";// UC正式 //
         *      //return "http://10.6.153.251:9090/XJGameServer/servers.txt";//10月29日半夜测试UC大礼包//
         *      return "http://10.6.155.106:8080/XJGameServer/servers.txt";//玄武岛测试间服务器//
         * }else{
         *      //return "http://219.232.242.229:80/XJGameServer/servers.txt";// 官网测试 //
         *      //return "http://files2.changyou.com/tlydand/servers.txt";// 官网正式 //
         *      //return "http://10.6.153.251:9090/XJGameServer/servers.txt";
         *      return "http://10.6.155.106:8080/XJGameServer/servers.txt";//玄武岛测试间服务器//
         * }
         */
        //return AndroidConfig.SERVERLISTURL;
    }
    void OnResultRet(string strMsg)
    {
        int    nStatus      = -1;
        int    nTradeStatus = -1;
        string strSpsn      = new string('\0', 5);

        StrParse(strMsg, out nStatus, out nTradeStatus, out strSpsn);
        Debug.Log("------OnResultRet strMsg=" + strMsg + " strSpsn=" + strSpsn);
        //请求成功
        if (nStatus == 0)
        {            //付费成功
            if (nTradeStatus == 0)
            {
                //支付成功通知java层,标示
                Debug.Log("pllog_Cyou_success:" + strSpsn);
                WebMediator.SuccessPayLog(strSpsn);

                // 转移到OnOrderRet
                //PurchaseHelper.Instance().AddCyouOrder(strSpsn);
                if (null != purchaseFinish)
                {
                    purchaseFinish(nStatus, strSpsn, "");
                }
            }
            else
            {
                if (null != purchaseFinish)
                {
                    purchaseFinish(-1, strSpsn, "购买失败");                     //TODO 字典替换
                }
            }
        }
        else
        {
            if (null != purchaseFinish)
            {
                purchaseFinish(-1, strSpsn, "请求失败");                 //TODO 字典替换
            }
        }
    }
Exemplo n.º 28
0
    public static void ShowWebView(string url, webViewMode mode)
    {
#if UNITY_EDITOR
#else
        WebMediator.LoadUrl("about:blank");
        Debug.Log("Enter ShowWebView!");
        removeWebView();

        topFrame = ResourceManager.Instance.LoadPopUp("WebViewBox");        //(GameObject)GameObject.Instantiate(messageBox);
        topFrame.transform.parent        = Camera.mainCamera.transform;
        topFrame.transform.localScale    = Vector3.one;
        topFrame.transform.localPosition = new Vector3(0, 0, box_z);

        WebViewBox wvb = topFrame.GetComponent <WebViewBox>();
        Debug.Log("ShowWebView url = " + url);

        if (wvb)
        {
            switch (mode)
            {
            case webViewMode.MESSAGEBOX:
                wvb.OpenWebWinow(WebViewBox.WebViewType.DEFAULT, url);
                break;

            case webViewMode.RAIDER:
                wvb.OpenWebWinow(WebViewBox.WebViewType.RAIDER, url);
                break;

            case webViewMode.NOTICE:
                wvb.OpenWebWinow(WebViewBox.WebViewType.NOTICE, url);
                break;
            }
        }
        else
        {
            Debug.Log("WebViewBox is NULL!!!");
        }
#endif
    }
Exemplo n.º 29
0
    public void OpenDefaultWeb()
    {
        left = 0;       right = 0;      bottom = 0;
#if UNITY_IPHONE
        if (Screen.height > 1136)
        {
            top = 132;
        }
        else
        {
            top = 66;
        }

        WebMediator.LoadUrl(url);
        WebMediator.SetMargin(left, top, right, bottom);
        WebMediator.Show();
#elif  UNITY_ANDROID
        if (isActivityWebview)
        {
            top = 66;
            WebMediator.LoadUrl(url);
            WebMediator.SetMargin(left, top, right, bottom);
            WebMediator.Show();
        }
        else
        {
            WebMediator.ShowWebView(url);
        }
#endif
#if UNITY_IPHONE
        DefaultPanel.SetActive(true);
        NoticePanel.SetActive(false);
        RaiderPanel.SetActive(false);
#elif UNITY_ANDROID
        DefaultPanel.SetActive(false);
        NoticePanel.SetActive(false);
        RaiderPanel.SetActive(false);
#endif
    }
Exemplo n.º 30
0
    void OnEnable()
    {
#if UNITY_ANDROID
        int level = 20;
        if (Obj_MyselfPlayer.GetMe().level >= level || WebMediator.GetNetworkType().Equals("3g"))
        {
            Debug.Log("open other billing button");
            otherPurchaseBtn.SetActive(true);
        }
        else
        {
            Debug.Log("close other billing button");
            otherPurchaseBtn.SetActive(false);
        }
#elif UNITY_IPHONE
        otherPurchaseBtn.SetActive(false);
#endif
        RefreshUI(true);
        if (mainLogic == null)
        {
            mainLogic = GameObject.Find("MainUILogic").GetComponent <MainUILogic>();
        }
        mainLogic.mainController.GetComponent <MainController>().showBottomBar();
    }