Ejemplo n.º 1
0
    //Displays the current option set's options on the various UI elements
    public void DisplayCurrentOptions()
    {
        for (short i = 0; i < 9; i++)
        {
            rulesDropdowns[i].value = OptionStorage.GetCurrent().GetRule(i);
        }
        edgeTypeDropdown.value  = OptionStorage.GetCurrent().GetEdgeType();
        nameInputField.text     = OptionStorage.GetCurrent().GetName();
        randomColorsToggle.isOn = OptionStorage.GetCurrent().ColorsAreRandom();
        localColors             = OptionStorage.GetCurrent().GetColors();
        DisplayColors();

        //Disallows editing of the Default options and the example options
        if (OptionStorage.GetCurrentOptionIndex() == 0 || OptionStorage.GetCurrentOptionIndex() == 1)
        {
            editButton.interactable   = false;
            deleteButton.interactable = false;
            renameButton.interactable = false;
        }
        else
        {
            editButton.interactable   = true;
            deleteButton.interactable = true;
            renameButton.interactable = true;
        }
    }
Ejemplo n.º 2
0
    //Saves current options
    public void AcceptChanges()
    {
        Options temp = OptionStorage.GetCurrent();

        temp.SetName(nameInputField.text);
        temp.SetEdgeType((short)edgeTypeDropdown.value);
        temp.SetColorsAreRandom(randomColorsToggle.isOn);
        temp.SetColors(localColors);

        for (short i = 0; i < 9; i++)
        {
            temp.SetRule(i, (short)rulesDropdowns[i].value);
        }

        OptionStorage.SetCurrent(temp);

        optionButtons[OptionStorage.GetCurrentOptionIndex()].gameObject.GetComponentInChildren <Text>().text = temp.GetName();

        EndEditing();
    }
Ejemplo n.º 3
0
    //Displays the whole list of saved options in special button objects
    private void DisplayOptionList()
    {
        //Destroys any buttons currently being displayed
        GameObject[] tempArray = GameObject.FindGameObjectsWithTag("OptionButton");
        for (int i = tempArray.Length - 1; i >= 0; i--)
        {
            Destroy(tempArray[i]);
        }

        //Lets the option button class know a new set of options will be created
        OptionButton.ResetIndexCounter();

        //Creates a new option button object for each stored option
        for (int i = 0; i < storedOptions.Count; i++)
        {
            optionListPlane.content.sizeDelta = new Vector2(182, 100 + (70 * (i + 1)));
            Button temp = Instantiate(objectButtonPrefab, optionListPlane.content);
            optionButtons.Add(temp);
            optionButtons[i].transform.position = new Vector3(0f, (-5f - (80 * i)), 0f) + optionButtons[i].transform.position;
            optionButtons[i].gameObject.GetComponentInChildren <Text>().text = storedOptions[i].GetName();
        }

        optionButtons[OptionStorage.GetCurrentOptionIndex()].image.color = Color.gray;
    }
Ejemplo n.º 4
0
 //Changes the highlighted opton button
 public void SetHighlightedOption(int newIndex)
 {
     optionButtons[OptionStorage.GetCurrentOptionIndex()].image.color = Color.white;
     optionButtons[newIndex].image.color = Color.gray;
 }