Project Zomboid

Project Zomboid

Mutie's Context Menu Icons
ㄥㄖ尺乇 2024 年 10 月 19 日 下午 12:38
Making the mod more versatile
You can make a new helper function that can look for a partial string match instead of being the exact context menu option by creating this function:

require "ISUI/ISContextMenu";

function ISContextMenu:getOptionFromStringIncluded(name)
ㅤfor i, v in ipairs(self.options) do
ㅤㅤif string.find(string.lower(name), string.lower(v.name), 1, true) then
ㅤㅤㅤreturn v
ㅤㅤend
ㅤend
end


Then, some context menu options can be set like this:

require("MutiesContextMenuIcons/HelperFunctions");

MutiesContextMenuIcons.Options["Rename"] = "media/ui/icons/redrawn/small/Rename.png";


So it'll just see if the options include the word "Rename" and apply the icon. I think this would make things easier
最后由 ㄥㄖ尺乇 编辑于; 2024 年 10 月 19 日 下午 1:01
< >
正在显示第 1 - 3 条,共 3 条留言
ㄥㄖ尺乇 2024 年 10 月 19 日 下午 11:48 
Made a mod for this:
Context Menu Icon MANIA

Feel free to check out the code. I reckoned the best way to apply the icon is to hook into addOption and make a separate object of options (Partial Match vs Exact Match)

And I made it so some can have a partial match, i.e. allowing in-between strings to exist but adding the same icon if a context option says "Remove [x] from [y]"
最后由 ㄥㄖ尺乇 编辑于; 2024 年 10 月 20 日 下午 5:16
Mutie  [开发者] 2024 年 12 月 19 日 上午 10:42 
I like this approach, and I'd like to write it up in my own way and add it to the community library[github.com] Chuck is building, if you don't mind.
ㄥㄖ尺乇 1 月 3 日 下午 1:26 
That sounds awesome!

I should mention one caveat to this is that translations will need to be made manually. Maybe we could find a way around that, though
< >
正在显示第 1 - 3 条,共 3 条留言
每页显示数: 1530 50