Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }