WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Supporting multiple clients (https://www.wowinterface.com/forums/showthread.php?t=58758)

fullmoon_sulfuras 05-24-21 10:34 AM

Supporting multiple clients
 
Hi there! I'm working on fixing LunarSphere for TBC Classic and wed like to have it working for the three clients: Retail, Classic, and BCC. The Backdrop System Changes seems the most problematic to handle, as every single frame creation will have an extra argument for inheriting from `BackdropTemplate` for Retail and BCC, but not for Classic.

Any elegant way to handle this? I didn't want to pepper the code with `if` on every single frame declaration.

Perhaps defining a `BackdropTemplate` only for the Classic client?

We have some frame templates defined in XML, so I'm guessing we would need to define the template in XML as well (because it's parsed before the Lua code).

Thanks!

Rilgamon 05-24-21 10:52 AM

See https://www.wowinterface.com/forums/...19&postcount=8 for more ...
Something like this should do the trick ...
Lua Code:
  1. local f = CreateFrame("Frame", nil, self, BackdropTemplateMixin and "BackdropTemplate")

For xml-files I'd recommend to take a look at the new toc-change mentioned here ... https://github.com/Stanzilla/WoWUIBu...ment-830351390

This way you can have different xml-files loaded by providing client-based toc files.

Fizzlemizz 05-24-21 01:26 PM

An alternative with xml to using different files is to use:
Code:

<OnLoad inherit="prepend">
    OnLoadFunc(self)
</OnLoad>

And then in OnLoadFunc before using any SetBackdropXxx calls use:

Lua Code:
  1. if BackdropTemplateMixin then
  2.     Mixin(self, BackdropTemplateMixin)
  3. end


All times are GMT -6. The time now is 04:23 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI