public void set_actor(Game_Actor actor) { reset(); if (actor != null) { string actor_name = actor.face_name; if (!Global.content_exists(@"Graphics/Faces/" + actor_name)) { if (Global.content_exists(@"Graphics/Faces/" + actor_name.Split(Global.ActorConfig.ActorNameDelimiter)[0])) { actor_name = actor_name.Split(Global.ActorConfig.ActorNameDelimiter)[0]; } } if (Global.content_exists(@"Graphics/Faces/" + actor_name)) { SetFilename(actor_name); } // Generic background/flags if (actor.generic_face) { Mirrored = false; Bg_Texture = Global.Content.Load <Texture2D>(@"Graphics/Faces/Countries/Default_Miniface"); Bg_Rect = new Rectangle(32 * actor.tier, 0, 32, 32); Flag_Texture = flag_texture(actor); Flag_Rect = new Rectangle(32 * actor.build, 0, 32, 32); } } }
public void activate_home_base(string background) { if (!Global.game_system.preparations) { Global.game_actors.heal_battalion(); Global.game_system.preparations = true; Global.game_system.home_base = true; Global.game_temp.menuing = true; if (!Global.content_exists(@"Graphics/Panoramas/" + background)) { background = DEFAULT_HOME_BASE_BACKGROUND; } Global.game_system.home_base_background = background; Global.battalion.enter_home_base(); if (Constants.Support.BASE_COUNTS_AS_SEPARATE_CHAPTER) { Global.game_state.reset_support_data(); } MapMenu = new HomeBaseMenuManager(this); start_preparations(); } }
public string BattlerName(string weaponType) { int gender = this.Gender; string className = this.ClassNameFull; string name; // Check if the unit has a personal sprite name = this.NameFull + "-" + className + gender.ToString(); if (!Global.content_exists(@"Graphics/Animations/" + name + "-" + weaponType)) { // Check for a generic sprite based on class/gender name = className + gender.ToString(); if (!Global.content_exists(@"Graphics/Animations/" + name + '-' + weaponType)) { // Use generic base gender sprite based on class/base gender gender %= 2; name = className + gender.ToString(); if (!Global.content_exists(@"Graphics/Animations/" + name + '-' + weaponType)) { return(""); } } } return(name); }
protected virtual Texture2D background(Game_Unit battler) { const string background_format = @"Graphics/Battlebacks/{0}-BG"; // Checks if the map has a forced background for this tile string terrain_name = Global.game_map.forced_battleback(battler.loc); if (!string.IsNullOrEmpty(terrain_name)) { if (Global.content_exists(string.Format(background_format, terrain_name))) { return(battle_content.Load <Texture2D>(string.Format(background_format, terrain_name))); } } // Else loads based on terrain type int tag = battler.terrain_id(); Texture2D result; // Check for background terrain_name = Global.data_terrains[tag].BackgroundName; result = terrain_texture(background_format, terrain_name); if (result != null) { return(result); } return(battle_content.Load <Texture2D>(string.Format(background_format, "Plains"))); }
public virtual void set_image(Game_Actor actor, Item_Data item_data) { if (item_data.non_equipment) { Icon.texture = null; Name.text = ""; Uses.text = ""; Slash.text = ""; Use_Max.text = ""; } else { Data_Equipment item = item_data.to_equipment; // Icon if (Global.content_exists(@"Graphics/Icons/" + item.Image_Name)) { Icon.texture = Global.Content.Load <Texture2D>(string.Format(@"Graphics/Icons/{0}", item.Image_Name)); Icon.columns = (int)(Icon.texture.Width / Icon.size.X); } Icon.index = item.Image_Index; // Name Name.text = item.Name; // Uses Uses.text = item_data.Uses < 0 ? "--" : item_data.Uses.ToString(); Slash.text = "/"; Use_Max.text = item.Uses < 0 ? "--" : item.Uses.ToString(); set_text_color(actor, item); } }
protected void next_animation() { while (Anim_Index < Ids.Count) { Anim_Index++; if (Global.data_animations.ContainsKey(id)) { Data = Global.data_animations[id]; if (Use_Animation_Texture) { // Uses the texture from the first animation in the animation list Filename = Data.filename; if (Global.content_exists(@"Graphics/Animations/" + Filename)) { this.texture = Global.Battler_Content.Load <Texture2D>(@"Graphics/Animations/" + Filename); } if (Filename.Contains('\\')) { #if DEBUG System.Console.WriteLine(string.Format( "Animation filename with backslash, standardize to forward slashes: \"{0}\"", Filename)); #endif string[] str_ary = Filename.Split('\\'); Filename = str_ary.Last(); } else { string[] str_ary = Filename.Split('/'); Filename = str_ary.Last(); } if (this.texture != null) { refresh_palette(Filename); } } if (Data.frame_count > 0) { break; } Data = null; } else { Data = null; } } if (Data == null) { Finished = true; } Frame = 0; Frame_Timer = 0; Anim_Timer = 0; update_sounds(); }
public void set_images(Game_Unit unit, bool full_inventory, bool drops_item) { Game_Actor actor = unit.actor; Icons.Clear(); if (full_inventory) { Weapon_Name.text = ""; int equipped = -1; // Show siege engine first if possible and inventory has space if (!actor.is_full_items && unit.is_on_siege()) { var siege = unit.items[Siege_Engine.SiegeInventoryIndex]; if (siege.is_weapon) { add_icon(siege, Siege_Engine.SiegeInventoryIndex, actor.num_items, false); } } if (equipped_first() && actor.equipped != 0) { equipped = actor.equipped - 1; add_icon(actor.items[equipped], equipped, actor.num_items, drops_item); } for (int i = 0; i < actor.items.Count; i++) { if (i == equipped) { continue; } add_icon(actor.items[i], i, actor.num_items, drops_item); } } else { if (actor.weapon == null) { Weapon_Name.text = "Unarmed"; } else { Data_Weapon item = actor.weapon; Weapon_Name.text = item.Name; Icons.Add(new Item_Icon_Sprite()); if (Global.content_exists(@"Graphics/Icons/" + item.Image_Name)) { Icons[Icons.Count - 1].texture = Global.Content.Load <Texture2D>(@"Graphics/Icons/" + item.Image_Name); } Icons[Icons.Count - 1].index = item.Image_Index; Icons[Icons.Count - 1].loc = new Vector2(0, 0); Icons[Icons.Count - 1].scissor = scissor(); } } }
public static void LoadChapterText(string filename) { if (Global.content_exists(@"Data/Text/" + filename)) { Global.chapter_text = Global.Chapter_Text_Content.Load <TextData>(@"Data/Text/" + filename).Text; } else { Global.chapter_text = new Dictionary <string, string>(); } }
protected void load_class(Class_Reel_Data data) { // Sets up actor Unit = Game_Unit.class_reel_unit();// new Game_Unit(); //Debug Unit.actor.name = data.Name; Unit.actor.gender = data.Gender; Unit.actor.class_id = data.Class_Id; Unit.actor.weapon_id = data.Weapon_Id; Unit.magic_attack = Unit.check_magic_attack(Global.data_weapons[data.Weapon_Id], data.Distance); Stats = new int[7]; for (int i = 0; i < 7; i++) { int j = i + (Class_Reel_Data.SKIP_LCK && i >= (int)Tactile.Stat_Labels.Lck ? 1 : 0); switch (data.Stat_Type) { case Reel_Generic_Stats.Actor: Game_Actor actor = Global.game_actors[data.Stats[0]]; if (j == 0) { Stats[0] = actor.hp; } else { Stats[i] = actor.stat(j); } break; case Reel_Generic_Stats.Class: Data_Class data_class = Global.data_classes[data.Class_Id]; Stats[i] = data_class.Generic_Stats[(int)Generic_Builds.Normal][0][j]; break; case Reel_Generic_Stats.Listed: Stats[i] = data.Stats[j]; break; } } Attack_Count = data.Num_Attacks; // Platform Terrain_Tag = data.Platform; string terrain_name = Global.data_terrains[Terrain_Tag].PlatformName; if (Global.content_exists(@"Graphics/Battlebacks/" + terrain_name + "-Melee")) { Platform.platform_1 = Global.Content.Load <Texture2D>(@"Graphics/Battlebacks/" + terrain_name + "-Melee"); } else { Platform.platform_1 = Global.Content.Load <Texture2D>(@"Graphics/Battlebacks/" + "Plains" + "-Melee"); } Platform.platform_2 = Platform.platform_1; }
public Anim_Sprite_Data AnimName(string weaponType) { int gender = this.Gender; if (string.IsNullOrEmpty(weaponType)) { return new Anim_Sprite_Data { name = "", gender = gender } } ; string className = this.ClassNameFull; string name; // Check if the unit has a personal sprite //name = unit.actor.name_full + "-" + className + //Debug // gender.ToString() + "-" + weapon; name = string.Format("{0}-{1}{2}-{3}", this.NameFull, className, gender, weaponType); if (!Global.content_exists(@"Graphics/Animations/" + name)) { // Check for a generic sprite based on class/gender name = className + gender.ToString() + '-' + weaponType; if (!Global.content_exists(@"Graphics/Animations/" + name)) { // Use generic base gender sprite based on class/base gender gender %= 2; name = className + gender.ToString() + '-' + weaponType; if (!Global.content_exists(@"Graphics/Animations/" + name)) { // Try one last time with the other gender, to at least show something gender = 1 - gender; name = className + gender.ToString() + '-' + weaponType; if (!Global.content_exists(@"Graphics/Animations/" + name)) { return new Anim_Sprite_Data { name = "", gender = gender } } ; } } } return(new Anim_Sprite_Data { name = name, gender = gender }); }
/// <summary> /// Returns a full map sprite name, corrected to an existing value and with a postfix for moving. /// </summary> public static string map_sprite_name( string name, bool moving) { name += moving ? "_move" : ""; if (!Global.content_exists(@"Graphics/Characters/" + name)) { name = Scene_Map.DEFAULT_MAP_SPRITE + (moving ? "_move" : ""); //name = Scene_Map.DEFAULT_MAP_SPRITE + (name.Substring(name.Length - 5, 5) == "_move" ? "_move" : ""); //Debug } return(name); }
private void add_events(string name) { bool event_exists = Global.content_exists(EVENTS_PATH + name); #if DEBUG System.Diagnostics.Debug.Assert(event_exists, string.Format("Event data file \"{0}\" does not exist", name)); #endif if (event_exists) { var event_data = Global.Chapter_Text_Content.Load <Map_Event_Data>(EVENTS_PATH + name); Event_Data.Events.AddRange(event_data.Events); } }
private Texture2D terrain_texture(string format, string terrain_name, string range = "") { if (Global.content_exists(string.Format(format, terrain_name + "_" + Global.game_map.tileset_battleback_suffix, range))) { return(battle_content.Load <Texture2D>(string.Format(format, terrain_name + "_" + Global.game_map.tileset_battleback_suffix, range))); } else if (Global.content_exists(string.Format(format, terrain_name, range))) { return(battle_content.Load <Texture2D>(string.Format(format, terrain_name, range))); } return(null); }
public static string class_map_sprite_name( string className, int gender) { string name = "Map" + className; string result = name + (gender % 2 == 0 ? "M" : "F"); if (gender % 2 != 0 && !Global.content_exists(@"Graphics/Characters/" + result)) { gender = (gender / 2) * 2; return(class_map_sprite_name(className, gender)); } return(result); }
protected Texture2D flag_texture(Game_Actor actor) { string flag = actor.flag_name; string format = @"Graphics/Faces/Countries/{0}"; if (Global.content_exists(string.Format(format, flag))) { return(Global.Content.Load <Texture2D>(string.Format(format, flag))); } #if !DEBUG else if (Global.content_exists(string.Format(format, DEFAULT_FLAGS))) { return(Global.Content.Load <Texture2D>(string.Format(format, DEFAULT_FLAGS))); } #endif return(null); }
public void set_actor(string actor_name) { reset(); if (!Global.content_exists(@"Graphics/Faces/" + actor_name)) { if (Global.content_exists(@"Graphics/Faces/" + actor_name.Split(Global.ActorConfig.ActorNameDelimiter)[0])) { actor_name = actor_name.Split(Global.ActorConfig.ActorNameDelimiter)[0]; } else { return; } } SetFilename(actor_name); }
protected void add_icon(Item_Data item_data, int index, int numItems, bool drops_item) { if (item_data.Id > 0) { Data_Equipment item = item_data.to_equipment; Icons.Add(new Item_Icon_Sprite()); if (Global.content_exists(@"Graphics/Icons/" + item.Image_Name)) { Icons[Icons.Count - 1].texture = Global.Content.Load <Texture2D>(@"Graphics/Icons/" + item.Image_Name); } Icons[Icons.Count - 1].index = item.Image_Index; Icons[Icons.Count - 1].loc = new Vector2((Icons.Count - 1) * 16, 0); Icons[Icons.Count - 1].flash_color = new Color(72, 232, 32, 255); Icons[Icons.Count - 1].flash_time_max = 120; //Icons[Icons.Count - 1].flash = (unit.drops_item && i == unit.actor.num_items - 1); //Debug Icons[Icons.Count - 1].flash = (drops_item && index == numItems - 1); Icons[Icons.Count - 1].scissor = scissor(); } }
public Unit_Page_3(Game_Unit unit) { // Inventory Inventory = new Unit_Window_Inventory(); Inventory.set_images(unit); // Skills foreach (int i in unit.actor.skills) { Skill_Icons.Add(new Icon_Sprite()); if (Global.content_exists(@"Graphics/Icons/" + Global.data_skills[i].Image_Name)) { Skill_Icons[Skill_Icons.Count - 1].texture = Global.Content.Load <Texture2D>(@"Graphics/Icons/" + Global.data_skills[i].Image_Name); } Skill_Icons[Skill_Icons.Count - 1].size = new Vector2(Config.SKILL_ICON_SIZE, Config.SKILL_ICON_SIZE); Skill_Icons[Skill_Icons.Count - 1].loc = new Vector2( 104 + (Skill_Icons.Count - 1) * Config.SKILL_ICON_SIZE, (16 - Config.SKILL_ICON_SIZE) / 2); Skill_Icons[Skill_Icons.Count - 1].index = Global.data_skills[i].Image_Index; } }
public virtual void set_image(Game_Actor actor, Item_Data item_data, int stock, int price) { Data_Equipment item = item_data.to_equipment; if (Global.content_exists(@"Graphics/Icons/" + item.Image_Name)) { Icon.texture = Global.Content.Load <Texture2D>(string.Format(@"Graphics/Icons/{0}", item.Image_Name)); Icon.columns = (int)(Icon.texture.Width / Icon.size.X); } Icon.index = item.Image_Index; // Name Name.text = item.Name; // Uses Uses.text = item_data.Uses < 0 ? "--" : item_data.Uses.ToString(); Slash.text = price.ToString(); Use_Max.text = stock < 0 ? "--" : stock.ToString(); // Num owned in battalion Convoy.text = Global.battalion.item_count(item_data).ToString(); set_text_color(actor, item, item_data, price); }
protected void initialize(List <int> skill_ids, bool battle_scene) { #if DEBUG if (skill_ids.Count > 1) { } //throw new System.Exception(); #endif Width = 80 + skill_ids.Count * Config.SKILL_ICON_SIZE; Timer_Max = 97; if (battle_scene) { texture = Global.Content.Load <Texture2D>(@"Graphics/Windowskins/Combat_Popup"); } else { Window = new System_Color_Window(); Window.width = Width; Window.height = 32; } // Skill icons Icons = new List <Icon_Sprite>(); for (int i = 0; i < skill_ids.Count; i++) { var icon = new Icon_Sprite(); if (Global.content_exists(@"Graphics/Icons/" + Global.data_skills[skill_ids[i]].Image_Name)) { icon.texture = Global.Content.Load <Texture2D>(@"Graphics/Icons/" + Global.data_skills[skill_ids[i]].Image_Name); } icon.size = new Vector2(Config.SKILL_ICON_SIZE, Config.SKILL_ICON_SIZE); icon.loc = (new Vector2(16) - icon.size / 2) + new Vector2(Config.SKILL_ICON_SIZE * i, 0); icon.index = Global.data_skills[skill_ids[i]].Image_Index; Icons.Add(icon); } // Text Text = new TextSprite(); Text.loc = new Vector2(8 + skill_ids.Count * Config.SKILL_ICON_SIZE, 8); Text.SetFont(Config.UI_FONT, Global.Content, "White"); Text.text = "Skill acquired."; }
public void set(string name, int lord_id, TactileLibrary.Preset_Chapter_Data data) { // Chapter Chapter.text = name; // Lord_Lvl int level = data.Lord_Lvl; if (level == 0) { if (Global.data_actors.ContainsKey(lord_id)) { level = Global.data_actors[lord_id].Level; } } Lord_Lvl.text = level.ToString(); // Unit_Count Unit_Count.text = data.Units.ToString(); // Gold Gold.text = data.Gold.ToString(); // Play Time Counter Counter = new Play_Time_Counter(data.Playtime); Counter.loc = new Vector2(40, 24); // Lord if (Global.content_exists(string.Format(@"Graphics/Characters/{0}", Global.game_actors[lord_id].map_sprite_name))) { Lord_Sprite.texture = Global.Content.Load <Texture2D>( string.Format(@"Graphics/Characters/{0}", Global.game_actors[lord_id].map_sprite_name)); } else { Lord_Sprite.texture = Global.Content.Load <Texture2D>( string.Format(@"Graphics/Characters/{0}", Scene_Map.DEFAULT_MAP_SPRITE)); } if (Lord_Sprite.texture != null) { Lord_Sprite.offset = new Vector2( (Lord_Sprite.texture.Width / Lord_Sprite.frame_count) / 2, (Lord_Sprite.texture.Height / Lord_Sprite.facing_count) - 8); } }
public virtual void set_image(Game_Actor actor, Data_Equipment item) { if (item == null) { Icon.texture = null; Name.text = "-----"; } else { // Icon if (Global.content_exists(@"Graphics/Icons/" + item.Image_Name)) { Icon.texture = Global.Content.Load <Texture2D>(string.Format(@"Graphics/Icons/{0}", item.Image_Name)); } Icon.index = item.Image_Index; Icon.columns = (int)(Icon.texture.Width / Icon.size.X); // Name Name.text = item.Name; set_text_color(actor, item); } }
public override void set_map(string chapter_id, string map_data_key, string unit_data_key, string event_data_key) { if (string.IsNullOrEmpty(Save_Name)) { if (!string.IsNullOrEmpty(chapter_id)) { Save_Name = chapter_id; } Map_Data_Key = map_data_key; UnitDataKey = unit_data_key; } // Set difficulty Global.game_system.Difficulty_Mode = Difficulty_Modes.Normal; foreach (var pair in Constants.Difficulty.DIFFICULTY_SAVE_APPEND) { if (Save_Name.EndsWith("" + pair.Value)) { Global.game_system.Difficulty_Mode = pair.Key; break; } } chapter_id = ""; /* //Debug * if (Unit_Data != null) * { * HashSet<Vector2> keys = new HashSet<Vector2>(); * keys.UnionWith(Unit_Data.Units.Keys); * Dictionary<Vector2, Data_Unit> fgdsf = new Dictionary<Vector2, Data_Unit>(); * foreach (Vector2 key in keys) * //for (int i = 0; i < keys.Count; i++) * { * Data_Unit unit = Unit_Data.Units[key]; * fgdsf[key + new Vector2(2, 2)] = unit; * } * //Unit_Data.Units = fgdsf; * } */ Global.game_battalions = new Game_Battalions(); Global.game_battalions.add_battalion(0); Global.game_battalions.current_battalion = 0; Global.game_actors = new Game_Actors(); while (Global.game_map.units.Count > 0) { Global.game_map.remove_unit(Global.game_map.units.First().Key); } bool new_map = _unitData == null; reset_map(new_map); // Map Data Data_Map map_data; if (Map_Data_Key == "") { map_data = new Data_Map(); } else { Data_Map loaded_map_data = get_map_data(Map_Data_Key); map_data = new Data_Map(loaded_map_data.values, loaded_map_data.GetTileset()); } // Unit Data if (!string.IsNullOrEmpty(unit_data_key) && _unitData == null) { if (Global.content_exists(string.Format(@"Data/Map Data/Unit Data/{0}", UnitDataKey))) { _unitData = Map_Content[0].Load <Map_Unit_Data>(string.Format(@"Data/Map Data/Unit Data/{0}", UnitDataKey)); } else if (_unitData == null) { _unitData = new Map_Unit_Data(); } LastSavedUnitData = new Map_Unit_Data(_unitData); } // Event Data Global.game_state.setup(chapter_id, map_data, _unitData, event_data_key); if (Global.test_battler_1.Generic) { Global.test_battler_1.Actor_Id = Global.game_actors.next_actor_id(); } set_map_texture(); if (new_map) { Global.player.center(); Global.game_system.Instant_Move = true; Global.game_state.update(); Global.game_system.update(); } else { Global.game_map.highlight_test(); } }