public virtual void UpdateKeyBoard(KeyboardState keys, float dt) { if (keys[Key.F5]) { lock (data) { long size = 50000; if (stream != null) { size = stream.Length; stream.Close(); stream = null; } stream = new MemoryStream((int)size); formater.Serialize(stream, data); } } else if (keys[Key.F6] && stream != null) { lock (data) { stream.Seek(0, SeekOrigin.Begin); data = (SuperMeleeData)formater.Deserialize(stream); this.data.GetNewShip = new GetNewShip(GetNewShip); } } else { foreach (IPlayerControler controler in data.controlers) { controler.SetKeyboardState(keys); } } }
public void DrawGraphics(Size s) { if (player1count == -1) { player1count = this.player1ShipSelection.ShipsLeft; player2count = this.player2ShipSelection.ShipsLeft; } float width = 6; float screenWidth = (float)Video.Screen.Width; float margin = .3f; float offset = screenWidth * margin; float length = screenWidth * (1 - (2 * margin)); Gl.glTranslatef(0, width * 1.5f, 0); SuperMeleeData.SetColor(SuperMeleeData.teamcolors[1]); DrawFilledBox(length * ((float)this.player1ShipSelection.ShipsLeft / (float)player1count), width); DrawBox(length, width); Gl.glTranslatef(0, -width * 1.5f, 0); SuperMeleeData.SetColor(SuperMeleeData.teamcolors[2]); DrawFilledBox(length * ((float)this.player2ShipSelection.ShipsLeft / (float)player2count), width); DrawBox(length, width); data.DrawGraphics(s); }