Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public static void SetupEditableColorWidget(Widget parent, Session.Slot s, Session.Client c, OrderManager orderManager, WorldRenderer worldRenderer, ColorPickerManagerInfo colorManager)
        {
            var color = parent.Get <DropDownButtonWidget>("COLOR");

            color.IsDisabled  = () => (s != null && s.LockColor) || orderManager.LocalClient.IsReady;
            color.OnMouseDown = _ => ShowColorDropDown(color, c, orderManager, worldRenderer, colorManager);

            SetupColorWidget(color, c);
        }
Ejemplo n.º 3
0
        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);
        }