예제 #1
0
        private void OnAccept(GumpButton button)
        {
            if (AcceptHandler != null)
            {
                AcceptHandler(button);
            }

            if (String.IsNullOrWhiteSpace(InvasionName))
            {
                Send(
                    new NoticeDialogGump(User, Hide(true))
                {
                    Title         = "Choose an Invasion Name",
                    Html          = "Your invasion must have a name!",
                    AcceptHandler = b => Refresh(true)
                });
                return;
            }

            if (Region.Regions.Find(x => x.Name == InvasionRegion) == null)
            {
                Send(
                    new NoticeDialogGump(User, Hide(true))
                {
                    Title         = "Region Does Not Exist",
                    Html          = "The region you input does not exist.",
                    AcceptHandler = b => Refresh(true)
                });
                return;
            }

            if (Levels.Count == 0)
            {
                Send(
                    new NoticeDialogGump(User, Hide(true))
                {
                    Title         = "Invalid Levels",
                    Html          = "You must specify at least one valid level.",
                    AcceptHandler = b => Refresh(true)
                });
                return;
            }

            EventInvasions.GenerateInvasion(InvasionName, InvasionRegion, Levels, Gates);

            Close();
        }
예제 #2
0
        protected override void CompileEntryLayout(
            SuperGumpLayout layout, int length, int index, int pIndex, int yOffset, Invasion entry)
        {
            yOffset = 116 + pIndex * 67;

            layout.Add(
                "entry" + index,
                () =>
            {
                AddBackground(54, yOffset, 664, 72, 9260);

                AddLabel(71, yOffset + 10, 0, @"Invasion Name");
                AddLabel(71, yOffset + 38, 0, entry.InvasionName);

                AddLabel(208, yOffset + 10, 0, @"Invasion Region");
                AddLabel(208, yOffset + 38, 0, entry.RegionName);

                AddLabel(335, yOffset + 10, 0, @"Date");
                AddLabel(335, yOffset + 38, 0, entry.DateStarted.ToShortDateString());

                AddLabel(439, yOffset + 10, 0, @"Status");
                AddLabel(439, yOffset + 38, entry.Status.AsHue(), entry.Status.ToString());

                AddLabel(505, yOffset + 10, 0, @"View Details");
                AddButton(518, yOffset + 38, 2074, 2076, b =>
                {
                    new InvasionDetailsUI(User, Hide(true), entry).
                    Send <InvasionDetailsUI>();
                });

                if (User.AccessLevel < EventInvasions.Access && entry.Status != InvasionStatus.Waiting)
                {
                    AddLabel(605, yOffset + 10, 0, @"View Scoreboard");
                    AddButton(630, yOffset + 38, 2074, 2076, b => Send(new InvasionScoresOverviewGump(User, entry, Refresh(true))));
                }

                if (User.AccessLevel >= EventInvasions.Access)
                {
                    if (entry.Status == InvasionStatus.Running)
                    {
                        AddLabel(600, yOffset + 10, 0, @"Cancel");
                        AddButton(590, yOffset + 38, 2071, 2073, b =>
                        {
                            if (entry.Status == InvasionStatus.Running)
                            {
                                entry.FinishInvasion();
                            }
                            Refresh(true);
                        });
                    }

                    if (entry.Status == InvasionStatus.Waiting)
                    {
                        AddLabel(600, yOffset + 10, 0, @"Start");
                        AddButton(593, yOffset + 38, 2074, 2076, b =>
                        {
                            if (entry.Status == InvasionStatus.Waiting)
                            {
                                entry.StartInvasion();
                            }
                            Refresh(true);
                        });
                    }

                    if (entry.Status == InvasionStatus.Finished)
                    {
                        AddLabel(600, yOffset + 10, 0, @"Restart");
                        AddButton(597, yOffset + 38, 2074, 2076, b =>
                        {
                            if (entry.Status == InvasionStatus.Finished)
                            {
                                entry.RestartInvasion();
                            }
                            Refresh(true);
                        });
                    }

                    AddLabel(666, yOffset + 10, 0, @"Copy");
                    AddButton(657, yOffset + 38, 2074, 2076, b =>
                    {
                        EventInvasions.GenerateInvasion(entry);
                        Refresh(true);
                    });
                }
            });
        }