Beispiel #1
0
    void DoBuyByItemID(uint currentItem)
    {
#if UNITY_EDITOR || WINDOWS_GUEST
        GameMain.hall_.GetPlayer().RequestBuyItem((uint)currentItem);
#else
#if VVPAY_H5
        OpenPayPlatfromSelectUI((uint)parma);
#else
#if UKGAME_SDK
        ShopItemdata itemdata = CCsvDataManager.Instance.ShopItemDataMgr.GetShopItemData((uint)currentItem);
        if (itemdata == null)
        {
            return;
        }
        string playeritemId = string.Format("{0}|{1}", GameMain.hall_.GetPlayerData().GetPlayerID(), itemdata.ItemID);
        CUKGameSDK.UKPlatform_Pay(itemdata.ItemPrice.ToString(), itemdata.ItemName, playeritemId, itemdata.ItemID.ToString());
#else
        //如果只允许行apple支付
        if (GameMain.hall_.GetPlayer().IsOnlyApplePay())
        {
            GameMain.hall_.GetPlayer().RequestBuyItem((uint)currentItem, PayPlatform.Apple);
        }
        else
        {
            GameMain.hall_.shop.OpenPayPlatfromSelectUI((uint)currentItem);
        }
#endif
#endif
#endif
    }
Beispiel #2
0
    /// <summary>
    /// 检测安卓运行权限
    /// </summary>
    private bool CheckAppRunPermission()
    {
        bool bpermiss = true;

#if UNITY_ANDROID
#if UKGAME_SDK
        if (Application.platform == RuntimePlatform.Android)
        {
            bpermiss = CUKGameSDK.GetUKGameActivity().Call <bool>("CheckAppRunPermission");
        }
#endif
#endif
        return(bpermiss);
    }
Beispiel #3
0
    // Update is called once per frame
    void Update()
    {
        //防止在start中初始化下载资源登陆场景还没有显示
        if (eLuancherState == LUANCHERSTATE.LuancherState_StartVerify && Time.time > 0.5f)
        {
            Debug.Log("LuancherState_StartVerify process:");
            if (CheckAppRunPermission() == true)
            {
                CheckVersionUpdate();
                //eLuancherState = LUANCHERSTATE.LuancherState_Over;
            }
            else
            {
                DownloadProcessUpdatetextObj.GetComponent <Text>().text = "请授予程序运行必要的权限...";
                DownloadProcessUpdatetextObj.SetActive(true);
                eLuancherState = LUANCHERSTATE.LuancherState_Over;
            }
        }

        //else if(eLuancherState == LUANCHERSTATE.LuancherState_UnZip)
        //{
        //    if (DownloadProcessBarImg.fillAmount == 0.01f)
        //    {
        //        FirstRunAppUnzipAssetbundle();
        //    }
        //    DownloadProcessBarImg.fillAmount += 0.005f;
        //    Debug.Log("unzip process:" + DownloadProcessBarImg.fillAmount);
        //}

        //资源更新下载状态
        else if (eLuancherState == LUANCHERSTATE.LuancherState_Downloading)
        {
            if (DownLoadProcessMgr.Instance.IsDownLoadOver)
            {
                DownloadProcessUpdatetextObj.GetComponent <Text>().text = "正在校验资源...";
                DownloadProcessUpdatetextObj.SetActive(true);
                eLuancherState = LUANCHERSTATE.LuancherState_VerifyMD5;
            }
            else
            {
                if (HttpDownloadMgr.Instance.bDownloadError)
                {
                    DownloadProcessUpdatetextObj.GetComponent <Text>().text = "网络出现异常,正在重试...";
                    DownloadProcessUpdatetextObj.SetActive(true);
                }
                else
                {
                    DownloadProcessBarImg.fillAmount = DownLoadProcessMgr.Instance.GetDownloadProcess();
                    uint percent = DownLoadProcessMgr.Instance.GetDownloadPercent();
                    //Debug.Log("percent:" + percent);
                    DownloadProcessPercentObj.GetComponent <Text>().text = percent.ToString() + "%";

                    //这里有优化空间的,不需要每帧去更新总大小
                    string downlenstr = DownLoadProcessMgr.Instance.GetDownloadFileCurLength().ToString();
                    DownloadProcessTotalLengthObj.GetComponent <Text>().text = downlenstr + "/" + DownLoadProcessMgr.Instance.GetDownloadFileTotalLength().ToString() + "KB";
                    DownloadProcessPercentObj.SetActive(true);
                    DownloadProcessTotalLengthObj.SetActive(true);
                    DownloadProcessUpdatetextObj.GetComponent <Text>().text = "更新资源,请稍候...";
                    DownloadProcessUpdatetextObj.SetActive(true);
                }
            }
        }

        //下载完成调起安装
        else if (eLuancherState == LUANCHERSTATE.LuancherState_InstallAPK)
        {
#if UNITY_ANDROID
#if UKGAME_SDK
            CUKGameSDK.GetUKGameActivity().Call("InstallApk", GameDefine.DownloadApkSavePath + GameDefine.ApkFileName);
#else
            AlipayWeChatPay.GetAndroidActivity().Call("InstallApk", GameDefine.DownloadApkSavePath + GameDefine.ApkFileName);
#endif
#endif
            eLuancherState = LUANCHERSTATE.LuancherState_Over;
        }

        //资源资源进行MD5校验(防止网络异常下载的资源文件内容有错)
        else if (eLuancherState == LUANCHERSTATE.LuancherState_VerifyMD5)
        {
            if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.OSXEditor)
            {
                eLuancherState = LUANCHERSTATE.LuancherState_StartGame;
            }
            else
            {
                ResourceMD5Verify();
            }
        }

        //启动游戏
        else if (eLuancherState == LUANCHERSTATE.LuancherState_StartGame)
        {
            GameMain.Instance.InitApplication(m_SvrResVerStr, m_ServerIP, m_ServerPort);
            eLuancherState = LUANCHERSTATE.LuancherState_Over;
        }
    }