public IEnumerator ReturnNullIfPathIsNullDuringRemove()
        {
            SceneManager.LoadScene("Scene", LoadSceneMode.Single);
            yield return(new WaitForSeconds(1.0f));

            goA = SceneManager.GetActiveScene().GetRootGameObjects();
            GameObject   go  = goA[3].transform.Find("Save Load Menu").gameObject;
            SaveLoadMenu slm = go.GetComponent <SaveLoadMenu>();

            string[] paths = Directory.GetFiles(Application.persistentDataPath, "*.map");
            slm.SelectItem("");
            int MapCount = slm.listContent.childCount;

            slm.Delete();

            Assert.IsEmpty(slm.path);

            foreach (GameObject g in goA)
            {
                GameObject.Destroy(g);
            }
            GameObject.Destroy(go);
            GameObject.Destroy(slm);
            SceneManager.UnloadScene("Scene");
        }
Esempio n. 2
0
    private void Initialize()
    {
        calcInput        = connectedMenus.calcInput;
        boundsManager    = connectedMenus.boundsManager;
        pieceWiseControl = connectedMenus.pieceWiseControl;
        boundsManager    = connectedMenus.boundsManager;
        saveLoadMenu     = connectedMenus.saveLoadMenu;

        if (connectedMenus.boundsManager != null)
        {
            connectedMenus.boundsManager.Initialize(this);
        }
        connectedMenus.calcInput.Initialize(this);
        //tier 3
        connectedMenus.outputMenu.Initialize(this);

        //Req: calcInput
        connectedMenus.pieceWiseControl.Initialize(this);
        //Req: calcInput
        calcInput.ChangeOutput(expressionSet.expressions[X]);
        //Req: calcInput
        connectedMenus.presetMenu.Initialize(this);

        connectedMenus.saveLoadMenu.Initialize(this);

        if (connectedMenus.particleAnimationSettings != null)
        {
            connectedMenus.particleAnimationSettings.Initialize(this);
        }
    }
Esempio n. 3
0
 protected void Start()
 {
     roundBy    = 90; //divides into four quadrants
     menu       = GetComponent <SaveLoadMenu>();
     jsReceiver = GetComponent <JoyStickReceiver>();
     if (jsReceiver != null)
     {
         jsReceiver.JoyStickTouched += scroll;
     }
 }
Esempio n. 4
0
    public void Initialize()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        calcInput        = connectedMenus.calcInput;
        boundsManager    = connectedMenus.boundsManager;
        pieceWiseControl = connectedMenus.pieceWiseControl;
        boundsManager    = connectedMenus.boundsManager;
        saveLoadMenu     = connectedMenus.saveLoadMenu;
        tournamentMenu   = connectedMenus.tournamentMenu;
        submissionsMenu  = connectedMenus.submissionsMenu;

        if (connectedMenus.boundsManager != null)
        {
            connectedMenus.boundsManager.Initialize(this);
        }
        connectedMenus.calcInput.Initialize(this);
        //tier 3
        connectedMenus.outputMenu.Initialize(this);

        //Req: calcInput
        connectedMenus.pieceWiseControl.Initialize(this);
        //Req: calcInput
        calcInput.ChangeOutput(expressionSet.expressions["X"]);
        //Req: calcInput
        connectedMenus.presetMenu.Initialize(this);

        connectedMenus.saveLoadMenu.Initialize(this);

        if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name.Equals("3 - FreeParametrization"))
        {
            if (connectedMenus.tournamentMenu != null)
            {
                connectedMenus.tournamentMenu.Initialize(this);
            }

            if (connectedMenus.submissionsMenu != null)
            {
                connectedMenus.submissionsMenu.Initialize(this);
            }

            if (connectedMenus.mySubmissionsMenu != null)
            {
                connectedMenus.mySubmissionsMenu.Initialize(this);
            }
        }

        if (connectedMenus.particleAnimationSettings != null)
        {
            connectedMenus.particleAnimationSettings.Initialize(this);
        }
    }
    private void Start()
    {
        foreach (Transform child in transform.parent)
        {
            if (child.GetComponent <SaveLoadMenu>())
            {
                saveLoadMenu = child.GetComponent <SaveLoadMenu>();
            }
        }

        uiResourcesPath = "prefabs/UI/";

        blocksPrefabsPath = "prefabs/Blocks/";
        parent            = transform;
        virtualCode       = new List <string>();
    }
Esempio n. 6
0
 void Awake()
 {
     instance = this;
     GetComponent <CanvasScaler>().referenceResolution = new Vector2(Screen.currentResolution.width, Screen.currentResolution.height);
     miniMap        = Instantiate(miniMap, transform);
     datePanel      = Instantiate(datePanel, transform);
     saveLoadPanel  = Instantiate(saveLoadPanel, transform);
     statisticPanel = Instantiate(statisticPanel, transform);
     gameMenu       = Instantiate(gameMenu, transform);
     codePanel      = Instantiate(codePanel, transform);
     // battlePanel = Instantiate(battlePanel, transform);
     provincePanel          = Instantiate(provincePanel, transform);
     armyPanel              = Instantiate(armyPanel, transform);
     HelpManager            = Instantiate(HelpManager, transform);
     saveLoadPanel.prevMenu = gameMenu.gameObject;
 }
        public IEnumerator CorrectMapLoading()
        {
            SceneManager.LoadScene("Scene", LoadSceneMode.Single);
            yield return(new WaitForSeconds(1.0f));

            goA = SceneManager.GetActiveScene().GetRootGameObjects();
            GameObject   go  = goA[3].transform.Find("Save Load Menu").gameObject;
            SaveLoadMenu slm = go.GetComponent <SaveLoadMenu>();
            GameObject   go2 = MonoBehaviour.Instantiate(Resources.Load <GameObject>("Prefabs/UI/Save Load Item"));
            SaveLoadItem sli = go2.GetComponent <SaveLoadItem>();

            sli.MapName    = "test16";
            sli.menu       = slm;
            slm.itemPrefab = sli;
            sli.Select();
            slm.hexGrid = goA[1].GetComponent <HexGrid>();
            slm.Open(true);
            slm.Action();
            slm.Open(false);
            slm.Action();
            string[] paths = Directory.GetFiles(Application.persistentDataPath, "*.map");
            bool     b     = false;

            for (int i = 0; i < paths.Length; i++)
            {
                if (Path.GetFileNameWithoutExtension(paths[i]) == sli.MapName)
                {
                    b = true;
                    break;
                }
            }

            Assert.IsTrue(b);

            foreach (GameObject g in goA)
            {
                GameObject.Destroy(g);
            }
            GameObject.Destroy(go);
            GameObject.Destroy(slm);
            GameObject.Destroy(go2);
            GameObject.Destroy(sli);
            SceneManager.UnloadScene("Scene");
        }
        public IEnumerator DeleteMapFromMenuList()
        {
            SceneManager.LoadScene("Scene", LoadSceneMode.Single);
            yield return(new WaitForSeconds(1.0f));

            goA = SceneManager.GetActiveScene().GetRootGameObjects();
            GameObject   go  = goA[3].transform.Find("Save Load Menu").gameObject;
            SaveLoadMenu slm = go.GetComponent <SaveLoadMenu>();

            string[] paths = Directory.GetFiles(Application.persistentDataPath, "*.map");

            slm.SelectItem("test3");
            slm.hexGrid = goA[1].GetComponent <HexGrid>();
            slm.Open(true);
            slm.Action();
            int MapCount = slm.listContent.childCount;

            slm.Delete();

            for (int i = 0; i < slm.listContent.childCount; i++)
            {
                for (int j = 0; j < paths.Length; j++)
                {
                    if (slm.listContent.GetChild(i).gameObject.GetComponent <SaveLoadItem>().MapName != "test3")
                    {
                        Assert.IsTrue(true);
                        yield return(null);
                    }
                }
            }
            Assert.IsFalse(false);

            foreach (GameObject g in goA)
            {
                GameObject.Destroy(g);
            }
            GameObject.Destroy(go);
            GameObject.Destroy(slm);
            SceneManager.UnloadScene("Scene");
        }
        public IEnumerator ClosingSaveLoadMenuWindow()
        {
            SceneManager.LoadScene("Scene", LoadSceneMode.Single);
            yield return(new WaitForSeconds(1.0f));

            goA = SceneManager.GetActiveScene().GetRootGameObjects();
            GameObject   go  = goA[3].transform.Find("Save Load Menu").gameObject;
            SaveLoadMenu slm = go.GetComponent <SaveLoadMenu>();

            slm.Close();

            Assert.IsFalse(HexMapCamera.Locked);
            Assert.IsFalse(go.activeSelf);

            foreach (GameObject g in goA)
            {
                GameObject.Destroy(g);
            }
            GameObject.Destroy(go);
            GameObject.Destroy(slm);
            SceneManager.UnloadScene("Scene");
        }
        public IEnumerator ChangingTheInterfaceWhenLoading()
        {
            SceneManager.LoadScene("Scene", LoadSceneMode.Single);
            yield return(new WaitForSeconds(1.0f));

            goA = SceneManager.GetActiveScene().GetRootGameObjects();
            GameObject   go  = goA[3].transform.Find("Save Load Menu").gameObject;
            SaveLoadMenu slm = go.GetComponent <SaveLoadMenu>();

            slm.Open(false);

            Assert.AreEqual(slm.menuLabel.text, "Load Map");
            Assert.AreEqual(slm.actionButtonLabel.text, "Load");

            foreach (GameObject g in goA)
            {
                GameObject.Destroy(g);
            }
            GameObject.Destroy(go);
            GameObject.Destroy(slm);
            SceneManager.UnloadScene("Scene");
        }
        public IEnumerator FillingMenuListWithMapNames()
        {
            SceneManager.LoadScene("Scene", LoadSceneMode.Single);
            yield return(new WaitForSeconds(1.0f));

            goA = SceneManager.GetActiveScene().GetRootGameObjects();
            GameObject   go  = goA[3].transform.Find("Save Load Menu").gameObject;
            SaveLoadMenu slm = go.GetComponent <SaveLoadMenu>();

            string[] paths = Directory.GetFiles(Application.persistentDataPath, "*.map");

            slm.Open(true);

            Assert.AreEqual(paths.Length, slm.listContent.childCount);

            foreach (GameObject g in goA)
            {
                GameObject.Destroy(g);
            }
            GameObject.Destroy(go);
            GameObject.Destroy(slm);
            SceneManager.UnloadScene("Scene");
        }
        public IEnumerator ReturnNullIfFileDontExistsDuringTheLoading()
        {
            SceneManager.LoadScene("Scene", LoadSceneMode.Single);
            yield return(new WaitForSeconds(1.0f));

            goA = SceneManager.GetActiveScene().GetRootGameObjects();
            GameObject   go  = goA[3].transform.Find("Save Load Menu").gameObject;
            SaveLoadMenu slm = go.GetComponent <SaveLoadMenu>();

            slm.SelectItem("test6");
            slm.Open(false);
            slm.Action();


            Assert.IsNull(slm.path);

            foreach (GameObject g in goA)
            {
                GameObject.Destroy(g);
            }
            GameObject.Destroy(go);
            GameObject.Destroy(slm);
            SceneManager.UnloadScene("Scene");
        }
        protected override void Awake()
        {
            base.Awake();

            saveLoadMenu = GetComponentInParent <SaveLoadMenu>();
        }
Esempio n. 14
0
 internal KeyboardInputResponder(SaveLoadMenu saveLoadMenu)
 {
     this.saveLoadMenu = saveLoadMenu;
 }
Esempio n. 15
0
 private void Awake()
 {
     menu = FindObjectOfType <SaveLoadMenu>();
 }