Beispiel #1
0
        private void updateFields()
        {
            configFieldsLayout.ClearWidgets();
            if (effect == null)
            {
                return;
            }

            foreach (var field in effect.Config.SortedFields)
            {
                configFieldsLayout.Add(new LinearLayout(Manager)
                {
                    AnchorFrom = BoxAlignment.Centre,
                    AnchorTo   = BoxAlignment.Centre,
                    Horizontal = true,
                    Fill       = true,
                    Children   = new Widget[]
                    {
                        new Label(Manager)
                        {
                            StyleName  = "listItem",
                            Text       = field.DisplayName,
                            AnchorFrom = BoxAlignment.TopLeft,
                            AnchorTo   = BoxAlignment.TopLeft,
                        },
                        buildFieldEditor(field),
                    }
                });
            }
        }
Beispiel #2
0
        private void refreshLayers()
        {
            layersLayout.ClearWidgets();
            foreach (var osbLayer in Project.OsbLayers)
            {
                Label osbLayerLabel;
                layersLayout.Add(osbLayerLabel = new Label(Manager)
                {
                    StyleName = "listHeader",
                    Text      = osbLayer.ToString(),
                });

                var ol = osbLayer;
                osbLayerLabel.HandleDrop = data =>
                {
                    if (data is EditorStoryboardLayer droppedLayer)
                    {
                        var dndLayer = layerManager.Layers.FirstOrDefault(l => l.Guid == droppedLayer.Guid);
                        if (dndLayer != null)
                        {
                            layerManager.MoveToOsbLayer(dndLayer, ol);
                        }
                        return(true);
                    }
                    return(false);
                };

                buildLayers(osbLayer, true);
                buildLayers(osbLayer, false);
            }
        }
Beispiel #3
0
 private void refreshEffects()
 {
     effectsLayout.ClearWidgets();
     foreach (var effect in project.Effects.OrderBy(e => e.Name))
     {
         effectsLayout.Add(createEffectWidget(effect));
     }
 }
Beispiel #4
0
        private void refreshLayers()
        {
            layersLayout.ClearWidgets();
            foreach (var osbLayer in Project.OsbLayers)
            {
                layersLayout.Add(new Label(Manager)
                {
                    StyleName = "listHeader",
                    Text      = osbLayer.ToString(),
                });

                buildLayers(osbLayer, true);
                buildLayers(osbLayer, false);
            }
        }
Beispiel #5
0
        private void refreshAssemblies()
        {
            assembliesLayout.ClearWidgets();
            foreach (var assembly in selectedAssemblies.OrderBy(id => isSystemAssembly(id) ? $"_{id}" : getAssemblyName(id)))
            {
                Widget assemblyRoot;
                Label  nameLabel;
                Button statusButton, editButton, removeButton;

                assembliesLayout.Add(assemblyRoot = new LinearLayout(WidgetManager)
                {
                    AnchorFrom  = BoxAlignment.Centre,
                    AnchorTo    = BoxAlignment.Centre,
                    Horizontal  = true,
                    FitChildren = true,
                    Fill        = true,
                    Children    = new Widget[]
                    {
                        new LinearLayout(WidgetManager)
                        {
                            StyleName = "condensed",
                            Children  = new Widget[]
                            {
                                nameLabel = new Label(WidgetManager)
                                {
                                    StyleName  = "listItem",
                                    Text       = getAssemblyName(assembly),
                                    AnchorFrom = BoxAlignment.Left,
                                    AnchorTo   = BoxAlignment.Left,
                                },
                            },
                        },
                        statusButton = new Button(WidgetManager)
                        {
                            StyleName  = "icon",
                            AnchorFrom = BoxAlignment.Centre,
                            AnchorTo   = BoxAlignment.Centre,
                            CanGrow    = false,
                            Displayed  = false,
                        },
                        editButton = new Button(WidgetManager)
                        {
                            StyleName  = "icon",
                            Icon       = IconFont.PencilSquare,
                            Tooltip    = "Change file",
                            AnchorFrom = BoxAlignment.Centre,
                            AnchorTo   = BoxAlignment.Centre,
                            CanGrow    = false,
                        },
                        removeButton = new Button(WidgetManager)
                        {
                            StyleName  = "icon",
                            Icon       = IconFont.Times,
                            Tooltip    = "Remove",
                            AnchorFrom = BoxAlignment.Centre,
                            AnchorTo   = BoxAlignment.Centre,
                            CanGrow    = false,
                        },
                    }
                });

                var ass = assembly;

                editButton.OnClick   += (sender, e) => changeReferencedAssembly(ass);
                removeButton.OnClick += (sender, e) => WidgetManager.ScreenLayerManager.ShowMessage($"Remove {getAssemblyName(ass)}?", () => removeReferencedAssembly(ass), true);
            }
        }
Beispiel #6
0
        private void refreshEffects()
        {
            effectsLayout.ClearWidgets();
            foreach (var effect in project.Effects.OrderBy(e => e.Name))
            {
                Widget effectRoot;
                Label  nameLabel, detailsLabel;
                Button renameButton, statusButton, configButton, editButton, removeButton;
                effectsLayout.Add(effectRoot = new LinearLayout(Manager)
                {
                    AnchorFrom  = BoxAlignment.Centre,
                    AnchorTo    = BoxAlignment.Centre,
                    Horizontal  = true,
                    FitChildren = true,
                    Fill        = true,
                    Children    = new Widget[]
                    {
                        renameButton = new Button(Manager)
                        {
                            StyleName  = "icon",
                            Icon       = IconFont.Pencil,
                            Tooltip    = "Rename",
                            AnchorFrom = BoxAlignment.Centre,
                            AnchorTo   = BoxAlignment.Centre,
                            CanGrow    = false,
                        },
                        new LinearLayout(Manager)
                        {
                            StyleName = "condensed",
                            Children  = new Widget[]
                            {
                                nameLabel = new Label(Manager)
                                {
                                    StyleName  = "listItem",
                                    Text       = effect.Name,
                                    AnchorFrom = BoxAlignment.Left,
                                    AnchorTo   = BoxAlignment.Left,
                                },
                                detailsLabel = new Label(Manager)
                                {
                                    StyleName  = "listItemSecondary",
                                    Text       = getEffectDetails(effect),
                                    AnchorFrom = BoxAlignment.Left,
                                    AnchorTo   = BoxAlignment.Left,
                                },
                            },
                        },
                        statusButton = new Button(Manager)
                        {
                            StyleName  = "icon",
                            AnchorFrom = BoxAlignment.Centre,
                            AnchorTo   = BoxAlignment.Centre,
                            CanGrow    = false,
                            Displayed  = false,
                        },
                        configButton = new Button(Manager)
                        {
                            StyleName  = "icon",
                            Icon       = IconFont.Gear,
                            Tooltip    = "Configure",
                            AnchorFrom = BoxAlignment.Centre,
                            AnchorTo   = BoxAlignment.Centre,
                            CanGrow    = false,
                        },
                        editButton = new Button(Manager)
                        {
                            StyleName  = "icon",
                            Icon       = IconFont.PencilSquare,
                            Tooltip    = "Edit script",
                            AnchorFrom = BoxAlignment.Centre,
                            AnchorTo   = BoxAlignment.Centre,
                            CanGrow    = false,
                            Disabled   = effect.Path == null,
                        },
                        removeButton = new Button(Manager)
                        {
                            StyleName  = "icon",
                            Icon       = IconFont.Times,
                            Tooltip    = "Remove",
                            AnchorFrom = BoxAlignment.Centre,
                            AnchorTo   = BoxAlignment.Centre,
                            CanGrow    = false,
                        },
                    },
                });

                updateStatusButton(statusButton, effect);

                var ef = effect;

                EventHandler changedHandler;
                effect.OnChanged += changedHandler = (sender, e) =>
                {
                    nameLabel.Text    = ef.Name;
                    detailsLabel.Text = getEffectDetails(ef);
                    updateStatusButton(statusButton, ef);
                };
                effectRoot.OnHovered += (sender, e) =>
                {
                    ef.Highlight = e.Hovered;
                    OnEffectPreselect?.Invoke(e.Hovered ? ef : null);
                };
                effectRoot.OnClickDown += (sender, e) =>
                {
                    OnEffectSelected?.Invoke(ef);
                    return(true);
                };
                effectRoot.OnDisposed += (sender, e) =>
                {
                    ef.Highlight  = false;
                    ef.OnChanged -= changedHandler;
                };

                statusButton.OnClick += (sender, e) => Manager.ScreenLayerManager.ShowMessage($"Status: {ef.Status}\n\n{ef.StatusMessage}");
                renameButton.OnClick += (sender, e) => Manager.ScreenLayerManager.ShowPrompt("Effect name", $"Pick a new name for {ef.Name}", ef.Name, (newName) =>
                {
                    ef.Name = newName;
                    refreshEffects();
                });
                editButton.OnClick   += (sender, e) => openEffectEditor(ef);
                configButton.OnClick += (sender, e) =>
                {
                    if (!effectConfigUi.Displayed || effectConfigUi.Effect != ef)
                    {
                        effectConfigUi.Effect    = ef;
                        effectConfigUi.Displayed = true;
                    }
                    else
                    {
                        effectConfigUi.Displayed = false;
                    }
                };
                removeButton.OnClick += (sender, e) => Manager.ScreenLayerManager.ShowMessage($"Remove {ef.Name}?", () => project.Remove(ef), true);
            }
        }