示例#1
0
        private void choose(int choice)
        {
            //open summary
            CharData          charData = DataManager.Instance.Save.ActiveTeam.Assembly[choice];
            OfferFeaturesMenu menu     = new OfferFeaturesMenu(this.Bounds, this);

            menu.SetCurrentChar(charData);

            MenuManager.Instance.AddMenu(menu, true);

            CurrentState = ExchangeState.Viewing;

            ActivityTradeTeam tradeTeam = NetworkManager.Instance.Activity as ActivityTradeTeam;

            tradeTeam.OfferChar(charData);
            tradeTeam.SetReady(CurrentState);
        }
示例#2
0
        public TradeTeamMenu(int defaultChoice)
        {
            int menuWidth = 152;

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

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

            int page   = defaultChoice / SLOTS_PER_PAGE;
            int choice = defaultChoice % SLOTS_PER_PAGE;

            Initialize(new Loc(0, 16 + LINE_SPACE + GraphicsManager.MenuBG.TileHeight * 2), menuWidth, Text.FormatKey("MENU_ASSEMBLY_TITLE"), box.ToArray(), choice, page, SLOTS_PER_PAGE);

            theirInfo = new OfferFeaturesMenu(new Rect(GraphicsManager.ScreenWidth - 0 - menuWidth, 16 + LINE_SPACE + GraphicsManager.MenuBG.TileHeight * 2, Bounds.Width, Bounds.Height), null);

            yourTitle = new SummaryMenu(Rect.FromPoints(new Loc(Bounds.Start.X, Bounds.Start.Y - LINE_SPACE - GraphicsManager.MenuBG.TileHeight * 2), new Loc(Bounds.End.X, Bounds.Start.Y)));
            MenuText yourText = new MenuText(DataManager.Instance.Save.ActiveTeam.GetDisplayName(),
                                             new Loc((yourTitle.Bounds.X + yourTitle.Bounds.End.X) / 2, yourTitle.Bounds.Y + GraphicsManager.MenuBG.TileHeight), DirH.None);

            yourText.Color = TextTan;
            yourTitle.Elements.Add(yourText);

            yourSummary = new SummaryMenu(Rect.FromPoints(new Loc(Bounds.Start.X, Bounds.End.Y),
                                                          new Loc(Bounds.End.X, Bounds.End.Y + LINE_SPACE + GraphicsManager.MenuBG.TileHeight * 2)));
            yourStatus = new MenuText("",
                                      new Loc((yourSummary.Bounds.X + yourSummary.Bounds.End.X) / 2, yourSummary.Bounds.Y + GraphicsManager.MenuBG.TileHeight), DirH.None);
            yourStatus.Color = TextTan;
            yourSummary.Elements.Add(yourStatus);



            theirTitle = new SummaryMenu(Rect.FromPoints(new Loc(theirInfo.Bounds.Start.X, theirInfo.Bounds.Start.Y - LINE_SPACE - GraphicsManager.MenuBG.TileHeight * 2), new Loc(theirInfo.Bounds.End.X, theirInfo.Bounds.Start.Y)));
            MenuText theirText = new MenuText("",
                                              new Loc((theirTitle.Bounds.X + theirTitle.Bounds.End.X) / 2, theirTitle.Bounds.Y + GraphicsManager.MenuBG.TileHeight), DirH.None);

            theirText.Color = TextTan;
            theirTitle.Elements.Add(theirText);

            theirSummary = new SummaryMenu(Rect.FromPoints(new Loc(theirInfo.Bounds.Start.X, theirInfo.Bounds.End.Y),
                                                           new Loc(theirInfo.Bounds.End.X, theirInfo.Bounds.End.Y + LINE_SPACE + GraphicsManager.MenuBG.TileHeight * 2)));
            theirStatus = new MenuText("",
                                       new Loc((theirSummary.Bounds.X + theirSummary.Bounds.End.X) / 2, theirSummary.Bounds.Y + GraphicsManager.MenuBG.TileHeight), DirH.None);
            theirStatus.Color = TextTan;
            theirSummary.Elements.Add(theirStatus);

            ActivityTradeTeam tradeTeam = NetworkManager.Instance.Activity as ActivityTradeTeam;

            theirText.SetText(tradeTeam.TargetInfo.Data.TeamName);

            CurrentState = ExchangeState.Selecting;
        }