public static void ShowColorDropDown(DropDownButtonWidget color, Session.Client client, OrderManager orderManager, World world, ColorPreviewManagerWidget preview) { Action onExit = () => { if (client.Bot == null) { Game.Settings.Player.Color = preview.Color; Game.Settings.Save(); } color.RemovePanel(); orderManager.IssueOrder(Order.Command("color {0} {1}".F(client.Index, preview.Color))); }; Action <Color> onChange = c => preview.Color = c; var colorChooser = Game.LoadWidget(world, "COLOR_CHOOSER", null, new WidgetArgs() { { "onChange", onChange }, { "initialColor", client.Color }, { "initialFaction", client.Faction } }); color.AttachPanel(colorChooser, onExit); }
public static void ShowColorDropDown(DropDownButtonWidget color, Session.Client client, OrderManager orderManager, ColorPickerPaletteModifier preview) { Action <ColorRamp> onSelect = c => { if (client.Bot == null) { Game.Settings.Player.ColorRamp = c; Game.Settings.Save(); } color.RemovePanel(); orderManager.IssueOrder(Order.Command("color {0} {1}".F(client.Index, c))); }; Action <ColorRamp> onChange = c => preview.Ramp = c; var colorChooser = Game.LoadWidget(orderManager.world, "COLOR_CHOOSER", null, new WidgetArgs() { { "onSelect", onSelect }, { "onChange", onChange }, { "initialRamp", client.ColorRamp } }); color.AttachPanel(colorChooser); }
void ShowLightDiffuseColorDropDown(DropDownButtonWidget color, ColorPreviewManagerWidget preview, World world) { Action onExit = () => { Color c = preview.Color; lightDiffuseColor[0] = float.Parse((Convert.ToSingle(c.R) / 255).ToString("0.0")); lightDiffuseColor[1] = float.Parse((Convert.ToSingle(c.G) / 255).ToString("0.0")); lightDiffuseColor[2] = float.Parse((Convert.ToSingle(c.B) / 255).ToString("0.0")); lightDiffuseColorBlock.GetColor = () => c; lightDiffuseColorValue.GetText = () => string.Format("{0}, {1}, {2}", lightDiffuseColor[0].ToString(), lightDiffuseColor[1].ToString(), lightDiffuseColor[2].ToString()); }; color.RemovePanel(); Action <Color> onChange = c => preview.Color = c; var colorChooser = Game.LoadWidget(world, "COLOR_CHOOSER", null, new WidgetArgs() { { "onChange", onChange }, { "initialColor", Color.FromArgb( Convert.ToInt32(lightDiffuseColor[0] * 255), Convert.ToInt32(lightDiffuseColor[1] * 255), Convert.ToInt32(lightDiffuseColor[2] * 255) ) }, { "initialFaction", null } }); color.AttachPanel(colorChooser, onExit); }
public static void ShowColorDropDown(DropDownButtonWidget color, ColorPickerManagerInfo colorManager, WorldRenderer worldRenderer, Action onExit = null) { color.RemovePanel(); var colorChooser = Game.LoadWidget(worldRenderer.World, "COLOR_CHOOSER", null, new WidgetArgs() { { "onChange", (Action <Color>)(c => colorManager.Color = c) }, { "initialColor", colorManager.Color }, { "initialFaction", null } }); color.AttachPanel(colorChooser, onExit); }
bool ShowColorPicker(DropDownButtonWidget color, PlayerSettings s) { Action <ColorRamp> onSelect = c => { s.ColorRamp = c; color.RemovePanel(); }; Action <ColorRamp> onChange = c => { playerPalettePreview.Ramp = c; }; var colorChooser = Game.LoadWidget(world, "COLOR_CHOOSER", null, new WidgetArgs() { { "onSelect", onSelect }, { "onChange", onChange }, { "initialRamp", s.ColorRamp } }); color.AttachPanel(colorChooser); return(true); }
bool ShowColorPicker(DropDownButtonWidget color, PlayerSettings s) { Action <HSLColor> onChange = c => colorPreview.Color = c; Action onExit = () => { s.Color = colorPreview.Color; color.RemovePanel(); }; var colorChooser = Game.LoadWidget(world, "COLOR_CHOOSER", null, new WidgetArgs() { { "onExit", onExit }, { "onChange", onChange }, { "initialColor", s.Color } }); color.AttachPanel(colorChooser, onExit); return(true); }
public static void ShowColorDropDown(DropDownButtonWidget color, ColorPreviewManagerWidget preview, World world) { Action onExit = () => { Game.Settings.Player.Color = preview.Color; Game.Settings.Save(); }; color.RemovePanel(); Action <HSLColor> onChange = c => preview.Color = c; var colorChooser = Game.LoadWidget(world, "COLOR_CHOOSER", null, new WidgetArgs() { { "onChange", onChange }, { "initialColor", Game.Settings.Player.Color } }); color.AttachPanel(colorChooser, onExit); }
public static void ShowColorDropDown(DropDownButtonWidget color, ColorPreviewManagerWidget preview, World world) { Action onExit = () => { Game.Settings.Player.Color = preview.Color; Game.Settings.Save(); }; color.RemovePanel(); Action<HSLColor> onChange = c => preview.Color = c; var colorChooser = Game.LoadWidget(world, "COLOR_CHOOSER", null, new WidgetArgs() { { "onChange", onChange }, { "initialColor", Game.Settings.Player.Color } }); color.AttachPanel(colorChooser, onExit); }
public static void ShowColorDropDown(DropDownButtonWidget color, Session.Client client, OrderManager orderManager, WorldRenderer worldRenderer, ColorPickerManagerInfo colorManager) { Action onExit = () => { if (client == orderManager.LocalClient) { Game.Settings.Player.Color = colorManager.Color; Game.Settings.Save(); } color.RemovePanel(); orderManager.IssueOrder(Order.Command($"color {client.Index} {colorManager.Color}")); }; var colorChooser = Game.LoadWidget(worldRenderer.World, "COLOR_CHOOSER", null, new WidgetArgs() { { "onChange", (Action <Color>)(c => colorManager.Color = c) }, { "initialColor", client.Color }, { "initialFaction", client.Faction } }); color.AttachPanel(colorChooser, onExit); }
void ShowColorDropDown(DropDownButtonWidget color, Session.Client client) { var colorChooser = Game.modData.WidgetLoader.LoadWidget( new WidgetArgs() { {"worldRenderer", worldRenderer} }, null, "COLOR_CHOOSER" ); var hueSlider = colorChooser.GetWidget<SliderWidget>("HUE_SLIDER"); hueSlider.Value = orderManager.LocalClient.ColorRamp.H / 255f; var satSlider = colorChooser.GetWidget<SliderWidget>("SAT_SLIDER"); satSlider.Value = orderManager.LocalClient.ColorRamp.S / 255f; var lumSlider = colorChooser.GetWidget<SliderWidget>("LUM_SLIDER"); lumSlider.Value = orderManager.LocalClient.ColorRamp.L / 255f; var rangeSlider = colorChooser.GetWidget<SliderWidget>("RANGE_SLIDER"); rangeSlider.Value = orderManager.LocalClient.ColorRamp.R / 255f; Action updateColorPreview = () => UpdateColorPreview(hueSlider.Value, satSlider.Value, lumSlider.Value, rangeSlider.Value); hueSlider.OnChange += _ => updateColorPreview(); satSlider.OnChange += _ => updateColorPreview(); lumSlider.OnChange += _ => updateColorPreview(); rangeSlider.OnChange += _ => updateColorPreview(); updateColorPreview(); colorChooser.GetWidget<ButtonWidget>("BUTTON_OK").OnClick = () => { updateColorPreview(); UpdatePlayerColor(hueSlider.Value, satSlider.Value, lumSlider.Value, rangeSlider.Value); color.RemovePanel(); }; color.AttachPanel(colorChooser); }
public static void ShowColorDropDown(DropDownButtonWidget color, Session.Client client, OrderManager orderManager, World world, ColorPreviewManagerWidget preview) { Action onExit = () => { if (client.Bot == null) { Game.Settings.Player.Color = preview.Color; Game.Settings.Save(); } color.RemovePanel(); orderManager.IssueOrder(Order.Command("color {0} {1}".F(client.Index, preview.Color))); }; Action<HSLColor> onChange = c => preview.Color = c; var colorChooser = Game.LoadWidget(world, "COLOR_CHOOSER", null, new WidgetArgs() { { "onChange", onChange }, { "initialColor", client.Color } }); color.AttachPanel(colorChooser, onExit); }
public static void ShowColorDropDown(DropDownButtonWidget color, Session.Client client, OrderManager orderManager, ColorPickerPaletteModifier preview) { Action<ColorRamp> onSelect = c => { if (client.Bot == null) { Game.Settings.Player.ColorRamp = c; Game.Settings.Save(); } color.RemovePanel(); orderManager.IssueOrder(Order.Command("color {0} {1}".F(client.Index, c))); }; Action<ColorRamp> onChange = c => preview.Ramp = c; var colorChooser = Game.LoadWidget(orderManager.world, "COLOR_CHOOSER", null, new WidgetArgs() { { "onSelect", onSelect }, { "onChange", onChange }, { "initialRamp", client.ColorRamp } }); color.AttachPanel(colorChooser); }
bool ShowColorPicker(DropDownButtonWidget color, PlayerSettings s) { Action<HSLColor> onChange = c => colorPreview.Color = c; Action onExit = () => { s.Color = colorPreview.Color; color.RemovePanel(); }; var colorChooser = Game.LoadWidget(world, "COLOR_CHOOSER", null, new WidgetArgs() { { "onExit", onExit }, { "onChange", onChange }, { "initialColor", s.Color } }); color.AttachPanel(colorChooser, onExit); return true; }
bool ShowColorPicker(DropDownButtonWidget color, PlayerSettings s) { Action<ColorRamp> onSelect = c => { s.ColorRamp = c; color.RemovePanel(); }; Action<ColorRamp> onChange = c => { playerPalettePreview.Ramp = c; }; var colorChooser = Game.LoadWidget(world, "COLOR_CHOOSER", null, new WidgetArgs() { { "onSelect", onSelect }, { "onChange", onChange }, { "initialRamp", s.ColorRamp } }); color.AttachPanel(colorChooser); return true; }
void OpenNewsPanel(DropDownButtonWidget button) { newsOpen = true; button.AttachPanel(newsPanel, () => newsOpen = false); }