public DecalPlacerWindow(IPrototypeManager prototypeManager) { RobustXamlLoader.Load(this); _prototypeManager = prototypeManager; _decalPlacementSystem = EntitySystem.Get <DecalPlacementSystem>(); // This needs to be done in C# so we can have custom stuff passed in the constructor // and thus have a proper step size RotationSpinBox = new FloatSpinBox(90.0f, 0) { HorizontalExpand = true }; SpinBoxContainer.AddChild(RotationSpinBox); Search.OnTextChanged += _ => RefreshList(); ColorPicker.OnColorPicked += color => { _color = color; UpdateDecalPlacementInfo(); RefreshList(); }; RotationSpinBox.OnValueChanged += args => { _rotation = args.Value; UpdateDecalPlacementInfo(); }; EnableColor.OnToggled += args => { _useColor = args.Pressed; UpdateDecalPlacementInfo(); RefreshList(); }; EnableSnap.OnToggled += args => { _snap = args.Pressed; UpdateDecalPlacementInfo(); }; EnableCleanable.OnToggled += args => { _cleanable = args.Pressed; UpdateDecalPlacementInfo(); }; // i have to make this a member method for some reason and i have no idea why its only for spinboxes ZIndexSpinBox.ValueChanged += ZIndexSpinboxChanged; Populate(); }
public DecalPlacerWindow(IPrototypeManager prototypeManager) { RobustXamlLoader.Load(this); _prototypeManager = prototypeManager; _decalPlacementSystem = EntitySystem.Get <DecalPlacementSystem>(); // This needs to be done in C# so we can have custom stuff passed in the constructor // and thus have a proper step size RotationSpinBox = new FloatSpinBox(90.0f, 0) { HorizontalExpand = true }; SpinBoxContainer.AddChild(RotationSpinBox); Search.OnTextChanged += _ => RefreshList(); ColorPicker.OnColorChanged += OnColorPicked; PickerOpen.OnPressed += _ => { if (_picker is null) { _picker = new PaletteColorPicker(); _picker.OpenToLeft(); _picker.PaletteList.OnItemSelected += args => { var color = (args.ItemList.GetSelected().First().Metadata as Color?) !.Value; ColorPicker.Color = color; OnColorPicked(color); }; } else { if (_picker.IsOpen) { _picker.Close(); } else { _picker.Open(); } } }; RotationSpinBox.OnValueChanged += args => { _rotation = args.Value; UpdateDecalPlacementInfo(); }; EnableColor.OnToggled += args => { _useColor = args.Pressed; UpdateDecalPlacementInfo(); RefreshList(); }; EnableSnap.OnToggled += args => { _snap = args.Pressed; UpdateDecalPlacementInfo(); }; EnableCleanable.OnToggled += args => { _cleanable = args.Pressed; UpdateDecalPlacementInfo(); }; // i have to make this a member method for some reason and i have no idea why its only for spinboxes ZIndexSpinBox.ValueChanged += ZIndexSpinboxChanged; Populate(); }