public void LoadView()
    {
        mBox = new UIBox(UIConstants.BoxRect, UIConstants.MainBackground);

        mBackgroundTextureLabel = new UILabel(UIConstants.RectLabelOne, UIConstants.CloudRecognition);

        string [] extendedTrackingStyle = {UIConstants.ExtendedTrackingStyleOff, UIConstants.ExtendedTrackingStyleOn};
        mExtendedTracking = new UICheckButton(UIConstants.RectOptionOne, false, extendedTrackingStyle);

        string[] aboutStyles = { UIConstants.AboutLableStyle, UIConstants.AboutLableStyle };
        mAboutLabel = new UICheckButton(UIConstants.RectLabelAbout, false, aboutStyles);

        string[] cameraFlashStyles = {UIConstants.CameraFlashStyleOff, UIConstants.CameraFlashStyleOn};
        mCameraFlashSettings = new UICheckButton(UIConstants.RectOptionThree, false, cameraFlashStyles);

        string[] autofocusStyles = {UIConstants.AutoFocusStyleOff, UIConstants.AutoFocusStyleOn};
        mAutoFocusSetting = new UICheckButton(UIConstants.RectOptionTwo, false, autofocusStyles);

        mCameraLabel = new UILabel(UIConstants.RectLabelTwo, UIConstants.CameraLabelStyle);

        string[,] cameraFacingStyles = new string[2,2] {{UIConstants.CameraFacingFrontStyleOff, UIConstants.CameraFacingFrontStyleOn},{ UIConstants.CameraFacingRearStyleOff, UIConstants.CameraFacingRearStyleOn}};
        UIRect[] cameraRect = { UIConstants.RectOptionFour, UIConstants.RectOptionFive };
        mCameraFacing = new UIRadioButton(cameraRect, 1, cameraFacingStyles);

        string[] closeButtonStyles = {UIConstants.closeButtonStyleOff, UIConstants.closeButtonStyleOn };
        mCloseButton = new UIButton(UIConstants.CloseButtonRect, closeButtonStyles);
    }
Exemplo n.º 2
0
    public void LoadView()
    {
        mBox = new UIBox(UIConstants.BoxRect, UIConstants.MainBackground);

        mImageTargetLabel = new UILabel(UIConstants.RectLabelOne, UIConstants.ImageTargetLabelStyle);

        string[] aboutStyles = { UIConstants.AboutLableStyle, UIConstants.AboutLableStyle };
        mAboutLabel = new UICheckButton(UIConstants.RectLabelAbout, false, aboutStyles);

        string[] offTargetTrackingStyles = { UIConstants.ExtendedTrackingStyleOff, UIConstants.ExtendedTrackingStyleOn };
        mExtendedTracking = new UICheckButton(UIConstants.RectOptionOne, false, offTargetTrackingStyles);

        string[] cameraFlashStyles = {UIConstants.CameraFlashStyleOff, UIConstants.CameraFlashStyleOn};
        mCameraFlashSettings = new UICheckButton(UIConstants.RectOptionThree, false, cameraFlashStyles);

        string[] autofocusStyles = {UIConstants.AutoFocusStyleOff, UIConstants.AutoFocusStyleOn};
        mAutoFocusSetting = new UICheckButton(UIConstants.RectOptionTwo, false, autofocusStyles);

        mCameraLabel = new UILabel(UIConstants.RectLabelTwo, UIConstants.CameraLabelStyle);

        string[,] cameraFacingStyles = new string[2,2] {{UIConstants.CameraFacingFrontStyleOff, UIConstants.CameraFacingFrontStyleOn},{ UIConstants.CameraFacingRearStyleOff, UIConstants.CameraFacingRearStyleOn}};
        UIRect[] cameraRect = { UIConstants.RectOptionFour, UIConstants.RectOptionFive };
        mCameraFacing = new UIRadioButton(cameraRect, 1, cameraFacingStyles);

        string[,] datasetStyles = new string[2,2] {{UIConstants.StonesAndChipsStyleOff, UIConstants.StonesAndChipsStyleOn}, {UIConstants.TarmacOff, UIConstants.TarmacOn}};
        UIRect[] datasetRect = { UIConstants.RectOptionSix, UIConstants.RectOptionSeven};
        mDataSet = new UIRadioButton(datasetRect, 0, datasetStyles);

        mDataSetLabel = new UILabel(UIConstants.RectLabelThree, UIConstants.DatasetLabelStyle);

        string[] closeButtonStyles = {UIConstants.closeButtonStyleOff, UIConstants.closeButtonStyleOn };
        mCloseButton = new UIButton(UIConstants.CloseButtonRect, closeButtonStyles);
    }
Exemplo n.º 3
0
        private void AddFilter()
        {
            //Loads the RealChute parachutes icon
            Texture2D normal = new Texture2D(32, 32), selected = new Texture2D(32, 32);

            normal.LoadImage(File.ReadAllBytes(Path.Combine(RCUtils.PluginDataURL, "FilterIcon.png")));
            selected.LoadImage(File.ReadAllBytes(Path.Combine(RCUtils.PluginDataURL, "FilterIcon_selected.png")));
            Icon icon = new Icon("RC_Parachutes", normal, selected);

            //Adds the Parachutes filter to the Filter by Function category
            PartCategorizer.Category filterByFunction = PartCategorizer.Instance.filters.Find(f => f.button.categorydisplayName == "#autoLOC_453547"); // Filter by Function
            PartCategorizer.AddCustomSubcategoryFilter(filterByFunction, "Parachutes", "Parachutes", icon,
                                                       p => p.moduleInfos.Any(m => m.moduleName == "RealChute" || m.moduleName == "Parachute"));

            //Sets the buttons in the Filter by Module category
            List <PartCategorizer.Category> modules = PartCategorizer.Instance.filters
                                                      .Find(f => f.button.categorydisplayName == "#autoLOC_453705").subcategories; // Filter by Module

            modules.Remove(modules.Find(m => m.button.categoryName == "Procedural Chute"));
            modules.Select(m => m.button).Single(b => b.categoryName == "RealChute").SetIcon(icon);

            //Apparently needed to make sure the buttons in Filter by Function show when the editor is loaded
            UIRadioButton button = filterByFunction.button.activeButton;

            button.SetState(UIRadioButton.State.False, UIRadioButton.CallType.APPLICATION, null, false);
            button.SetState(UIRadioButton.State.True, UIRadioButton.CallType.APPLICATION, null, false);
        }
Exemplo n.º 4
0
    public void LoadView()
    {
        mBox = new UIBox(UIConstants.BoxRect, UIConstants.MainBackground);

        mVideoPlaybackLabel = new UILabel(UIConstants.RectLabelOne, UIConstants.VideoPlaybackLabelStyle);

        string[] aboutStyles = { UIConstants.AboutLableStyle, UIConstants.AboutLableStyle };
        mAboutLabel = new UICheckButton(UIConstants.RectLabelAbout, false, aboutStyles);

        string[] extendedTrackingStyles = { UIConstants.ExtendedTrackingStyleOff, UIConstants.ExtendedTrackingStyleOn };
        mExtendedTracking = new UICheckButton(UIConstants.RectOptionOne, false, extendedTrackingStyles);

        string[] cameraFlashStyles = { UIConstants.CameraFlashStyleOff, UIConstants.CameraFlashStyleOn };
        mCameraFlashSettings = new UICheckButton(UIConstants.RectOptionThree, false, cameraFlashStyles);

        string[] autofocusStyles = { UIConstants.AutoFocusStyleOff, UIConstants.AutoFocusStyleOn };
        mAutoFocusSetting = new UICheckButton(UIConstants.RectOptionTwo, false, autofocusStyles);

        mCameraLabel = new UILabel(UIConstants.RectLabelTwo, UIConstants.CameraLabelStyle);

        string[,] cameraFacingStyles = new string[2, 2] {
            { UIConstants.CameraFacingFrontStyleOff, UIConstants.CameraFacingFrontStyleOn }, { UIConstants.CameraFacingRearStyleOff, UIConstants.CameraFacingRearStyleOn }
        };
        UIRect[] cameraRect = { UIConstants.RectOptionFour, UIConstants.RectOptionFive };
        mCameraFacing = new UIRadioButton(cameraRect, 1, cameraFacingStyles);

        string[] closeButtonStyles = { UIConstants.closeButtonStyleOff, UIConstants.closeButtonStyleOn };
        mCloseButton = new UIButton(UIConstants.CloseButtonRect, closeButtonStyles);
    }
Exemplo n.º 5
0
    public void LoadView()
    {
        mBox = new UIBox(UIConstants.BoxRect, UIConstants.MainBackground);

        mHeaderLabel = new UILabel(UIConstants.RectLabelOne, UIConstants.UDTTextureStyle);

        string[] aboutStyles = { UIConstants.AboutLableStyle, UIConstants.AboutLableStyle };
        mAboutLabel = new UICheckButton(UIConstants.RectLabelAbout, false, aboutStyles);

        string[] extendedTrackingStyles = { UIConstants.ExtendedTrackingStyleOff, UIConstants.ExtendedTrackingStyleOn };
        mExtendedTracking = new UICheckButton(UIConstants.RectOptionOne, false, extendedTrackingStyles);

        string[] cameraFlashStyles = {UIConstants.CameraFlashStyleOff, UIConstants.CameraFlashStyleOn};
        mCameraFlashSettings = new UICheckButton(UIConstants.RectOptionThree, false, cameraFlashStyles);

        string[] autofocusStyles = {UIConstants.AutoFocusStyleOff, UIConstants.AutoFocusStyleOn};
        mAutoFocusSetting = new UICheckButton(UIConstants.RectOptionTwo, false, autofocusStyles);

        mCameraLabel = new UILabel(UIConstants.RectLabelTwo, UIConstants.CameraLabelStyle);

        string[,] cameraFacingStyles = new string[2,2] {{UIConstants.CameraFacingFrontStyleOff, UIConstants.CameraFacingFrontStyleOn},{ UIConstants.CameraFacingRearStyleOff, UIConstants.CameraFacingRearStyleOn}};
        UIRect[] cameraRect = { UIConstants.RectOptionFour, UIConstants.RectOptionFive };
        mCameraFacing = new UIRadioButton(cameraRect, 1, cameraFacingStyles);

        string[] closeButtonStyles = {UIConstants.closeButtonStyleOff, UIConstants.closeButtonStyleOn };
        mCloseButton = new UIButton(UIConstants.CloseButtonRect, closeButtonStyles);

        //      Rect rect = new Rect(0.4f * Screen.width, Screen.height - (100 * Screen.width)/800.0f, 0.3f * Screen.width, (70.0f * Screen.width)/800.0f);
        //      string[] newUDTButtonStyles = {"UserInterface/capture_button_normal_XHigh", "UserInterface/capture_button_normal_XHigh"};
        //      string imageForButton = "UserInterface/icon_camera";
        //      mNewUserDefinedTargetButton = new UIButton(rect, newUDTButtonStyles, imageForButton);
    }
Exemplo n.º 6
0
        void AddRadioGroup(string title, string groupName, string[] optionLabels, object[] optionValues)
        {
            var vbox = new UIVBoxContainer();

            vbox.Add(new UILabel()
            {
                Caption = title
            });

            for (var i = 0; i < optionLabels.Length; i++)
            {
                var formField = new UIHBoxContainer();
                vbox.Add(formField);

                var radio = new UIRadioButton
                {
                    RadioData  = optionValues[i],
                    RadioGroup = groupName
                };
                radio.OnButtonClick += Radio_OnButtonClick;
                radio.Tooltip        = optionLabels[i];

                formField.Add(radio);

                formField.Add(new UILabel {
                    Caption = optionLabels[i]
                });
            }

            Container.Add(vbox);
        }
Exemplo n.º 7
0
 public void UnLoadView()
 {
     mVideoPlaybackLabel = null;
     mExtendedTracking = null;
     mCameraFlashSettings = null;
     mAutoFocusSetting = null;
     mCameraLabel = null;
     mCameraFacing = null;
     mAboutLabel = null;
 }
Exemplo n.º 8
0
 public void UnLoadView()
 {
     mBackgroundTextureLabel = null;
     mExtendedTracking       = null;
     mCameraFlashSettings    = null;
     mAutoFocusSetting       = null;
     mAboutLabel             = null;
     mCameraLabel            = null;
     mCameraFacing           = null;
 }
Exemplo n.º 9
0
 public void UnLoadView()
 {
     mVideoPlaybackLabel  = null;
     mExtendedTracking    = null;
     mCameraFlashSettings = null;
     mAutoFocusSetting    = null;
     mCameraLabel         = null;
     mCameraFacing        = null;
     mAboutLabel          = null;
 }
Exemplo n.º 10
0
 public void UnLoadView()
 {
     mAboutLabel          = null;
     mImageTargetLabel    = null;
     mExtendedTracking    = null;
     mCameraFlashSettings = null;
     mAutoFocusSetting    = null;
     mCameraLabel         = null;
     mCameraFacing        = null;
     mDataSet             = null;
     mDataSetLabel        = null;
 }
Exemplo n.º 11
0
    void CreateRadioButton(GameObject go)
    {
        if (UISettings.atlas != null)
        {
            NGUIEditorTools.DrawSpriteField("Normal", "Active state sprite", UISettings.atlas, mImage0, (name) =>
            {
                if (mImage0 != name)
                {
                    mImage0 = name; Save(); Repaint();
                }
            }, GUILayout.Width(120f));

            NGUIEditorTools.DrawSpriteField("Pressed", "Unactive state sprite", UISettings.atlas, mImage1, (name) =>
            {
                if (mImage1 != name)
                {
                    mImage1 = name; Save(); Repaint();
                }
            }, GUILayout.Width(120f));
        }

        if (ShouldCreate(go, UISettings.atlas != null))
        {
            int depth = NGUITools.CalculateNextDepth(go);
            go      = NGUITools.AddChild(go);
            go.name = "Radio Button";

            UIAtlas.Sprite sp     = UISettings.atlas.GetSprite(mImage0);
            UISprite       sprite = (sp.inner == sp.outer) ? NGUITools.AddWidget <UISprite>(go) :
                                    (UISprite)NGUITools.AddWidget <UISlicedSprite>(go);

            sprite.name       = "Background";
            sprite.depth      = depth;
            sprite.atlas      = UISettings.atlas;
            sprite.spriteName = mImage0;
            //sprite.transform.localScale = new Vector3(150f, 40f, 1f);
            sprite.Dimensions = new Vector2(150f, 40f);
            sprite.MakePixelPerfect();

            // Add a collider
            NGUITools.AddWidgetCollider(go);

            // Add the scripts
            UIRadioButton ib = go.AddComponent <UIRadioButton>();
            ib.target         = sprite;
            ib.ActiveSprite   = mImage0;
            ib.UnactiveSprite = mImage1;
            go.AddComponent <UIButtonSound>();

            Selection.activeGameObject = go;
        }
    }
Exemplo n.º 12
0
        public UILotSkillModeDialog(LotCategory category, uint originalValue) : base(UIDialogStyle.OK | UIDialogStyle.Close, true)
        {
            SetSize(400, 300);

            uint min = 0;

            if (!SkillGameplayCategory.TryGetValue(category, out min))
            {
                min = 0;
            }

            Caption   = GameFacade.Strings.GetString("f109", "5");
            DescLabel = new UILabel
            {
                Caption  = GameFacade.Strings.GetString("f109", "6") + ((min > 0) ? ("\n\n" + GameFacade.Strings.GetString("f109", "7")) : ""),
                Position = new Vector2(25, 40),
                Wrapped  = true,
                Size     = new Vector2(350, 200)
            };
            Add(DescLabel);

            var vbox = new UIVBoxContainer();

            for (uint i = 0; i < 3; i++)
            {
                var hbox  = new UIHBoxContainer();
                var radio = new UIRadioButton
                {
                    RadioGroup = "skl",
                    RadioData  = i,
                    Disabled   = i < min,
                    Selected   = i == originalValue
                };
                radio.OnButtonClick += Radio_OnButtonClick;

                hbox.Add(radio);
                hbox.Add(new UILabel
                {
                    Caption = GameFacade.Strings.GetString("f109", (8 + i).ToString())
                });
                vbox.Add(hbox);
            }
            vbox.Position = new Vector2(25, 200);
            Add(vbox);
            vbox.AutoSize();

            CloseButton.OnButtonClick += CloseButton_OnButtonClick;
            OKButton.OnButtonClick    += OKButton_OnButtonClick;
        }
Exemplo n.º 13
0
        public UIDonatorDialog(UILotControl panel) : base(UIDialogStyle.Standard, false)
        {
            LotParent = panel;
            var modeHBox = new UIHBoxContainer();

            modeHBox.Spacing = 20;

            for (int i = 0; i < 2; i++)
            {
                var hbox  = new UIHBoxContainer();
                var radio = new UIRadioButton();
                radio.RadioGroup = "donateMode";
                radio.RadioData  = false;
                radio.Selected   = (i == 0);
                radio.Tooltip    = ModeNames[i];
                var donate = (i > 0);
                radio.OnButtonClick += (btn) =>
                {
                    SetDonate(donate);
                };
                ModeButtons[i] = radio;

                hbox.Add(radio);
                hbox.Add(new UILabel
                {
                    Caption = ModeNames[i]
                });
                modeHBox.Add(hbox);
            }

            modeHBox.AutoSize();
            modeHBox.Position = new Vector2((400 - modeHBox.Size.X) / 2, 35);
            Add(modeHBox);

            SetSize(400, 100);

            Add(SummaryLabel = new UILabel()
            {
                Caption   = "(100/100) Mayor Objects, (1999/2000) Donated Objects",
                Position  = new Vector2(200, 70),
                Size      = Vector2.One,
                Alignment = TextAlignment.Center | TextAlignment.Middle
            });

            GameResized();

            Caption = "Community Lot Buy Mode";
        }
Exemplo n.º 14
0
        private void SubCategory()
        {
            Debug.Log("Adding KerBalloons Catagory");
            const string FILTER_CATEGORY      = "Filter by Function";
            const string CUSTOM_CATEGORY_NAME = "KerBalloons";



            Texture2D iconTexNormal   = GameDatabase.Instance.GetTexture("KerBalloons/Textures/KBIconNormal", false);
            Texture2D iconTexSelected = GameDatabase.Instance.GetTexture("KerBalloons/Textures/KBIconSelected", false);

            Icon icon = new Icon("KerBalloons", iconTexNormal, iconTexSelected, false);

            PartCategorizer.Category filter = PartCategorizer.Instance.filters.Find(f => f.button.categoryName == FILTER_CATEGORY);
            PartCategorizer.AddCustomSubcategoryFilter(filter, CUSTOM_CATEGORY_NAME, icon, p => availableParts.Contains(p));

            UIRadioButton button = filter.button.activeButton;
        }
Exemplo n.º 15
0
        // Changer de filtre/catégorie
        internal static void SelectPartCategory(bool dirScrolling, List <PartCategorizer.Category> categories, int index, UIList list)
        {
            if (QSettings.Instance.EnableWheelBlockTopEnd)
            {
                if (dirScrolling && index == 0)
                {
                    return;
                }
                if (!dirScrolling && index == categories.Count - 1)
                {
                    return;
                }
            }
            PartCategorizer.Category _category = (dirScrolling ? PrevCategory(categories, index) : NextCategory(categories, index));
            UIRadioButton            _btn      = _category.button.activeButton;

            _btn.SetState(UIRadioButton.State.True, UIRadioButton.CallType.APPLICATION, null, true);
            //PartListTooltipsTWEAK (false);
            QuickScroll.Log("SelectPartCategory " + (dirScrolling ? "Prev" : "Next"), "QCategory");
        }
Exemplo n.º 16
0
        public bool LoadFrame()
        {
            GameHelper.LoadUIForm(GUISystem.Instance.RootWindow, "content", "/ui/form/CreateRoleForm.nui");

            uiRoleName = GUISystem.Instance.RootWindow.FindChild("CreateRoleNameEditBox", true) as UIEditBox;
            btnBoy     = GUISystem.Instance.RootWindow.FindChild("CreateBoy", true) as UIRadioButton;
            btnGirl    = GUISystem.Instance.RootWindow.FindChild("CreateGirl", true) as UIRadioButton;
            btnOK      = GUISystem.Instance.RootWindow.FindChild("LoginOK", true) as UIButton;
            UIButton btnCancel = GUISystem.Instance.RootWindow.FindChild("CreateCancel", true) as UIButton;

            uiRoleName.ClearText();
            uiRoleName.TextChange += new EventHandler <WindowEventArgs>(uiRoleName_TextChange);

            btnOK.Clicked += new EventHandler <GUIEventArgs>(btnOK_Clicked);
            btnOK.Disable();

            btnCancel.Clicked += new EventHandler <GUIEventArgs>(btnCancel_Clicked);

            return(true);
        }
        protected internal override void NativeInit()
        {
            if (Parent != null)
            {
                if (this.NativeUIElement == null)
                {
                    var b = new UIRadioButton(UIButtonType.Custom);

                    b.HorizontalAlignment = UIControlContentHorizontalAlignment.Left;

                    UIImage selectedImage   = null;
                    UIImage unselectedImage = null;

                    if (int.Parse(UIDevice.CurrentDevice.SystemVersion.Split('.')[0]) >= 7)
                    {
                        selectedImage   = UIImage.FromBundle("iOS_Resources/RadioButtonChecked").ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
                        unselectedImage = UIImage.FromBundle("iOS_Resources/RadioButtonUnchecked").ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
                    }
                    else
                    {
                        selectedImage   = UIImage.FromBundle("iOS_Resources/RadioButtonCheckediOS6");
                        unselectedImage = UIImage.FromBundle("iOS_Resources/RadioButtonUncheckediOS6");
                    }

                    b.SetImage(unselectedImage, UIControlState.Normal);
                    b.SetImage(selectedImage, UIControlState.Selected);
                    b.SetImage(selectedImage, UIControlState.Highlighted);
                    b.SetImage(selectedImage, UIControlState.Selected | UIControlState.Highlighted);
                    b.SetTitleColor(UIColor.Black, UIControlState.Normal);
                    b.TitleEdgeInsets = new UIEdgeInsets(0, 6, 0, 0);
                    b.SetTitle("", UIControlState.Normal);

                    this.NativeUIElement = b;
                }

                base.NativeInit();
            }
        }
Exemplo n.º 18
0
        protected internal override void NativeInit()
        {
            if (Parent != null)
            {
                if (this.NativeUIElement == null)
                {
                    var b = new UIRadioButton(UIButtonType.Custom);

                    b.HorizontalAlignment = UIControlContentHorizontalAlignment.Left;

                    UIImage selectedImage = null;
                    UIImage unselectedImage = null;

                    if (int.Parse(UIDevice.CurrentDevice.SystemVersion.Split('.')[0]) >= 7)
                    {
                        selectedImage = UIImage.FromBundle("iOS_Resources/RadioButtonChecked").ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
                        unselectedImage = UIImage.FromBundle("iOS_Resources/RadioButtonUnchecked").ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
                    }
                    else
                    {
                        selectedImage = UIImage.FromBundle("iOS_Resources/RadioButtonCheckediOS6");
                        unselectedImage = UIImage.FromBundle("iOS_Resources/RadioButtonUncheckediOS6");
                    }

                    b.SetImage(unselectedImage, UIControlState.Normal);
                    b.SetImage(selectedImage, UIControlState.Selected);
                    b.SetImage(selectedImage, UIControlState.Highlighted);
                    b.SetImage(selectedImage, UIControlState.Selected | UIControlState.Highlighted);
                    b.SetTitleColor(UIColor.Black, UIControlState.Normal);
                    b.TitleEdgeInsets = new UIEdgeInsets(0, 6, 0, 0);
                    b.SetTitle("", UIControlState.Normal);

                    this.NativeUIElement = b;
                }

                base.NativeInit();
            }
        }
Exemplo n.º 19
0
    public void LoadView()
    {
        mBox = new UIBox(UIConstants.BoxRect, UIConstants.MainBackground);

        mImageTargetLabel = new UILabel(UIConstants.RectLabelOne, UIConstants.ImageTargetLabelStyle);

        string[] aboutStyles = { UIConstants.AboutLableStyle, UIConstants.AboutLableStyle };
        mAboutLabel = new UICheckButton(UIConstants.RectLabelAbout, false, aboutStyles);

        string[] offTargetTrackingStyles = { UIConstants.ExtendedTrackingStyleOff, UIConstants.ExtendedTrackingStyleOn };
        mExtendedTracking = new UICheckButton(UIConstants.RectOptionOne, false, offTargetTrackingStyles);

        string[] cameraFlashStyles = { UIConstants.CameraFlashStyleOff, UIConstants.CameraFlashStyleOn };
        mCameraFlashSettings = new UICheckButton(UIConstants.RectOptionThree, false, cameraFlashStyles);

        string[] autofocusStyles = { UIConstants.AutoFocusStyleOff, UIConstants.AutoFocusStyleOn };
        mAutoFocusSetting = new UICheckButton(UIConstants.RectOptionTwo, false, autofocusStyles);

        mCameraLabel = new UILabel(UIConstants.RectLabelTwo, UIConstants.CameraLabelStyle);

        string[,] cameraFacingStyles = new string[2, 2] {
            { UIConstants.CameraFacingFrontStyleOff, UIConstants.CameraFacingFrontStyleOn }, { UIConstants.CameraFacingRearStyleOff, UIConstants.CameraFacingRearStyleOn }
        };
        UIRect[] cameraRect = { UIConstants.RectOptionFour, UIConstants.RectOptionFive };
        mCameraFacing = new UIRadioButton(cameraRect, 1, cameraFacingStyles);

        string[,] datasetStyles = new string[2, 2] {
            { UIConstants.StonesAndChipsStyleOff, UIConstants.StonesAndChipsStyleOn }, { UIConstants.TarmacOff, UIConstants.TarmacOn }
        };
        UIRect[] datasetRect = { UIConstants.RectOptionSix, UIConstants.RectOptionSeven };
        mDataSet = new UIRadioButton(datasetRect, 0, datasetStyles);

        mDataSetLabel = new UILabel(UIConstants.RectLabelThree, UIConstants.DatasetLabelStyle);

        string[] closeButtonStyles = { UIConstants.closeButtonStyleOff, UIConstants.closeButtonStyleOn };
        mCloseButton = new UIButton(UIConstants.CloseButtonRect, closeButtonStyles);
    }
Exemplo n.º 20
0
        // Color slider
        // customdata?
        // random jitter on all floats?

        // TODO, browser and Eyedropper, and Intents-Open other tool to select from it.
        public override void OnInitialize()
        {
            mainPanel = new UIPanel();
            //mainPanel.SetPadding(0);
            mainPanel.Left.Set(-290f, 1f);
            mainPanel.Top.Set(-620f, 1f);
            mainPanel.Width.Set(240f, 0f);
            mainPanel.Height.Set(520f, 0f);
            mainPanel.SetPadding(12);
            mainPanel.BackgroundColor = new Color(173, 194, 171);

            int top = 0;

            UIText text = new UIText("Dust:", 0.85f);

            text.Top.Set(top, 0f);
            //text.Left.Set(12f, 0f);
            mainPanel.Append(text);

            UITextPanel <string> resetButton = new UITextPanel <string>("Reset Tool");

            resetButton.SetPadding(4);
            resetButton.Width.Set(-10, 0.5f);
            resetButton.Left.Set(0, 0.5f);
            resetButton.Top.Set(top, 0f);
            resetButton.OnClick += ResetButton_OnClick;
            mainPanel.Append(resetButton);

            top += 20;
            noGravityCheckbox = new UICheckbox("No Gravity", "");
            noGravityCheckbox.Top.Set(top, 0f);
            //gravityCheckbox.Left.Set(12f, 0f);
            mainPanel.Append(noGravityCheckbox);

            top            += 20;
            noLightCheckbox = new UICheckbox("No Light", "");
            noLightCheckbox.Top.Set(top, 0f);
            mainPanel.Append(noLightCheckbox);

            top += 20;
            showSpawnRectangleCheckbox = new UICheckbox("Show Spawn Rectangle", "");
            showSpawnRectangleCheckbox.Top.Set(top, 0f);
            mainPanel.Append(showSpawnRectangleCheckbox);

            top += 30;
            scaleDataProperty = new UIFloatRangedDataValue("Scale:", 1f, 0, 5f);
            UIElement uiRange = new UIRange <float>(scaleDataProperty);

            uiRange.Top.Set(top, 0f);
            uiRange.Width.Set(0, 1f);
            mainPanel.Append(uiRange);

            top += 30;
            widthDataProperty = new UIIntRangedDataValue("Width:", 30, 0, 400);
            uiRange           = new UIRange <int>(widthDataProperty);
            uiRange.Top.Set(top, 0f);
            uiRange.Width.Set(0, 1f);
            mainPanel.Append(uiRange);

            top += 30;
            heightDataProperty = new UIIntRangedDataValue("Height:", 30, 0, 400);
            uiRange            = new UIRange <int>(heightDataProperty);
            uiRange.Top.Set(top, 0f);
            uiRange.Width.Set(0, 1f);
            mainPanel.Append(uiRange);

            top += 30;
            UIImageButton b = new UIImageButton(ModdersToolkit.instance.GetTexture("UIElements/searchIcon"));

            b.OnClick += (s, e) => { ShowDustChooser = !ShowDustChooser; Recalculate(); };
            b.Top.Set(top, 0f);
            mainPanel.Append(b);

            typeDataProperty = new IntDataRangeProperty("Type:", 1, DustTool.dustCount, true);             //TODO fix.
            typeDataProperty.range.Top.Set(top, 0f);
            typeDataProperty.range.Left.Set(20, 0f);
            typeDataProperty.range.Width.Set(-20, 1f);
            mainPanel.Append(typeDataProperty.range);

            //top += 30;
            //UIImageButton b = new UIImageButton(ModdersToolkit.instance.GetTexture("UIElements/eyedropper"));

            dustChooserUI = new DustChooserUI(userInterface);

            top += 30;
            useCustomColorCheckbox = new UICheckbox("Use Custom Color", "");
            useCustomColorCheckbox.Top.Set(top, 0f);
            mainPanel.Append(useCustomColorCheckbox);

            top += 20;
            colorDataProperty = new ColorDataRangeProperty("Color:");
            colorDataProperty.range.Top.Set(top, 0f);
            mainPanel.Append(colorDataProperty.range);

            top += 30;
            alphaDataProperty = new UIIntRangedDataValue("Alpha:", 0, 0, 255);
            uiRange           = new UIRange <int>(alphaDataProperty);
            uiRange.Top.Set(top, 0f);
            uiRange.Width.Set(0, 1f);
            mainPanel.Append(uiRange);

            top += 30;
            shaderDataProperty = new UIIntRangedDataValue("Shader:", 0, 0, DustTool.shaderCount);
            uiRange            = new UIRange <int>(shaderDataProperty);
            uiRange.Top.Set(top, 0f);
            uiRange.Width.Set(0, 1f);
            mainPanel.Append(uiRange);

            top += 30;
            speedXDataProperty = new UIFloatRangedDataValue("SpeedX:", 0, -10, 10);
            uiRange            = new UIRange <float>(speedXDataProperty);
            uiRange.Top.Set(top, 0f);
            uiRange.Width.Set(0, 1f);
            mainPanel.Append(uiRange);

            top += 30;
            speedYDataProperty = new UIFloatRangedDataValue("SpeedY:", 0, -10, 10);
            uiRange            = new UIRange <float>(speedYDataProperty);
            uiRange.Top.Set(top, 0f);
            uiRange.Width.Set(0, 1f);
            mainPanel.Append(uiRange);

            //todo, position this better? displays as well?
            //		top += 30;
            //		var ui2DRange = new UI2DRange<float>(speedXDataProperty, speedYDataProperty);
            //		ui2DRange.Top.Set(top, 0f);
            //		//ui2DRange.Width.Set(0, 1f);
            //		mainPanel.Append(ui2DRange);

            top += 30;
            fadeInDataProperty = new UIFloatRangedDataValue("FadeIn:", 0, 0, 3);
            uiRange            = new UIRange <float>(fadeInDataProperty);
            uiRange.Top.Set(top, 0f);
            uiRange.Width.Set(0, 1f);
            mainPanel.Append(uiRange);

            top += 30;
            spawnChanceDataProperty = new UIFloatRangedDataValue("Spawn%:", 1f, 0, 1, true, true);
            uiRange = new UIRange <float>(spawnChanceDataProperty);
            uiRange.Top.Set(top, 0f);
            uiRange.Width.Set(0, 1f);
            mainPanel.Append(uiRange);

            top += 24;
            UIRadioButtonGroup g = new UIRadioButtonGroup();

            NewDustRadioButton        = new UIRadioButton("NewDust", "Dust.NewDust method");
            NewDustPerfectRadioButton = new UIRadioButton("NewDustPerfect", "Dust.NewDust method");
            NewDustDirectRadioButton  = new UIRadioButton("NewDustDirect", "Dust.NewDust method");
            g.Add(NewDustRadioButton);
            g.Add(NewDustPerfectRadioButton);
            g.Add(NewDustDirectRadioButton);
            g.Top.Pixels = top;
            g.Width.Set(0, .75f);
            mainPanel.Append(g);
            NewDustRadioButton.Selected = true;

            UIHoverImageButton copyCodeButton = new UIHoverImageButton(ModdersToolkit.instance.GetTexture("UIElements/CopyCodeButton"), "Copy code to clipboard");

            copyCodeButton.OnClick += CopyCodeButton_OnClick;
            copyCodeButton.Top.Set(-20, 1f);
            copyCodeButton.Left.Set(-20, 1f);
            mainPanel.Append(copyCodeButton);

            Append(mainPanel);
        }
Exemplo n.º 21
0
        public override void OnInitialize()
        {
            base.OnInitialize();
            ItemModifier instance = ModContent.GetInstance <ItemModifier>();

            CategoryName = new UIText("There's a problem")
            {
                SkipDescenderCheck = true,
                HorizontalAlign    = 0.5f
            };
            CategoryName.Parent = this;

            PreviousCategory = new UIImageButton(ModContent.GetTexture("ItemModifier/UI/LeftArrow"))
            {
                ColorTint = new Color(0, 100, 255),
                Parent    = this
            };
            PreviousCategory.OnLeftClick     += (source, e) => changeIndex(CategoryIndex - 1);
            PreviousCategory.OnRightClick    += (source, e) => changeIndex(CategoryIndex + 1);
            PreviousCategory.WhileMouseHover += (source, e) => instance.Tooltip = "Previous Category";

            NextCategory = new UIImageButton(ModContent.GetTexture("ItemModifier/UI/RightArrow"))
            {
                ColorTint = new Color(255, 100, 0)
            };
            NextCategory.XOffset          = new SizeDimension(InnerWidth - NextCategory.OuterWidth);
            NextCategory.Parent           = this;
            NextCategory.OnLeftClick     += (source, e) => changeIndex(CategoryIndex + 1);
            NextCategory.OnRightClick    += (source, e) => changeIndex(CategoryIndex - 1);
            NextCategory.WhileMouseHover += (source, e) => instance.Tooltip = "Next Category";

            void changeIndex(int newIndex)
            {
                CategoryIndex = newIndex < 0 ? Categories.Count - 1 : newIndex >= Categories.Count ? 0 : newIndex;
            }

            AutoReuse = new UIBool();
            AutoReuse.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.autoReuse = e.Value;
            AutoReuse.OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.autoReuse = DefaultItem.autoReuse;
            PAutoReuse = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/AutoReuse"), "Auto Use", AutoReuse);

            Consumable = new UIBool();
            Consumable.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.consumable = e.Value;
            Consumable.OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.consumable = DefaultItem.consumable;
            PConsumable = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/Consumable"), "Consumable", Consumable);

            Potion = new UIBool();
            Potion.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.potion = e.Value;
            Potion.OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.potion = DefaultItem.potion;
            PPotion = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/PotionSickness"), "Potion Sickness", Potion);

            DamageType = new UIRadioButtonContainer();
            RMelee     = new UIRadioButton("Melee")
            {
                Parent = DamageType
            };
            RMelee.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.melee = e.Value;
            RMagic = new UIRadioButton("Magic")
            {
                Parent = DamageType
            };
            RMagic.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.magic = e.Value;
            RRanged = new UIRadioButton("Ranged")
            {
                Parent = DamageType
            };
            RRanged.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.ranged = e.Value;
            RSummon = new UIRadioButton("Summon")
            {
                Parent = DamageType
            };
            RSummon.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.summon = e.Value;
            RThrown = new UIRadioButton("Thrown")
            {
                Parent = DamageType
            };
            RThrown.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.thrown = e.Value;
            float dTypeWidth = 0f;

            for (int i = 0; i < DamageType.ChildrenCount; i++)
            {
                UIElement child = DamageType[i];
                if (child.InnerWidth > dTypeWidth)
                {
                    dTypeWidth = child.InnerWidth;
                }
                child.YOffset = new SizeDimension(RMelee.InnerHeight * i);
            }
            DamageType.Width         = new SizeDimension(dTypeWidth);
            DamageType.Height        = new SizeDimension(RMelee.InnerHeight * DamageType.ChildrenCount);
            DamageType.OnRightClick += (source, e) =>
            {
                Main.LocalPlayer.HeldItem.melee  = DefaultItem.melee;
                Main.LocalPlayer.HeldItem.magic  = DefaultItem.magic;
                Main.LocalPlayer.HeldItem.ranged = DefaultItem.ranged;
                Main.LocalPlayer.HeldItem.summon = DefaultItem.summon;
                Main.LocalPlayer.HeldItem.thrown = DefaultItem.thrown;
            };
            PDamageType = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/DamageType"), "Damage Type", DamageType);

            Accessory = new UIBool();
            Accessory.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.accessory = e.Value;
            Accessory.OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.accessory = DefaultItem.accessory;
            PAccessory = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/Accessory"), "Accessory", Accessory);

            Damage = new UIIntTextbox();
            Damage.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.damage = e.Value;
            Damage.OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.damage = DefaultItem.damage;
            PDamage = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/Damage"), "Damage", Damage);

            Critical = new UIIntTextbox();
            Critical.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.crit = e.Value;
            Critical.OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.crit = DefaultItem.crit;
            PCritical = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/CritChance"), "Crit Chance", Critical);

            KnockBack = new UIFloatTextbox();
            KnockBack.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.knockBack = e.Value;
            KnockBack.OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.knockBack = DefaultItem.knockBack;
            PKnockBack = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/Knockback"), "KnockBack", KnockBack);

            Shoot = new UIIntTextbox(0, ProjectileLoader.ProjectileCount - 1);
            Shoot.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.shoot = e.Value;
            Shoot.OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.shoot = DefaultItem.shoot;
            PShoot = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/ProjectileShot"), "Projectile Shot", Shoot);

            ShootSpeed = new UIFloatTextbox();
            ShootSpeed.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.shootSpeed = e.Value;
            ShootSpeed.OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.shootSpeed = DefaultItem.shootSpeed;
            PShootSpeed = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/ProjectileSpeed"), "Shoot Speed", ShootSpeed);

            Tile = new UIIntTextbox(-1, TileLoader.TileCount - 1);
            Tile.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.createTile = e.Value;
            Tile.OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.createTile = DefaultItem.createTile;
            PTile = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/CreateTile"), "Place Tile", Tile);

            TileBoost = new UIIntTextbox();
            TileBoost.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.tileBoost = e.Value;
            TileBoost.OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.tileBoost = DefaultItem.tileBoost;
            PTileBoost = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/AddedRange"), "Added Range", TileBoost);

            BuffContainer = new UIContainer()
            {
                Width          = new SizeDimension(144f),
                Height         = new SizeDimension(130f),
                OverflowHidden = true
            };
            BuffTypes    = new UIBuffTextbox[22];
            BuffTimes    = new UIIntTextbox[22];
            BuffTypes[0] = new UIBuffTextbox()
            {
                Width  = new SizeDimension(26f),
                Height = new SizeDimension(26f),
                Parent = BuffContainer
            };
            BuffTypes[0].OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.buffType = e.Value;
            BuffTypes[0].OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.buffType = DefaultItem.buffType;
            BuffTimes[0]                 = new UIIntTextbox();
            BuffTimes[0].XOffset         = new SizeDimension(BuffTypes[0].OuterWidth + 4);
            BuffTimes[0].Parent          = BuffContainer;
            BuffTimes[0].OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.buffTime = e.Value;
            BuffTimes[0].OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.buffTime = DefaultItem.buffTime;
            for (int i = 1; i < BuffTypes.Length; i++)
            {
                int id = i - 1;
                BuffTypes[i] = new UIBuffTextbox()
                {
                    Width   = new SizeDimension(26f),
                    Height  = new SizeDimension(26f),
                    YOffset = new SizeDimension(i * 26f),
                    Parent  = BuffContainer
                };
                BuffTypes[i].OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.GetGlobalItem <CustomProperties>().BuffTypes[id] = e.Value;
                BuffTypes[i].OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.GetGlobalItem <CustomProperties>().BuffTypes[id] = DefaultItem.GetGlobalItem <CustomProperties>().BuffTypes[id];
                BuffTimes[i]                 = new UIIntTextbox();
                BuffTimes[i].XOffset         = new SizeDimension(BuffTypes[i].OuterWidth + 4);
                BuffTimes[i].YOffset         = new SizeDimension(i * 26f);
                BuffTimes[i].Parent          = BuffContainer;
                BuffTimes[i].OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.GetGlobalItem <CustomProperties>().BuffTimes[id] = e.Value;
                BuffTimes[i].OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.GetGlobalItem <CustomProperties>().BuffTimes[id] = DefaultItem.GetGlobalItem <CustomProperties>().BuffTimes[id];
            }
            PBuff = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/BuffType"), "Buff", BuffContainer);

            HealHP = new UIIntTextbox();
            HealHP.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.healLife = e.Value;
            HealHP.OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.healLife = DefaultItem.healLife;
            PHealHP = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/HealHP"), "HP Healed", HealHP);

            HealMP = new UIIntTextbox();
            HealMP.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.healMana = e.Value;
            HealMP.OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.healMana = DefaultItem.healMana;
            PHealMP = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/HealMP"), "Mana Healed", HealMP);

            AxePower = new UIIntTextbox();
            AxePower.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.axe = e.Value;
            AxePower.OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.axe = DefaultItem.axe;
            PAxePower = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/AxePower"), "Axe Power", AxePower);

            PickaxePower = new UIIntTextbox();
            PickaxePower.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.pick = e.Value;
            PickaxePower.OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.pick = DefaultItem.pick;
            PPickaxePower = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/PickaxePower"), "Pickaxe Power", PickaxePower);

            HammerPower = new UIIntTextbox();
            HammerPower.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.hammer = e.Value;
            HammerPower.OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.hammer = DefaultItem.hammer;
            PHammerPower = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/HammerPower"), "Hammer Power", HammerPower);

            Stack = new UIIntTextbox();
            Stack.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.stack = e.Value;
            Stack.OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.stack = DefaultItem.stack;
            PStack = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/Stack"), "Amount", Stack);

            MaxStack = new UIIntTextbox();
            MaxStack.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.maxStack = e.Value;
            MaxStack.OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.maxStack = DefaultItem.maxStack;
            PMaxStack = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/MaxStack"), "Max Stack", MaxStack);

            UseAnimation = new UIIntTextbox();
            UseAnimation.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.useAnimation = e.Value;
            UseAnimation.OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.useAnimation = DefaultItem.useAnimation;
            PUseAnimation = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/UseAnimation"), "Animation Span", UseAnimation);

            UseTime = new UIIntTextbox();
            UseTime.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.useTime = e.Value;
            UseTime.OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.useTime = DefaultItem.useTime;
            PUseTime = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/UseTime"), "Use Span", UseTime);

            Defense = new UIIntTextbox();
            Defense.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.defense = e.Value;
            Defense.OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.defense = DefaultItem.defense;
            PDefense = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/Defense"), "Defense", Defense);

            FishingPower = new UIIntTextbox();
            FishingPower.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.fishingPole = e.Value;
            FishingPower.OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.fishingPole = DefaultItem.fishingPole;
            PFishingPower = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/FishingPower"), "Fishing Power", FishingPower);

            Scale = new UIFloatTextbox();
            Scale.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.scale = e.Value;
            Scale.OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.scale = DefaultItem.scale;
            PScale = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/Scale"), "Item Scale", Scale);

            UseStyleRadio = new UIRadioButtonContainer();
            RSwing        = new UIRadioButton("Swing")
            {
                Parent = UseStyleRadio
            };
            RSwing.OnValueChanged += (source, e) =>
            {
                if (e.Value)
                {
                    Main.LocalPlayer.HeldItem.useStyle = ItemUseStyleID.SwingThrow;
                }
            };
            RDrink = new UIRadioButton("Drink")
            {
                Parent = UseStyleRadio
            };
            RDrink.OnValueChanged += (source, e) =>
            {
                if (e.Value)
                {
                    Main.LocalPlayer.HeldItem.useStyle = ItemUseStyleID.EatingUsing;
                }
            };
            RStab = new UIRadioButton("Stab")
            {
                Parent = UseStyleRadio
            };
            RStab.OnValueChanged += (source, e) =>
            {
                if (e.Value)
                {
                    Main.LocalPlayer.HeldItem.useStyle = ItemUseStyleID.Stabbing;
                }
            };
            RAboveHead = new UIRadioButton("Above Head")
            {
                Parent = UseStyleRadio
            };
            RAboveHead.OnValueChanged += (source, e) =>
            {
                if (e.Value)
                {
                    Main.LocalPlayer.HeldItem.useStyle = ItemUseStyleID.HoldingUp;
                }
            };
            RHeld = new UIRadioButton("Held")
            {
                Parent = UseStyleRadio
            };
            RHeld.OnValueChanged += (source, e) =>
            {
                if (e.Value)
                {
                    Main.LocalPlayer.HeldItem.useStyle = ItemUseStyleID.HoldingOut;
                }
            };
            float uStyleWidth = 0f;

            for (int i = 0; i < UseStyleRadio.ChildrenCount; i++)
            {
                UIElement child = UseStyleRadio[i];
                if (child.InnerWidth > uStyleWidth)
                {
                    uStyleWidth = child.InnerWidth;
                }
                child.YOffset = new SizeDimension(RSwing.InnerHeight * i);
            }
            UseStyleRadio.Width         = new SizeDimension(uStyleWidth);
            UseStyleRadio.Height        = new SizeDimension(RSwing.InnerHeight * UseStyleRadio.ChildrenCount);
            UseStyleRadio.OnRightClick += (source, e) => Main.LocalPlayer.HeldItem.useStyle = DefaultItem.useStyle;
            UseStyleRadio.OnDeselected += (source, e) =>
            {
                Item heldItem = Main.LocalPlayer.HeldItem;
                if (UseStyleRadio.Selected.Count < 1 && heldItem.useStyle <= ItemUseStyleID.HoldingOut)
                {
                    heldItem.useStyle = 0;
                }
            };
            UseStyle = new UIIntTextbox();
            UseStyle.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.useStyle = e.Value;
            UseStyle.OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.useStyle = DefaultItem.useStyle;
            PUseStyle = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/UseStyle"), "Use Style", UseStyleRadio, UseStyle);

            CostMP = new UIIntTextbox();
            CostMP.OnValueChanged += (source, e) => Main.LocalPlayer.HeldItem.mana = e.Value;
            CostMP.OnRightClick   += (source, e) => Main.LocalPlayer.HeldItem.mana = DefaultItem.mana;
            PCostMP = new UICategory.UIProperty(ModContent.GetTexture("ItemModifier/UI/CostMP"), "Mana Cost", CostMP);

            ToggleLiveSync = new UIImageButton(ModContent.GetTexture("ItemModifier/UI/Sync"), false, new Color(20, 255, 20))
            {
                Width   = new SizeDimension(16f),
                Height  = new SizeDimension(16f),
                YOffset = CloseButton.YOffset
            };
            ToggleLiveSync.Recalculate();
            ToggleLiveSync.XOffset      = new SizeDimension(CloseButton.CalculatedXOffset - ToggleLiveSync.OuterWidth - 3); // -3 spacing
            ToggleLiveSync.Parent       = this;
            ToggleLiveSync.OnLeftClick += (source, e) => { LiveSync = !LiveSync; if (!LiveSync)
                                                           {
                                                               GrayBG.Visible = false;
                                                           }
            };
            ToggleLiveSync.WhileMouseHover += (source, e) => instance.Tooltip = "Toggle Live Sync";

            ClearModifications = new UIImageButton(ModContent.GetTexture("ItemModifier/UI/ClearModifications"), false)
            {
                Width   = new SizeDimension(16f),
                Height  = new SizeDimension(16f),
                YOffset = CloseButton.YOffset
            };
            ClearModifications.Recalculate();
            ClearModifications.XOffset          = new SizeDimension(ToggleLiveSync.CalculatedXOffset - ClearModifications.OuterWidth - 3); // -3 spacing
            ClearModifications.Parent           = this;
            ClearModifications.OnLeftClick     += (source, e) => Main.LocalPlayer.HeldItem.SetDefaults(Main.LocalPlayer.HeldItem.type);
            ClearModifications.WhileMouseHover += (source, e) => instance.Tooltip = "Clear Modifications";

            /*SaveItemConfig = new UIImageButton(ModContent.GetTexture("ItemModifier/UI/Globe"), false)
            *  {
            *   Width = new SizeDimension(16f),
            *   Height = new SizeDimension(16f),
            *   YOffset = CloseButton.YOffset
            *  };
            *  SaveItemConfig.Recalculate();
            *  SaveItemConfig.XOffset = new SizeDimension(ClearModifications.CalculatedXOffset - SaveItemConfig.OuterWidth - 3);
            *  SaveItemConfig.Parent = this;
            *  SaveItemConfig.OnLeftClick += (source, e) =>
            *  {
            *   Item heldItem = Main.LocalPlayer.HeldItem;
            *   if (heldItem.type == 0)
            *   {
            *       Main.NewText("Cannot modify air!");
            *       return;
            *   }
            *   List<ItemProperties> itemConfig = ItemConfig.Instance.ItemChanges;
            *   int index = itemConfig.FindIndex(prop => prop.Type == heldItem.type);
            *   if (index == -1)
            *   {
            *       ItemProperties props = new ItemProperties(heldItem.type);
            *       props.FromItem(heldItem);
            *       itemConfig.Add(props);
            *   }
            *   else
            *   {
            *       itemConfig[index].FromItem(heldItem);
            *   }
            *   Main.NewText("Global Change Added! Reload Required", Color.Green);
            *  };
            *  SaveItemConfig.WhileMouseHover += (source, e) => instance.Tooltip = "Add to Item Config";*/

            AllCategory = new UICategory("All", new List <UICategory.UIProperty> {
                PAutoReuse,
                PAxePower,
                PPickaxePower,
                PHammerPower,
                PDamageType,
                PDamage,
                PCritical,
                PKnockBack,
                PShoot,
                PShootSpeed,
                PAccessory,
                PDefense,
                PTileBoost,
                PTile,
                PConsumable,
                PPotion,
                PBuff,
                PHealHP,
                PHealMP,
                PCostMP,
                PStack,
                PMaxStack,
                PUseAnimation,
                PUseTime,
                PUseStyle,
                PFishingPower,
                PScale
            });

            ToolsCategory = new UICategory("Tools", new List <UICategory.UIProperty>
            {
                PAutoReuse,
                PAxePower,
                PPickaxePower,
                PHammerPower,
                PCostMP,
                PUseAnimation,
                PUseTime,
                PUseStyle,
                PFishingPower
            });

            WeaponsCategory = new UICategory("Weapons", new List <UICategory.UIProperty>
            {
                PAutoReuse,
                PDamageType,
                PDamage,
                PCritical,
                PKnockBack,
                PConsumable,
                PShoot,
                PShootSpeed,
                PCostMP,
                PUseAnimation,
                PUseAnimation,
                PUseStyle
            });

            PotionsCategory = new UICategory("Potions", new List <UICategory.UIProperty>
            {
                PConsumable,
                PPotion,
                PBuff,
                PHealHP,
                PHealMP,
                PUseStyle
            });

            ArmorCategory = new UICategory("Armor", new List <UICategory.UIProperty>
            {
                PDefense
            });

            AccessoriesCategory = new UICategory("Accessories", new List <UICategory.UIProperty>
            {
                PAccessory,
                PDefense
            });

            Categories = new List <UICategory>
            {
                AllCategory,
                ToolsCategory,
                WeaponsCategory,
                PotionsCategory,
                ArmorCategory,
                AccessoriesCategory
            };

            CategoryContainer = new UIContainer()
            {
                Width          = new SizeDimension(290f),
                Height         = new SizeDimension(450f),
                XOffset        = new SizeDimension(5f),
                YOffset        = new SizeDimension(30f),
                OverflowHidden = true,
                Parent         = this
            };

            GrayBG = new UIContainer(new Color(47, 79, 79, 150))
            {
                Width   = CategoryContainer.Width,
                Height  = CategoryContainer.Height,
                XOffset = CategoryContainer.XOffset,
                YOffset = CategoryContainer.YOffset,
                Parent  = this
            };
            GrayBG.OnVisibilityChanged += (source) => LockImage.Visible = source.Visible;

            LockImage         = new UIImage(ModContent.GetTexture("ItemModifier/UI/Lock"));
            LockImage.XOffset = new SizeDimension((GrayBG.InnerWidth - LockImage.OuterWidth) * 0.5f);
            LockImage.YOffset = new SizeDimension((GrayBG.InnerHeight - LockImage.OuterHeight) * 0.5f);
            LockImage.Parent  = GrayBG;

            CategoryIndex = 0;

            SetLimits();
        }
Exemplo n.º 22
0
        public UIProfanityOptions()
        {
            //var alert = UIScreen.GlobalShowAlert(new UIAlertOptions { Title = "Not Implemented", Message = "This feature is not implemented yet!" }, true);
            var uis = this.RenderScript("profanitypanel.uis");

            //don't draw, this currently breaks the uis parser
            //var bg = uis.Create<UIImage>("Background");
            //AddAt(0, bg);
            Remove(PrevColorButton);
            Remove(NextColorButton);
            Remove(AddButton);
            Remove(SubtractButton);
            Remove(EnableFilterCheckButton);
            Remove(ProfanityFilterTitle);
            Remove(EntryBox);

            EnterWordLabel.Caption = GameFacade.Strings.GetString("f113", "5");

            var ttsToggleContainer = new UIHBoxContainer();

            ttsToggleContainer.Add(new UILabel()
            {
                Caption = GameFacade.Strings.GetString("f113", "1")
            });
            var ttsMode = GlobalSettings.Default.TTSMode;

            for (int i = 0; i < 3; i++)
            {
                var radio = new UIRadioButton();
                radio.RadioData      = i;
                radio.RadioGroup     = "ttsOpt";
                radio.OnButtonClick += TTSOptSet;
                radio.Tooltip        = GameFacade.Strings.GetString("f113", (2 + i).ToString());
                radio.Selected       = ttsMode == i;
                ttsToggleContainer.Add(radio);
                ttsToggleContainer.Add(new UILabel()
                {
                    Caption = radio.Tooltip
                });
            }

            ttsToggleContainer.Position = new Vector2(10, 10);
            Add(ttsToggleContainer);
            ttsToggleContainer.AutoSize();

            var col = new Color(GlobalSettings.Default.ChatColor);

            ChatColor.CaptionStyle        = ChatColor.CaptionStyle.Clone();
            ChatColor.CaptionStyle.Color  = col;
            ChatColor.CaptionStyle.Shadow = true;
            ChatColor.Caption             = "#" + col.R.ToString("x2") + col.G.ToString("x2") + col.B.ToString("x2");

            var changeBtn = new UIButton();

            changeBtn.Caption  = GameFacade.Strings.GetString("f113", "6");
            changeBtn.Position = new Microsoft.Xna.Framework.Vector2(155 + 100, 74 - 7);
            Add(changeBtn);
            changeBtn.OnButtonClick += (btn1) =>
            {
                UIAlert alert = null;
                alert = UIScreen.GlobalShowAlert(new UIAlertOptions()
                {
                    Title           = "",
                    Message         = GameFacade.Strings.GetString("f113", "8"),
                    GenericAddition = new UIColorPicker(),
                    Buttons         = new UIAlertButton[]
                    {
                        new UIAlertButton(UIAlertButtonType.OK, (btn) => {
                            //set the color
                            var col2 = int.Parse(alert.ResponseText);
                            GlobalSettings.Default.ChatColor = new Color(col2 >> 16, (byte)(col2 >> 8), (byte)col2).PackedValue;
                            SetChatParams();
                            UIScreen.RemoveDialog(alert);
                        }),
                        new UIAlertButton(UIAlertButtonType.No, (btn) => {
                            //set the color
                            var rand = new Random();
                            GlobalSettings.Default.ChatColor = VMTSOAvatarState.RandomColours[rand.Next(VMTSOAvatarState.RandomColours.Length)].PackedValue;
                            SetChatParams();
                            UIScreen.RemoveDialog(alert);
                        }, GameFacade.Strings.GetString("f113", "7")),
                        new UIAlertButton(UIAlertButtonType.Cancel)
                    }
                }, true);
            };
            var chatTimestampContainer = new UIHBoxContainer();

            chatTimestampContainer.Add(new UILabel()
            {
                Caption = GameFacade.Strings.GetString("f113", "44")
            });
            var chatShowTimestamp = GlobalSettings.Default.ChatShowTimestamp;
            var radioChatTSOff    = new UIRadioButton();

            radioChatTSOff.RadioData      = false;
            radioChatTSOff.RadioGroup     = "chatTSToggle";
            radioChatTSOff.OnButtonClick += ChatTsOptSet;
            radioChatTSOff.Tooltip        = GameFacade.Strings.GetString("f113", "45");
            radioChatTSOff.Selected       = chatShowTimestamp == false;
            chatTimestampContainer.Add(radioChatTSOff);
            chatTimestampContainer.Add(new UILabel()
            {
                Caption = radioChatTSOff.Tooltip
            });

            var radioChatTSOn = new UIRadioButton();

            radioChatTSOn.RadioData      = true;
            radioChatTSOn.RadioGroup     = "chatTSToggle";
            radioChatTSOn.OnButtonClick += ChatTsOptSet;
            radioChatTSOn.Tooltip        = GameFacade.Strings.GetString("f113", "46");
            radioChatTSOn.Selected       = chatShowTimestamp == true;
            chatTimestampContainer.Add(radioChatTSOn);
            chatTimestampContainer.Add(new UILabel()
            {
                Caption = radioChatTSOn.Tooltip
            });

            chatTimestampContainer.Position = new Vector2(368, 10);
            Add(chatTimestampContainer);
            chatTimestampContainer.AutoSize();

            var chatOpacityContainer = new UIHBoxContainer();

            chatOpacityContainer.Position = new Vector2(368, 32);
            var chatOpacityLabel = new UILabel()
            {
                Caption = GameFacade.Strings.GetString("f113", "47")
            };

            chatOpacityContainer.Add(chatOpacityLabel);
            var chatOpacity       = GlobalSettings.Default.ChatWindowsOpacity;
            var chatOpacitySlider = new UISlider();

            chatOpacitySlider.Orientation   = 0;
            chatOpacitySlider.Texture       = GetTexture(0x42500000001);
            chatOpacitySlider.MinValue      = 20;
            chatOpacitySlider.MaxValue      = 100;
            chatOpacitySlider.AllowDecimals = false;
            chatOpacitySlider.Position      = chatOpacityLabel.Position + new Vector2(115, 24);
            chatOpacitySlider.Value         = GlobalSettings.Default.ChatWindowsOpacity * 100;
            chatOpacitySlider.SetSize(140f, 0f);
            chatOpacityContainer.Add(chatOpacitySlider);
            Add(chatOpacityContainer);
            chatOpacityContainer.AutoSize();

            PitchSlider               = new UISlider();
            PitchSlider.Orientation   = 0;
            PitchSlider.Texture       = GetTexture(0x42500000001);
            PitchSlider.MinValue      = -100f;
            PitchSlider.MaxValue      = 100f;
            PitchSlider.AllowDecimals = false;
            PitchSlider.Position      = EnterWordLabel.Position + new Vector2(115, 3);
            PitchSlider.Value         = GlobalSettings.Default.ChatTTSPitch;
            PitchSlider.SetSize(150f, 0f);
            Add(PitchSlider);

            chatOpacitySlider.OnChange += chatOpacitySlider_OnChange;
            PitchSlider.OnChange       += PitchSlider_OnChange;
        }
Exemplo n.º 23
0
        public override void OnInitialize()
        {
            mainPanel = new UIPanel();
            mainPanel.Left.Set(-350f, 1f);
            mainPanel.Top.Set(-740f, 1f);
            mainPanel.Width.Set(310f, 0f);
            mainPanel.Height.Set(640f, 0f);
            mainPanel.SetPadding(6);
            mainPanel.BackgroundColor = Color.PeachPuff * 0.8f;

            int    top  = 0;
            UIText text = new UIText("Shaders:", 0.85f);

            text.Top.Set(top, 0f);
            mainPanel.Append(text);
            top += 20;

            int topModSourcesPanel = 0;
            var modSourcesPanel    = new UIPanel();

            modSourcesPanel.Top.Set(top, 0f);
            modSourcesPanel.Width.Set(0, 1f);
            modSourcesPanel.Height.Set(370f, 0f);
            modSourcesPanel.SetPadding(6);
            modSourcesPanel.BackgroundColor = Color.Blue * 0.7f;
            top += 376;

            text = new UIText("Mod Sources:", 0.85f);
            text.Top.Set(topModSourcesPanel, 0f);
            modSourcesPanel.Append(text);
            topModSourcesPanel += 20;

            var modListBackPanel = new UIPanel();

            modListBackPanel.Top.Set(topModSourcesPanel, 0);
            modListBackPanel.Width.Set(0, 1f);
            modListBackPanel.Height.Set(120f, 0f);
            modListBackPanel.SetPadding(6);
            modListBackPanel.BackgroundColor = Color.Green * 0.7f;

            modList = new UIList();
            modList.Width.Set(-25f, 1f);
            modList.Height.Set(0, 1f);
            modList.ListPadding = 0f;
            modListBackPanel.Append(modList);

            var modListScrollbar = new UIElements.FixedUIScrollbar(userInterface);

            modListScrollbar.SetView(100f, 1000f);
            modListScrollbar.Top.Pixels = 4;
            modListScrollbar.Height.Set(-8, 1f);
            modListScrollbar.HAlign = 1f;
            modListBackPanel.Append(modListScrollbar);
            modList.SetScrollbar(modListScrollbar);

            modSourcesPanel.Append(modListBackPanel);
            mainPanel.Append(modSourcesPanel);
            topModSourcesPanel += 130;

            text = new UIText("Filter:", 0.85f);
            text.Top.Set(topModSourcesPanel, 0f);
            modSourcesPanel.Append(text);

            searchFilter = new NewUITextBox("Search", 0.85f);
            searchFilter.SetPadding(0);
            searchFilter.OnTextChanged += () => { updateneeded = true; };
            searchFilter.Top.Set(topModSourcesPanel, 0f);
            searchFilter.Left.Set(text.GetInnerDimensions().Width + 6, 0f);
            searchFilter.Width.Set(-(text.GetInnerDimensions().Width + 6), 1f);
            searchFilter.Height.Set(20, 0f);
            modSourcesPanel.Append(searchFilter);
            topModSourcesPanel += 26;

            currentShader = new UIText("Current: None selected", 0.85f);
            currentShader.Top.Set(topModSourcesPanel, 0f);
            currentShader.Left.Set(0, 0f);
            currentShader.Width.Set(0, 1);
            currentShader.HAlign = 0;
            modSourcesPanel.Append(currentShader);
            topModSourcesPanel += 20;

            var shaderListBackPanel = new UIPanel();

            shaderListBackPanel.Top.Set(topModSourcesPanel, 0);
            shaderListBackPanel.Width.Set(0, 1f);
            shaderListBackPanel.Height.Set(140f, 0f);
            shaderListBackPanel.SetPadding(6);
            shaderListBackPanel.BackgroundColor = Color.Green * 0.7f;

            shaderList = new UIList();
            shaderList.Width.Set(-25f, 1f);
            shaderList.Height.Set(0, 1f);
            shaderList.ListPadding = 0f;
            shaderListBackPanel.Append(shaderList);

            var shaderListScrollbar = new UIElements.FixedUIScrollbar(userInterface);

            shaderListScrollbar.SetView(100f, 1000f);
            shaderListScrollbar.Top.Pixels = 4;
            shaderListScrollbar.Height.Set(-8, 1f);
            shaderListScrollbar.HAlign = 1f;
            shaderListBackPanel.Append(shaderListScrollbar);
            shaderList.SetScrollbar(shaderListScrollbar);
            modSourcesPanel.Append(shaderListBackPanel);

            topModSourcesPanel     += 146;
            watchModSourcesCheckbox = new UICheckbox("Watch Mod Sources", "Automatically Compile Mod Sources Shaders when Changed on Disk", false);
            watchModSourcesCheckbox.Top.Set(topModSourcesPanel, 0);
            watchModSourcesCheckbox.OnSelectedChanged += WatchModSources_OnSelectedChanged;
            modSourcesPanel.Append(watchModSourcesCheckbox);
            topModSourcesPanel += 20;


            int topTestShaderPanel = 0;
            var testShaderPanel    = new UIPanel();

            testShaderPanel.Top.Set(top, 0f);
            testShaderPanel.Width.Set(0, 1f);
            testShaderPanel.Height.Set(230f, 0f);
            testShaderPanel.SetPadding(6);
            testShaderPanel.BackgroundColor = Color.LightBlue * 0.7f;
            top += 230;
            mainPanel.Append(testShaderPanel);

            text = new UIText("Test Shader:", 0.85f);
            text.Top.Set(topTestShaderPanel, 0f);
            testShaderPanel.Append(text);
            topTestShaderPanel += 20;

            // Current Working Shader
            // Status Text: "Compiled .fx"
            // Filter?
            // Checkbox: Force

            UIRadioButtonGroup g = new UIRadioButtonGroup();

            armorShaderRadioButton  = new UIRadioButton("Armor", "Generate an Armor Shader");
            screenShaderRadioButton = new UIRadioButton("Screen", "Generate a Screen Shader");
            g.Add(armorShaderRadioButton);
            g.Add(screenShaderRadioButton);
            g.Top.Pixels = topTestShaderPanel;
            g.Width.Set(0, .75f);
            testShaderPanel.Append(g);
            armorShaderRadioButton.Selected = true;
            topTestShaderPanel += (int)g.Height.Pixels;

            var createTestShaderButton = new UITextPanel <string>("Create/Recreate Test Shader");

            createTestShaderButton.OnClick += CreateTestShaderFileButton_OnClick;
            createTestShaderButton.Top.Set(topTestShaderPanel, 0f);
            createTestShaderButton.Left.Set(0, 0f);
            createTestShaderButton.SetPadding(4);
            testShaderPanel.Append(createTestShaderButton);
            topTestShaderPanel += 26;

            var openTestShaderButton = new UITextPanel <string>("Edit Test Shader");

            openTestShaderButton.OnClick += OpenTestShaderFileButton_OnClick;
            openTestShaderButton.Top.Set(topTestShaderPanel, 0f);
            openTestShaderButton.Left.Set(0, 0f);
            openTestShaderButton.SetPadding(4);
            testShaderPanel.Append(openTestShaderButton);
            topTestShaderPanel += 26;

            var compileShaderButton = new UITextPanel <string>("Compile Test Shader");

            compileShaderButton.OnClick += CompileTestShaderButton_OnClick;
            compileShaderButton.Top.Set(topTestShaderPanel, 0f);
            compileShaderButton.Left.Set(0, 0f);
            compileShaderButton.SetPadding(4);
            testShaderPanel.Append(compileShaderButton);
            topTestShaderPanel += 26;

            topTestShaderPanel     += 4;
            watchTestShaderCheckbox = new UICheckbox("Watch Test Shader File", "Automatically Compile Test Shader when Changed on Disk", true);
            watchTestShaderCheckbox.Top.Set(topTestShaderPanel, 0);
            watchTestShaderCheckbox.OnSelectedChanged += WatchTestShader_OnSelectedChanged;
            testShaderPanel.Append(watchTestShaderCheckbox);
            topTestShaderPanel += 20;

            forceShaderCheckbox = new UICheckbox("Force Shader Active", "Automatically enable the last compiled screen shader.", true);
            forceShaderCheckbox.Top.Set(topTestShaderPanel, 0);
            //forceShaderCheckbox.OnSelectedChanged += ForceShaderCheckbox_OnSelectedChanged;
            testShaderPanel.Append(forceShaderCheckbox);
            topTestShaderPanel += 20;

            var uiRanges = new List <UIElement>();

            colorDataProperty = new Dusts.ColorDataRangeProperty("uColor:");
            colorDataProperty.range.Top.Set(top, 0f);
            colorDataProperty.OnValueChanged += () => Filters.Scene["ModdersToolkit:TestScreenShader"].GetShader().UseColor(colorDataProperty.Data);
            uiRanges.Add(colorDataProperty.range);

            intensityData            = new UIFloatRangedDataValue("uIntensity:", 1f, 0f, 1f);
            intensityData.DataGetter = () => Filters.Scene["ModdersToolkit:TestScreenShader"].GetShader().Intensity;
            intensityData.DataSetter = (value) => Filters.Scene["ModdersToolkit:TestScreenShader"].GetShader().UseIntensity(value);
            uiRanges.Add(new UIRange <float>(intensityData));

            //var uDirectionXProperty = new UIFloatRangedDataValue("uDirectionX:", 0, -1, 1);
            //uDirectionXProperty.DataGetter = () => Filters.Scene["ModdersToolkit:TestScreenShader"].GetShader().UseDirection.Intensity;
            //uDirectionXProperty.DataSetter = (value) => Filters.Scene["ModdersToolkit:TestScreenShader"].GetShader().UseDirection(value);
            //var uDirectionYProperty = new UIFloatRangedDataValue("uDirectionY:", 0, -1, 1);
            //var ui2DRange = new UI2DRange<float>(uDirectionXProperty, uDirectionYProperty);
            //uiRanges.Add(ui2DRange);
            //ui2DRange.Top.Set(top, 0f);
            //ui2DRange.Left.Set(200, 0f);
            //mainPanel.Append(ui2DRange);
            //top += 30;

            foreach (var uiRange in uiRanges)
            {
                uiRange.Top.Set(topTestShaderPanel, 0f);
                uiRange.Width.Set(0, 1f);
                testShaderPanel.Append(uiRange);
                topTestShaderPanel += 22;
            }

            updateneeded = true;
            Append(mainPanel);
        }
        protected void OnDeselectContract(UIRadioButton button, UIRadioButton.CallType callType, PointerEventData data)
        {
            if (callType != UIRadioButton.CallType.USER)
            {
                return;
            }

            MissionControl.Instance.panelView.gameObject.SetActive(false);
            MissionControl.Instance.ClearInfoPanel();
            MissionControl.Instance.selectedMission = null;
            selectedButton = null;
        }
        protected void HandleRemovedContract(Contract c)
        {
            LoggingUtil.LogVerbose(this, "HandleRemovedContract");

            // Check we're in the right mode
            if (!displayModeAll || MissionControl.Instance.displayMode != MissionControl.DisplayMode.Available)
            {
                if (MissionControl.Instance.displayMode != MissionControl.DisplayMode.Available)
                {
                    MissionControl.Instance.ClearInfoPanel();
                    MissionControl.Instance.panelView.gameObject.SetActive(false);
                    MissionControl.Instance.RebuildContractList();
                }
                else
                {
                    OnClickAvailable(true);

                    // Our contract was removed
                    if (MissionControl.Instance.selectedMission != null && MissionControl.Instance.selectedMission.contract == c)
                    {
                        MissionControl.Instance.ClearInfoPanel();
                        MissionControl.Instance.panelView.gameObject.SetActive(false);
                        selectedButton.SetState(UIRadioButton.State.False, UIRadioButton.CallType.APPLICATION, null);
                        selectedButton = null;
                    }
                    else
                    {
                        OnSelectContract(selectedButton, UIRadioButton.CallType.USER, null);
                    }
                }
                return;
            }

            // Find the matching contract in our list
            ContractContainer foundMatch = null;
            List<UIListData<KSP.UI.UIListItem>>.Enumerator enumerator = MissionControl.Instance.scrollListContracts.GetEnumerator();
            while (enumerator.MoveNext())
            {
                KSP.UI.UIListItem item = enumerator.Current.listItem;
                foundMatch = item.Data as ContractContainer;
                if (foundMatch != null && foundMatch.contract == c)
                {
                    break;
                }
            }

            // Something went wrong
            if (foundMatch == null)
            {
                LoggingUtil.LogDebug(this, "Something odd, didn't find a match for contract removal...");
                return;
            }

            // Clean up the list item
            bool downgrade = false;
            ConfiguredContract cc = c as ConfiguredContract;
            if (cc != null)
            {
                if (ConfiguredContract.CurrentContracts.Any(checkContract => checkContract != null && checkContract != cc && checkContract.contractType == cc.contractType))
                {
                    // Just remove from the list, there are other matches
                    MissionControl.Instance.scrollListContracts.RemoveItem(foundMatch.mcListItem.container);
                }
                else
                {
                    // Need to downgrade to a contract type line
                    downgrade = true;
                    foundMatch.contract = null;
                    SetupContractItem(foundMatch);
                }
            }
            else
            {
                // Simply remove from the list
                MissionControl.Instance.scrollListContracts.RemoveItem(foundMatch.mcListItem.container);
            }

            // Clean up any empty parents
            if (!downgrade)
            {
                Container previous = foundMatch;
                for (GroupContainer parent = foundMatch.parent; parent != null; parent = parent.parent)
                {
                    ContractContainer cC = previous as ContractContainer;
                    GroupContainer gc = previous as GroupContainer;
                    if (cC != null)
                    {
                        foundMatch.parent.childContracts.Remove(cC);
                    }
                    else if (gc != null)
                    {
                        foundMatch.parent.childGroups.Remove(gc);
                    }

                    if (parent.childContracts.Any())
                    {
                        break;
                    }
                    else
                    {
                        // Remove from the list
                        MissionControl.Instance.scrollListContracts.RemoveItem(parent.mcListItem.container);
                    }
                }
            }

            // If the selected contract was cancelled
            if (MissionControl.Instance.selectedMission != null && MissionControl.Instance.selectedMission.contract == c)
            {
                MissionControl.Instance.selectedMission = null;
                if (selectedButton != null)
                {
                    if (downgrade)
                    {
                        OnSelectContract(selectedButton, UIRadioButton.CallType.USER, null);
                    }
                    else
                    {
                        selectedButton.SetState(UIRadioButton.State.False, UIRadioButton.CallType.APPLICATION, null);
                        selectedButton = null;
                    }
                }
            }
        }
Exemplo n.º 26
0
    private static void HandleUilayoutEvent(WidgetEvent ev)
    {
        UIWidget widget = (UIWidget)ev.Target;

        if (widget.Equals(null))
        {
            return;
        }
        if (ev.Type == UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK)
        {
            if (widget.GetId() == "go_layout_config")    // its LAYOUT-O-MATIC time.
            {
                AtomicMain.AppLog("UILayout action : " + widget.GetId() + " was pressed, its LAYOUT-O-MATIC time");
                UIView   someview = widget.GetView();
                UIWindow window   = new UIWindow();
                window.SetSettings(UI_WINDOW_SETTINGS.UI_WINDOW_SETTINGS_DEFAULT);
                window.SetText("LAYOUT-O-MATIC(tm)");
                window.Load("Scenes/view_layout.ui.txt");
                window.ResizeToFitContent();
                someview.AddChild(window);

                UIWidget okbutt = window.GetWidget("ok");
                okbutt.SubscribeToEvent <WidgetEvent> (okbutt, HandleUilayoutEvent);

                var lox = new AtomicEngine.Vector <AtomicEngine.UIWidget>();
                window.SearchWidgetClass("TBRadioButton", lox);
                for (var ii = 0; ii < lox.Size; ii++)
                {
                    lox[ii].SubscribeToEvent <WidgetEvent> (lox [ii], HandleUilayoutEvent);
                }
            }
            if (widget.GetId() == "ok")
            {
                UIWindow mywindow = (UIWindow)AtomicMain.FindTheWindowParent(widget);
                if (!mywindow.Equals(null))
                {
                    mywindow.Close();
                }
            }
            if (widget.GetId() == "set_ax")
            {
                UILayout      targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on.
                UIRadioButton setla   = (UIRadioButton)widget;                        // who we are
                if (!targetl.Equals(null) && !setla.Equals(null))
                {
                    if (setla.GetValue() == 1)
                    {
                        ReplaceChar(0, 'X');
                        targetl.SetLayoutConfig(layoutomaticstr);
                    }
                }
            }
            if (widget.GetId() == "set_ay")
            {
                UILayout      targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on.
                UIRadioButton setla   = (UIRadioButton)widget;                        // who we are
                if (!targetl.Equals(null) && !setla.Equals(null))
                {
                    if (setla.GetValue() == 1)
                    {
                        ReplaceChar(0, 'Y');
                        targetl.SetLayoutConfig(layoutomaticstr);
                    }
                }
            }

            if (widget.GetId() == "set_sza")
            {
                UILayout      targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on.
                UIRadioButton setla   = (UIRadioButton)widget;                        // who we are
                if (!targetl.Equals(null) && !setla.Equals(null))
                {
                    if (setla.GetValue() == 1)
                    {
                        ReplaceChar(1, 'A');
                        targetl.SetLayoutConfig(layoutomaticstr);
                    }
                }
            }
            if (widget.GetId() == "set_szg")
            {
                UILayout      targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on.
                UIRadioButton setla   = (UIRadioButton)widget;                        // who we are
                if (!targetl.Equals(null) && !setla.Equals(null))
                {
                    if (setla.GetValue() == 1)
                    {
                        ReplaceChar(1, 'G');
                        targetl.SetLayoutConfig(layoutomaticstr);
                    }
                }
            }
            if (widget.GetId() == "set_szp")
            {
                UILayout      targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on.
                UIRadioButton setla   = (UIRadioButton)widget;                        // who we are
                if (!targetl.Equals(null) && !setla.Equals(null))
                {
                    if (setla.GetValue() == 1)
                    {
                        ReplaceChar(1, 'P');
                        targetl.SetLayoutConfig(layoutomaticstr);
                    }
                }
            }


            if (widget.GetId() == "set_posc")
            {
                UILayout      targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on.
                UIRadioButton setla   = (UIRadioButton)widget;                        // who we are
                if (!targetl.Equals(null) && !setla.Equals(null))
                {
                    if (setla.GetValue() == 1)
                    {
                        ReplaceChar(2, 'C');
                        targetl.SetLayoutConfig(layoutomaticstr);
                    }
                }
            }
            if (widget.GetId() == "set_posg")
            {
                UILayout      targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on.
                UIRadioButton setla   = (UIRadioButton)widget;                        // who we are
                if (!targetl.Equals(null) && !setla.Equals(null))
                {
                    if (setla.GetValue() == 1)
                    {
                        ReplaceChar(2, 'G');
                        targetl.SetLayoutConfig(layoutomaticstr);
                    }
                }
            }
            if (widget.GetId() == "set_posl")
            {
                UILayout      targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on.
                UIRadioButton setla   = (UIRadioButton)widget;                        // who we are
                if (!targetl.Equals(null) && !setla.Equals(null))
                {
                    if (setla.GetValue() == 1)
                    {
                        ReplaceChar(2, 'L');
                        targetl.SetLayoutConfig(layoutomaticstr);
                    }
                }
            }
            if (widget.GetId() == "set_posr")
            {
                UILayout      targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on.
                UIRadioButton setla   = (UIRadioButton)widget;                        // who we are
                if (!targetl.Equals(null) && !setla.Equals(null))
                {
                    if (setla.GetValue() == 1)
                    {
                        ReplaceChar(2, 'R');
                        targetl.SetLayoutConfig(layoutomaticstr);
                    }
                }
            }

            if (widget.GetId() == "set_dista")
            {
                UILayout      targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on.
                UIRadioButton setla   = (UIRadioButton)widget;                        // who we are
                if (!targetl.Equals(null) && !setla.Equals(null))
                {
                    if (setla.GetValue() == 1)
                    {
                        ReplaceChar(3, 'A');
                        targetl.SetLayoutConfig(layoutomaticstr);
                    }
                }
            }
            if (widget.GetId() == "set_distg")
            {
                UILayout      targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on.
                UIRadioButton setla   = (UIRadioButton)widget;                        // who we are
                if (!targetl.Equals(null) && !setla.Equals(null))
                {
                    if (setla.GetValue() == 1)
                    {
                        ReplaceChar(3, 'G');
                        targetl.SetLayoutConfig(layoutomaticstr);
                    }
                }
            }
            if (widget.GetId() == "set_distp")
            {
                UILayout      targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on.
                UIRadioButton setla   = (UIRadioButton)widget;                        // who we are
                if (!targetl.Equals(null) && !setla.Equals(null))
                {
                    if (setla.GetValue() == 1)
                    {
                        ReplaceChar(3, 'P');
                        targetl.SetLayoutConfig(layoutomaticstr);
                    }
                }
            }

            if (widget.GetId() == "set_dpc")
            {
                UILayout      targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on.
                UIRadioButton setla   = (UIRadioButton)widget;                        // who we are
                if (!targetl.Equals(null) && !setla.Equals(null))
                {
                    if (setla.GetValue() == 1)
                    {
                        ReplaceChar(4, 'C');
                        targetl.SetLayoutConfig(layoutomaticstr);
                    }
                }
            }
            if (widget.GetId() == "set_dpl")
            {
                UILayout      targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on.
                UIRadioButton setla   = (UIRadioButton)widget;                        // who we are
                if (!targetl.Equals(null) && !setla.Equals(null))
                {
                    if (setla.GetValue() == 1)
                    {
                        ReplaceChar(4, 'L');
                        targetl.SetLayoutConfig(layoutomaticstr);
                    }
                }
            }
            if (widget.GetId() == "set_dpr")
            {
                UILayout      targetl = (UILayout)widget.FindWidget("target_layout"); // who to operate on.
                UIRadioButton setla   = (UIRadioButton)widget;                        // who we are
                if (!targetl.Equals(null) && !setla.Equals(null))
                {
                    if (setla.GetValue() == 1)
                    {
                        ReplaceChar(4, 'R');
                        targetl.SetLayoutConfig(layoutomaticstr);
                    }
                }
            }
        }
    }
Exemplo n.º 27
0
 private static void Write(AssetStreamWriter writer, UIRadioButton o, List <object> objectDictionary)
 {
     Write(writer, (UICheckBox)o, objectDictionary);
 }
Exemplo n.º 28
0
 private void Process(UIRadioButton button, PhotoshopDocument.Layer layer)
 {
     Process((UICheckBox)button, layer);
 }
Exemplo n.º 29
0
        private UIVisual AddChildTo(UIWindow window, PhotoshopDocument.Layer layer)
        {
            if (string.IsNullOrEmpty(layer.Name) ||
                layer.Name.StartsWith("#") == false)
            {
                return(null);
            }

            string name;
            string type;
            Dictionary <string, string> args;

            ParseLayerName(layer.Name, out name, out type, out args);

            if (layer.IsGroup == false)
            {
                if (string.Compare(type, "UIMarkupLabel", true) == 0 ||
                    string.Compare(type, "MarkupLabel", true) == 0 ||
                    string.Compare(type, "Label", true) == 0)
                {
                    UILabel label = new UILabel();
                    label.Name = name;
                    if (args.ContainsKey("0"))
                    {
                        label.Text = args["0"];
                    }
                    window.AddChild(label);
                    Process(label, layer);
                    return(label);
                }
                else if (string.Compare(type, "Document", true) == 0 ||
                         string.Compare(type, "Doc", true) == 0)
                {
                    UIDocument document = new UIDocument();
                    document.Name = name;
                    if (args.ContainsKey("0"))
                    {
                        document.Text = args["0"];
                    }
                    window.AddChild(document);
                    Process(document, layer);
                    return(document);
                }
                else if (string.Compare(type, "Edit", true) == 0 ||
                         string.Compare(type, "EditText", true) == 0 ||
                         string.Compare(type, "EditBox", true) == 0)
                {
                    UIEditText editText = new UIEditText();
                    editText.Name = name;
                    if (args.ContainsKey("0"))
                    {
                        editText.Text = args["0"];
                    }
                    window.AddChild(editText);
                    Process(editText, layer);
                    return(editText);
                }
                else if (string.Compare(type, "9Patch", true) == 0 ||
                         string.Compare(type, "NinePatch", true) == 0 ||
                         string.Compare(type, "9P", true) == 0 ||
                         string.Compare(type, "9P*", true) == 0)
                {
                    UIWindow childWindow = new UIWindow();
                    childWindow.Name = name;
                    window.AddChild(childWindow);
                    Process((UIPanel)childWindow, layer);

                    int bw = layer.Bitmap.Width;
                    int bh = layer.Bitmap.Height;

                    int leftBorder   = 0;
                    int topBorder    = 0;
                    int rightBorder  = 0;
                    int bottomBorder = 0;
                    switch (args.Count)
                    {
                    case 0:
                        leftBorder   = bw / 10;
                        topBorder    = bh / 10;
                        rightBorder  = leftBorder;
                        bottomBorder = topBorder;
                        break;

                    case 1:
                        leftBorder   = int.Parse(args["0"] ?? "0");
                        topBorder    = leftBorder;
                        rightBorder  = leftBorder;
                        bottomBorder = leftBorder;
                        break;

                    default:
                        leftBorder   = int.Parse(args["0"] ?? "0");
                        topBorder    = int.Parse(args["1"] ?? "0");
                        rightBorder  = int.Parse(args["2"] ?? "0");
                        bottomBorder = int.Parse(args["3"] ?? "0");
                        break;
                    }

                    int horizontalBorder = leftBorder + rightBorder;
                    int verticalBorder   = topBorder + bottomBorder;

                    Bitmap leftTopImage     = layer.Bitmap.Clip(new Rectangle(0, 0, leftBorder, topBorder));
                    Bitmap rightTopImage    = layer.Bitmap.Clip(new Rectangle(bw - rightBorder, 0, rightBorder, topBorder));
                    Bitmap leftBottomImage  = layer.Bitmap.Clip(new Rectangle(0, bh - bottomBorder, leftBorder, bottomBorder));
                    Bitmap rightBottomImage = layer.Bitmap.Clip(new Rectangle(bw - rightBorder, bh - bottomBorder, rightBorder, bottomBorder));
                    Bitmap leftImage        = layer.Bitmap.Clip(new Rectangle(0, topBorder, leftBorder, bh - verticalBorder));
                    Bitmap topImage         = layer.Bitmap.Clip(new Rectangle(leftBorder, 0, bw - horizontalBorder, topBorder));
                    Bitmap rightImage       = layer.Bitmap.Clip(new Rectangle(bw - rightBorder, topBorder, rightBorder, bh - verticalBorder));
                    Bitmap bottomImage      = layer.Bitmap.Clip(new Rectangle(leftBorder, bh - bottomBorder, bw - horizontalBorder, bottomBorder));
                    Bitmap centerImage      = layer.Bitmap.Clip(new Rectangle(leftBorder, topBorder, Math.Max(bw - horizontalBorder, 1), Math.Max(bh - verticalBorder, 1)));

                    var images = new List <UIImage>(9);
                    images.Add(CreateNinePatchPart(leftTopImage, UIAnchorPoint.LeftTop, new Vector2(0.0f, 0.0f), 0, 0, leftBorder, topBorder, UISizeMode.Absolute, UISizeMode.Absolute));
                    images.Add(CreateNinePatchPart(rightTopImage, UIAnchorPoint.RightTop, new Vector2(1.0f, 0.0f), 0, 0, rightBorder, topBorder, UISizeMode.Absolute, UISizeMode.Absolute));
                    images.Add(CreateNinePatchPart(leftBottomImage, UIAnchorPoint.LeftBottom, new Vector2(0.0f, 1.0f), 0, 0, leftBorder, bottomBorder, UISizeMode.Absolute, UISizeMode.Absolute));
                    images.Add(CreateNinePatchPart(rightBottomImage, UIAnchorPoint.RightBottom, new Vector2(1.0f, 1.0f), 0, 0, rightBorder, bottomBorder, UISizeMode.Absolute, UISizeMode.Absolute));

                    images.Add(CreateNinePatchPart(leftImage, UIAnchorPoint.LeftTop, new Vector2(0.0f, 0.0f), 0, topBorder, leftBorder, -verticalBorder, UISizeMode.Absolute, UISizeMode.Adjustive));           // left
                    images.Add(CreateNinePatchPart(topImage, UIAnchorPoint.LeftTop, new Vector2(0.0f, 0.0f), leftBorder, 0, -horizontalBorder, topBorder, UISizeMode.Adjustive, UISizeMode.Absolute));          // top
                    images.Add(CreateNinePatchPart(rightImage, UIAnchorPoint.RightTop, new Vector2(1.0f, 0.0f), 0, topBorder, rightBorder, -verticalBorder, UISizeMode.Absolute, UISizeMode.Adjustive));        // right
                    images.Add(CreateNinePatchPart(bottomImage, UIAnchorPoint.LeftBottom, new Vector2(0.0f, 1.0f), leftBorder, 0, -horizontalBorder, bottomBorder, UISizeMode.Adjustive, UISizeMode.Absolute)); // bototm

                    bool forceSingleColor = false;
                    if (string.Compare(type, "9P*", true) == 0)
                    {
                        forceSingleColor = true;
                    }

                    images.Add(CreateNinePatchPart(
                                   centerImage,
                                   UIAnchorPoint.LeftTop,
                                   new Vector2(0.0f, 0.0f),
                                   leftBorder,
                                   topBorder,
                                   -horizontalBorder,
                                   -verticalBorder,
                                   UISizeMode.Adjustive,
                                   UISizeMode.Adjustive,
                                   forceSingleColor: forceSingleColor));

                    foreach (var item in images)
                    {
                        if (item != null)
                        {
                            childWindow.AddChild(item);
                        }
                    }
                    return(childWindow);
                }
                else
                {
                    UIImage image = new UIImage();
                    image.Name = name;
                    window.AddChild(image);
                    Process(image, layer, string.Compare(type, "MaskImage", true) == 0 || string.Compare(type, "MaskSprite", true) == 0);
                    return(image);
                }
            }
            else
            {
                if (string.Compare(type, "Button", true) == 0)
                {
                    UIButton button = new UIButton();
                    button.Name = name;
                    window.AddChild(button);
                    Process(button, layer);
                    return(button);
                }
                else if (string.Compare(type, "CheckBox", true) == 0)
                {
                    UICheckBox button = new UICheckBox();
                    button.Name = name;
                    window.AddChild(button);
                    Process(button, layer);
                    return(button);
                }
                else if (string.Compare(type, "Radio", true) == 0)
                {
                    UIRadioButton button = new UIRadioButton();
                    button.Name = name;
                    window.AddChild(button);
                    Process(button, layer);
                    return(button);
                }
                else if (string.Compare(type, "Scrollable", true) == 0)
                {
                    UIScrollablePanel panel = new UIScrollablePanel();
                    panel.Name = name;
                    window.AddChild(panel);
                    Process(panel, layer);
                    return(panel);
                }
                else
                {
                    bool hasNormal          = layer.FindSubLayer("#Normal", false) != null;
                    bool hasPushed          = layer.FindSubLayer("#Pushed", false) != null;
                    bool hasHovering        = layer.FindSubLayer("#Hovering", false) != null;
                    bool hasCheckedNormal   = layer.FindSubLayer("#CheckedNormal", false) != null;
                    bool hasCheckedPushed   = layer.FindSubLayer("#CheckedPushed", false) != null;
                    bool hasCheckedHovering = layer.FindSubLayer("#CheckedHovering", false) != null;
                    if (hasNormal && hasPushed && !hasCheckedNormal && !hasCheckedPushed)
                    {
                        UIButton button = new UIButton();
                        button.Name = name;
                        window.AddChild(button);
                        Process(button, layer);
                        return(button);
                    }
                    else if (hasNormal && hasCheckedNormal)
                    {
                        UICheckBox button = new UICheckBox();
                        button.Name = name;
                        window.AddChild(button);
                        Process(button, layer);
                        return(button);
                    }
                    else
                    {
                        UIWindow childWindow = new UIWindow();
                        childWindow.Name = name;
                        window.AddChild(childWindow);
                        Process(childWindow, layer);
                        return(childWindow);
                    }
                }
            }
        }
Exemplo n.º 30
0
 public void UnLoadView()
 {
     mAboutLabel = null;
     mImageTargetLabel = null;
     mExtendedTracking = null;
     mCameraFlashSettings = null;
     mAutoFocusSetting = null;
     mCameraLabel = null;
     mCameraFacing = null;
     mDataSet = null;
     mDataSetLabel = null;
 }
        protected void OnDeselectGroup(UIRadioButton button, UIRadioButton.CallType callType, PointerEventData data)
        {
            LoggingUtil.LogVerbose(this, "OnDeselectGroup");

            if (callType != UIRadioButton.CallType.USER)
            {
                return;
            }

            MissionControl.Instance.panelView.gameObject.SetActive(false);
            MissionControl.Instance.ClearInfoPanel();

            GroupContainer groupContainer = (GroupContainer)button.GetComponent<KSP.UI.UIListItem>().Data;
            groupContainer.Toggle();
        }
        protected void OnSelectContract(UIRadioButton button, UIRadioButton.CallType callType, PointerEventData data)
        {
            LoggingUtil.LogVerbose(this, "OnSelectContract");

            if (callType != UIRadioButton.CallType.USER || button == null)
            {
                return;
            }

            ContractContainer cc = (ContractContainer)button.GetComponent<KSP.UI.UIListItem>().Data;

            // Check requirements before displaying the contract
            if (cc.contract != null)
            {
                cc.contract.MeetRequirements();
            }

            // Mark as read
            if (cc.contract != null)
            {
                cc.contract.SetViewed(Contract.Viewed.Read);
                SetContractTitle(cc.mcListItem, cc);
                SetupParentGroups(cc);
            }

            MissionControl.Instance.panelView.gameObject.SetActive(true);
            MissionControl.Instance.logoRenderer.gameObject.SetActive(true);
            selectedButton = button;
            Contract.ContractPrestige? prestige = null;
            if (cc.contract != null)
            {
                MissionControl.Instance.selectedMission = cc.missionSelection;
                MissionControl.Instance.UpdateInfoPanelContract(cc.contract);
                prestige = cc.contract.Prestige;

                MissionControl.Instance.btnAccept.interactable = ContractConfigurator.CanAccept(cc.contract) && ContractSystem.Instance.GetActiveContractCount() < maxActive;
            }
            else
            {
                UpdateInfoPanelContractType(cc.contractType);
                prestige = GetPrestige(cc.contractType);
            }

            if (prestige == Contracts.Contract.ContractPrestige.Exceptional)
            {
                MissionControl.Instance.UpdateInstructor(MissionControl.Instance.avatarController.animTrigger_selectHard, MissionControl.Instance.avatarController.animLoop_excited);
            }
            else if (prestige == Contracts.Contract.ContractPrestige.Significant)
            {
                MissionControl.Instance.UpdateInstructor(MissionControl.Instance.avatarController.animTrigger_selectNormal, MissionControl.Instance.avatarController.animLoop_default);
            }
            else
            {
                MissionControl.Instance.UpdateInstructor(MissionControl.Instance.avatarController.animTrigger_selectEasy, MissionControl.Instance.avatarController.animLoop_default);
            }
        }
Exemplo n.º 33
0
        public UIChatCategoryDialog(VMTSOChatChannel cat, bool isNew) : base(UIDialogStyle.OK | UIDialogStyle.Close, true)
        {
            Channel = cat;
            Caption = GameFacade.Strings.GetString("f113", "21") + cat.ID;
            var topVbox = new UIVBoxContainer();

            var nameLabel = new UILabel();

            nameLabel.Caption = GameFacade.Strings.GetString("f113", "22");
            topVbox.Add(nameLabel);

            NameEdit = new UITextBox();
            NameEdit.SetSize(200, 25);
            NameEdit.CurrentText = cat.Name;
            NameEdit.MaxChars    = 8;
            topVbox.Add(NameEdit);

            var descLabel = new UILabel();

            descLabel.Caption = GameFacade.Strings.GetString("f113", "23");
            topVbox.Add(descLabel);

            DescEdit = new UITextEdit();
            DescEdit.BackgroundTextureReference = UITextBox.StandardBackground;
            DescEdit.TextMargin = new Rectangle(8, 2, 8, 3);
            DescEdit.SetSize(400, 100);
            DescEdit.CurrentText = cat.Description;
            DescEdit.MaxChars    = 256;
            DescEdit.MaxLines    = 5;
            topVbox.Add(DescEdit);

            var flagLabel = new UILabel();

            flagLabel.Caption = GameFacade.Strings.GetString("f113", "24");
            topVbox.Add(flagLabel);

            var flagbox = new UIHBoxContainer();

            for (var i = 0; i < 2; i++)
            {
                var caption = GameFacade.Strings.GetString("f113", (25 + i).ToString());
                var check   = new UIButton(GetTexture(0x0000083600000001));
                check.Tooltip = caption;
                var flag = (VMTSOChatChannelFlags)(1 << i);
                check.OnButtonClick += x => {
                    check.Selected = !check.Selected;
                    cat.Flags     ^= flag;
                };
                check.Selected = (cat.Flags & flag) > 0;

                flagbox.Add(check);

                flagbox.Add(new UILabel
                {
                    Caption = caption
                });
            }
            topVbox.Add(flagbox);
            flagbox.AutoSize();

            Add(topVbox);
            topVbox.AutoSize();
            topVbox.Position = new Vector2(20, 35);

            UIVBoxContainer before = null;

            for (int j = 0; j < 2; j++)
            {
                var vbox = new UIVBoxContainer();
                vbox.Add(new UILabel
                {
                    Caption = (j == 0) ? GameFacade.Strings.GetString("f113", "35") : GameFacade.Strings.GetString("f113", "36")
                });
                var viewMin = (j == 0);
                for (uint i = 0; i < 4; i++)
                {
                    var hbox  = new UIHBoxContainer();
                    var radio = new UIRadioButton();
                    radio.RadioGroup     = (j == 0) ? "viewPerm" : "showPerm";
                    radio.RadioData      = (VMTSOAvatarPermissions)i;
                    radio.Selected       = (viewMin)?(i == (int)cat.ViewPermMin): (i == (int)cat.SendPermMin);
                    radio.Tooltip        = GameFacade.Strings.GetString("f113", (37 + i).ToString());
                    radio.OnButtonClick += (btn) =>
                    {
                        if (viewMin)
                        {
                            cat.ViewPermMin = (VMTSOAvatarPermissions)radio.RadioData;
                        }
                        else
                        {
                            cat.SendPermMin = (VMTSOAvatarPermissions)radio.RadioData;
                        }
                    };

                    hbox.Add(radio);
                    hbox.Add(new UILabel
                    {
                        Caption = GameFacade.Strings.GetString("f113", (37 + i).ToString())
                    });
                    vbox.Add(hbox);
                }
                before        = vbox;
                vbox.Position = new Vector2(20 + j * 200, topVbox.Size.Y + 50);
                Add(vbox);
                vbox.AutoSize();
            }

            var buttonsHbox = new UIHBoxContainer();

            if (!isNew)
            {
                var deleteButton = new UIButton();
                deleteButton.Caption        = GameFacade.Strings.GetString("f113", "33");
                deleteButton.OnButtonClick += (btn) =>
                {
                    UIScreen.RemoveDialog(this);
                    Channel.Flags |= VMTSOChatChannelFlags.Delete;
                    OnDelete();
                };
                buttonsHbox.Add(deleteButton);
            }

            var setColorButton = new UIButton();

            setColorButton.Caption             = GameFacade.Strings.GetString("f113", "34");
            setColorButton.CaptionStyle        = setColorButton.CaptionStyle.Clone();
            setColorButton.CaptionStyle.Color  = cat.TextColor;
            setColorButton.CaptionStyle.Shadow = true;
            setColorButton.OnButtonClick      += (btn) =>
            {
                UIAlert alert = null;
                alert = UIScreen.GlobalShowAlert(new UIAlertOptions()
                {
                    Title   = "",
                    Message = GameFacade.Strings.GetString("f113", "8"),
                    Color   = true,
                    Buttons = new UIAlertButton[]
                    {
                        new UIAlertButton(UIAlertButtonType.OK, (btn2) => {
                            //set the color
                            var col       = int.Parse(alert.ResponseText);
                            cat.TextColor = new Color(col >> 16, (byte)(col >> 8), (byte)col);
                            setColorButton.CaptionStyle.Color = cat.TextColor;
                            setColorButton.Invalidate();
                            UIScreen.RemoveDialog(alert);
                        }),
                        new UIAlertButton(UIAlertButtonType.Cancel)
                    }
                }, true);
            };
            buttonsHbox.Add(setColorButton);
            buttonsHbox.AutoSize();
            buttonsHbox.Position = new Vector2((440 - buttonsHbox.Size.X) / 2, topVbox.Size.Y + before.Size.Y + 65);
            Add(buttonsHbox);

            SetSize(440, (int)(topVbox.Size.Y + before.Size.Y + 115));

            CloseButton.OnButtonClick += (btn) =>
            {
                UIScreen.RemoveDialog(this);
            };

            OKButton.OnButtonClick += (btn) =>
            {
                Channel.Name        = NameEdit.CurrentText;
                Channel.Description = DescEdit.CurrentText;
                UIScreen.RemoveDialog(this);
            };
        }
        protected void OnSelectGroup(UIRadioButton button, UIRadioButton.CallType callType, PointerEventData data)
        {
            LoggingUtil.LogVerbose(this, "OnSelectGroup");

            if (callType != UIRadioButton.CallType.USER)
            {
                return;
            }

            GroupContainer groupContainer = (GroupContainer)button.GetComponent<KSP.UI.UIListItem>().Data;

            if (groupContainer.agent != null)
            {
                MissionControl.Instance.panelView.gameObject.SetActive(true);
                MissionControl.Instance.logoRenderer.gameObject.SetActive(true);

                MissionControl.Instance.UpdateInfoPanelAgent(groupContainer.agent);
                MissionControl.Instance.btnAgentBack.gameObject.SetActive(false);
                MissionControl.Instance.textDateInfo.text = "";
            }
            else
            {
                MissionControl.Instance.panelView.gameObject.SetActive(false);
                MissionControl.Instance.logoRenderer.gameObject.SetActive(false);
            }

            groupContainer.Toggle();

            // Mark the contracts as unread without changing their display state
            foreach (ContractContainer contractContainer in groupContainer.childContracts)
            {
                if (contractContainer.contract != null && contractContainer.contract.ContractViewed == Contract.Viewed.Unseen)
                {
                    contractContainer.contract.SetViewed(Contract.Viewed.Seen);
                }
            }
            SetupGroupItem(groupContainer);
            SetupParentGroups(groupContainer);
        }
Exemplo n.º 35
0
 public void UnLoadView()
 {
     mBackgroundTextureLabel = null;
     mExtendedTracking = null;
     mCameraFlashSettings = null;
     mAutoFocusSetting = null;
     mAboutLabel = null;
     mCameraLabel = null;
     mCameraFacing = null;
 }
Exemplo n.º 36
0
        public Exception Parse(string text, string path)
        {
            var isValid = true;

            try {
                var tmpFileName = string.Format(@"{0}\tmp.xml", Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData));
                File.WriteAllText(tmpFileName, text);
                var xmlDoc = new XmlDocument();
                xmlDoc.Load(tmpFileName);
                Dialog = new UIDialog {
                    Name = xmlDoc.DocumentElement.Attributes["Name"].Value
                };
                if (xmlDoc.DocumentElement.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "Width"))
                {
                    Dialog.Width = Convert.ToDouble(xmlDoc.DocumentElement.Attributes["Width"].Value);
                }
                if (xmlDoc.DocumentElement.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "Height"))
                {
                    Dialog.Height = Convert.ToDouble(xmlDoc.DocumentElement.Attributes["Height"].Value);
                }
                if (xmlDoc.DocumentElement.ChildNodes.Cast <XmlNode>().Any(t => t.Name == "Resource"))
                {
                    var dlgRes = xmlDoc.DocumentElement.ChildNodes.Cast <XmlNode>().FirstOrDefault(t => t.Name == "Resource");
                    if (dlgRes.ChildNodes.Cast <XmlNode>().Any(t => t.Name == "FrameImage"))
                    {
                        Dialog.FrameImage = new UIResourceFrameImage {
                            FileName = string.Format(@"{0}\{1}", path, dlgRes.ChildNodes.Cast <XmlNode>().FirstOrDefault(t => t.Name == "FrameImage").Attributes["FileName"].Value)
                        }
                    }
                    ;
                }

                foreach (XmlNode element in xmlDoc.DocumentElement.ChildNodes)
                {
                    switch (element.Name)
                    {
                    case "IMAGEPICTURE":
                        var imageControl = new UIImagePicture {
                            Name     = element.Attributes["Name"].Value,
                            FileName = element.FirstChild != null && element.FirstChild.FirstChild != null
                                    ? string.Format(@"{0}\{1}", path, element.FirstChild.FirstChild.Attributes["FileName"].Value)
                                    : ""
                        };
                        if (element.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "x"))
                        {
                            imageControl.X = Convert.ToDouble(element.Attributes["x"].Value);
                        }
                        if (element.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "y"))
                        {
                            imageControl.Y = Convert.ToDouble(element.Attributes["y"].Value);
                        }
                        if (element.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "Width"))
                        {
                            imageControl.Width = Convert.ToDouble(element.Attributes["Width"].Value);
                        }
                        if (element.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "Height"))
                        {
                            imageControl.Height = Convert.ToDouble(element.Attributes["Height"].Value);
                        }
                        Dialog.ImagePictures.Add(imageControl);
                        break;

                    case "SCROLL":
                        var scrollControl = new UIScroll {
                            Name = element.Attributes["Name"].Value
                        };
                        if (element.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "x"))
                        {
                            scrollControl.X = Convert.ToDouble(element.Attributes["x"].Value);
                        }
                        if (element.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "y"))
                        {
                            scrollControl.Y = Convert.ToDouble(element.Attributes["y"].Value);
                        }
                        if (element.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "Width"))
                        {
                            scrollControl.Width = Convert.ToDouble(element.Attributes["Width"].Value);
                        }
                        if (element.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "Height"))
                        {
                            scrollControl.Height = Convert.ToDouble(element.Attributes["Height"].Value);
                        }
                        foreach (var node in element.ChildNodes.Cast <XmlNode>().Where(node => node.Name == "Resource"))
                        {
                            var upImage = node.ChildNodes.Cast <XmlNode>().FirstOrDefault(t => t.Name == "UpImage");
                            if (upImage != null)
                            {
                                scrollControl.UpImage = string.Format(@"{0}\{1}", path, upImage.Attributes["FileName"].Value);
                            }

                            var downImage = node.ChildNodes.Cast <XmlNode>().FirstOrDefault(t => t.Name == "DownImage");
                            if (downImage != null)
                            {
                                scrollControl.DownImage = string.Format(@"{0}\{1}", path, downImage.Attributes["FileName"].Value);
                            }

                            var scrollImage = node.ChildNodes.Cast <XmlNode>().FirstOrDefault(t => t.Name == "ScrollImage");
                            if (scrollImage != null)
                            {
                                scrollControl.ScrollImage = string.Format(@"{0}\{1}", path, scrollImage.Attributes["FileName"].Value);
                            }

                            var barFrameImage = node.ChildNodes.Cast <XmlNode>().FirstOrDefault(t => t.Name == "BarFrameImage");
                            if (barFrameImage != null)
                            {
                                scrollControl.BarFrameImage = string.Format(@"{0}\{1}", path, barFrameImage.Attributes["FileName"].Value);
                            }
                        }
                        Dialog.Scrolls.Add(scrollControl);
                        break;

                    case "RADIO":
                        var radioControl = new UIRadioButton {
                            Name = element.Attributes["Name"].Value,
                        };
                        if (element.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "x"))
                        {
                            radioControl.X = Convert.ToDouble(element.Attributes["x"].Value);
                        }
                        if (element.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "y"))
                        {
                            radioControl.Y = Convert.ToDouble(element.Attributes["y"].Value);
                        }
                        if (element.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "Width"))
                        {
                            radioControl.Width = Convert.ToDouble(element.Attributes["Width"].Value);
                        }
                        if (element.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "Height"))
                        {
                            radioControl.Height = Convert.ToDouble(element.Attributes["Height"].Value);
                        }
                        if (element.ChildNodes != null && element.ChildNodes[0].Name == "Hint")
                        {
                            radioControl.Hint = element.ChildNodes != null
                                                   ? element.ChildNodes[0].Attributes["String"].Value
                                                   : "";
                        }
                        foreach (var node in element.ChildNodes.Cast <XmlNode>().Where(node => node.Name == "Resource"))
                        {
                            var normalImage = node.ChildNodes.Cast <XmlNode>().FirstOrDefault(t => t.Name == "NormalImage");
                            if (normalImage != null)
                            {
                                radioControl.NormalImage = string.Format(@"{0}\{1}", path, normalImage.Attributes["FileName"].Value);
                            }

                            var checkedImage = node.ChildNodes.Cast <XmlNode>().FirstOrDefault(t => t.Name == "CheckedImage");
                            if (checkedImage != null)
                            {
                                radioControl.CheckedImage = string.Format(@"{0}\{1}", path, checkedImage.Attributes["FileName"].Value);
                            }
                        }
                        Dialog.RadioButtons.Add(radioControl);
                        break;

                    case "STILLIMAGEBUTTON":
                        var buttonControl = new UIStillImageButton {
                            Name = element.Attributes["Name"].Value,
                        };
                        if (element.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "x"))
                        {
                            buttonControl.X = Convert.ToDouble(element.Attributes["x"].Value);
                        }
                        if (element.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "y"))
                        {
                            buttonControl.Y = Convert.ToDouble(element.Attributes["y"].Value);
                        }
                        if (element.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "Width"))
                        {
                            buttonControl.Width = Convert.ToDouble(element.Attributes["Width"].Value);
                        }
                        if (element.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "Height"))
                        {
                            buttonControl.Height = Convert.ToDouble(element.Attributes["Height"].Value);
                        }
                        if (element.ChildNodes != null && element.ChildNodes[0].Name == "Hint")
                        {
                            buttonControl.Hint = element.ChildNodes != null
                                                   ? element.ChildNodes[0].Attributes["String"].Value
                                                   : "";
                        }
                        if (element.ChildNodes.Cast <XmlNode>().Any(node => node.Name == "Text"))
                        {
                            var textNode = element.ChildNodes.Cast <XmlNode>().First(node => node.Name == "Text");
                            if (textNode.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "String"))
                            {
                                buttonControl.Text = textNode.Attributes["String"].Value;
                            }
                            if (textNode.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "FontSize"))
                            {
                                buttonControl.FontSize = Convert.ToDouble(textNode.Attributes["FontSize"].Value);
                            }
                            if (textNode.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "Color"))
                            {
                                buttonControl.Color = textNode.Attributes["Color"].Value;
                            }
                            if (textNode.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "OutlineColor"))
                            {
                                buttonControl.OutlineColor = textNode.Attributes["OutlineColor"].Value;
                            }
                            if (textNode.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "InnerColor"))
                            {
                                buttonControl.InnerColor = textNode.Attributes["InnerColor"].Value;
                            }
                        }
                        foreach (var node in element.ChildNodes.Cast <XmlNode>().Where(node => node.Name == "Resource"))
                        {
                            var upImage = node.ChildNodes.Cast <XmlNode>().FirstOrDefault(t => t.Name == "FrameUpImage");
                            if (upImage != null)
                            {
                                buttonControl.UpImage = string.Format(@"{0}\{1}", path, upImage.Attributes["FileName"].Value);
                            }

                            var downImage = node.ChildNodes.Cast <XmlNode>().FirstOrDefault(t => t.Name == "FrameDownImage");
                            if (downImage != null)
                            {
                                buttonControl.DownImage = string.Format(@"{0}\{1}", path, downImage.Attributes["FileName"].Value);
                            }

                            var hoverImage = node.ChildNodes.Cast <XmlNode>().FirstOrDefault(t => t.Name == "FrameOnHoverImage");
                            if (hoverImage != null)
                            {
                                buttonControl.HoverImage = string.Format(@"{0}\{1}", path, hoverImage.Attributes["FileName"].Value);
                            }
                        }
                        Dialog.StillImageButtons.Add(buttonControl);
                        break;

                    case "LABEL":
                        var labelControl = new UILabel {
                            Name = element.Attributes["Name"].Value,
                        };
                        if (element.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "x"))
                        {
                            labelControl.X = Convert.ToDouble(element.Attributes["x"].Value);
                        }
                        if (element.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "y"))
                        {
                            labelControl.Y = Convert.ToDouble(element.Attributes["y"].Value);
                        }
                        if (element.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "Width"))
                        {
                            labelControl.Width = Convert.ToDouble(element.Attributes["Width"].Value);
                        }
                        if (element.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "Height"))
                        {
                            labelControl.Height = Convert.ToDouble(element.Attributes["Height"].Value);
                        }
                        if (element.ChildNodes.Cast <XmlNode>().Any(node => node.Name == "Text"))
                        {
                            var textNode = element.ChildNodes.Cast <XmlNode>().First(node => node.Name == "Text");
                            if (textNode.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "String"))
                            {
                                labelControl.Text = textNode.Attributes["String"].Value;
                            }
                            if (textNode.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "FontSize"))
                            {
                                labelControl.FontSize = Convert.ToDouble(textNode.Attributes["FontSize"].Value);
                            }
                            if (textNode.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "Color"))
                            {
                                labelControl.Color = textNode.Attributes["Color"].Value;
                            }
                            if (textNode.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "OutlineColor"))
                            {
                                labelControl.OutlineColor = textNode.Attributes["OutlineColor"].Value;
                            }
                            if (textNode.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "TextUpperColor"))
                            {
                                labelControl.TextUpperColor = textNode.Attributes["TextUpperColor"].Value;
                            }
                            if (textNode.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "TextLowerColor"))
                            {
                                labelControl.TextLowerColor = textNode.Attributes["TextLowerColor"].Value;
                            }
                        }
                        Dialog.Labels.Add(labelControl);
                        break;

                    case "EDIT":
                        var editControl = new UIEditBox {
                            Name = element.Attributes["Name"].Value
                        };
                        if (element.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "x"))
                        {
                            editControl.X = Convert.ToDouble(element.Attributes["x"].Value);
                        }
                        if (element.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "y"))
                        {
                            editControl.Y = Convert.ToDouble(element.Attributes["y"].Value);
                        }
                        if (element.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "Width"))
                        {
                            editControl.Width = Convert.ToDouble(element.Attributes["Width"].Value);
                        }
                        if (element.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "Height"))
                        {
                            editControl.Height = Convert.ToDouble(element.Attributes["Height"].Value);
                        }
                        if (element.ChildNodes.Cast <XmlNode>().Any(node => node.Name == "Text"))
                        {
                            var textNode = element.ChildNodes.Cast <XmlNode>().First(node => node.Name == "Text");
                            if (textNode.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "String"))
                            {
                                editControl.Text = textNode.Attributes["String"].Value;
                            }
                            if (textNode.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "FontSize"))
                            {
                                editControl.FontSize = Convert.ToDouble(textNode.Attributes["FontSize"].Value);
                            }
                            if (textNode.Attributes.Cast <XmlAttribute>().Any(t => t.Name == "Color"))
                            {
                                editControl.Color = textNode.Attributes["Color"].Value;
                            }
                        }
                        foreach (var node in element.ChildNodes.Cast <XmlNode>().Where(node => node.Name == "Resource"))
                        {
                            var frameImage = node.ChildNodes.Cast <XmlNode>().FirstOrDefault(t => t.Name == "FrameImage");
                            if (frameImage != null)
                            {
                                editControl.FrameImage = new UIResourceFrameImage {
                                    FileName = string.Format(@"{0}\{1}", path, frameImage.Attributes["FileName"].Value)
                                }
                            }
                            ;
                        }
                        Dialog.Edits.Add(editControl);
                        break;
                    }
                }

                File.Delete(tmpFileName);
            }
            catch (Exception e) {
                return(e);
            }

            return(null);
        }