public void ClearLabels()
 {
     for (int i = 0; i < fieldSets.Count; i++)
     {
         var fieldSet = fieldSets[i];
         int count    = fieldSet.fields.Count;
         for (int j = 0; j < count; j++)
         {
             GUIInputField field = fieldSet.fields[j];
             field.SetLabel("");
         }
     }
 }
        internal TackConsole()
        {
            // Set the static instance
            ActiveInstance = this;

            m_logPath = string.Format("logs/log_{0}_{1}_{2}.txt", DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year);

            if (!Directory.Exists(Directory.GetCurrentDirectory() + "/logs"))
            {
                Directory.CreateDirectory(Directory.GetCurrentDirectory() + "/logs");
            }

            mInputFieldStyle = new InputFieldStyle();
            mInputFieldStyle.BackgroundColour  = new Colour4b(100, 100, 100, 190);
            mInputFieldStyle.FontColour        = new Colour4b(0, 0, 0, 255);
            mInputFieldStyle.SpriteTexture     = Sprite.DefaultSprite;
            mInputFieldStyle.FontSize          = 10f;
            mInputFieldStyle.VerticalAlignment = VerticalAlignment.Middle;
            mInputFieldStyle.FontFamilyId      = 0; //TackGUI.LoadFontFromFile(Environment.GetFolderPath(Environment.SpecialFolder.Fonts) + "\\cour.ttf");
            mInputFieldStyle.Scrollable        = false;

            mActivationKey = KeyboardKey.Tilde;

            mConsoleUIStyle = new TextAreaStyle()
            {
                BackgroundColour  = new Colour4b(0, 0, 0, 190),
                FontColour        = new Colour4b(0, 255, 0, 255),
                FontFamilyId      = TackGUI.GetFontFamilyId("Courier New"),
                FontSize          = 10f,
                VerticalAlignment = VerticalAlignment.Top,
                ScrollPosition    = 0,
                Scrollable        = true
            };

            mCaretBoxStyle = new BoxStyle()
            {
                Colour = new Colour4b(255, 0, 0, 255),
            };

            mConsoleInputField = null;
            mConsoleTextArea   = null;
            mConsoleGUIActive  = true;
        }
 public void SetFieldsActive(bool state)
 {
     for (int i = 0; i < fieldSets.Count; i++)
     {
         var fieldSet = fieldSets[i];
         int count    = fieldSet.fields.Count;
         for (int j = 0; j < count; j++)
         {
             GUIInputField field = fieldSet.fields[j];
             field.SetInteractible(state, false);
             if (field.hasToggle)
             {
                 if (!state || field.toggle.actionElementMapId >= 0) // only enable toggle if something is mapped. Disable it regardless.
                 {
                     field.toggle.SetInteractible(state, false);     // set toggle state
                 }
             }
         }
     }
 }
 public void Initialize()
 {
     for (int i = 0; i < fieldSets.Count; i++)
     {
         var fieldSet = fieldSets[i];
         int count    = fieldSet.fields.Count;
         for (int j = 0; j < count; j++)
         {
             GUIInputField field = fieldSet.fields[j];
             if (field.hasToggle)
             {
                 field.toggle.SetInteractible(false, false); // disable toggle
                 field.toggle.SetToggleState(false);         // unset toggle
                 field.toggle.actionElementMapId = -1;
             }
             field.SetLabel("");
             field.actionElementMapId = -1;
             field.controllerId       = -1;
         }
     }
 }
                public void PopulateField(ControllerType controllerType, int controllerId, int index, int actionElementMapId, string label, bool invert)
                {
                    if (!fieldSets.ContainsKey((int)controllerType))
                    {
                        return;
                    }
                    if (!fieldSets.Get((int)controllerType).fields.ContainsKey(index))
                    {
                        return;
                    }

                    GUIInputField field = fieldSets.Get((int)controllerType).fields.Get(index);

                    field.SetLabel(label);                         // set the label
                    field.actionElementMapId = actionElementMapId; // store the element map id
                    field.controllerId       = controllerId;
                    if (field.hasToggle)
                    {
                        field.toggle.SetInteractible(true, false);
                        field.toggle.SetToggleState(invert);
                        field.toggle.actionElementMapId = actionElementMapId; // store the element map id
                    }
                }
 public void AddInputField(ControllerType controllerType, int fieldIndex, GUIInputField inputField) {
     if(!fieldSets.ContainsKey((int)controllerType)) return;
     FieldSet fieldSet = fieldSets.Get((int)controllerType);
     if(fieldSet.fields.ContainsKey(fieldIndex)) return; // already used
     fieldSet.fields.Add(fieldIndex, inputField);
 }
 public void AddInputField(int mapCategoryId, InputAction action, AxisRange axisRange, ControllerType controllerType, int fieldIndex, GUIInputField inputField) {
     list.AddInputField(mapCategoryId, action, axisRange, controllerType, fieldIndex, inputField);
 }
 public void AddInputField(int mapCategoryId, InputAction action, AxisRange axisRange, ControllerType controllerType, int fieldIndex, GUIInputField inputField) {
     ActionEntry actionEntry = GetActionEntry(mapCategoryId, action, axisRange);
     if(actionEntry == null) return;
     actionEntry.AddInputField(controllerType, fieldIndex, inputField);
 }
        internal void OnUpdate()
        {
            if (mConsoleTextArea == null)
            {
                mConsoleTextArea = new GUITextArea()
                {
                    Bounds      = new RectangleShape(5, 5, TackEngine.ScreenWidth - 10, 400),
                    NormalStyle = new GUITextArea.GUITextAreaStyle()
                    {
                        Colour              = new Colour4b(0, 0, 0, 255),
                        Texture             = Sprite.DefaultSprite,
                        FontColour          = new Colour4b(0, 255, 0, 255),
                        FontSize            = 9f,
                        VerticalAlignment   = VerticalAlignment.Top,
                        HorizontalAlignment = HorizontalAlignment.Left
                    },

                    HoverStyle = new GUITextArea.GUITextAreaStyle()
                    {
                        Colour              = new Colour4b(0, 0, 0, 255),
                        Texture             = Sprite.DefaultSprite,
                        FontColour          = new Colour4b(0, 255, 0, 255),
                        FontSize            = 9f,
                        VerticalAlignment   = VerticalAlignment.Top,
                        HorizontalAlignment = HorizontalAlignment.Left
                    },
                    Text   = "",
                    Active = true
                };
            }

            if (mConsoleInputField == null)
            {
                mConsoleInputField = new GUIInputField()
                {
                    Bounds = new RectangleShape(5, 415, TackEngine.ScreenWidth - 10, 25),
                    Text   = "",
                    Active = true
                };

                mConsoleInputField.OnSubmit += ProcessCommand;
            }

            mConsoleTextArea.Active   = mConsoleGUIActive;
            mConsoleInputField.Active = mConsoleGUIActive;
            mConsoleTextArea.Bounds   = new RectangleShape(5, 5, TackEngine.ScreenWidth - 10, 400);
            mConsoleInputField.Bounds = new RectangleShape(5, 410, TackEngine.ScreenWidth - 10, 25);

            // Check to see if user wants to display the TackConsole GUI
            if (TackInput.InputActiveKeyDown(mActivationKey))
            {
                mConsoleGUIActive = !mConsoleGUIActive;
            }

            if (TackInput.KeyDown(KeyboardKey.PageDown))
            {
                if (mConsoleUIStyle.ScrollPosition < mMessages.Count - 1)
                {
                    mConsoleUIStyle.ScrollPosition += 1.0f;
                }
            }

            if (TackInput.KeyDown(KeyboardKey.PageUp))
            {
                if (mConsoleUIStyle.ScrollPosition > 0)
                {
                    mConsoleUIStyle.ScrollPosition -= 1.0f;
                }
            }

            //mInputString = mInputField.InputString;
        }
                public void AddInputField(ControllerType controllerType, int fieldIndex, GUIInputField inputField)
                {
                    if (!fieldSets.ContainsKey((int)controllerType))
                    {
                        return;
                    }
                    FieldSet fieldSet = fieldSets.Get((int)controllerType);

                    if (fieldSet.fields.ContainsKey(fieldIndex))
                    {
                        return;                                         // already used
                    }
                    fieldSet.fields.Add(fieldIndex, inputField);
                }
 public void AddInputField(int mapCategoryId, InputAction action, AxisRange axisRange, ControllerType controllerType, int fieldIndex, GUIInputField inputField)
 {
     list.AddInputField(mapCategoryId, action, axisRange, controllerType, fieldIndex, inputField);
 }
            public void AddInputField(int mapCategoryId, InputAction action, AxisRange axisRange, ControllerType controllerType, int fieldIndex, GUIInputField inputField)
            {
                ActionEntry actionEntry = GetActionEntry(mapCategoryId, action, axisRange);

                if (actionEntry == null)
                {
                    return;
                }
                actionEntry.AddInputField(controllerType, fieldIndex, inputField);
            }