예제 #1
0
    private void OnLogout(int code, string msg)
    {
        log(string.Format("UCCallbackMessage - OnLogout: code={0}, msg={1}", code, msg));

        //输出退出登录结果到页面(接入后删除)
        UI.Login.LoginUIManagerPlatform.setSdkMessage(string.Format("UCCallbackMessage - OnLogout: code={0}, msg={1}", code, msg));

        if (code == UCStatusCode.SUCCESS)
        {
            //当前登录用户已退出,应将游戏切换到未登录的状态。
            UCConfig.logined = false;
            UCGameSdk.destroyFloatButton();

            LoginPlatformManager.Instance.m_isLoginedPlatform = false;
            LoginPlatformManager.Instance.LoginPlatform();
            //DemoControl.Restart();
        }
        else
        {
            //unknown error
            log(string.Format("unknown error: code={0}, msg={1}", code, msg));
        }
    }
예제 #2
0
    public static void PayForCommodity(CommodityData data)
    {
        long   roleId   = Globals.Instance.MGameDataManager.MActorData.PlayerID;
        string roleName = Globals.Instance.MGameDataManager.MActorData.BasicData.Name;
        int    level    = Globals.Instance.MGameDataManager.MActorData.BasicData.Level;

        float exchangeRatio = RmbYuan2UCbi;

        if (data.currency == CurrencyType.RmbYuan)
        {
            exchangeRatio = RmbYuan2UCbi;
        }
        else if (data.currency == CurrencyType.RmbJiao)
        {
            exchangeRatio = 0.1f * RmbYuan2UCbi;
        }
        else if (data.currency == CurrencyType.RmbFen)
        {
            exchangeRatio = 0.01f * RmbYuan2UCbi;
        }
        float productPrice         = exchangeRatio * data.currPrice;
        float productOriginalPrice = exchangeRatio * data.originalPrice;
        int   productCnt           = data.BasicData.Count;

        productPrice         *= productCnt;
        productOriginalPrice *= productCnt;
        int ucbi = (int)Mathf.CeilToInt(productPrice);

        // Send to our pay server
        string customInfo = cpid + "," + data.orderId;

#if UNITY_ANDROID
        //调用支付接口
        UCGameSdk.pay(true, ucbi, serverid, roleId.ToString(), roleName, level.ToString(), customInfo);
#elif UNITY_IPHONE
#endif
    }