Esempio n. 1
0
 public void OptionPressed(DebugStreamOption option, bool value)
 {
     if (value)
     {
         Diglbug.EnablePrintStream(option.stream);
     }
     else
     {
         Diglbug.DisablePrintStream(option.stream);
     }
 }
Esempio n. 2
0
    private void OnValidate()
    {
        updateStructure = false;

        int enumCount = Enum.GetNames(typeof(PrintStream)).Length;

        while (optionsGridParent.transform.childCount < enumCount)
        {
            GameObject newChild = GameObject.Instantiate(optionObject);
            newChild.transform.SetParent(optionsGridParent.transform, false);
            DebugStreamOption option = newChild.GetComponent <DebugStreamOption> ();
            option.callback = this;
        }


        if (loadOptions)
        {
            loadOptions = false;
            GameObject        cChild;
            DebugStreamOption cOption;
            PrintStream       cStream;
            allOptions = new DebugStreamOption[enumCount];
            for (int k = 0; k < enumCount; k++)
            {
                cChild         = optionsGridParent.transform.GetChild(k).gameObject;
                cStream        = ((PrintStream)k);
                cChild.name    = cStream.ToString();
                cOption        = cChild.GetComponent <DebugStreamOption> ();
                cOption.stream = cStream;
                allOptions [k] = cOption;
                cChild.GetComponentInChildren <Text>().text = cStream.ToString();
            }
        }


        for (int k = enumCount; k < optionsGridParent.transform.childCount; k++)
        {
            optionsGridParent.transform.GetChild(k).gameObject.name = "__UNUSED";
        }
    }