示例#1
0
        protected override Type PullState()
        {
            Type type;

            type_property.TryGetContentValues <Type>(out type);
            return(type);
        }
示例#2
0
        protected override bool GetIsOpenInternal()
        {
            bool is_open;

            edit_property_value.TryGetContentValues <bool>(out is_open);
            return(is_open);
        }
示例#3
0
        protected override LabeledSpritePoint DrawValueInternal(Rect rect, LabeledSpritePoint value)
        {
            string  label    = value.GetLabel();
            Vector2 position = value.GetPosition();

            EditProperty_Single_Value sprite_property = GetProperty().GetTarget().ForcePropertyValue("target_asset");

            Rect label_rect;
            Rect position_rect;

            rect.SplitByXLeftPercent(0.4f, out rect, out position_rect);
            rect.SplitByYBottomOffset(LINE_HEIGHT, out label_rect, out rect);

            label = EditorGUIExtensions.TextField(label_rect, label);

            if (sprite_property != null)
            {
                Sprite sprite;

                if (sprite_property.TryGetContentValues <Sprite>(out sprite))
                {
                    position_rect = GUIExtensions.DrawSprite(position_rect, sprite);

                    position = EditorGUIExtensions.XYControl(
                        position_rect,
                        position,
                        new FloatRange(0.0f, 1.0f),
                        new FloatRange(0.0f, 1.0f)
                        );
                }
            }

            return(new LabeledSpritePoint(label, position));
        }
示例#4
0
        public override IEnumerable <Type> GetOptions()
        {
            Type type;

            if (type_property.TryGetContentValues(out type))
            {
                return(type.GetTypeAndAllBaseTypes());
            }

            return(Empty.IEnumerable <Type>());
        }
示例#5
0
        public override IEnumerable <Type> GetOptions()
        {
            GameObject game_object;

            if (game_object_property.TryGetContentValues(out game_object))
            {
                return(game_object.GetAllComponents().Convert(c => c.GetType()).Unique());
            }

            return(Empty.IEnumerable <Type>());
        }
示例#6
0
        public override IEnumerable <MethodInfo> GetOptions(string text)
        {
            Type type;

            if (type_property.TryGetContentValues <Type>(out type))
            {
                return(type.GetFilteredInstanceMethods(
                           Filterer_MethodInfo.DoesNameContain(text)
                           ).Convert <MethodInfoEX, MethodInfo>());
            }

            return(Empty.IEnumerable <MethodInfo>());
        }
示例#7
0
        protected override void DrawElementInternal(int draw_id, Rect view)
        {
            T old_value;

            if (property.TryGetContentValues <T>(out old_value, true))
            {
                DrawUnifiedElementInternal(GetElementRect(), old_value);
            }
            else
            {
                EditorGUI.LabelField(GetElementRect(), "(Non-Unified Value)");
            }
        }
示例#8
0
        protected override EditorGUIElement PushState()
        {
            CustomAsset asset;
            EditProperty_Single_Value property = GetProperty();

            Type field_type = property.GetPropertyType();

            EditorGUIElement_Container_Auto      container      = new EditorGUIElement_Container_Auto_Simple_VerticalStrip();
            EditorGUIElement_Container_Flow_Line type_container = container.AddChild(new EditorGUIElement_Container_Flow_Line());

            if (property.TryGetContentValues <CustomAsset>(out asset, true))
            {
                switch (asset.GetAssetType())
                {
                case AssetType.None:
                case AssetType.External:
                    type_container.AddWeightedChild(1.0f,
                                                    new EditorGUIElement_EditPropertySingleValue_Selector_Asset(property, false)
                                                    );
                    break;

                case AssetType.Internal:
                    type_container.AddWeightedChild(1.0f,
                                                    new EditorGUIElement_Popup_ProcessOperation <Type>(
                                                        GetInternalCustomAssetTypes(field_type),
                                                        t => property.SetContentValues(CustomAssets.CreateInternalCustomAsset(t)),
                                                        (out Type t) => property.TryGetContentsType(out t)
                                                        )
                                                    );
                    break;
                }

                type_container.AddFixedChild(64.0f, new EditorGUIElement_Process(delegate(Rect rect) {
                    AssetType new_type = EditorGUIExtensions.EnumPopup(rect, asset.GetAssetType());

                    if (asset.GetAssetType() != new_type)
                    {
                        switch (new_type)
                        {
                        case AssetType.None:
                            property.SetContentValues(null);
                            break;

                        case AssetType.External:
                            property.SetContentValues(
                                CustomAssets.GetExternalCustomAssetsOfType(field_type)
                                .GetFirst()
                                );
                            break;

                        case AssetType.Internal:
                            property.SetContentValues(
                                CustomAssets.CreateInternalCustomAsset(
                                    GetInternalCustomAssetTypes(field_type)
                                    .GetFirst()
                                    )
                                );
                            break;
                        }
                    }
                }));

                if (asset != null && asset.IsInternalAsset())
                {
                    container.AddChild(new EditorGUIElement_Complex_EditTarget(new EditTarget(asset)));
                }
            }

            return(container);
        }