Exemplo n.º 1
0
    private IEnumerator StartGenCoroutine(string fileToGen)
    {
        yield return(new WaitForSeconds(1.5f));

        LoadScene.Instance.ChangeScene();
        UpdateTrainingCommand();
        PythonThread.ExecuteCommand(_commands[0]);
        MapReader.GM.InitMap(fileToGen);
    }
Exemplo n.º 2
0
    /// <summary>
    /// Button method to continue to the next step of the input.
    /// If load mode goes to the file selected.
    /// If generation mode, calls the python thread to execute the command with the
    /// proper variables
    /// </summary>
    public void OnClickContinue()
    {
        string text = " ";

        if (_generationMode)
        {
            string fileToGen = "";
            if (_mlMode)
            {
                fileToGen = _fileNameNGrams;
                text      = "GENERATING NGRAMS";
            }
            else
            {
                fileToGen = _fileNameRNN;
                text      = "GENERATING RNN";
            }
            if (arrFiles.Count > 0)
            {
                if (_gOp != GenerateOptions.TRAIN)
                {
                    LoadScene.Instance.ActiveLoadObject();
                    SendCommand();
                    LoadScene.Instance.GetCommands(_commands);
                    LoadScene.Instance.SetLoadText(text);
                    LoadScene.Instance.StartFadeIn("SampleScene", fileToGen);
                }
                else
                {
                    int    nFiles = GetFilesSelectedLength();
                    string concat = "";

                    for (int i = 0; i < nFiles; i++)
                    {
                        string file    = GetFilesToConcatInput()[i];
                        string sufix   = ".csv";
                        string concatS = "..\\Maps\\" + file + sufix;
                        concat = concat + " " + concatS;
                    }

                    string interpolation = "0";
                    if (_makeInterpolation)
                    {
                        interpolation = "1 " + _interpolationProbs;
                    }

                    string debug     = "";
                    bool   debugMode = GetCheckBoxActive();
                    if (debugMode)
                    {
                        debug = " -d";
                    }
                    if (_mlMode)
                    {
                        PythonThread.ExecuteCommand("/C python TrainNGrams.py " + nFiles.ToString() + concat + " " + _nGramsInput + " " + interpolation + " " + debug);
                    }
                    else
                    {
                        string concatLayers = "";
                        for (int i = 0; i < _layersArr.Count; i++)
                        {
                            string file    = _layersArr[i];
                            string concatS = file;
                            concatLayers = concatLayers + " " + concatS;
                        }
                        PythonThread.ExecuteCommand("/C python TrainNN_2.py " + nFiles.ToString() + concat /*ESTO ES PARA LO DE MEZCLA DE ARCHIVOS nFiles.ToString() + concat +*/ + " " + _seqLengthInput + " " + _bufferSizeInput + " " + _embedDimInput + " " + _nnUnitsInput + " " + _epochsInput + " "
                                                    + _layersArr.Count + " " + concatLayers + " " + _temperatureInput + " " + debug);
                    }
                    GameManager.GM.ChangeScene(GameManager.SceneFlow.CURRENT);
                }
            }
        }
        else
        {
            if (arrFiles.Count == 1)
            {
                text = "MAP: " + arrFiles[0];
                //PythonThread.ExecuteCommand();
                LoadScene.Instance.ActiveLoadObject();
                LoadScene.Instance.SetLoadText(text);
                LoadScene.Instance.StartFadeIn("SampleScene", "");
                MapReader.GM.InitMap(arrFiles[0], false);
                LoadScene.Instance.ChangeScene();
            }
        }
    }
Exemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        if (_start)
        {
            if (_moveImage.GetComponent <MoveImage>().HasFinishedMovement())
            {
                if (_change)
                {
                    if (!_resetText)
                    {
                        this.transform.GetChild(0).GetChild(1).GetComponent <UnityEngine.UI.Text>().text = _text;
                        _resetText = true;
                    }
                    Color tmp2 = _internalImage.transform.GetChild(1).GetComponentInChildren <UnityEngine.UI.Text>().color;
                    tmp2.a += 0.08f;
                    _internalImage.transform.GetChild(1).GetComponentInChildren <UnityEngine.UI.Text>().color = tmp2;
                    if (_internalImage.transform.GetChild(1).GetComponentInChildren <UnityEngine.UI.Text>().color.a > 1.5f)
                    {
                        _start = false;
                        if (!_coroutine && _fileToGen != "")
                        {
                            if (_commands.Count > 1)
                            {
                                PythonThread.ExecuteCommand(_commands[1]);
                                //PythonThread.ExecuteCommand("/C python GenerateNGrams.py ..\\NGramsTraining\\20200528_112114_Training_Ngrams.pkl 250 ..\\Maps\\25.csv");
                            }
                            StartCoroutine(StartGenCoroutine(_fileToGen));
                            _coroutine = false;
                        }
                    }

                    /*if (!_resetText && _internalImage.transform.GetChild(1).GetComponentInChildren<UnityEngine.UI.Text>().color.a > 0)
                     * {
                     *  Color tmp = _internalImage.transform.GetChild(1).GetComponentInChildren<UnityEngine.UI.Text>().color;
                     *  tmp.a -= 0.01f;
                     *  _internalImage.transform.GetChild(1).GetComponentInChildren<UnityEngine.UI.Text>().color = tmp;
                     *  Debug.Log("ALPHA: " + _internalImage.transform.GetChild(1).GetComponentInChildren<UnityEngine.UI.Text>().color.a);
                     * }
                     * if (!_resetText && _internalImage.transform.GetChild(1).GetComponentInChildren<UnityEngine.UI.Text>().color.a <= 0)
                     * {
                     *  _start = false;
                     *  Color tmp2 = _internalImage.transform.GetChild(1).GetComponentInChildren<UnityEngine.UI.Text>().color;
                     *  tmp2.a = 0f;
                     *  _internalImage.transform.GetChild(1).GetComponentInChildren<UnityEngine.UI.Text>().color = tmp2;
                     *  _resetText = true;
                     *  SetLoadText(_text);
                     * }
                     * else
                     * {
                     *  Color tmp2 = _internalImage.transform.GetChild(1).GetComponentInChildren<UnityEngine.UI.Text>().color;
                     *  tmp2.a += 0.01f;
                     *  _internalImage.transform.GetChild(1).GetComponentInChildren<UnityEngine.UI.Text>().color = tmp2;
                     *  if (_internalImage.transform.GetChild(1).GetComponentInChildren<UnityEngine.UI.Text>().color.a > 1.5f && _fileToGen != "")
                     * }*/
                }
                else
                {
                    // Debug.Log("AA");
                    Color tmp = _internalImage.transform.GetChild(1).GetComponentInChildren <UnityEngine.UI.Text>().color;
                    tmp.a -= 0.01f;
                    _internalImage.transform.GetChild(1).GetComponentInChildren <UnityEngine.UI.Text>().color = tmp;
                    if (tmp.a <= 0)
                    {
                        _start = false;
                        _internalImage.gameObject.SetActive(false);
                    }
                }
            }
            else
            {
                Color tmp = _internalImage.transform.GetChild(1).GetComponentInChildren <UnityEngine.UI.Text>().color;
                tmp.a -= 0.01f;
                _internalImage.transform.GetChild(1).GetComponentInChildren <UnityEngine.UI.Text>().color = tmp;
                if (_internalImage.transform.GetChild(1).GetComponentInChildren <UnityEngine.UI.Text>().color.a <= 0)
                {
                }
            }
        }
        //Debug.Log("START: " + _start + "       CHANGESCENE: " + _canChangeScene);
        if (!_start && _canChangeScene && _moveImage.GetComponent <MoveImage>().CanStartLoading())
        {
            GameManager.GM.ChangeScene(GameManager.SceneFlow.NEXT);
            _canChangeScene = false;
            //GameCamera.Instance.GoToBlueScreen();
        }
    }