36ButtonPanel::ButtonPanel(
Object *parent,
int index,
const std::string &texture,
int rows,
int columns,
const std::string &direction,
Real CenterX,
Real CenterZ,
Real buttonwidth,
Real buttonheight,
Real spacingX,
Real spacingY,
Real voffset,
Real tw,
Real th,
bool autosize) :
Object(parent)
63 std::string name =
"Button Panel " +
ToString(index);
74 AddWall(
"Panel", texture, 0, -(
Width / 2), 0,
Width / 2, 0,
Height,
Height, 0, 0, tw, th, autosize);
79 AddWall(
"Panel", texture, 0, -(
Width / 2), 0,
Width / 2, 0,
Height,
Height, 0, 0, tw, th, autosize);
84 AddWall(
"Panel", texture, 0, 0, -(
Width / 2), 0,
Width / 2,
Height,
Height, 0, 0, tw, th, autosize);
89 AddWall(
"Panel", texture, 0, 0, -(
Width / 2), 0,
Width / 2,
Height,
Height, 0, 0, tw, th, autosize);
96 Move(CenterX, voffset - (
Height / 2), CenterZ);
102 for (
size_t i = 0; i <
controls.size(); i++)
106 controls[i]->parent_deleting =
true;
126 if (type ==
"ElevatorCar")
129 if (type ==
"CallStation")
147 std::vector<std::string> textures, names;
148 std::string newtype = type;
152 if (newtype ==
"stop")
155 textures.emplace_back(texture);
156 textures.emplace_back(texture_lit);
161 names.emplace_back(
"off");
162 names.emplace_back(newtype);
165 names.emplace_back(newtype);
167 return AddControl(sound, row, column, width, height, hoffset, voffset, 1, names, textures);
174 Vector3 position = Vector3::ZERO;
220 int control_index = (int)
controls.size() - 1;
225 std::vector<Action*> actions;
226 std::vector<std::string> actionsnull;
228 for (
size_t i = 0; i < action_names.size(); i++)
231 std::vector<Object*> parents;
233 if ((
off_action == 0 && action_names[i] ==
"off") || action_names[i] !=
"off")
236 actions.emplace_back(action);
238 if (action_names[i] ==
"off")
245 Control *control =
controls[control_index] =
new Control(
this, name,
false, sound, actionsnull, actions, textures,
Direction,
ButtonWidth * bwidth,
ButtonHeight * bheight,
false, selection_position);
248 controls[control_index]->Move(position);
262 for (
size_t i = 0; i <
controls.size(); i++)
269bool ButtonPanel::AddWall(
const std::string &name,
const std::string &texture,
Real thickness,
Real x1,
Real z1,
Real x2,
Real z2,
Real height1,
Real height2,
Real voffset1,
Real voffset2,
Real tw,
Real th,
bool autosize)
274 return sbs->
AddWallMain(wall, name, texture, thickness, x1, z1, x2, z2, height1, height2, voffset1, voffset2, tw, th, autosize);
281 for (
size_t i = 0; i <
controls.size(); i++)
283 controls[i]->ChangeFloorLight(floor, value);
291 for (
size_t i = 0; i <
controls.size(); i++)
306 if (index < 0 || index > (
int)
controls.size() - 1)
318 for (
size_t i = 0; i <
controls.size(); i++)
320 if (
controls[i]->FindActionPosition(name) > 0)
330 for (
size_t i = 0; i <
controls.size(); i++)
353 for (
size_t i = 0; i <
controls.size(); i++)
356 if (index > 0 &&
controls[i]->GetSelectPosition() != index)
357 controls[i]->SetSelectPosition(index);
int FindActionPosition(const std::string &name)
Wall * CreateWallObject(const std::string &name)
const std::string & GetName()
void SetName(const std::string &name)
virtual void Move(const Vector3 &vector, Real speed=1.0)
void SetValues(const std::string &type, const std::string &name, bool is_permanent, bool is_movable=true)
const std::string & GetType()
Action * AddAction(const std::string &name, std::vector< Object * > &action_parents, const std::string &command, const std::vector< std::string > ¶meters)
Real GetConfigFloat(const std::string &key, Real default_value)
bool AddWallMain(Wall *wallobject, const std::string &name, const std::string &texture, Real thickness, Real x1, Real z1, Real x2, Real z2, Real height_in1, Real height_in2, Real altitude1, Real altitude2, Real tw, Real th, bool autosize)
void ResetWalls(bool ToDefaults=false)
TextureManager * GetTextureManager()
bool RemoveAction(std::string name)
void DrawWalls(bool MainN, bool MainP, bool SideN, bool SideP, bool Top, bool Bottom)
void ResetTextureMapping(bool todefaults=false)
void EnableLighting(const std::string &material_name, bool value)
void SetCase(std::string &string, bool uppercase)
std::string ToString(int number)
bool IsNumeric(char character)
void TrimString(std::string &string)