//GameObjectPacket private static void HandlePacket(GameObjectPacket packet) { var type = packet.Type; var id = packet.Id; var another = packet.AnotherFollowing; var deleted = packet.Deleted; var json = ""; if (!deleted) { json = packet.Data; } switch (type) { case GameObjectType.Map: //Handled in a different packet break; case GameObjectType.Tileset: var obj = new TilesetBase(id); obj.Load(json); TilesetBase.Lookup.Set(id, obj); if (Globals.HasGameData && !another) { Globals.ContentManager.LoadTilesets(TilesetBase.GetNameList()); } break; case GameObjectType.Event: //Clients don't store event data, im an idiot. break; default: var lookup = type.GetLookup(); if (deleted) { lookup.Get(id).Delete(); } else { lookup.DeleteAt(id); var item = lookup.AddNew(type.GetObjectType(), id); item.Load(json); } break; } }
private static void ProcessLoading() { if (Globals.Me == null || Globals.Me.MapInstance == null) { return; } if (!_loadedTilesets && Globals.HasGameData) { Globals.ContentManager.LoadTilesets(TilesetBase.GetNameList()); _loadedTilesets = true; } Audio.PlayMusic(MapInstance.Get(Globals.Me.CurrentMap).Music, 3, 3, true); Globals.GameState = GameStates.InGame; Fade.FadeIn(); }