/*
 * Copyright (C) 2013 Snowsun <http://wyrez.org> and contributors
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
package org.wyrez.shootingstars.states;

import com.jme3.app.state.AbstractAppState;
import com.jme3.app.state.AppStateManager;
import org.wyrez.shootingstars.game.GameSettings;
import org.wyrez.shootingstars.gui.FileMetaInfoGUI;
import org.wyrez.shootingstars.gui.Gui;
import org.wyrez.shootingstars.gui.listener.FileMetaInfoListener;
import org.wyrez.shootingstars.helper.ScreenHelper;
import tonegod.gui.core.Screen;

/**
 *
 * @author Snowsun
 */
public class FileMetaInfoState extends AbstractAppState implements FileMetaInfoListener {

    private StateManager stateManager;
    private Gui gui;
    
    public FileMetaInfoState(Screen screen, StateManager stateManager, GameSettings settings, ScreenHelper screenHelper) {
        this.stateManager = stateManager;
        this.gui = new FileMetaInfoGUI(screen, this, settings, screenHelper);
    }
    
    public void startLoading() {
        stateManager.setState(State.LOADING);
    }

    public void cancel() {
        stateManager.setState(State.MENU);
    }

    @Override
    public void stateAttached(AppStateManager stateManager) {
        gui.refresh();
        gui.attach();
    }

    @Override
    public void stateDetached(AppStateManager stateManager) {
        gui.detach();
    }
}
