Beispiel #1
0
        protected override GlyssenColors GetDefaultPaletteColor(ColorProperties colorProperty)
        {
            switch (colorProperty)
            {
            case ColorProperties.ForeColor:
            case ColorProperties.BorderColor:
                return(GlyssenColors.ForeColor);

            case ColorProperties.BackColor: return(GlyssenColors.BackColor);

            case ColorProperties.MouseDownBackColor: return(GlyssenColors.MouseDownBackColor);

            case ColorProperties.MouseOverBackColor: return(GlyssenColors.MouseOverBackColor);

            case ColorProperties.LinkColor: return(GlyssenColors.LinkColor);

            case ColorProperties.ActiveLinkColor: return(GlyssenColors.ActiveLinkColor);

            case ColorProperties.DisabledLinkColor: return(GlyssenColors.DisabledLinkColor);

            case ColorProperties.VisitedLinkColor: return(GlyssenColors.VisitedLinkColor);

            default: return(base.GetDefaultPaletteColor(colorProperty));
            }
        }
Beispiel #2
0
 public ScriptStyle(string name, Color fore, Color back, Font font)
 {
     Name            = name;
     ForegroundColor = ColorSerializetionHelper.Serialize(fore);
     BackgroundColor = ColorSerializetionHelper.Serialize(back);
     FontProperties  = FontSerializetionHelper.Serialize(font);
 }
Beispiel #3
0
 public ImageProperties()
 {
     KeepSize = true;
     Colors   = new ColorProperties {
         Brightness = 0, Contrast = 0, Saturation = 0, Hue = 0
     };
     _crop = new ResizeProperties();
 }
            protected override void OnSceneLoad(SceneOperationKind operation, ReadOnlyDictionary <int, ObjectCtrlInfo> loadedItems)
            {
                var data = GetExtendedData();

                if (operation == SceneOperationKind.Clear || operation == SceneOperationKind.Load)
                {
                    RendererPropertyList.Clear();
                    MaterialFloatPropertyList.Clear();
                    MaterialColorPropertyList.Clear();
                    MaterialTexturePropertyList.Clear();
                    TextureDictionary.Clear();
                }

                if (data == null)
                {
                    return;
                }

                var importDictionary = new Dictionary <int, int>();

                if (operation == SceneOperationKind.Load)
                {
                    if (data.data.TryGetValue(nameof(TextureDictionary), out var texDic) && texDic != null)
                    {
                        TextureDictionary = MessagePackSerializer.Deserialize <Dictionary <int, byte[]> >((byte[])texDic);
                    }
                }
                else if (operation == SceneOperationKind.Import)
                {
                    if (data.data.TryGetValue(nameof(TextureDictionary), out var texDic) && texDic != null)
                    {
                        Dictionary <int, byte[]> importTextureDictionary = MessagePackSerializer.Deserialize <Dictionary <int, byte[]> >((byte[])texDic);

                        foreach (var x in importTextureDictionary)
                        {
                            importDictionary[x.Key] = SetAndGetTextureID(x.Value);
                        }
                    }
                }
                else if (operation == SceneOperationKind.Clear)
                {
                    return;
                }

                if (data.data.TryGetValue(nameof(RendererPropertyList), out var rendererProperties) && rendererProperties != null)
                {
                    var loadedRendererProperties = MessagePackSerializer.Deserialize <List <RendererProperty> >((byte[])rendererProperties);

                    foreach (var loadedRendererProperty in loadedRendererProperties)
                    {
                        if (loadedItems.TryGetValue(loadedRendererProperty.ID, out ObjectCtrlInfo objectCtrlInfo) && objectCtrlInfo is OCIItem ociItem)
                        {
                            foreach (var renderer in ociItem.objectItem.GetComponentsInChildren <Renderer>())
                            {
                                if (renderer.NameFormatted() == loadedRendererProperty.RendererName)
                                {
                                    RendererPropertyList.Add(new RendererProperty(GetObjectID(objectCtrlInfo), loadedRendererProperty.RendererName, loadedRendererProperty.Property, loadedRendererProperty.Value, loadedRendererProperty.ValueOriginal));
                                    SetRendererProperty(renderer, loadedRendererProperty.Property, int.Parse(loadedRendererProperty.Value));
                                }
                            }
                        }
                    }
                }

                if (data.data.TryGetValue(nameof(MaterialFloatPropertyList), out var materialFloatProperties) && materialFloatProperties != null)
                {
                    var loadedMaterialFloatProperties = MessagePackSerializer.Deserialize <List <MaterialFloatProperty> >((byte[])materialFloatProperties);

                    foreach (var loadedMaterialFloatProperty in loadedMaterialFloatProperties)
                    {
                        if (loadedItems.TryGetValue(loadedMaterialFloatProperty.ID, out ObjectCtrlInfo objectCtrlInfo) && objectCtrlInfo is OCIItem ociItem)
                        {
                            foreach (var rend in ociItem.objectItem.GetComponentsInChildren <Renderer>())
                            {
                                foreach (var mat in rend.materials)
                                {
                                    if (mat.NameFormatted() == loadedMaterialFloatProperty.MaterialName && mat.HasProperty($"_{loadedMaterialFloatProperty.Property}") && FloatProperties.Contains(loadedMaterialFloatProperty.Property))
                                    {
                                        var valueOriginal = mat.GetFloat($"_{loadedMaterialFloatProperty.Property}").ToString();
                                        MaterialFloatPropertyList.Add(new MaterialFloatProperty(GetObjectID(objectCtrlInfo), loadedMaterialFloatProperty.MaterialName, loadedMaterialFloatProperty.Property, loadedMaterialFloatProperty.Value, valueOriginal));
                                        SetFloatProperty(ociItem.objectItem, mat, loadedMaterialFloatProperty.Property, loadedMaterialFloatProperty.Value, ObjectType.StudioItem);
                                    }
                                }
                            }
                        }
                    }
                }

                if (data.data.TryGetValue(nameof(MaterialColorPropertyList), out var materialColorProperties) && materialColorProperties != null)
                {
                    var loadedMaterialColorProperties = MessagePackSerializer.Deserialize <List <MaterialColorProperty> >((byte[])materialColorProperties);

                    foreach (var loadedMaterialColorProperty in loadedMaterialColorProperties)
                    {
                        if (loadedItems.TryGetValue(loadedMaterialColorProperty.ID, out ObjectCtrlInfo objectCtrlInfo) && objectCtrlInfo is OCIItem ociItem)
                        {
                            foreach (var rend in ociItem.objectItem.GetComponentsInChildren <Renderer>())
                            {
                                foreach (var mat in rend.materials)
                                {
                                    if (mat.NameFormatted() == loadedMaterialColorProperty.MaterialName && mat.HasProperty($"_{loadedMaterialColorProperty.Property}") && ColorProperties.Contains(loadedMaterialColorProperty.Property))
                                    {
                                        var valueOriginal = mat.GetColor($"_{loadedMaterialColorProperty.Property}");
                                        MaterialColorPropertyList.Add(new MaterialColorProperty(GetObjectID(objectCtrlInfo), loadedMaterialColorProperty.MaterialName, loadedMaterialColorProperty.Property, loadedMaterialColorProperty.Value, valueOriginal));
                                        SetColorProperty(ociItem.objectItem, mat, loadedMaterialColorProperty.Property, loadedMaterialColorProperty.Value, ObjectType.StudioItem);
                                    }
                                }
                            }
                        }
                    }
                }

                if (data.data.TryGetValue(nameof(MaterialTexturePropertyList), out var materialTextureProperties) && materialTextureProperties != null)
                {
                    var loadedMaterialTextureProperties = MessagePackSerializer.Deserialize <List <MaterialTextureProperty> >((byte[])materialTextureProperties);

                    foreach (var loadedMaterialTextureProperty in loadedMaterialTextureProperties)
                    {
                        if (loadedItems.TryGetValue(loadedMaterialTextureProperty.ID, out ObjectCtrlInfo objectCtrlInfo) && objectCtrlInfo is OCIItem ociItem)
                        {
                            foreach (var rend in ociItem.objectItem.GetComponentsInChildren <Renderer>())
                            {
                                foreach (var mat in rend.materials)
                                {
                                    if (mat.NameFormatted() == loadedMaterialTextureProperty.MaterialName && mat.HasProperty($"_{loadedMaterialTextureProperty.Property}") && TextureProperties.Contains(loadedMaterialTextureProperty.Property))
                                    {
                                        int texID = operation == SceneOperationKind.Import ? importDictionary[loadedMaterialTextureProperty.TexID] : loadedMaterialTextureProperty.TexID;
                                        MaterialTextureProperty newTextureProperty = new MaterialTextureProperty(GetObjectID(objectCtrlInfo), loadedMaterialTextureProperty.MaterialName, loadedMaterialTextureProperty.Property, texID);
                                        MaterialTexturePropertyList.Add(newTextureProperty);
                                        SetTextureProperty(ociItem.objectItem, mat, newTextureProperty.Property, newTextureProperty.Texture, ObjectType.StudioItem);
                                    }
                                }
                            }
                        }
                    }
                }
            }
Beispiel #5
0
 public void SetNewColor(ColorProperties _newColor)
 {
     GameCircle.color = _newColor.color;
     myColor          = _newColor;
 }
Beispiel #6
0
            protected override void OnSceneLoad(SceneOperationKind operation, ReadOnlyDictionary <int, ObjectCtrlInfo> loadedItems)
            {
                var data = GetExtendedData();

                if (operation == SceneOperationKind.Clear || operation == SceneOperationKind.Load)
                {
                    StudioItemRendererPropertyList.Clear();
                    StudioItemMaterialFloatPropertyList.Clear();
                    StudioItemMaterialColorPropertyList.Clear();
                }

                if (data == null)
                {
                    return;
                }

                if (data.data.TryGetValue("RendererProperties", out var rendererProperties) && rendererProperties != null)
                {
                    var loadedRendererProperties = MessagePackSerializer.Deserialize <List <RendererProperty> >((byte[])rendererProperties);

                    foreach (var loadedRendererProperty in loadedRendererProperties)
                    {
                        if (loadedItems.TryGetValue(loadedRendererProperty.ID, out ObjectCtrlInfo objectCtrlInfo) && objectCtrlInfo is OCIItem ociItem)
                        {
                            foreach (var renderer in ociItem.objectItem.GetComponentsInChildren <Renderer>())
                            {
                                if (renderer.NameFormatted() == loadedRendererProperty.RendererName)
                                {
                                    StudioItemRendererPropertyList.Add(new RendererProperty(GetObjectID(objectCtrlInfo), loadedRendererProperty.RendererName, loadedRendererProperty.Property, loadedRendererProperty.Value, loadedRendererProperty.ValueOriginal));
                                    SetRendererProperty(renderer, loadedRendererProperty.Property, int.Parse(loadedRendererProperty.Value));
                                }
                            }
                        }
                    }
                }

                if (data.data.TryGetValue("MaterialFloatProperties", out var materialFloatProperties) && materialFloatProperties != null)
                {
                    var loadedMaterialFloatProperties = MessagePackSerializer.Deserialize <List <MaterialFloatProperty> >((byte[])materialFloatProperties);

                    foreach (var loadedMaterialFloatProperty in loadedMaterialFloatProperties)
                    {
                        if (loadedItems.TryGetValue(loadedMaterialFloatProperty.ID, out ObjectCtrlInfo objectCtrlInfo) && objectCtrlInfo is OCIItem ociItem)
                        {
                            foreach (var rend in ociItem.objectItem.GetComponentsInChildren <Renderer>())
                            {
                                foreach (var mat in rend.materials)
                                {
                                    if (mat.HasProperty($"_{loadedMaterialFloatProperty.Property}") && FloatProperties.Contains(loadedMaterialFloatProperty.Property))
                                    {
                                        var valueOriginal = mat.GetFloat($"_{loadedMaterialFloatProperty.Property}").ToString();
                                        StudioItemMaterialFloatPropertyList.Add(new MaterialFloatProperty(GetObjectID(objectCtrlInfo), loadedMaterialFloatProperty.MaterialName, loadedMaterialFloatProperty.Property, loadedMaterialFloatProperty.Value, valueOriginal));
                                        SetFloatProperty(ociItem.objectItem, mat, loadedMaterialFloatProperty.Property, loadedMaterialFloatProperty.Value);
                                    }
                                }
                            }
                        }
                    }
                }

                if (data.data.TryGetValue("MaterialColorProperties", out var materialColorProperties) && materialColorProperties != null)
                {
                    var loadedMaterialColorProperties = MessagePackSerializer.Deserialize <List <MaterialColorProperty> >((byte[])materialColorProperties);

                    foreach (var loadedMaterialColorProperty in loadedMaterialColorProperties)
                    {
                        if (loadedItems.TryGetValue(loadedMaterialColorProperty.ID, out ObjectCtrlInfo objectCtrlInfo) && objectCtrlInfo is OCIItem ociItem)
                        {
                            foreach (var rend in ociItem.objectItem.GetComponentsInChildren <Renderer>())
                            {
                                foreach (var mat in rend.materials)
                                {
                                    if (mat.HasProperty($"_{loadedMaterialColorProperty.Property}") && ColorProperties.Contains(loadedMaterialColorProperty.Property))
                                    {
                                        var valueOriginal = mat.GetColor($"_{loadedMaterialColorProperty.Property}");
                                        StudioItemMaterialColorPropertyList.Add(new MaterialColorProperty(GetObjectID(objectCtrlInfo), loadedMaterialColorProperty.MaterialName, loadedMaterialColorProperty.Property, loadedMaterialColorProperty.Value, valueOriginal));
                                        SetColorProperty(ociItem.objectItem, mat, loadedMaterialColorProperty.Property, loadedMaterialColorProperty.Value);
                                    }
                                }
                            }
                        }
                    }
                }
            }
 protected virtual TPaletteColors GetDefaultPaletteColor(ColorProperties colorProperty)
 {
     return(default(TPaletteColors));
 }
 public void SetNewColor(ColorProperties _newColor, ColorProperties _newColorText)
 {
     GameText.color = _newColor.color;
     GameText.text  = _newColorText.Name;
     myColor        = _newColorText;
 }
Beispiel #9
0
        private ControlProperties CreateProperties(PropertyType type, PropertyInfo info, ExposePropertyAttribute attribute)
        {
            ControlProperties control = null;

            switch (type)
            {
            case PropertyType.AnimationCurve:
                control = new AnimationCurveProperties(this, info, attribute);
                break;

            case PropertyType.Boolean:
                control = new BooleanProperties(this, info, attribute);
                break;

            case PropertyType.Bounds:
                control = new BoundsProperties(this, info, attribute);
                break;

            case PropertyType.Color:
                control = new ColorProperties(this, info, attribute);
                break;

            case PropertyType.Enum:
                control = new EnumProperties(this, info, attribute);
                break;

            case PropertyType.Float:
                control = new FloatProperties(this, info, attribute);
                break;

            case PropertyType.Integer:
                control = new IntegerProperties(this, info, attribute);
                break;

            case PropertyType.LayerMask:
                control = new LayerMaskProperties(this, info, attribute);
                break;

            case PropertyType.ObjectReference:
                control = new UnityObjectProperties(this, info, attribute);
                break;

            case PropertyType.Quaternion:
                control = new QuaternionProperties(this, info, attribute);
                break;

            case PropertyType.Rect:
                control = new RectProperties(this, info, attribute);
                break;

            case PropertyType.String:
                control = new StringProperties(this, info, attribute);
                break;

            case PropertyType.Vector2:
                control = new Vector2Properties(this, info, attribute);
                break;

            case PropertyType.Vector3:
                control = new Vector3Properties(this, info, attribute);
                break;

            case PropertyType.Vector4:
                control = new Vector4Properties(this, info, attribute);
                break;

            case PropertyType.SerializableObject:
                control = new SerializableObjectProperties(this, info, attribute);
                break;

            case PropertyType.Array:
                control = new ArrayProperties(this, info, attribute);
                break;
            }

            if (control != null)
            {
                var margin = control.Control.Margin;
                margin.Left           += 2;
                margin.Top            += 2;
                margin.Bottom         += 2;
                control.Control.Margin = margin;
            }
            return(control);
        }