public Prep_Stats_Window(Game_Unit unit) { // Stats Window initialize_window(); // Stat Labels Stats = new List <StatusPrimaryStatUINode>(); for (int i = 0; i < 8; i++) { string label, help_label; var stat_label = (Stat_Labels)i; Vector2 loc = new Vector2(8 + (i / 4) * SPACING(), 8 + (i % 4) * 16); PrimaryStatState.label(stat_label, out label, out help_label); Func <Game_Unit, PrimaryStatState> stat_formula = (Game_Unit stat_unit) => { return(new PrimaryStatState(stat_unit, stat_label)); }; Func <Game_Unit, Color> label_color = null; if (Window_Status.show_stat_colors(stat_label)) { label_color = (Game_Unit color_unit) => { return(color_unit.actor.stat_color(stat_label)); }; } Stats.Add(new StatusPrimaryStatUINode( help_label, label, stat_formula, label_color, 40)); Stats.Last().loc = loc; Stats.Last().stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH; if (stat_label == Stat_Labels.Pow) { PowNode = Stats.Last() as StatusStatUINode; } } set_images(unit); }
public Status_Page_1() { var nodes = new List <StatusUINode>(); // Stats Window Stats_Window = new System_Color_Window(); Stats_Window.loc = new Vector2(8, 80); Stats_Window.width = 144; Stats_Window.height = 112; Stats_Window.stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH; // Stats for (int i = 0; i < 6; i++) { string help_label; string label; var stat_label = (Stat_Labels)i + 1; Vector2 loc = Stats_Window.loc + new Vector2(8, i * 16 + 8); PrimaryStatState.label((Stat_Labels)i + 1, out label, out help_label); Func <Game_Unit, PrimaryStatState> stat_formula = (Game_Unit unit) => { return(new PrimaryStatState(unit, stat_label)); }; Func <Game_Unit, Color> label_color = null; if (Window_Status.show_stat_colors(stat_label)) { label_color = (Game_Unit unit) => { if (unit.average_stat_hue_shown) { return(unit.actor.stat_color(stat_label)); } return(Color.White); }; } nodes.Add(new StatusPrimaryStatUINode( help_label, label, stat_formula, label_color, 40)); nodes.Last().loc = loc; nodes.Last().stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH; #if DEBUG nodes.Last().set_cheat(stat_cheat(stat_label)); #endif if (stat_label == Stat_Labels.Pow) { PowNode = nodes.Last() as StatusStatUINode; } } // Move nodes.Add(new StatusPrimaryStatUINode( "Move", "Move", (Game_Unit unit) => { if (unit.immobile) { return new PrimaryStatState { Stat = 0, Bonus = 0, Cap = unit.stat_cap(Stat_Labels.Mov), NullStat = true, } } ; return(new PrimaryStatState { Stat = unit.base_mov, Bonus = unit.mov - unit.base_mov, Cap = unit.stat_cap(Stat_Labels.Mov), }); }, null, 40)); nodes.Last().loc = Stats_Window.loc + new Vector2(72, 0 * 16 + 8); nodes.Last().stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH; #if DEBUG nodes.Last().set_cheat(stat_cheat(Stat_Labels.Mov)); #endif // Con nodes.Add(new StatusPrimaryStatUINode( "Con", "Con", (Game_Unit unit) => { return(new PrimaryStatState { Stat = unit.actor.stat(Stat_Labels.Con), Bonus = Math.Min(unit.stat_bonus(Stat_Labels.Con), unit.actor.cap_base_difference(Stat_Labels.Con)), Cap = unit.stat_cap(Stat_Labels.Con), IsCapped = unit.actor.get_capped(Stat_Labels.Con) }); }, null, 40)); nodes.Last().loc = Stats_Window.loc + new Vector2(72, 1 * 16 + 8); nodes.Last().stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH; #if DEBUG nodes.Last().set_cheat(stat_cheat(Stat_Labels.Con)); #endif // Aid nodes.Add(new StatusAidUINode( "Aid", "Aid", (Game_Unit unit) => { return(unit.aid().ToString()); }, (Game_Unit unit) => { if (unit.actor.actor_class.Class_Types.Contains(ClassTypes.FDragon)) { return(3); } else if (unit.actor.actor_class.Class_Types.Contains(ClassTypes.Flier)) { return(2); } else if (unit.actor.actor_class.Class_Types.Contains(ClassTypes.Cavalry)) { return(1); } else { return(0); } }, 40)); nodes.Last().loc = Stats_Window.loc + new Vector2(72, 2 * 16 + 8); nodes.Last().stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH; // Trv nodes.Add(new StatusTravelerUINode( "Trv", "Trv", (Game_Unit unit) => { if (unit.is_rescued) { return(Global.game_map.units[unit.rescued].actor.name); } else if (unit.is_rescuing) { return(Global.game_map.units[unit.rescuing].actor.name); } return("---"); }, (Game_Unit unit) => { if (!unit.is_rescuing) { return(0); } return(Global.game_map.units[unit.rescuing].team); }, 24)); nodes.Last().loc = Stats_Window.loc + new Vector2(72, 3 * 16 + 8); nodes.Last().stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH; // Type nodes.Add(new StatusClassTypesUINode( "Type", "Type", (Game_Unit unit) => { return(unit.actor.class_types); }, 24)); nodes.Last().loc = Stats_Window.loc + new Vector2(72, 4 * 16 + 8); nodes.Last().stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH; // Rating nodes.Add(new StatusLabeledTextUINode( "Rating", "Rating", (Game_Unit unit) => { return(unit.rating().ToString()); }, 32)); nodes.Last().loc = Stats_Window.loc + new Vector2(72, 5 * 16 + 8); nodes.Last().Size = new Vector2(64, 16); nodes.Last().stereoscopic = Config.STATUS_LEFT_WINDOW_DEPTH; // Items Window Items_Window = new System_Color_Window(); Items_Window.loc = new Vector2(168, 80); Items_Window.width = 144; Items_Window.height = Global.ActorConfig.NumItems * 16 + 16; Items_Window.stereoscopic = Config.STATUS_RIGHT_WINDOW_DEPTH; // Skill Bg SiegeBg = new Status_Support_Background(); SiegeBg.loc = Items_Window.loc + new Vector2( 8, 8 + (Global.ActorConfig.NumItems - 1) * 16); SiegeBg.stereoscopic = Config.STATUS_RIGHT_WINDOW_DEPTH; SiegeBg.visible = false; // Items for (int i = 0; i < Global.ActorConfig.NumItems; i++) { int j = i; Vector2 loc = Items_Window.loc + new Vector2(8, i * 16 + 8); nodes.Add(new StatusItemUINode( string.Format("Item{0}", i + 1), (Game_Unit unit) => { return(new ItemState { Item = unit.actor.items[j], Drops = unit.drops_item && j == unit.actor.num_items - 1, Equipped = unit.actor.equipped - 1 == j }); })); nodes.Last().loc = loc; nodes.Last().stereoscopic = Config.STATUS_RIGHT_WINDOW_DEPTH; Func <Game_Unit, DirectionFlags, bool> item_cheat = (unit, dir) => { // Uses if (dir.HasFlag(DirectionFlags.Up) || dir.HasFlag(DirectionFlags.Down)) { if (unit.actor.items[j].non_equipment || unit.actor.items[j].infinite_uses) { return(false); } int uses = unit.actor.items[j].Uses; if (dir.HasFlag(DirectionFlags.Up)) { uses++; } else { uses--; } uses = Math.Max(Math.Min( uses, unit.actor.items[j].max_uses), 1); if (uses == unit.actor.items[j].Uses) { return(false); } unit.actor.items[j].Uses = uses; return(true); } else { // Change item if (unit.actor.items[j].is_weapon) { List <int> weapon_keys = Global.data_weapons.Keys.ToList(); int index = weapon_keys.IndexOf(unit.actor.items[j].Id); if (dir.HasFlag(DirectionFlags.Right)) { index++; } else if (dir.HasFlag(DirectionFlags.Left)) { index--; } else { return(false); } index = (index + weapon_keys.Count) % weapon_keys.Count; unit.actor.items[j].Id = weapon_keys[index]; unit.actor.setup_items(false); } else { List <int> item_keys = Global.data_items.Keys.ToList(); int index = item_keys.IndexOf(unit.actor.items[j].Id); if (dir.HasFlag(DirectionFlags.Right)) { index++; } else if (dir.HasFlag(DirectionFlags.Left)) { index--; } else { return(false); } index = (index + item_keys.Count) % item_keys.Count; unit.actor.items[j].Id = item_keys[index]; } if (unit.actor.items[j].infinite_uses) { unit.actor.items[j].Uses = -1; } else { if (unit.actor.items[j].Uses == -1) { unit.actor.items[j].Uses = 1; } } return(true); } }; #if DEBUG nodes.Last().set_cheat(item_cheat); #endif } // Siege engine Vector2 siege_loc = Items_Window.loc + new Vector2(8, (Global.ActorConfig.NumItems - 1) * 16 + 8 + 2); nodes.Add(new StatusSiegeItemUINode( string.Format("Item{0}", Global.ActorConfig.NumItems + 1), (Game_Unit unit) => { Item_Data siege = new Item_Data(); if (!unit.actor.is_full_items && unit.is_on_siege()) { siege = unit.items[Siege_Engine.SiegeInventoryIndex]; } return(new ItemState { Item = siege, Drops = false, Equipped = false }); })); nodes.Last().loc = siege_loc; nodes.Last().stereoscopic = Config.STATUS_RIGHT_WINDOW_DEPTH; StatusPageNodes = new UINodeSet <StatusUINode>(nodes); init_design(); }