public override bool Update() { if (IGM_Junction != null && !IGM_Junction.GetMode().Equals(Mode.Abilities_Commands)) { Cursor_Status &= ~Cursor_Status.Enabled; } else { Cursor_Status |= Cursor_Status.Enabled; } int pos = 0; int skip = Page * Rows; for (int i = 0; Memory.State.Characters != null && i < Memory.State.Characters[Character].UnlockedGFAbilities.Count && pos < Rows; i++) { if (Memory.State.Characters[Character].UnlockedGFAbilities[i] != Kernel_bin.Abilities.None) { Kernel_bin.Abilities j = (Memory.State.Characters[Character].UnlockedGFAbilities[i]); if (Source.ContainsKey(j) && skip-- <= 0) { Font.ColorID cid = Memory.State.Characters[Character].Commands.Contains(j) ? Font.ColorID.Grey : Font.ColorID.White; BLANKS[pos] = cid == Font.ColorID.Grey ? true : false; ITEM[pos, 0] = new IGMDataItem_String( Icons.ID.Ability_Command, 9, Source[j].Name, new Rectangle(SIZE[pos].X, SIZE[pos].Y, 0, 0), cid); Contents[pos] = j; pos++; } } } for (; pos < Rows; pos++) { ITEM[pos, 0] = null; BLANKS[pos] = true; Contents[pos] = Kernel_bin.Abilities.None; } if (Contents[CURSOR_SELECT] != Kernel_bin.Abilities.None && IGM_Junction.GetMode().Equals(Mode.Abilities_Commands)) { IGM_Junction.ChangeHelp(Source[Contents[CURSOR_SELECT]].Description); } UpdateTitle(); if (Contents[CURSOR_SELECT] == Kernel_bin.Abilities.None) { CURSOR_NEXT(); } if (Pages > 1) { if (Contents[0] == Kernel_bin.Abilities.None) { Pages = Page; PAGE_NEXT(); return(Update()); } else if (Contents[Rows - 1] == Kernel_bin.Abilities.None) { Pages = Page + 1; } } return(base.Update()); }
public override bool Update() { if (InGameMenu_Junction != null && InGameMenu_Junction.GetMode() != Mode.Abilities_Abilities) { Cursor_Status &= ~Cursor_Status.Enabled; } else { Cursor_Status |= Cursor_Status.Enabled; } int pos = 0; int skip = Page * rows; for (int i = 0; Memory.State.Characters != null && i < Memory.State.Characters[Character].UnlockedGFAbilities.Count && pos < rows; i++) { if (Memory.State.Characters[Character].UnlockedGFAbilities[i] != Kernel_bin.Abilities.None) { Kernel_bin.Abilities j = Memory.State.Characters[Character].UnlockedGFAbilities[i]; if (Source.ContainsKey(j)) { if (skip > 0) { skip--; continue; } Font.ColorID cid = Memory.State.Characters[Character].Abilities.Contains(j) ? Font.ColorID.Grey : Font.ColorID.White; BLANKS[pos] = cid == Font.ColorID.Grey ? true : false; ITEM[pos, 0] = new IGMDataItem_String( Source[j].Icon, 9, Source[j].Name, new Rectangle(SIZE[pos].X, SIZE[pos].Y, 0, 0), cid); Contents[pos] = j; pos++; } } } for (; pos < rows; pos++) { ITEM[pos, 0] = null; BLANKS[pos] = true; Contents[pos] = Kernel_bin.Abilities.None; } if (Contents[CURSOR_SELECT] != Kernel_bin.Abilities.None && InGameMenu_Junction.GetMode() == Mode.Abilities_Abilities) { InGameMenu_Junction.ChangeHelp(Source[Contents[CURSOR_SELECT]].Description.ReplaceRegion()); } UpdateTitle(); if (Contents[CURSOR_SELECT] == Kernel_bin.Abilities.None) { CURSOR_NEXT(); } if (Pages > 1) { if (Contents[0] == Kernel_bin.Abilities.None) { Pages = Page; PAGE_NEXT(); return(Update()); } else if (Contents[rows - 1] == Kernel_bin.Abilities.None) { Pages = Page + 1; } } return(base.Update()); }
public void Draw(int number, NumType type, int palette, string format, Vector2 location, Vector2 scale, float fade = 1f, Font.ColorID color = Font.ColorID.White, bool blink = false) { if (type == NumType.sysfnt) { Memory.font.RenderBasicText(number.ToString(), location.ToPoint(), scale, Font.Type.sysfnt, Fade: fade, color: color, blink: blink); return; } else if (type == NumType.sysFntBig) { Memory.font.RenderBasicText(number.ToString(), location.ToPoint(), scale, Font.Type.sysFntBig, Fade: fade, color: color, blink: blink); return; } else if (type == NumType.menuFont) { Memory.font.RenderBasicText(number.ToString(), location.ToPoint(), scale, Font.Type.menuFont, Fade: fade, color: color, blink: blink); return; } ID[] numberstarts = { ID.Num_8x8_0_0, ID.Num_8x8_1_0, ID.Num_8x8_2_0, ID.Num_8x16_0_0, ID.Num_8x16_1_0, ID.Num_16x16_0_0 }; List <ID>[] nums = new List <ID> [numberstarts.Length]; int j = 0; foreach (ID id in numberstarts) { nums[j] = new List <ID>(10); for (byte i = 0; i < 10; i++) { nums[j].Add(id + i); } j++; } IEnumerable <int> intList = number.ToString(format).Select(digit => int.Parse(digit.ToString())); Rectangle dst = new Rectangle { Location = location.ToPoint() }; foreach (int i in intList) { Draw(nums[(int)type][i], palette, dst, scale, fade, blink ? Color.Lerp(Font.ColorID2Color[color], Font.ColorID2Blink[color], Menu.Blink_Amount) : Font.ColorID2Color[color]); dst.Offset(Entries[nums[(int)type][i]].GetRectangle.Width * scale.X, 0); } }
private void AddGFs(ref int pos, ref int skip, System.Func <GFs, bool> predicate, Font.ColorID colorid = Font.ColorID.White, bool blank = false) { foreach (GFs g in UnlockedGFs.Where(predicate)) { if (!AddGF(ref pos, ref skip, g, colorid, blank)) { break; } } }
public Color[] GetClutColors(Font.ColorID clut) => GetClutColors((ushort)clut);
public override void ReInit() { if (!eventSet && InGameMenu_Items != null) { InGameMenu_Items.ModeChangeHandler += ModeChangeEvent; InGameMenu_Items.ReInitCompletedHandler += ReInitCompletedEvent; eventSet = true; } base.ReInit(); Source = Memory.State; if (Source != null && Source.Items != null) { ((IGMDataItem_Box)CONTAINER).Title = Pages <= 1 ? (Icons.ID?)Icons.ID.ITEM : (Icons.ID?)(Icons.ID.ITEM_PG1 + (byte)Page); byte pos = 0; int skip = Page * rows; for (byte i = 0; pos < rows && i < Source.Items.Count; i++) { Saves.Item item = Source.Items[i]; if (item.ID == 0 || item.QTY == 0) { continue; // skip empty values. } if (skip-- > 0) { continue; //skip items that are on prev pages. } Item_In_Menu itemdata = item.DATA ?? new Item_In_Menu(); if (itemdata.ID == 0) { continue; // skip empty values. } Font.ColorID color = Font.ColorID.White; byte palette = itemdata.Palette; if (!itemdata.ValidTarget()) { color = Font.ColorID.Grey; BLANKS[pos] = true; palette = itemdata.Faded_Palette; } else { BLANKS[pos] = false; } ((IGMDataItem_String)(ITEM[pos, 0])).Data = itemdata.Name; ((IGMDataItem_String)(ITEM[pos, 0])).Icon = itemdata.Icon; ((IGMDataItem_String)(ITEM[pos, 0])).Palette = palette; ((IGMDataItem_String)(ITEM[pos, 0])).Colorid = color; ((IGMDataItem_Int)(ITEM[pos, 1])).Data = item.QTY; ((IGMDataItem_Int)(ITEM[pos, 1])).Show(); ((IGMDataItem_Int)(ITEM[pos, 1])).Colorid = color; _helpStr[pos] = itemdata.Description; Contents[pos] = itemdata; pos++; } for (; pos < rows; pos++) { ((IGMDataItem_Int)(ITEM[pos, 1])).Hide(); if (pos == 0) { return; // if page turning. this till be enough to trigger a try next page. } ((IGMDataItem_String)(ITEM[pos, 0])).Data = null; ((IGMDataItem_Int)(ITEM[pos, 1])).Data = 0; ((IGMDataItem_String)(ITEM[pos, 0])).Icon = Icons.ID.None; BLANKS[pos] = true; } } }