outfit window init

This commit is contained in:
Henrique
2011-11-14 20:32:55 -02:00
parent da3b39017d
commit a95d0bcc1f
16 changed files with 242 additions and 5 deletions

View File

@@ -14,5 +14,6 @@ Module
importStyles 'styles/windows.otui'
importStyles 'styles/listboxes.otui'
importStyles 'styles/items.otui'
importStyles 'styles/creatures.otui'
return true

View File

@@ -0,0 +1,6 @@
Creature < UICreature
size: 66 66
creature-margin: 1
border-image:
source: /core_styles/images/panel_flat.png
border: 1

View File

@@ -14,4 +14,5 @@ Module
- viplist
- textmessage
- chat
- outfit

41
modules/outfit/outfit.lua Normal file
View File

@@ -0,0 +1,41 @@
Outfit = {}
-- private variables
local window = nil
-- public functions
function Outfit.test()
local button = UIButton.create()
UI.root:addChild(button)
button:setText('Set Outfit')
button:setStyle('Button')
button:moveTo({x = 0, y = 100})
button:setWidth('100')
button:setHeight('30')
button.onClick = function() Game.openOutfitWindow() end
end
function Outfit.create(creature, outfitList)
if window ~= nil then
Outfit.destroy()
end
window = loadUI("/outfit/outfit.otui", UI.root)
local creatureWidget = window:getChildById('creature')
creatureWidget:setCreature(creature)
end
function Outfit.destroy()
window:destroy()
window = nil
end
-- private functions
-- hooked events
connect(Game, { onOpenOutfitWindow = Outfit.create,
onLogout = Outfit.destroy })
connect(Game, { onLogin = Outfit.test })

View File

@@ -0,0 +1,10 @@
Module
name: outfit
description: Change local player outfit
author: OTClient team
website: https://github.com/edubart/otclient
onLoad: |
require 'outfit'
return true

View File

@@ -0,0 +1,40 @@
Window
title: Select Outfit
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
Creature
id: creature
anchors.top: parent.top
anchors.left: parent.left
margin.top: 30
margin.left: 20
HorizontalSeparator
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: next.top
margin.left: 16
margin.right: 16
margin.bottom: 10
Button
id: buttonOk
text: Ok
width: 64
anchors.right: next.left
anchors.bottom: parent.bottom
margin.bottom: 16
margin.right: 16
onClick: Outfit.accept()
Button
id: buttonCancel
text: Cancel
width: 64
anchors.right: parent.right
anchors.bottom: parent.bottom
margin.bottom: 16
margin.right: 16
onClick: Outfit.destroy()