这是我的控制器代码;
public class GameScene extends Scene{
Engine mEngine;
Camera mCamera;
BaseGameActivity activity;
VertexBufferObjectManager vbom;
PhysicsWorld world;
Rectangle player;
Rectangle enemy;
public GameScene(Engine mEngine, Camera mCamera, BaseGameActivity activity, VertexBufferObjectManager vbom) {
this.mEngine = mEngine;
this.mCamera = mCamera;
this.activity = activity;
this.vbom = vbom;
load();
}
void load(){
world = new PhysicsWorld(new Vector2(0, SensorManager.GRAVITY_EARTH),false);
player = new Rectangle(mCamera.getWidth()/2,mCamera.getHeight()/2,50,50,vbom){
@Override
public boolean onAreaTouched(TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) {
fire();
return true;
}
};
enemy = new Rectangle(mCamera.getWidth()/2,mCamera.getHeight()/2 - 400,50,50,vbom){
@Override
public void onAttached() {
TimerHandler handler = new TimerHandler(3, new ITimerCallback() {
@Override
public void onTimePassed(TimerHandler pTimerHandler) {
enemyFire();
}
});
handler.setAutoReset(true);
registerUpdateHandler(handler);
super.onAttached();
}
};
attachChild(enemy);
attachChild(player);
registerUpdateHandler(world);
world.setContactListener(new ContactListener() {
@Override
public void beginContact(Contact contact) {
Log.e("begin","Contact");
}
@Override
public void endContact(Contact contact) {
}
@Override
public void preSolve(Contact contact, Manifold manifold) {
}
@Override
public void postSolve(Contact contact, ContactImpulse contactImpulse) {
}
});
registerTouchArea(player);
}
void enemyFire(){
Rectangle rect = new Rectangle(mCamera.getWidth()/2,mCamera.getHeight()/2 - 400,50,50,vbom);
FixtureDef fix = PhysicsFactory.createFixtureDef(0.5f,0.5f,0.5f);
Body b = PhysicsFactory.createBoxBody(world,rect, BodyDef.BodyType.KinematicBody,fix);
b.setLinearVelocity(0, 7);
attachChild(rect);
world.registerPhysicsConnector(new PhysicsConnector(rect, b));
}
void fire(){
Rectangle rect = new Rectangle(mCamera.getWidth()/2,mCamera.getHeight()/2,50,50,vbom);
FixtureDef fix = PhysicsFactory.createFixtureDef(0.5f,0.5f,0.5f);
Body b = PhysicsFactory.createBoxBody(world,rect, BodyDef.BodyType.KinematicBody,fix);
b.setLinearVelocity(0,-7);
attachChild(rect);
world.registerPhysicsConnector(new PhysicsConnector(rect,b));
}
代码的$fields = ['country','county','gor','locauth','parlc'];
$rules = [];
foreach ($fields as $i => $field) {
$rules[$field] = 'alpha_num|required_without_all:' . implode(',', array_except($fields, $i));
}
$validator = \Validator::make($input, $rules);
部分是新的。在此之前,它有效。现在我收到了错误;
alpha_num|
如果我将ErrorException in Validator.php line 1281:
preg_match() expects parameter 2 to be string, array given
更改为其他类型的验证规则(例如alpha_num
),则应用程序将按预期工作。那么email
特别存在问题吗? alpha_num
会返回相同的错误...
更新
即使我这么做;
alpha_dash
我仍然得到与以前完全相同的错误......