Example #1
0
    void  SwapTeam()
    {
        HttpTask task = new HttpTask(ThreadType.MainThread, TaskResponse.Default_Response);

        SwapTeamParam param = new SwapTeamParam();

        param.gid    = Core.Data.playerManager.PlayerID;
        param.teamid = (Core.Data.playerManager.RTData.curTeamId == MonsterTeam.MAIN_TEAM_ID ? MonsterTeam.SUB_TEAM_ID : MonsterTeam.MAIN_TEAM_ID);

        task.AppendCommonParam(RequestType.SWAP_TEAM, param);

        task.ErrorOccured   += testHttpResp_Error;
        task.afterCompleted += testHttpResp_UI;

        RED.Log("send swap team msg");
        RED.Log("team id : " + param.teamid);

        //then you should dispatch to a real handler
        task.DispatchToRealHandler();
    }
Example #2
0
    public void SwapTeam(BaseHttpRequest request, BaseResponse response)
    {
        if (response != null && response.status != BaseResponse.ERROR)
        {
            SwapTeamResponse resp = response as SwapTeamResponse;

            HttpRequest   req   = request as HttpRequest;
            SwapTeamParam param = req.ParamMem as SwapTeamParam;

            if (resp.data)
            {
                Core.Data.playerManager.RTData.curTeamId = (short)param.teamid;

                //MonsterTeam team = RTData.curTeam;
                if (RTData.curTeam == null)
                {
                    MonsterTeamInfo teamInfo = new MonsterTeamInfo();
                    teamInfo.teamid = (short)param.teamid;
                    RTData.myTeams.Add(teamInfo.toMonsterTeam(14, Core.Data.monManager));
                }
            }
        }
    }