本文整理汇总了C#中ViewBase.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ViewBase.GetType方法的具体用法?C# ViewBase.GetType怎么用?C# ViewBase.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewBase
的用法示例。
在下文中一共展示了ViewBase.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFieldInformation
protected void GetFieldInformation(ViewBase t)
{
_fieldInfos = t.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic);
_toggleGroups = new Dictionary<string, FieldInfo>();
_groupFields = new Dictionary<string, List<FieldInfo>>();
foreach (var fieldInfo in _fieldInfos)
{
var attribute = fieldInfo.GetCustomAttributes(typeof(UFToggleGroup), true).FirstOrDefault() as UFToggleGroup;
var requireInstanceAttribute =
fieldInfo.GetCustomAttributes(typeof(UFRequireInstanceMethod), true).FirstOrDefault() as UFRequireInstanceMethod;
if (requireInstanceAttribute != null)
{
var method = t.GetType()
.GetMethod(requireInstanceAttribute.MethodName, BindingFlags.Public | BindingFlags.Instance);
if (method == null || (method.DeclaringType != null
&& method.DeclaringType.Name.EndsWith("ViewBase"))) // TODO: Remove this hack and use attributes
{
var value = (bool)fieldInfo.GetValue(target);
if (value)
{
fieldInfo.SetValue(target, false);
}
continue;
}
}
if (attribute == null)
{
var groupAttribute =
fieldInfo.GetCustomAttributes(typeof(UFGroup), true).FirstOrDefault() as UFGroup;
if (groupAttribute == null) continue;
if (!_groupFields.ContainsKey(groupAttribute.Name))
{
_groupFields.Add(groupAttribute.Name, new List<FieldInfo>());
}
_groupFields[groupAttribute.Name].Add(fieldInfo);
}
else
{
if (!_toggleGroups.ContainsKey(attribute.Name))
{
_toggleGroups.Add(attribute.Name, fieldInfo);
}
if (!_groupFields.ContainsKey(attribute.Name))
{
_groupFields.Add(attribute.Name, new List<FieldInfo>());
}
}
}
}
示例2: NavigateToView
public static void NavigateToView(ViewBase view)
{
if (view == null) return;
CurrentFocusType = view.GetType();
var scenViewWindow = EditorWindow.GetWindow<SceneView>();
var sceneView= SceneView.lastActiveSceneView ?? scenViewWindow;
scenViewWindow.Show(true);
Selection.activeGameObject = view.gameObject;
//var localScale = (view.transform.localScale*2f);
sceneView.pivot = view.transform.position;// - new Vector3(localScale.x,2f,localScale.z);
sceneView.LookAt(view.transform.position,Quaternion.Euler(0f,0f,0f));
//sceneView.AlignViewToObject(view.transform);
CurrentView = view;
}