private void OnToolLoadClick(object sender, EventArgs e) { var dialog = new OpenFileDialog(); if (dialog.Run(ParentWindow)) { StateInfoList newList = null; using (var fileStream = File.Open(dialog.FileName, FileMode.Open, FileAccess.Read)) { Stream stream; if (Helper.IsGZip(fileStream)) { stream = Helper.GetUnGZipStrem(fileStream); } else { stream = fileStream; } newList = Serialization.Deserialize(stream) as StateInfoList; stream.Close(); } var form = new ToolWindow(); form.Label.Text = Path.GetFileNameWithoutExtension(dialog.FileName); form.Target = new LogList() { ListSource = newList }; form.Mode = ToolShowMode.Dialog; form.Show(this, new Point(0, 0)); } }
public Task Update() { _frameCount++; MOMsg notify = new MOMsg(); notify.ActionId = 100010; S2C100010 content = new S2C100010(); content.FrameCount = _frameCount; if (_commands.Count != 0) { List <CommandInfo> commands = new List <CommandInfo>(); while (_commands.Count != 0) { var command = _commands.Dequeue(); if (DoCommand(command)) { if (command.CommandId == (int)CommandType.Transform) { continue; } commands.Add(command); } } content.Commands.AddRange(commands); } StateInfoList stateList = new StateInfoList(); foreach (var player in _players) { var transform = new TransformInfo(); transform.Position = new MsgVector3() { X = player.Value.Position.X, Y = player.Value.Position.Y, Z = player.Value.Position.Z }; transform.Rotation = new MsgVector3() { X = player.Value.Rotate.X, Y = player.Value.Rotate.Y, Z = player.Value.Rotate.Z }; stateList.StateInfos.Add(new StateInfo() { UserId = player.Key, BloodValue = player.Value.CurBlood, KillCount = player.Value.KillCount, DeadCount = player.Value.DeadCount, Transform = transform }); } content.CommandResult = stateList.ToByteString(); notify.Content = content.ToByteString(); foreach (var player in _players) { if (player.Value.CurBlood == 0) { player.Value.Reset(); } } RoomNotify(notify); return(Task.CompletedTask); }