Exemplo n.º 1
0
    /// <summary>
    /// 上传玩家信息到sdk服务器  参数1:玩家参数 参数2:上传时机
    /// </summary>
    public void UpdatePlayerInfo(SDKData.RoleData roleData, UpdatePlayerInfoType updateType = UpdatePlayerInfoType.createRole)
    {
        long roleCTime;

        if (!long.TryParse(roleData.createTime, out roleCTime))
        {
            roleCTime = 0;
        }
        var roleModel = new YaoLingSDKCallBackManager.SaveRoleDataModel()
        {
            userName  = SDK_UserName,
            roleLevel = long.Parse(roleData.roleLevel),
            roleCTime = roleCTime,
            roleId    = roleData.roleId,
            roleName  = roleData.roleName,
            zoneId    = roleData.realmId,
            zoneName  = roleData.realmName,
        };

        #region 2018年8月17日14:18:09 qiubin添加 曜灵 116 聚合 SDK
#if UNITY_ANDROID
        YaoLingSDKCallBackManager.Instance.CallAndroidFunc(YaoLingSDKCallBackManager.YaoLinAndroidSDKNameType.StartSDKSaveRoleInfo, LitJson.JsonMapper.ToJson(roleModel));
#elif UNITY_IOS
        SDKIOSFunction.sdkmanagersavedata(roleModel.roleId, roleModel.roleName, roleModel.zoneId, roleModel.roleLevel.ToString(), roleModel.zoneName);
#endif
        #endregion
    }
Exemplo n.º 2
0
        /// <summary>
        /// 上传玩家信息到sdk服务器  参数1:玩家参数 参数2:上传时机
        /// </summary>
        public void UpdatePlayerInfo(SDKData.RoleData roleData, UpdatePlayerInfoType updateType)
        {
            if (UpdatePlayerInfoType.levelUp == updateType)
            {
                Umeng.GA.SetUserLevel(int.Parse(roleData.roleLevel));//统计玩家等级
            }
            else if (UpdatePlayerInfoType.enterGame == updateType)
            {
                Umeng.Analytics.Event("RoleLoginCount");//统计登陆次数
            }
            else if (UpdatePlayerInfoType.createRole == updateType)
            {
            }

#if YaoLing
            #region 2018年8月17日14:18:09 qiubin添加 曜灵 116 聚合 SDK
            Debug.LogWarning("调用曜灵116sdk 保存信息!");
            long roleCTime;
            if (!long.TryParse(roleData.createTime, out roleCTime))
            {
                roleCTime = 0;
            }
            var roleModel = new YaoLingSDKCallBackManager.SaveRoleDataModel()
            {
                userName  = UserName,
                roleLevel = long.Parse(roleData.roleLevel),
                roleCTime = roleCTime,
                roleId    = roleData.roleId,
                roleName  = roleData.roleName,
                zoneId    = roleData.realmId,
                zoneName  = roleData.realmName,
            };
            YaoLingSDKCallBackManager.Instance.CallAndroidFunc(YaoLingSDKCallBackManager.YaoLinAndroidSDKNameType.StartSDKSaveRoleInfo, LitJson.JsonMapper.ToJson(roleModel));
            #endregion
#else
            //TODO 解决时间戳过大传入java中转换成整形失败的问题
            if (roleData.createTime.Length >= 10)
            {
                long createTime = long.Parse(roleData.createTime);
                int  intTime    = (int)(createTime / 10);
                roleData.createTime = intTime.ToString();
            }

            //设置所有的数据
            U3DTypeSDK.Instance.GetUserData().SetData(U3DTypeAttName.USER_ID, "userid");
            U3DTypeSDK.Instance.GetUserData().SetData(U3DTypeAttName.USER_NAME, "username");
            U3DTypeSDK.Instance.GetUserData().SetData(U3DTypeAttName.ROLE_ID, roleData.roleId);
            U3DTypeSDK.Instance.GetUserData().SetData(U3DTypeAttName.ROLE_NAME, roleData.roleName);
            U3DTypeSDK.Instance.GetUserData().SetData(U3DTypeAttName.ROLE_LEVEL, roleData.roleLevel);

            U3DTypeSDK.Instance.GetUserData().SetData(U3DTypeAttName.ZONE_ID, roleData.realmId);
            U3DTypeSDK.Instance.GetUserData().SetData(U3DTypeAttName.ZONE_NAME, roleData.realmName);
            U3DTypeSDK.Instance.GetUserData().SetData(U3DTypeAttName.SERVER_ID, roleData.realmId);
            U3DTypeSDK.Instance.GetUserData().SetData(U3DTypeAttName.SERVER_NAME, roleData.realmName);
            U3DTypeSDK.Instance.GetUserData().SetData(U3DTypeAttName.USER_TOKEN, Token);

            U3DTypeSDK.Instance.GetUserData().SetData(U3DTypeAttName.USER_HEAD_ID, "");
            U3DTypeSDK.Instance.GetUserData().SetData(U3DTypeAttName.USER_HEAD_URL, "");
            U3DTypeSDK.Instance.GetUserData().SetData(U3DTypeAttName.VIP_LEVEL, "0");
            U3DTypeSDK.Instance.GetUserData().SetData(U3DTypeAttName.PARTY_NAME, "");
            U3DTypeSDK.Instance.GetUserData().SetData(U3DTypeAttName.ROLE_CREATE_TIME, roleData.createTime);

            U3DTypeSDK.Instance.GetUserData().SetData(U3DTypeAttName.ROLE_LEVELUP_TIME, "0");           //角色升级时间(单位/秒)
            U3DTypeSDK.Instance.GetUserData().SetData(U3DTypeAttName.ROLE_TYPE, updateType.ToString()); //角色统计信息类型即调用时机,(createRole:创建角色,levelUp:角色升级,enterGame:选定角色进入游戏,不能为空字符串)
            U3DTypeSDK.Instance.GetUserData().SetData(U3DTypeAttName.SAVED_BALANCE, "0");

            U3DTypeBaseData cacheUser = GetUserData();
            Debug.Log("send player info : " + cacheUser.DataToString());
            bonjour.SetPlayerInfo(cacheUser);
#endif
        }