Changeset 8448 for code/branches/tutoriallevel2/data/gui/scripts
- Timestamp:
- May 11, 2011, 10:45:56 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/tutoriallevel2/data/gui/scripts/NotificationLayer.lua
r8446 r8448 27 27 ["window"] = queue, 28 28 ["name"] = name, 29 [" edit"] = nil,29 ["maxSize"] = size, 30 30 ["visible"] = false, 31 31 ["fontSize"] = 12, … … 183 183 -- Change the size of the queue. 184 184 -- The parameters are (in order) 'name of the queue', 'relative width', 'absolute width in pixel', 'relative height', 'absolute heigth in pixel'. 185 -- Additionally the last parameter can be ommitted and relativeHeight can be set to the size (i.e. the maximal number of notifications displayed) of the queue, which leads to the height being set such that all notifications can be displayed.185 -- Additionally the last two parameters can be ommitted, which leads to the height being set such that all notifications can be displayed. using the size of the queue. 186 186 function P.resizeQueue(queueName, relativeWidth, absoluteWidth, relativeHeight, absoluteHeigth) 187 local queueWindow = P.queueList[queueName].window 187 local queue = P.queueList[queueName] 188 local queueWindow = queue.window 188 189 if queueWindow == nil then 189 190 return 190 191 end 191 192 if absoluteHeigth == nil then 192 absoluteHeigth = P.queueHeightHelper( P.queueList[queueName], relativeHeight)193 absoluteHeigth = P.queueHeightHelper(queue, queue.maxSize) 193 194 relativeHeight = 0 194 195 end … … 196 197 end 197 198 198 -- Change the font size and font color of all notifications in a queueHeightHelper 199 -- The parameters are (in order) 'name of the queue', 'font size', 'ARGB of the font color in hex notation'. 200 function P.changeQueueFont(queueName, size, color) 201 local queue = P.queueList[queueName] 202 local queueWindow = queue.window 203 if queueWindow == nil then 204 return 205 end 206 207 queue.fontSize = size 208 local changeColor = false 209 if color ~= nil then 210 queue.fontColor = color 211 changeColor = true 212 end 213 for i=queue.first,queue.last-1 do 214 P.setItemFontHelper(queue.items[i], queue, changeColor) 215 end 216 end 217 199 -- Change the horizontal alignment of the displayed notifications. 200 -- The parameters are the name of the queue and the alignment parameter, 218 201 function P.changeQueueAlignment(queueName, alignment) 219 202 local queue = P.queueList[queueName] … … 222 205 return 223 206 end 224 207 225 208 queue.alignment = alignment 226 209 local item = nil … … 228 211 item = queue.items[i] 229 212 item:setProperty("HorzFormatting", queue.alignment) 213 end 214 end 215 216 -- Change the font size of all notifications in a queue. 217 -- The parameters are (in order) 'name of the queue', 'font size'. 218 function P.changeQueueFontSize(queueName, size) 219 local queue = P.queueList[queueName] 220 local queueWindow = queue.window 221 if queueWindow == nil then 222 return 223 end 224 225 queue.fontSize = size 226 for i=queue.first,queue.last-1 do 227 P.setItemFontHelper(queue.items[i], queue, false) 228 end 229 end 230 231 -- Change the font color of all notifications in a queue. 232 -- The parameters are (in order) 'name of the queue', 'ARGB of the font color in hex notation'. 233 function P.changeQueueFontColor(queueName, color) 234 local queue = P.queueList[queueName] 235 local queueWindow = queue.window 236 if queueWindow == nil then 237 return 238 end 239 240 queue.fontColor = color 241 for i=queue.first,queue.last-1 do 242 P.setItemFontHelper(queue.items[i], queue, true) 230 243 end 231 244 end
Note: See TracChangeset
for help on using the changeset viewer.