コード例 #1
0
        protected override void ChoiceChanged()
        {
            int itemIndex = DataManager.Instance.Save.ActiveTeam.Players[CurrentChoice].EquippedItem.ID;

            if (itemIndex > -1)
            {
                Text.SetText(RogueEssence.Text.FormatKey("MENU_HELD_ITEM", DataManager.Instance.Save.ActiveTeam.Players[CurrentChoice].EquippedItem.GetDisplayName()));
            }
            else
            {
                Text.SetText(RogueEssence.Text.FormatKey("MENU_HELD_NO_ITEM"));
            }
            base.ChoiceChanged();
        }
コード例 #2
0
 public void SetSOS(SOSMail sos)
 {
     Title.SetText(Text.FormatKey("MENU_SOS_TITLE"));
     Portraits = new SpeakerPortrait[sos.TeamProfile.Length];
     for (int ii = 0; ii < sos.TeamProfile.Length; ii++)
     {
         Portraits[ii] = new SpeakerPortrait(sos.TeamProfile[ii], new EmoteStyle(sos.RescuedBy == null ? GraphicsManager.SOSEmotion : 0, true),
                                             new Loc(Bounds.X + Bounds.Width / 2 - (GraphicsManager.PortraitSize * sos.TeamProfile.Length + (sos.TeamProfile.Length - 1) * 2) / 2 + ii * (GraphicsManager.PortraitSize + 2),
                                                     Bounds.Y + GraphicsManager.MenuBG.TileHeight + TitledStripMenu.TITLE_OFFSET), false);
     }
     Name.SetText(Text.FormatKey("MENU_SOS_CLIENT", sos.TeamName));
     LastSeen.SetText(Text.FormatKey("MENU_SOS_DATE", sos.DateDefeated));
     Goal.SetText(Text.FormatKey("MENU_SOS_GOAL", sos.GoalText.ToLocal().Replace('\n', ' ')));
     Reward.SetText(sos.OfferedItem.Value > 0 ? Text.FormatKey("MENU_SOS_REWARD", sos.OfferedItem.GetDungeonName()) : "");
 }
コード例 #3
0
        public override void Update(InputManager input)
        {
            Visible = true;
            NetworkManager.Instance.Update();
            if (NetworkManager.Instance.Status == OnlineStatus.Connected)
            {
                MenuManager.Instance.RemoveMenu();
                action();
            }
            else if (NetworkManager.Instance.Status == OnlineStatus.Offline)
            {
                //give offline message in a dialogue
                MenuManager.Instance.RemoveMenu();
                MenuManager.Instance.AddMenu(MenuManager.Instance.CreateDialogue(NetworkManager.Instance.ExitMsg), false);
            }
            else
            {
                if (NetworkManager.Instance.Status == OnlineStatus.FindingPartner || NetworkManager.Instance.Status == OnlineStatus.ReceivingPartner)
                {
                    ConnectingMsg.SetText(Text.FormatKey("MENU_CONNECTING_PARTNER"));
                }

                if (input.JustPressed(FrameInput.InputType.Menu) || input.JustPressed(FrameInput.InputType.Cancel))
                {
                    NetworkManager.Instance.Disconnect();
                    GameManager.Instance.SE("Menu/Cancel");
                    MenuManager.Instance.RemoveMenu();
                }
            }
        }
コード例 #4
0
        private void chooseAction(int index, MenuText buttonType)
        {
            buttonType.SetText("(" + Text.FormatKey("MENU_CONTROLS_CHOOSE_BUTTON") + ")");

            MenuManager.Instance.AddMenu(new GetButtonMenu(Settings.ForbiddenButtons, (Buttons button) =>
            {
                actionButtons[index] = button;
                refresh();
            }, () => { refresh(); }), true);
        }
コード例 #5
0
        private void chooseAction(int index, MenuText buttonType)
        {
            buttonType.SetText("[" + Text.FormatKey("MENU_CONTROLS_CHOOSE_KEY") + "]");

            MenuManager.Instance.AddMenu(new GetKeyMenu(Settings.ForbiddenKeys, (Keys key) =>
            {
                actionKeys[index] = key;
                refresh();
            }, () => { refresh(); }), true);
        }
コード例 #6
0
 public void SetItem(InvItem item)
 {
     Data.ItemData entry = Data.DataManager.Instance.GetItem(item.ID);
     Description.SetText(entry.Desc.ToLocal());
     SalePrice.SetText(Text.FormatKey("MENU_ITEM_VALUE", Text.FormatKey("MONEY_AMOUNT", item.GetSellValue())));
     if (entry.Rarity > 0)
     {
         string rarityStr = "";
         for (int ii = 0; ii < entry.Rarity; ii++)
         {
             rarityStr += "\uE10C";
         }
         Rarity.SetText(Text.FormatKey("MENU_ITEM_RARITY", rarityStr));
     }
     else
     {
         Rarity.SetText("");
     }
 }
コード例 #7
0
 public void SetSOS(SOSMail mail)
 {
     if (mail != null)
     {
         Name.SetText(mail.TeamName);
         Reward.SetText(Text.FormatKey("MENU_SOS_REWARD", mail.OfferedItem.Value > -1 ? mail.OfferedItem.GetDungeonName() : "---"));
         LastSeen.SetText(Text.FormatKey("MENU_SOS_DATE", mail.DateDefeated));
         Goal.SetText(Text.FormatKey("MENU_SOS_GOAL", mail.GoalText.ToLocal().Replace('\n', ' ')));
         Portraits = new SpeakerPortrait[mail.TeamProfile.Length];
         for (int ii = 0; ii < mail.TeamProfile.Length; ii++)
         {
             Portraits[ii] = new SpeakerPortrait(mail.TeamProfile[ii], new EmoteStyle(GraphicsManager.SOSEmotion, true),
                                                 new Loc(Bounds.End.X - GraphicsManager.MenuBG.TileWidth + (GraphicsManager.PortraitSize + 2) * (ii - mail.TeamProfile.Length),
                                                         Bounds.Y + GraphicsManager.MenuBG.TileHeight), false);
         }
     }
     else
     {
         setError();
     }
 }
コード例 #8
0
        public void UpdateStatus()
        {
            ActivityGetHelp getHelp = NetworkManager.Instance.Activity as ActivityGetHelp;

            switch (CurrentState)
            {
            case ExchangeRescueState.Communicating:
                yourStatus.SetText(Text.FormatKey("MENU_RESCUE_STATUS_COMMUNICATING"));
                break;

            case ExchangeRescueState.SOSReady:
                yourStatus.SetText(Text.FormatKey("MENU_RESCUE_STATUS_SOS_CONFIRMING"));
                break;

            case ExchangeRescueState.SOSTrading:
                yourStatus.SetText(Text.FormatKey("MENU_RESCUE_STATUS_SOS_SENDING"));
                break;

            case ExchangeRescueState.AOKReady:
                yourStatus.SetText(Text.FormatKey("MENU_RESCUE_STATUS_AOK_CONFIRMING"));
                break;

            case ExchangeRescueState.AOKTrading:
                yourStatus.SetText(Text.FormatKey("MENU_RESCUE_STATUS_AOK_RECEIVING"));
                break;

            case ExchangeRescueState.Completed:
                yourStatus.SetText(Text.FormatKey("MENU_RESCUE_STATUS_WAITING"));
                break;
            }
        }
コード例 #9
0
        public void UpdateStatus()
        {
            ActivityTradeItem tradeTeam = NetworkManager.Instance.Activity as ActivityTradeItem;

            if (tradeTeam.OfferedItems != theirInfo.CurrentOffer)
            {
                theirInfo.SetCurrentItems(tradeTeam.OfferedItems);
            }

            //set status
            yourStatus.SetText(CurrentState.ToLocal("msg"));
            theirStatus.SetText(tradeTeam.CurrentState.ToLocal("msg"));
        }
コード例 #10
0
        public void SetSkill(int index)
        {
            SkillData   skillEntry   = DataManager.Instance.GetSkill(index);
            ElementData elementEntry = DataManager.Instance.GetElement(skillEntry.Data.Element);

            SkillElement.SetText(Text.FormatKey("MENU_SKILLS_ELEMENT", elementEntry.GetIconName()));
            SkillCategory.SetText(Text.FormatKey("MENU_SKILLS_CATEGORY", skillEntry.Data.Category.ToLocal()));
            BasePowerState powerState = skillEntry.Data.SkillStates.GetWithDefault <BasePowerState>();

            SkillPower.SetText(Text.FormatKey("MENU_SKILLS_POWER", (powerState != null ? powerState.Power.ToString() : "---")));
            SkillHitRate.SetText(Text.FormatKey("MENU_SKILLS_HIT_RATE", (skillEntry.Data.HitRate > -1 ? skillEntry.Data.HitRate + "%" : "---")));
            Targets.SetText(Text.FormatKey("MENU_SKILLS_RANGE", skillEntry.HitboxAction.GetDescription()));
            Description.SetText(skillEntry.Desc.ToLocal());
        }
コード例 #11
0
 public void SetContact(string name, string stats, string lastSeen, string id, ProfilePic[] portraits)
 {
     Name.SetText(name);
     Stats.SetText(stats);
     LastSeen.SetText(lastSeen);
     ID.SetText(id);
     Portraits = new SpeakerPortrait[portraits.Length];
     for (int ii = 0; ii < portraits.Length; ii++)
     {
         Portraits[ii] = new SpeakerPortrait(portraits[ii].ID, new EmoteStyle(portraits[ii].Emote, true),
                                             new Loc(Bounds.End.X - GraphicsManager.MenuBG.TileWidth + (GraphicsManager.PortraitSize + 2) * (ii - portraits.Length),
                                                     Bounds.Y + GraphicsManager.MenuBG.TileHeight), false);
     }
 }
コード例 #12
0
 public void SetSkill(string skillName, int element, int charges, int max, bool skillSealed)
 {
     if (!String.IsNullOrWhiteSpace(skillName))
     {
         Color color = (skillSealed || charges == 0) ? Color.Red : Color.White;
         skillText.SetText(DiagManager.Instance.GetControlString((FrameInput.InputType)(skillSlot + (int)FrameInput.InputType.Skill1)) + ": " + skillName);
         skillText.Color = color;
         skillCharges.SetText(charges + "/" + max);
         skillCharges.Color = color;
         ElementData elementData = DataManager.Instance.GetElement(element);
         skillElement.SetText(elementData.GetIconName());
         skillElement.Color = color;
     }
     else
     {
         skillText.SetText(DiagManager.Instance.GetControlString((FrameInput.InputType)(skillSlot + (int)FrameInput.InputType.Skill1)));
         skillText.Color = Color.Gray;
         skillCharges.SetText("");
         skillCharges.Color = Color.Gray;
         skillElement.SetText("");
         skillElement.Color = Color.Gray;
     }
 }
コード例 #13
0
        public void SetMember(Character character)
        {
            FullName.SetText(character.GetDisplayName(true) + " / " + CharData.GetFullFormName(character.BaseForm));
            Level.SetText(Text.FormatKey("MENU_TEAM_LEVEL_SHORT", character.Level));
            HP.SetText(Text.FormatKey("MENU_TEAM_HP", character.HP, character.MaxHP));
            Fullness.SetText(Text.FormatKey("MENU_TEAM_HUNGER", character.Fullness, character.MaxFullness));

            int expToNext = 0;

            if (character.Level < DataManager.Instance.MaxLevel)
            {
                int        growth     = DataManager.Instance.GetMonster(character.BaseForm.Species).EXPTable;
                GrowthData growthData = DataManager.Instance.GetGrowth(growth);
                expToNext = growthData.GetExpToNext(character.Level);
            }
            EXP.SetText(Text.FormatKey("MENU_TEAM_EXP", character.EXP, expToNext));
            Intrinsics.SetText(Text.FormatKey("MENU_TEAM_INTRINSIC", (character.Intrinsics[0].Element.ID > -1 ? DataManager.Instance.GetIntrinsic(character.Intrinsics[0].Element.ID).GetColoredName() : DataManager.Instance.GetIntrinsic(0).GetColoredName())));
        }
コード例 #14
0
        public void SetCurrentChar(CharData chara)
        {
            CurrentChar = chara;
            if (CurrentChar == null)
            {
                return;
            }

            Portrait.Speaker = CurrentChar.BaseForm;
            Nickname.SetText(CurrentChar.BaseName);
            Name.SetText(CharData.GetFullFormName(CurrentChar.BaseForm));

            BaseMonsterForm formData = DataManager.Instance.GetMonster(CurrentChar.BaseForm.Species).Forms[CurrentChar.BaseForm.Form];

            Level.SetText(Text.FormatKey("MENU_TEAM_LEVEL_SHORT", CurrentChar.Level));
            ElementData element1   = DataManager.Instance.GetElement(formData.Element1);
            ElementData element2   = DataManager.Instance.GetElement(formData.Element2);
            string      typeString = element1.GetIconName();

            if (formData.Element2 != 00)
            {
                typeString += "/" + element2.GetIconName();
            }

            Elements.SetText(typeString);

            for (int ii = 0; ii < CharData.MAX_SKILL_SLOTS; ii++)
            {
                SlotSkill skill       = CurrentChar.BaseSkills[ii];
                SkillData data        = DataManager.Instance.GetSkill(skill.SkillNum);
                string    skillString = "-----";
                if (skill.SkillNum > -1)
                {
                    skillString = data.GetIconName();
                }
                Skills[ii].SetText(skillString);
            }

            IntrinsicData entry = DataManager.Instance.GetIntrinsic(CurrentChar.BaseIntrinsics[0]);

            Intrinsic.SetText(entry.GetColoredName());
        }
コード例 #15
0
ファイル: TeachMenu.cs プロジェクト: RogueCollab/RogueEssence
        protected override void ChoiceChanged()
        {
            Character character = DataManager.Instance.Save.ActiveTeam.Players[CurrentChoice];

            SummaryTitle.SetText(Text.FormatKey("MENU_SKILLS_TITLE", character.GetDisplayName(true)));
            for (int ii = 0; ii < Skills.Length; ii++)
            {
                if (character.BaseSkills[ii].SkillNum > -1)
                {
                    SkillData data = DataManager.Instance.GetSkill(character.BaseSkills[ii].SkillNum);
                    Skills[ii].SetText(data.GetColoredName());
                    SkillCharges[ii].SetText(character.BaseSkills[ii].Charges + "/" + (data.BaseCharges + character.ChargeBoost));
                }
                else
                {
                    Skills[ii].SetText("");
                    SkillCharges[ii].SetText("");
                }
            }
            base.ChoiceChanged();
        }
コード例 #16
0
        public void SetSong(string fileName)
        {
            string name       = "---";
            string originName = "---";
            string origin     = "---";
            string artist     = "---";

            if (File.Exists(fileName))
            {
                try
                {
                    LoopedSong song = new LoopedSong(fileName);
                    name = song.Name;
                    if (song.Tags.ContainsKey("TITLE"))
                    {
                        originName = song.Tags["TITLE"];
                    }
                    if (song.Tags.ContainsKey("ALBUM"))
                    {
                        origin = song.Tags["ALBUM"];
                    }
                    if (song.Tags.ContainsKey("ARTIST"))
                    {
                        artist = song.Tags["ARTIST"];
                    }
                }
                catch (Exception ex)
                {
                    DiagManager.Instance.LogError(new Exception("Error loading song " + fileName + "\n", ex));
                }
            }

            Name.SetText(name);
            OriginName.SetText(Text.FormatKey("MENU_SONG_ORIGIN_NAME", originName));
            Origin.SetText(Text.FormatKey("MENU_SONG_ORIGIN", origin));
            Artist.SetText(Text.FormatKey("MENU_SONG_ARTIST", artist));
        }
コード例 #17
0
        public TradeItemMenu(int defaultChoice)
        {
            int menuWidth = 152;

            AllowedGoods = new List <int>();

            int[] itemPresence = new int[DataManager.Instance.DataIndices[DataManager.DataType.Item].Count];
            for (int ii = 0; ii < itemPresence.Length; ii++)
            {
                itemPresence[ii] += DataManager.Instance.Save.ActiveTeam.Storage[ii];
            }

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

            for (int ii = 0; ii < itemPresence.Length; ii++)
            {
                int index = ii;
                if (itemPresence[index] > 0)
                {
                    ItemEntrySummary itemEntry = DataManager.Instance.DataIndices[DataManager.DataType.Item].Entries[index] as ItemEntrySummary;
                    if (itemEntry.ContainsState <MaterialState>())
                    {
                        AllowedGoods.Add(index);
                        int slot = flatChoices.Count;

                        MenuText menuText  = new MenuText(DataManager.Instance.GetItem(ii).GetIconName(), new Loc(2, 1));
                        MenuText menuCount = new MenuText("(" + itemPresence[index] + ")", new Loc(menuWidth - 8 * 4, 1), DirV.Up, DirH.Right, Color.White);
                        flatChoices.Add(new MenuElementChoice(() => { choose(slot); }, true, menuText, menuCount));
                    }
                }
            }

            defaultChoice = Math.Min(defaultChoice, flatChoices.Count - 1);
            int startChoice         = defaultChoice % SLOTS_PER_PAGE;
            int startPage           = defaultChoice / SLOTS_PER_PAGE;
            List <MenuChoice[]> inv = SortIntoPages(flatChoices, SLOTS_PER_PAGE);


            Initialize(new Loc(0, 16 + LINE_SPACE + GraphicsManager.MenuBG.TileHeight * 2), menuWidth, Text.FormatKey("MENU_STORAGE_TITLE"), inv.ToArray(), startChoice, startPage, SLOTS_PER_PAGE, false, 8);

            theirInfo = new OfferItemsMenu(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);

            theirText.SetText(NetworkManager.Instance.Activity.TargetInfo.Data.TeamName);

            CurrentState = ExchangeState.Selecting;
        }
コード例 #18
0
        public void SetDungeon(int index, bool isComplete)
        {
            ZoneEntrySummary zoneEntry = DataManager.Instance.DataIndices[DataManager.DataType.Zone].Entries[index] as ZoneEntrySummary;

            if (zoneEntry == null)
            {
                Visible = false;
            }
            else
            {
                DungeonName.SetText(zoneEntry.GetColoredName());
                DungeonName.Color = isComplete ? Color.White : Color.Cyan;
                Floors.SetText(Text.FormatKey("MENU_DUNGEON_FLOORS", (isComplete && zoneEntry.CountedFloors > 0) ? zoneEntry.CountedFloors.ToString() : "??"));

                while (Elements.Count > 3)
                {
                    Elements.RemoveAt(3);
                }

                List <MenuText> rules = new List <MenuText>();

                if (zoneEntry.NoEXP)
                {
                    rules.Add(new MenuText(Text.FormatKey("ZONE_RESTRICT_EXP"), new Loc()));
                }
                if (zoneEntry.Level > -1)
                {
                    if (zoneEntry.LevelCap)
                    {
                        rules.Add(new MenuText(Text.FormatKey("ZONE_RESTRICT_LEVEL", zoneEntry.Level), new Loc()));
                    }
                    else
                    {
                        rules.Add(new MenuText(Text.FormatKey("ZONE_EXPECT_LEVEL", zoneEntry.Level), new Loc()));
                    }
                }
                if (zoneEntry.TeamSize > -1)
                {
                    rules.Add(new MenuText(Text.FormatKey("ZONE_RESTRICT_TEAM", zoneEntry.TeamSize), new Loc(),
                                           (DataManager.Instance.Save.ActiveTeam.Players.Count > zoneEntry.TeamSize) ? Color.Red : Color.White));
                }
                if (zoneEntry.TeamRestrict)
                {
                    rules.Add(new MenuText(Text.FormatKey("ZONE_RESTRICT_ALONE"), new Loc(),
                                           (DataManager.Instance.Save.ActiveTeam.Players.Count > 1) ? Color.Red : Color.White));
                }
                if (zoneEntry.MoneyRestrict)
                {
                    rules.Add(new MenuText(Text.FormatKey("ZONE_RESTRICT_MONEY"), new Loc(),
                                           (DataManager.Instance.Save.ActiveTeam.Money > 0) ? Color.Red : Color.White));
                }
                if (zoneEntry.BagSize > -1)
                {
                    rules.Add(new MenuText(Text.FormatKey("ZONE_RESTRICT_BAG", zoneEntry.BagSize), new Loc(),
                                           (DataManager.Instance.Save.ActiveTeam.GetInvCount() > zoneEntry.BagSize) ? Color.Red : Color.White));
                }
                if (zoneEntry.BagRestrict > -1)
                {
                    rules.Add(new MenuText((zoneEntry.BagRestrict == 0) ? Text.FormatKey("ZONE_RESTRICT_ITEM_ALL") : Text.FormatKey("ZONE_RESTRICT_ITEM", zoneEntry.BagRestrict), new Loc(),
                                           (DataManager.Instance.Save.ActiveTeam.GetInvCount() > zoneEntry.BagRestrict) ? Color.Red : Color.White));
                }

                for (int ii = 0; ii < rules.Count; ii++)
                {
                    rules[ii].Loc = Bounds.Start + new Loc(GraphicsManager.MenuBG.TileWidth * 2, GraphicsManager.MenuBG.TileHeight + TitledStripMenu.TITLE_OFFSET + VERT_SPACE * (1 + ii));
                    Elements.Add(rules[ii]);
                }

                Bounds.Size = new Loc(Bounds.Size.X, GraphicsManager.MenuBG.TileHeight * 2 + TitledStripMenu.TITLE_OFFSET + VERT_SPACE * (1 + rules.Count));
            }
        }
コード例 #19
0
 public void SetTeamMode(bool teamMode)
 {
     menuText.SetText((teamMode ? Text.FormatKey("MENU_TEAM_MODE_ON") : Text.FormatKey("MENU_TEAM_MODE_OFF")));
     timeSinceUpdate = new FrameTick();
     Visible         = true;
 }
コード例 #20
0
        public override void Update(InputManager input)
        {
            bool[] charInput = new bool[TOTAL_CHARS];
            bool   shift     = (input.BaseKeyDown(Keys.LeftShift) || input.BaseKeyDown(Keys.RightShift));
            //plus shift
            int offset = (shift ? 0 : 32);

            for (int ii = 0; ii < 26; ii++)
            {
                //check all letters
                if (input.BaseKeyPressed((Keys)(ii + 65)))
                {
                    charInput['A' - 32 + offset + ii] = true;
                }
            }

            for (int ii = 0; ii < 10; ii++)
            {
                if (input.BaseKeyPressed((Keys)(48 + ii)))
                {
                    if (!shift)
                    {
                        charInput['0' - 32 + ii] = true;
                    }
                    else
                    {
                        switch (ii)
                        {
                        case 1: charInput['!' - 32] = true; break;

                        case 2: charInput['@' - 32] = true; break;

                        case 3: charInput['#' - 32] = true; break;

                        case 4: charInput['$' - 32] = true; break;

                        case 5: charInput['%' - 32] = true; break;

                        case 6: charInput['^' - 32] = true; break;

                        case 7: charInput['&' - 32] = true; break;

                        case 8: charInput['*' - 32] = true; break;

                        case 9: charInput['(' - 32] = true; break;

                        case 0: charInput[')' - 32] = true; break;
                        }
                    }
                }
                //numpad
                if (input.BaseKeyPressed((Keys)(96 + ii)))
                {
                    charInput['0' - 32 + ii] = true;
                }
            }

            if (input.BaseKeyPressed(Keys.Multiply))
            {
                charInput['*' - 32] = true;
            }
            if (input.BaseKeyPressed(Keys.Divide))
            {
                charInput['/' - 32] = true;
            }
            if (input.BaseKeyPressed(Keys.Decimal))
            {
                charInput['.' - 32] = true;
            }
            if (input.BaseKeyPressed(Keys.Add))
            {
                charInput['+' - 32] = true;
            }
            if (input.BaseKeyPressed(Keys.Subtract))
            {
                charInput['-' - 32] = true;
            }

            if (input.BaseKeyPressed(Keys.OemSemicolon))
            {
                charInput[(shift ? ':' : ';') - 32] = true;
            }
            if (input.BaseKeyPressed(Keys.OemPlus))
            {
                charInput[(shift ? '+' : '=') - 32] = true;
            }
            if (input.BaseKeyPressed(Keys.OemMinus))
            {
                charInput[(shift ? '_' : '-') - 32] = true;
            }
            if (input.BaseKeyPressed(Keys.OemComma))
            {
                charInput[(shift ? '<' : ',') - 32] = true;
            }
            if (input.BaseKeyPressed(Keys.OemPeriod))
            {
                charInput[(shift ? '>' : '.') - 32] = true;
            }
            if (input.BaseKeyPressed(Keys.OemQuestion))
            {
                charInput[(shift ? '?' : '/') - 32] = true;
            }
            if (input.BaseKeyPressed(Keys.OemTilde))
            {
                charInput[(shift ? '~' : '`') - 32] = true;
            }
            if (input.BaseKeyPressed(Keys.OemOpenBrackets))
            {
                charInput[(shift ? '{' : '[') - 32] = true;
            }
            if (input.BaseKeyPressed(Keys.OemPipe))
            {
                charInput[(shift ? '|' : '\\') - 32] = true;
            }
            if (input.BaseKeyPressed(Keys.OemCloseBrackets))
            {
                charInput[(shift ? '}' : ']') - 32] = true;
            }
            if (input.BaseKeyPressed(Keys.OemQuotes))
            {
                charInput[(shift ? '"' : '\'') - 32] = true;
            }

            //check all numbers and symbols
            if (input.BaseKeyPressed(Keys.Space))
            {
                charInput[0] = true;
            }

            bool pressAlt   = (input.BaseKeyPressed(Keys.LeftAlt) || input.BaseKeyPressed(Keys.RightAlt));
            bool pressEsc   = input.BaseKeyPressed(Keys.Escape) || input.BaseButtonPressed(Buttons.Back);
            bool pressEnter = input.BaseKeyPressed(Keys.Enter) || input.BaseButtonPressed(Buttons.Start);
            bool pressBack  = input.BaseKeyPressed(Keys.Back);

            if (PressedPaste(input))
            {
                string paste = GetRenderableString(SDL.SDL_GetClipboardText());
                if (paste != "")
                {
                    ProcessTextInput(paste);
                }
                else
                {
                    GameManager.Instance.SE("Menu/Cancel");
                }
            }
            else if (pressEnter)
            {
                Confirmed();
            }
            else if (pressEsc)
            {
                Canceled();
            }
            else if (pressAlt)
            {
                //insert will change changeable characters
                if (Text.Text.Length > 0)
                {
                    char checkChar = Text.Text[Text.Text.Length - 1];
                    if (AltChar.ContainsKey(checkChar))
                    {
                        GameManager.Instance.SE("Menu/Confirm");
                        Text.SetText(Text.Text.Substring(0, Text.Text.Length - 1) + AltChar[checkChar]);
                    }
                    else
                    {
                        GameManager.Instance.SE("Menu/Cancel");
                    }
                }
                else
                {
                    GameManager.Instance.SE("Menu/Cancel");
                }
                UpdatePickerPos();
            }
            else if (pressBack)
            {
                //backspace will erase (if there's something there)
                if (Text.Text != "")
                {
                    Text.SetText(Text.Text.Substring(0, Text.Text.Length - 1));
                }
                GameManager.Instance.SE("Menu/Cancel");
                UpdatePickerPos();
            }
            else
            {
                ProcessTextInput(GetRecentChars(charInput));
            }
        }
コード例 #21
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;
        }
コード例 #22
0
 public void SetChoice(int choice)
 {
     CurrentChoice = choice;
     Setting.SetText(TotalChoices[CurrentChoice]);
     Setting.Color = (CurrentChoice == SavedChoice) ? NormalColor : ChangedColor;
 }