Add Bar Fill Direction

This commit is contained in:
GreenComfyTea
2023-05-26 13:18:46 +03:00
parent e2354eedcc
commit 7ad40bbb89
10 changed files with 300 additions and 33 deletions

View File

@@ -128,7 +128,6 @@ small_monster.init_module();
ailment_hook.init_module();
ailment_buildup.init_module();
customization_menu.init_module();
label_customization.init_module();
bar_customization.init_module();
line_customization.init_module();
@@ -143,6 +142,7 @@ body_parts_customization.init_module();
ailments_customization.init_module();
ailment_buildups_customization.init_module();
module_visibility_customization.init_module();
customization_menu.init_module();
drawing.init_module();

View File

@@ -405,6 +405,11 @@ function this.init_default()
bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 0
@@ -597,6 +602,11 @@ function this.init_default()
bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 14
@@ -783,6 +793,11 @@ function this.init_default()
buildup_bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 17
@@ -809,6 +824,11 @@ function this.init_default()
highlighted_buildup_bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 17
@@ -962,6 +982,11 @@ function this.init_default()
bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 0
@@ -1104,6 +1129,11 @@ function this.init_default()
bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 17
@@ -1224,6 +1254,11 @@ function this.init_default()
bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 17
@@ -1385,6 +1420,11 @@ function this.init_default()
bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 6
@@ -1486,6 +1526,11 @@ function this.init_default()
bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 7
@@ -1586,6 +1631,11 @@ function this.init_default()
bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 7
@@ -1782,6 +1832,11 @@ function this.init_default()
bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 14
@@ -1965,6 +2020,11 @@ function this.init_default()
buildup_bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 17
@@ -1991,6 +2051,11 @@ function this.init_default()
highlighted_buildup_bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 17
@@ -2148,6 +2213,11 @@ function this.init_default()
bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 0
@@ -2289,6 +2359,11 @@ function this.init_default()
bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 0
@@ -2409,6 +2484,11 @@ function this.init_default()
bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 0
@@ -2570,6 +2650,11 @@ function this.init_default()
bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 6
@@ -2671,6 +2756,11 @@ function this.init_default()
bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 7
@@ -2771,6 +2861,11 @@ function this.init_default()
bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 7
@@ -2968,6 +3063,11 @@ function this.init_default()
bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 14
@@ -3151,6 +3251,11 @@ function this.init_default()
buildup_bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 17
@@ -3177,6 +3282,11 @@ function this.init_default()
highlighted_buildup_bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 17
@@ -3320,6 +3430,11 @@ function this.init_default()
bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 0
@@ -3461,6 +3576,11 @@ function this.init_default()
bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 10 - 10,
y = 17
@@ -3581,6 +3701,11 @@ function this.init_default()
bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 17
@@ -3742,6 +3867,11 @@ function this.init_default()
bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 6
@@ -3843,6 +3973,11 @@ function this.init_default()
bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 7
@@ -3943,6 +4078,11 @@ function this.init_default()
bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 7
@@ -3967,7 +4107,6 @@ function this.init_default()
}
}
}
},
ailments = {
@@ -4139,6 +4278,11 @@ function this.init_default()
bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 14
@@ -4322,6 +4466,11 @@ function this.init_default()
buildup_bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 17
@@ -4348,6 +4497,11 @@ function this.init_default()
highlighted_buildup_bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 17
@@ -4607,6 +4761,11 @@ function this.init_default()
damage_bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 17
@@ -4767,6 +4926,11 @@ function this.init_default()
damage_bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 17
@@ -4879,6 +5043,11 @@ function this.init_default()
damage_bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 17
@@ -5012,6 +5181,11 @@ function this.init_default()
damage_bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 17
@@ -5145,6 +5319,11 @@ function this.init_default()
damage_bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 17
@@ -5278,6 +5457,11 @@ function this.init_default()
damage_bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 17
@@ -5505,6 +5689,11 @@ function this.init_default()
damage_bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 17
@@ -5639,6 +5828,11 @@ function this.init_default()
bar = {
visibility = true,
settings = {
fill_direction = "Left to Right"
},
offset = {
x = 0,
y = 17

View File

@@ -541,7 +541,13 @@ this.default_language = {
filter_mode = "Filter Mode",
current_state = "Current State",
default_state = "Default State"
default_state = "Default State",
fill_direction = "Fill Direction",
left_to_right = "Left to Right",
right_to_left = "Right to Left",
top_to_bottom = "Top to Bottom",
bottom_to_top = "Bottom to Top",
}
};

View File

@@ -167,7 +167,6 @@ function this.draw_label(label, position, opacity_scale, ...)
end
function this.draw_bar(bar, position, opacity_scale, percentage)
if bar == nil or not bar.visibility then
return;
end
@@ -182,6 +181,7 @@ function this.draw_bar(bar, position, opacity_scale, percentage)
local outline_visibility = bar.outline.visibility;
local style = bar.outline.style; -- Inside/Center/Outside
local fill_direction = bar.settings.fill_direction; -- Left to Right/Right to Left/Top to Bottom/Bottom to Top
local outline_thickness = bar.outline.thickness;
if not outline_visibility then
@@ -206,10 +206,21 @@ function this.draw_bar(bar, position, opacity_scale, percentage)
local position_x = 0;
local position_y = 0;
local foreground_width = 0;
local background_width = 0;
local width = 0;
local height = 0;
local foreground_width = 0;
local foreground_height = 0;
local background_width = 0;
local background_height = 0;
local foreground_shift_x = 0;
local foreground_shift_y = 0;
local background_shift_x = 0;
local background_shift_y = 0;
if style == "Inside" then
outline_position_x = position.x + bar.offset.x + half_outline_thickness;
outline_position_y = position.y + bar.offset.y + half_outline_thickness;
@@ -220,10 +231,7 @@ function this.draw_bar(bar, position, opacity_scale, percentage)
position_x = outline_position_x + half_outline_thickness + outline_offset;
position_y = outline_position_y + half_outline_thickness + outline_offset;
local width = outline_width - outline_thickness - outline_offset - outline_offset;
foreground_width = width * percentage;
background_width = width - foreground_width;
width = outline_width - outline_thickness - outline_offset - outline_offset;
height = outline_height - outline_thickness - outline_offset - outline_offset;
elseif style == "Center" then
@@ -236,22 +244,16 @@ function this.draw_bar(bar, position, opacity_scale, percentage)
position_x = outline_position_x + half_outline_thickness + outline_offset;
position_y = outline_position_y + half_outline_thickness + outline_offset;
local width = outline_width - outline_thickness - outline_offset - outline_offset;
foreground_width = width * percentage;
background_width = width - foreground_width;
width = outline_width - outline_thickness - outline_offset - outline_offset;
height = outline_height - outline_thickness - outline_offset - outline_offset;
else
else -- Outside
position_x = position.x + bar.offset.x;
position_y = position.y + bar.offset.y;
local width = bar.size.width;
width = bar.size.width;
height = bar.size.height;
foreground_width = width * percentage;
background_width = width - foreground_width;
outline_position_x = position_x - half_outline_thickness - outline_offset;
outline_position_y = position_y - half_outline_thickness - outline_offset;
@@ -259,6 +261,43 @@ function this.draw_bar(bar, position, opacity_scale, percentage)
outline_height = height + outline_thickness + outline_offset + outline_offset;
end
if fill_direction == "Right to Left" then
foreground_width = width * percentage;
foreground_height = height;
background_width = width - foreground_width;
background_height = height;
foreground_shift_x = background_width;
elseif fill_direction == "Top to Bottom" then
foreground_width = width;
foreground_height = height * percentage;
background_width = width;
background_height = height - foreground_height;
background_shift_y = foreground_height;
elseif fill_direction == "Bottom to Top" then
foreground_width = width;
foreground_height = height * percentage;
background_width = width;
background_height = height - foreground_height;
foreground_shift_y = background_height;
else -- Left to Right
foreground_width = width * percentage;
foreground_height = height;
background_width = width - foreground_width;
background_height = height;
background_shift_x = foreground_width;
end
local foreground_color = bar.colors.foreground;
local background_color = bar.colors.background;
local outline_color = bar.colors.outline;
@@ -271,35 +310,33 @@ function this.draw_bar(bar, position, opacity_scale, percentage)
local use_d2d = d2d ~= nil and config.current_config.global_settings.renderer.use_d2d_if_available;
-- outline
if outline_thickness ~= 0 then
-- background
if background_width ~= 0 then
if use_d2d then
d2d.outline_rect(outline_position_x, outline_position_y, outline_width, outline_height, outline_thickness,
outline_color);
d2d.fill_rect(position_x + background_shift_x, position_y + background_shift_y, background_width, background_height, background_color);
else
outline_color = this.argb_color_to_abgr_color(outline_color);
draw.outline_rect(outline_position_x, outline_position_y, outline_width, outline_height, outline_color);
background_color = this.argb_color_to_abgr_color(background_color);
draw.filled_rect(position_x + background_shift_x, position_y + background_shift_y, background_width, background_height, background_color)
end
end
-- foreground
if foreground_width ~= 0 then
if use_d2d then
d2d.fill_rect(position_x, position_y, foreground_width, height, foreground_color);
d2d.fill_rect(position_x + foreground_shift_x, position_y + foreground_shift_y, foreground_width, foreground_height, foreground_color);
else
foreground_color = this.argb_color_to_abgr_color(foreground_color);
draw.filled_rect(position_x, position_y, foreground_width, height, foreground_color)
draw.filled_rect(position_x + foreground_shift_x, position_y + foreground_shift_y, foreground_width, foreground_height, foreground_color)
end
end
-- background
if background_width ~= 0 then
-- outline
if outline_thickness ~= 0 then
if use_d2d then
d2d.fill_rect(position_x + foreground_width, position_y, background_width, height, background_color);
d2d.outline_rect(outline_position_x, outline_position_y, outline_width, outline_height, outline_thickness, outline_color);
else
background_color = this.argb_color_to_abgr_color(background_color);
draw.filled_rect(position_x + foreground_width, position_y, background_width, height, background_color)
outline_color = this.argb_color_to_abgr_color(outline_color);
draw.outline_rect(outline_position_x, outline_position_y, outline_width, outline_height, outline_color);
end
end
end

View File

@@ -59,6 +59,7 @@
"bomb_damage": "Bomb Damage",
"bottom_left": "Bottom-Left",
"bottom_right": "Bottom-Right",
"bottom_to_top": "Bottom to Top",
"break_count": "Break Count",
"break_filter": "Break",
"break_health": "Break Health",
@@ -109,6 +110,7 @@
"family": "Family",
"farthest": "Farthest",
"fight_time": "Fight Time",
"fill_direction": "Fill Direction",
"filter": "Filter",
"filter_mode": "Filter Mode",
"first": "First",
@@ -171,6 +173,7 @@
"large_monster_static_UI": "Large Monster Static UI",
"large_monsters": "Large Monsters",
"last": "Last",
"left_to_right": "Left to Right",
"level": "Level",
"level_label": "Level Label",
"loading_quest": "Loading Quest",
@@ -242,6 +245,7 @@
"reset": "Reset",
"reversed_order": "Reversed Order",
"reward_screen": "Reward Screen",
"right_to_left": "Right to Left",
"servant_otomos": "Servant Buddies",
"servants": "Followers",
"settings": "Settings",
@@ -276,6 +280,7 @@
"top_dps": "Top DPS",
"top_left": "Top-Left",
"top_right": "Top-Right",
"top_to_bottom": "Top to Bottom",
"total": "Total",
"total_buildup": "Total Buildup",
"total_buildup_label": "Total Buildup Label",

View File

@@ -59,6 +59,7 @@
"bomb_damage": "爆弾ダメージ",
"bottom_left": "左下",
"bottom_right": "右下",
"bottom_to_top": "Bottom to Top",
"break_count": "破壊時間",
"break_filter": "Break",
"break_health": "部位破壊までのダメージ状況",
@@ -109,6 +110,7 @@
"family": "Family",
"farthest": "Farthest",
"fight_time": "戦闘時間",
"fill_direction": "Fill Direction",
"filter": "フィルター",
"filter_mode": "Filter Mode",
"first": "最初",
@@ -171,6 +173,7 @@
"large_monster_static_UI": "大型モンスターのスタティック表示UI",
"large_monsters": "大型モンスター",
"last": "最後",
"left_to_right": "Left to Right",
"level": "Level",
"level_label": "Level Label",
"loading_quest": "Loading Quest",
@@ -242,6 +245,7 @@
"reset": "Reset",
"reversed_order": "逆順",
"reward_screen": "Reward Screen",
"right_to_left": "Right to Left",
"servant_otomos": "Servant Buddies",
"servants": "Followers",
"settings": "設定",
@@ -276,6 +280,7 @@
"top_dps": "最高DPS",
"top_left": "左上",
"top_right": "右上",
"top_to_bottom": "Top to Bottom",
"total": "Total",
"total_buildup": "蓄積合計",
"total_buildup_label": "合計蓄積ラベル",

View File

@@ -59,6 +59,7 @@
"bomb_damage": "폭탄 대미지",
"bottom_left": "좌하단",
"bottom_right": "우하단",
"bottom_to_top": "Bottom to Top",
"break_count": "파괴 횟수",
"break_filter": "파괴",
"break_health": "파괴 수치",
@@ -109,6 +110,7 @@
"family": "글꼴",
"farthest": "가장 멀리있는",
"fight_time": "전투 시간",
"fill_direction": "Fill Direction",
"filter": "필터",
"filter_mode": "Filter Mode",
"first": "맨 앞",
@@ -171,6 +173,7 @@
"large_monster_static_UI": "대형 몬스터 고정 UI",
"large_monsters": "대형 몬스터",
"last": "맨 뒤",
"left_to_right": "Left to Right",
"level": "레벨",
"level_label": "레벨 정보",
"loading_quest": "퀘스트 로딩 중",
@@ -242,6 +245,7 @@
"reset": "리셋",
"reversed_order": "역순",
"reward_screen": "보상 화면",
"right_to_left": "Right to Left",
"servant_otomos": "맹우 동반자",
"servants": "맹우",
"settings": "설정",
@@ -276,6 +280,7 @@
"top_dps": "최고 DPS",
"top_left": "좌상단",
"top_right": "우상단",
"top_to_bottom": "Top to Bottom",
"total": "전체",
"total_buildup": "총 누적치",
"total_buildup_label": "총 누적치 정보",

View File

@@ -59,6 +59,7 @@
"bomb_damage": "Урон от бомб",
"bottom_left": "Левый нижний угол",
"bottom_right": "Правй нижний угол",
"bottom_to_top": "Снизу вверх",
"break_count": "Счётчик повреждений",
"break_filter": "Повреждение",
"break_health": "Повреждение части",
@@ -109,6 +110,7 @@
"family": "Семейство",
"farthest": "Самый дальний",
"fight_time": "Время в бою",
"fill_direction": "Направление заполнения",
"filter": "Фильтр",
"filter_mode": "Режим Фильтра",
"first": "Первый",
@@ -171,6 +173,7 @@
"large_monster_static_UI": "Статический интерфейс больших монстров",
"large_monsters": "Большие монстры",
"last": "Последний",
"left_to_right": "Слева направо",
"level": "Уровень",
"level_label": "Метка уровня",
"loading_quest": "Загрузка квеста",
@@ -242,6 +245,7 @@
"reset": "Сбросить",
"reversed_order": "Обратный порядок",
"reward_screen": "Экран наград",
"right_to_left": "Справа налево",
"servant_otomos": "Спутники последователей",
"servants": "Последователи",
"settings": "Настройки",
@@ -276,6 +280,7 @@
"top_dps": "Наибольший урон в секунду",
"top_left": "Левый верхний угол",
"top_right": "Правый верхний угол",
"top_to_bottom": "Сверху вниз",
"total": "Всего",
"total_buildup": "Общее накопление",
"total_buildup_label": "Метка общего накопления",

View File

@@ -59,6 +59,7 @@
"bomb_damage": "爆弹桶伤害",
"bottom_left": "左下",
"bottom_right": "右下",
"bottom_to_top": "Bottom to Top",
"break_count": "破坏次数",
"break_filter": "破坏",
"break_health": "破坏值",
@@ -109,6 +110,7 @@
"family": "字体",
"farthest": "最远",
"fight_time": "战斗时间",
"fill_direction": "Fill Direction",
"filter": "筛选器",
"filter_mode": "筛选方式",
"first": "第一",
@@ -171,6 +173,7 @@
"large_monster_static_UI": "大型怪物固定UI",
"large_monsters": "大型怪物群",
"last": "最后",
"left_to_right": "Left to Right",
"level": "等级",
"level_label": "等级标签",
"loading_quest": "任务加载中",
@@ -242,6 +245,7 @@
"reset": "重置",
"reversed_order": "逆向排序",
"reward_screen": "奖励界面",
"right_to_left": "Right to Left",
"servant_otomos": "盟友随从",
"servants": "盟友",
"settings": "设定",
@@ -276,6 +280,7 @@
"top_dps": "最高DPS",
"top_left": "左上",
"top_right": "右上",
"top_to_bottom": "Top to Bottom",
"total": "总计",
"total_buildup": "总积累值",
"total_buildup_label": "总积累值标签",

View File

@@ -59,6 +59,7 @@
"bomb_damage": "爆炸傷害",
"bottom_left": "左下",
"bottom_right": "右下",
"bottom_to_top": "Bottom to Top",
"break_count": "破壞次數",
"break_filter": "Break",
"break_health": "Break Health",
@@ -109,6 +110,7 @@
"family": "字體",
"farthest": "最遠的",
"fight_time": "戰鬥時間",
"fill_direction": "Fill Direction",
"filter": "篩選器",
"filter_mode": "Filter Mode",
"first": "第一",
@@ -171,6 +173,7 @@
"large_monster_static_UI": "大型魔物固定 UI",
"large_monsters": "大型魔物群",
"last": "最後",
"left_to_right": "Left to Right",
"level": "Level",
"level_label": "Level Label",
"loading_quest": "Loading Quest",
@@ -242,6 +245,7 @@
"reset": "Reset",
"reversed_order": "反向排序",
"reward_screen": "Reward Screen",
"right_to_left": "Right to Left",
"servant_otomos": "Servant Buddies",
"servants": "Followers",
"settings": "設定",
@@ -276,6 +280,7 @@
"top_dps": "最高 DPS",
"top_left": "左上",
"top_right": "右上",
"top_to_bottom": "Top to Bottom",
"total": "Total",
"total_buildup": "總累積值",
"total_buildup_label": "總累積值文字",