上传代码
This commit is contained in:
parent
00ee9c35ab
commit
628f673aec
48
Client.cs
48
Client.cs
@ -27,10 +27,18 @@ namespace BattleServer
|
|||||||
private void doBinary(byte[] message)
|
private void doBinary(byte[] message)
|
||||||
{
|
{
|
||||||
BattleRpcMessage msg = ProtoDeSerialize<BattleRpcMessage>(message);
|
BattleRpcMessage msg = ProtoDeSerialize<BattleRpcMessage>(message);
|
||||||
|
Console.WriteLine("接收到消息 {0}",msg.method);
|
||||||
// Pb.BattleRpcMessage msg = Deserialize<Pb.BattleRpcMessage>(message);
|
// Pb.BattleRpcMessage msg = Deserialize<Pb.BattleRpcMessage>(message);
|
||||||
Task.Run(() =>{
|
Task t = Task.Run(() =>{
|
||||||
handle(msg);
|
handle(msg);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
t.ContinueWith(r =>
|
||||||
|
{
|
||||||
|
//Thread.Sleep(3000);
|
||||||
|
string Exception = Convert.ToString(t.Exception);
|
||||||
|
Console.WriteLine("消息处理异常:" + Exception);
|
||||||
|
}, TaskContinuationOptions.OnlyOnFaulted);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -39,24 +47,28 @@ namespace BattleServer
|
|||||||
/// <param name="msg"></param>
|
/// <param name="msg"></param>
|
||||||
private void handle(BattleRpcMessage msg)
|
private void handle(BattleRpcMessage msg)
|
||||||
{
|
{
|
||||||
try{
|
|
||||||
Console.WriteLine("收到战斗消息:{0}", msg.method);
|
long ts = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000;
|
||||||
switch(msg.method){
|
Console.WriteLine("接收到战斗消息 1 {0}|{1}",msg.method,ts);
|
||||||
case "Check":
|
switch(msg.method){
|
||||||
BattleReport report = ProtoDeSerialize<BattleReport>(msg.data.value);
|
case "Check":
|
||||||
bool ischeck = HotUpdateScripts.FightRunnerMgr.Instance.VerifyOnceFight(report);
|
BattleReport report = ProtoDeSerialize<BattleReport>(msg.data.value);
|
||||||
Console.WriteLine("战斗校验结果:{0}", ischeck);
|
ts = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000;
|
||||||
msg.data = new Google.Protobuf.WellKnownTypes.Any {
|
Console.WriteLine("接收到战斗消息 2 |{0}",ts);
|
||||||
type_url = "type.googleapis.com/BattleCheckResults",
|
bool ischeck = HotUpdateScripts.FightRunnerMgr.Instance.VerifyOnceFight(report);
|
||||||
value = ProtoSerialize(new BattleCheckResults{ischeck=ischeck}),
|
ts = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000;
|
||||||
};
|
Console.WriteLine("接收到战斗消息 3 |{0}",ts);
|
||||||
socket.Send(ProtoSerialize(msg));
|
msg.data = new Google.Protobuf.WellKnownTypes.Any {
|
||||||
break;
|
type_url = "type.googleapis.com/BattleCheckResults",
|
||||||
}
|
value = ProtoSerialize(new BattleCheckResults{ischeck=ischeck}),
|
||||||
} catch (IOException ex){
|
};
|
||||||
Console.WriteLine("战斗异常 {0}",ex.Message);
|
byte[] _msg = ProtoSerialize(msg);
|
||||||
socket.Close();
|
ts = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000;
|
||||||
|
Console.WriteLine("接收到战斗消息 4 |{0}",ts);
|
||||||
|
socket.Send(_msg);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -10,10 +10,10 @@ namespace BattleServer
|
|||||||
{
|
{
|
||||||
HotUpdateScripts.FightRunnerMgr.Instance.Init("./GameConfig/");
|
HotUpdateScripts.FightRunnerMgr.Instance.Init("./GameConfig/");
|
||||||
cfg.Game.HeroData data = HotUpdateScripts.FightBase.GC.Hero.Get("25001");
|
cfg.Game.HeroData data = HotUpdateScripts.FightBase.GC.Hero.Get("25001");
|
||||||
HotUpdateScripts.FightDebug.Log("测试读取配置 name:"+data.Name);
|
// HotUpdateScripts.FightDebug.Log("测试读取配置 name:"+data.Name);
|
||||||
Console.WriteLine("BattleServer Start!");
|
|
||||||
Service service = new Service();
|
Service service = new Service();
|
||||||
Console.ReadKey();
|
Console.WriteLine("BattleServer Start!");
|
||||||
|
Thread.Sleep(Timeout.Infinite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -7,4 +7,4 @@ build_property.InvariantGlobalization =
|
|||||||
build_property.PlatformNeutralAssembly =
|
build_property.PlatformNeutralAssembly =
|
||||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||||
build_property.RootNamespace = dfbattle
|
build_property.RootNamespace = dfbattle
|
||||||
build_property.ProjectDir = F:\work\c#\dfbattle\
|
build_property.ProjectDir = f:\work\c#\dfbattle\
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user