当前位置: 首页>>代码示例>>C#>>正文


C# UIComponent.AddUIComponent方法代码示例

本文整理汇总了C#中UIComponent.AddUIComponent方法的典型用法代码示例。如果您正苦于以下问题:C# UIComponent.AddUIComponent方法的具体用法?C# UIComponent.AddUIComponent怎么用?C# UIComponent.AddUIComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIComponent的用法示例。


在下文中一共展示了UIComponent.AddUIComponent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetupBrushStrengthPanel

        public static void SetupBrushStrengthPanel(UIComponent brushOptionsPanel)
        {
            var brushStrengthPanel = brushOptionsPanel.AddUIComponent<UIPanel>();
            brushStrengthPanel.size = new Vector2(197, 49);
            brushStrengthPanel.relativePosition = new Vector2(17, 110);
            brushStrengthPanel.name = "Strength";
            var brushStrengthLabel = brushStrengthPanel.AddUIComponent<UILabel>();
            brushStrengthLabel.localeID = "MAPEDITOR_BRUSHSTRENGTH";
            brushStrengthLabel.size = new Vector2(131, 19);
            brushStrengthLabel.relativePosition = new Vector3(-5, 7);
            var brushStrengthText = brushStrengthPanel.AddUIComponent<UITextField>();
            brushStrengthText.name = "BrushStrength";
            brushStrengthText.size = new Vector2(60, 18);
            brushStrengthText.normalBgSprite = "TextFieldPanel";
            brushStrengthText.relativePosition = new Vector3(125, 7, 0);
            brushStrengthText.builtinKeyNavigation = true;
            brushStrengthText.isInteractive = true;
            brushStrengthText.readOnly = false;
            brushStrengthText.selectionSprite = "EmptySprite";
            brushStrengthText.selectionBackgroundColor = new Color32(0, 172, 234, 255);

            var brushStrengthSlider = brushStrengthPanel.AddUIComponent<UISlider>();
            brushStrengthSlider.name = "BrushStrength";
            brushStrengthSlider.relativePosition = new Vector3(13, 30, 0);
            brushStrengthSlider.backgroundSprite = "ScrollbarTrack";
            brushStrengthSlider.size = new Vector2(171, 12);
            brushStrengthSlider.minValue = 0;
            brushStrengthSlider.maxValue = 1;
            brushStrengthSlider.stepSize = 0.01f;
            var brushStrengthSliderThumb = brushStrengthSlider.AddUIComponent<UISlicedSprite>();
            brushStrengthSliderThumb.spriteName = "ScrollbarThumb";
            brushStrengthSliderThumb.size = new Vector2(10, 20);
            brushStrengthSlider.thumbObject = brushStrengthSliderThumb;
        }
开发者ID:earalov,项目名称:Skylines-NaturalResourcesBrush,代码行数:34,代码来源:UI.cs

示例2: CreateCheckBox

        public static UICheckBox CreateCheckBox(UIComponent parent)
        {
            UICheckBox checkBox = parent.AddUIComponent<UICheckBox>();

            checkBox.width = parent.width;
            checkBox.height = 20f;
            checkBox.clipChildren = true;

            UISprite sprite = checkBox.AddUIComponent<UISprite>();
            sprite.spriteName = "ToggleBase";
            sprite.size = new Vector2(16f, 16f);
            sprite.relativePosition = Vector3.zero;

            checkBox.checkedBoxObject = sprite.AddUIComponent<UISprite>();
            ((UISprite)checkBox.checkedBoxObject).spriteName = "ToggleBaseFocused";
            checkBox.checkedBoxObject.size = new Vector2(16f, 16f);
            checkBox.checkedBoxObject.relativePosition = Vector3.zero;

            checkBox.label = checkBox.AddUIComponent<UILabel>();
            checkBox.label.text = " ";
            checkBox.label.textScale = 0.9f;
            checkBox.label.relativePosition = new Vector3(22f, 2f);

            return checkBox;
        }
开发者ID:lisa-lionheart,项目名称:TimeWarp,代码行数:25,代码来源:UIUtils.cs

示例3: CreateDropDown

        public static UIDropDown CreateDropDown(UIComponent parent)
        {
            UIDropDown dropDown = parent.AddUIComponent<UIDropDown>();
            dropDown.atlas = defaultAtlas;
            dropDown.size = new Vector2(90f, 30f);
            dropDown.listBackground = "GenericPanelLight";
            dropDown.itemHeight = 30;
            dropDown.itemHover = "ListItemHover";
            dropDown.itemHighlight = "ListItemHighlight";
            dropDown.normalBgSprite = "ButtonMenu";
            dropDown.disabledBgSprite = "ButtonMenuDisabled";
            dropDown.hoveredBgSprite = "ButtonMenuHovered";
            dropDown.focusedBgSprite = "ButtonMenu";
            dropDown.listWidth = 90;
            dropDown.listHeight = 500;
            dropDown.foregroundSpriteMode = UIForegroundSpriteMode.Stretch;
            dropDown.popupColor = new Color32(45, 52, 61, 255);
            dropDown.popupTextColor = new Color32(170, 170, 170, 255);
            dropDown.zOrder = 1;
            dropDown.textScale = 0.8f;
            dropDown.verticalAlignment = UIVerticalAlignment.Middle;
            dropDown.horizontalAlignment = UIHorizontalAlignment.Left;
            dropDown.selectedIndex = 0;
            dropDown.textFieldPadding = new RectOffset(8, 0, 8, 0);
            dropDown.itemPadding = new RectOffset(14, 0, 8, 0);

            UIButton button = dropDown.AddUIComponent<UIButton>();
            dropDown.triggerButton = button;
            button.atlas = defaultAtlas;
            button.text = "";
            button.size = dropDown.size;
            button.relativePosition = new Vector3(0f, 0f);
            button.textVerticalAlignment = UIVerticalAlignment.Middle;
            button.textHorizontalAlignment = UIHorizontalAlignment.Left;
            button.normalFgSprite = "IconDownArrow";
            button.hoveredFgSprite = "IconDownArrowHovered";
            button.pressedFgSprite = "IconDownArrowPressed";
            button.focusedFgSprite = "IconDownArrowFocused";
            button.disabledFgSprite = "IconDownArrowDisabled";
            button.foregroundSpriteMode = UIForegroundSpriteMode.Fill;
            button.horizontalAlignment = UIHorizontalAlignment.Right;
            button.verticalAlignment = UIVerticalAlignment.Middle;
            button.zOrder = 0;
            button.textScale = 0.8f;

            dropDown.eventSizeChanged += new PropertyChangedEventHandler<Vector2>((c, t) =>
            {
                button.size = t; dropDown.listWidth = (int)t.x;
            });

            return dropDown;
        }
开发者ID:GRANTSWIM4,项目名称:Cimtographer,代码行数:52,代码来源:UIUtils.cs

示例4: CreateButton

        // Figuring all this was a pain (no documentation whatsoever)
        // So if your are using it for your mod consider thanking me (SamsamTS)
        // Extended Public Transport UI's code helped me a lot so thanks a lot AcidFire
        public static UIButton CreateButton(UIComponent parent)
        {
            UIButton button = (UIButton)parent.AddUIComponent<UIButton>();
            button.atlas = defaultAtlas;
            button.size = new Vector2(90f, 30f);
            button.textScale = 0.9f;
            button.normalBgSprite = "ButtonMenu";
            button.hoveredBgSprite = "ButtonMenuHovered";
            button.pressedBgSprite = "ButtonMenuPressed";
            button.canFocus = false;

            return button;
        }
开发者ID:GRANTSWIM4,项目名称:Cimtographer,代码行数:16,代码来源:UIUtils.cs

示例5: CreateButton

        // Figuring all this was a pain (no documentation whatsoever)
        // So if your are using it for your mod consider thanking me (SamsamTS)
        // Extended Public Transport UI's code helped me a lot so thanks a lot AcidFire
        public static UIButton CreateButton(UIComponent parent)
        {
            UIButton button = parent.AddUIComponent<UIButton>();

            button.size = new Vector2(90f, 30f);
            button.textScale = 0.9f;
            button.normalBgSprite = "ButtonMenu";
            button.hoveredBgSprite = "ButtonMenuHovered";
            button.pressedBgSprite = "ButtonMenuPressed";
            button.disabledBgSprite = "ButtonMenuDisabled";
            button.disabledTextColor = new Color32(128, 128, 128, 255);
            button.canFocus = false;

            return button;
        }
开发者ID:lisa-lionheart,项目名称:TimeWarp,代码行数:18,代码来源:UIUtils.cs

示例6: SetupTitle

        public static void SetupTitle(string text, UIComponent parentPanel)
        {
            var title = parentPanel.AddUIComponent<UIPanel>();
            title.size = new Vector2(parentPanel.width, 40);
            title.canFocus = true;
            title.isInteractive = true;
            title.relativePosition = Vector3.zero;

            var dragHandle = title.AddUIComponent<UIDragHandle>();
            dragHandle.size = title.size;
            dragHandle.relativePosition = Vector3.zero;
            dragHandle.target = parentPanel;

            var windowName = dragHandle.AddUIComponent<UILabel>();
            windowName.relativePosition = new Vector3(60, 13);
            windowName.text = text;
        }
开发者ID:earalov,项目名称:Skylines-NoPillars,代码行数:17,代码来源:UIUtil.cs

示例7: SetupBrushSelectPanel

 public static void SetupBrushSelectPanel(UIComponent brushOptionsPanel)
 {
     var brushSelectPanel = brushOptionsPanel.AddUIComponent<UIPanel>();
     brushSelectPanel.size = new Vector2(255, 321);
     brushSelectPanel.relativePosition = new Vector2(3, 180);
     brushSelectPanel.name = "Brushes";
     var scrollablePanel = brushSelectPanel.AddUIComponent<UIScrollablePanel>();
     scrollablePanel.name = "BrushesContainer";
     scrollablePanel.size = new Vector2(219, 321);
     scrollablePanel.relativePosition = new Vector2(3, 0);
     scrollablePanel.backgroundSprite = "GenericPanel";
     scrollablePanel.autoLayout = true;
     scrollablePanel.autoLayoutDirection = LayoutDirection.Horizontal;
     scrollablePanel.autoLayoutStart = LayoutStart.TopLeft;
     scrollablePanel.autoLayoutPadding = new RectOffset(5, 5, 5, 5);
     scrollablePanel.scrollPadding = new RectOffset(10, 10, 10, 10);
     scrollablePanel.wrapLayout = true;
     scrollablePanel.clipChildren = true;
     scrollablePanel.freeScroll = false;
     var verticalScrollbar = UIUtil.SetUpScrollbar(brushSelectPanel);
     scrollablePanel.verticalScrollbar = verticalScrollbar;
     verticalScrollbar.relativePosition = new Vector2(206, 0);
 }
开发者ID:earalov,项目名称:Skylines-NaturalResourcesBrush,代码行数:23,代码来源:UI.cs

示例8: SetUpScrollbar

        public static UIScrollbar SetUpScrollbar(UIComponent comp)
        {
            var scrollbar = comp.AddUIComponent<UIScrollbar>();
            scrollbar.name = "Scrollbar";
            scrollbar.width = 20f;
            scrollbar.height = comp.height;
            scrollbar.orientation = UIOrientation.Vertical;
            scrollbar.pivot = UIPivotPoint.BottomLeft;
            scrollbar.AlignTo(comp, UIAlignAnchor.TopRight);
            scrollbar.minValue = 0;
            scrollbar.value = 0;
            scrollbar.incrementAmount = 50;

            UISlicedSprite tracSprite = scrollbar.AddUIComponent<UISlicedSprite>();
            tracSprite.relativePosition = Vector2.zero;
            tracSprite.autoSize = true;
            tracSprite.size = tracSprite.parent.size;
            tracSprite.fillDirection = UIFillDirection.Vertical;
            tracSprite.spriteName = "ScrollbarTrack";
            tracSprite.name = "Track";
            scrollbar.trackObject = tracSprite;
            scrollbar.trackObject.height = scrollbar.height;

            UISlicedSprite thumbSprite = tracSprite.AddUIComponent<UISlicedSprite>();
            thumbSprite.relativePosition = Vector2.zero;
            thumbSprite.fillDirection = UIFillDirection.Vertical;
            thumbSprite.autoSize = true;
            thumbSprite.width = thumbSprite.parent.width - 8;
            thumbSprite.spriteName = "ScrollbarThumb";
            thumbSprite.name = "Thumb";

            scrollbar.thumbObject = thumbSprite;
            scrollbar.isVisible = true;
            scrollbar.isEnabled = true;
            return scrollbar;
        }
开发者ID:earalov,项目名称:Skylines-NaturalResourcesBrush,代码行数:36,代码来源:UIUtil.cs

示例9: CreateTextField

        public static UITextField CreateTextField(UIComponent parent)
        {
            UITextField textField = parent.AddUIComponent<UITextField>();

            textField.size = new Vector2(90f, 20f);
            textField.padding = new RectOffset(6, 6, 3, 3);
            textField.builtinKeyNavigation = true;
            textField.isInteractive = true;
            textField.readOnly = false;
            textField.horizontalAlignment = UIHorizontalAlignment.Center;
            textField.selectionSprite = "EmptySprite";
            textField.selectionBackgroundColor = new Color32(0, 172, 234, 255);
            textField.normalBgSprite = "TextFieldPanelHovered";
            textField.disabledBgSprite = "TextFieldPanel";
            textField.textColor = new Color32(0, 0, 0, 255);
            textField.disabledTextColor = new Color32(0, 0, 0, 128);
            textField.color = new Color32(255, 255, 255, 255);

            return textField;
        }
开发者ID:lisa-lionheart,项目名称:TimeWarp,代码行数:20,代码来源:UIUtils.cs

示例10: CreateIconToggle

        public static UICheckBox CreateIconToggle(UIComponent parent, string atlas, string checkedSprite, string uncheckedSprite)
        {
            UICheckBox checkBox = parent.AddUIComponent<UICheckBox>();

            checkBox.width = 35f;
            checkBox.height = 35f;
            checkBox.clipChildren = true;

            UIPanel panel = checkBox.AddUIComponent<UIPanel>();
            panel.backgroundSprite = "IconPolicyBaseRect";
            panel.size = checkBox.size;
            panel.relativePosition = Vector3.zero;

            checkBox.eventCheckChanged += (c, b) =>
            {
                if (checkBox.isChecked)
                    panel.backgroundSprite = "IconPolicyBaseRect";
                else
                    panel.backgroundSprite = "IconPolicyBaseRectDisabled";
                panel.Invalidate();
            };

            checkBox.eventMouseEnter += (c, p) =>
            {
                panel.backgroundSprite = "IconPolicyBaseRectHovered";
            };

            checkBox.eventMouseLeave += (c, p) =>
            {
                if (checkBox.isChecked)
                    panel.backgroundSprite = "IconPolicyBaseRect";
                else
                    panel.backgroundSprite = "IconPolicyBaseRectDisabled";
            };

            UISprite sprite = panel.AddUIComponent<UISprite>();
            sprite.atlas = GetAtlas(atlas);
            sprite.spriteName = uncheckedSprite;
            sprite.size = checkBox.size;
            sprite.relativePosition = Vector3.zero;

            checkBox.checkedBoxObject = sprite.AddUIComponent<UISprite>();
            ((UISprite)checkBox.checkedBoxObject).atlas = sprite.atlas;
            ((UISprite)checkBox.checkedBoxObject).spriteName = checkedSprite;
            checkBox.checkedBoxObject.size = checkBox.size;
            checkBox.checkedBoxObject.relativePosition = Vector3.zero;

            return checkBox;
        }
开发者ID:lisa-lionheart,项目名称:TimeWarp,代码行数:49,代码来源:UIUtils.cs

示例11: SetupWaterCapacityPanel

        public static void SetupWaterCapacityPanel(UIComponent waterOptionsPanel)
        {
            var waterCapacityPanel = waterOptionsPanel.AddUIComponent<UIPanel>();
            waterCapacityPanel.size = new Vector2(231, 78);
            waterCapacityPanel.relativePosition = new Vector2(0, 40);
            waterCapacityPanel.name = "Settings";
            var waterCapacityLabel = waterCapacityPanel.AddUIComponent<UILabel>();
            waterCapacityLabel.localeID = "MAPEDITOR_WATERCAPACITY";
            waterCapacityLabel.size = new Vector2(137, 16);
            waterCapacityLabel.relativePosition = new Vector3(10, 16);
            var waterCapacityText = waterCapacityPanel.AddUIComponent<UITextField>();
            waterCapacityText.name = "Capacity";
            waterCapacityText.size = new Vector2(64, 18);
            waterCapacityText.normalBgSprite = "TextFieldPanel";
            waterCapacityText.builtinKeyNavigation = true;
            waterCapacityText.isInteractive = true;
            waterCapacityText.readOnly = false;
            waterCapacityText.selectionSprite = "EmptySprite";
            waterCapacityText.selectionBackgroundColor = new Color32(0, 172, 234, 255);

            waterCapacityText.relativePosition = new Vector3(150, 16, 0);
            var waterCapacitySlider = waterCapacityPanel.AddUIComponent<UISlider>();
            waterCapacitySlider.name = "Capacity";
            waterCapacitySlider.relativePosition = new Vector3(28, 39, 0);
            waterCapacitySlider.backgroundSprite = "ScrollbarTrack";
            waterCapacitySlider.size = new Vector2(174, 12);
            waterCapacitySlider.minValue = 0.0001f;
            waterCapacitySlider.maxValue = 1;
            waterCapacitySlider.stepSize = 0.0001f;
            var waterCapacitySliderThumb = waterCapacitySlider.AddUIComponent<UISlicedSprite>();
            waterCapacitySliderThumb.spriteName = "ScrollbarThumb";
            waterCapacitySliderThumb.size = new Vector2(10, 20);
            waterCapacitySlider.thumbObject = waterCapacitySliderThumb;

            var resetButton = waterOptionsPanel.AddUIComponent<UIButton>();
            resetButton.name = "Apply";
            resetButton.localeID = "MAPEDITOR_RESET_WATER";
            resetButton.size = new Vector2(191, 38);
            resetButton.relativePosition = new Vector3(20, 132);
            resetButton.eventClick += (component, eventParam) => { Singleton<TerrainManager>.instance.WaterSimulation.m_resetWater = true; };
            resetButton.normalBgSprite = "ButtonMenu";
            resetButton.hoveredBgSprite = "ButtonMenuHovered";
            resetButton.pressedBgSprite = "ButtonMenuPressed";
            resetButton.disabledBgSprite = "ButtonMenuDisabled";
            resetButton.canFocus = false;
        }
开发者ID:earalov,项目名称:Skylines-NaturalResourcesBrush,代码行数:46,代码来源:UI.cs

示例12: SetupLevelHeightPanel

        public static void SetupLevelHeightPanel(UIComponent optionsBar)
        {
            if (GameObject.Find("LevelHeightPanel") != null)
            {
                return;
            }
            var levelHeightPanel = optionsBar.AddUIComponent<UIPanel>();
            levelHeightPanel.backgroundSprite = "MenuPanel2";
            levelHeightPanel.isVisible = false;
            levelHeightPanel.size = new Vector2(231, 108);
            levelHeightPanel.relativePosition = new Vector2(-256, -702);
            levelHeightPanel.name = "LevelHeightPanel";
            UIUtil.SetupTitle("", levelHeightPanel);
            var heightLabel = levelHeightPanel.AddUIComponent<UILabel>();
            heightLabel.name = "HeightLabel";
            heightLabel.localeID = "MAPEDITOR_TERRAINLEVEL";
            heightLabel.size = new Vector2(134, 18);
            heightLabel.relativePosition = new Vector3(13, 56);
            var heightText = levelHeightPanel.AddUIComponent<UITextField>();
            heightText.name = "Height";
            heightText.size = new Vector2(52, 18);
            heightText.normalBgSprite = "TextFieldPanel";
            heightText.relativePosition = new Vector3(150, 56);
            heightText.builtinKeyNavigation = true;
            heightText.isInteractive = true;
            heightText.readOnly = false;
            heightText.selectionSprite = "EmptySprite";
            heightText.selectionBackgroundColor = new Color32(0, 172, 234, 255);

            var heightSlider = levelHeightPanel.AddUIComponent<UISlider>();
            heightSlider.name = "Height";
            heightSlider.relativePosition = new Vector3(28, 79);
            heightSlider.backgroundSprite = "ScrollbarTrack";
            heightSlider.size = new Vector2(174, 12);
            heightSlider.minValue = 0.0f;
            heightSlider.maxValue = 1024.0f;
            heightSlider.stepSize = 0.01f;
            var heightSliderThumb = heightSlider.AddUIComponent<UISlicedSprite>();
            heightSliderThumb.spriteName = "ScrollbarThumb";
            heightSliderThumb.size = new Vector2(10, 20);
            heightSlider.thumbObject = heightSliderThumb;

            levelHeightPanel.gameObject.AddComponent<LevelHeightOptionPanel>();
        }
开发者ID:earalov,项目名称:Skylines-NaturalResourcesBrush,代码行数:44,代码来源:UI.cs

示例13: CreateTextField

        private static UITextField CreateTextField(UIComponent parent)
        {
            var textField = parent.AddUIComponent<UITextField>();

            textField.size = new Vector2(90f, 20f);
            textField.padding = new RectOffset(0, 0, 7, 0);
            textField.builtinKeyNavigation = true;
            textField.isInteractive = true;
            textField.readOnly = false;
            textField.horizontalAlignment = UIHorizontalAlignment.Center;
            textField.selectionSprite = "EmptySprite";
            textField.selectionBackgroundColor = new Color32(0, 172, 234, 255);
            textField.normalBgSprite = "TextFieldPanel";
            textField.hoveredBgSprite = "TextFieldPanelHovered";
            textField.focusedBgSprite = "TextFieldPanelHovered";
            textField.textColor = new Color32(0, 0, 0, 255);
            textField.disabledTextColor = new Color32(0, 0, 0, 128);
            textField.color = new Color32(255, 255, 255, 255);
            textField.eventGotFocus += (component, param) => component.color = new Color32(253, 227, 144, 255);
            textField.eventLostFocus += (component, param) => component.color = new Color32(255, 255, 255, 255);
            return textField;
        }
开发者ID:boformer,项目名称:NetworkSkins,代码行数:22,代码来源:UIUtil.cs

示例14: AddLabel

        private static UILabel AddLabel(UIComponent parent, string text, float width, float dropDownHeight)
        {
            var label = parent.AddUIComponent<UILabel>();
            label.text = text;
            label.textScale = .85f;
            label.textColor = new Color32(200, 200, 200, 255);
            label.autoSize = false;
            label.autoHeight = true;
            label.width = width;
            label.textAlignment = UIHorizontalAlignment.Right;
            label.relativePosition = new Vector3(0, Mathf.Round((dropDownHeight - label.height) / 2));

            return label;
        }
开发者ID:boformer,项目名称:NetworkSkins,代码行数:14,代码来源:UIUtil.cs

示例15: DoToolTips


//.........这里部分代码省略.........
                            //case "Disable Machine Info":
                            //    cb[i].tooltip = "Disables telemetry sent for when you boot up the game exe.\n it includes information to id your specific computer spec & steamid or paradox login\n**Please Note: This setting does nothing atm, mods load too late to change this\n if you want to disable this you must use patched Assemembly-CSharp.dll";
                            //    cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableMachineInfo);
                            //    break;
                            case "Disable Custom Content":
                                cb[i].tooltip = "Disables telemetry about what custom content you load with a map.\n It includes information such has counts of building,props,trees,vehicles,mods, and details about every enabled mod.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableCustomContent );
                                break;
                            case "Disable Session Start":
                                cb[i].tooltip = "Disables telemetry about what Session Starts(loading a map).\n it includes information such has mapname,mapfilename,loadmode,environment,inverted traffic and map guid.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableStartSession);
                                break;
                            case "Disable Session Loaded":
                                cb[i].tooltip = "Disables telemetry about a Loaded Session (map loading completed).\n it includes information such has current time, time in your map, and how long part of the load took to execute.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableSessionLoaded );
                                break;
                            case "Disable Session End":
                                cb[i].tooltip = "Disables telemetry about a Session End (map unloaded).\n it includes data that a session has ended, and of what type it was (map,game,asset).";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableEndSession);
                                break;
                            case "Disable Exception Reporting":
                                cb[i].tooltip = "Disables telemetry about an Exception Error occuring.\n This only sends the 'type' of error and the basic error message, it does not send a stack trace.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableExceptionReporting);
                                break;
                            case "Disable OnAppQuit":
                                cb[i].tooltip = "Disables telemetry sent when you exit the game.\n This includes data that you exited the game and a timestamp.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableOnQuit);
                                break;
                            case "Disable Store Clicks":
                                cb[i].tooltip = "Disables telemetry sent when you click on a store item.\n This only sends that you clicked on the store button.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableOnStoreClick);
                                break;
                            case "Disable Feed Clicks":
                                cb[i].tooltip = "Disables telemetry sent when you click on a workshop feed\\news item \n This sends that you clicked on one and the target steamAppID or url upon which you clicked.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableOnClicks);
                                break;
                            case "Disable Paradox Login":
                                cb[i].tooltip = "Disables telemetry sent when the game logs you into your paradox account \n This sends data that you were auto-logged in and a timestamp.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableParadoxLogin);
                                break;
                            case "Enable All SendToFile Only":
                                cb[i].tooltip = "Enables all telemetry - but nothing will be sent to Paradox, only logged in your log file.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.EnableAllButLogToFileInstead);
                                break;
                            case "DisableWorkshopAdPanel":
                                cb[i].tooltip = "Disables the workshop 'feed' panel, does NOT disable Workshop in general.\n There is no telemetry directly associated with disabling this.\n I simply find the feeds a waste of bandwidth.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableWorkshopAdPanel);
                                break;
                            case "NoOpThePush":
                                cb[i].tooltip = "This is a master overide to make Telemetry.Push() (function that sends the data) do absolutely nothing.\n If set nothing will be sent OR even logged (if not in verbose logging mode).";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.NoOpThePush);
                                break;
                            case "SetURL To LocalHost":
                                cb[i].tooltip = "Sets the Paradox API URL to whatever you have in your config file.\n The default is 'https://localhost:49100/cities' if enabled.\n Can be used if you want to enable everything but send data your own web server.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.SetAPIUrlLocalHost);
                                break;

                            case "Disable All Telemetry":
                                cb[i].tooltip = "Disables all telemetry - Nothing will be sent to Paradox.\nYou do NOT have to select the individual options if this is set.\n *Please see note at bottom of options page about the OnAppStartup and MachineInfo telemetry events.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.DisableAll);
                                break;
                            case "Enable All Telemetry":
                                cb[i].tooltip = "Enables all telemetry - The game's default behavior.";
                                cb[i].isChecked = Helper.HasTelemFlag(Mod.config.TelemetryLevel, Helper.TelemOption.EnableAll);
                                break;
                            default:
                                break;
                        }
                    }
                }

                List<UIButton> bb = new List<UIButton>();
                component.GetComponentsInChildren<UIButton>(true, bb);
                if ( bb.Count > 0)
                {
                    bb[0].tooltip = "Press this after making changes to ensure all changes are activated.\n ";

                    if (!isMsgLabelSetup)
                    {
                        uiMsg = component.AddUIComponent<UILabel>();
                        isMsgLabelSetup = true;
                        uiMsg.name = "TelemetryMessageText";
                        uiMsg.text = UILABEL_MSG_TEXT;
                        uiMsg.width = 350f;

                        //uiMsg.wordWrap = true;
                        uiMsg.relativePosition = new Vector3(bb[0].relativePosition.x, bb[0].relativePosition.y + 30f);
                        uiMsg.Show();
                    }

                }

                if (Mod.DEBUG_LOG_ON) { Helper.dbgLog("Tooltips set"); }
            }
            catch(Exception ex)
            {
                Helper.dbgLog("", ex, true);
            }
            yield break;
        }
开发者ID:Knighth,项目名称:Telemetry-Control,代码行数:101,代码来源:Mod.cs


注:本文中的UIComponent.AddUIComponent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。