上传战斗服衔接代码
This commit is contained in:
parent
56c554b0b5
commit
68a4fc5008
47
Client.cs
47
Client.cs
@ -78,7 +78,52 @@ namespace BattleServer
|
||||
// Console.WriteLine("接收到战斗消息 4 |{0}",ts);
|
||||
socket.Send(_msg);
|
||||
break;
|
||||
case "GetInfo": //创建战斗场景
|
||||
case "Run": //运行战斗
|
||||
BattleRunReq runreq = ProtoDeSerialize<BattleRunReq>(msg.data.value);
|
||||
BattleReport[] reports = new BattleReport[runreq.info.Count];
|
||||
for (int i = 0; i < runreq.info.Count; i++)
|
||||
{
|
||||
|
||||
var respaction = () =>
|
||||
{
|
||||
bool isfinsh = true;
|
||||
for (int i = 0; i < reports.Length; i++)
|
||||
{
|
||||
if (reports[i] == null)
|
||||
{
|
||||
isfinsh = false;
|
||||
}
|
||||
}
|
||||
if (isfinsh)
|
||||
{
|
||||
msg.data = new Google.Protobuf.WellKnownTypes.Any
|
||||
{
|
||||
type_url = "type.googleapis.com/BattleRunResp",
|
||||
value = ProtoSerialize(new BattleRunResp { reports = reports.ToList() }),
|
||||
};
|
||||
_msg = ProtoSerialize(msg);
|
||||
socket.Send(_msg);
|
||||
}
|
||||
};
|
||||
|
||||
HotUpdateScripts.FightRunnerMgr.Instance.RunOnceFight(runreq.info[i], (issucc) =>
|
||||
{
|
||||
int index = i;
|
||||
reports[index] = new BattleReport()
|
||||
{
|
||||
info = runreq.info[index],
|
||||
winSide = 2,
|
||||
};
|
||||
respaction();
|
||||
}, (report) =>
|
||||
{
|
||||
int index = i;
|
||||
reports[index] = report;
|
||||
respaction();
|
||||
});
|
||||
}
|
||||
break;
|
||||
case "GetInfo": //获取战斗场景
|
||||
// Console.WriteLine("处理GetInfoPVP !");
|
||||
BattleGetInfoReq req = ProtoDeSerialize<BattleGetInfoReq>(msg.data.value);
|
||||
BattleStateInfo info = HotUpdateScripts.FightRunnerMgr.Instance.GetPvpStateInfo(req.battleid);
|
||||
|
Loading…
Reference in New Issue
Block a user