Пример #1
0
		public Game(int conns)
		{
			ClientManager = new GameClientManager(conns);
			if (PhoenixEnvironment.GetConfig().data["client.ping.enabled"] == "1")
			{
				ClientManager.StartConnectionChecker();
			}
			DateTime Now = DateTime.Now;
			Logging.Write("Connecting to database...");
			using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
			{
				Logging.WriteLine("completed!");
				PhoenixEnvironment.GameInstance = this;
				LoadSettings(adapter);
				BanManager = new ModerationBanManager();
				RoleManager = new RoleManager();
				HelpTool = new HelpTool();
				Catalog = new Catalog();
				Navigator = new Navigator();
				ItemManager = new ItemManager();
				RoomManager = new RoomManager();
				AdvertisementManager = new AdvertisementManager();
				PixelManager = new PixelManager();
				AchievementManager = new AchievementManager();
				ModerationTool = new ModerationTool();
				BotManager = new BotManager();
				Marketplace = new Marketplace();
				QuestManager = new QuestManager();
				TextManage = new TextManager();
                Guilds = new GroupManager();
				TextManager.LoadTexts(adapter);
				BanManager.LoadBans(adapter);
                RoleManager.LoadRoles(adapter);
				HelpTool.LoadCategories(adapter);
				HelpTool.LoadTopics(adapter);
				ModerationTool.LoadMessagePresets(adapter);
				ModerationTool.LoadPendingTickets(adapter);
				ItemManager.LoadItems(adapter);
				Catalog.Initialize(adapter);
				Catalog.InitCache();
				Navigator.Initialize(adapter);
				RoomManager.LoadModels(adapter);
				RoomManager.LoadCache();
				NavigatorCache = new NavigatorCache();
				AdvertisementManager.LoadRoomAdvertisements(adapter);
				BotManager.LoadBots(adapter);
				AchievementManager.LoadAchievements(adapter);
				PixelManager.Start();
				ChatCommandHandler.InitFilter(adapter);
				QuestManager.InitQuests();
				GroupManager.LoadGroups(adapter);
				DatabaseCleanup(adapter, 1);
			}
			Task = new Task(new Action(LowPriorityWorker.Process));
			Task.Start();
		}
Пример #2
0
		public void Destroy()
		{
			if (Task != null)
			{
				Task = null;
			}
			using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
			{
				DatabaseCleanup(adapter, 0);
			}
			if (GetClientManager() != null)
			{
				GetClientManager().Clear();
				GetClientManager().StopConnectionChecker();
			}
			if (GetPixelManager() != null)
			{
				PixelManager.KeepAlive = false;
			}
			ClientManager = null;
			BanManager = null;
			RoleManager = null;
			HelpTool = null;
			Catalog = null;
			Navigator = null;
			ItemManager = null;
			RoomManager = null;
			AdvertisementManager = null;
			PixelManager = null;
		}