6 Commits

Author SHA1 Message Date
GreenComfyTea
72ca959581 Formatting 2023-05-25 12:32:46 +03:00
GreenComfyTea
cd2aa12d3c Add Proper Unicode Glyph Ranges for Each Language 2023-05-25 12:18:34 +03:00
GreenComfyTea
865512f8d6 Fix Chaotic Gore Magala Wingclaws 2023-04-25 17:02:43 +03:00
GreenComfyTea
ecd150eb4d Make debug.lua a separate script 2023-04-21 13:27:34 +03:00
GreenComfyTea
585860666f Merge branch 'main' of https://github.com/GreenComfyTea/MHR-Overlay 2023-04-21 13:16:14 +03:00
GreenComfyTea
e6556e8d9b Check for debug.lua presence before requiring 2023-04-21 13:16:13 +03:00
12 changed files with 153 additions and 58 deletions

View File

@@ -30,8 +30,6 @@ local os = os;
local ValueType = ValueType;
local package = package;
local debug = require("MHR_Overlay.Misc.debug");
local keyboard = require("MHR_Overlay.Game_Handler.keyboard");
local quest_status = require("MHR_Overlay.Game_Handler.quest_status");
local screen = require("MHR_Overlay.Game_Handler.screen");
@@ -88,15 +86,10 @@ local body_parts_customization = require("MHR_Overlay.UI.Customizations.body_par
local ailments_customization = require("MHR_Overlay.UI.Customizations.ailments_customization");
local ailment_buildups_customization = require("MHR_Overlay.UI.Customizations.ailment_buildups_customization");
local module_visibility_customization = require("MHR_Overlay.UI.Customizations.module_visibility_customization");
local large_monster_UI_customization = require("MHR_Overlay.UI.Customizations.large_monster_UI_customization");
local drawing = require("MHR_Overlay.UI.drawing");
if debug ~= nil and debug.enabled then
xy = "";
end
------------------------INIT MODULES-------------------------
-- #region
screen.init_module();
@@ -337,33 +330,6 @@ end);
-- #endregion
----------------------------D2D------------------------------
if debug ~= nil and debug.enabled then
if d2d ~= nil then
d2d.register(function()
end, function()
if not config.current_config.global_settings.renderer.use_d2d_if_available then
return;
end
if xy ~= "" then
d2d.text(drawing.font, "xy:\n" .. tostring(xy), 256, 71, 0xFF000000);
d2d.text(drawing.font, "xy:\n" .. tostring(xy), 255, 70, 0xFFFFFFFF);
end
end);
end
re.on_frame(function()
if d2d ~= nil and config.current_config.global_settings.renderer.use_d2d_if_available then
return;
end
if xy ~= "" then
draw.text("xy:\n" .. tostring(xy), 256, 31, 0xFF000000);
draw.text("xy:\n" .. tostring(xy), 255, 30, 0xFFFFFFFF);
end
end);
end
if imgui.begin_table == nil then
re.msg(language.current_language.customization_menu.reframework_outdated);
end

View File

@@ -1,5 +0,0 @@
local this = {};
this.enabled = false;
return this;

View File

@@ -36,11 +36,47 @@ local package = package;
this.language_folder = "MHR Overlay\\languages\\";
--[[
EXAMPLE:
unicode_glyph_ranges = {
0x0020, 0x00FF, -- Basic Latin + Latin Supplement
0x2000, 0x206F, -- General Punctuation
0x3000, 0x30FF, -- CJK Symbols and Punctuations, Hiragana, Katakana
0x31F0, 0x31FF, -- Katakana Phonetic Extensions
0x4e00, 0x9FAF, -- CJK Ideograms
0xFF00, 0xFFEF, -- Half-width characters
0
},
]]
--[[
EXAMPLE:
unicode_glyph_ranges = {
0x0020, 0x00FF, -- Basic Latin + Latin Supplement
0x0400, 0x052F, -- Cyrillic
0x2000, 0x206F, -- General Punctuation
0xFF00, 0xFFEF, -- Half-width characters
0
},
]]
--[[
EXAMPLE:
unicode_glyph_ranges = {
0x0020, 0x00FF, -- Basic Latin + Latin Supplement
0x1100, 0x11FF, -- Hangul Jamo
0x2000, 0x206F, -- General Punctuation
0x3130, 0x318F, -- Hangul Compatibility Jamo
0xAC00, 0xD7AF, -- Hangul Syllables
0xFF00, 0xFFEF, -- Half-width characters
0
},
]]
this.current_language = {};
this.default_language = {
font_name = "NotoSansKR-Bold.otf",
font_name = "",
unicode_glyph_ranges = {0},
parts = {
head = "Head",
neck = "Neck",

View File

@@ -826,11 +826,12 @@ function this.init()
language.current_language.parts.head,
language.current_language.parts.torso,
language.current_language.parts.wings,
language.current_language.parts.wingclaws,
language.current_language.parts.right_wingclaw,
language.current_language.parts.forelegs,
language.current_language.parts.hind_legs,
language.current_language.parts.tail,
language.current_language.parts.antenna
language.current_language.parts.antenna,
language.current_language.parts.left_wingclaw
},
[2072] = -- Risen Kushala Daora 2072

View File

@@ -215,6 +215,14 @@ function this.number.round(value)
return math.floor(value + 0.5);
end
function this.number.is_odd(value)
return value % 2 ~= 0;
end
function this.number.is_even(value)
return value % 2 == 0;
end
function this.string.trim(str)
return str:match("^%s*(.-)%s*$");
end

View File

@@ -62,7 +62,7 @@ local ValueType = ValueType;
local package = package;
this.font = nil;
this.font_range = {0x1, 0xFFFF, 0};
this.full_font_range = {0x1, 0xFFFF, 0};
this.is_opened = false;
this.status = "OK";
@@ -146,8 +146,22 @@ this.menu_font_changed = false;
this.config_name_input = "";
function this.reload_font(pop_push)
this.font = imgui.load_font(language.current_language.font_name,
config.current_config.global_settings.menu_font.size, this.font_range);
local cached_language = language.current_language;
local font_range = cached_language.unicode_glyph_ranges;
if cached_language.font_name == "" then
font_range = nil;
elseif cached_language.unicode_glyph_ranges == nil
or utils.table.is_empty(cached_language.unicode_glyph_ranges)
or #cached_language.unicode_glyph_ranges == 1
or not utils.number.is_odd(#cached_language.unicode_glyph_ranges) then
font_range = this.full_font_range;
end
this.font = imgui.load_font(cached_language.font_name, config.current_config.global_settings.menu_font.size, font_range);
if pop_push then
imgui.pop_font();
@@ -321,17 +335,18 @@ function this.draw()
imgui.set_next_window_pos(this.window_position, 1 << 3, this.window_pivot);
imgui.set_next_window_size(this.window_size, 1 << 3);
imgui.push_font(this.font);
this.is_opened = imgui.begin_window(
language.current_language.customization_menu.mod_name .. " v" .. config.current_config.version, this.is_opened,
this.window_flags);
if not this.is_opened then
imgui.pop_font();
imgui.end_window();
return;
end
imgui.push_font(this.font);
local config_changed = false;
local language_changed = false;
local modifiers_changed = false;
@@ -434,7 +449,7 @@ function this.draw()
if this.menu_font_changed and (apply_font_requested or config_changed) then
this.menu_font_changed = false;
this.reload_font(false);
this.reload_font();
end
if modules_changed or global_settings_changed or small_monster_UI_changed or large_monster_dynamic_UI_changed or
@@ -2278,7 +2293,7 @@ function this.init_module()
module_visibility_customization = require("MHR_Overlay.UI.Customizations.module_visibility_customization");
this.init();
this.reload_font(false);
this.reload_font();
end
return this;

View File

@@ -303,7 +303,7 @@
"y": "Y",
"z": "Z"
},
"font_name": "NotoSansKR-Bold.otf",
"font_name": "",
"parts": {
"abdomen": "Abdomen",
"amatsu_unknown": "?",
@@ -372,5 +372,8 @@
"wingclaw": "Wingclaw",
"wingclaws": "Wingclaws",
"wings": "Wings"
}
},
"unicode_glyph_ranges": [
0
]
}

View File

@@ -372,5 +372,20 @@
"wingclaw": "翼爪",
"wingclaws": "Wingclaws",
"wings": "翼"
}
},
"unicode_glyph_ranges": [
32,
255,
8192,
8303,
12288,
12543,
12784,
12799,
19968,
40879,
65280,
65519,
0
]
}

View File

@@ -372,5 +372,20 @@
"wingclaw": "날개발톱",
"wingclaws": "날개발톱",
"wings": "날개"
}
},
"unicode_glyph_ranges": [
32,
255,
4352,
4607,
8192,
8303,
12592,
12687,
44032,
55215,
65280,
65519,
0
]
}

View File

@@ -372,5 +372,16 @@
"wingclaw": "Крыло-коготь",
"wingclaws": "Крыло-коготь",
"wings": "Крылья"
}
},
"unicode_glyph_ranges": [
32,
255,
1024,
1241,
8192,
8303,
65280,
65519,
0
]
}

View File

@@ -372,5 +372,20 @@
"wingclaw": "翼爪",
"wingclaws": "翼爪",
"wings": "翼"
}
},
"unicode_glyph_ranges": [
32,
255,
8192,
8303,
12288,
12543,
12784,
12799,
19968,
40879,
65280,
65519,
0
]
}

View File

@@ -372,5 +372,20 @@
"wingclaw": "翼爪",
"wingclaws": "翼爪",
"wings": "翅膀"
}
},
"unicode_glyph_ranges": [
32,
255,
8192,
8303,
12288,
12543,
12784,
12799,
19968,
40879,
65280,
65519,
0
]
}