예제 #1
0
        private void openDialogueItem(object sender, MouseEventArgs e)
        {
            int item = grabElement();

            if (item == -1)
            {
                return;
            }

            if (!elements[item].isEvent)
            {
                DialogueProperties dp = new DialogueProperties(dialogSystem.items[elements[item].id]);

                dp.FormClosed += (object s, FormClosedEventArgs fcea) =>
                {
                    dialogSystem.items[elements[item].id] = dp.current;

                    if (dp.current.entry)
                    {
                        for (int i = 0; i < dialogSystem.items.Count; i++)
                        {
                            if (i != elements[item].id &&
                                dialogSystem.items[i] != null &&
                                dialogSystem.items[i].entry)
                            {
                                dp.current.entry = false;

                                MessageBox.Show("The dialog item could not be set as the entry point, as an entry point already exists.", "WebClash Server - Error");

                                break;
                            }
                        }
                    }

                    canvas.Invalidate();
                };

                dp.Text = "Edit item #" + elements[item].id;

                dp.ShowDialog();
            }
            else
            {
                DialogueEventProperties dep = new DialogueEventProperties(dialogSystem.items[elements[item].id]);

                dep.FormClosed += (object s, FormClosedEventArgs fcea) =>
                {
                    dialogSystem.items[elements[item].id] = dep.current;

                    canvas.Invalidate();
                };

                dep.Text = "Edit event #" + elements[item].id;

                dep.ShowDialog();
            }
        }
예제 #2
0
        private void OpenDialogueItem(object sender, MouseEventArgs e)
        {
            int item = GrabElement();

            if (item == -1)
            {
                return;
            }

            if (!elements[item].isEvent)
            {
                DialogueProperties dp = new DialogueProperties(dialogSystem.items[elements[item].id]);

                dp.FormClosed += (object s, FormClosedEventArgs fcea) =>
                {
                    dialogSystem.items[elements[item].id] = dp.current;

                    if (dp.current.entry)
                    {
                        for (int i = 0; i < dialogSystem.items.Count; i++)
                        {
                            if (i != elements[item].id &&
                                dialogSystem.items[i] != null &&
                                dialogSystem.items[i].entry)
                            {
                                dp.current.entry = false;

                                Logger.Error("The dialog item could not be set as the entry point, as an entry point already exists.");

                                break;
                            }
                        }
                    }

                    canvas.Invalidate();
                };

                dp.Text = "Edit item #" + elements[item].id;

                dp.ShowDialog();
            }
            else
            {
                //Make sure it is not the turn hostile event

                if (dialogSystem.items[elements[item].id].eventType == "TurnHostile")
                {
                    Logger.Message("The 'Turn Hostile' event has no event properties.");

                    return;
                }

                //If it is a show shop event, open shop selection
                //form instead of dialogue event properties

                if (dialogSystem.items[elements[item].id].eventType == "ShowShop")
                {
                    //Open shop selection

                    ShopSelection ss = new ShopSelection("Shop event #" + elements[item].id, dialogSystem.items[elements[item].id].showShopEvent);

                    ss.FormClosed += (object s, FormClosedEventArgs fcea) =>
                    {
                        dialogSystem.items[elements[item].id].showShopEvent = ss.GetResult();
                    };

                    ss.ShowDialog();

                    return;
                }

                //If it is a show bank event, open a text input
                //form instead of dialogue event properties

                if (dialogSystem.items[elements[item].id].eventType == "ShowBank")
                {
                    //Open text input

                    TextInput ti = new TextInput("Bank event #" + elements[item].id, "Set the bank name", dialogSystem.items[elements[item].id].showBankEvent.name);

                    ti.ShowDialog();
                    if (ti.DialogResult == DialogResult.OK)
                    {
                        dialogSystem.items[elements[item].id].showBankEvent.name = ti.GetResult();
                    }

                    return;
                }

                //Open event properties

                DialogueEventProperties dep = new DialogueEventProperties(dialogSystem.items[elements[item].id]);

                dep.FormClosed += (object s, FormClosedEventArgs fcea) =>
                {
                    dialogSystem.items[elements[item].id] = dep.current;

                    //Check if entry point (Get Global Variable)

                    if (dep.current.entry)
                    {
                        for (int i = 0; i < dialogSystem.items.Count; i++)
                        {
                            if (i != elements[item].id &&
                                dialogSystem.items[i] != null &&
                                dialogSystem.items[i].entry)
                            {
                                dep.current.entry = false;

                                Logger.Error("The dialog event could not be set as the entry point, as an entry point already exists.");

                                break;
                            }
                        }
                    }

                    canvas.Invalidate();
                };

                dep.Text = "Edit event #" + elements[item].id;

                dep.ShowDialog();
            }
        }