Exemple #1
0
        public Game1()
        {
            _graphics       = new GraphicsDeviceManager(this);
            ScreenRectangle = new Rectangle(
                0,
                0,
                ScreenWidth,
                ScreenHeight);
            IsMouseVisible = true;

            Content.RootDirectory = "Content";

            Components.Add(new InputHandler(this));

            _gameStateManager = new GameStateManager(this);
            Components.Add(_gameStateManager);

            _ = new TextureManager();

            TitleScreen              = new TitleScreen(this, _gameStateManager);
            StartMenuScreen          = new StartMenuScreen(this, _gameStateManager);
            GamePlayScreen           = new GamePlayScreen(this, _gameStateManager);
            CharacterGeneratorScreen = new CharacterGeneratorScreen(this, _gameStateManager);
            SkillScreen              = new SkillScreen(this, _gameStateManager);
            LoadGameScreen           = new LoadGameScreen(this, _gameStateManager);
            ConversationScreen       = new ConversationScreen(this, _gameStateManager);
            ShopScreen      = new ShopState(this, _gameStateManager);
            InventoryScreen = new InventoryScreen(this, _gameStateManager);

            _gameStateManager.ChangeState(TitleScreen);

            IsFixedTimeStep = false;
            _graphics.SynchronizeWithVerticalRetrace = false;
        }
Exemple #2
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);

            graphics.PreferredBackBufferWidth  = screenWidth;
            graphics.PreferredBackBufferHeight = screenHeight;

            ScreenRectangle = new Rectangle(
                0,
                0,
                screenWidth,
                screenHeight);

            Content.RootDirectory = "Content";

            Components.Add(new InputHandler(this));

            stateManager = new GameStateManager(this);
            Components.Add(stateManager);

            TitleScreen              = new TitleScreen(this, stateManager);
            StartMenuScreen          = new StartMenuScreen(this, stateManager);
            GamePlayScreen           = new GamePlayScreen(this, stateManager);
            CharacterGeneratorScreen = new CharacterGeneratorScreen(this, stateManager);
            LoadGameScreen           = new LoadGameScreen(this, stateManager);
            SkillScreen              = new GameScreens.SkillScreen(this, stateManager);

            stateManager.ChangeState(TitleScreen);

            this.IsFixedTimeStep = false;
            graphics.SynchronizeWithVerticalRetrace = false;
        }
Exemple #3
0
    private void Start()
    {
        PlayerController _playerController = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>();

        m_InterfaceObj = GameObject.FindGameObjectWithTag("Interface");
        m_UIManager    = FindObjectOfType <UIManager>();

        GameObject InventoryObj = Resources.Load("UI/Inventory") as GameObject;

        m_InventoryBtnObj      = Instantiate(InventoryObj, m_InterfaceObj.transform);
        m_InventoryBtnObj.name = InventoryObj.name;
        m_InventoryBtnObj.SetActive(false);

        GameObject skillObj = Resources.Load("UI/Skill") as GameObject;

        _skillBtnObj      = Instantiate(skillObj, m_InterfaceObj.transform);
        _skillBtnObj.name = skillObj.name;
        m_SkillScreen     = _skillBtnObj.GetComponent <SkillScreen>();
        m_SkillScreen.Init(_playerController);
        _skillBtnObj.SetActive(false);

        m_UIManager.Save(m_InventoryBtnObj.GetComponent <Inventory>(), _playerController.m_PlayerAbility);
    }
        public Game1()
        {
            _graphics       = new GraphicsDeviceManager(this);
            ScreenRectangle = new Rectangle(
                0,
                0,
                ScreenWidth,
                ScreenHeight);

            Content.RootDirectory = "Content";

            Components.Add(new InputHandler(this));

            _gameStateManager = new GameStateManager(this);
            Components.Add(_gameStateManager);

            TitleScreen              = new TitleScreen(this, _gameStateManager);
            StartMenuScreen          = new StartMenuScreen(this, _gameStateManager);
            GamePlayScreen           = new GamePlayScreen(this, _gameStateManager);
            CharacterGeneratorScreen = new CharacterGeneratorScreen(this, _gameStateManager);
            SkillScreen              = new SkillScreen(this, _gameStateManager);

            _gameStateManager.ChangeState(TitleScreen);
        }
        /// <summary>
        /// Show a child screen
        /// </summary>
        /// <param name="Child">The screen to show</param>
        public void ShowChildScreen(ChildScreen Child)
        {
            switch (Child)
            {
            case ChildScreen.DataInputRaceScreen:
            {
                //if the screen is already up, don't try to bring it up again, just pull it to the foreground
                if (DataInputRaceScreenVisible == true)
                {
                    DataInputRaceScreen.BringToFront();
                }
                else
                {
                    DataInputRaceScreen = new DataInputRaceScreenClass();
                    DataInputRaceScreen.Show();
                }
                DataInputRaceScreenVisible = true;
                break;
            }

            case ChildScreen.DataInputClassScreen:
            {
                //if the screen is already up, don't try to bring it up again, just pull it to the foreground
                if (DataInputClassScreenVisible == true)
                {
                    DataInputClassScreen.BringToFront();
                }
                else
                {
                    DataInputClassScreen = new DataInputClassScreenClass();
                    DataInputClassScreen.Show();
                }
                DataInputClassScreenVisible = true;
                break;
            }

            case ChildScreen.DataInputCharacterScreen:
            {
                //if the screen is already up, don't try to bring it up again, just pull it to the foreground
                if (DataInputCharacterScreenVisible == true)
                {
                    DataInputCharacterScreen.BringToFront();
                }
                else
                {
                    DataInputCharacterScreen = new DataInputCharacterScreenClass();
                    DataInputCharacterScreen.Show();
                }
                DataInputCharacterScreenVisible = true;
                break;
            }

            case ChildScreen.DataInputFeatScreen:
            {
                //if the screen is already up, don't try to bring it up again, just pull it to the foreground
                if (DataInputFeatScreenVisible == true)
                {
                    DataInputFeatScreen.BringToFront();
                }
                else
                {
                    DataInputFeatScreen = new DataInputFeatScreenClass();
                    DataInputFeatScreen.Show();
                }
                DataInputFeatScreenVisible = true;
                break;
            }

            case ChildScreen.DataInputSpellScreen:
            {
                //if the screen is already up, don't try to bring it up again, just pull it to the foreground
                if (DataInputSpellScreenVisible == true)
                {
                    DataInputSpellScreen.BringToFront();
                }
                else
                {
                    DataInputSpellScreen = new DataInputSpellScreenClass();
                    DataInputSpellScreen.Show();
                }
                DataInputSpellScreenVisible = true;
                break;
            }

            case ChildScreen.DataInputEnhancementScreen:
            {
                //if the screen is already up, don't try to bring it up again, just pull it to the foreground
                if (DataInputEnhancementScreenVisible == true)
                {
                    DataInputEnhancementScreen.BringToFront();
                }
                else
                {
                    DataInputEnhancementScreen = new DataInputEnhancementScreenClass();
                    DataInputEnhancementScreen.Show();
                }
                DataInputEnhancementScreenVisible = true;
                break;
            }

            case ChildScreen.DataInputTomeScreen:
            {
                //if the screen is already up, don't try to bring it up again, just pull it to the foreground
                if (DataInputTomeScreenVisible == true)
                {
                    DataInputTomeScreen.BringToFront();
                }
                else
                {
                    DataInputTomeScreen = new DataInputTomeScreenClass();
                    DataInputTomeScreen.Show();
                }
                DataInputTomeScreenVisible = true;
                break;
            }

            case ChildScreen.PastLifeEditScreen:
            {
                if (PastLifeEditScreenVisible == true)
                {
                    PastLifeScreen.BringToFront();
                }
                else
                {
                    PastLifeScreen = new PastLifeEditScreen();
                    PastLifeScreen.Show();
                }
                PastLifeEditScreenVisible = true;
                break;
            }

            case ChildScreen.SkinEditorScreen:
            {
                //if the screen is already up, don't try to bring it up again, just pull it to the foreground
                if (SkinEditorScreenVisible == true)
                {
                    SkinEditorScreen.BringToFront();
                }
                else
                {
                    SkinEditorScreen = new SkinEditorScreenClass();
                    SkinEditorScreen.Show();
                }
                SkinEditorScreenVisible = true;
                break;
            }

            case ChildScreen.SkillEditScreen:
            {
                if (SkillEditScreenVisible == true)
                {
                    SkillScreen.BringToFront();
                }
                else
                {
                    SkillScreen = new SkillEditScreen();
                    SkillScreen.Show();
                }
                SkillEditScreenVisible = true;
                break;
            }

            case ChildScreen.ClassEditScreen:
            {
                if (ClassEditScreenVisible == true)
                {
                    ClassScreen.BringToFront();
                }
                else
                {
                    ClassScreen = new ClassEditScreen();
                    ClassScreen.Show();
                }
                ClassEditScreenVisible = true;
                break;
            }

            case ChildScreen.AbilityEditScreen:
            {
                if (AbilityEditScreenVisible == true)
                {
                    AbilityScreen.BringToFront();
                }
                else
                {
                    AbilityScreen = new AbilityEditPanel();
                    AbilityScreen.Show();
                }
                AbilityEditScreenVisible = true;
                break;
            }

            case ChildScreen.SkillTomeEditScreen:
            {
                if (SkillTomeScreenVisible == true)
                {
                    SkillTomeScreen.BringToFront();
                }
                else
                {
                    SkillTomeScreen = new SkillTomePanel();
                    SkillTomeScreen.Show();
                }
                SkillTomeScreenVisible = true;
                break;
            }

            case ChildScreen.AlignmentEditForm:
            {
                if (AlignmentScreenVisible == true)
                {
                    AlignmentScreen.BringToFront();
                }
                else
                {
                    AlignmentScreen = new AlignmentEditForm();
                    AlignmentScreen.Show();
                }
                AlignmentScreenVisible = true;
                break;
            }
            }
        }