Skip to content

Commit

Permalink
fix nameplate font
Browse files Browse the repository at this point in the history
  • Loading branch information
bssthu committed Nov 21, 2016
1 parent a9d8404 commit a032dbc
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 46 deletions.
96 changes: 50 additions & 46 deletions AddOns/EsoZH/EsoZH.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,64 +3,68 @@ EsoZH.name = "EsoZH"
EsoZH.Flags = { "en", "zh" }

function EsoZH_Change(lang)
zo_callLater(function()
SetCVar("language.2", lang)
ReloadUI()
end, 500)
zo_callLater(function()
SetCVar("language.2", lang)
ReloadUI()
end, 500)
end

function EsoZH:RefreshUI()
local flagControl
local count = 0
local flagTexture
for _, flagCode in pairs(EsoZH.Flags) do
flagTexture = "EsoZH/flags/"..flagCode..".dds"
flagControl = GetControl("EsoZH_FlagControl_"..tostring(flagCode))
if flagControl == nil then
flagControl = CreateControlFromVirtual("EsoZH_FlagControl_", EsoZHUI, "EsoZH_FlagControl", tostring(flagCode))
GetControl("EsoZH_FlagControl_"..flagCode.."Texture"):SetTexture(flagTexture)
if EsoZH:GetLanguage() ~= flagCode then
flagControl:SetAlpha(0.3)
if flagControl:GetHandler("OnMouseDown") == nil then flagControl:SetHandler("OnMouseDown", function() EsoZH_Change(flagCode) end) end
end
end
flagControl:ClearAnchors()
flagControl:SetAnchor(LEFT, EsoZHUI, LEFT, 14 +count*34, 0)
count = count + 1
end
EsoZHUI:SetDimensions(25 +count*34, 50)
EsoZHUI:SetMouseEnabled(true)
local flagControl
local count = 0
local flagTexture
for _, flagCode in pairs(EsoZH.Flags) do
flagTexture = "EsoZH/flags/"..flagCode..".dds"
flagControl = GetControl("EsoZH_FlagControl_"..tostring(flagCode))
if flagControl == nil then
flagControl = CreateControlFromVirtual("EsoZH_FlagControl_", EsoZHUI, "EsoZH_FlagControl", tostring(flagCode))
GetControl("EsoZH_FlagControl_"..flagCode.."Texture"):SetTexture(flagTexture)
if EsoZH:GetLanguage() ~= flagCode then
flagControl:SetAlpha(0.3)
if flagControl:GetHandler("OnMouseDown") == nil then flagControl:SetHandler("OnMouseDown", function() EsoZH_Change(flagCode) end) end
end
end
flagControl:ClearAnchors()
flagControl:SetAnchor(LEFT, EsoZHUI, LEFT, 14 +count*34, 0)
count = count + 1
end
EsoZHUI:SetDimensions(25 +count*34, 50)
EsoZHUI:SetMouseEnabled(true)
end

function EsoZH:GetLanguage()
local lang = GetCVar("language.2")
if(lang == "zh") then return lang end
return "en"
local lang = GetCVar("language.2")
if(lang == "zh") then return lang end
return "en"
end

function EsoZH:OnInit(eventCode, addOnName)
if (addOnName):find("^ZO_") then return end
if (addOnName):find("^ZO_") then return end

for _, flagCode in pairs(EsoZH.Flags) do
ZO_CreateStringId("SI_BINDING_NAME_"..string.upper(flagCode), string.upper(flagCode))
end

SetSCTKeyboardFont("EsoZH/fonts/univers67.otf|29|soft-shadow-thick")
SetNameplateKeyboardFont("EsoZH/fonts/univers67.otf", 4)
SetNameplateGamepadFont("EsoZH/fonts/ftn87.otf", 4)

for _, flagCode in pairs(EsoZH.Flags) do
ZO_CreateStringId("SI_BINDING_NAME_"..string.upper(flagCode), string.upper(flagCode))
end
EsoZH:RefreshUI()

EsoZH:RefreshUI()
function ZO_GameMenu_OnShow(control)
if control.OnShow then
control.OnShow(control.gameMenu)
EsoZHUI:SetHidden(hidden)
end
end

function ZO_GameMenu_OnShow(control)
if control.OnShow then
control.OnShow(control.gameMenu)
EsoZHUI:SetHidden(hidden)
end
end

function ZO_GameMenu_OnHide(control)
if control.OnHide then
control.OnHide(control.gameMenu)
EsoZHUI:SetHidden(not hidden)
end
end
function ZO_GameMenu_OnHide(control)
if control.OnHide then
control.OnHide(control.gameMenu)
EsoZHUI:SetHidden(not hidden)
end
end
end

EVENT_MANAGER:RegisterForEvent("EsoZH_OnAddOnLoaded", EVENT_ADD_ON_LOADED, function(_event, _name) EsoZH:OnInit(_event, _name) end)
1 change: 1 addition & 0 deletions scripts/utils/lang_def.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
'interact-win': ('149328292', ),
'country-or-region': ('152988005', ),
'letter': ('219317028', ),
'set': ('38727365', ), # 套装名
'quest-end': ('116521668', '168415844'), # NPC对话,总结
'quest-talk-long': ('3952276', '55049764', '200879108', '103224356', # NPC
'115740052', '187173764',
Expand Down

0 comments on commit a032dbc

Please sign in to comment.