Example #1
0
        public TutorTeamMenu(int teamSlot, OnChooseSlot action, Action refuseAction)
        {
            this.chooseSlotAction = action;
            this.refuseAction     = refuseAction;
            int menuWidth          = 160;
            List <MenuChoice> team = new List <MenuChoice>();

            foreach (Character character in DataManager.Instance.Save.ActiveTeam.Players)
            {
                int teamIndex = team.Count;

                MenuText memberName = new MenuText(character.GetDisplayName(true), new Loc(2, 1), Color.White);
                MenuText memberLv   = new MenuText(Text.FormatKey("MENU_TEAM_LEVEL_SHORT", character.Level), new Loc(menuWidth - 8 * 4, 1), DirV.Up, DirH.Right, Color.White);
                team.Add(new MenuElementChoice(() => { choose(teamIndex); }, true, memberName, memberLv));
            }

            summaryMenu = new TeamMiniSummary(Rect.FromPoints(new Loc(16,
                                                                      GraphicsManager.ScreenHeight - 8 - GraphicsManager.MenuBG.TileHeight * 2 - VERT_SPACE * 5),
                                                              new Loc(GraphicsManager.ScreenWidth - 16, GraphicsManager.ScreenHeight - 8)));

            if (teamSlot == -1)
            {
                teamSlot = Math.Min(Math.Max(0, defaultChoice), team.Count - 1);
            }

            Initialize(new Loc(16, 16), menuWidth, Text.FormatKey("MENU_TEAM_TITLE"), team.ToArray(), teamSlot);
        }
Example #2
0
        public AddToTeamMenu(OnChooseTeam teamChoice, Action refuseAction)
        {
            int menuWidth = 152;

            this.teamChoice   = teamChoice;
            this.refuseAction = refuseAction;

            List <MenuChoice> flatChoices = new List <MenuChoice>();

            for (int ii = 0; ii < DungeonScene.Instance.ActiveTeam.Assembly.Count; ii++)
            {
                int       index      = ii;
                Character character  = DungeonScene.Instance.ActiveTeam.Assembly[index];
                MenuText  memberName = new MenuText(character.BaseName, new Loc(2, 1), character.Dead ? Color.Red : Color.White);
                MenuText  memberLv   = new MenuText(Text.FormatKey("MENU_TEAM_LEVEL_SHORT", character.Level), new Loc(menuWidth - 8 * 4, 1),
                                                    DirV.Up, DirH.Right, character.Dead ? Color.Red : Color.White);
                flatChoices.Add(new MenuElementChoice(() => { choose(index); }, !character.Dead, memberName, memberLv));
            }
            List <MenuChoice[]> box = SortIntoPages(flatChoices, SLOTS_PER_PAGE);

            summaryMenu = new TeamMiniSummary(Rect.FromPoints(new Loc(16,
                                                                      GraphicsManager.ScreenHeight - 8 - GraphicsManager.MenuBG.TileHeight * 2 - VERT_SPACE * 5),
                                                              new Loc(GraphicsManager.ScreenWidth - 16, GraphicsManager.ScreenHeight - 8)));

            portrait = new SpeakerPortrait(new MonsterID(), new EmoteStyle(0), new Loc(GraphicsManager.ScreenWidth - 32 - 40, 16), true);

            Initialize(new Loc(16, 16), menuWidth, Text.FormatKey("MENU_ASSEMBLY_TITLE"), box.ToArray(), 0, 0, SLOTS_PER_PAGE);
        }
Example #3
0
        public TeamMenu(bool sendHome, int teamSlot)
        {
            int menuWidth = 160;

            this.sendHome = sendHome;
            bool checkSkin = DataManager.Instance.Save is RogueProgress && sendHome;

            if (checkSkin && DataManager.Instance.Save.ActiveTeam.Players.Count > ExplorerTeam.MAX_TEAM_SLOTS)
            {
                checkSkin = false;
                foreach (Character character in DataManager.Instance.Save.ActiveTeam.Players)
                {
                    if (!DataManager.Instance.GetSkin(character.BaseForm.Skin).Challenge || character.Dead)
                    {
                        checkSkin = true;
                    }
                }
            }
            List <MenuChoice> team = new List <MenuChoice>();

            foreach (Character character in DataManager.Instance.Save.ActiveTeam.Players)
            {
                int  teamIndex = team.Count;
                bool disabled  = false;
                if (GameManager.Instance.CurrentScene == DungeonScene.Instance)
                {
                    CharIndex turnChar = ZoneManager.Instance.CurrentMap.CurrentTurnMap.GetCurrentTurnChar();
                    if (sendHome && turnChar.Char == team.Count)//disable the current turn choice in send home mode
                    {
                        disabled = true;
                    }
                }
                if (checkSkin)
                {
                    disabled |= DataManager.Instance.GetSkin(character.BaseForm.Skin).Challenge&& !character.Dead;
                }

                MenuText memberName = new MenuText(character.GetDisplayName(true), new Loc(2, 1), disabled ? Color.Red : Color.White);
                MenuText memberLv   = new MenuText(Text.FormatKey("MENU_TEAM_LEVEL_SHORT", character.Level), new Loc(menuWidth - 8 * 4, 1), DirV.Up, DirH.Right, disabled ? Color.Red : Color.White);
                team.Add(new MenuElementChoice(() => { choose(teamIndex); }, !disabled, memberName, memberLv));
            }

            summaryMenu = new TeamMiniSummary(Rect.FromPoints(new Loc(16,
                                                                      GraphicsManager.ScreenHeight - 8 - GraphicsManager.MenuBG.TileHeight * 2 - VERT_SPACE * 5),
                                                              new Loc(GraphicsManager.ScreenWidth - 16, GraphicsManager.ScreenHeight - 8)));

            if (teamSlot == -1)
            {
                teamSlot = Math.Min(Math.Max(0, defaultChoice), team.Count - 1);
            }

            Initialize(new Loc(16, 16), menuWidth, Text.FormatKey("MENU_TEAM_TITLE"), team.ToArray(), teamSlot);
        }
Example #4
0
        public AssemblyMenu(int defaultChoice, Action teamChanged)
        {
            int menuWidth = 152;

            this.teamChanged = teamChanged;

            List <MenuChoice> flatChoices = new List <MenuChoice>();

            for (int ii = 0; ii < DataManager.Instance.Save.ActiveTeam.Players.Count; ii++)
            {
                int       index      = ii;
                Character character  = DataManager.Instance.Save.ActiveTeam.Players[index];
                bool      enabled    = !ChoosingLeader(ii);
                MenuText  memberName = new MenuText(character.BaseName, new Loc(2, 1), enabled ? Color.Lime : TextIndigo);
                MenuText  memberLv   = new MenuText(Text.FormatKey("MENU_TEAM_LEVEL_SHORT", character.Level), new Loc(menuWidth - 8 * 4, 1),
                                                    DirV.Up, DirH.Right, enabled ? Color.Lime : TextIndigo);
                flatChoices.Add(new MenuElementChoice(() => { Choose(index, false); }, true, memberName, memberLv));
            }
            for (int ii = 0; ii < DataManager.Instance.Save.ActiveTeam.Assembly.Count; ii++)
            {
                int       index      = ii;
                Character character  = DataManager.Instance.Save.ActiveTeam.Assembly[index];
                Color     color      = CanChooseAssembly(ii) ? (character.IsFavorite ? Color.Yellow : Color.White) : Color.Red;
                MenuText  memberName = new MenuText(character.BaseName, new Loc(2, 1), color);
                MenuText  memberLv   = new MenuText(Text.FormatKey("MENU_TEAM_LEVEL_SHORT", character.Level), new Loc(menuWidth - 8 * 4, 1),
                                                    DirV.Up, DirH.Right, color);
                flatChoices.Add(new MenuElementChoice(() => { Choose(index, true); }, true, memberName, memberLv));
            }
            List <MenuChoice[]> box = SortIntoPages(flatChoices, SLOTS_PER_PAGE);

            defaultChoice = Math.Min(defaultChoice, flatChoices.Count - 1);
            int startChoice = defaultChoice % SLOTS_PER_PAGE;
            int startPage   = defaultChoice / SLOTS_PER_PAGE;

            summaryMenu = new TeamMiniSummary(Rect.FromPoints(new Loc(16,
                                                                      GraphicsManager.ScreenHeight - 8 - GraphicsManager.MenuBG.TileHeight * 2 - VERT_SPACE * 5),
                                                              new Loc(GraphicsManager.ScreenWidth - 16, GraphicsManager.ScreenHeight - 8)));

            portrait = new SpeakerPortrait(new MonsterID(), new EmoteStyle(0), new Loc(GraphicsManager.ScreenWidth - 32 - 40, 16), true);

            Initialize(new Loc(16, 16), menuWidth, Text.FormatKey("MENU_ASSEMBLY_TITLE"), box.ToArray(), startChoice, startPage, SLOTS_PER_PAGE);
        }