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


C# UIComponent类代码示例

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


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


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