public WorldScreen(Game game, string name) : base(game, name) { Camera = new Camera(); _self = new Character { Camera = Camera }; _map = new Map(game, _self) { Camera = Camera }; }
public Map(Game game, Character character) { _game = game; _self = character; _entities = new List<Entity>(); _game.Connection.AddSubscriber(this); _chunks = new List<Chunk>(); }
public void OnSelectableCharacter(Packet packet) { var p = (SelectableCharacterPacket)packet; Out.Green(string.Format("Name: {0}, Id: {1}", p.Name, p.Id)); Character character = new Character { Name = p.Name, Id = p.Id }; Text text = new Text(colour: Color4.White, shadow: true, location: new PointF(600, _charCount * 75)); text.Camera = Camera; _characters.Add(character); _charTexts.Add(text); _deferralQueue.Enqueue(new QueuedFunction { Parameters = new List<object> { _charCount, character }, Function = (args) => text.Value = string.Format("{0} - level x something ({1})", args[1], args[0]) }); _deferralQueue.Enqueue(new QueuedFunction { Parameters = new List<object> { _charCount, p.Name, p.Id }, Function = args => _delButtons.Add(new Button(new PointF(300, (int)(args[0]) * 75), new SizeF(250, 100), "assets/gfx/buttons/options.png", () => PacketWriter.WritePacketAsync(new DeleteCharacterPacket { Id = (Guid)args[2], Name = (string)args[1] }, _game.Connection.Writer))) }); _charCount++; }