コード例 #1
0
        /// <summary>
        /// Constructs a CmdButtonSpriteGroup instance.
        /// </summary>
        /// <param name="cmdPanelView">Reference to the command panel view.</param>
        /// <param name="btnState">The button state for which this sprite group belongs to.</param>
        public CmdButtonSpriteGroup(ICommandView cmdPanelView, CommandButtonStateEnum btnState)
            : base()
        {
            if (cmdPanelView == null)
            {
                throw new ArgumentNullException("cmdPanelView");
            }

            this.commandPanelView = cmdPanelView;
            this.buttonState      = btnState;
        }
コード例 #2
0
        /// <summary>
        /// This method is called when this RCCommandButton has been pressed.
        /// </summary>
        private void OnButtonPressed(UISensitiveObject sender)
        {
            if (sender != this)
            {
                throw new InvalidOperationException("Unexpected sender!");
            }

            CommandButtonStateEnum buttonState = this.commandPanelView.GetCmdButtonState(this.slotCoords);

            if (buttonState == CommandButtonStateEnum.Invisible || buttonState == CommandButtonStateEnum.Disabled)
            {
                return;
            }
            this.commandService.PressCommandButton(this.slotCoords);
        }
コード例 #3
0
        /// <see cref="UIObject.Render_i"/>
        protected override void Render_i(IUIRenderContext renderContext)
        {
            CommandButtonStateEnum buttonState = this.commandPanelView.GetCmdButtonState(this.slotCoords);

            if (buttonState == CommandButtonStateEnum.Invisible)
            {
                return;
            }
            if (!this.commandButtonSprites.ContainsKey(buttonState))
            {
                return;
            }

            SpriteRenderInfo renderedSprite = this.commandPanelView.GetCmdButtonSprite(this.slotCoords);

            renderContext.RenderSprite(this.commandButtonSprites[buttonState][renderedSprite.Index],
                                       renderedSprite.DisplayCoords,
                                       renderedSprite.Section);
        }