private void OnArenaChallengeRequest(NetConnection <NetSession> sender, ArenaChallengeRequest request) { Character character = sender.Session.Character; // Log.InfoFormat("OnArenaChallengeRequest: RedId:{0}:RedName{1} BlueId:{2} BlueName:{3]", request.ArenaInfo.Red.EntityId, request.ArenaInfo.Red.Name, request.ArenaInfo.Blue.EntityId, request.ArenaInfo.Blue.Name); NetConnection <NetSession> blue = null; if (request.ArenaInfo.Blue.EntityId > 0) { blue = SessionManager.Instance.GetSession(request.ArenaInfo.Blue.EntityId); } else {//pve对战 var arena = ArenaManager.Instance.NewArena(request.ArenaInfo, sender, null); this.SendArenaBegin(arena); return; } if (blue == null) { sender.Session.Response.arennaChallengeRes = new ArenaChallengeResponse(); sender.Session.Response.arennaChallengeRes.Result = Result.Failed; sender.Session.Response.arennaChallengeRes.Errormsg = "对方不存在或不在线"; sender.SendResponse(); return; } //Log.InfoFormat("ForwardArenaChallengeRequest: RedId:{0}:RedName{1} BlueId:{2} BlueName:{3]", request.ArenaInfo.Red.EntityId, request.ArenaInfo.Red.Name, request.ArenaInfo.Blue.EntityId, request.ArenaInfo.Blue.Name); blue.Session.Response.arennaChallengeReq = request; blue.SendResponse(); }
public void SendArenaChangeReponse(bool accept, ArenaChallengeRequest request) { Debug.Log("SendArenaChangeReponse"); NetMessage message = new NetMessage(); message.Request = new NetMessageRequest(); message.Request.arenaChallengeRes = new ArenaChallengeResponse(); message.Request.arenaChallengeRes.Result = accept ? Result.Success : Result.Failed; message.Request.arenaChallengeRes.ArenaInfo = request.ArenaInfo; NetClient.Instance.SendMessage(message); }
private void OnArenaChallengeRequest(object sender, ArenaChallengeRequest request) { Debug.Log("OnArenaChallengeRequest"); var confirn = MessageBox.Show(String.Format("{0}邀请你竞技场对战", request.ArenaInfo.Red.Name), "竞技场对战", MessageBoxType.Confirm, "接受", "拒绝"); confirn.OnYes = () => { this.SendArenaChangeReponse(true, request); }; confirn.OnNo = () => { this.SendArenaChangeReponse(false, request); }; }