コード例 #1
0
        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;
        }
コード例 #2
0
ファイル: CncSettingsLogic.cs プロジェクト: JamesDunne/OpenRA
        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;
        }