コード例 #1
0
ファイル: GameLevel.cs プロジェクト: OhBlihv/SkyCore-MiNET
        public void ShowEndGameMenu(SkyPlayer player)
        {
            var simpleForm = new SimpleForm
            {
                Title   = GetGameModalTitle(),
                Content = GetEndOfGameContent(player),
                Buttons = new List <Button>
                {
                    new Button
                    {
                        Text = "§2§lPlay Again\n" +
                               "§r§8(Jump into a new game)",
                        Image = new Image
                        {
                            Type = "url",
                            Url  = "https://static.skytonia.com/dl/replayiconmenu.png"
                        },
                        ExecuteAction = delegate { ExternalGameHandler.AddPlayer(player, GameType); }
                    }
                }
            };

            StateType currentStateType = CurrentState.GetEnumState(this);

            if (currentStateType != StateType.EndGame &&
                currentStateType != StateType.Closing)
            {
                simpleForm.Buttons.Add(
                    new Button
                {
                    Text = "§6§lSpectate Game\n" +
                           "§r§8(Continue watching this game)",
                    Image = new Image
                    {
                        Type = "url",
                        Url  = "https://static.skytonia.com/dl/spectateiconmenu.png"
                    },
                    ExecuteAction = delegate { SetPlayerTeam(player, GetSpectatorTeam()); }
                }
                    );
            }

            simpleForm.Buttons.Add(
                new Button
            {
                Text = "§c§lChange Game\n" +
                       "§r§8(Choose a different game)",
                Image = new Image
                {
                    Type = "url",
                    Url  = "https://static.skytonia.com/dl/comingsooniconmenu.png"
                },
                ExecuteAction = delegate { GameUtil.ShowGameList(player); }
            }
                );

            player.SendForm(simpleForm);
        }
コード例 #2
0
ファイル: GameUtil.cs プロジェクト: OhBlihv/SkyCore-MiNET
        public static void ShowGameList(SkyPlayer player)
        {
            try
            {
                if (player == null || !player.IsConnected || player.KnownPosition == null)
                {
                    SkyUtil.log("Attempted to show GameList to a null player");
                    return;
                }

                var simpleForm = new SimpleForm
                {
                    Title   = "§lSkytonia Network",
                    Content = "",
                    Buttons = new List <Button>
                    {
                        new Button
                        {
                            Text  = $"§3§lNetwork Lobby\n{GetFormattedPlayerCount("hub")}",
                            Image = new Image
                            {
                                Type = "url",
                                Url  = "https://static.skytonia.com/dl/hubiconmenu.png"
                            },
                            ExecuteAction = delegate { ExternalGameHandler.AddPlayer(player, "hub"); }
                        },
                        new Button
                        {
                            Text  = $"§c§lMurder Mystery\n{GetFormattedPlayerCount("murder")}",
                            Image = new Image
                            {
                                Type = "url",
                                Url  = "https://static.skytonia.com/dl/murdericonmenu.png"
                            },
                            ExecuteAction = delegate { ExternalGameHandler.AddPlayer(player, "murder"); }
                        },
                        new Button
                        {
                            Text  = $"§6§l Build Battle\n{GetFormattedPlayerCount("build-battle")}",
                            Image = new Image
                            {
                                Type = "url",
                                Url  = "https://static.skytonia.com/dl/buildbattleiconmenu.png"
                            },
                            ExecuteAction = delegate { ExternalGameHandler.AddPlayer(player, "build-battle"); }
                        },
                        new Button
                        {
                            Text  = $"§d§lComing Soon...",
                            Image = new Image
                            {
                                Type = "url",
                                Url  = "https://static.skytonia.com/dl/comingsooniconmenu.png"
                            },
                            ExecuteAction = delegate {  }                             //Empty
                        }
                    }
                };

                player.SendForm(simpleForm);
            }
            catch (Exception e)
            {
                BugSnagUtil.ReportBug(e);
            }
        }