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


C# UIComponent.GetType方法代码示例

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


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

示例1: OnClick

        public override UIComponent OnClick(UIComponent ui)
        {
            if (ui.GetType() == typeof(UIComponent_Toolbar))
            {
                if (((UIComponent_Toolbar)ui).Diagonal)
                    ((UIComponent_Toolbar)ui).Diagonal = false;
                else
                    ((UIComponent_Toolbar)ui).Diagonal = true;

                diagonal = ((UIComponent_Toolbar)ui).Diagonal;
            }
            return ui;
        }
开发者ID:steffan88,项目名称:Bevelle,代码行数:13,代码来源:UI_Diagonal.cs

示例2: DumpComponent

        public static string DumpComponent(UIComponent component, int ident = 0)
        {
            string identString = "";
            for (int i = 0; i < ident; i++)
            {
                identString += "  ";
            }

            string result = "";

            result += String.Format("\n{1}<Component name=\"{0}\">\n", component.name, identString);

            var properties = component.GetType().GetProperties();
            foreach (var property in properties)
            {
                if (!property.CanRead)
                {
                    continue;
                }

                var name = property.Name;
                string value;
                try
                {
	                var rawValue = property.GetValue(component, null);
	                value = rawValue == null ? "null" : rawValue.ToString();
                }
                catch (Exception ex)
                {
                    value = "[ERROR] " + ex;
                }
                
                result += String.Format("{2}  <{0}>{1}</{0}>\n", name, value, identString);
            }
            
            for (int i = 0; i < component.transform.childCount; i++)
            {
                try
                {
                    result += DumpComponent(component.transform.GetChild(i).GetComponent<UIComponent>(), ident + 1);
                }
                catch (Exception)
                {
                }
            }

            result += String.Format("{0}</Component>\n", identString);
            return result;
        }
开发者ID:aoighost,项目名称:Skylines-Sapphire,代码行数:49,代码来源:SceneUtil.cs

示例3: OnClick

 public override UIComponent OnClick(UIComponent ui)
 {
     if (ui.GetType() == typeof(UIComponent_Toolbar))
         ((UIComponent_Toolbar)ui).StartAstar = true;
     return ui;
 }
开发者ID:steffan88,项目名称:Bevelle,代码行数:6,代码来源:UI_Start.cs

示例4: ApplyInternalRecursive

 private void ApplyInternalRecursive(XmlNode node, UIComponent component)
 {
     if (component != null)
     {
         if (component.GetType() == typeof(UIMultiStateButton) && node.Name == "SpriteState")
         {
             ApplyUIMultiStateButtonSpriteStateProperty(node, component);
         }
         else
         {
             ApplyGenericProperty(node, component);
         }
     }
     else
     {
         throw new ParseException("Setting properties on the UIView object is not allowed!", node);
     }
 }
开发者ID:aoighost,项目名称:Skylines-Sapphire,代码行数:18,代码来源:SkinApplicator.cs

示例5: SetPropertyValue

        private void SetPropertyValue(XmlNode setNode, XmlNode node, UIComponent component, bool optional, bool rollback)
        {
            var property = ReflectionCache.GetPropertyForType(component.GetType(), setNode.Name);

            if (property == null)
            {
                if (optional)
                {
                    return;
                }
				if (ConfigManager.IgnoreMissingComponents)
	            {
					Debug.LogWarning(string.Format("Component: {0} doesn't contain {1} - node: {3}", setNode.Name, component, node));
		            return;
	            }

	            throw new MissingComponentPropertyException(setNode.Name, component, node);
            }

            if (!property.CanWrite)
            {
                throw new ParseException(String.Format("Property \"{0}\" of component \"{1}\" is read-only", property.Name, component.name), setNode);
            }

            object value;

            bool raw = XmlUtil.TryGetBoolAttribute(setNode, "raw");

            if (property.PropertyType == typeof(Color32) && !raw)
            {
                value = _skin.GetNamedColor(setNode.InnerText);
            }
            else
            {
                value = XmlUtil.GetValueForType(setNode, property.PropertyType, setNode.InnerText, _skin.spriteAtlases);
            }

            if (rollback)
            {
                SetPropertyValueWithRollback(component, property, value);
            }
            else
            {
                SetPropertyValue(component, property, value);
            }
        }
开发者ID:aoighost,项目名称:Skylines-Sapphire,代码行数:46,代码来源:SkinApplicator.cs

示例6: OnClick

 public override UIComponent OnClick(UIComponent ui)
 {
     if (ui.GetType() == typeof(UIComponent_Toolbar))
         ((UIComponent_Toolbar)ui).ToolID = 0;
     return ui;
 }
开发者ID:steffan88,项目名称:Bevelle,代码行数:6,代码来源:UI_None.cs

示例7: LogComponent

        /// <summary>
        /// Logs the component data.
        /// </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 component.</param>
        /// <param name="depth">The recursion depth.</param>
        private static void LogComponent(object source, string block, UIComponent component, string componentName, string connectedName, int depth)
        {
            string componentPath = null;

            try
            {
                if (component != null && component is UIComponent)
                {
                    Log.InfoList info = new Log.InfoList();

                    componentPath = componentName;

                    if (String.IsNullOrEmpty(componentPath))
                    {
                        componentPath = component.cachedName;

                        if (String.IsNullOrEmpty(componentPath))
                        {
                            componentPath = "?";
                        }
                    }

                    if (!String.IsNullOrEmpty(connectedName))
                    {
                        componentPath = connectedName + "/" + componentPath;
                    }

                    try
                    {
                        foreach (var property in component.GetType().GetProperties())
                        {
                            if (property != null)
                            {
                                try
                                {
                                    info.Add(property.Name, property.GetValue(component, null));
                                }
                                catch
                                {
                                }
                            }
                        }
                    }
                    catch
                    {
                    }

                    Log.Debug(source, block, depth, componentPath, component.GetType(), component, info);

                    if (depth < 32)
                    {
                        depth++;

                        foreach (UIComponent child in component.components)
                        {
                            if (child != null)
                            {
                                LogComponent(source, block, child, null, componentPath, depth);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                if (String.IsNullOrEmpty(componentPath))
                {
                    Log.Debug(source, block, connectedName, componentName, ex.GetType(), ex.Message);
                }
                else
                {
                    Log.Debug(source, block, componentPath, ex.GetType(), ex.Message);
                }
            }
        }
开发者ID:DinkyToyz,项目名称:wtmcsServiceDispatcher,代码行数:84,代码来源:UI.cs


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