7 self.warningStep = 0.02
11 self.isAbnormal = false
19 local entryX =
middleX + xPadding
20 local labelX =
middleX + xPadding - 5
24 self.recommendedNameLength = 8
25 self.descriptionLimit = 256
26 self.recommendedDescriptionLength = 24
28 -- 9 fields (1
double height) = 9 * 30 + 75 = 345
30 ISPanel.initialise(
self)
34 self.
title = ISLabel:new(
self.
uiHelper.GetMiddle(
self.
width, UIFont.Title,
title),
yOffset, 25,
title, 1, 1, 1, 1, UIFont.Title, true)
40 self.
subtitle = ISLabel:new(
self.
uiHelper.GetMiddle(
self.
width, UIFont.Large,
subtitle),
yOffset, 25,
subtitle, 1, 1, 1, 1, UIFont.Large, true)
46 self.genderLabel = ISLabel:new(labelX,
yOffset, 25, "Gender:", 1, 1, 1, 1, UIFont.Large, false)
47 self.genderLabel:initialise()
51 self.genderDropdown = ISComboBox:new(entryX,
yOffset, entryWidth, 25,
self,
self.onGenderChanged)
52 self.genderDropdown:addOption("Male")
53 self.genderDropdown:addOption("Female")
58 self.nameLabel = ISLabel:new(labelX,
yOffset, 25, "Name (32):", 1, 1, 1, 1, UIFont.Large, false)
59 self.nameLabel:initialise()
62 self.nameEntry = ISTextEntryBox:new("", entryX,
yOffset, entryWidth, 25)
63 self.nameEntry.backgroundColor = {r=0, g=0, b=0,
a=1.0}
64 self.nameEntry.borderColor = {r=1, g=0, b=0,
a=1.0}
65 self.nameEntry:initialise()
66 self.nameEntry:instantiate()
75 self.descriptionEntry = ISTextEntryBox:new("", entryX,
yOffset, entryWidth, 100)
76 self.descriptionEntry.backgroundColor = {r=0, g=0, b=0,
a=1.0}
77 self.descriptionEntry.borderColor = {r=1, g=0, b=0,
a=1}
78 self.descriptionEntry:initialise()
79 self.descriptionEntry:instantiate()
80 self.descriptionEntry:setMultipleLine(true)
81 self.descriptionEntry:setMaxLines(0)
86 self.ageLabel = ISLabel:new(labelX,
yOffset, 25, "Age (25):", 1, 1, 1, 1, UIFont.Large, false)
87 self.ageLabel:initialise()
90 self.ageSlider = ISSliderPanel:new(entryX,
yOffset, entryWidth, 25,
self,
self.onAgeChanged)
91 self.ageSlider.currentValue = 25
94 self.ageSlider.stepValue = 1
97 --[[
self.ageDropdown = ISComboBox:new(entryX,
yOffset, entryWidth, 25)
98 self.ageDropdown:addOption("18")
99 self.ageDropdown:addOption("19")
100 self.ageDropdown:addOption("20")
101 -- Add more
age options as needed
106 self.heightLabel = ISLabel:new(labelX,
yOffset, 25, "Height (5'10\"):", 1, 1, 1, 1, UIFont.Large, false)
107 self.heightLabel:initialise()
110 self.heightSlider = ISSliderPanel:new(entryX,
yOffset, entryWidth, 25,
self,
self.onHeightChanged)
111 self.heightSlider.currentValue = 70
114 self.heightSlider.stepValue = 1
117 --[[
self.heightFeetDropdown = ISComboBox:new(entryX,
yOffset, entryWidth, 25)
118 self.heightFeetDropdown:addOption("5")
119 self.heightFeetDropdown:addOption("6")
120 -- Add more
height options as needed
121 self:addChild(
self.heightFeetDropdown)--]]
126 self.heightInchesLabel = ISLabel:new(labelX,
yOffset, 25, "Height (10\"):", 1, 1, 1, 1, UIFont.Large, false)
127 self.heightInchesLabel:initialise()
128 self:addChild(
self.heightInchesLabel)
130 self.heightInchesSlider = ISSliderPanel:new(entryX,
yOffset, entryWidth, 25,
self,
self.onHeightInchesChanged)
131 self.heightInchesSlider.currentValue = 10
132 self.heightInchesSlider.minValue = 0
133 self.heightInchesSlider.maxValue = 11
134 self.heightInchesSlider.stepValue = 1
135 self:addChild(
self.heightInchesSlider)
138 --[[
self.heightInchesDropdown = ISComboBox:new(entryX,
yOffset, entryWidth, 25)
139 self.heightInchesDropdown:addOption("0")
140 self.heightInchesDropdown:addOption("1")
141 -- Add more
height options as needed
142 self:addChild(
self.heightInchesDropdown)--]]
146 self.weightLabel = ISLabel:new(labelX,
yOffset, 25, "Weight (150 lb):", 1, 1, 1, 1, UIFont.Large, false)
147 self.weightLabel:initialise()
150 self.weightSlider = ISSliderPanel:new(entryX,
yOffset, entryWidth, 25,
self,
self.onWeightChanged)
151 self.weightSlider.currentValue = 150
154 self.weightSlider.stepValue = 5
159 self.physiqueLabel = ISLabel:new(labelX,
yOffset, 25, "Physique:", 1, 1, 1, 1, UIFont.Large, false)
160 self.physiqueLabel:initialise()
163 self.physiqueDropdown = ISComboBox:new(entryX,
yOffset, entryWidth, 25)
164 self.physiqueDropdown:addOption("Skinny")
165 self.physiqueDropdown:addOption("Slim")
166 self.physiqueDropdown:addOption("Average")
167 self.physiqueDropdown:addOption("Muscular")
168 self.physiqueDropdown:addOption("Overweight")
169 self.physiqueDropdown:addOption("Obese")
170 self.physiqueDropdown:initialise()
172 self:addChild(
self.physiqueDropdown)
176 self.eyeColorLabel = ISLabel:new(labelX,
yOffset, 25, "Eye Color:", 1, 1, 1, 1, UIFont.Large, false)
177 self.eyeColorLabel:initialise()
180 self.eyeColorDropdown = ISComboBox:new(entryX,
yOffset, entryWidth, 25)
181 self.eyeColorDropdown:addOption("Blue")
182 self.eyeColorDropdown:addOption("Brown")
183 self.eyeColorDropdown:addOption("Gray")
184 self.eyeColorDropdown:addOption("Green")
185 self.eyeColorDropdown:addOption("Heterochromatic")
186 -- Add more eye
color options as needed
187 self:addChild(
self.eyeColorDropdown)
191 self.hairColorLabel = ISLabel:new(labelX,
yOffset, 25, "Hair Color:", 1, 1, 1, 1, UIFont.Large, false)
192 self.hairColorLabel:initialise()
195 self.hairColorDropdown = ISComboBox:new(entryX,
yOffset, entryWidth, 25)
196 self.hairColorDropdown:addOptionWithData("Black", {r = HAIR_COLOR_BLACK_R, g = HAIR_COLOR_BLACK_G, b = HAIR_COLOR_BLACK_B})
197 self.hairColorDropdown:addOptionWithData(
"Blonde", {r = HAIR_COLOR_BLONDE_R, g = HAIR_COLOR_BLONDE_G, b = HAIR_COLOR_BLONDE_B})
198 self.hairColorDropdown:addOptionWithData(
"Brown", {r = HAIR_COLOR_BROWN_R, g = HAIR_COLOR_BROWN_G, b = HAIR_COLOR_BROWN_B})
199 self.hairColorDropdown:addOptionWithData(
"Gray", {r = HAIR_COLOR_GRAY_R, g = HAIR_COLOR_GRAY_G, b = HAIR_COLOR_GRAY_B})
200 self.hairColorDropdown:addOptionWithData(
"Red", {r = HAIR_COLOR_RED_R, g = HAIR_COLOR_RED_G, b = HAIR_COLOR_RED_B})
201 self.hairColorDropdown:addOptionWithData(
"White", {r = HAIR_COLOR_WHITE_R, g = HAIR_COLOR_WHITE_G, b = HAIR_COLOR_WHITE_B})
202 self:addChild(
self.hairColorDropdown)
206 self.skinColorLabel = ISLabel:new(labelX,
yOffset, 25,
"Skin Color:", 1, 1, 1, 1, UIFont.Large, false)
207 self.skinColorLabel:initialise()
210 self.skinColorDropdown = ISComboBox:new(entryX,
yOffset, entryWidth, 25)
211 self.skinColorDropdown:addOptionWithData(
"Pale", SKIN_COLOR_PALE)
212 self.skinColorDropdown:addOptionWithData(
"White", SKIN_COLOR_WHITE)
213 self.skinColorDropdown:addOptionWithData(
"Tanned", SKIN_COLOR_TANNED)
214 self.skinColorDropdown:addOptionWithData(
"Brown", SKIN_COLOR_BROWN)
215 self.skinColorDropdown:addOptionWithData(
"Dark Brown", SKIN_COLOR_DARK_BROWN)
216 self:addChild(
self.skinColorDropdown)
220 -- HL2RP abnormal stuff
222 local warningText1 =
"Your character would be considered abnormal."
223 local warningText2 =
"The Combine will target you."
225 self.abnormalLabel1 = ISLabel:new(
self.
uiHelper.GetMiddle(
self.
width, UIFont.Large, warningText1),
yOffset, 50, warningText1, 1, 1, 1, 1, UIFont.Large, true)
226 self.abnormalLabel1:initialise()
227 self.abnormalLabel1:setVisible(false)
232 self.abnormalLabel2 = ISLabel:new(
self.
uiHelper.GetMiddle(
self.
width, UIFont.Large, warningText2),
yOffset, 50, warningText2, 1, 1, 1, 1, UIFont.Large, true)
233 self.abnormalLabel2:initialise()
234 self.abnormalLabel2:setVisible(false)
238 --[[
self.weightDropdown = ISComboBox:new(entryX,
yOffset, entryWidth, 25)
239 self.weightDropdown:addOption(
"0")
240 self.weightDropdown:addOption(
"25")
241 -- Add more
weight options as needed
242 self:addChild(
self.weightDropdown)--]]
250 self.ageLabel:setName(
"Age (" .. newValue ..
"):")
252 -- HL2RP abnormal stuff
254 if newValue < 20 or newValue >= 60 then
255 self.isAbnormal = true
256 self.abnormalLabel1:setVisible(true)
257 self.abnormalLabel2:setVisible(true)
259 self.isAbnormal = false
260 self.abnormalLabel1:setVisible(false)
261 self.abnormalLabel2:setVisible(false)
267 local feet = math.floor(newValue / 12)
268 local inches = newValue % 12
270 self.heightLabel:setName(
"Height (" .. feet ..
"' " .. inches ..
"\"):")
272 -- HL2RP abnormal stuff
274 if newValue < 60 or newValue > 74 then
275 self.isAbnormal = true
276 self.abnormalLabel1:setVisible(true)
277 self.abnormalLabel2:setVisible(true)
279 self.isAbnormal = false
280 self.abnormalLabel1:setVisible(false)
281 self.abnormalLabel2:setVisible(false)
287 self.weightLabel:setName(
"Weight (" .. newValue ..
" lb):")
289 -- HL2RP abnormal stuff
291 if newValue < 125 or newValue > 175 then
292 self.isAbnormal = true
293 self.abnormalLabel1:setVisible(true)
294 self.abnormalLabel2:setVisible(true)
296 self.isAbnormal = false
297 self.abnormalLabel1:setVisible(false)
298 self.abnormalLabel2:setVisible(false)
304 ISPanel.prerender(
self)
310 -- HL2RP abnormal stuff
312 if
self.abnormalLabel1 and
self.abnormalLabel2 and
self.abnormalLabel1:getIsVisible() == true and
self.abnormalLabel2:getIsVisible() == true then
334 if
self.nameLabel and
self.nameEntry then
339 self.nameEntry:setText(string.sub(
self.nameEntry:getText(), 1,
self.nameLimit))
354 red = math.max(0, math.min(1, ratio * 0.5))
355 green = math.max(0, math.min(1, 1 - ratio * 0.5))
363 if self.descriptionLabel and
self.descriptionEntry then
368 self.descriptionEntry:setText(string.sub(
self.descriptionEntry:getText(), 1,
self.descriptionLimit))
382 local ratio = (
usedCharacters -
self.recommendedDescriptionLength) / (
self.descriptionLimit -
self.recommendedDescriptionLength)
383 red = math.max(0, math.min(1, ratio * 0.5))
384 green = math.max(0, math.min(1, 1 - ratio * 0.5))
389 self.descriptionEntry.borderColor = {r=
red, g=
green, b=0,
a=0.7}
396 o = ISPanel:
new(parameters.x, parameters.y, parameters.width, parameters.height)
397 setmetatable(o,
self)
399 o.backgroundColor = {r=0, g=0, b=0,
a=0}
400 o.borderColor = {r=0, g=0, b=0,
a=0}
401 o.moveWithMouse =
false
402 o.playerObject = parameters.playerObject
void CharacterMaxHeight()
void CharacterMinHeight()
void CharacterMinWeight()
void CharacterMaxWeight()
void if select("#",...)()
void local descriptionLabel()
void self warningTurningRed()
void local usedCharacters()
void local remainingCharacters()
void PFW_CreateCharacterInfo()
void processingNotification backgroundColor a()
void onGenderChanged(dropdown)
void onWeightChanged(newValue, slider)
void onAgeChanged(newValue, slider)
void onHeightChanged(newValue, slider)