示例#1
0
        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 override 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.UI_FONT, Global.Content, "White");
            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.UI_FONT);

            width = width + (width % 8 == 0 ? 0 : (8 - width % 8)) + 16 + (int)loc.X;
            if (width > Size.X)
            {
                size = new Vector2(width, Size.Y);
            }
        }
示例#3
0
        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);
            }
        }