public byte[][] Throw(Character player) { player.Num = new Random().Next(1, 7); return new byte[][] { DataType.Num.ToBinary(), player.Num.ToBinary() }; }
public byte[][] GetScore(Character player) { return new byte[][] { DataType.Score.ToBinary(), player.Gold.ToBinary() }; }
private void 处理_能进否(int id) { // todo: check... // 对于 能进否 来说,有如下条件: // 不超出游戏最大上限人数 // 把玩家加入列表 lock (_sync_players) { if (_currentStateHander.CanIJoinIt(_players.Count)) //人数是否已满 { if (!_players.ContainsKey(id)) { var player = new Character(); player.clientState = ClientStates.已发_能进否; //占位 _players.Add(id, new KeyValuePair<int, Character>(id, player)); //十秒未发送 要求进入,就删之 player.超时_进入超时 = GameLooper.Counter + 10; //回复可以进入 发出_能够进入(id); w.WL("玩家 " + id + "准备进入游戏" + Environment.NewLine); } else { //重复进入 发出_不能进入(id); } } } }