Ejemplo n.º 1
0
    // 支付
    public static void MakePay()
    {
        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            if (GetChannelType() == ChannelType.IOS_APPSTORE || GetChannelType() == ChannelType.IOS_APPSTORE_TEST)
            {
#if UNITY_IPHONE && !UNITY_EDITOR
                IOSHelper.makePay(string.Format("{0:X16}", PlayerPreferenceData.LastRoleGUID), PlayerPreferenceData.LastServer.ToString());
#endif
                return;
            }
        }
        else if (Application.platform == RuntimePlatform.Android)
        {
#if UNITY_ANDROID && !UNITY_EDITOR
            if (GameManager.gameManager == null || GameManager.gameManager.PlayerDataPool == null)
            {
                return;
            }
            PayActivityData payActivityData = GameManager.gameManager.PlayerDataPool.PayActivity;

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            JsonWriter writer            = new JsonWriter(sb);
            writer.WriteObjectStart();
            writer.WritePropertyName("ROLEID");
            writer.Write(string.Format("{0:X16}", PlayerPreferenceData.LastRoleGUID));
            writer.WritePropertyName("UID");
            writer.Write(LoginData.accountData.m_userID);
            writer.WritePropertyName("SERVERID");
            writer.Write(PlayerPreferenceData.LastServer.ToString());
            writer.WritePropertyName("OID");
            writer.Write(LoginData.accountData.m_oid);
            writer.WritePropertyName("TOKEN");
            writer.Write(LoginData.accountData.m_accessToken);
            writer.WritePropertyName("ROLENAME");
            writer.Write(LoginData.m_sRoleName);
            if (PlatformHelper.IsChannelTW())
            {
                // 成长基金
                writer.WritePropertyName("CZJJ_SHOWFLAG");
                writer.Write(payActivityData.IsGrowUpFlag() == true ? "0" : "1");
                // 招财进宝
                writer.WritePropertyName("ZCJB_SHOWFLAG");
                writer.Write(payActivityData.IsMonthCardFlag() == true ? "0" : "1");
                writer.WritePropertyName("ZCJB_SURPLUSDAY");
                writer.Write(payActivityData.GetMonthCardLeftDay().ToString());
            }
            LoginData.PlayerRoleData curRole = LoginData.GetPlayerRoleData(PlayerPreferenceData.LastRoleGUID);
            if (null != curRole)
            {
                writer.WritePropertyName("ROLELEVEL");
                writer.Write(curRole.level.ToString());
            }
            writer.WriteObjectEnd();

            AndroidHelper.doSdk("doOrder", sb.ToString());
#endif
            return;
        }

        Obj_MainPlayer mainPlayer = Singleton <ObjManager> .Instance.MainPlayer;
        if (null != mainPlayer)
        {
            mainPlayer.SendNoticMsg(false, "#{2136}");
        }
    }