本文整理汇总了C#中dfControl.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# dfControl.GetType方法的具体用法?C# dfControl.GetType怎么用?C# dfControl.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dfControl
的用法示例。
在下文中一共展示了dfControl.GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateScript
public static void CreateScript( dfControl control )
{
if( control == null )
return;
if( string.IsNullOrEmpty( EditorApplication.currentScene ) )
{
EditorUtility.DisplayDialog( "Please save your scene", "Please save your scene before using the Script Wizard", "OK" );
return;
}
var events = control
.GetType()
.GetAllFields()
.Where( x => typeof( Delegate ).IsAssignableFrom( x.FieldType ) )
.Select( x => new EventInfo( x ) )
.OrderBy( x => x.Category + "." + x.Field.Name )
.ToList();
var path = buildGameObjectPath( control );
var dialog = GetWindow<dfScriptWizard>( true, "Create Script - " + path );
dialog.target = control;
dialog.events = events;
dialog.minSize = new Vector2( 640, 480 );
dialog.className = control.name.Replace( " ", "" ) + "Events";
}
示例2: generateControlName
private string generateControlName( dfControl target )
{
var name = target.GetType().Name;
if( name.StartsWith( "df" ) && name.Length > 2 )
{
name = char.ToLowerInvariant( name[ 2 ] ) + name.Substring( 3 );
}
return "_" + name;
}
示例3: buildGameObjectPath
private static string buildGameObjectPath( dfControl control )
{
var obj = control.transform;
var buffer = new StringBuilder();
while( obj != null )
{
if( buffer.Length > 0 )
buffer.Insert( 0, "/" );
buffer.Insert( 0, obj.name );
obj = obj.parent;
}
buffer.Append( " (" );
buffer.Append( control.GetType().Name );
buffer.Append( " )" );
return buffer.ToString();
}