public ContactChosenMenu(ContactInfo info, ServerInfo serverInfo, bool canTrade, bool hasSwappable, bool rescueMode, ContactsMenu.OnChooseActivity action, Action deleteAction)
        {
            this.targetContact = info;
            this.targetServer  = serverInfo;
            this.rescueMode    = rescueMode;
            this.action        = action;
            this.deleteAction  = deleteAction;

            List <MenuTextChoice> choices = new List <MenuTextChoice>();

            if (rescueMode)
            {
                choices.Add(new MenuTextChoice(Text.FormatKey("MENU_RESCUE"), () => { ActivityAction(ActivityType.GetHelp); }));
            }
            else
            {
                choices.Add(new MenuTextChoice(Text.FormatKey("MENU_RESCUE"), () => { ActivityAction(ActivityType.SendHelp); }));
                choices.Add(new MenuTextChoice(Text.FormatKey("MENU_TRADE_TEAM"), () => { ActivityAction(ActivityType.TradeTeam); }, canTrade, canTrade ? Color.White : Color.Red));
                choices.Add(new MenuTextChoice(Text.FormatKey("MENU_TRADE_ITEM"), () => { ActivityAction(ActivityType.TradeItem); }, hasSwappable, hasSwappable ? Color.White : Color.Red));
                //choices.Add(new MenuTextChoice(Text.FormatKey("MENU_TRADE_MAIL"), () => { ActivityAction(ActivityType.TradeMail); }));
                //choices.Add(new MenuTextChoice(Text.FormatKey("MENU_INFO"), InfoAction));
            }
            choices.Add(new MenuTextChoice(Text.FormatKey("MENU_DELETE"), deleteAction));
            choices.Add(new MenuTextChoice(Text.FormatKey("MENU_EXIT"), ExitAction));

            Initialize(new Loc(204, 8), CalculateChoiceLength(choices, 72), choices.ToArray(), 0);
        }
示例#2
0
        //TODO: this class may not be needed since peer to peer communication can
        //be done by just setting the server to the target IP
        public PeersMenu(ContactsMenu.OnChooseActivity action)
        {
            this.action = action;

            canTrade     = DataManager.Instance.Save.ActiveTeam.Assembly.Count > 0;
            hasSwappable = false;


            bool[] itemPresence = new bool[DataManager.Instance.DataIndices[DataManager.DataType.Item].Count];
            for (int ii = 0; ii < itemPresence.Length; ii++)
            {
                if (DataManager.Instance.Save.ActiveTeam.Storage[ii] > 0)
                {
                    if (updatePresence(ii, itemPresence))
                    {
                        hasSwappable = true;
                        break;
                    }
                }
            }

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

            for (int ii = 0; ii < DiagManager.Instance.CurSettings.PeerList.Count; ii++)
            {
                int      index     = ii;
                PeerInfo record    = DiagManager.Instance.CurSettings.PeerList[ii];
                string   entryText = null;
                if (record.Data.TeamName.Length > 0)
                {
                    entryText = record.Data.TeamName;
                }
                else
                {
                    entryText = Text.FormatKey("MENU_NEW_CONTACT") + " [" + record.IP + "]";
                }
                flatChoices.Add(new MenuTextChoice(entryText, () => { choose(index); }));
            }
            flatChoices.Add(new MenuTextChoice(Text.FormatKey("MENU_ADD_NEW"), startAddNew, true, Color.Yellow));
            List <MenuChoice[]> choices = SortIntoPages(flatChoices, SLOTS_PER_PAGE);

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

            Initialize(new Loc(8, 8), 196, Text.FormatKey("MENU_CONTACTS_TITLE"), choices.ToArray(), 0, 0, SLOTS_PER_PAGE);
        }
示例#3
0
        public SelfChosenMenu(string copyString, bool rescueMode, ContactsMenu.OnChooseActivity action)
        {
            this.copyString = copyString;
            this.rescueMode = rescueMode;
            this.action     = action;

            List <MenuTextChoice> choices = new List <MenuTextChoice>();

            choices.Add(new MenuTextChoice(Text.FormatKey("MENU_COPY_UUID"), CopyAction));
            if (!rescueMode)
            {
                choices.Add(new MenuTextChoice(Text.FormatKey("MENU_TEAM_RENAME"), () => { MenuManager.Instance.AddMenu(new TeamNameMenu(Text.FormatKey("INPUT_TEAM_TITLE"), "", RenameAction), false); }));
                choices.Add(new MenuTextChoice(Text.FormatKey("MENU_UPDATE_TEAM"), UpdateAction));
            }
            choices.Add(new MenuTextChoice(Text.FormatKey("MENU_EXIT"), ExitAction));

            Initialize(new Loc(204, 8), CalculateChoiceLength(choices, 72), choices.ToArray(), 0);
        }