Exemple #1
0
    private void SendMatchEnemyReq(object data)
    {
        PVPRealTimeMainUIModel.MatchType = PVPMatchType.Enemy;
        MatchEnemyData     tmpData = data as MatchEnemyData;
        ZonePvp1v1MatchReq req     = new ZonePvp1v1MatchReq();
        int state = KHUtil.GetInt(UISettingMoreView.OnlyReal, 0);

        req.only_real_player = state == 1;
        NetworkManager.Instance.Send((uint)ZoneCmd.ZONE_PVP_1V1_MATCH, req, (object fullInfo) => {
            ZonePvp1v1MatchResp resp = fullInfo as ZonePvp1v1MatchResp;
            if (resp.ret_info.ret_code == 0)
            {
                tmpData.expectSeconds   = (int)resp.expect_wait_second;
                EstimatedTimeLabel.text = tmpData.expectSeconds + "秒";
                NGUITools.SetActive(EstimatedContainer.gameObject, true);
                isStarted = true;
            }
            else
            {
                ErrorCodeCenter.DefaultProcError(resp.ret_info);
                _CloseWindow(null);
            }
        }, false, onTimeout => {
            UIAPI.ShowMsgTip("匹配请求超时");
            _CloseWindow(null);
        });
    }
Exemple #2
0
    private void InviteFightAgain(object data)
    {
        FightAgainData againData = data as FightAgainData;
        var            req       = new ZonePvp1v1InviteReq();

        req.friend_gid  = againData.player_id;
        req.friend_zone = againData.zoneid;
        req.invite      = true;
        req.plat_friend = false;
        req.fight_again = true;
        req.pvp_type    = againData.pvp_type;

        NetworkManager.Instance.Send <ZonePvp1v1InviteReq>((uint)ZoneCmd.ZONE_PVP_1V1_INVITE, req, (object fullInfo) =>
        {
            ZonePvp1v1InviteResp resp = fullInfo as ZonePvp1v1InviteResp;
            if (resp.ret_info.ret_code == 0)
            {
                isStarted = true;
            }
            else
            {
                ErrorCodeCenter.DefaultProcError(resp.ret_info);
                _CloseWindow(null);
            }
        }, false, timeoutCallback => {
            UIAPI.ShowMsgTip("邀请再来一战超时");
            _CloseWindow(null);
        });
    }
Exemple #3
0
    //先进界面再发请求,以防止未打开界面时,就已经匹配了。
    private void InviteFriend(object data)
    {
        BriefRoleInfo friend = data as BriefRoleInfo;
        var           req    = new ZonePvp1v1InviteReq();

        req.friend_gid  = friend.player_id;
        req.friend_zone = friend.zoneid;
        req.invite      = true;
        var friendModel = KHPluginManager.Instance.GetModel(PVPRealTimeFriendPlugin.PluginName) as PVPRealTimeFriendModel;

        if (actData != null)
        {
            req.pvp_type = actData.pvp_type;
        }
        else
        {
            req.pvp_type = friendModel.banMode ? 1u : 0u;
        }


        if (friendModel.platformFriendList.Contains(friend))
        {
            req.plat_friend = true;
        }
        else
        {
            req.plat_friend = false;
        }
        NetworkManager.Instance.Send <ZonePvp1v1InviteReq>((uint)ZoneCmd.ZONE_PVP_1V1_INVITE, req, (object fullInfo) =>
        {
            ZonePvp1v1InviteResp resp = fullInfo as ZonePvp1v1InviteResp;
            if (resp.ret_info.ret_code == 0)
            {
                isStarted = true;
                if (actData == null)
                {
                    NGUITools.SetActive(Button, true);
                }
            }
            else
            {
                ErrorCodeCenter.DefaultProcError(resp.ret_info);

                if (actData != null && actData.remain_times > 0)
                {
                    ActCenterPlugin plugin = KH.KHPluginManager.Instance.GetPluginByName(KH.Plugins.ActCenterPlugin.NAME) as KH.Plugins.ActCenterPlugin;
                    plugin.InvokeActFun((uint)actData.act_id, "ReqCmd7");
                }
                else
                {
                    _CloseWindow(null);
                }
            }
            if (resp.refresh)
            {
                var model = plugin.Model as PVPRealTimeMainUIModel;
                model.TriggerBinding("RefreshFriendList");
            }
        }, false, timeoutCallback => {
            UIAPI.ShowMsgTip("邀请好友比试超时");

            if (actData != null && actData.remain_times > 0)
            {
                ActCenterPlugin plugin = KH.KHPluginManager.Instance.GetPluginByName(KH.Plugins.ActCenterPlugin.NAME) as KH.Plugins.ActCenterPlugin;
                plugin.InvokeActFun((uint)actData.act_id, "ReqCmd7");
            }
            else
            {
                _CloseWindow(null);
            }
        });
    }