Beispiel #1
0
    //Bake appropriate cookies, then send to user and reload the page.  See loadCookies() for cookie unboxing and loadMain()
    //for loading of the appropriate main window page.
    protected void gamePageButtonClicked(Object sender, EventArgs e)
    {
        //Get needed Controls
        GamePageButton gamePageButton = (GamePageButton)sender;
        GameLink       gameLink       = gamePageButton.GameLink;
        Panel          gamePanel      = (Panel)gamePageButton.Parent;
        Panel          gameTypePanel  = (Panel)gameLink.Parent;

        //Make required Cookies
        Session["gameLinkID"]      = gameLink.ID;
        Session["gameCategoryID"]  = gameLink.GameTypeDropdown.ID;
        Session["gamePanelID"]     = gamePanel.ID;
        Session["gameTypePanelID"] = gameTypePanel.ID;

        //Save Active Game to be Shown, and remove any savedContent from objectTables.
        Session["activeGame"] = gamePageButton.Game;
        Session.Remove("savedContent");
        if (!gamePageButton.IsCustomPage)
        {
            Response.Redirect("~/" + gamePageButton.Url);
        }
        else
        {
            Session["customPath"] = Request.ApplicationPath + gamePageButton.Url;
            Response.Redirect("~/Player/CustomPage");
        }
    }
Beispiel #2
0
    //Loads all the NavBar content for each game the user is Game Mastering in.
    protected void loadGMGames()
    {
        Panel gmGames = new Panel();

        gmGames.ID       = "gmGames";
        gmGames.CssClass = "outerDropdownContainer";

        //Foreach Game Database says User is GMing in, create a corresponding Game Dropdown and associated panel.
        //This is a 'pretend' game to display what it should look like if you actually are playing in two games.
        foreach (Game game in gmGamesList)
        {
            GameLink gameLink = new GameLink(gmGamesLink, gmCarrot);
            gameLink.ID           = Server.HtmlDecode(game.GameName + "GMLink");
            gameLink.Text         = game.GameName;
            gameLink.Text        += "<i class=\"fa fa-caret-down\"></i>";
            gameLink.GameCarrotID = game.GameName + "GMCarrot";
            gameLink.CssClass     = "dropdown-btn";
            gmGames.Controls.Add(gameLink);

            Panel gamePanel = new Panel();
            gamePanel.ID       = Server.HtmlDecode(game.GameName + "GMPanel");
            gamePanel.CssClass = "innerDropdownContainer";
            {
                GamePageButton gameInfo = new GamePageButton(gameLink, "GM/GameInformationGM", game);
                gameInfo.Text   = "Game Information";
                gameInfo.Click += new EventHandler(gamePageButtonClicked);
                gamePanel.Controls.Add(gameInfo);

                GamePageButton charList = new GamePageButton(gameLink, "GM/GamePartyGM", game);
                charList.Text   = "Game Party";
                charList.Click += new EventHandler(gamePageButtonClicked);
                gamePanel.Controls.Add(charList);

                GamePageButton encounterPage = new GamePageButton(gameLink, "GM/EncounterTool", game);
                encounterPage.Text   = "Encounter Tool";
                encounterPage.Click += new EventHandler(gamePageButtonClicked);
                gamePanel.Controls.Add(encounterPage);

                GamePageButton npcTrackerPage = new GamePageButton(gameLink, "GM/NPCTracker", game);
                npcTrackerPage.Text   = "NPC Tracker";
                npcTrackerPage.Click += new EventHandler(gamePageButtonClicked);
                gamePanel.Controls.Add(npcTrackerPage);

                GamePageButton npcToolPage = new GamePageButton(gameLink, "GM/NPCTool", game);
                npcToolPage.Text   = "NPC Tool";
                npcToolPage.Click += new EventHandler(gamePageButtonClicked);
                gamePanel.Controls.Add(npcToolPage);

                GamePageButton magicShopToolPage = new GamePageButton(gameLink, "GM/MagicShopTool", game);
                magicShopToolPage.Text   = "Magic Shop Tool";
                magicShopToolPage.Click += new EventHandler(gamePageButtonClicked);
                gamePanel.Controls.Add(magicShopToolPage);

                GamePageButton publicPages = new GamePageButton(gameLink, "GM/CustomPageTool", game);
                publicPages.Text   = "Add/Edit/Remove Pages";
                publicPages.Click += new EventHandler(gamePageButtonClicked);
                gamePanel.Controls.Add(publicPages);
            }
            gmGames.Controls.Add(gamePanel);
        }

        //Give a nice label if user has no games, so they are not sad :(
        if (gmGamesList.Count == 0)
        {
            Label noGamesLabel = new Label();
            noGamesLabel.Text     = "You have no games.";
            noGamesLabel.CssClass = "innerDropdownNoGames";
            gmGames.Controls.Add(noGamesLabel);
            gmGamesDropdown.Controls.Add(noGamesLabel);
        }
        else
        {
            gmGamesDropdown.Controls.Add(gmGames);
        }
    }
Beispiel #3
0
    //Loads all the NavBar content for each game the user is playing in.
    protected void loadPlayerGames()
    {
        Panel playerGames = new Panel();

        playerGames.ID       = "playerGames";
        playerGames.CssClass = "outerDropdownContainer";

        //Foreach Game database says User is playing in, create a corresponding Game Dropdown and associated panel.  These are both 'pretend' games
        //to display what it should look like if you actually are playing in two games.
        foreach (Game game in playerGamesList)
        {
            GameLink gameLink = new GameLink(playerGamesLink, playerCarrot);
            gameLink.ID           = Server.HtmlDecode(game.GameName + "PlayerLink");
            gameLink.Text         = game.GameName;
            gameLink.Text        += "<i class=\"fa fa-caret-down\"></i>";
            gameLink.GameCarrotID = game.GameName + "PlayerCarrot";
            gameLink.CssClass     = "dropdown-btn";
            playerGames.Controls.Add(gameLink);

            Panel gamePanel = new Panel();
            gamePanel.ID       = Server.HtmlDecode(game.GameName + "PlayerPanel");
            gamePanel.CssClass = "innerDropdownContainer";
            {
                GamePageButton gameInfo = new GamePageButton(gameLink, "Player/GameInformation", game);
                gameInfo.Text   = "Game Information";
                gameInfo.Click += new EventHandler(gamePageButtonClicked);
                gamePanel.Controls.Add(gameInfo);

                GamePageButton charList = new GamePageButton(gameLink, "Player/GameParty", game);
                charList.Text   = "Game Party";
                charList.Click += new EventHandler(gamePageButtonClicked);
                gamePanel.Controls.Add(charList);

                //Add Custom Pages
                PagesTable     pagesTable = new PagesTable(new DatabaseConnection());
                CustomPageList pages      = pagesTable.getGamePages(game.GameID);

                for (int i = 0; i < pages.Pages.Count; i++)
                {
                    CustomPage     page       = pages.Pages[i];
                    GamePageButton publicPage = new GamePageButton(gameLink, page.PageURL, game, true);
                    publicPage.Text   = page.PageName;
                    publicPage.Click += new EventHandler(gamePageButtonClicked);
                    gamePanel.Controls.Add(publicPage);
                }
            }
            playerGames.Controls.Add(gamePanel);
        }

        //Give a nice label if user has no games, so they are not sad :(
        if (playerGamesList.Count == 0)
        {
            Label noGamesLabel = new Label();
            noGamesLabel.Text     = "You have no games.";
            noGamesLabel.CssClass = "innerDropdownNoGames";
            playerGames.Controls.Add(noGamesLabel);
            playerGamesDropdown.Controls.Add(noGamesLabel);
        }

        else
        {
            playerGamesDropdown.Controls.Add(playerGames);
        }
    }