|
|
@@ -20,7 +20,7 @@ namespace Server |
|
|
protected readonly ArgumentOptions options; |
|
|
protected readonly ArgumentOptions options; |
|
|
private HttpSender? httpSender; |
|
|
private HttpSender? httpSender; |
|
|
private object gameLock = new(); |
|
|
private object gameLock = new(); |
|
|
private int playerNum => options.playerNum; // 注意修改 |
|
|
|
|
|
|
|
|
public int PlayerNum => options.playerNum; // 注意修改 |
|
|
private MessageToClient currentGameInfo = new(); |
|
|
private MessageToClient currentGameInfo = new(); |
|
|
private MessageOfObj currentMapMsg = new(); |
|
|
private MessageOfObj currentMapMsg = new(); |
|
|
private object newsLock = new(); |
|
|
private object newsLock = new(); |
|
|
@@ -202,7 +202,7 @@ namespace Server |
|
|
} |
|
|
} |
|
|
private bool ValidPlayerID(long playerID) |
|
|
private bool ValidPlayerID(long playerID) |
|
|
{ |
|
|
{ |
|
|
if (0 <= playerID && playerID < options.PlayerCountPerTeam + 1) |
|
|
|
|
|
|
|
|
if ((0 <= playerID && playerID < options.PlayerCountPerTeam) || playerID == 4) |
|
|
return true; |
|
|
return true; |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
@@ -276,7 +276,7 @@ namespace Server |
|
|
var onConnection = new BoolRes(); |
|
|
var onConnection = new BoolRes(); |
|
|
lock (gameLock) |
|
|
lock (gameLock) |
|
|
{ |
|
|
{ |
|
|
if (0 <= request.PlayerId && request.PlayerId < playerNum) // 注意修改 |
|
|
|
|
|
|
|
|
if (0 <= request.PlayerId && request.PlayerId < PlayerNum) // 注意修改 |
|
|
{ |
|
|
{ |
|
|
onConnection.ActSuccess = true; |
|
|
onConnection.ActSuccess = true; |
|
|
Console.WriteLine(onConnection.ActSuccess); |
|
|
Console.WriteLine(onConnection.ActSuccess); |
|
|
@@ -331,7 +331,7 @@ namespace Server |
|
|
lock (semaDict) |
|
|
lock (semaDict) |
|
|
{ |
|
|
{ |
|
|
semaDict.Add(request.PlayerId, temp); |
|
|
semaDict.Add(request.PlayerId, temp); |
|
|
start = semaDict.Count == playerNum; |
|
|
|
|
|
|
|
|
start = semaDict.Count == PlayerNum; |
|
|
} |
|
|
} |
|
|
if (start) StartGame(); |
|
|
if (start) StartGame(); |
|
|
} |
|
|
} |
|
|
@@ -427,7 +427,8 @@ namespace Server |
|
|
#endif |
|
|
#endif |
|
|
BoolRes boolRes = new(); |
|
|
BoolRes boolRes = new(); |
|
|
var gameID = communicationToGameID[request.PlayerId]; |
|
|
var gameID = communicationToGameID[request.PlayerId]; |
|
|
//boolRes.ActSuccess = game.UseProp(gameID, CopyInfo.ToPropType(request.PropType)); |
|
|
|
|
|
|
|
|
game.UseProp(gameID, CopyInfo.ToPropType(request.PropType)); |
|
|
|
|
|
boolRes.ActSuccess = true; |
|
|
return Task.FromResult(boolRes); |
|
|
return Task.FromResult(boolRes); |
|
|
} |
|
|
} |
|
|
public override Task<BoolRes> ThrowProp(PropMsg request, ServerCallContext context) |
|
|
public override Task<BoolRes> ThrowProp(PropMsg request, ServerCallContext context) |
|
|
@@ -437,7 +438,8 @@ namespace Server |
|
|
#endif |
|
|
#endif |
|
|
BoolRes boolRes = new(); |
|
|
BoolRes boolRes = new(); |
|
|
var gameID = communicationToGameID[request.PlayerId]; |
|
|
var gameID = communicationToGameID[request.PlayerId]; |
|
|
//boolRes.ActSuccess = game.ThrowProp(gameID, CopyInfo.ToPropType(request.PropType)); |
|
|
|
|
|
|
|
|
game.ThrowProp(gameID, CopyInfo.ToPropType(request.PropType)); |
|
|
|
|
|
boolRes.ActSuccess = true; |
|
|
return Task.FromResult(boolRes); |
|
|
return Task.FromResult(boolRes); |
|
|
} |
|
|
} |
|
|
public override Task<BoolRes> UseSkill(SkillMsg request, ServerCallContext context) |
|
|
public override Task<BoolRes> UseSkill(SkillMsg request, ServerCallContext context) |
|
|
@@ -447,7 +449,7 @@ namespace Server |
|
|
#endif |
|
|
#endif |
|
|
BoolRes boolRes = new(); |
|
|
BoolRes boolRes = new(); |
|
|
var gameID = communicationToGameID[request.PlayerId]; |
|
|
var gameID = communicationToGameID[request.PlayerId]; |
|
|
//boolRes.ActSuccess = game.UseActiveSkill(gameID, CopyInfo.ToPropType(request.PropType)); |
|
|
|
|
|
|
|
|
boolRes.ActSuccess = game.UseActiveSkill(gameID, request.SkillId); |
|
|
return Task.FromResult(boolRes); |
|
|
return Task.FromResult(boolRes); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@@ -629,7 +631,7 @@ namespace Server |
|
|
|
|
|
|
|
|
if (options.Url != DefaultArgumentOptions.Url && options.Token != DefaultArgumentOptions.Token) |
|
|
if (options.Url != DefaultArgumentOptions.Url && options.Token != DefaultArgumentOptions.Token) |
|
|
{ |
|
|
{ |
|
|
//this.httpSender = new HttpSender(options.Url, options.Token, "PUT"); |
|
|
|
|
|
|
|
|
this.httpSender = new HttpSender(options.Url, options.Token, "PUT"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|