Beispiel #1
0
        private MenuItem CreateTeamShortcutMenu(Configuration.TeamSettings team)
        {
            var menuItem = default(MenuItem);

            // Shortcuts Menu Item
            List <object> quickLaunchClientShortcuts = new List <object>();

            Mubox.Configuration.ClientSettingsCollection clients = team.Clients;

            menuItem        = new MenuItem();
            menuItem.Header = "Start All";
            menuItem.Click += (sender, e) =>
            {
                // TODO: need to create a team selector (not launcher), maybe just a 'Teams' menu, need to allow team selection by hotkey, allow hotkey definition from a sub-menu e.g. MENU={"Select","Set/Clear HotKey.."}
                // TODO: allow characters to be shared between multiple Teams, two teams should not 'Launch' the same 'Character' more than once. Characters will be known uniquely only by 'Name'
                LaunchTeam(team);
            };
            quickLaunchClientShortcuts.Add(menuItem);

            // "Auto-Launch Game on Client Start"
            menuItem             = new MenuItem();
            menuItem.IsCheckable = true;
            menuItem.IsChecked   = Mubox.Configuration.MuboxConfigSection.Default.AutoLaunchGame;
            menuItem.Click      += (sender, e) =>
            {
                Mubox.Configuration.MuboxConfigSection.Default.AutoLaunchGame = !Mubox.Configuration.MuboxConfigSection.Default.AutoLaunchGame;
                Mubox.Configuration.MuboxConfigSection.Default.Save();
            };
            menuItem.Header  = "Auto-Launch Game on Client Start";
            menuItem.ToolTip =
                "Enable this option to Automatically Launch your Game when the Mubox Client is started via the Quick Launch Menu." + Environment.NewLine +
                "Note, the game will not run until the client successfully connects to the Server, once a Server Connection is established the Launch will continue.";
            quickLaunchClientShortcuts.Add(menuItem);

            quickLaunchClientShortcuts.Add(new Separator());
            foreach (var o in clients)
            {
                var client = o as Mubox.Configuration.ClientSettings;
                if (!client.CanLaunch || (Mubox.View.Client.ClientWindowCollection.Instance.Count((dlg) => dlg.ClientState.Settings.Name.ToUpper() == client.Name.ToUpper()) != 0))
                {
                    continue;
                }

                client.PerformConnectOnLoad = true;
                quickLaunchClientShortcuts.Add(
                    QuickLaunchMenu_CreateClientItem(client.Name)
                    );
            }

            menuItem        = new MenuItem();
            menuItem.Header = team.Name;
            menuItem.Icon   = Resources["imageShortcutIcon"];

            if (quickLaunchClientShortcuts.Count > 3)
            {
                menuItem             = new MenuItem();
                menuItem.Header      = team.Name;
                menuItem.Icon        = Resources["imageShortcutIcon"];
                menuItem.ItemsSource = quickLaunchClientShortcuts;

                var lMenuItem = new MenuItem();
                lMenuItem.IsCheckable = true;
                lMenuItem.IsChecked   = (Mubox.Configuration.MuboxConfigSection.Default.Teams.Default.Equals(team.Name));
                lMenuItem.Header      = "Select Team"; // TODO: need hotkey support
                lMenuItem.Click      += (s, e) =>
                {
                    Mubox.Configuration.MuboxConfigSection.Default.Teams.ActiveTeam = team;
                };
                quickLaunchClientShortcuts.Insert(0, lMenuItem);
            }
            else
            {
                menuItem.IsCheckable = true;
                menuItem.IsChecked   = (Mubox.Configuration.MuboxConfigSection.Default.Teams.Default.Equals(team.Name));
                menuItem.Click      += (sender, e) =>
                {
                    Mubox.Configuration.MuboxConfigSection.Default.Teams.ActiveTeam = team;
                };
            }

            return(menuItem);
        }
Beispiel #2
0
        private MenuItem CreateProfileShortcutMenu(Configuration.ProfileSettings profile)
        {
            var menuItem = default(MenuItem);

            // Shortcuts Menu Item
            List <object> quickLaunchClientShortcuts = new List <object>();

            Mubox.Configuration.ClientSettingsCollection clients = profile.Clients;

            menuItem        = new MenuItem();
            menuItem.Header = "Start All";
            menuItem.Click += (sender, e) =>
            {
                LaunchProfileClients(profile);
            };
            quickLaunchClientShortcuts.Add(menuItem);

            // "Auto-Launch Game on Client Start"
            menuItem             = new MenuItem();
            menuItem.IsCheckable = true;
            menuItem.IsChecked   = Mubox.Configuration.MuboxConfigSection.Default.AutoLaunchGame;
            menuItem.Click      += (sender, e) =>
            {
                Mubox.Configuration.MuboxConfigSection.Default.AutoLaunchGame = !Mubox.Configuration.MuboxConfigSection.Default.AutoLaunchGame;
                Mubox.Configuration.MuboxConfigSection.Save();
            };
            menuItem.Header  = "Auto-Launch Game on Client Start";
            menuItem.ToolTip =
                "Enable this option to Automatically Launch your Game when a Client started via the Quick Launch Menu." + Environment.NewLine +
                "Note, the game will not run until the client successfully connects to the Server, once a Server Connection is established the Launch will continue.";
            quickLaunchClientShortcuts.Add(menuItem);

            // "Enable Mouse Panning Fix"
            menuItem             = new MenuItem();
            menuItem.IsCheckable = true;
            menuItem.IsChecked   = profile.EnableMousePanningFix;
            menuItem.Click      += (sender, e) =>
            {
                profile.EnableMousePanningFix = !profile.EnableMousePanningFix;
                Mubox.Configuration.MuboxConfigSection.Save();
            };
            menuItem.Header  = "Enable Mouse Panning Fix";
            menuItem.ToolTip = "Only enable this option if you experience 'erratic' behavior when panning with the mouse. Properly written games do not have this problem.";
            quickLaunchClientShortcuts.Add(menuItem);

            // "Enable CAS Fix"
            menuItem             = new MenuItem();
            menuItem.IsCheckable = true;
            menuItem.IsChecked   = profile.EnableCASFix;
            menuItem.Click      += (sender, e) =>
            {
                profile.EnableCASFix = !profile.EnableCASFix;
                Mubox.Configuration.MuboxConfigSection.Save();
            };
            menuItem.Header  = "Enable Control-Alt-Shift Fix";
            menuItem.ToolTip = "Only enable this option if you have problems with the Control, Alt and Shift keys in your game.";
            quickLaunchClientShortcuts.Add(menuItem);

            // New Mubox Client
            menuItem        = new MenuItem();
            menuItem.Click += (sender, e) =>
            {
                try
                {
                    // ensure client name is unique for current profile
                    var clientName = default(string);
                    while (true)
                    {
                        clientName = Mubox.View.PromptForClientNameDialog.PromptForClientName();
                        if (string.IsNullOrEmpty(clientName))
                        {
                            return;
                        }
                        //foreach (var L_profile in Mubox.Configuration.MuboxConfigSection.Default.Profiles.Cast<Mubox.Configuration.ProfileSettings>())
                        {
                            if (profile.Clients.GetExisting(clientName) != null)
                            {
                                MessageBox.Show("Name '" + clientName + "' is already in use, choose another.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                                continue;
                            }
                        }
                        break;
                    }

                    var clientSettings = profile.Clients.CreateNew(clientName);
                    clientSettings.CanLaunch = true;
                    Mubox.Configuration.MuboxConfigSection.Save();

                    ClientState clientState = new ClientState(clientSettings, profile);
                    Mubox.View.Client.ClientWindow clientWindow = new Mubox.View.Client.ClientWindow(clientState);
                    clientWindow.Show();
                }
                catch (Exception ex)
                {
                    ex.Log();
                }
            };
            menuItem.Header = "_Configure New Client...";
            menuItem.Icon   = Resources["imageSettingsIcon"];
            quickLaunchClientShortcuts.Add(menuItem);

            quickLaunchClientShortcuts.Add(new Separator());
            foreach (var client in clients.Cast <Mubox.Configuration.ClientSettings>())
            {
                // NOTE: a !CanLaunch client is one we know about, but likely exists on a remote computer. we do not (yet) support remote launch, and so these entries are hidden even though they may appear in the config file.
                if (!client.CanLaunch || (Mubox.View.Client.ClientWindowCollection.Instance.Count((dlg) => dlg.ClientState.Settings.Name.ToUpper() == client.Name.ToUpper()) != 0))
                {
                    continue;
                }

                client.PerformConnectOnLoad = true;
                quickLaunchClientShortcuts.Add(
                    QuickLaunchMenu_CreateClientItem(client.Name, profile)
                    );
            }

            menuItem             = new MenuItem();
            menuItem.Header      = profile.Name;
            menuItem.ItemsSource = quickLaunchClientShortcuts;

            var lMenuItem = new MenuItem();

            lMenuItem.IsCheckable = true;
            lMenuItem.IsChecked   = (Mubox.Configuration.MuboxConfigSection.Default.Profiles.Default.Equals(profile.Name));
            lMenuItem.Header      = "Active Profile";
            lMenuItem.Click      += (s, e) =>
            {
                Mubox.Configuration.MuboxConfigSection.Default.Profiles.ActiveProfile = profile;
                Mubox.Configuration.MuboxConfigSection.Save();
            };
            quickLaunchClientShortcuts.Insert(0, lMenuItem);

            return(menuItem);
        }