In diesem kleinen Wiki soll durch ein einfaches Beispiel gezeigt werden, wie sich ein bestehendes Menü durch ein eigenes oder modifiziertes Menü ersetzen lässt. Als Beispiel verwende ich hier das Handelsbeschränkungsmenü/traderestrictionsmenu.
At this page i will discribe to replace a vanilla menu with your own. For example i will change the traderestrictionsmenu
Als erstes solltet ihr in eurem Modordner folgendes erstellen:
- ui.xml
- ego_detailmonitorHelper.xml
- Einen Ordner mit dem Namen ui
At first you should create the following things in your mod folder:
- ui.xml
- ego_detailmonitorHelper.xml
- A Folder which named ui
Nun kopiert ihr euch in den Ordner ui die traderestrictions.lua Datei und benennt diese nach eurem Gut Dünken um. In meinem Beispiel habe ich sie einfach FC_traderestrictions.lua genannt.
Now copy the traderestrictions.lua in your folder ui an rename it. For example in my case i named it FC_traderestrictions.lua.
Jetzt fangen wir mit dem schwierigen Teil an. Wir erstellen die ui.xml und die ego_detailmonitorHelper.xml.
Now we begins with the modding. We create the ui.xml and the ego_detailmonitor.xml
In die ui.xml kommt der foldende Code:The following code is for the ui.xml:
Code Block |
---|
<addon name="FC_Traderestriction"> |
...
<environment type="detailmonitor"> |
...
<file name="ui/FC_menu_traderestrictions/FC_menu_traderestrictions.lua" /> |
...
<dependency name="ego_detailmonitorHelper" /> |
...
</environment> |
...
</addon> |
Bedeutung der Zeilen /meanings:
- environment type="detailmonitor" = Hier steht welchen Typ von Monitor man änder. Es existieren der Detailmonitor und das
- file name="ui/FC_menu_traderestrictions/FC_menu_traderestrictions.lua" = Hier steht der Pfad zu eurer neuen lua Datei / Thats the path of your lua file
- dependency name="ego_detailmonitorHelper"= Hier seht welches Hilfmenü ihr für euren Mod verwendet. In diesem Fall den detailmonitorHelper / Thats the line for the depency. In my example i use the DetailmonitorHelper
- addon name="FC_Traderestriction" = Das addon sagt dem Spiel das er etwas hinzufügen soll, der Name ist einfach der Name eurer Erweiterung /
Nach der ui.xml kommt noch die detailmonitorHelper.xml, welche ihr mit folgendem code verseht:The following code ist for the detailmonitorHelper.xml:
Code Block |
---|
<addon name="ego_detailmonitorHelper" viewtype="detailmonitor"> |
...
<file name="ui/FC_menu_traderestrictions/FC_menu_traderestrictions.lua" /> |
...
</addon> |
Nun folgt der Code des eigentlichen Menüs/ Now we write the new code for our menu:
Zum löschen des alten Menüs nutzt ihr die folgenden Codezeilen:
The following Codelines are to delete the old menu:
Code Block |
---|
local FC_menu = {} |
...
local Funcs = {} |
...
local function init() |
...
for _, menu in ipairs(Menus) |
...
do if menu.name == "TradeRestrictionsMenu" |
...
then -- Hier steht das Menu das ihr ersetzen möchtet /Here the name of the menu you want to |
...
replace FC_menu = |
...
menu menu.cleanup = Funcs.FC_cleanup -- Neue Definitionen für euer Menü/ New definitions for your own |
...
menu menu.buttonTradeRestriction = Funcs.FC_buttonTradeRestriction |
...
menu.buttonWareRestriction = Funcs.FC_buttonWareRestriction |
...
menu.buttonRestriction = Funcs.FC_buttonRestriction |
...
menu.onShowMenu = Funcs.FC_onShowMenu |
...
menu.showMenu = Funcs.FC_showMenu |
...
menu.onUpdate = Funcs.FC_onUpdate |
...
menu.onRowChanged = Funcs.FC_onRowChanged |
...
menu.onSelectElement = Funcs.FC_onSelectElement |
...
menu.onCloseElement = Funcs.FC_onCloseElement |
...
break
end
end
...
break
end
end
end |
Nachdem ihr das Alte Menü gelöcht habt könnt ihr euren eigenen Code dahinter schreiben und somit das neue Menü erstellen. Für ein Codebeispiel (das ist etwas zu lang für diese Seite) schriebt mir einfach eine PN im Egosoft Forum. Mein Name ist FindolCaleb
After deleting the old menu you can add your own code after that. For examples please write a PN to me FindolCaleb at the Egosoft Forum ( because the maincode is to long for this side)