Ejemplo n.º 1
0
    private string message;                             // Invalid file message

    // Start is called before the first frame update
    void Start()
    {
        // Get the reference to the GameFilesHandler game object
        GameObject game_files = GameObject.FindGameObjectWithTag("GameFiles");

        files_handler = game_files.GetComponent <GameFilesHandler>();
    }
    GameObject menu_panel = default;        // Reference to return panel

    private void Awake()
    {
        modal_panel = ModalPanel.Instance();
        // Get the reference to the GameFilesHandler game object
        GameObject game_files = GameObject.FindGameObjectWithTag("GameFiles");

        files_handler = game_files.GetComponent <GameFilesHandler>();
    }
    private List <GameObject> buttons_list;             //Buttons list

    private void Awake()
    {
        buttons_list = new List <GameObject>();
        GameObject game_files = GameObject.FindGameObjectWithTag("GameFiles");

        files_handler = game_files.GetComponent <GameFilesHandler>();
        Debug.Log("GameListController: Game Files Handler Found");
    }
    private void Start()
    {
        // Player attributes initialization
        target = null;

        // Undo attributes initialization
        undo_list      = new List <PlayState>();
        undo_index     = 0;
        list_size      = 1048576;
        moved_flag     = false;
        undo_flag      = false;
        updating_score = false;

        // Structure references initialization
        particles = StructureInitialization.residues_structure;
        bonds     = StructureInitialization.bonds_structure;
        n_mol     = StructureInitialization.n_mol;
        sequence  = StructureInitialization.sequence;

        // Display references initialization
        score_display            = score_text.gameObject;
        parameters_display       = parameters_text.gameObject;
        score_toggle_button      = toggle_score;
        parameters_toggle_button = toggle_parameters;

        // Get the reference to the GameFilesHandler game object
        GameObject game_files = GameObject.FindGameObjectWithTag("GameFiles");

        files_handler = game_files.GetComponent <GameFilesHandler>();
        //  Check if there is a settings file saved
        if (files_handler.settingsFileExists(GameFilesHandler.Display_file))
        {
            Debug.Log("PlayerController: Display file found!");
            // Load settings saved in previous use
            files_handler.loadSettings(GameFilesHandler.Display_file);
        }
        else
        {
            Debug.Log("PlayerController: Display file NOT found!");
        }

        // Call initializeGame function in the next frame.
        Invoke("initializeGame", 0);
    }
 /// <summary>
 /// Go to input/keyboard if the saved files limit isn't reached.
 /// </summary>
 public void testLimit()
 {
     if (GameFilesHandler.countSavesFolder() < GameFilesHandler.Saves_limit)
     {
         // Hide Save Menu
         save_panel.SetActive(false);
         // Show Input Panel
         input_panel.SetActive(true);
         // Set Input text message
         input_panel.GetComponent <InputPanelSetText>().setInputText("Entry the file name:");
         //Show Keyboard
         keyboard_container.SetActive(true);
     }
     else
     {
         // Show Error message
         Debug.Log("Save files limit reached!");
         gameObject.GetComponent <NotifySaveFilesLimit>().notifySaveFilesLimit("Can't Save:\nSave files limit reached!\nRemove some save file and try again.");
     }
 }
Ejemplo n.º 6
0
    private GameFilesHandler files_handler;         // Game Files Handler reference.


    // Start is called before the first frame update.
    // Runs before PlayerController initializeGame()
    private void Start()
    {
        // Get the reference to the GameFilesHandler game object
        GameObject game_files = GameObject.FindGameObjectWithTag("GameFiles");

        files_handler = game_files.GetComponent <GameFilesHandler>();

        // New Game Structure initialization
        if (!string.IsNullOrEmpty(PlayerPrefs.GetString(GameFilesHandler.New_game)))
        {
            string file_name = PlayerPrefs.GetString(GameFilesHandler.New_game);

            // Get the name of the original protein file and set a reference name
            origin_name = Path.GetFileNameWithoutExtension(file_name);

            // Read data in a Txt file to a string
            string read_data = files_handler.readTxtFile(file_name);
            // Check the string generated and loads only the necessary data to build a structure
            if (!string.IsNullOrEmpty(read_data))
            {
                loadInput(read_data);
                buildStructure();
            }
        }
        // Saved Game Structure initialization
        else if (!string.IsNullOrEmpty(PlayerPrefs.GetString(GameFilesHandler.Saved_game)))
        {
            string file_name = PlayerPrefs.GetString(GameFilesHandler.Saved_game);
            files_handler.loadGame(file_name);
            loadStructure();
        }
        else
        {
            Debug.Log("StructureInitialization Error: No File Loaded!");
        }
    }