private void Awake()
    {
        //Simple setter
        Console.AddVariable <float>("volume", "", x => Volume = x, this);

        //Lambda
        Console.AddVariable <bool>("vsync", "", x =>
        {
            Vsync = x;
            QualitySettings.vSyncCount = x ? 1 : 0;
        }, this);

        //Method
        Console.AddVariable <int>("frameLimit", "", SetFramerate, this);
    }
예제 #2
0
        internal void Initialize(ConsoleBackend backend, Options options)
        {
            if (!gameObject.activeSelf)
            {
                return;
            }

            m_eventSystem           = GameObject.FindObjectOfType <EventSystem>();
            this.m_backend          = backend;
            this.m_options          = options;
            m_consoleRoot.anchorMin = new Vector2(0f, 0.65f);
            m_consoleRoot.anchorMax = new Vector2(1f, 1f);
            m_posTarget             = new Vector2(0, 10000);
            m_inputField.onValueChanged.AddListener(DrawAutoCompleteSuggestions);
            m_inputField.onEndEdit.AddListener(HandleInput);
            m_backend.OnWriteLine       += OnWriteLine;
            m_backend.OnExecutedCommand += OnExecutedLine;
            m_backend.RegisterCommand("clear", "clear the console log", this, Clear);
            Console.DestroyChildren(m_consoleContent.transform);
            m_historyRoot.gameObject.SetActive(false);
            m_beastConsoleHelp = m_beastConsoleHelp;

            Console.AddVariable <bool>("console.showHelp", "Shows the info box in the console", x => m_beastConsoleHelp = x, this);
        }
예제 #3
0
 // Use this for initialization
 void Start()
 {
     //You need to provide a setter for a variable, and a reference to "owner".
     Console.AddVariable <float>("test", "some test", x => TestVar = x, this);
     Console.AddCommand("moveUp", "", this, MoveUp);
 }