protected void set_choices(int ox, string str1, string str2) { List <TextUINode> choices = new List <TextUINode>(); var text1 = new TextSprite(); text1.SetFont(Config.CONVO_FONT, Global.Content, "White"); text1.text = str1; var node = new TextUINode("", text1, text1.text_width); node.loc = new Vector2(88 + ox, 32); choices.Add(node); var text2 = new TextSprite(); text2.SetFont(Config.CONVO_FONT, Global.Content, "White"); text2.text = str2; node = new TextUINode("", text2, text2.text_width); node.loc = new Vector2(88 + ox + 40, 32); choices.Add(node); Choices = new UINodeSet <TextUINode>(choices); Cursor = new UICursor <TextUINode>(Choices); Cursor.draw_offset = new Vector2(-16, 0); Cursor.ratio = new int[] { 1, 1 }; Cursor.hide_when_using_mouse(false); Cursor.move_to_target_loc(); }
public virtual void add_choice(string str, Vector2 loc) { List <TextUINode> choices = Choices == null ? new List <TextUINode>() : Choices.ToList(); var text = new TextSprite(); text.SetFont(Tactile.Config.CONVO_FONT, Global.Content, "Black"); text.text = str; var node = new TextUINode("", text, text.text_width); node.loc = loc; choices.Add(node); Choices = new UINodeSet <TextUINode>(choices); Cursor = new UICursor <TextUINode>(Choices); Cursor.hide_when_using_mouse(false); // Resize if needed int width = Font_Data.text_width(str, Tactile.Config.CONVO_FONT); width = width + (width % 8 == 0 ? 0 : (8 - width % 8)) + 16 + (int)loc.X; if (width > Size.X) { size = new Vector2(width, Size.Y); } Cursor.move_to_target_loc(); }
private void initialize(int actor_id1, int actor_id2, int initial_index) { Actor_Id1 = actor_id1; Actor_Id2 = actor_id2; //Hand_Texture = Global.Content.Load<Texture2D>(@"Graphics/Windowskins/Menu_Hand"); loc = new Vector2( (Config.WINDOW_WIDTH - (SPACING * 2)) / 2, Config.WINDOW_HEIGHT - Math.Max(96, Num * 16 + 16 + 12)); initialize_images(); refresh(); if (initial_index != -1) { #if DEBUG throw new NotImplementedException(); #endif this.index = initial_index; enter(); UICursor.move_to_target_loc(); } }
protected void update_cursor_location(bool instant) { if (Cursor != null) { if (instant) { Cursor.update(); Cursor.move_to_target_loc(); } else { Cursor.update(); } } }
public WindowRankingsOverview(string chapter, Difficulty_Modes difficulty) { Chapter = chapter; Difficulty = difficulty; initialize_sprites(); update_black_screen(); // Jump to chapter int index = Rankings.FindIndex(x => x.Key == chapter); Nodes.set_active_node(Nodes[index]); Cursor.UpdateTargetLoc(); Cursor.move_to_target_loc(); }
public void refresh_nodes() { int active_index = 0; if (UnitNodes != null) { active_index = UnitNodes.ActiveNodeIndex; } var old_cursor = UnitCursor; ActorList = GetActorList(); List <PrepItemsUnitUINode> nodes = new List <PrepItemsUnitUINode>(); // Units for (int index = 0; index < ActorList.Count; index++) { Vector2 loc = new Vector2( (index % this.Columns) * unit_spacing() + 28, (index / this.Columns) * this.RowSize + this.ScissorRectOffset.Y) + unit_offset(); int id = ActorList[index]; nodes.Add(unit_node(id)); nodes[index].loc = loc + new Vector2(this.ScissorRectOffset.X - 8, 0); } UnitNodes = new PartialRangeVisibleUINodeSet <PrepItemsUnitUINode>(nodes); UnitNodes.CursorMoveSound = System_Sounds.Menu_Move1; for (int index = 0; index < ActorList.Count; index++) { refresh_map_sprite(index); refresh_font(index); } UnitCursor = new UICursor <PrepItemsUnitUINode>(UnitNodes); UnitCursor.draw_offset = new Vector2(-12, 0); UnitNodes.set_active_node(UnitNodes[active_index]); UnitCursor.move_to_target_loc(); if (old_cursor != null) { UnitCursor.loc = old_cursor.loc; } UnitNodes.Update(false); }
public WindowCommandSupportViewerActor(int actorId, Vector2 loc) { Rows = LINES; ActorId = actorId; Header = new Support_Command_Components(LINES, this.SupportsRemaining, true); Header.color_override = 0; List <string> strs = GetNames(); initialize(loc, 8 + 16, strs); Window_Img.color_override = 0; Window_Img.set_lines(LINES, (int)Size_Offset.Y + 8); int width = WIDTH - 16; this.text_offset = new Vector2(width - (this.ColumnCount + 1) * 8, 0); set_columns(this.ColumnCount); this.size_offset = new Vector2(width - this.text_area_width, Size_Offset.Y); Window_Img.set_lines(LINES, (int)Size_Offset.Y + 8); initialize_scrollbar(); if (Scrollbar != null) { Scrollbar.loc += new Vector2(4, 0); } // Bar Glow = true; this.glow_width = 16; this.bar_offset = new Vector2(-4, 0); // Cursor UICursor.UpdateTargetLoc(ScrollOffset); UICursor.move_to_target_loc(); PlayerCursor = new Character_Sprite(Global.Content.Load <Texture2D>(@"Graphics/Characters/Cursor")); PlayerCursor.offset = new Vector2(4, 0 - 2); SetUnits(); }
protected void initialize_index() { // Default index to Global.game_system.Preparations_Actor_Id if possible if (ActorList.Contains( Global.game_system.Preparations_Actor_Id)) { this.index = ActorList.IndexOf( Global.game_system.Preparations_Actor_Id); Scroll = (int)MathHelper.Clamp( this.index / this.Columns - (this.VisibleRows / 2), 0, Rows - this.VisibleRows); if (Scrollbar != null) { Scrollbar.scroll = Scroll; } update_cursor(); UnitCursor.move_to_target_loc(); } else { this.index = 0; } }
protected void initialize_sprites() { // Black Screen Black_Screen = new Sprite(); Black_Screen.texture = Global.Content.Load <Texture2D>(@"Graphics/White_Square"); Black_Screen.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT); Black_Screen.tint = new Color(0, 0, 0, 255); // Banner Banner = new MenuScreenBanner(); Banner.width = 120; Banner.loc = new Vector2(OPTIONS_OFFSET, 8); Banner.stereoscopic = Config.OPTIONS_BANNER_DEPTH; Banner_Text = new Sprite(); Banner_Text.texture = Global.Content.Load <Texture2D>(@"Graphics/Pictures/Banner_Text"); Banner_Text.src_rect = new Rectangle(0, 0, 96, 16); Banner_Text.loc = new Vector2(OPTIONS_OFFSET + 24 + 2, 8 + 8); Banner_Text.stereoscopic = Config.OPTIONS_BANNER_DEPTH; // Background Background = new Menu_Background(); Background.texture = Global.Content.Load <Texture2D>(@"Graphics/Pictures/Option_Background"); (Background as Menu_Background).vel = new Vector2(-0.25f, 0); (Background as Menu_Background).tile = new Vector2(3, 1); Background.stereoscopic = Config.MAPMENU_BG_DEPTH; // Description Window Description_Window = new System_Color_Window(); Description_Window.loc = new Vector2(60, 156); Description_Window.width = 200; Description_Window.height = 24; Description_Window.small = true; Description_Window.stereoscopic = Config.OPTIONS_DESC_DEPTH; // Description Description = new TextSprite(); Description.loc = new Vector2(72, 160); Description.SetFont(Config.UI_FONT, Global.Content, "White"); Description.stereoscopic = Config.OPTIONS_DESC_DEPTH; // Solo Anim Button Icon Solo_Icon = new SoloAnim_Button(); Solo_Icon.loc = new Vector2( CHOICES_OFFSET + 20 + OptionsConfig.OPTIONS_DATA[(int)Constants.Options.Animation_Mode] .Options[(int)Constants.Animation_Modes.Solo].Offset, 16 * (int)Constants.Options.Animation_Mode) + new Vector2(Data_Scissor_Rect.X, Data_Scissor_Rect.Y); Solo_Icon.stereoscopic = Config.OPTIONS_OPTIONS_DEPTH; // Page Arrows Up_Page_Arrow = new Page_Arrow(); Up_Page_Arrow.loc = new Vector2(CHOICES_OFFSET - 4, Data_Scissor_Rect.Y - 4); Up_Page_Arrow.angle = MathHelper.PiOver2; Up_Page_Arrow.stereoscopic = Config.OPTIONS_ARROWS_DEPTH; Down_Page_Arrow = new Page_Arrow(); Down_Page_Arrow.loc = new Vector2(CHOICES_OFFSET - 4, Data_Scissor_Rect.Y + Data_Scissor_Rect.Height + 4); Down_Page_Arrow.mirrored = true; Down_Page_Arrow.angle = MathHelper.PiOver2; Down_Page_Arrow.stereoscopic = Config.OPTIONS_ARROWS_DEPTH; Up_Page_Arrow.ArrowClicked += Up_Page_Arrow_ArrowClicked; Down_Page_Arrow.ArrowClicked += Down_Page_Arrow_ArrowClicked; // UI Nodes List <OptionsUINode> nodes = new List <OptionsUINode>(); // Options for (int index = 0; index < OptionsConfig.OPTIONS_DATA.Length; index++) { Vector2 loc = new Vector2(OPTIONS_OFFSET + 16, index * 16) + new Vector2(Data_Scissor_Rect.X, Data_Scissor_Rect.Y); nodes.Add(new OptionsUINode(index)); nodes[index].stereoscopic = Config.OPTIONS_OPTIONS_DEPTH; nodes[index].loc = loc; } OptionsNodes = new PartialRangeVisibleUINodeSet <OptionsUINode>(nodes); OptionsNodes.CursorMoveSound = System_Sounds.Menu_Move1; OptionsCursor = new UICursor <OptionsUINode>(OptionsNodes); OptionsCursor.draw_offset = new Vector2(-(16 + 12), 0); OptionsCursor.stereoscopic = Config.OPTIONS_CURSOR_DEPTH; // Settings List <SettingUINode> settings_nodes = new List <SettingUINode>(); SettingsGroups = new List <List <SettingUINode> >(); foreach (var option_node in OptionsNodes) { int i = (int)option_node.Option; var option = OptionsConfig.OPTIONS_DATA[i]; var settings_group = new List <SettingUINode>(); if (option.Gauge) { Vector2 loc = new Vector2(CHOICES_OFFSET, i * 16) + new Vector2(Data_Scissor_Rect.X, Data_Scissor_Rect.Y); var node = new SettingGaugeUINode(option.Options[0].Name, option.GaugeWidth, option.GaugeMin, option.GaugeMax, option.gauge_offset); node.stereoscopic = Config.OPTIONS_OPTIONS_DEPTH; node.loc = loc; settings_nodes.Add(node); settings_group.Add(node); } else { for (int j = 0; j < option.Options.Length; j++) { Vector2 loc = new Vector2(CHOICES_OFFSET + option.Options[j].Offset, i * 16) + new Vector2(Data_Scissor_Rect.X, Data_Scissor_Rect.Y); var node = new SettingUINode(option.Options[j].Name); node.stereoscopic = Config.OPTIONS_OPTIONS_DEPTH; node.loc = loc; settings_nodes.Add(node); settings_group.Add(node); } } SettingsGroups.Add(settings_group); } SettingsNodes = new PartialRangeVisibleUINodeSet <SettingUINode>(settings_nodes); SettingsNodes.CursorMoveSound = System_Sounds.Menu_Move2; SettingsNodes.set_active_node(SettingsNodes[this.current_setting]); SettingsCursor = new UICursor <SettingUINode>(SettingsNodes); SettingsCursor.draw_offset = new Vector2(-16, 0); SettingsCursor.min_distance_y = 4; SettingsCursor.override_distance_y = 16; SettingsCursor.stereoscopic = Config.OPTIONS_CURSOR_DEPTH; SettingsCursor.move_to_target_loc(); // Scrollbar /* //Debug * Scrollbar = new Scroll_Bar( * ROWS_AT_ONCE * 16 - 16, OptionsConfig.OPTIONS_DATA.Length, ROWS_AT_ONCE, 0); * Scrollbar.loc = new Vector2(Data_Scissor_Rect.Width - 12, Data_Scissor_Rect.Y + 8); * * Scrollbar.UpArrowClicked += Scrollbar_UpArrowClicked; * Scrollbar.DownArrowClicked += Scrollbar_DownArrowClicked;*/ create_cancel_button(); refresh_arrow_visibility(); update_loc(); }