Beispiel #1
0
        private static void ResetConfigMenu()
        {
            EmergencyLighting els = (Vehicle.Exists()) ? Vehicle.EmergencyLighting : null;

            if (SirenConfigMenu?.ELS.Name != els?.Name || els == null)
            {
                Menu.ReleaseMenuFromItem(SirenConfigItem);
                SirenConfigItem.Activated -= OnNonEditableConfigSelected;

                if (els.Exists() && els.IsCustomSetting())
                {
                    SirenConfigMenu = new EmergencyLightingMenu(els);
                    Menu.BindMenuToItem(SirenConfigMenu.Menu, SirenConfigItem);
                    SirenConfigItem.Enabled     = true;
                    SirenConfigItem.LeftBadge   = UIMenuItem.BadgeStyle.None;
                    SirenConfigItem.Description = defaultConfigMenuDesc;
                }
                else if (els.Exists())
                {
                    SirenConfigMenu             = null;
                    SirenConfigItem.Enabled     = true;
                    SirenConfigItem.LeftBadge   = UIMenuItem.BadgeStyle.Alert;
                    SirenConfigItem.Activated  += OnNonEditableConfigSelected;
                    SirenConfigItem.Description = defaultConfigMenuDesc + builtInConfigMenuDesc + new string(' ', 20);
                }
                else
                {
                    SirenConfigMenu             = null;
                    SirenConfigItem.LeftBadge   = UIMenuItem.BadgeStyle.None;
                    SirenConfigItem.Enabled     = false;
                    SirenConfigItem.Description = "No selected siren setting";
                }
            }
        }
Beispiel #2
0
        public CopyMenu(EmergencyLightingMenu parent)
        {
            this.ParentMenu = parent;
            Menu            = new UIMenu("Edit Siren", parent.Menu.SubtitleText + " > Copy Siren Properties");
            DestinationSirenSelectorMenu.Menu.SubtitleText = "~b~Copy Siren Properties > Select Destination Sirens";
            TargetMenu = new SirenSettingsSelectionMenu(ParentELS);

            allSirenCopyCheckboxes.Add(SequencesCheckbox);
            allSirenCopyCheckboxes.Add(DeltasCheckbox);
            allSirenCopyCheckboxes.Add(FlashinessCheckbox);
            allSirenCopyCheckboxes.Add(RotationCheckbox);
            allSirenCopyCheckboxes.Add(EnvLightingCheckbox);
            allSirenCopyCheckboxes.Add(CoronaCheckbox);
            allSirenCopyCheckboxes.Add(ColorCheckbox);

            allGeneralCopyCheckboxes.Add(SettingEnvCheckbox);
            allGeneralCopyCheckboxes.Add(SettingSpeedCheckbox);
            allGeneralCopyCheckboxes.Add(HeadTailCheckbox);

            Menu.AddItem(AllSirenPropertiesCheckbox);
            foreach (UIMenuCheckboxItem checkbox in allSirenCopyCheckboxes)
            {
                checkbox.BackColor = Color.FromArgb(100, Color.DarkGray);
                checkbox.ForeColor = Color.WhiteSmoke;
                checkbox.Text      = "    " + checkbox.Text;
                Menu.AddItem(checkbox);
            }

            Menu.AddItem(AllGeneralPropertiesCheckbox);
            foreach (UIMenuCheckboxItem checkbox in allGeneralCopyCheckboxes)
            {
                checkbox.BackColor = Color.FromArgb(100, Color.DarkGray);
                checkbox.ForeColor = Color.WhiteSmoke;
                checkbox.Text      = "    " + checkbox.Text;
                Menu.AddItem(checkbox);
            }

            AllSirenPropertiesCheckbox.CheckboxEvent   += OnAllPropertiesChecked;
            AllGeneralPropertiesCheckbox.CheckboxEvent += OnAllPropertiesChecked;


            Menu.AddItem(CopyModeItem);
            TargetMenuItem = TargetMenu.CreateAndBindToSubmenuItem(this.Menu, "Target", "Select target siren setting to copy to/from", true);
            Menu.AddItem(SourceSirenSelector);
            Menu.AddItem(DestinationSirenMenuItem);
            Menu.BindMenuAndCopyProperties(DestinationSirenSelectorMenu.Menu, DestinationSirenMenuItem);
            DestinationSirenMenuItem.RightLabel = "None →";
            Menu.AddItem(CopyItem);

            CopyModeItem.OnListChanged   += OnCopyModeChanged;
            CopyItem.Activated           += OnCopyActivated;
            CopyItem.BackColor            = Color.DarkGreen;
            CopyItem.ForeColor            = Color.White;
            CopyItem.HighlightedBackColor = Color.PaleGreen;
            CopyItem.HighlightedForeColor = Color.DarkGreen;

            OnCopyModeChanged(CopyModeItem, 0);

            Menu.RefreshIndex();
        }
        public SequenceQuickEditMenu(EmergencyLighting els, EmergencyLightingMenu parent)
        {
            this.ELS    = els;
            this.Parent = parent;

            Menu = new UIMenuRefreshable("Edit Sequences", parent.Menu.SubtitleText + " > Sequence Quick Edit");

            for (int i = 0; i < ELS.Lights.Length; i++)
            {
                EmergencyLight             siren   = ELS.Lights[i];
                string                     sirenId = $"Siren {i + 1}";
                UIMenuSequenceItemSelector item    = new UIMenuSequenceItemSelector($"{sirenId} Sequence", siren.FlashinessSequence, $"Edit 32-bit sequence for {sirenId}");
                Menu.AddMenuDataBinding(item, (x) => siren.FlashinessSequence = x, () => siren.FlashinessSequence);
                sirenSequenceItems.Add(item);
            }

            Menu.AddItem(Parent.LeftHeadlightSequenceItem);
            sirenSequenceItems.Add(Parent.LeftHeadlightSequenceItem);
            Menu.AddItem(Parent.RightHeadlightSequenceItem);
            sirenSequenceItems.Add(Parent.RightHeadlightSequenceItem);
            Menu.AddItem(Parent.LeftTaillightSequenceItem);
            sirenSequenceItems.Add(Parent.LeftTaillightSequenceItem);
            Menu.AddItem(Parent.RightTaillightSequenceItem);
            sirenSequenceItems.Add(Parent.RightTaillightSequenceItem);


            buttons.Add(new InstructionalButton("V", "Paste sequence"));
            buttons.Add(new InstructionalButton("C", "Copy sequence"));
            buttons.Add(new InstructionalButton("dn", "Move siren down"));
            buttons.Add(new InstructionalButton("up", "Move siren up"));
            buttons.Add(new InstructionalButton("R", "Invert sequence"));
            buttons.Add(new InstructionalButton("E", "Extend sequence"));
            buttons.Add(new InstructionalButton(GameControl.FrontendRight, "Shift sequence"));
            buttons.Add(new InstructionalButton(GameControl.FrontendLeft, "Shift sequence"));
            buttons.Add(new InstructionalButton(GameControl.Duck, "Shift x4"));

            foreach (InstructionalButton button in buttons)
            {
                Menu.AddInstructionalButton(button);
            }

            Menu.OnMenuClose += OnMenuClose;
        }
 public static void OnImportCarcols(EmergencyLightingMenu menu)
 {
     Game.DisplayNotification("~y~Export not implemented yet");
 }