• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# UIComponent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: 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


示例2: ChallengeChanged

        public void ChallengeChanged(UIComponent comp, int value)
        {
            m_selectButton.Enable();
            this.m_selectedIndex = value;
            Challenge selectedChallenge = m_challenges [value];
            m_challengeName.text = "Name\n    " + selectedChallenge.Name;
            m_challengeDesc.text = "Description\n    " + selectedChallenge.Description;
            m_challengeBreakdown.text = "Breakdown" + GoalsToString (selectedChallenge.Goals);
            if (selectedChallenge.Rewards != null && selectedChallenge.Rewards.Length >= 0) {
                m_challengeReward.text = "Reward" + RewardsToString (selectedChallenge.Rewards);
            } else {
                m_challengeReward.text = "";
            }

            if (selectedChallenge.Penalties != null && selectedChallenge.Penalties.Length >= 0) {
                m_challengePenalty.text = "Penalty" + RewardsToString (selectedChallenge.Penalties);
            } else {
                m_challengePenalty.text = "";
            }

            if (selectedChallenge.m_hasDeadline){
                m_challengeDeadline.text = "Duration\n    " + selectedChallenge.Years + " years, " + selectedChallenge.Months + " months";
            } else {
                m_challengeDeadline.text = "Duration\n    Unlimited";
            }

            m_challengeName.Enable ();
            m_challengeDesc.Enable ();
            m_challengeBreakdown.Enable ();
            m_challengeReward.Enable ();
            m_challengePenalty.Enable ();
            m_challengeDeadline.Enable ();
            FormatDetails ();
        }
开发者ID:CWMlolzlz,项目名称:Challenges,代码行数:34,代码来源:ChallengeManagerPanel.cs


示例3: OnButtonClicked

 protected override void OnButtonClicked(UIComponent comp)
 {
     int zOrder = comp.zOrder;
     TerrainTool terrainTool = ToolsModifierControl.SetTool<TerrainTool>();
     if (terrainTool == null)
     {
         return;
     }
     var panel = (TerrainPanel)Convert.ChangeType(this, typeof(TerrainPanel));
     ShowUndoTerrainOptionsPanel(panel, true);
     ShowBrushOptionsPanel(panel, true);
     //begin mod
     UIView.library.Show("LandscapingInfoPanel");
     //end mod
     if (zOrder == 1 || zOrder == 3)
         ShowLevelHeightPanel(panel, true);
     else
         ShowLevelHeightPanel(panel, false);
     //begin mod
     if (zOrder < kTools.Length)
     {
         terrainTool.m_mode = TerrainPanelDetour.kTools[zOrder].enumValue;
         TerrainToolDetour.isDitch = false;
     }
     else
     {
         terrainTool.m_mode = TerrainTool.Mode.Shift;
         TerrainToolDetour.isDitch = true;
     }
     //end mod
 }
开发者ID:earalov,项目名称:Skylines-NaturalResourcesBrush,代码行数:31,代码来源:TerrainPanelDetour.cs


示例4: ButtonClick

		private void ButtonClick(UIComponent uiComponent, UIMouseEventParameter eventParam) {
			if (!_uiShown) {
				Show();
			} else {
				Close();
			}
		}
开发者ID:akira-ishizaki,项目名称:Cities-Skylines-Traffic-Manager-President-Edition,代码行数:7,代码来源:UIBase.cs


示例5: CheckBoxChanged

 public void CheckBoxChanged(UIComponent c, UIMouseEventParameter p)
 {
     UICheckBox cb = c as UICheckBox;
     bAutosaveEnabled = cb.isChecked;
     timer = autoSaveInterval * 60;
     updateLabel(bAutosaveEnabled, autoSaveInterval);
 }
开发者ID:iUltimateLP,项目名称:skylines-autosave-countdown,代码行数:7,代码来源:Main.cs


示例6: ListBase

        public ListBase(UILogic uiLogic, UIComponent parent, TimeSpan creationTime, Rectangle rec, SpriteFont font, bool checkable)
            : base(uiLogic, parent, creationTime)
        {
            this.Font = font;
            this.IsCheckable = checkable;
            recInitial = rec;

            sizeText = font.MeasureString(new String(' ', 40)) + new Vector2(Ribbon.MARGE * 2, Ribbon.MARGE);

            countMaxItem = (rec.Height - 2 * MARGE) / (int)sizeText.Y;

            Rec = new Rectangle(
                recInitial.X,
                recInitial.Y,
                Math.Min((int)sizeText.X, recInitial.Width),
                (int)(countMaxItem * sizeText.Y + 2 * MARGE));

            if (sizeText.X > Rec.Width)
                sizeText.X = Rec.Width - 2 * MARGE;

            //--- Molette de la souris
            MouseManager mouseWheel = AddMouse(MouseButtons.Wheel);
            mouseWheel.MouseWheelChanged += new MouseManager.MouseWheelChangedHandler(mouseWheel_MouseWheelChanged);
            //---
        }
开发者ID:HaKDMoDz,项目名称:geff,代码行数:25,代码来源:ListBase.cs


示例7: ApplyGenericProperty

        private void ApplyGenericProperty(XmlNode node, UIComponent component)
        {
            bool optional = XmlUtil.TryGetBoolAttribute(node, "optional");
            bool sticky = XmlUtil.TryGetBoolAttribute(node, "sticky");
            string aspect = XmlUtil.TryGetStringAttribute(node, "aspect", "any");
            if (aspect != "any")
            {
                if (Util.AspectRatioFromString(aspect) != _currentAspectRatio)
                {
                    return;
                }
            }

            if (sticky)
            {
                _stickyProperties.Add(new StickyProperty
                {
                    ChildNode = node,
                    Component = component,
                    Node = node
                });
            }

            SetPropertyValue(node, node, component, optional, true);
        }
开发者ID:aoighost,项目名称:Skylines-Sapphire,代码行数:25,代码来源:SkinApplicator.cs


示例8: 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


示例9: OnButtonClicked

 protected override void OnButtonClicked(UIComponent comp)
 {
     object objectUserData = comp.objectUserData;
     BuildingInfo buildingInfo = objectUserData as BuildingInfo;
     NetInfo netInfo = objectUserData as NetInfo;
     TreeInfo treeInfo = objectUserData as TreeInfo;
     PropInfo propInfo = objectUserData as PropInfo;
     if (buildingInfo != null)
     {
         BuildingTool buildingTool = ToolsModifierControl.SetTool<BuildingTool>();
         if (buildingTool != null)
         {
             if (base.pathsOptionPanel != null)
             {
                 base.pathsOptionPanel.Hide();
             }
             buildingTool.m_prefab = buildingInfo;
             buildingTool.m_relocate = 0;
         }
     }
     if (netInfo != null)
     {
         NetToolFine netTool = ToolsModifierControl.SetTool<NetToolFine>();
         if (netTool != null)
         {
             if (base.pathsOptionPanel != null)
             {
                 base.pathsOptionPanel.Show();
             }
             netTool.m_prefab = netInfo;
         }
     }
     if (treeInfo != null)
     {
         TreeTool treeTool = ToolsModifierControl.SetTool<TreeTool>();
         if (treeTool != null)
         {
             if (base.pathsOptionPanel != null)
             {
                 base.pathsOptionPanel.Hide();
             }
             treeTool.m_prefab = treeInfo;
             treeTool.m_mode = TreeTool.Mode.Single;
         }
     }
     if (propInfo != null)
     {
         PropTool propTool = ToolsModifierControl.SetTool<PropTool>();
         if (propTool != null)
         {
             if (base.pathsOptionPanel != null)
             {
                 base.pathsOptionPanel.Hide();
             }
             propTool.m_prefab = propInfo;
             propTool.m_mode = PropTool.Mode.Single;
         }
     }
 }
开发者ID:FIDOCABRA,项目名称:Skylines-FineRoadHeights,代码行数:59,代码来源:BeautificationFinePanel.cs


示例10: ButtonWhatsNew_eventClicked

 private void ButtonWhatsNew_eventClicked(UIComponent component, UIMouseEventParameter eventParam)
 {
     if(whatsNewPanel != null)
     {
         whatsNewPanel.Show();
         whatsNewPanel.BringToFront();
     }
 }
开发者ID:GRANTSWIM4,项目名称:Cimtographer,代码行数:8,代码来源:ExportPanel.cs


示例11: AskInfoModalCallback

 private void AskInfoModalCallback(UIComponent component, int result)
 {
     if (result != 0)
     {
         string workshopUrl = string.Format("http://steamcommunity.com/sharedfiles/filedetails/?id={0}", _workshopAssetRowData.WorkshopId);
         Process.Start(workshopUrl);
     }
 }
开发者ID:gertjanstulp,项目名称:CSWorkshopMonitor,代码行数:8,代码来源:ShowWorkshopAssetInfoCommand.cs


示例12: clickSwitchTraffic

		private void clickSwitchTraffic(UIComponent component, UIMouseEventParameter eventParam) {
			if (TrafficLightTool.getToolMode() != ToolMode.SwitchTrafficLight) {
				_buttonSwitchTraffic.focusedBgSprite = "ButtonMenuFocused";
				TrafficLightTool.SetToolMode(ToolMode.SwitchTrafficLight);
			} else {
				_buttonSwitchTraffic.focusedBgSprite = "ButtonMenu";
				TrafficLightTool.SetToolMode(ToolMode.None);
			}
		}
开发者ID:akira-ishizaki,项目名称:Cities-Skylines-Traffic-Manager-President-Edition,代码行数:9,代码来源:UITrafficManager.cs


示例13: ZonedPanel_eventVisibilityChanged

 public void ZonedPanel_eventVisibilityChanged(UIComponent component, bool value)
 {
     if (!value)
     {
         return;
     }
     Tabs.AlignTo(zonedPanelUi, UIAlignAnchor.TopLeft);
     Tabs.relativePosition = new Vector2(13, -25);
 }
开发者ID:earalov,项目名称:Skylines-SubBuildingsTabBar,代码行数:9,代码来源:SubBuildingsMonitor.cs


示例14: OnClick

        protected void OnClick(UIComponent comp, UIMouseEventParameter p)
        {
            p.Use();
            UIButton uIButton = comp as UIButton;
            if (uIButton != null && uIButton.parent == this.m_strip)
            {

            }
        }
开发者ID:Rovanion,项目名称:csl-traffic,代码行数:9,代码来源:RoadCustomizerGroupPanel.cs


示例15: TextField_eventTextSubmitted

        private void TextField_eventTextSubmitted(UIComponent component, string value)
        {
            if (Populating) return;

            #if DEBUG
            Debug.LogFormat("Changing " + Description + " TextField");
            #endif
            OnTextChanged(value);
        }
开发者ID:boformer,项目名称:NetworkSkins,代码行数:9,代码来源:UIDropDownTextFieldOption.cs


示例16: LogPosition

        /// <summary>
        /// Logs the components position.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="block">The block.</param>
        /// <param name="component">The component.</param>
        /// <param name="componentName">Name of the component.</param>
        /// <param name="connectedName">Name of the connected control.</param>
        public static void LogPosition(object source, string block, UIComponent component, string componentName = null, string connectedName = null)
        {
            if (String.IsNullOrEmpty(componentName))
            {
                componentName = component.cachedName;
            }

            Log.Debug(source, block, connectedName, componentName, component, "Position", component.absolutePosition, component.relativePosition, component.position, component.width, component.height, component.anchor);
        }
开发者ID:DinkyToyz,项目名称:wtmcsServiceDispatcher,代码行数:17,代码来源:UI.cs


示例17: DropDown_eventSelectedIndexChanged

        private void DropDown_eventSelectedIndexChanged(UIComponent component, int index)
        {
            if (Populating) return;

            #if DEBUG
            Debug.LogFormat("Changing " + Description);
            #endif
            OnSelectionChanged(index);
        }
开发者ID:boformer,项目名称:NetworkSkins,代码行数:9,代码来源:UIDropDownTextFieldOption.cs


示例18: Ribbon

        public Ribbon(UILogic uiLogic, UIComponent parent, TimeSpan creationTime)
            : base(uiLogic, parent, creationTime)
        {
            CreationTime = creationTime;

            Visible = true;
            Alive = true;

            Init();
        }
开发者ID:HaKDMoDz,项目名称:geff,代码行数:10,代码来源:Ribbon.cs


示例19: rootPanel_eventVisibilityChanged

 private void rootPanel_eventVisibilityChanged(UIComponent component, bool value)
 {
     // Only save and apply the configuration if the rootpanel was visible but isn't anymore (meaning the user closed the window)
     if (_wasVisible && !value)
     {
         _configuration.SaveConfiguration();
         _configuration.ApplyConfiguration();
     }
     this._wasVisible = value;
 }
开发者ID:gertjanstulp,项目名称:CSNoQuestionsAsked,代码行数:10,代码来源:UIModOptionsPanelBuilder.cs


示例20: SpawnSubEntry

        public static UIButton SpawnSubEntry(UITabstrip strip, string name, string localeID, string unlockText, string spriteBase, bool enabled,
            UIComponent m_OptionsBar, UITextureAtlas m_DefaultInfoTooltipAtlas)
        {
            if (strip.Find<UIButton>(name) != null)
            {
                return null;
            }

            Type type1 = Util.FindType(name + "Group" + "Panel");
            if (type1 != null && !type1.IsSubclassOf(typeof(GeneratedGroupPanel)))
                type1 = (Type)null;
            if (type1 == null)
                return (UIButton)null;
            UIButton button;

            GameObject asGameObject1 = UITemplateManager.GetAsGameObject(kMainToolbarButtonTemplate);
            GameObject asGameObject2 = UITemplateManager.GetAsGameObject(kScrollableSubPanelTemplate);
            UITabstrip uiTabstrip = strip;
            string name1 = name;
            GameObject strip1 = asGameObject1;
            GameObject page = asGameObject2;
            Type[] typeArray = new Type[1];
            int index = 0;
            Type type2 = type1;
            typeArray[index] = type2;
            button = uiTabstrip.AddTab(name1, strip1, page, typeArray) as UIButton;

            button.isEnabled = enabled;
            button.gameObject.GetComponent<TutorialUITag>().tutorialTag = name;
            GeneratedGroupPanel generatedGroupPanel = GameObject.FindObjectOfType(type1) as GeneratedGroupPanel;
            if ((Object)generatedGroupPanel != (Object)null)
            {
                generatedGroupPanel.component.isInteractive = true;
                generatedGroupPanel.m_OptionsBar = m_OptionsBar;
                generatedGroupPanel.m_DefaultInfoTooltipAtlas = m_DefaultInfoTooltipAtlas;
                if (enabled)
                    generatedGroupPanel.RefreshPanel();
            }
            button.normalBgSprite = GetBackgroundSprite(button, spriteBase, name, "Normal");
            button.focusedBgSprite = GetBackgroundSprite(button, spriteBase, name, "Focused");
            button.hoveredBgSprite = GetBackgroundSprite(button, spriteBase, name, "Hovered");
            button.pressedBgSprite = GetBackgroundSprite(button, spriteBase, name, "Pressed");
            button.disabledBgSprite = GetBackgroundSprite(button, spriteBase, name, "Disabled");
            string str = spriteBase + name;
            button.normalFgSprite = str;
            button.focusedFgSprite = str + "Focused";
            button.hoveredFgSprite = str + "Hovered";
            button.pressedFgSprite = str + "Pressed";
            button.disabledFgSprite = str + "Disabled";
            if (unlockText != null)
                button.tooltip = Locale.Get(localeID, name) + " - " + unlockText;
            else
                button.tooltip = Locale.Get(localeID, name);
            return button;
        }
开发者ID:earalov,项目名称:Skylines-NaturalResourcesBrush,代码行数:55,代码来源:ToolbarButtonSpawner.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UIControlledApplication类代码示例发布时间:2022-05-24
下一篇:
C# UIColor类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap