コード例 #1
0
        public static void OnMutedCommand(BasePlayer sender)
        {
            var mutedPlayersDialog = new ListDialog("Muted players:", "Ok");

            foreach (var basePlayer in Player.All)
            {
                var player = (Player)basePlayer;

                if (!player.IsLoggedIn)
                {
                    continue;
                }

                if (player.Account.Muted > DateTime.Now)
                {
                    mutedPlayersDialog.AddItem($"{player.Name} (ID:{player.Id})");
                }
            }

            if (mutedPlayersDialog.Items.Count != 0)
            {
                mutedPlayersDialog.Show(sender);
            }
            else
            {
                sender.SendClientMessage(Color.GreenYellow, Messages.ThereAreNoMutedPlayers);
            }
        }
コード例 #2
0
        public void ShowCreateEventTypeDialog(Player player)
        {
            ListDialog createEventDialog = new ListDialog("Create an event", "Create", "Cancel");

            foreach (EventType t in (EventType[])Enum.GetValues(typeof(EventType)))
            {
                createEventDialog.AddItem(t.ToString());
            }

            createEventDialog.Show(player);
            createEventDialog.Response += (sender, eventArgs) =>
            {
                if (eventArgs.DialogButton == DialogButton.Left)
                {
                    EventType evtType;
                    if (Enum.TryParse(eventArgs.InputText, out evtType))
                    {
                        ShowCreateEventNameDialog(player, evtType);
                    }
                    else
                    {
                        ShowCreateEventTypeDialog(player);
                        player.Notificate("Unable to parse event type");
                    }
                }
                else
                {
                    player.Notificate("Cancelled");
                    ShowManagerDialog(player);
                }
            };
        }
コード例 #3
0
 private static void BanIps(Player player)
 {
     if (player.IsAdminLevel(3))
     {
         return;
     }
     try
     {
         var lists = File.ReadAllLines("./samp.ban");
         if (lists.Length == 0)
         {
             player.SendClientMessage(Color.Red, "Error: No se encontró ninguna IP prohíbida.");
             return;
         }
         var dialog = new ListDialog($"Ban IPs: ({lists.Length})", "Cerrar", "");
         foreach (string info in lists)
         {
             dialog.AddItem(info);
         }
         dialog.Show(player);
         SendMessageToAdmins(player, "banips");
     }
     catch (FileNotFoundException)
     {
         player.SendClientMessage(Color.Red, "Error: No se encontró ninguna IP prohíbida.");
     }
 }
コード例 #4
0
        public PlayerCharacterChoice(Player player)
        {
            this.player = player;

            ServerDbContext dbContext = ((GameMode)GameMode.Instance).DbContext;

            playerChars = dbContext.Characters.Select(c => c).Where(c => c.Account == player.AccountData).ToList();

            if (playerChars.Count == 0)
            {
                charCreationMenu = new PlayerCharacterCreation();
            }
            else
            {
                charList           = new ListDialog("Choix de personnage", "Confirmer", "Quitter");
                charList.Response += ChoiceResponse;

                foreach (Character chr in playerChars)
                {
                    charList.AddItem(chr.Name + " (Niveau " + chr.Level + " - " + Utils.SexUtils.SexToString(chr.Sex) + " de " + chr.Age + " ans)");
                }

                if (playerChars.Count < SemiRP.Constants.MAX_CHARACTERS)
                {
                    charList.AddItem(Color.DarkGray + "Créer un autre personnage...");
                }
            }
        }
コード例 #5
0
            private static void GetInfo(Player player, int id)
            {
                Dictionary <string, string> result = RaceCreator.GetRaceInfo(id);

                if (result.Count == 0)
                {
                    player.SendClientMessage("No race found !");
                }
                else
                {
                    var    infoList = new ListDialog("Race info", "Ok", "");
                    string str      = "";
                    foreach (KeyValuePair <string, string> kvp in result)
                    {
                        str = new Color(50, 50, 255) + kvp.Key + ": " + new Color(255, 255, 255) + kvp.Value;
                        if (str.Length >= 64)
                        {
                            infoList.AddItem(str.Substring(0, 63));
                            infoList.AddItem(str.Substring(63));
                        }
                        else
                        {
                            infoList.AddItem(str);
                        }
                    }
                    infoList.Show(player);
                }
            }
コード例 #6
0
        public void ShowManagerDialog(Player player)
        {
            ListDialog managerDialog = new ListDialog("Event manager", "Select", "Cancel");

            managerDialog.AddItem(Color.Green + "Create event");
            foreach (Event evt in eventList)
            {
                managerDialog.AddItem(Color.White + "[" + evt.Status.ToString() + "]" + evt.Name);
            }

            managerDialog.Show(player);
            managerDialog.Response += (sender, eventArgs) =>
            {
                if (eventArgs.DialogButton == DialogButton.Left)
                {
                    if (eventArgs.ListItem == 0) // Create event
                    {
                        ShowCreateEventTypeDialog(player);
                    }
                    else
                    {
                        ShowEventOptionDialog(player, eventList.ElementAt(eventArgs.ListItem + 1));
                    }
                }
                else
                {
                    player.Notificate("Cancelled");
                }
            };
        }
コード例 #7
0
ファイル: RaceCreator.cs プロジェクト: LDami/Dami-Land
        private void ShowCheckpointDialog()
        {
            Checkpoint cp       = editingRace.checkpoints[checkpointIndex];
            ListDialog cpDialog = new ListDialog("Checkpoint options", "Select", "Cancel");

            cpDialog.AddItem("Edit checkpoint position");
            cpDialog.AddItem("Edit checkpoint size [" + cp.Size.ToString() + "]");

            if (cp.Type == CheckpointType.Normal || cp.Type == CheckpointType.Finish)
            {
                cpDialog.AddItem("Change checkpoint type: " + Color.Green + "Normal" + Color.White + "/Air");
            }
            else if (cp.Type == CheckpointType.Air || cp.Type == CheckpointType.AirFinish)
            {
                cpDialog.AddItem("Change checkpoint type: Normal/" + Color.Green + "Air");
            }

            if (checkpointIndex > 0)
            {
                cpDialog.AddItem("Edit events");
            }

            cpDialog.Show(player);
            cpDialog.Response += CpDialog_Response;
        }
コード例 #8
0
            private static void ModelsDialogCreate(Player player)
            {
                var action = new EventHandler <DialogResponseEventArgs>((o, args) =>
                {
                    if (args.DialogButton == DialogButton.Left)
                    {
                        player.SendClientMessage($"Stworzyłeś obiekt o modelu {args.InputText}.");
                        player.ObjectEditor.CreateObjectMode(new MruDynamicObject(Int32.Parse(args.InputText), player.Position));
                    }
                    else
                    {
                        ModelsDialogCreate(player);
                    }
                });

                var categoriesDialog = new ListDialog("Kategorie modeli", "Wyjdź", "Wybierz");

                categoriesDialog.AddItems(Objects.Objects.ObjectModelsCategory.Keys);
                categoriesDialog.Response += (sender, args) =>
                {
                    var tablistDialog = new TablistDialog($"Modele - Kategoria {args.InputText}",
                                                          new[] { "Model", "Nazwa", "Rozmiar", "Tagi" },
                                                          "Stwórz", "Wróć");
                    foreach (var objectModel in Objects.Objects.ObjectModelsCategory[args.InputText])
                    {
                        var o = objectModel.Value;
                        tablistDialog.Add(o.Model.ToString(), o.Name,
                                          o.Size.ToString(CultureInfo.CurrentCulture), String.Join(", ", o.Tags));
                    }

                    tablistDialog.Response += action;
                    tablistDialog.Show(player);
                };
                categoriesDialog.Show(player);
            }
コード例 #9
0
 public static void SetSelectedAction(ListDialog dialog, UnityAction action)
 {
     if (dialog == null)
     {
         return;
     }
     dialog.selectedAction = action;
 }
コード例 #10
0
        //public static IEntry EnsureClassIsInFile(IMEPackage pcc, string className)
        //{
        //    //check to see class is already in file
        //    foreach (ImportEntry import in pcc.Imports)
        //    {
        //        if (import.IsClass && import.ObjectName == className)
        //        {
        //            return import;
        //        }
        //    }
        //    foreach (ExportEntry export in pcc.Exports)
        //    {
        //        if (export.IsClass && export.ObjectName == className)
        //        {
        //            return export;
        //        }
        //    }

        //    ClassInfo info = UnrealObjectInfo.GetClassOrStructInfo(pcc.Game, className);

        //    //backup some package state so we can undo changes if something goes wrong
        //    int exportCount = pcc.ExportCount;
        //    int importCount = pcc.ImportCount;
        //    List<string> nameListBackup = pcc.Names.ToList();
        //    try
        //    {
        //        if (EntryImporter.IsSafeToImportFrom(info.pccPath, pcc.Game))
        //        {
        //            string package = Path.GetFileNameWithoutExtension(info.pccPath);
        //            return pcc.getEntryOrAddImport($"{package}.{className}");
        //        }

        //        //It's a class that's defined locally in every file that uses it.
        //        Stream loadStream = null;
        //        if (info.pccPath == UnrealObjectInfo.Me3ExplorerCustomNativeAdditionsName)
        //        {
        //            loadStream = ME3ExplorerCoreUtilities.GetCustomAppResourceStream(pcc.Game);
        //            //string resourceFilePath = App.CustomResourceFilePath(pcc.Game);
        //            //if (File.Exists(resourceFilePath))
        //            //{
        //            //    sourceFilePath = resourceFilePath;
        //            //}
        //        }
        //        else
        //        {
        //            string testPath = Path.Combine(MEDirectories.GetBioGamePath(pcc.Game), info.pccPath);
        //            if (File.Exists(testPath))
        //            {
        //                loadStream = new MemoryStream(File.ReadAllBytes(testPath));
        //            }
        //            else if (pcc.Game == MEGame.ME1)
        //            {
        //                testPath = Path.Combine(ME1Directory.DefaultGamePath, info.pccPath);
        //                if (File.Exists(testPath))
        //                {
        //                    loadStream = new MemoryStream(File.ReadAllBytes(testPath));
        //                }
        //            }
        //        }

        //        if (loadStream == null)
        //        {
        //            //can't find file to import from. This may occur if user does not have game or neccesary dlc installed
        //            return null;
        //        }

        //        using IMEPackage sourcePackage = MEPackageHandler.OpenMEPackageFromStream(loadStream);

        //        if (!sourcePackage.IsUExport(info.exportIndex))
        //        {
        //            return null; //not sure how this would happen
        //        }

        //        ExportEntry sourceClassExport = sourcePackage.GetUExport(info.exportIndex);

        //        if (sourceClassExport.ObjectName != className)
        //        {
        //            return null;
        //        }

        //        //Will make sure that, if the class is in a package, that package will exist in pcc
        //        IEntry parent = EntryImporter.GetOrAddCrossImportOrPackage(sourceClassExport.ParentFullPath, sourcePackage, pcc);

        //        var relinkResults = EntryImporter.ImportAndRelinkEntries(EntryImporter.PortingOption.CloneAllDependencies, sourceClassExport, pcc, parent, true, out IEntry result);
        //        if (relinkResults?.Count > 0)
        //        {
        //            ListDialog ld = new ListDialog(relinkResults, "Relink report", "The following items failed to relink.", null);
        //            ld.Show();
        //        }
        //        return result;
        //    }
        //    catch (Exception e)
        //    {
        //        //remove added entries
        //        var entriesToRemove = new List<IEntry>();
        //        for (int i = exportCount; i < pcc.Exports.Count; i++)
        //        {
        //            entriesToRemove.Add(pcc.Exports[i]);
        //        }
        //        for (int i = importCount; i < pcc.Imports.Count; i++)
        //        {
        //            entriesToRemove.Add(pcc.Imports[i]);
        //        }
        //        EntryPruner.TrashEntries(pcc, entriesToRemove);
        //        pcc.restoreNames(nameListBackup);
        //        return null;
        //    }
        //}

        public static void ShowRelinkResults(List <EntryStringPair> results)
        {
            Application.Current.Dispatcher.Invoke(() =>
            {
                ListDialog ld = new ListDialog(results, "Relink report", "The following items failed to relink.", null);
                ld.Show();
            });
        }
コード例 #11
0
 private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
 {
     if (sender is Hyperlink hl && hl.DataContext is DeploymentChecklistItem dcli)
     {
         ListDialog ld = new ListDialog(dcli.Errors, dcli.ErrorsTitle, dcli.ErrorsMessage, Window.GetWindow(hl));
         ld.ShowDialog();
     }
 }
コード例 #12
0
 public static void AddDestroyAction(ListDialog dialog, UnityAction action)
 {
     if (dialog == null)
     {
         return;
     }
     dialog.destroyedAction += action;
 }
コード例 #13
0
        /// <summary>
        /// Handles the click event for the "..." data source button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void btnDataSource_Click(object sender, EventArgs e)
        {
            if (ValidateToAddDataSource())
            {
                NamedObjectCollection <Field> columnNamesInLower = new NamedObjectCollection <Field>();
                int         selectedIndex = 1;
                DataRowView item;
                string[]    selectedViewFields = new string[lbxLinkedFields.SelectedItems.Count + 1];
                selectedViewFields[0] = field.Name;
                for (int i = 0; i < lbxLinkedFields.Items.Count; i++)
                {
                    item = (DataRowView)lbxLinkedFields.Items[i];
                    if (lbxLinkedFields.GetSelected(i))
                    {
                        selectedViewFields[selectedIndex] = item[lbxLinkedFields.DisplayMember].ToString();
                        DataRow selectRow       = item.Row;
                        string  fieldColumnName = (selectRow[ColumnNames.NAME].ToString());
                        string  fieldStringID   = (selectRow[ColumnNames.FIELD_ID].ToString());
                        if (DoesFieldNameExistInCollection(fieldColumnName, selectedFields) == false)
                        {
                            selectedFields.Add(page.GetView().GetFieldById(int.Parse(fieldStringID)));
                        }
                        selectedIndex++;
                    }
                }

                ListDialog   codesDialog = new ListDialog((TableBasedDropDownField)this.Field, this.MainForm, txtFieldName.Text, this.page, selectedFields);
                DialogResult result      = codesDialog.ShowDialog();
                if (result == DialogResult.OK)
                {
                    if (!((string.IsNullOrEmpty(codesDialog.SourceTableName) && string.IsNullOrEmpty(codesDialog.TextColumnName))))
                    {
                        txtDataSource.Text      = codesDialog.SourceTableName + " :: " + codesDialog.TextColumnName;
                        lbxLinkedFields.Enabled = false;
                        lblSelectFields.Enabled = false;
                        txtFieldName.Enabled    = false;
                    }
                    else
                    {
                        //if code table has not been set - set these to empty
                        txtDataSource.Text      = string.Empty;
                        field.SourceTableName   = string.Empty;
                        field.TextColumnName    = string.Empty;
                        lbxLinkedFields.Enabled = true;
                        lblSelectFields.Enabled = true;
                    }

                    this.sourceTableName = codesDialog.SourceTableName;
                    this.textColumnName  = codesDialog.TextColumnName;
                    btnOk.Enabled        = true;
                }
                btnOk.Enabled = true;
            }
            else
            {
                ShowErrorMessages();
            }
        }
コード例 #14
0
        public static void OnWeatherCommand(BasePlayer sender)
        {
            var weatherListDialog = new ListDialog("Select weather type:", Messages.DialogButtonSelect,
                                                   Messages.DialogButtonCancel);

            weatherListDialog.AddItem(
                "Normal\nStormy\nFoggy\nScorching Hot\nDull, cloudy, rainy\nSandstorm\nGreen Fog\nDark, cloudy, brown\nExtremely bright\nDark toxic clouds\nBlack & white sky");
            weatherListDialog.Show(sender);
            weatherListDialog.Response += (objectSender, e) =>
            {
                switch (e.ListItem)
                {
                case 0:
                    Server.SetWeather(0);
                    break;

                case 1:
                    Server.SetWeather(8);
                    break;

                case 2:
                    Server.SetWeather(9);
                    break;

                case 3:
                    Server.SetWeather(11);
                    break;

                case 4:
                    Server.SetWeather(16);
                    break;

                case 5:
                    Server.SetWeather(19);
                    break;

                case 6:
                    Server.SetWeather(20);
                    break;

                case 7:
                    Server.SetWeather(33);
                    break;

                case 8:
                    Server.SetWeather(39);
                    break;

                case 9:
                    Server.SetWeather(43);
                    break;

                case 10:
                    Server.SetWeather(44);
                    break;
                }
            };
        }
コード例 #15
0
        public static void OnCarOptionCommand(BasePlayer sender)
        {
            if (!sender.IsDriving())
            {
                sender.SendClientMessage(Color.Red, Messages.CommandAllowedOnlyAsDriver);
                return;
            }

            var carOptionsDialog = new ListDialog("Select option for your vehicle:", Messages.DialogButtonToggle,
                                                  Messages.DialogButtonCancel);

            carOptionsDialog.AddItem("Engine\nLights\nAlarm\nDoors\nBonnet\nBoot\nObjective");
            carOptionsDialog.Show(sender);

            carOptionsDialog.Response += (objectSender, e) =>
            {
                if (e.DialogButton != DialogButton.Left)
                {
                    return;
                }

                var playerVehicle = sender.Vehicle;

                switch (e.ListItem)
                {
                case 0:
                    playerVehicle.Engine = !playerVehicle.Engine;
                    break;

                case 1:
                    playerVehicle.Lights = !playerVehicle.Lights;
                    break;

                case 2:
                    playerVehicle.Alarm = !playerVehicle.Alarm;
                    break;

                case 3:
                    playerVehicle.Doors = !playerVehicle.Doors;
                    break;

                case 4:
                    playerVehicle.Bonnet = !playerVehicle.Bonnet;
                    break;

                case 5:
                    playerVehicle.Boot = !playerVehicle.Boot;
                    break;

                case 6:
                    playerVehicle.Objective = !playerVehicle.Objective;
                    break;
                }
            };
        }
コード例 #16
0
    public void ShowListDialog()
    {
        List <ListItem> items = new List <ListItem>();

        for (int i = 0; i < 10; i++)
        {
            var item = ListItem.CreateItem(i, "index = " + i, OnSelectedItem);
            items.Add(item);
        }
        listDialog = ListDialog.ShowDialog(items);
        ListDialog.AddDestroyAction(listDialog, () => { Debug.Log("ListDialog destroyed!"); });
    }
コード例 #17
0
        private void reachSpecCalculatorThread_Done(object sender, RunWorkerCompletedEventArgs e)
        {
            List <string> badBases = (List <string>)e.Result;

            if (badBases != null && badBases.Count > 0)
            {
                //bad bases were found.
                ListDialog lw = new ListDialog(badBases, "Bad reachspecs found", badBases.Count + " bad ReachSpecs were found.");
                lw.ShowDialog();
            }
            //throw new NotImplementedException();
            recalculateButton.Enabled = true;
        }
コード例 #18
0
        private void Label_MouseLeftButtonDownDirectInsertSort(object sender, MouseButtonEventArgs e)
        {
            getCurrentOperator(sender);
            maindemon = new MainDemon();
            maindemon.Demon_Code_Value.Height = 0;
            this.pageContainer.Navigate(maindemon, "DirInsSort");

            ListDialog DirInsSortWindow = new ListDialog(8);

            //订阅事件
            DirInsSortWindow.PassValuesEvent += new ListDialog.PassValuesHandler(ReceiveValuesOfDirInsSort);
            DirInsSortWindow.ShowDialog();
        }
コード例 #19
0
        private void Label_MouseLeftButtonDownOrderBinSearch(object sender, MouseButtonEventArgs e)
        {
            getCurrentOperator(sender);
            maindemon = new MainDemon();
            maindemon.Demon_Code_Value.Height = 0;
            this.pageContainer.Navigate(maindemon, "BinarySearch");

            ListDialog BinarySearchWindow = new ListDialog(7);

            //订阅事件
            BinarySearchWindow.PassValuesEvent += new ListDialog.PassValuesHandler(ReceiveValuesOfBinaarySearch);
            BinarySearchWindow.ShowDialog();
        }
コード例 #20
0
        /// <summary>
        /// 线性表的链表删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Label_MouseLeftButtonDownLinkedDelete(object sender, MouseButtonEventArgs e)
        {
            getCurrentOperator(sender);
            maindemon = new MainDemon();
            maindemon.Demon_Code_Value.Height = 0;
            this.pageContainer.Navigate(maindemon, "LinkedListedDelete");

            ListDialog linkedDelWindow = new ListDialog(5);

            //订阅事件
            linkedDelWindow.PassValuesEvent += new ListDialog.PassValuesHandler(ReceiveValuesOfLinkedListDelete);
            linkedDelWindow.ShowDialog();
        }
コード例 #21
0
        private void Label_MouseLeftButtonDownPartitionSort(object sender, MouseButtonEventArgs e)
        {
            getCurrentOperator(sender);
            maindemon = new MainDemon();
            maindemon.Demon_Code_Value.Height = 0;
            this.pageContainer.Navigate(maindemon, "QuickSort");

            ListDialog FastSortWindow = new ListDialog(10);

            //订阅事件
            FastSortWindow.PassValuesEvent += new ListDialog.PassValuesHandler(ReceiveValuesOfFastSort);
            FastSortWindow.ShowDialog();
        }
コード例 #22
0
        public static void OnConvoyCommand(Player sender)
        {
            if (sender.PlayerClass != PlayerClassType.TruckDriver)
            {
                sender.SendClientMessage(Color.Red, Messages.CommandOnlyAllowedAsTruckDriver);
                return;
            }

            var convoyStatus     = string.Empty;
            var convoyListDialog =
                new ListDialog("Select convoy:", Messages.DialogButtonSelect, Messages.DialogButtonCancel);

            foreach (var convoy in MissionConvoy.Convoys)
            {
                string leaderName;
                int    memberCount;
                if (convoy.Status == ConvoyStatus.Empty)
                {
                    memberCount  = 0;
                    leaderName   = "None";
                    convoyStatus = "Empty";
                }
                else
                {
                    memberCount = convoy.Members.Count;
                    leaderName  = convoy.Members[0].Name;

                    switch (convoy.Status)
                    {
                    case ConvoyStatus.Open:
                        convoyStatus = "Open";
                        break;

                    case ConvoyStatus.Closed:
                        convoyStatus = "Closed";
                        break;

                    case ConvoyStatus.Full:
                        convoyStatus = "Full";
                        break;
                    }
                }

                convoyListDialog.AddItem(
                    $"Leader: {{00FF00}}{leaderName}{{FFFFFF}}, members: {{FF0000}}{memberCount}{{FFFFFF}}, Status: {{00FF00}}{convoyStatus}{{FFFFFF}}");
            }

            convoyListDialog.Show(sender);
            convoyListDialog.Response += ConvoyController.ConvoyListDialog_Response;
        }
コード例 #23
0
        /// <summary>
        /// 线性表的顺序插入
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Label_MouseLeftButtonDownOrderInsert(object sender, MouseButtonEventArgs e)
        {
            //pageContainer.Source = new Uri("/Pages/MainDemon.xaml", UriKind.RelativeOrAbsolute);
            getCurrentOperator(sender);
            maindemon = new MainDemon();
            maindemon.Demon_Code_Value.Height = 0;
            this.pageContainer.Navigate(maindemon, "SqListInsert");

            ListDialog insertWindow = new ListDialog(1);

            //订阅事件
            insertWindow.PassValuesEvent += new ListDialog.PassValuesHandler(ReceiveValuesOfOrderInsert);
            insertWindow.ShowDialog();
        }
コード例 #24
0
ファイル: RaceCreator.cs プロジェクト: LDami/Dami-Land
        private void ShowCheckpointEventDialog()
        {
            ListDialog cpEventDialog = new ListDialog("Checkpoint events", "Select", "Cancel");

            if (editingRace.checkpoints[checkpointIndex].NextVehicle == null)
            {
                cpEventDialog.AddItem("Vehicle event [None]");
            }
            else
            {
                cpEventDialog.AddItem("Vehicle event [" + editingRace.checkpoints[checkpointIndex].NextVehicle.ToString() + "]");
            }
            cpEventDialog.Show(player);
            cpEventDialog.Response += CpEventDialog_Response;
        }
コード例 #25
0
        public static void DialogListCommand(GtaPlayer player, string items)
        {
            var dialog = new ListDialog("Captions", "OK!");

            foreach (var i in items.Split(' ').Where(s => !string.IsNullOrWhiteSpace(s)))
            {
                dialog.Items.Add(i);
            }

            dialog.Show(player);

            dialog.Response += (sender, args) =>
            {
                player.SendClientMessage("Response: " + args.ListItem);
            };
        }
コード例 #26
0
ファイル: MenuDialog.cs プロジェクト: SA-MP-Developer/SemiRP
        public MenuDialog(string caption, string button1, string button2 = null, string continueName = null)
        {
            menuDialog           = new ListDialog(caption, button1, button2);
            menuDialog.Response += MenuResponse;

            menuItems = new List <MenuDialogItem>();

            itemsData = new Hashtable();

            continueItem = null;

            if (continueName != null)
            {
                continueItem           = new MenuDialogItem(continueName);
                continueItem.Selected += ContinueResponse;
            }
        }
コード例 #27
0
        private void lstObjects_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            ISelectable obj = (ISelectable)lstObjects.SelectedObject;

            if (obj == null)
            {
                return;
            }
            if (obj is ListDialog)
            {
                ListDialog dlg = (ListDialog)obj;
                if (!FOCommon.Utils.LaunchDialogEditor(dlg, Config.PathScriptsDir + "../DialogEditor.exe"))
                {
                    Message.Show("DialogEditor not found", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #28
0
    public static void TopTen(Player player)
    {
        var dialogTop = new ListDialog("Top Ten", "Seleccionar", "Cerrar");
        var topten    = new Top()
        {
            Sender = player, DialogMain = dialogTop
        };

        dialogTop.AddItems(new[]
        {
            "Total Kills",
            "Total Deaths",
            "Killing Sprees",
            "Headshots",
            "Dropped Flags"
        });
        dialogTop.Response += (sender, e) =>
        {
            if (e.DialogButton == DialogButton.Left)
            {
                switch (e.ListItem)
                {
                case 0:
                    topten.ShowTopTen("totalKills", "Total Kills");
                    break;

                case 1:
                    topten.ShowTopTen("totalDeaths", "Total Deaths");
                    break;

                case 2:
                    topten.ShowTopTen("killingSprees", "Killing Sprees");
                    break;

                case 3:
                    topten.ShowTopTen("headshots", "Headshots");
                    break;

                case 4:
                    topten.ShowTopTen("droppedFlags", "Dropped Flags");
                    break;
                }
            }
        };
        dialogTop.Show(player);
    }
コード例 #29
0
        public static void ShowAdminDialog(Player player, Player receiver = null)
        {
            listAdmin = new ListDialog("Administration", "Sélectionner", "Quitter");
            listAdmin.AddItem("Modération");
            listAdmin.AddItem("Donner");
            listAdmin.AddItem("Véhicule");
            listAdmin.AddItem("Permissions");
            listAdmin.Show(player);
            listAdmin.Response += (sender, EventArgs) =>
            {
                if (EventArgs.DialogButton == SampSharp.GameMode.Definitions.DialogButton.Right)
                {
                    return;
                }

                switch (EventArgs.ListItem)
                {
                case 0:
                {
                    ShowModerationDialog(player, receiver);
                    break;
                }

                case 1:
                {
                    ShowGiveDialog(player);
                    break;
                }

                case 2:
                {
                    ShowVehicleDialog(player);
                    break;
                }

                case 3:
                {
                    ShowPermsDialog(player);
                    break;
                }

                default: return;
                }
            };
        }
コード例 #30
0
        public static void OnConvoyMembersCommand(Player sender)
        {
            if (!sender.IsInConvoy)
            {
                sender.SendClientMessage(Color.Red, Messages.PlayerNotPartOfAnyConvoy);
                return;
            }

            var convoy            = sender.Convoy;
            var membersListDialog = new ListDialog("Convoy members:", Messages.DialogButtonOk);

            foreach (var member in convoy.Members)
            {
                membersListDialog.AddItem($"{member.Name}\n");
            }

            membersListDialog.Show(sender);
        }
コード例 #31
0
ファイル: Till.cs プロジェクト: alex606/cis501
 private void Till_Load(object sender, EventArgs e)
 {
     tillController = new TillController(this);
     listDialog = new ListDialog();
 }
コード例 #32
0
ファイル: MainWindow.cs プロジェクト: mortie/JC3MM
		//Build mod to dropzone
		private bool buildMod(Mod mod, Dictionary<string, Mod> modFromPath)
		{
			Console.WriteLine("building mod " + mod.DisplayName);
			Stream readStream;
			try
			{
				readStream = new FileStream(mod.ModPath, FileMode.Open);
			}
			catch (IOException ex)
			{
				MessageBox.Show(ex.Message);
				return false;
			}

			ZipArchive archive = new ZipArchive(readStream, ZipArchiveMode.Read);

			//Get dropzones
			ArrayList dropzones = new ArrayList();
			Regex rx = new Regex("^((.*/)?dropzone)");
			foreach (ZipArchiveEntry ent in archive.Entries)
			{
				Match match = rx.Match(ent.FullName);
				string zone = match.Groups[1].Value;
				if (match.Success && !dropzones.Contains(zone))
				{
					dropzones.Add(zone);
				}
			}

			//Get single dropzone
			string dropzone = "";
			if (dropzones.Count == 0)
			{
				readStream.Close();
				MessageBox.Show("Mod " + mod.DisplayName + " has no dropzone.");
				return false;
			}
			else if (dropzones.Count == 1)
			{
				dropzone = (string)dropzones[0];
			}
			else
			{
				string caption = mod.DisplayName + " has multiple options. Choose one.";
				ListDialog dialog = new ListDialog(mod.DisplayName, caption, dropzones);
				int i = dialog.ShowDialog();
				if (i == -1)
				{
					readStream.Close();
					return false;
				}
				else
				{
					dropzone = (string)dropzones[i];
				}
			}

			foreach (ZipArchiveEntry ent in archive.Entries)
			{
				if (!ent.FullName.StartsWith(dropzone))
				{
					continue;
				}

				string relPath = ent.FullName.Replace(dropzone, "");
				if (relPath[0] == '/')
				{
					relPath = relPath.Substring(1);
				}

				string outPath = Path.Combine(dropzoneDir, relPath);

				//If it's a directory, create it
				if (ent.FullName.EndsWith("/"))
				{
					Console.WriteLine("mkdir " + outPath);
					mkdir(outPath);
				}

				//If not, write the file
				else
				{
					//Check if mod collides with an existing mod
					Mod collidesWith;
					if (modFromPath.TryGetValue(relPath, out collidesWith))
					{
						readStream.Close();
						MessageBox.Show(
							"Mod '" + mod.DisplayName + "'" +
							" collides with '" + collidesWith.DisplayName + "'."
						);
						return false;
					}
					modFromPath.Add(relPath, mod);

					//Write entry to file
					Console.WriteLine("write " + outPath);
					Stream writeStream = File.Create(outPath);
					Stream stream = ent.Open();
					stream.CopyTo(writeStream);
					writeStream.Close();
					stream.Close();
				}
			}

			readStream.Close();
			return true;
		}
コード例 #33
0
        /// <summary>
        /// Handles the click event for the "..." data source button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void btnDataSource_Click(object sender, EventArgs e)
        {
            if (ValidateToAddDataSource())
            {
                NamedObjectCollection<Field> columnNamesInLower = new NamedObjectCollection<Field>();
                int selectedIndex = 1;
                DataRowView item;
                string[] selectedViewFields = new string[lbxLinkedFields.SelectedItems.Count + 1];
                selectedViewFields[0] = field.Name;
                for (int i = 0; i < lbxLinkedFields.Items.Count; i++)
                {
                    item = (DataRowView)lbxLinkedFields.Items[i];
                    if (lbxLinkedFields.GetSelected(i))
                    {
                        selectedViewFields[selectedIndex] = item[lbxLinkedFields.DisplayMember].ToString();
                        DataRow selectRow = item.Row;
                        string fieldColumnName = (selectRow[ColumnNames.NAME].ToString());
                        string fieldStringID = (selectRow[ColumnNames.FIELD_ID].ToString());
                        if (DoesFieldNameExistInCollection(fieldColumnName, selectedFields) == false)
                        {
                            selectedFields.Add(page.GetView().GetFieldById(int.Parse(fieldStringID)));
                        }
                        selectedIndex++;
                    }
                }

                ListDialog codesDialog = new ListDialog((TableBasedDropDownField)this.Field, this.MainForm, txtFieldName.Text, this.page, selectedFields);
                DialogResult result = codesDialog.ShowDialog();
                if (result == DialogResult.OK)
                {
                    if (!((string.IsNullOrEmpty(codesDialog.SourceTableName) && string.IsNullOrEmpty(codesDialog.TextColumnName))))
                    {
                        txtDataSource.Text = codesDialog.SourceTableName + " :: " + codesDialog.TextColumnName;
                        lbxLinkedFields.Enabled = false;
                        lblSelectFields.Enabled = false;
                        txtFieldName.Enabled = false;
                    }
                    else
                    {
                        //if code table has not been set - set these to empty
                        txtDataSource.Text = string.Empty;
                        field.SourceTableName = string.Empty;
                        field.TextColumnName = string.Empty;
                        lbxLinkedFields.Enabled = true;
                        lblSelectFields.Enabled = true;
                    }

                    this.sourceTableName = codesDialog.SourceTableName;
                    this.textColumnName = codesDialog.TextColumnName;
                    btnOk.Enabled = true;
                }
                btnOk.Enabled = true;
            }
            else
            {
                ShowErrorMessages();
            }
        }
コード例 #34
0
ファイル: Console.cs プロジェクト: alex606/cis501
 private void Console_Load(object sender, EventArgs e)
 {
     consoleController = new ConsoleController(this);
     listDialog = new ListDialog();
 }