Example #1
0
    // 统计日志:角色进入游戏
    public static void RoleEnterGame(string strAccountID, string strRoleType, string strRoleName, int RoleLevel)
    {
#if  UNITY_WP8 && !UNITY_EDITOR
#elif UNITY_ANDROID && !UNITY_EDITOR
        string serverId   = PlayerPreferenceData.LastServer.ToString();
        string serverName = LoginData.GetServerListDataByID(PlayerPreferenceData.LastServer).m_name;

        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        JsonWriter writer            = new JsonWriter(sb);
        writer.WriteObjectStart();
        writer.WritePropertyName("AccountId");
        writer.Write(strAccountID);
        if (PlatformHelper.IsChannelTW())
        {
            //GUID
            UInt64 roleId = Convert.ToUInt64(strAccountID);
            string guid16 = string.Format("{0:X16}", roleId);
            writer.WritePropertyName("GUID16");
            writer.Write(guid16);
        }
        writer.WritePropertyName("RoleType");
        writer.Write(strRoleType);
        writer.WritePropertyName("RoleName");
        writer.Write(strRoleName);
        writer.WritePropertyName("RoleLevel");
        writer.Write(RoleLevel);
        writer.WritePropertyName("ServerId");
        writer.Write(serverId);
        writer.WritePropertyName("ServerName");
        writer.Write(serverName);
        writer.WriteObjectEnd();

        AndroidHelper.platformHelper("roleEnterGame", sb.ToString());
#elif UNITY_IPHONE && !UNITY_EDITOR
        IOSHelper.onRoleEnterGame(strAccountID, strRoleType, strRoleName, RoleLevel);
        //提交新版客服页面参数
        LoginData.ServerListData lastServerData = LoginData.GetServerListDataByID(PlayerPreferenceData.LastServer);
        LoginData.PlayerRoleData lastRoleData   = LoginData.GetPlayerRoleData(PlayerPreferenceData.LastRoleGUID);
        Obj_MainPlayer           mainPlayer     = Singleton <ObjManager> .GetInstance().MainPlayer;

        if (null != lastServerData && null != lastRoleData && null != mainPlayer)
        {
            IOSHelper.CommitH5CustomServiceData(lastServerData.m_name,
                                                lastServerData.m_id.ToString(),
                                                lastRoleData.name,
                                                string.Format("{0:X16}", lastRoleData.guid),
                                                GCGame.Utils.GetVersionString(),
                                                mainPlayer.BaseAttr.Level.ToString(),
                                                VipData.GetVipLv().ToString());
        }
#else
#endif
    }