Beispiel #1
0
        public LoadAndSaveMenu(bool a_willSave, States a_backState)
        {
            m_willSave = a_willSave;
            m_backState = a_backState;
            m_newSaveName = new TextField(new Vector2(400, 100), 200, 32, true, true, true, 20);
            m_newSaveName.setVisible(false);

            TextButton t_slot1 = new TextButton(new Vector2(450, 350), "Slot 1", "MotorwerkLarge", m_normal, m_hover, m_pressed, m_toggle);
            m_buttons.AddLast(t_slot1);
            TextButton t_slot2 = new TextButton(new Vector2(500, 410), "Slot 2", "MotorwerkLarge", m_normal, m_hover, m_pressed, m_toggle);
            m_buttons.AddLast(t_slot2);
            TextButton t_slot3 = new TextButton(new Vector2(550, 470), "Slot 3", "MotorwerkLarge", m_normal, m_hover, m_pressed, m_toggle);
            m_buttons.AddLast(t_slot3);

            updateSaveText();

            foreach (TextButton f_b in m_buttons)
            {
                if (m_willSave)
                {
                    f_b.m_clickEvent += new TextButton.clickDelegate(saveProgressClick);
                }
                else
                {
                    f_b.m_clickEvent += new TextButton.clickDelegate(loadProgressClick);
                }
            }

            m_backButton = new TextButton(new Vector2(20, Game.getInstance().getResolution().Y - 120), "Back", "MotorwerkLarge", m_normal, m_hover, m_pressed, m_toggle);
            m_buttons.AddLast(m_backButton);
            m_backButton.m_clickEvent += new TextButton.clickDelegate(backTo);
        }
Beispiel #2
0
 public Cutscene(States a_backState, String[] a_commands)
 {
     m_backState = a_backState;
     m_comDone = 0;
     m_commands = a_commands;
     m_waiting = false;
     m_guis = new Dictionary<int, GuiObject>();
     m_objects = new LinkedList<GameObject>();
     m_deleteList = new Stack<GameObject>();
 }
Beispiel #3
0
 public Cutscene(States a_backState, String a_sceneToLoad)
 {
     m_backState = a_backState;
     m_comDone = 0;
     m_filePath = Game.CUTSCENE_FOLDER + a_sceneToLoad;
     m_waiting = false;
     m_guis = new Dictionary<int, GuiObject>();
     m_objects = new LinkedList<GameObject>();
     m_deleteList = new Stack<GameObject>();
 }
Beispiel #4
0
 public static void updateState(States a_currentState)
 {
     m_state = a_currentState;
 }
Beispiel #5
0
 public static void createPlayer(Vector2 a_position)
 {
     if (Game.getInstance().getState().getPlayer() == null) {
         m_state = Game.getInstance().getState();
         Player t_player = new Player(m_state.getTileCoordinates(a_position), "Images//Sprite//Hero//hero_stand", 0.300f);
         m_state.setPlayer(t_player);
         m_state.addObject(t_player);
     }
 }
Beispiel #6
0
 public MapState(States a_backState)
 {
     m_backState = a_backState;
     m_colors = new Color[] { Color.White, new Color(122, 129, 211), new Color(37,45,128)};
     m_goals = new LinkedList<Vector2>();
 }
Beispiel #7
0
        protected override void Update(GameTime a_gameTime)
        {
            if (!IsActive)
            {
                return;
            }
            KeyboardHandler.setCurrentKeyboard(Keyboard.GetState());
            MouseHandler.setCurrentMouse(Mouse.GetState());
            m_currentGameTime = a_gameTime;
            if (m_nextProgress != null)
            {
                m_progress = m_nextProgress;
                m_nextProgress = null;
            }
            if (m_nextState != null)
            {
                m_currentState = m_nextState;
                AssetFactory.updateState(m_currentState);
                if (!m_currentState.isLoaded())
                {
                    #if DEBUG
                    m_currentState.load();
                    #else
                    try
                    {
                        m_currentState.load();
                    }
                    catch (Exception e)
                    {
                        ErrorLogger.getInstance().writeString("While loading " + m_currentState + " got exception: " + e);
                    }
                    #endif
                }
                m_nextState = null;
            }

            #if DEBUG
            if (m_currentState != null)
            {
                m_currentState.update(a_gameTime);
            }
            #else
            if (m_currentState != null)
            {
                try
                {
                    m_currentState.update(a_gameTime);
                }
                catch (Exception e)
                {
                    //ErrorLogger.getInstance().writeString("While updating " + m_currentState + " got exception: " + e);
                }
            }
            #endif

            if (KeyboardHandler.keyClicked(Keys.F7)) //TODO Alfa/Beta-grej
            {
                m_nextState = new MainMenu();
            }

            MouseHandler.setPreviousMouse();
            KeyboardHandler.setPreviousKeyboard();
            base.Update(a_gameTime);
        }
Beispiel #8
0
 protected override void Initialize()
 {
     ErrorLogger.getInstance().clearFile();
     ErrorLogger.getInstance().writeString("GrandLarceny initiated at "+System.DateTime.Now);
     #if DEBUG
     m_camera = new Camera();
     Loader.getInstance().loadGraphicSettings("Content//wtf//settings.ini");
     Loader.getInstance().loadSoundSettings("Content//wtf//settings.ini");
     m_camera.load();
     m_currentState = new MainMenu();
     m_currentState.load();
     base.Initialize();
     #else
     try
     {
         m_camera = new Camera();
         m_currentState = new MainMenu();
         m_currentState.load();
         base.Initialize();
     }
     catch (Exception e)
     {
         ErrorLogger.getInstance().writeString("While instantiating: " + e);
         ErrorLogger.getInstance().writeString("Terminating");
         Exit();
     }
     #endif
 }
Beispiel #9
0
 internal void setState(States a_newState)
 {
     m_nextState = a_newState;
 }
Beispiel #10
0
 public void setCutscene(String a_fileName)
 {
     if (File.Exists(CUTSCENE_FOLDER + a_fileName))
     {
         m_nextState = new Cutscene(m_currentState, a_fileName);
     }
     else
     {
         #if RELEASE
         ErrorLogger.getInstance().writeString("While setting cutscene, could not find " + CUTSCENE_FOLDER + a_fileName);
         #endif
     }
 }
Beispiel #11
0
        protected override void Update(GameTime a_gameTime)
        {
            if (!IsActive)
                return;
            m_currentKeyInput = Keyboard.GetState();
            m_currentMouse = Mouse.GetState();
            m_currentGameTime = a_gameTime;

            if (m_nextState != null)
            {
                m_currentState = m_nextState;
                if (!m_currentState.isLoaded())
                {
                    try
                    {
                        m_currentState.load();
                    }
                    catch (Exception e)
                    {
                        ErrorLogger.getInstance().writeString("While loading " + m_currentState + " got exception: " + e);
                    }
                }
                m_nextState = null;
            }

            if (m_currentState != null)
            {
                try
                {
                    m_currentState.update(a_gameTime);
                }
                catch (Exception e)
                {
                    ErrorLogger.getInstance().writeString("While updating " + m_currentState + " got exception: " + e);
                }
            }

            if (keyClicked(Keys.F7)) //Asså det här är ju inte ok
            {
                m_nextState = new MainMenu();
            }

            m_previousMouse = m_currentMouse;
            m_previousKeyInput = m_currentKeyInput;
            base.Update(a_gameTime);
        }
Beispiel #12
0
 protected override void Initialize()
 {
     ErrorLogger.getInstance().writeString("GrandLarceny initiated at "+System.DateTime.Now);
     try
     {
         m_camera = new Camera();
         m_currentState = new MainMenu();
         m_currentState.load();
         base.Initialize();
     }
     catch (Exception e)
     {
         ErrorLogger.getInstance().writeString("While instantiating: " + e);
         ErrorLogger.getInstance().writeString("Terminating");
         Exit();
     }
 }
Beispiel #13
0
 public void setCutscene(String a_fileName)
 {
     if (File.Exists(a_fileName))
     {
         m_nextState = new Cutscene(m_currentState, a_fileName);
     }
     else
     {
         ErrorLogger.getInstance().writeString("While setting cutscene, could not find " + a_fileName);
     }
 }