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


C# ViewBase.GetType方法代码示例

本文整理汇总了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>());
                }
            }
        }
    }
开发者ID:wang-yichun,项目名称:AnimalStory,代码行数:52,代码来源:uFrameInspector.cs

示例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;
    }
开发者ID:wang-yichun,项目名称:AnimalStory,代码行数:15,代码来源:uFrameEditorSceneManager.cs


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