Add Right Shift Alignment

This commit is contained in:
GreenComfyTea
2023-05-28 17:40:10 +03:00
parent 5af7f53962
commit c56976b97f
9 changed files with 1603 additions and 240 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -562,6 +562,8 @@ this.default_language = {
right_to_left = "Right to Left",
top_to_bottom = "Top to Bottom",
bottom_to_top = "Bottom to Top",
right_alignment_shift = "Right Alignment Shift"
}
};

View File

@@ -45,60 +45,57 @@ local ValueType = ValueType;
local package = package;
function this.draw(label_name, label)
local cached_language = language.current_language.customization_menu;
local label_changed = false;
local changed = false;
if imgui.tree_node(label_name) then
changed, label.visibility = imgui.checkbox(language.current_language.customization_menu.visible, label.visibility);
changed, label.visibility = imgui.checkbox(cached_language.visible, label.visibility);
label_changed = label_changed or changed;
if label.include ~= nil then
if imgui.tree_node(language.current_language.customization_menu.include) then
for include_name, include in pairs(label.include) do
changed, label.include[include_name] = imgui.checkbox(language.current_language.customization_menu[include_name], include);
label_changed = label_changed or changed;
end
imgui.tree_pop();
end
end
-- add text format
if imgui.tree_node(language.current_language.customization_menu.offset) then
changed, label.offset.x = imgui.drag_float(language.current_language.customization_menu.x, label.offset.x, 0.1, -screen.width, screen.width, "%.1f");
label_changed = label_changed or changed;
changed, label.offset.y = imgui.drag_float(language.current_language.customization_menu.y, label.offset.y, 0.1, -screen.height, screen.height, "%.1f");
if imgui.tree_node(cached_language.settings) then
changed, label.settings.right_alignment_shift = imgui.slider_int(cached_language.right_alignment_shift, label.settings.right_alignment_shift, 0, 64);
label_changed = label_changed or changed;
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.color) then
if imgui.tree_node(cached_language.offset) then
changed, label.offset.x = imgui.drag_float(cached_language.x, label.offset.x, 0.1, -screen.width, screen.width, "%.1f");
label_changed = label_changed or changed;
changed, label.offset.y = imgui.drag_float(cached_language.y, label.offset.y, 0.1, -screen.height, screen.height, "%.1f");
label_changed = label_changed or changed;
imgui.tree_pop();
end
if imgui.tree_node(cached_language.color) then
changed, label.color = imgui.color_picker_argb("", label.color, customization_menu.color_picker_flags);
label_changed = label_changed or changed;
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.shadow) then
changed, label.shadow.visibility = imgui.checkbox(language.current_language.customization_menu.visible, label.shadow.visibility);
if imgui.tree_node(cached_language.shadow) then
changed, label.shadow.visibility = imgui.checkbox(cached_language
.visible, label.shadow.visibility);
label_changed = label_changed or changed;
if imgui.tree_node(language.current_language.customization_menu.offset) then
changed, label.shadow.offset.x = imgui.drag_float(language.current_language.customization_menu.x,
if imgui.tree_node(cached_language.offset) then
changed, label.shadow.offset.x = imgui.drag_float(cached_language.x,
label.shadow.offset.x, 0.1, -screen.width, screen.width, "%.1f");
label_changed = label_changed or changed;
changed, label.shadow.offset.y = imgui.drag_float(language.current_language.customization_menu.y,
changed, label.shadow.offset.y = imgui.drag_float(cached_language.y,
label.shadow.offset.y, 0.1, -screen.height, screen.height, "%.1f");
label_changed = label_changed or changed;
imgui.tree_pop();
end
if imgui.tree_node(language.current_language.customization_menu.color) then
if imgui.tree_node(cached_language.color) then
changed, label.shadow.color = imgui.color_picker_argb("", label.shadow.color,
customization_menu.color_picker_flags);
label_changed = label_changed or changed;

View File

@@ -126,12 +126,19 @@ function this.draw_label(label, position, opacity_scale, ...)
return;
end
local text = string.format(label.text_format, table.unpack({...}));
local text = string.format(label.text_formatting, table.unpack({...}));
if text == "" then
return;
end
local right_alignment_shift = label.settings.right_alignment_shift;
if right_alignment_shift ~= 0 then
local right_aligment_format = string.format("%%%ds", right_alignment_shift);
text = string.format(right_aligment_format, text);
end
local position_x = position.x + label.offset.x;
local position_y = position.y + label.offset.y;

View File

@@ -256,6 +256,7 @@
"reset": "Reset",
"reversed_order": "Reversed Order",
"reward_screen": "Reward Screen",
"right_alignment_shift": "Right Alignment Shift",
"right_to_left": "Right to Left",
"servant_otomos": "Servant Buddies",
"servants": "Followers",

View File

@@ -256,6 +256,7 @@
"reset": "Reset",
"reversed_order": "逆順",
"reward_screen": "Reward Screen",
"right_alignment_shift": "Right Alignment Shift",
"right_to_left": "Right to Left",
"servant_otomos": "Servant Buddies",
"servants": "Followers",

View File

@@ -256,6 +256,7 @@
"reset": "리셋",
"reversed_order": "역순",
"reward_screen": "보상 화면",
"right_alignment_shift": "Right Alignment Shift",
"right_to_left": "Right to Left",
"servant_otomos": "맹우 동반자",
"servants": "맹우",

View File

@@ -256,6 +256,7 @@
"reset": "重置",
"reversed_order": "逆向排序",
"reward_screen": "奖励界面",
"right_alignment_shift": "Right Alignment Shift",
"right_to_left": "Right to Left",
"servant_otomos": "盟友随从",
"servants": "盟友",

View File

@@ -256,6 +256,7 @@
"reset": "Reset",
"reversed_order": "反向排序",
"reward_screen": "Reward Screen",
"right_alignment_shift": "Right Alignment Shift",
"right_to_left": "Right to Left",
"servant_otomos": "Servant Buddies",
"servants": "Followers",