public void Insert(BlueprintContainer blueprint) { if (blueprint.Data.BlueprintType.IsMothership) { AddMothership(blueprint); } else { AddUnit(blueprint); } }
public void Toggle(BlueprintContainer blueprint) { if (Fleet.Contains(blueprint)) { Remove(blueprint); } else { Insert(blueprint); } }
private void AddMothership(BlueprintContainer blueprint) { if (Fleet.mothership != null) { SetSelected(Fleet.mothership, false); } Fleet.mothership = blueprint; fleetChange.Invoke(); SetSelected(blueprint, true, mothershipContainer); }
private void AddUnit(BlueprintContainer blueprint) { if (Fleet.units.Count == Fleet.units.Capacity) { OnUnitsFull(animationArgs); return; } Fleet.units.Add(blueprint); UpdateUnitCountText(); fleetChange.Invoke(); SetSelected(blueprint, true, unitsContainer); }
public void Import(BlueprintContainer blueprintContainer, Action <BlueprintContainer> saveCallback) { this.container = blueprintContainer; this.saveCallback = saveCallback; this.gridValidator = new BlueprintGridValidator(); this.nameValidator = new BlueprintNameValidator(); var newBlueprint = blueprintContainer.Data.Clone(); editorGrid.Import(newBlueprint); ValidateName(newBlueprint.name); overlay.infoPanel.blueprintNameInput.SetValue(newBlueprint.name, false); }
public void Remove(BlueprintContainer blueprint) { if (blueprint.Data.BlueprintType.IsMothership) { Fleet.mothership = null; } else { Fleet.units.Remove(blueprint); UpdateUnitCountText(); } fleetChange.Invoke(); SetSelected(blueprint, false); }
private void SetSelected(BlueprintContainer blueprint, bool active, Transform container = null) { var view = viewFactory(blueprint); view.Selected = active; if (container != null) { view.transform.SetParent(container); view.ParentTab.ChildCount--; } else { view.transform.SetParent(view.ParentTab.container); view.ParentTab.ChildCount++; } view.hoverable.ForceExit(); }
private void load(IBindableBeatmap beatmap, IFrameBasedClock framedClock) { Beatmap.BindTo(beatmap); try { RulesetContainer = CreateRulesetContainer(); RulesetContainer.Clock = framedClock; } catch (Exception e) { Logger.Error(e, "Could not load beatmap sucessfully!"); return; } var layerBelowRuleset = CreateLayerContainer(); layerBelowRuleset.Child = new EditorPlayfieldBorder { RelativeSizeAxes = Axes.Both }; var layerAboveRuleset = CreateLayerContainer(); layerAboveRuleset.Child = blueprintContainer = new BlueprintContainer(); layerContainers.Add(layerBelowRuleset); layerContainers.Add(layerAboveRuleset); RadioButtonCollection toolboxCollection; InternalChild = new GridContainer { RelativeSizeAxes = Axes.Both, Content = new[] { new Drawable[] { new FillFlowContainer { Name = "Sidebar", RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Right = 10 }, Children = new Drawable[] { new ToolboxGroup { Child = toolboxCollection = new RadioButtonCollection { RelativeSizeAxes = Axes.X } } } }, new Container { Name = "Content", RelativeSizeAxes = Axes.Both, Children = new Drawable[] { layerBelowRuleset, RulesetContainer, layerAboveRuleset } } }, }, ColumnDimensions = new[] { new Dimension(GridSizeMode.Absolute, 200), } }; toolboxCollection.Items = CompositionTools.Select(t => new RadioButton(t.Name, () => blueprintContainer.CurrentTool = t)) .Prepend(new RadioButton("Select", () => blueprintContainer.CurrentTool = null)) .ToList(); toolboxCollection.Items[0].Select(); }
private void load(IFrameBasedClock framedClock) { try { drawableRulesetWrapper = new DrawableEditRulesetWrapper <TObject>(CreateDrawableRuleset(Ruleset, workingBeatmap, Array.Empty <Mod>())) { Clock = framedClock, ProcessCustomClock = false }; } catch (Exception e) { Logger.Error(e, "Could not load beatmap sucessfully!"); return; } var layerBelowRuleset = drawableRulesetWrapper.CreatePlayfieldAdjustmentContainer().WithChildren(new Drawable[] { distanceSnapGridContainer = new Container { RelativeSizeAxes = Axes.Both }, new EditorPlayfieldBorder { RelativeSizeAxes = Axes.Both } }); var layerAboveRuleset = drawableRulesetWrapper.CreatePlayfieldAdjustmentContainer().WithChild(blueprintContainer = new BlueprintContainer()); layerContainers.Add(layerBelowRuleset); layerContainers.Add(layerAboveRuleset); RadioButtonCollection toolboxCollection; InternalChild = new GridContainer { RelativeSizeAxes = Axes.Both, Content = new[] { new Drawable[] { new FillFlowContainer { Name = "Sidebar", RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Right = 10 }, Children = new Drawable[] { new ToolboxGroup { Child = toolboxCollection = new RadioButtonCollection { RelativeSizeAxes = Axes.X } } } }, new Container { Name = "Content", RelativeSizeAxes = Axes.Both, Children = new Drawable[] { layerBelowRuleset, drawableRulesetWrapper, layerAboveRuleset } } }, }, ColumnDimensions = new[] { new Dimension(GridSizeMode.Absolute, 200), } }; toolboxCollection.Items = CompositionTools.Select(t => new RadioButton(t.Name, () => selectTool(t))) .Prepend(new RadioButton("选择", () => selectTool(null))) .ToList(); toolboxCollection.Items[0].Select(); blueprintContainer.SelectionChanged += selectionChanged; }