Example #1
0
    private void ClearElements(selectionType type)
    {
        List <string> listElements = new List <string>();

        listElements.Clear();
        Button createQuestButton = rootVisualElement.Q <Button>("create-Q-btn");
        Button createStepButton  = rootVisualElement.Q <Button>("create-S-btn");
        Button removeQuestButton = rootVisualElement.Q <Button>("remove-Q-btn");
        Button removeStepButton  = rootVisualElement.Q <Button>("remove-S-btn");

        switch (type)
        {
        case selectionType.Questline:
            listElements.Add("quests-list");
            listElements.Add("steps-list");
            listElements.Add("actor-conversations");
            listElements.Add("steps-list");
            listElements.Add("dialogues-list");

            listElements.Add("step-info-scroll");
            listElements.Add("dialogue-info-scroll");
            if (createQuestButton != null)
            {
                createQuestButton.SetEnabled(true);
                removeQuestButton.SetEnabled(true);
            }
            if (createStepButton != null)
            {
                createStepButton.SetEnabled(false);
                removeStepButton.SetEnabled(false);
            }

            break;

        case selectionType.Quest:
            listElements.Add("dialogues-list");

            listElements.Add("step-info-scroll");
            listElements.Add("dialogue-info-scroll");

            if (createStepButton != null)
            {
                createStepButton.SetEnabled(true);
                removeStepButton.SetEnabled(true);
            }

            break;

        case selectionType.Step:

            listElements.Add("dialogue-info-scroll");

            break;
        }
        foreach (string elementName in listElements)
        {
            VisualElement element = rootVisualElement.Q <VisualElement>(elementName);
            element.Clear();
        }
    }
Example #2
0
    public static void makeSpace(coordinates c, selectionType type, int moves, coordinates o, UnityAction method)
    {
        float width  = Convert.ToSingle(Camera.main.orthographicSize * 2.0 * Screen.width / 10);
        float height = Convert.ToSingle(Camera.main.orthographicSize * 2.0 * Screen.height / 10);

        //When setting selections make sure to add or subtract width / 15.68f and height / 8.8138f
        GameObject selection = GameObject.Instantiate(MainPresenter.highlightedSpace, new Vector3(width / 4.1925f + c.x * (width / 15.68f), height / 1.7348f + c.y * (height / 8.8138f), 0), Quaternion.identity, MainPresenter.canvas.transform);
        Button     button    = selection.GetComponent <Button>();

        selections.Add(selection);
        coordinatesSpotted.Add(c);
        if (type == selectionType.move)
        {
            selection.GetComponent <Image>().color = new Color(0, 1, 0, 0.49f);
            button.onClick.AddListener(delegate { moveUnit(moves, c, o); });
            if (moves < unit.movesRemaining)
            {
                checkAdjacentSpaces(c, moves + 1, o, true);
            }
        }
        else if (type == selectionType.attack)
        {
            selection.GetComponent <Image>().color = new Color(1, 0, 0, 0.49f);
            button.onClick.AddListener(delegate { attackUnit(o); });
        }
        else
        {
            selection.GetComponent <Image>().color = new Color(1, 1, 0, 0.49f);
            button.onClick.AddListener(method);
        }
    }
Example #3
0
 public Form1(int n, int p, int mutationPossibillity, selectionType myselection)
 {
     this.n = n;
     this.p = p;
     this.mutationPossibillity = mutationPossibillity;
     this.myselection          = myselection;
     currentGeneration         = new int[p, n + 1];
     newGeneration             = new int[p, n + 1];
     InitializeComponent();
 }
Example #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            selectionType myselection = selectionType.basic;

            if (radioButton1.Checked)
            {
                myselection = selectionType.basic;
            }
            else if (radioButton2.Checked)
            {
                myselection = selectionType.rouletteWheel;
            }
            int   n = Convert.ToInt32(textBox1.Text);
            int   p = Convert.ToInt32(textBox2.Text);
            int   mutationPossibillity = Convert.ToInt32(textBox3.Text);
            Form1 frm1 = new Form1(n, p, mutationPossibillity, myselection);

            this.Visible = false;
            frm1.Show();
        }