コード例 #1
0
ファイル: MessageBox.cs プロジェクト: galaxyyao/TouhouGrave
 public MessageBox(Graphics.TexturedQuad buttonFace, TextRenderer.IFormattedText[] buttonTexts)
 {
     m_commonButtons = new CommonButtons(buttonFace, buttonTexts);
     m_commonButtons.Dispatcher = this;
     m_commonButtons.ButtonClicked += btn =>
     {
         if (ButtonClicked != null)
         {
             ButtonClicked(btn);
         }
     };
     m_renderableProxy = new RenderableProxy(this);
 }
コード例 #2
0
        public NumberSelector(TextRenderer.IFormattedText[] digits, TextRenderer.IFormattedText[] signs, Graphics.TexturedQuad upButtonFace, Graphics.TexturedQuad downButtonFace,
            Graphics.TexturedQuad okCancelButtonFace, TextRenderer.IFormattedText[] okCancelTexts)
        {
            if (digits == null)
            {
                throw new ArgumentNullException("digits");
            }
            else if (digits.Length != 10 || digits.Contains(null))
            {
                throw new ArgumentException("Digits array is not provided appropriately.");
            }
            else if (signs == null)
            {
                throw new ArgumentNullException("signs");
            }
            else if (signs.Length != 2 || signs.Contains(null))
            {
                throw new ArgumentException("Signs array is not provided appropriately.");
            }
            else if (upButtonFace == null)
            {
                throw new ArgumentNullException("upButtonFace");
            }
            else if (downButtonFace == null)
            {
                throw new ArgumentNullException("downButtonFace");
            }
            else if (okCancelTexts == null)
            {
                throw new ArgumentNullException("okCancelTexts");
            }
            else if (okCancelTexts.Length != NumButtons || okCancelTexts.Contains(null))
            {
                throw new ArgumentException("OkCancelTexts array is not provided appropriately.");
            }

            m_digits = digits;
            m_signs = signs;
            m_upButtonFace = upButtonFace;
            m_downButtonFace = downButtonFace;

            var buttonTexts = new TextRenderer.IFormattedText[CommonButtons.NumButtons];
            buttonTexts[CommonButtons.ButtonOK] = okCancelTexts[ButtonOK];
            buttonTexts[CommonButtons.ButtonCancel] = okCancelTexts[ButtonCancel];
            m_commonButtons = new CommonButtons(okCancelButtonFace, buttonTexts);
            m_commonButtons.Dispatcher = this;
            m_commonButtons.ButtonClicked += btn =>
            {
                if (ButtonClicked != null)
                {
                    ButtonClicked(btn, CurrentValue);
                }
            };
            m_renderableProxy = new RenderableProxy(this);

            SetRange(0, 1);
        }
コード例 #3
0
        public CommonButtons(Graphics.TexturedQuad buttonFace, TextRenderer.IFormattedText[] buttonTexts)
        {
            if (buttonFace == null)
            {
                throw new ArgumentNullException("buttonFace");
            }
            else if (buttonTexts == null)
            {
                throw new ArgumentNullException("buttonTexts");
            }
            else if (buttonTexts.Length != 4 || buttonTexts.All(txt => txt == null))
            {
                throw new ArgumentException("ButtonTexts array is not provided appropriately.");
            }

            m_buttonFace = buttonFace;
            m_buttonTexts = buttonTexts;

            CreateButtons();
        }