我想制作一个输出特定代码的php脚本。我在这个游戏中开发了很多东西,但其中很多都是相同的代码。比如类名。
因此,我想制作一个php脚本,在那里我可以填充大小写,并用什么价格勾选什么类名。例如
它必须输出这样的东西:
case "civ_car":<--- changeable
{
_return =
[
["B_Quadbike_01_F",3333],<<---- classname followed by a price
["C_Hatchback_01_F",8333],
["C_Offroad_01_F",16666],
["C_SUV_01_F",40000],
["C_Van_01_transport_F",50000],
["C_Hatchback_01_sport_F",53333]<<------ no , here
];
};
价格很奇怪,因为在游戏中会乘以1.5。
但有时它需要看起来像这样有点不同:
case "med_shop":<<---- also want this to be changeable
{
_return = [
["C_Hatchback_01_F",5000]<<--- these dont need a ; at the end
];
if(__GETC__(life_mediclevel) >= 2) then <<---- also wanna be able to change the life_mediclevel and the statement behind it.
{
_return pushBack ["C_Van_01_box_F",45224];<<---- these need a ; at the end
};
if(__GETC__(life_mediclevel) >= 3) then
{
_return pushBack ["C_SUV_01_F",50000];
_return pushBack ["C_Offroad_01_F",50000];
};
if(__GETC__(life_mediclevel) >= 4) then
{
_return pushBack ["C_Hatchback_01_sport_F",5000];
};
};
这方面的php脚本会是什么样子?如果你们能把我推向正确的方向,我就可以完成剩下的工作。如果你需要JavaScript和/或HTML5,那没问题。
提前感谢
Joey
call_user_func()应该能够帮助您。