4 id
= "ui:interface:appzone",
5 homeuri
= "?action=appzone_toolbar",
6 launchuri
= "?action=launch_app",
7 addappuri
= "?action=list_user_apps",
12 -- use client.cfg value when available
13 local uri
= getClientCfg("AppZoneUrl")
14 if uri
== nil or uri
== '' then
15 uri
= 'http://app.ryzom.com/'
18 AppZone
.homeuri
= uri
.. AppZone
.homeuri
19 AppZone
.launchuri
= uri
.. AppZone
.launchuri
20 AppZone
.addappuri
= uri
.. AppZone
.addappuri
22 function AppZone
:getRoot()
26 function AppZone
:onButtonHome()
27 local webig
= getUI("ui:interface:webig")
28 webig
:find("html").url
= self
.addappuri
32 function AppZone
:calculateSize(count
, spacer
, mode
)
34 if mode
== "h_bar" then
36 w
= count
* self
.imagesize
+ spacer
* 15
38 h
= self
.imagesize
+ 2
39 elseif mode
== "h_box" then
40 w
= count
* self
.imagesize
42 h
= self
.imagesize
+ 2
45 elseif mode
== "v_bar" then
47 h
= count
* self
.imagesize
+ spacer
* 15
49 w
= self
.imagesize
+ 2 + 18
51 h
= count
* self
.imagesize
53 w
= self
.imagesize
+ 2
58 local ui
= getUI("ui:interface")
69 function AppZone
:setElementCount(count
,spacer
,m
)
72 local root
= self
:getRoot()
73 local content
= root
:find("content")
74 local html
= root
:find("html")
76 local button_toggle
= root
:find("toggle_mode")
77 local button_reload
= root
:find("browse_reload")
78 local button_home
= root
:find("browse_home")
80 local w
, h
= self
:calculateSize(count
, spacer
, self
.mode
)
86 -- set position of buttons
87 if self
.mode
== "h_bar" then
88 -- button_toggle.posref = "BL BL"
91 -- button_reload.posref = "TL BL"
96 -- button_home.posref = "BR BR"
98 button_home
.y
= -3 + 5
99 elseif self
.mode
== "h_box" then
100 -- button_toggle.posref = "TL TL"
102 button_toggle
.y
= h
- 15
103 -- button_reload.posref = "TL BL"
106 button_reload
.x
= -25
107 button_reload
.y
= -4 - 20
108 -- button_home.posref = "BR BR"
110 button_home
.y
= -3 + h
- 18
111 elseif self
.mode
== "v_bar" then
112 -- button_toggle.posref = "TL TL"
114 button_toggle
.y
= h
- 15
115 -- button_reload.posref = "TL BL"
120 -- button_home.posref = "BR BR"
121 button_home
.x
= 4 - 7
124 -- button_toggle.posref = "TL TL"
126 button_toggle
.y
= h
- 15
127 -- button_reload.posref = "TL BL"
130 button_reload
.x
= -25
131 button_reload
.y
= -4 - 20
132 -- button_home.posref = "BR BR"
133 button_home
.x
= 0 - w
+ 54 + 12
138 function AppZone
:setMode(m
)
144 function AppZone
:setActive(s
)
145 self
:getRoot().active
= s
148 function AppZone
:launchApp(appid
, appwin
, appurl
)
150 if string.match(appid
, "^[0-9]+$") then
151 appwin
= "app" .. tostring(appid
)
158 appurl
= self
.launchuri
.. "&appid=" .. tostring(appid
)
162 WebBrowser
:openWindow(appwin
, appurl
)
164 -- fallback if WebBrowser not present
165 local webig
= getUI("ui:interface:webig")
166 webig
:find("html").url
= appurl
;
171 function AppZone
:reload()
172 local url
= self
.homeuri
173 url
= url
.. "&mode=" .. tostring(self
.mode
)
175 local html
= self
:getRoot():find("html")
179 -- slash command: /appzone <cmd>
180 function AppZone
:handle(cmd
)
181 if cmd
== 'show' then
183 elseif cmd
== 'hide' then
184 self
:setActive(false)
185 elseif cmd
== 'reload' then
187 elseif cmd
== 'list' then
195 RYZOM_APPZONE_VERSION
= 10469