public void Initialize() { String PathToUse = "GameData"; if (!System.IO.Directory.Exists(PathToUse)) { PathToUse = "../../GameData"; if (!System.IO.Directory.Exists(PathToUse)) { PathToUse = "../../../../RockBlaster/GameData"; if (!System.IO.Directory.Exists(PathToUse)) { } } } var DataFolderTree = new DataAssetTree(PathToUse); DataAssetCache.Instance.SetAssetTree(DataFolderTree); Entity.GameWidth = (int)Width; Entity.GameHeight = (int)Height; mainMenu = new MainMenu(BoundsRelativeToParent); AddChild(mainMenu); mainMenu.SendToBack(); mainMenu.StartGame += new MainMenu.StartGameEventHandler(StartGame); mainMenu.ShowCredits += new MainMenu.ShowCreditsEventHandler(ShowCredits); mainMenu.ExitGame += new MainMenu.ExitGameEventHandler(ExitGame); howManyPlayersMenu = new HowManyPlayersMenu(BoundsRelativeToParent); AddChild(howManyPlayersMenu); howManyPlayersMenu.SendToBack(); howManyPlayersMenu.StartOnePlayerGame += new HowManyPlayersMenu.StartOnePlayerGameEventHandler(StartOnePlayerGame); howManyPlayersMenu.StartTwoPlayerGame += new HowManyPlayersMenu.StartTwoPlayerGameEventHandler(StartTwoPlayerGame); howManyPlayersMenu.StartFourPlayerGame += new HowManyPlayersMenu.StartFourPlayerGameEventHandler(StartFourPlayerGame); howManyPlayersMenu.CancelMenu += new HowManyPlayersMenu.CancelMenuEventHandler(BackToMainMenu); creditsMenu = new CreditsMenu(BoundsRelativeToParent); AddChild(creditsMenu); creditsMenu.SendToBack(); creditsMenu.CancelMenu += new CreditsMenu.CancelMenuEventHandler(BackToMainMenu); playfield = new PlayfieldView(BoundsRelativeToParent); AddChild(playfield); playfield.SendToBack(); playfield.Menu += new PlayfieldView.MenuEventHandler(EndGame); playfield.Visible = false; MakeMenuVisibleHideOthers(mainMenu); }
public override void OnInitialize() { base.OnInitialize(); String PathToUse = "GameData"; if (!System.IO.Directory.Exists(PathToUse)) { PathToUse = "../../GameData"; if (!System.IO.Directory.Exists(PathToUse)) { PathToUse = "../../../../CTFA/GameData"; if (!System.IO.Directory.Exists(PathToUse)) { } } } DataAssetTree DataFolderTree = new DataAssetTree(PathToUse); DataAssetCache.Instance.SetAssetTree(DataFolderTree); m_MainMenu = new MainMenu(Bounds); AddChild(m_MainMenu); m_MainMenu.SendToBack(); m_MainMenu.StartGame += new MainMenu.StartGameEventHandler(StartGame); m_MainMenu.ShowCredits +=new MainMenu.ShowCreditsEventHandler(ShowCredits); m_MainMenu.ExitGame += new MainMenu.ExitGameEventHandler(ExitGame); m_CreditsMenu = new CreditsMenu(Bounds); AddChild(m_CreditsMenu); m_CreditsMenu.SendToBack(); m_CreditsMenu.CancelMenu += new CreditsMenu.CancelMenuEventHandler(BackToMainMenu); m_Playfield = new PlayfieldView(Bounds); AddChild(m_Playfield); m_Playfield.SendToBack(); m_Playfield.Menu += new PlayfieldView.MenuEventHandler(EndGame); m_Playfield.Visible = false; Entity.GameWidth = (int)m_Playfield.BackgroundImage.Width(); Entity.GameHeight = (int)m_Playfield.BackgroundImage.Height(); MakeMenuVisibleHideOthers(m_MainMenu); }
public void SetAssetTree(DataAssetTree dataAssetTree) { m_DataAssetTree = dataAssetTree; }