Esempio n. 1
0
            public DeleteCharacterMessageBox(IGUIManager guiManager, string characterName, byte slot)
                : base(guiManager, _msgBoxTitle, string.Format(_msgBoxMsg, characterName), MessageBoxButton.OkCancel)
            {
                _slot = slot;

                DisposeOnSelection = true;
            }
Esempio n. 2
0
        /// <summary>
        /// Updates the targeting.
        /// </summary>
        /// <param name="gui">THe <see cref="IGUIManager"/>.</param>
        public void Update(IGUIManager gui)
        {
            var cursorPos = gui.CursorPosition;

            MouseOverTarget = _world.Map.Spatial.Get <IDrawableTarget>(_world.Camera.ToWorld(cursorPos));

            if (gui.IsMouseButtonDown(MouseButton.Left))
            {
                if (MouseOverTarget != null)
                {
                    Target = MouseOverTarget == _world.UserChar ? null : MouseOverTarget;
                }
                else
                {
                    Target = null;
                }
            }

            if (MouseOverTarget != null && MouseOverTarget.IsDisposed)
            {
                MouseOverTarget = null;
            }

            if (Target != null && Target.IsDisposed)
            {
                Target = null;
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Updates all of the <see cref="GameControl"/>s in this <see cref="GameControlCollection"/>.
 /// </summary>
 /// <param name="guiManager">The <see cref="IGUIManager"/> used to update the <see cref="GameControl"/>s.</param>
 /// <param name="currentTime">The current time in milliseconds.</param>
 public void Update(IGUIManager guiManager, TickCount currentTime)
 {
     foreach (var gc in this)
     {
         gc.Update(guiManager, currentTime);
     }
 }
Esempio n. 4
0
        public Window(Vector2 pos, Vector2 size, int bor, IGUIManager manager)
        {
            position = pos;
            this.size = size;
            border = bor;
            guiManager = manager;

            Color[] data = new Color[1];
            Color[] data4 = new Color[1];
            data[0] = Color.FromNonPremultiplied(210, 210, 210, 220);
            tex1 = new Texture2D(guiManager.GetGraphics(), 1, 1);
            tex1.SetData(data);

            data4[0] = Color.FromNonPremultiplied(100, 100, 100, 255);
            tex4 = new Texture2D(guiManager.GetGraphics(), 1, 1);
            tex4.SetData(data4);

            lines = new Line[4];
            lines[0] = new Line(tex4, position - new Vector2(border, border), new Vector2(size.X + border * 2, border));
            lines[1] = new Line(tex4, position - new Vector2(border, border), new Vector2(border, size.Y + border * 2));
            lines[2] = new Line(tex4, new Vector2(position.X + size.X, position.Y - border), new Vector2(border, size.Y + border * 2));
            lines[3] = new Line(tex4, new Vector2(position.X - border, position.Y + size.Y), new Vector2(size.X + border, border));

            manager.AddGui(this);
        }
Esempio n. 5
0
        /// <summary>
        /// Sells an inventory item to the currently open shop.
        /// </summary>
        /// <param name="slot">The slot of the item to sell.</param>
        /// <param name="guiManager">The <see cref="IGUIManager"/> to use to create the <see cref="InputBox"/> if it is needed.</param>
        public void SellToShop(InventorySlot slot, IGUIManager guiManager)
        {
            // Check for a valid item
            var item = this[slot];

            if (item == null)
            {
                return;
            }

            // Check the amount
            if (item.Amount > 1)
            {
                // Create an InputBox to ask how much to drop
                const string text    = "Sell item";
                const string message = "How much of the item do you wish to sell?\n(Enter a value from 1 to {0})";

                var inBox = InputBox.CreateNumericInputBox(guiManager, text, string.Format(message, item.Amount));
                inBox.Tag             = slot;
                inBox.OptionSelected += SellToShopInputBox_OptionSelected;
            }
            else
            {
                // Auto-drop if there is just one of the item
                SellToShop(slot, 1);
            }
        }
Esempio n. 6
0
 /// <summary>
 /// Adds an <see cref="IGUIManager"/> to this <see cref="ISkinManager"/>.
 /// </summary>
 /// <param name="guiManager">The <see cref="IGUIManager"/> to add.</param>
 void ISkinManager.AddGUIManager(IGUIManager guiManager)
 {
     if (!_guiManagers.Contains(guiManager))
     {
         _guiManagers.Add(guiManager);
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GuildMembersFormBase"/> class.
 /// </summary>
 /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
 /// <param name="position">Position of the Control reletive to its parent.</param>
 /// <param name="clientSize">The size of the <see cref="Control"/>'s client area.</param>
 /// <exception cref="ArgumentNullException"><paramref name="guiManager"/> is null.</exception>
 protected GuildMembersFormBase(IGUIManager guiManager, Vector2 position, Vector2 clientSize)
     : base(guiManager, position, clientSize)
 {
     _lstMembers = new GuildMemberListControl(this, Vector2.Zero, ClientSize)
     {
         Items = _listItemsCache
     };
 }
Esempio n. 8
0
 public Game(ISpaceUpdater spaceUpdater,
             ISpaceStore spaceStore, IPainter painter, IGUIManager GUIManager)
 {
     this.spaceUpdater = spaceUpdater;
     this.spaceStore   = spaceStore;
     this.painter      = painter;
     this.GUIManager   = GUIManager;
 }
Esempio n. 9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AvailableQuestsForm"/> class.
        /// </summary>
        /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
        /// <param name="position">Position of the Control reletive to its parent.</param>
        /// <param name="clientSize">The size of the <see cref="Control"/>'s client area.</param>
        /// <param name="hasStartQuestReqs">A func used to check if the user has the requirements to start a quest.</param>
        /// <exception cref="ArgumentNullException"><paramref name="guiManager"/> is null.</exception>
        public AvailableQuestsForm(IGUIManager guiManager, Vector2 position, Vector2 clientSize, Func<QuestID, bool> hasStartQuestReqs) 
            : base(guiManager, position, clientSize)
        {
            _hasStartQuestReqs = hasStartQuestReqs;

            CreateChildren();
            IsVisible = false;
        }
Esempio n. 10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AvailableQuestsForm"/> class.
        /// </summary>
        /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
        /// <param name="position">Position of the Control reletive to its parent.</param>
        /// <param name="clientSize">The size of the <see cref="Control"/>'s client area.</param>
        /// <param name="hasStartQuestReqs">A func used to check if the user has the requirements to start a quest.</param>
        /// <exception cref="ArgumentNullException"><paramref name="guiManager"/> is null.</exception>
        public AvailableQuestsForm(IGUIManager guiManager, Vector2 position, Vector2 clientSize,
                                   Func <QuestID, bool> hasStartQuestReqs) : base(guiManager, position, clientSize)
        {
            _hasStartQuestReqs = hasStartQuestReqs;

            CreateChildren();
            IsVisible = false;
        }
Esempio n. 11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TextControl"/> class.
        /// </summary>
        /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
        /// <param name="position">Position of the Control reletive to its parent.</param>
        /// <param name="clientSize">The size of the <see cref="Control"/>'s client area.</param>
        /// <exception cref="ArgumentNullException"><paramref name="guiManager"/> is null.</exception>
        public TextBox(IGUIManager guiManager, Vector2 position, Vector2 clientSize) : base(guiManager, position, clientSize)
        {
            _numCharsToDraw.TextBox = this;
            _editableTextHandler    = new EditableTextHandler(this);

            // Set the initial line length and number of visible lines
            UpdateMaxLineLength();
            UpdateMaxVisibleLines();
        }
Esempio n. 12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="QuestDescriptionListBox"/> class.
        /// </summary>
        /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
        /// <param name="position">Position of the Control reletive to its parent.</param>
        /// <param name="clientSize">The size of the <see cref="Control"/>'s client area.</param>
        /// <param name="hasStartQuestReqs">A func used to check if the user has the requirements to start a quest.</param>
        /// <param name="hasFinishQuestReqs">A func used to check if the user has the requirements to finish a quest.</param>
        /// <exception cref="ArgumentNullException"><paramref name="guiManager"/> is null.</exception>
        public QuestDescriptionListBox(IGUIManager guiManager, Vector2 position, Vector2 clientSize,
                                       Func <QuestID, bool> hasStartQuestReqs, Func <QuestID, bool> hasFinishQuestReqs)
            : base(guiManager, position, clientSize)
        {
            _hasStartQuestReqs  = hasStartQuestReqs;
            _hasFinishQuestReqs = hasFinishQuestReqs;

            CanTurnInQuestForeColor = _defaultCanTurnInColor;
        }
Esempio n. 13
0
        /// <summary>
        /// Creates a <see cref="InputBox"/> that only accepts numeric values.
        /// </summary>
        /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
        /// <param name="text">The message box's title text.</param>
        /// <param name="message">The message to display.</param>
        /// <param name="buttonTypes">The <see cref="MessageBoxButton"/>s to display. Default is <see cref="MessageBoxButton.OkCancel"/></param>
        /// <param name="maxWidth">The maximum width of the created <see cref="MessageBox"/>. If less than or equal to 0, then
        /// the <see cref="MessageBox.DefaultMaxWidth"/> will be used instead. Default is 0.</param>
        /// <returns>An <see cref="InputBox"/> that only accepts numeric values.</returns>
        public static InputBox CreateNumericInputBox(IGUIManager guiManager, string text, string message,
                                                     MessageBoxButton buttonTypes = MessageBoxButton.OkCancel, int maxWidth = 0)
        {
            var ret = new InputBox(guiManager, text, message, buttonTypes, maxWidth);

            ret.InputControl.AllowKeysHandler = TextEventArgsFilters.IsDigitFunc;
            ret.InputText = "0";
            return(ret);
        }
Esempio n. 14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TextControl"/> class.
        /// </summary>
        /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
        /// <param name="position">Position of the Control reletive to its parent.</param>
        /// <param name="clientSize">The size of the <see cref="Control"/>'s client area.</param>
        /// <exception cref="ArgumentNullException"><paramref name="guiManager"/> is null.</exception>
        public TextBox(IGUIManager guiManager, Vector2 position, Vector2 clientSize) : base(guiManager, position, clientSize)
        {
            _numCharsToDraw.TextBox = this;
            _editableTextHandler = new EditableTextHandler(this);

            // Set the initial line length and number of visible lines
            UpdateMaxLineLength();
            UpdateMaxVisibleLines();
        }
Esempio n. 15
0
 public TextField(Vector2 pos, Vector2 size, IGUIManager manager)
     : base(pos, size, 3, manager)
 {
     position = pos;
     this.size = size;
     guiManager = manager;
     manager.AddGui(this);
     text = string.Empty;
 }
Esempio n. 16
0
 public Label(Vector2 pos, Vector2 size, String text, Justification just, IGUIManager manager)
     : base(pos, size, 1, manager)
 {
     position = pos;
     this.size = size;
     this.text = text;
     guiManager = manager;
     this.just = just;
     manager.AddGui(this);
 }
Esempio n. 17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Tooltip"/> class.
        /// </summary>
        /// <param name="guiManager">The <see cref="IGUIManager"/> to attach the <see cref="Tooltip"/> to.</param>
        /// <exception cref="ArgumentNullException"><paramref name="guiManager" /> is <c>null</c>.</exception>
        public Tooltip(IGUIManager guiManager)
        {
            if (guiManager == null)
                throw new ArgumentNullException("guiManager");

            _guiManager = guiManager;
            _font = guiManager.Font;
            _drawer = new StyledTextsDrawer(Font);

            Debug.Assert(Font != null);
        }
Esempio n. 18
0
    // Use this for initialization
    void Start()
    {
        m_DragStyle.normal.background = TextureGenerator.MakeTexture(0.8f, 0.8f, 0.8f, 0.3f);
        m_DragStyle.border.bottom     = 1;
        m_DragStyle.border.top        = 1;
        m_DragStyle.border.left       = 1;
        m_DragStyle.border.right      = 1;

        m_GuiManager      = ManagerResolver.Resolve <IGUIManager>();
        m_SelectedManager = ManagerResolver.Resolve <ISelectedManager>();

        ManagerResolver.Resolve <IEventsManager>().MouseClick += LeftButtonPressed;
    }
Esempio n. 19
0
        public ListBox(int width, int height, SpriteFont font, IGUIManager manager)
            : base(new Vector2(0,0), new Vector2(width, height), 0, manager)
        {
            size = new Vector2(width, height);
            items = new List<String>();
            this.font = font;
            fontSize = font.MeasureString("test");

            max = (int)((height - 40) / fontSize.Y);

            guiManager = manager;
            guiManager.AddGui(this);
        }
Esempio n. 20
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Tooltip"/> class.
        /// </summary>
        /// <param name="guiManager">The <see cref="IGUIManager"/> to attach the <see cref="Tooltip"/> to.</param>
        /// <exception cref="ArgumentNullException"><paramref name="guiManager" /> is <c>null</c>.</exception>
        public Tooltip(IGUIManager guiManager)
        {
            if (guiManager == null)
            {
                throw new ArgumentNullException("guiManager");
            }

            _guiManager = guiManager;
            _font       = guiManager.Font;
            _drawer     = new StyledTextsDrawer(Font);

            Debug.Assert(Font != null);
        }
Esempio n. 21
0
    //Autogenerated code. End of implementation [GetState_ViaReplace]

    //Autogenerated code. Begin of implementation [Command_ViaReplace]
    public void Command_ViaReplace(IServerDocumentView view, ref string parameters)
    {
        IGUIManager guiManager = DXP.GlobalVars.Client.GetGUIManager();

        if (guiManager == null)
        {
            return;
        }

        if (!guiManager.GetPanelIsOpen(frmViaReplace.PanelName))
        {
            guiManager.SetPanelVisibleInCurrentForm(frmViaReplace.PanelName, true);
        }
    }
Esempio n. 22
0
    //Autogenerated code. End of implementation [GetState_ResFinder]

    //Autogenerated code. Begin of implementation [Command_ResFinder]
    public void Command_ResFinder(IServerDocumentView view, ref string parameters)
    {
        IGUIManager guiManager = DXP.GlobalVars.Client.GetGUIManager();

        if (guiManager == null)
        {
            return;
        }

        if (!guiManager.GetPanelIsOpen(frmResFinder.PanelName))
        {
            guiManager.SetPanelVisibleInCurrentForm(frmResFinder.PanelName, true);
        }
        //To Do : Insert code here
    }
Esempio n. 23
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GameScreen"/> class.
        /// </summary>
        /// <param name="screenManager">The <see cref="IScreenManager"/> to add this <see cref="GameScreen"/> to.</param>
        /// <param name="name">Unique name of the screen that can be used to identify and
        /// call it from other screens</param>
        /// <exception cref="ArgumentNullException"><paramref name="screenManager"/> is null.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="name"/> is null or empty.</exception>
        protected GameScreen(IScreenManager screenManager, string name)
        {
            if (screenManager == null)
                throw new ArgumentNullException("screenManager");
            if (string.IsNullOrEmpty(name))
                throw new ArgumentNullException("name");

            _screenManager = screenManager;
            _name = name;

            var font = GetScreenManagerFont(ScreenManager) ?? screenManager.DefaultFont;
            _guiManager = ScreenManager.CreateGUIManager(font);

            screenManager.Add(this);
        }
Esempio n. 24
0
    //Autogenerated code. End of implementation [GetState_VarFootprintSelect]

    //Autogenerated code. Begin of implementation [Command_VarFootprintSelect]
    public void Command_VarFootprintSelect(IServerDocumentView view, ref string parameters)
    {
        IGUIManager guiManager = DXP.GlobalVars.Client.GetGUIManager();

        if (guiManager == null)
        {
            return;
        }

        if (!guiManager.GetPanelIsOpen(FootprintSelect.PanelName))
        {
            guiManager.SetPanelVisibleInCurrentForm(FootprintSelect.PanelName, true);
        }

        //new FootprintSelect().Show();
    }
Esempio n. 25
0
        /// <summary>
        /// Creates the GUI manager for the current toolkit.
        /// </summary>
        public static void Create()
        {
            switch (Program.Toolkit)
            {
            case WindowToolkit.WinForms:
                _guiManager = new WinGUI.WinFormsGUIManager();
                break;

            case WindowToolkit.GtkSharp:
                _guiManager = new GTKGUI.GTKGUIManager();
                break;

            default:
                throw new NotImplementedException("No GUI manager found " +
                                                  " for toolkit '" + Program.Toolkit.ToString() + "'");
            }
        }
Esempio n. 26
0
    //Autogenerated code. End of implementation [GetState_DoReport]

    //Autogenerated code. Begin of implementation [Command_DoReport]
    public void Command_DoReport(IServerDocumentView view, ref string parameters)
    {
        IGUIManager guiManager = DXP.GlobalVars.Client.GetGUIManager();

        if (guiManager == null)
        {
            return;
        }

        if (!guiManager.GetPanelIsOpen(DoFileGen.PanelName))
        {
            guiManager.SetPanelVisibleInCurrentForm(DoFileGen.PanelName, true);
        }
        DXP.Utils.StatusBarSetStateDefault();
        DXP.Utils.PercentFinish();
        return;
    }
Esempio n. 27
0
        /// <summary>
        /// Creates the GUI manager for the current toolkit.
        /// </summary>
        public static void Create()
        {
            switch (Program.Toolkit)
            {
            case WindowToolkit.WinForms:
                _guiManager = new WinGUI.WinFormsGUIManager();
                break;

            case WindowToolkit.GtkSharp:
                _guiManager = new GTKGUI.GTKGUIManager();
                break;

            default:
                throw new NotImplementedException("No GUI manager found " +
                    " for toolkit '" + Program.Toolkit.ToString() + "'");
            }
        }
Esempio n. 28
0
    //Autogenerated code. End of implementation [GetState_TrackUtil]

    //Autogenerated code. Begin of implementation [Command_TrackUtil]
    public void Command_TrackUtil(IServerDocumentView view, ref string parameters)
    {
        //new Track_Util().TrackUtil(new frmTracks(), Track_Util.PanelName);
        IGUIManager guiManager = DXP.GlobalVars.Client.GetGUIManager();

        if (guiManager == null)
        {
            return;
        }

        if (!guiManager.GetPanelIsOpen(frmTracks.PanelName))
        {
            guiManager.SetPanelVisibleInCurrentForm(frmTracks.PanelName, true);
        }
        DXP.Utils.StatusBarSetStateDefault();
        DXP.Utils.PercentFinish();
        return;
    }
Esempio n. 29
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MessageBox"/> class.
        /// </summary>
        /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
        /// <param name="text">The message box's title text.</param>
        /// <param name="message">The message to display.</param>
        /// <param name="buttonTypes">The <see cref="MessageBoxButton"/>s to display.</param>
        /// <param name="maxWidth">The maximum width of the created <see cref="MessageBox"/>. If less than or equal to 0, then
        /// the <see cref="DefaultMaxWidth"/> will be used instead. Default is 0.</param>
        public MessageBox(IGUIManager guiManager, string text, string message, MessageBoxButton buttonTypes, int maxWidth = 0)
            : base(guiManager, Vector2.Zero, new Vector2(32))
        {
            if (maxWidth <= 0)
                maxWidth = DefaultMaxWidth;

            _maxWidth = maxWidth;

            // ReSharper disable DoNotCallOverridableMethodsInConstructor
            Text = text;
            Message = message;
            ButtonTypes = buttonTypes;
            // ReSharper restore DoNotCallOverridableMethodsInConstructor

            _suspendCreateChildControls = false;

            CreateChildControls();
        }
Esempio n. 30
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GameScreen"/> class.
        /// </summary>
        /// <param name="screenManager">The <see cref="IScreenManager"/> to add this <see cref="GameScreen"/> to.</param>
        /// <param name="name">Unique name of the screen that can be used to identify and
        /// call it from other screens</param>
        /// <exception cref="ArgumentNullException"><paramref name="screenManager"/> is null.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="name"/> is null or empty.</exception>
        protected GameScreen(IScreenManager screenManager, string name)
        {
            if (screenManager == null)
            {
                throw new ArgumentNullException("screenManager");
            }
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }

            _screenManager = screenManager;
            _name          = name;

            var font = GetScreenManagerFont(ScreenManager) ?? screenManager.DefaultFont;

            _guiManager = ScreenManager.CreateGUIManager(font);

            screenManager.Add(this);
        }
Esempio n. 31
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MessageBox"/> class.
        /// </summary>
        /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
        /// <param name="text">The message box's title text.</param>
        /// <param name="message">The message to display.</param>
        /// <param name="buttonTypes">The <see cref="MessageBoxButton"/>s to display.</param>
        /// <param name="maxWidth">The maximum width of the created <see cref="MessageBox"/>. If less than or equal to 0, then
        /// the <see cref="DefaultMaxWidth"/> will be used instead. Default is 0.</param>
        public MessageBox(IGUIManager guiManager, string text, string message, MessageBoxButton buttonTypes, int maxWidth = 0)
            : base(guiManager, Vector2.Zero, new Vector2(32))
        {
            if (maxWidth <= 0)
            {
                maxWidth = DefaultMaxWidth;
            }

            _maxWidth = maxWidth;

            // ReSharper disable DoNotCallOverridableMethodsInConstructor
            Text        = text;
            Message     = message;
            ButtonTypes = buttonTypes;
            // ReSharper restore DoNotCallOverridableMethodsInConstructor

            _suspendCreateChildControls = false;

            CreateChildControls();
        }
Esempio n. 32
0
    // Use this for initialization
    void Start()
    {
        //Resolve interface variables
        m_SelectedManager   = ManagerResolver.Resolve <ISelectedManager>();
        m_Camera            = ManagerResolver.Resolve <ICamera>();
        m_GuiManager        = ManagerResolver.Resolve <IGUIManager>();
        m_MiniMapController = ManagerResolver.Resolve <IMiniMapController>();

        //Attach Event Handlers
        IEventsManager eventsManager = ManagerResolver.Resolve <IEventsManager>();

        eventsManager.MouseClick              += ButtonClickedHandler;
        eventsManager.MouseScrollWheel        += ScrollWheelHandler;
        eventsManager.KeyAction               += KeyBoardPressedHandler;
        eventsManager.ScreenEdgeMousePosition += MouseAtScreenEdgeHandler;

        //Attach gui width changed event
        GUIEvents.MenuWidthChanged += MenuWidthChanged;

        //Loader.main.FinishedLoading (this);
    }
Esempio n. 33
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ListBox{T}"/> class.
        /// </summary>
        /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
        /// <param name="position">Position of the Control reletive to its parent.</param>
        /// <param name="clientSize">The size of the <see cref="Control"/>'s client area.</param>
        /// <exception cref="ArgumentNullException"><paramref name="guiManager"/> is null.</exception>
        public ListBox(IGUIManager guiManager, Vector2 position, Vector2 clientSize) : base(guiManager, position, clientSize)
        {
            // ReSharper disable DoNotCallOverridableMethodsInConstructor
            if (Font != null)
            {
                ItemHeight = Font.GetLineSpacing();
            }
            else
            {
                ItemHeight = 12;
            }

            _itemDrawer = GetDefaultItemDrawer();
            // ReSharper restore DoNotCallOverridableMethodsInConstructor

            // Create the buttons
            _btnFirst = new PagedListButton(this, "First", () => CurrentPage = 1);
            _btnPrev  = new PagedListButton(this, "Previous", () => CurrentPage--);
            _btnNext  = new PagedListButton(this, "Next", () => CurrentPage++);
            _btnLast  = new PagedListButton(this, "Last", () => CurrentPage = NumPages);

            UpdateButtonPositions();
        }
Esempio n. 34
0
        /// <summary>
        /// Drops an item from the inventory onto the ground. If the user has just one item in the given <paramref name="slot"/>,
        /// then it is dropped. If they have multiple items in the <paramref name="slot"/>, then they are presented with an
        /// <see cref="InputBox"/> so they can enter in how much to drop.
        /// </summary>
        /// <param name="slot">The slot of the item to drop.</param>
        /// <param name="guiManager">The <see cref="IGUIManager"/> to use to create the <see cref="InputBox"/> if it is needed.</param>
        public void Drop(InventorySlot slot, IGUIManager guiManager)
        {
            // Check for a valid item
            var item = this[slot];
            if (item == null)
                return;

            // Check the amount
            if (item.Amount > 1)
            {
                // Create an InputBox to ask how much to drop
                const string text = "Drop item";
                const string message = "How much of the item do you wish to drop?\n(Enter a value from 1 to {0})";

                var inBox = InputBox.CreateNumericInputBox(guiManager, text, string.Format(message, item.Amount));
                inBox.Tag = slot;
                inBox.OptionSelected += DropInputBox_OptionSelected;
            }
            else
            {
                // Auto-drop if there is just one of the item
                Drop(slot, 1);
            }
        }
Esempio n. 35
0
 // Use this for initialization
 void Start()
 {
     m_GUIManager = ManagerResolver.Resolve <IGUIManager>();
 }
Esempio n. 36
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GuildInfoFormBase"/> class.
 /// </summary>
 /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
 /// <param name="position">Position of the Control reletive to its parent.</param>
 /// <param name="clientSize">The size of the <see cref="Control"/>'s client area.</param>
 /// <exception cref="ArgumentNullException"><paramref name="guiManager"/> is null.</exception>
 protected GuildInfoFormBase(IGUIManager guiManager, Vector2 position, Vector2 clientSize)
     : base(guiManager, position, clientSize)
 {
 }
Esempio n. 37
0
            public DeleteCharacterMessageBox(IGUIManager guiManager, string characterName, byte slot)
                : base(guiManager, _msgBoxTitle, string.Format(_msgBoxMsg, characterName), MessageBoxButton.OkCancel)
            {
                _slot = slot;

                DisposeOnSelection = true;
            }
Esempio n. 38
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GuildMembersForm"/> class.
 /// </summary>
 /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
 /// <param name="position">Position of the Control reletive to its parent.</param>
 /// <param name="clientSize">The size of the <see cref="Control"/>'s client area.</param>
 /// <exception cref="ArgumentNullException"><paramref name="guiManager"/> is null.</exception>
 public GuildMembersForm(IGUIManager guiManager, Vector2 position, Vector2 clientSize)
     : base(guiManager, position, clientSize)
 {
     _updateHandlerA = (x, y) => UpdateCache();
     _updateHandlerB = (x, y) => UpdateCache();
 }
Esempio n. 39
0
        /// <summary>
        /// Updates the <see cref="GameControl"/>.
        /// </summary>
        /// <param name="guiManager">The <see cref="IGUIManager"/> to get the key states from.</param>
        /// <param name="currentTime">The current time in milliseconds.</param>
        public void Update(IGUIManager guiManager, TickCount currentTime)
        {
            // Ensure the object is enabled and there is an invoke handler before checking the key states
            if (!IsEnabled || Invoked == null)
            {
                return;
            }

            // If there all the NewKeysDown are up, and we need to reset, then reset
            if (_needsReset)
            {
                if (GameControlKeys.NewKeysDown.IsEmpty() ||
                    !GameControlKeys.NewKeysDown.All(x => x.Key == Keyboard.Key.Unknown || guiManager.IsKeyDown(x.Key)))
                {
                    // All of the keys are up, so set the bool to false, allowing us to invoke again
                    _needsReset = false;
                }

                return;
            }

            // Check that enough time has elapsed since the last invoke
            if (currentTime - _lastInvokeTime < Delay)
            {
                return;
            }

            // Check the key states

            // Check if any of the keys required to be up are down
            if (GameControlKeys.KeysUp.Any(x => x.Key != Keyboard.Key.Unknown && guiManager.IsKeyDown(x.Key)))
            {
                return;
            }

            // Check that all of the keys required to be down are down
            if (!GameControlKeys.KeysDown.All(x => x.Key == Keyboard.Key.Unknown || guiManager.IsKeyDown(x.Key)))
            {
                return;
            }

            if (!GameControlKeys.NewKeysDown.All(x => x.Key == Keyboard.Key.Unknown || guiManager.IsKeyDown(x.Key)))
            {
                return;
            }

            // Check additional requirements
            if (AdditionalRequirements == null || !AdditionalRequirements())
            {
                return;
            }

            // All keys are in the needed state, so invoke the handler
            OnInvoked();

            if (Invoked != null)
            {
                Invoked.Raise(this, EventArgs.Empty);
            }

            // Set the timeout
            if (!GameControlKeys.NewKeysDown.IsEmpty())
            {
                _needsReset = true;
            }

            _lastInvokeTime = currentTime;
        }
Esempio n. 40
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GroupForm"/> class.
 /// </summary>
 /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
 /// <param name="position">Position of the Control reletive to its parent.</param>
 /// <param name="clientSize">The size of the <see cref="Control"/>'s client area.</param>
 /// <exception cref="ArgumentNullException"><paramref name="guiManager"/> is null.</exception>
 public GroupForm(IGUIManager guiManager, Vector2 position, Vector2 clientSize) : base(guiManager, position, clientSize)
 {
     _memberList = new GroupMemberListControl(this, position, clientSize);
     IsVisible   = false;
 }
 // Use this for initialization
 void Start()
 {
     m_GUIManager = ManagerResolver.Resolve<IGUIManager>();
 }
Esempio n. 42
0
 /// <summary>
 /// Adds an <see cref="IGUIManager"/> to this <see cref="ISkinManager"/>.
 /// </summary>
 /// <param name="guiManager">The <see cref="IGUIManager"/> to add.</param>
 void ISkinManager.AddGUIManager(IGUIManager guiManager)
 {
     if (!_guiManagers.Contains(guiManager))
         _guiManagers.Add(guiManager);
 }
Esempio n. 43
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InputBox"/> class.
 /// </summary>
 /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
 /// <param name="text">The message box's title text.</param>
 /// <param name="message">The message to display.</param>
 /// <param name="buttonTypes">The <see cref="MessageBoxButton"/>s to display. Default is <see cref="MessageBoxButton.OkCancel"/></param>
 /// <param name="maxWidth">The maximum width of the created <see cref="MessageBox"/>. If less than or equal to 0, then
 /// the <see cref="MessageBox.DefaultMaxWidth"/> will be used instead. Default is 0.</param>
 public InputBox(IGUIManager guiManager, string text, string message,
                 MessageBoxButton buttonTypes = MessageBoxButton.OkCancel, int maxWidth = 0)
     : base(guiManager, text, message, buttonTypes, maxWidth)
 {
 }
Esempio n. 44
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Control"/> class.
 /// </summary>
 /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
 /// <param name="position">Position of the Control reletive to its parent.</param>
 /// <param name="clientSize">The size of the <see cref="Control"/>'s client area.</param>
 /// <exception cref="ArgumentNullException"><paramref name="guiManager"/> is null.</exception>
 public PictureBox(IGUIManager guiManager, Vector2 position, Vector2 clientSize) : base(guiManager, position, clientSize)
 {
 }
Esempio n. 45
0
 public static void Init(ISpaceContext spaceContext, IGUIManager GUIManager)
 {
     space         = spaceContext;
     gui           = GUIManager;
     IsInitialized = true;
 }
Esempio n. 46
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GuildForm"/> class.
 /// </summary>
 /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
 /// <param name="position">Position of the Control reletive to its parent.</param>
 /// <exception cref="ArgumentNullException"><paramref name="guiManager"/> is null.</exception>
 public GuildForm(IGUIManager guiManager, Vector2 position) : base(guiManager, position, new Vector2(125, 275))
 {
     IsVisible = false;
     CreateControls();
 }
Esempio n. 47
0
 /// <summary>
 /// Removes an <see cref="IGUIManager"/> from this <see cref="ISkinManager"/>.
 /// </summary>
 /// <param name="guiManager">The <see cref="IGUIManager"/> to remove.</param>
 bool ISkinManager.RemoveGUIManager(IGUIManager guiManager)
 {
     return _guiManagers.Remove(guiManager);
 }
    // Use this for initialization
    void Start()
    {
        Debug.Log(primaryPlayer.controlledLayer + " swag");
        //Resolve interface variables
        m_SelectedManager = ManagerResolver.Resolve<ISelectedManager>();
        m_Camera = ManagerResolver.Resolve<ICamera>();
        m_GuiManager = ManagerResolver.Resolve<IGUIManager>();
        m_MiniMapController = ManagerResolver.Resolve<IMiniMapController>();

        //Attach Event Handlers
        IEventsManager eventsManager = ManagerResolver.Resolve<IEventsManager>();
        eventsManager.MouseClick += ButtonClickedHandler;
        eventsManager.MouseScrollWheel += ScrollWheelHandler;
        eventsManager.KeyAction += KeyBoardPressedHandler;
        eventsManager.ScreenEdgeMousePosition += MouseAtScreenEdgeHandler;

        //Attach gui width changed event
        GUIEvents.MenuWidthChanged += MenuWidthChanged;

        //Resolve player tag / layer variables
        SetPlayerIdentifiers();

        //Loader.main.FinishedLoading (this);
    }
 /// <summary>
 /// Initializes a new instance of the <see cref="GuildOnlineMembersForm"/> class.
 /// </summary>
 /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
 /// <param name="position">Position of the Control reletive to its parent.</param>
 /// <param name="clientSize">The size of the <see cref="Control"/>'s client area.</param>
 /// <exception cref="ArgumentNullException"><paramref name="guiManager"/> is null.</exception>
 public GuildOnlineMembersForm(IGUIManager guiManager, Vector2 position, Vector2 clientSize)
     : base(guiManager, position, clientSize)
 {
     _updateHandler = (x, y) => UpdateCache();
 }
Esempio n. 50
0
 /// <summary>
 /// Creates a <see cref="InputBox"/> that only accepts numeric values.
 /// </summary>
 /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
 /// <param name="text">The message box's title text.</param>
 /// <param name="message">The message to display.</param>
 /// <param name="buttonTypes">The <see cref="MessageBoxButton"/>s to display. Default is <see cref="MessageBoxButton.OkCancel"/></param>
 /// <param name="maxWidth">The maximum width of the created <see cref="MessageBox"/>. If less than or equal to 0, then
 /// the <see cref="MessageBox.DefaultMaxWidth"/> will be used instead. Default is 0.</param>
 /// <returns>An <see cref="InputBox"/> that only accepts numeric values.</returns>
 public static InputBox CreateNumericInputBox(IGUIManager guiManager, string text, string message,
                                              MessageBoxButton buttonTypes = MessageBoxButton.OkCancel, int maxWidth = 0)
 {
     var ret = new InputBox(guiManager, text, message, buttonTypes, maxWidth);
     ret.InputControl.AllowKeysHandler = TextEventArgsFilters.IsDigitFunc;
     ret.InputText = "0";
     return ret;
 }
Esempio n. 51
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Label"/> class.
 /// </summary>
 /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
 /// <param name="position">Position of the Control reletive to its parent.</param>
 /// <exception cref="ArgumentNullException"><paramref name="guiManager"/> is null.</exception>
 public CheckBox(IGUIManager guiManager, Vector2 position) : base(guiManager, position)
 {
     HandleAutoResize();
 }
Esempio n. 52
0
        /// <summary>
        /// Updates the <see cref="GameControl"/>.
        /// </summary>
        /// <param name="guiManager">The <see cref="IGUIManager"/> to get the key states from.</param>
        /// <param name="currentTime">The current time in milliseconds.</param>
        public void Update(IGUIManager guiManager, TickCount currentTime)
        {
            // Ensure the object is enabled and there is an invoke handler before checking the key states
            if (!IsEnabled || Invoked == null)
                return;

            // If there all the NewKeysDown are up, and we need to reset, then reset
            if (_needsReset)
            {
                if (GameControlKeys.NewKeysDown.IsEmpty() ||
                    !GameControlKeys.NewKeysDown.All(x => x.Key == KeyCode.None || guiManager.IsKeyDown(x.Key)))
                {
                    // All of the keys are up, so set the bool to false, allowing us to invoke again
                    _needsReset = false;
                }

                return;
            }

            // Check that enough time has elapsed since the last invoke
            if (currentTime - _lastInvokeTime < Delay)
                return;

            // Check the key states

            // Check if any of the keys required to be up are down
            if (GameControlKeys.KeysUp.Any(x => x.Key != KeyCode.None && guiManager.IsKeyDown(x.Key)))
                return;

            // Check that all of the keys required to be down are down
            if (!GameControlKeys.KeysDown.All(x => x.Key == KeyCode.None || guiManager.IsKeyDown(x.Key)))
                return;

            if (!GameControlKeys.NewKeysDown.All(x => x.Key == KeyCode.None || guiManager.IsKeyDown(x.Key)))
                return;

            // Check additional requirements
            if (AdditionalRequirements == null || !AdditionalRequirements())
                return;

            // All keys are in the needed state, so invoke the handler
            OnInvoked();

            if (Invoked != null)
                Invoked.Raise(this, EventArgs.Empty);

            // Set the timeout
            if (!GameControlKeys.NewKeysDown.IsEmpty())
                _needsReset = true;

            _lastInvokeTime = currentTime;
        }
Esempio n. 53
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Button"/> class.
 /// </summary>
 /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
 /// <param name="position">Position of the Control reletive to its parent.</param>
 /// <param name="clientSize">The size of the <see cref="Control"/>'s client area.</param>
 /// <exception cref="ArgumentNullException"><paramref name="guiManager"/> is null.</exception>
 public Button(IGUIManager guiManager, Vector2 position, Vector2 clientSize) : base(guiManager, position, clientSize)
 {
 }
Esempio n. 54
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Control"/> class.
        /// </summary>
        /// <param name="parent">Parent <see cref="Control"/> of this <see cref="Control"/>.</param>
        /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
        /// <param name="position">Position of the Control reletive to its parent.</param>
        /// <param name="clientSize">The size of the <see cref="Control"/>'s client area.</param>
        /// <exception cref="ArgumentNullException"><paramref name="guiManager"/> is null.</exception>
        /// <exception cref="ArgumentException"><paramref name="parent"/> control is disposed.</exception>
        Control(Control parent, IGUIManager guiManager, Vector2 position, Vector2 clientSize)
        {
            if (guiManager == null)
                throw new ArgumentNullException("guiManager", "GUIManager cannot be null.");

            _gui = guiManager;
            _parent = parent;

            _border = ControlBorder.Empty;
            _position = position;
            _size = clientSize;

            // Get the root
            if (Parent == null)
                _root = this;
            else
                _root = Parent.Root;

            if (Parent != null)
            {
                // Check that the parent isn't disposed
                if (Parent.IsDisposed)
                    throw new ArgumentException("Parent control is disposed and cannot be used.", "parent");

                // Add the Control to the parent
                Parent._controls.Add(this);
                KeepInParent();

                if (Parent.ResizeToChildren)
                    Parent.UpdateResizeToChildren();
            }
            else
            {
                _alwaysOnTop = GetIsAlwaysOnTop();

                // This control is the root, so add it directly to the GUI manager
                GUIManager.Add(this);
            }

            SetDefaultValues();
        }
Esempio n. 55
0
        /// <summary>
        /// Updates the targeting.
        /// </summary>
        /// <param name="gui">THe <see cref="IGUIManager"/>.</param>
        public void Update(IGUIManager gui)
        {
            var cursorPos = gui.CursorPosition;

            MouseOverTarget = _world.Map.Spatial.Get<IDrawableTarget>(_world.Camera.ToWorld(cursorPos));

            if (gui.IsMouseButtonDown(MouseButton.Left))
            {
                if (MouseOverTarget != null)
                {
                    Target = MouseOverTarget == _world.UserChar ? null : MouseOverTarget;
                }
                else
                {
                    Target =  null;
                }
            }

            if (MouseOverTarget != null && MouseOverTarget.IsDisposed)
                MouseOverTarget =  null;

            if (Target != null && Target.IsDisposed)
                Target = null;

        }
Esempio n. 56
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Control"/> class.
 /// </summary>
 /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
 /// <param name="position">Position of the Control reletive to its parent.</param>
 /// <param name="clientSize">The size of the <see cref="Control"/>'s client area.</param>
 /// <exception cref="ArgumentNullException"><paramref name="guiManager"/> is null.</exception>
 protected Control(IGUIManager guiManager, Vector2 position, Vector2 clientSize)
     : this(null, guiManager, position, clientSize)
 {
 }
Esempio n. 57
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GuildMembersFormBase"/> class.
 /// </summary>
 /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
 /// <param name="position">Position of the Control reletive to its parent.</param>
 /// <param name="clientSize">The size of the <see cref="Control"/>'s client area.</param>
 /// <exception cref="ArgumentNullException"><paramref name="guiManager"/> is null.</exception>
 protected GuildMembersFormBase(IGUIManager guiManager, Vector2 position, Vector2 clientSize)
     : base(guiManager, position, clientSize)
 {
     _lstMembers = new GuildMemberListControl(this, Vector2.Zero, ClientSize) { Items = _listItemsCache };
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GroupMemberListControl"/> class.
 /// </summary>
 /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
 /// <param name="position">Position of the Control reletive to its parent.</param>
 /// <param name="clientSize">The size of the <see cref="Control"/>'s client area.</param>
 /// <exception cref="ArgumentNullException"><paramref name="guiManager"/> is null.</exception>
 public GroupMemberListControl(IGUIManager guiManager, Vector2 position, Vector2 clientSize)
     : base(guiManager, position, clientSize)
 {
     ShowPaging = true;
 }
Esempio n. 59
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Label"/> class.
 /// </summary>
 /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
 /// <param name="position">Position of the Control reletive to its parent.</param>
 /// <exception cref="ArgumentNullException"><paramref name="guiManager"/> is null.</exception>
 public CheckBox(IGUIManager guiManager, Vector2 position) : base(guiManager, position)
 {
     HandleAutoResize();
 }
Esempio n. 60
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TextControl"/> class.
 /// </summary>
 /// <param name="guiManager">The GUI manager this <see cref="Control"/> will be managed by.</param>
 /// <param name="position">Position of the Control reletive to its parent.</param>
 /// <param name="clientSize">The size of the <see cref="Control"/>'s client area.</param>
 /// <exception cref="ArgumentNullException"><paramref name="guiManager"/> is null.</exception>
 protected TextControl(IGUIManager guiManager, Vector2 position, Vector2 clientSize)
     : base(guiManager, position, clientSize)
 {
 }