public override void DoAction(IEventArgs args) { var msg = GameOverMessage.Allocate(); msg.HallRoomId = args.GameContext.session.commonSession.RoomInfo.HallRoomId; FreeGameRule rule = (FreeGameRule)args.Rule; foreach (PlayerEntity player in args.GameContext.player.GetInitializedPlayerEntities()) { SimpleParable sp = new SimpleParable(); SimpleParaList paras = new SimpleParaList(); sp.SetList(paras); var gameOverPlayer = GameOverPlayer.Allocate(); paras.AddFields(new ObjectFields(gameOverPlayer)); gameOverPlayer.Id = player.playerInfo.PlayerId; args.Act(action, new TempUnit[] { new TempUnit("basic", sp) }); } }
public override void DoAction(IEventArgs args) { FreeGameRule rule = (FreeGameRule)args.Rule; if (type == 0) { rule.GameStartTime = rule.ServerTime; foreach (PlayerEntity player in args.GameContext.player.GetEntities()) { if (player.hasStatisticsData) { player.statisticsData.Statistics.GameJoinTime = rule.ServerTime; } SimpleProto sp = FreePool.Allocate(); sp.Key = FreeMessageConstant.PlaySound; sp.Ks.Add(1); sp.Ins.Add(args.GameContext.session.commonSession.RoomInfo.MapId); FreeMessageSender.SendMessage(player, sp); } } if (type == 1) { rule.GameEndTime = rule.ServerTime; foreach (PlayerEntity player in args.GameContext.player.GetEntities()) { if (player.hasStatisticsData && player.statisticsData.Statistics.GameJoinTime > 0) { player.statisticsData.Statistics.GameTime = (int)(rule.ServerTime - player.statisticsData.Statistics.GameJoinTime); } if (player.gamePlay.IsDead()) { player.statisticsData.Statistics.DeadTime += (int)(rule.ServerTime - player.statisticsData.Statistics.LastDeadTime); } } } }
public override void DoAction(IEventArgs args) { FreeGameRule free = (FreeGameRule)args.Rule; free.Reload(args.GameContext, this.rule); }