示例#1
0
    public void ListConfigs_listsConfigs()
    {
        var configs = _handler.ListConfigs();

        Assert.IsNotNull(configs);
        Assert.IsNotEmpty(configs);
        Assert.IsTrue(configs.ContainsKey(2));
        Assert.AreEqual("1v1", configs[2]);
        Assert.IsTrue(configs.ContainsKey(3));
        Assert.AreEqual("4Way", configs[3]);
    }
    public void ListConfigs_listsConfigs()
    {
        var configs = _handler.ListConfigs();

        Assert.IsNotNull(configs);
        Assert.IsNotEmpty(configs);
        Assert.IsTrue(configs.ContainsKey(0));
        Assert.AreEqual("Run0", configs[0]);
        Assert.IsTrue(configs.ContainsKey(1));
        Assert.AreEqual("Run1", configs[1]);
    }
示例#3
0
    public void DeleteConfig_DeletesConfigWithGivenID()
    {
        var id      = 2;
        var configs = _handler.ListConfigs();

        Assert.IsTrue(configs.Any(c => c.Key == id));

        var generationBefore = _handler.ReadGeneration(id, 0);

        Assert.AreEqual(2, generationBefore.Individuals.Count);

        _handler.DeleteConfig(id);

        var configsAfter = _handler.ListConfigs();

        Assert.IsFalse(configsAfter.Any(c => c.Key == id));

        var generationAfter = _handler.ReadGeneration(id, 0);

        Assert.AreEqual(0, generationAfter.Individuals.Count);
    }
示例#4
0
        public void Start()
        {
            _handler = new EvolutionDatabaseHandler();

            var autoLoadId = _handler.ReadAutoloadId();

            _configs = _handler.ListConfigs();
            var i = 0;

            foreach (var config in _configs)
            {
                var menuItem = Instantiate(MenuItemPrefab, FirstMenuItemLocation.position + (i * SubsequentItemOffset), FirstMenuItemLocation.rotation, transform);
                menuItem.text = config.Value;
                var menuItemScript = menuItem.GetComponent <MenuItem>();

                menuItemScript.IdToLoad    = config.Key;
                menuItemScript.SetIdToLoad = true;
                menuItemScript.SceneToLoad = RunScene;
                if (autoLoadId != null && autoLoadId.Value == config.Key)
                {
                    //This one is the one to load, simulate a click to load the scene.
                    menuItemScript.OnMouseUp();
                }

                var editButton = Instantiate(MenuItemPrefab, FirstEditButtonLocation.position + (i * SubsequentItemOffset), FirstMenuItemLocation.rotation, transform);
                editButton.text     = "edit";
                editButton.fontSize = 100;
                var editButtonScript = editButton.GetComponent <MenuItem>();

                editButtonScript.IdToLoad    = config.Key;
                editButtonScript.SetIdToLoad = true;
                editButtonScript.SceneToLoad = EditScene;

                i++;
            }
        }