outfit fixes
This commit is contained in:
parent
1185dc9a00
commit
7eb57d5802
|
@ -23,12 +23,11 @@ local function onColorCheckChange(color)
|
||||||
if color == m_currentColor then
|
if color == m_currentColor then
|
||||||
color.onCheckChange = nil
|
color.onCheckChange = nil
|
||||||
color:setChecked(true)
|
color:setChecked(true)
|
||||||
color.onCheckChange = function() onColorCheckChange(color) end
|
color.onCheckChange = onColorCheckChange
|
||||||
else
|
else
|
||||||
m_currentColor.onCheckChange = nil
|
m_currentColor.onCheckChange = nil
|
||||||
m_currentColor:setChecked(false)
|
m_currentColor:setChecked(false)
|
||||||
local color2 = m_currentColor
|
m_currentColor.onCheckChange = onColorCheckChange
|
||||||
m_currentColor.onCheckChange = function() onColorCheckChange(color2) end
|
|
||||||
|
|
||||||
m_currentColor = color
|
m_currentColor = color
|
||||||
|
|
||||||
|
@ -50,12 +49,11 @@ local function onClotheCheckChange(clothe)
|
||||||
if clothe == m_currentClothe then
|
if clothe == m_currentClothe then
|
||||||
clothe.onCheckChange = nil
|
clothe.onCheckChange = nil
|
||||||
clothe:setChecked(true)
|
clothe:setChecked(true)
|
||||||
clothe.onCheckChange = function() onClotheCheckChange(clothe) end
|
clothe.onCheckChange = onClotheCheckChange
|
||||||
else
|
else
|
||||||
m_currentClothe.onCheckChange = nil
|
m_currentClothe.onCheckChange = nil
|
||||||
m_currentClothe:setChecked(false)
|
m_currentClothe:setChecked(false)
|
||||||
local clothe2 = m_currentClothe
|
m_currentClothe.onCheckChange = onClotheCheckChange
|
||||||
m_currentClothe.onCheckChange = function() onClotheCheckChange(clothe2) end
|
|
||||||
|
|
||||||
m_currentClothe = clothe
|
m_currentClothe = clothe
|
||||||
|
|
||||||
|
@ -75,18 +73,18 @@ end
|
||||||
|
|
||||||
local function update()
|
local function update()
|
||||||
local nameWidget = window:getChildById('name')
|
local nameWidget = window:getChildById('name')
|
||||||
nameWidget:setText(m_outfits[currentOutfit][2])
|
nameWidget:setText(m_outfits[m_currentOutfit][2])
|
||||||
|
|
||||||
local availableAddons = m_outfits[currentOutfit][3]
|
local availableAddons = m_outfits[m_currentOutfit][3]
|
||||||
local addon1 = window:getChildById('addon1')
|
local addon1 = window:getChildById('addon1')
|
||||||
local addon2 = window:getChildById('addon2')
|
local addon2 = window:getChildById('addon2')
|
||||||
local addon3 = window:getChildById('addon3')
|
local addon3 = window:getChildById('addon3')
|
||||||
addon1.onCheckChange = function() onAddonCheckChange(addon1, 1) end
|
|
||||||
addon2.onCheckChange = function() onAddonCheckChange(addon2, 2) end
|
|
||||||
addon3.onCheckChange = function() onAddonCheckChange(addon3, 4) end
|
|
||||||
addon1:setChecked(false)
|
addon1:setChecked(false)
|
||||||
addon2:setChecked(false)
|
addon2:setChecked(false)
|
||||||
addon3:setChecked(false)
|
addon3:setChecked(false)
|
||||||
|
addon1.onCheckChange = function(self) onAddonCheckChange(self, 1) end
|
||||||
|
addon2.onCheckChange = function(self) onAddonCheckChange(self, 2) end
|
||||||
|
addon3.onCheckChange = function(self) onAddonCheckChange(self, 4) end
|
||||||
addon1:setEnabled(false)
|
addon1:setEnabled(false)
|
||||||
addon2:setEnabled(false)
|
addon2:setEnabled(false)
|
||||||
addon3:setEnabled(false)
|
addon3:setEnabled(false)
|
||||||
|
@ -113,7 +111,7 @@ local function update()
|
||||||
addon3:setEnabled(true)
|
addon3:setEnabled(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
m_outfit.type = m_outfits[currentOutfit][1]
|
m_outfit.type = m_outfits[m_currentOutfit][1]
|
||||||
m_outfit.addons = 0
|
m_outfit.addons = 0
|
||||||
m_creature:setOutfit(m_outfit)
|
m_creature:setOutfit(m_outfit)
|
||||||
|
|
||||||
|
@ -139,14 +137,10 @@ function Outfit.create(creature, outfitList)
|
||||||
m_outfit = creature:getOutfit()
|
m_outfit = creature:getOutfit()
|
||||||
|
|
||||||
m_currentClothe = window:getChildById('head')
|
m_currentClothe = window:getChildById('head')
|
||||||
local head = window:getChildById('head')
|
window:getChildById('head').onCheckChange = onClotheCheckChange
|
||||||
local primary = window:getChildById('primary')
|
window:getChildById('primary').onCheckChange = onClotheCheckChange
|
||||||
local secondary = window:getChildById('secondary')
|
window:getChildById('secondary').onCheckChange = onClotheCheckChange
|
||||||
local detail = window:getChildById('detail')
|
window:getChildById('detail').onCheckChange = onClotheCheckChange
|
||||||
head.onCheckChange = function() onClotheCheckChange(head) end
|
|
||||||
primary.onCheckChange = function() onClotheCheckChange(primary) end
|
|
||||||
secondary.onCheckChange = function() onClotheCheckChange(secondary) end
|
|
||||||
detail.onCheckChange = function() onClotheCheckChange(detail) end
|
|
||||||
|
|
||||||
local creatureWidget = window:getChildById('creature')
|
local creatureWidget = window:getChildById('creature')
|
||||||
creatureWidget:setCreature(creature)
|
creatureWidget:setCreature(creature)
|
||||||
|
@ -169,17 +163,17 @@ function Outfit.create(creature, outfitList)
|
||||||
color:setChecked(true)
|
color:setChecked(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
color.onCheckChange = function() onColorCheckChange(color) end
|
color.onCheckChange = onColorCheckChange
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
m_creature = creature
|
m_creature = creature
|
||||||
m_outfits = outfitList
|
m_outfits = outfitList
|
||||||
|
|
||||||
currentOutfit = 1
|
m_currentOutfit = 1
|
||||||
for i=1,#outfitList do
|
for i=1,#outfitList do
|
||||||
if outfitList[i][1] == m_outfit.type then
|
if outfitList[i][1] == m_outfit.type then
|
||||||
currentOutfit = i
|
m_currentOutfit = i
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -200,18 +194,18 @@ function Outfit.accept()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Outfit.nextType()
|
function Outfit.nextType()
|
||||||
currentOutfit = currentOutfit + 1
|
m_currentOutfit = m_currentOutfit + 1
|
||||||
if currentOutfit > #m_outfits then
|
if m_currentOutfit > #m_outfits then
|
||||||
currentOutfit = 1
|
m_currentOutfit = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
update()
|
update()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Outfit.previousType()
|
function Outfit.previousType()
|
||||||
currentOutfit = currentOutfit - 1
|
m_currentOutfit = m_currentOutfit - 1
|
||||||
if currentOutfit <= 0 then
|
if m_currentOutfit <= 0 then
|
||||||
currentOutfit = #m_outfits
|
m_currentOutfit = #m_outfits
|
||||||
end
|
end
|
||||||
|
|
||||||
update()
|
update()
|
||||||
|
|
Loading…
Reference in New Issue