Ejemplo n.º 1
0
    public static object DrawInternalVariableGUI(object obj, FieldInfo f)
    {
        bool isShow = true;

        foreach (Attribute a in f.GetCustomAttributes(true))
        {
            NoneShowInEditorGUIAttribute ns = a as NoneShowInEditorGUIAttribute;
            if (ns != null)
            {
                isShow = false;
                break;
            }
        }
        if (!isShow)
        {
            return(obj);
        }

        object value = EditorUseUtils.DrawObjectDataEditorDefultOneField(f.Name, f.GetValue(obj));

        f.SetValue(obj, value);
        return(obj);
    }
Ejemplo n.º 2
0
    SDKInterfaceBase SelectSDKInterfaceGUI(ref bool isFold, Type SDKType, SDKInterfaceBase sdk, string title)
    {
        isFold = EditorGUILayout.Foldout(isFold, title + ":");

        if (isFold)
        {
            EditorGUI.indentLevel++;
            EditorGUILayout.LabelField("接口类型:" + SDKType.Name);
            string[] mask = GetSDKNameList(SDKType);

            int currentIndex = GetNameListIndex(mask, sdk);
            int index        = EditorGUILayout.Popup("当前SDK:", currentIndex, mask);

            if (sdk == null || mask[index] != sdk.GetType().Name)
            {
                Type type = Assembly.Load("Assembly-CSharp").GetType(mask[index]);

                if (type != null)
                {
                    sdk = (SDKInterfaceBase)Activator.CreateInstance(type);
                }
                else
                {
                    Debug.LogError("Load " + mask[index] + " Fail!");
                }
            }

            //显示界面

            EditorUseUtils.DrawClassData(sdk);

            EditorGUI.indentLevel--;
            EditorGUILayout.Space();
        }

        return(sdk);
    }