Beispiel #1
0
        public UIColorPicker()
        {
            ClickHandler =
                ListenForMouse(new Rectangle(0, 0, 206, 128), new UIMouseEvent(OnMouseEvent));

            RedText = new UITextBox();
            RedText.SetBackgroundTexture(null, 0, 0, 0, 0);
            RedText.SetSize(40, 22);
            RedText.Position  = new Vector2(232, 50);
            RedText.OnChange += RecalcColor;
            Add(RedText);

            var redLabel = new UILabel();

            redLabel.Position = RedText.Position - new Vector2(20, -4);
            redLabel.Caption  = "R:";
            Add(redLabel);

            GreenText = new UITextBox();
            GreenText.SetBackgroundTexture(null, 0, 0, 0, 0);
            GreenText.SetSize(40, 22);
            GreenText.Position  = new Vector2(232, 50 + 28);
            GreenText.OnChange += RecalcColor;
            Add(GreenText);

            var greenLabel = new UILabel();

            greenLabel.Position = GreenText.Position - new Vector2(20, -4);
            greenLabel.Caption  = "G:";
            Add(greenLabel);

            BlueText = new UITextBox();
            BlueText.SetBackgroundTexture(null, 0, 0, 0, 0);
            BlueText.SetSize(40, 22);
            BlueText.Position  = new Vector2(232, 50 + 28 * 2);
            BlueText.OnChange += RecalcColor;
            Add(BlueText);

            var blueLabel = new UILabel();

            blueLabel.Position = BlueText.Position - new Vector2(20, -4);
            blueLabel.Caption  = "B:";
            Add(blueLabel);

            HexText = new UITextBox();
            HexText.SetBackgroundTexture(null, 0, 0, 0, 0);
            HexText.SetSize(68, 45);
            HexText.Alignment        = TextAlignment.Center | TextAlignment.Middle;
            HexText.TextStyle        = HexText.TextStyle.Clone();
            HexText.TextStyle.Shadow = true;
            HexText.TextStyle.Size   = 8;
            HexText.Position         = new Vector2(208, 0);
            HexText.OnChange        += HexText_OnChange;
            Add(HexText);

            InternalChange = 1;
            RecalcColor(null);
            InternalChange = 0;
        }
Beispiel #2
0
        public UIChatPanel(VM vm, UILotControl owner)
        {
            this.vm    = vm;
            this.Owner = owner;

            if (FSOEnvironment.SoftwareKeyboard)
            {
                //need a button to initiate chat history
                var btn = new UIButton();
                btn.Caption        = "Chat";
                btn.Position       = new Vector2(10, 10);
                btn.OnButtonClick += (state) =>
                {
                    HistoryDialog.Visible = !HistoryDialog.Visible;
                };
                Add(btn);
            }

            Style        = TextStyle.DefaultTitle.Clone();
            Style.Size   = 16;
            Style.Shadow = true;
            Labels       = new List <UIChatBalloon>();

            TextBox = new UITextBox();
            TextBox.SetBackgroundTexture(null, 0, 0, 0, 0);
            TextBox.Visible = false;
            Add(TextBox);
            TextBox.Position = new Vector2(25, 25);
            TextBox.SetSize(GlobalSettings.Default.GraphicsWidth - 50, 25);

            SelectionFillColor = new Color(0, 25, 70);

            //-- populate invalid areas --
            //chat bubbles will be pushed out of these areas
            //when this happens, they will also begin displaying the name of the speaking avatar.

            InvalidAreas = new List <Rectangle>();
            InvalidAreas.Add(new Rectangle(-100000, -100000, 100020, 200000 + GlobalSettings.Default.GraphicsHeight));                                   //left
            InvalidAreas.Add(new Rectangle(-100000, -100000, 200000 + GlobalSettings.Default.GraphicsWidth, 100020));                                    //top
            InvalidAreas.Add(new Rectangle(GlobalSettings.Default.GraphicsWidth - 20, -100000, 100020, 200000 + GlobalSettings.Default.GraphicsHeight)); //right
            InvalidAreas.Add(new Rectangle(-100000, GlobalSettings.Default.GraphicsHeight - 20, 200000 + GlobalSettings.Default.GraphicsWidth, 100020)); //bottom
            InvalidAreas.Add(new Rectangle(-100000, GlobalSettings.Default.GraphicsHeight - 230, 100230, 100230));                                       //ucp

            HistoryDialog                = new UIChatDialog();
            HistoryDialog.Position       = new Vector2(20, 20);
            HistoryDialog.Visible        = false;
            HistoryDialog.Opacity        = 0.75f;
            HistoryDialog.OnSendMessage += SendMessage;
            this.Add(HistoryDialog);

            PropertyLog          = new UIPropertyLog();
            PropertyLog.Position = new Vector2(400, 20);
            PropertyLog.Visible  = false;
            PropertyLog.Opacity  = 0.75f;
            this.Add(PropertyLog);
        }
Beispiel #3
0
 /// <summary>
 /// A UICheatTextbox with text
 /// </summary>
 /// <param name="initialText"></param>
 public UICheatTextbox(FSO.SimAntics.VM vm, string initialText)
 {
     ts1VM       = vm;
     baseTextbox = new UITextBox()
     {
         CurrentText  = initialText,
         FlashOnEmpty = true,
         MaxLines     = 1,
         //Tooltip = "Cheaters never win",
         //FrameColor = Color.Transparent,
         ID = "UICheatTextboxBase",
     };
     baseTexture = new Texture2D(GameFacade.GraphicsDevice, 1, 1);
     baseTexture.SetData(new Color[] { new Color((byte)67, (byte)93, (byte)90, (byte)255) });
     baseTextbox.SetBackgroundTexture(baseTexture, 0, 0, 0, 0);
     Size = new Vector2(200, 23);
     baseTextbox.SetSize(200, 23);
     Add(baseTextbox);
 }