public void draw(SpriteBatch sprite_batch) { sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null); Black_Fill.draw(sprite_batch); Burst.draw(sprite_batch); sprite_batch.End(); Rectangle scissor_rect = new Rectangle(Banner_Scissor_Rect.X + (int)Stereoscopic_Graphic_Object.graphic_draw_offset(Config.RANKING_BANNER_DEPTH).X, Banner_Scissor_Rect.Y, Banner_Scissor_Rect.Width, Banner_Scissor_Rect.Height); sprite_batch.GraphicsDevice.ScissorRectangle = Scene_Map.fix_rect_to_screen(scissor_rect); sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, new RasterizerState { ScissorTestEnable = true }); Banner.draw(sprite_batch); sprite_batch.End(); sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null); Window_Img.draw(sprite_batch); if (Window_Img.visible) { foreach (TextSprite text in Text) { text.draw(sprite_batch, -Window_Img.loc); } } Rank.draw(sprite_batch); White_Screen.draw(sprite_batch); sprite_batch.End(); }
protected void update_movement() { if (moving) { Waypoint_Length += Movement_Speed; loc = Worldmap_Arrow.point_along_route(Waypoint_Length, Waypoints); if (loc == Waypoints[Waypoints.Length - 1]) { if (Unit_Queue.Count == 0) { Highlighted = false; } Waypoints = null; Scene_Map.refresh_map_sprite(Unit_Sprite, Team, Filename, false); process_unit_queue(); return; } else if (Unit_Queue.Count > 0 && Unit_Queue[0].Key == Worldmap_Unit_Queue.Remove && Worldmap_Arrow.point_along_route(Waypoint_Length, Waypoints) == Waypoints[Waypoints.Length - 1]) { remove((bool)Unit_Queue[0].Value); Unit_Queue.RemoveAt(0); } update_movement_facing(); } }
public Worldmap_Unit(int team, string filename) { Team = team; Filename = filename; Unit_Sprite = new Character_Sprite(); Unit_Sprite.draw_offset = WORLDMAP_UNIT_OFFSET; Scene_Map.refresh_map_sprite(Unit_Sprite, Team, Filename, false); }
public override void Draw(SpriteBatch spriteBatch) { if (_Visible) { draw_background(spriteBatch); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); Darkened_Bar.draw(spriteBatch); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); Portrait_Bg.draw(spriteBatch); if (Portrait_Label != null) { Portrait_Label.draw(spriteBatch); } spriteBatch.End(); Face.draw(spriteBatch); draw_window(spriteBatch); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); Gold_Window.draw(spriteBatch); Gold_Data.draw(spriteBatch); Gold_G.draw(spriteBatch); spriteBatch.End(); spriteBatch.GraphicsDevice.ScissorRectangle = Scene_Map.fix_rect_to_screen(Item_Rect); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, Item_State); //foreach (Shop_Item item in Item_Data) //Debug { }//item.draw(sprite_batch, new Vector2(0, Scroll_Real)); //Debug spriteBatch.End(); Message.draw_background(spriteBatch); Message.draw_faces(spriteBatch); Message.draw_foreground(spriteBatch); if (Choices != null) { spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); Choices.Draw(spriteBatch); Cursor.draw(spriteBatch); spriteBatch.End(); } } spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); Black_Screen.draw(spriteBatch); spriteBatch.End(); }
protected void process_unit_queue() { while (Unit_Queue.Count > 0) { var unit_action = Unit_Queue[0]; Unit_Queue.RemoveAt(0); switch (unit_action.Key) { case Worldmap_Unit_Queue.Move: Waypoint_Length = 0; Movement_Speed = ((KeyValuePair <float, Vector2[]>)unit_action.Value).Key; Vector2[] waypoints = ((KeyValuePair <float, Vector2[]>)unit_action.Value).Value; Waypoints = new Vector2[waypoints.Length + 1]; Waypoints[0] = loc; for (int i = 0; i < waypoints.Length; i++) { Waypoints[i + 1] = waypoints[i]; } for (int i = 1; i < Waypoints.Length; i++) { Waypoint_Total_Length += (Waypoints[i] - Waypoints[i - 1]).Length(); } Scene_Map.refresh_map_sprite(Unit_Sprite, Team, Filename, true); return; case Worldmap_Unit_Queue.Idle: Highlighted = false; break; case Worldmap_Unit_Queue.Pose: Highlighted = true; break; case Worldmap_Unit_Queue.Remove: remove((bool)unit_action.Value); break; case Worldmap_Unit_Queue.Track: Tracking_Unit_Min = ((Vector2[])unit_action.Value)[0]; Tracking_Unit_Max = ((Vector2[])unit_action.Value)[1]; Tracking = true; break; } } }
public void WorldmapChapterChanged(Data_Chapter chapter) { // Update lord map sprite location Lord_Sprite.loc = chapter.World_Map_Loc; Lord_Sprite.texture = Scene_Map.get_team_map_sprite( Constants.Team.PLAYER_TEAM, Global.game_actors[chapter.World_Map_Lord_Id].map_sprite_name); 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); } SetTargetLoc(chapter.World_Map_Loc - Constants.WorldMap.WORLDMAP_MAP_SPRITE_OFFSET); }
internal void update() { Scene_Map scene_map = Global.game_map.get_scene_map(); if (scene_map == null || scene_map.map_transition_running) { // Timer stuff Global.game_map.update_characters_while_waiting(); return; } bool cont = Global.game_map.update(); update_state_functions(); if (cont) { if (prev_player_loc != Global.player.loc) { if (!Global.game_map.is_off_map(Global.player.loc, false)) { Global.game_map.highlight_test(); } prev_player_loc = Global.player.loc; } update_victory_theme(); update_main_turn_change(); if (is_map_ready() && !ai_active && is_battle_map && !scene_map.is_changing_turn() && !is_menuing && !Global.game_temp.minimap_call) { input_handling(); } // Decrement No_Input_Timer if (No_Input_Timer > 0 && (is_map_ready() || ( (visit_active || support_active || talk_active || combat_active) && !Global.game_system.is_interpreter_running))) { No_Input_Timer--; } } }
public override void draw(SpriteBatch sprite_batch, Vector2 draw_offset = default(Vector2)) { if (texture != null) { if (visible) { // Window sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); Vector2 offset = this.offset; if (window_visible) { draw_window(sprite_batch, draw_offset); if (Speaker == Window_Message.CG_VOICEOVER_SPEAKER) { SpeakerName.draw(sprite_batch, draw_offset - (this.loc + draw_vector() - offset)); } } sprite_batch.End(); // Text if (ready) { sprite_batch.GraphicsDevice.ScissorRectangle = Scene_Map.fix_rect_to_screen(new Rectangle( (Text_Rect.X + (int)draw_vector().X) - (int)draw_offset.X, (Text_Rect.Y + (int)draw_vector().Y) - (int)draw_offset.Y, Text_Rect.Width, Text_Rect.Height)); if (sprite_batch.GraphicsDevice.ScissorRectangle.Width > 0 && sprite_batch.GraphicsDevice.ScissorRectangle.Width > 0) { sprite_batch.Begin(SpriteSortMode.Texture, BlendState.AlphaBlend, null, null, Text_State); foreach (TextSprite text in Text_Imgs) { text.draw_multicolored(sprite_batch, -(Loc + draw_vector() + new Vector2(8, 8)) + draw_offset); } sprite_batch.End(); } } } } }
public static void init(Game game, ContentManager content, GameServiceContainer services) { Content = new ThreadSafeContentManager(services, "Content"); Battler_Content = new ThreadSafeContentManager(services, "Content"); Chapter_Text_Content = new ThreadSafeContentManager(services, "Content"); if (Services == null) { Services = new GameServiceContainer(); Services.AddService(typeof(IAudioService), new Audio_Engine.Audio_Service()); Services.AddService( typeof(Tactile.Services.Rumble.BaseRumbleService), new Tactile.Services.Rumble.RumbleService(game)); Services.AddService( typeof(Tactile.Services.Input.BaseInputService), new Tactile.Services.Input.InputService(game)); Item_Data.equipment_data = new Equipment_Service(); Data_Class.class_data = new Class_Service(); Data_Weapon.weapon_type_data = new WeaponTypeService(); TactileBattlerImage.animation_battler_data = new BattlerAnimsService(); Global.game_state = new Game_State(); Global.game_options = new Game_Options(); Global.game_system = new Game_System(); Global.game_temp = new Game_Temp(); #if DEBUG && WINDOWS DebugMonitor = new Debug_Monitor.DebugMonitorState(); #endif } load_data_content(); Scene_Map.set_content(services); }
public Texture2D get_team_map_sprite(int team, string name) { return(Scene_Map.get_team_map_sprite(team, name)); }
protected void set_images() { Game_Actor actor = unit.actor; // Face set_face(unit); // Map Sprite Map_Sprite.texture = Scene_Map.get_team_map_sprite(unit.team, unit.map_sprite_name); if (Map_Sprite.texture != null) { Map_Sprite.offset = new Vector2( (Map_Sprite.texture.Width / Map_Sprite.frame_count) / 2, (Map_Sprite.texture.Height / Map_Sprite.facing_count) - 8); } Map_Sprite.mirrored = unit.has_flipped_map_sprite; // Lives //Debug Blocked_Help_Indices.Remove("Lives"); if (Global.game_system.Style != Mode_Styles.Casual || !unit.lives_visible) { Blocked_Help_Indices.Add("Lives"); } // Rescue_Icon Rescue_Icon.visible = unit.is_rescued; if (unit.is_rescued) { Rescue_Icon.src_rect = new Rectangle( (Global.game_map.units[unit.rescued].team - 1) * (Rescue_Icon.texture.Width / Constants.Team.NUM_TEAMS), 0, Rescue_Icon.texture.Width / Constants.Team.NUM_TEAMS, Rescue_Icon.texture.Height); } // Pages foreach (Status_Page status_page in Pages) { status_page.set_images(unit); } // Refresh UI nodes foreach (StatusUINode node in TopPanelNodes) { node.refresh(unit); } // Get page UI nodes StatusNodes = new List <UINodeSet <StatusUINode> >(); StatusCursors = new List <UICursor <StatusUINode> >(); for (int i = 0; i < Pages.Count; i++) { var page_nodes = Pages[i].node_union(TopPanelNodes); StatusNodes.Add(new UINodeSet <StatusUINode>(page_nodes)); var cursor = new UICursor <StatusUINode>(StatusNodes.Last()); cursor.draw_offset = new Vector2(-14, 0); cursor.hide_when_using_mouse(false); StatusCursors.Add(cursor); } }
public Rectangle scissor_rect() { return(Scene_Map.fix_rect_to_screen(new Rectangle(0, (int)loc.Y + 24 - (Timer * (Data == null ? 2 : 4)), 320, Timer * (Data == null ? 4 : 8)))); }
public void draw( SpriteBatch sprite_batch, Vector2 draw_offset, Maybe <Rectangle> scissorRect) { if (texture != null) { if (visible) { // If clipping RasterizerState scissorState = null; if (scissorRect.IsSomething) { scissorState = new RasterizerState { ScissorTestEnable = true }; sprite_batch.GraphicsDevice.ScissorRectangle = Scene_Map.fix_rect_to_screen(scissorRect); } // Adjust position if (Convo_Placement_Offset) { draw_offset -= new Vector2(placement_offset * (mirrored ? 1 : -1), 0); } // Setup shader for palettes if (palette_exists) { Effect effect = Global.effect_shader(); if (effect != null) { Texture2D palette_texture = Global.palette_pool.get_palette(); palette_texture.SetData <Color>(Palette); #if __ANDROID__ // There has to be a way to do this for both effect.Parameters["Palette"].SetValue(palette_texture); #else sprite_batch.GraphicsDevice.Textures[2] = palette_texture; #endif sprite_batch.GraphicsDevice.SamplerStates[2] = SamplerState.PointClamp; effect.CurrentTechnique = effect.Techniques["Palette1"]; effect.Parameters["color_shift"].SetValue(new Vector4(0, 0, 0, 0)); effect.Parameters["opacity"].SetValue(1f); } sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, scissorState, effect); } else { sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, scissorState); } Rectangle src_rect = this.src_rect; Vector2 offset = this.offset; if (mirrored) { offset.X = src_rect.Width - offset.X; } // Crop eyes and mouth out of body, then draw it foreach (var rect in frame_exclusion()) { Vector2 frame_offset = new Vector2( rect.X - src_rect.X, rect.Y - src_rect.Y); frame_offset = new Vector2(mirrored ? this.FaceWidth - (frame_offset.X + (int)rect.Width) : frame_offset.X, frame_offset.Y); sprite_batch.Draw(texture, this.loc + frame_offset + draw_vector() - draw_offset, rect, tint, angle, offset, scale, mirrored ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Z); } int eyes_frame = Idle ? 0 : EyesFrame; int mouth_frame = Idle ? 0 : MouthFrame; // Eyes sprite_batch.Draw(texture, Loc + Eyes_Loc + draw_vector() - draw_offset, eyes_rect(eyes_frame), tint, angle, offset, scale, mirrored ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Z); // Mouth sprite_batch.Draw(texture, Loc + Mouth_Loc + draw_vector() - draw_offset, mouth_rect(mouth_frame), tint, angle, offset, scale, mirrored ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Z); sprite_batch.End(); #if __ANDROID__ // There has to be a way to do this for both if (Global.effect_shader() != null) { Global.effect_shader().Parameters["Palette"].SetValue((Texture2D)null); } #else sprite_batch.GraphicsDevice.Textures[2] = null; #endif } } }