Java 类com.badlogic.gdx.utils.Timer 实例源码

项目:gdx-gamesvcs    文件:GameJoltClient.java   
protected void sendOpenSessionEvent() {
    if (!isSessionActive())
        return;

    Map<String, String> params = new HashMap<String, String>();
    addGameIDUserNameUserToken(params);

    final Net.HttpRequest http = buildJsonRequest("sessions/open/", params);

    if (http != null)
        Gdx.net.sendHttpRequest(http, new NoOpResponseListener());

    pingTask = Timer.schedule(new Timer.Task() {
        @Override
        public void run() {
            sendKeepSessionOpenEvent();
        }
    }, GJ_PING_INTERVAL, GJ_PING_INTERVAL);

}
项目:Parasites-of-HellSpace    文件:SpawningEnemy.java   
public void create()
{
    enemyStack = new Stack<Enemy>();


    Timer.schedule(new Task()
    {
        @Override
        public void run()
        {
            int choiceToMove = MathUtils.random(3);
            for(int i = 0; i < 5; i++)
            {
                enemyStack.add(new WeakEnemy(choiceToMove, xOffset * i, yOffset * i));
            }
            //Timer.instance().clear();
        }
    }, 0.5f, intervalBetweenSpawn);
}
项目:enklave    文件:ProgressBarEnergy.java   
public void downenergy(int value){
    bar.act(Gdx.graphics.getDeltaTime());
    infoProfile.getDateUserGame().setEnergy(infoProfile.getDateUserGame().getEnergy() - value);
    FadeIn();
    new Timer().schedule(new Timer.Task() {
        @Override
        public void run() {
            bar.setAnimateDuration(3);
            bar.setValue((float) infoProfile.getDateUserGame().getEnergy());
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            mapsScreen.startTimer();
        }
    }, 1000);
}
项目:enklave    文件:ProgressBarEnergy.java   
public void update() {
    bar.act(Gdx.graphics.getDeltaTime());
    infoProfile.getDateUserGame().setEnergy(infoProfile.getDateUserGame().getEnergy());
    username.setText("L "+infoProfile.getDateUserGame().getLevel()+" "+infoProfile.getDateUser().getFristName());
    bar.setValue(infoProfile.getDateUserGame().getEnergy() - infoProfile.getValueenergyuse());
    FadeIn();
    new Timer().schedule(new Timer.Task() {
        @Override
        public void run() {
            bar.setAnimateDuration(3);
            bar.setValue((float) infoProfile.getDateUserGame().getEnergy());
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            if(infoProfile.getDateUserGame().getEnklaveCombatId() == -1)
                mapsScreen.startTimer();
        }
    } ,1);
}
项目:enklave    文件:ScreenCombat.java   
public void screenExit(String message){
        messageShow = message;
        showtextexit = true;
        circleShow = false;
        InformationProfile.getInstance().getDateUserGame().setEnklaveCombatId(-1);
        Label labelmess = new Label("You already joined this combat once!",new Label.LabelStyle(bitmapFont,Color.WHITE));
        labelmess.setPosition(WIDTH /2 - labelmess.getWidth() /2,labelmess.getHeight()*2);
        stage.addActor(labelmess);
        combatFight.deselect();
        attachers.deselect();
        defenders.deselect();
        if(!message.contentEquals("You lose!")){
            new Timer().scheduleTask(new Timer.Task() {
                @Override
                public void run() {
                    managerAssets.getAssertEnklaveScreen().setIsupdate(false);
                    new GetEnklaveDetails().makeRequest(InformationEnklave.getInstance().getId(), managerAssets);
//                    gameManager.setScreen(gameManager.screenEnklave);
                }
            },1);
        }
    }
项目:FlappySpinner    文件:MenuScreen.java   
public void setUpPlayButton() {
    playButton = new GameButton(Constants.RECTANGLE_BUTTON_WIDTH, Constants.RECTANGLE_BUTTON_HEIGHT, "playbtn", false);
    playButton.setPosition(Constants.WIDTH / 4 - playButton.getWidth() * 2 / 5,
            Constants.HEIGHT / 2 - playButton.getHeight() * 2.5f -2);
    playButton.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            //FlappySpinner.gameManager.hideAd();
            float delay = 0.3f;
            setUpFadeOut();
            Timer.schedule(new Timer.Task() {
                @Override
                public void run() {
                    game.setScreen(new GameScreen(game, 0, false));
                }
            }, delay);
        }
    });
    stage.addActor(playButton);
}
项目:FlappySpinner    文件:MenuScreen.java   
public void setUpMarketButton() {
    marketButton = new GameButton(Constants.RECTANGLE_BUTTON_WIDTH, Constants.RECTANGLE_BUTTON_HEIGHT, "market", false);
    marketButton.setPosition(Constants.WIDTH * 3 / 4 - marketButton.getWidth() * 3 / 5,
            Constants.HEIGHT / 2 - marketButton.getHeight() * 2.5f - 2);
    marketButton.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            float delay = 0.3f;
            setUpFadeOut();
            Timer.schedule(new Timer.Task() {
                @Override
                public void run() {
                    game.setScreen(new MarketScreen(game));
                }
            }, delay);
        }
    });
    stage.addActor(marketButton);
}
项目:cgc-game    文件:CGCWorld.java   
public void setTimersAndTasks()
{
    endTask = new Timer.Task()
    {
        public void run()
        {   
            Gdx.app.log("timer", "Ending game");
            endGameWorld(won());
        }
    };

    endClock = new CGCTimer(endTask, endTime, false, "endClock");

    respawnTask = new Timer.Task()
    {
        public void run()
        {
            respawnHeight = getPlayerAverageY();
        }
    };

    respawnClock = new CGCTimer(respawnTask, CAMERA_DELAY, (int)respawnTime * 60);
    respawnClock.name = "respawnClock";
}
项目:cgc-game    文件:Helicopter.java   
public Helicopter(CGCWorld theWorld, Animation newLowAnimation, Animation newMidAnimation,
        Animation newHighAnimation, EntityType entityType, Body body)
{
    super(newLowAnimation, newMidAnimation, newHighAnimation, entityType, body);
    gameWorld = theWorld;
    Gdx.app.log("In the pipe", "five by five");
    rotation = 90;

    //SoundManager.playSound("helicopter", false);

    hoverTask = new Timer.Task() {

        public void run() 
        {
            stopped = false;
            returnTrip = true;
            getBody().setLinearVelocity(new Vector2(4,0));
        }
    };

    hoverClock = new CGCTimer(hoverTask, hoverTime, false, "hoverClock");
    body.setLinearVelocity(new Vector2(4, 0));
}
项目:cgc-game    文件:RookieCop.java   
public RookieCop(CGCWorld theWorld, CharacterArt art, EntityType pEntityType, Body attachedBody, short pID) {
    super(art, pEntityType, attachedBody, pID);
    gameWorld = theWorld;

    maxGrabStrength = MAX_GRAB_STRENGTH_BASE + Math.round(((float)(Math.random() * 2) - 1.0f) * MAX_GRAB_RANGE);
    currentGrabStrength = maxGrabStrength;
    noGrab = false;
    setCoins(0);

    grabCooldownTask = new Timer.Task()
    {
        public void run()
        {
            currentGrabStrength = maxGrabStrength;
            noGrab = false;
        }
    };

    grabCooldownTimer = new CGCTimer(grabCooldownTask, grabCooldown, false, "grabCooldownTimer");
}
项目:cgc-game    文件:RookieCop.java   
public RookieCop(CGCWorld theWorld, Animation newLowAnimation, Animation newMidAnimation,
        Animation newHighAnimation, EntityType pEntityType, Body attachedBody, short pID)
{
    super(newLowAnimation, newMidAnimation, newHighAnimation, pEntityType, attachedBody, pID);

    gameWorld = theWorld;

    maxGrabStrength = MAX_GRAB_STRENGTH_BASE + Math.round(((float)(Math.random() * 2) - 1.0f) * MAX_GRAB_RANGE);
    currentGrabStrength = maxGrabStrength;
    noGrab = false;
    setCoins(0);

    grabCooldownTask = new Timer.Task() 
    {   
        public void run() 
        {   
            currentGrabStrength = maxGrabStrength;
            noGrab = false;
        }
    };

    grabCooldownTimer = new CGCTimer(grabCooldownTask, grabCooldown, false, "grabCooldownTimer");
}
项目:cgc-game    文件:Sheriff.java   
public Sheriff(Animation newLowAnimation, Animation newMidAnimation,
        Animation newHighAnimation, EntityType pEntityType,
        Body attachedBody, Boss bo, float startAlpha)
{
    super(newLowAnimation, newMidAnimation, newHighAnimation, pEntityType,
            attachedBody, startAlpha);
    boss = bo;
    fireTask = new Timer.Task()
    {

        public void run()
        {
            fire();
        }
    };

    fireTimer = new CGCTimer(fireTask, fireTime, true, "fireTimer");

    do
    {
        target = CGCWorld.getPrisoners().random();
    }while(!target.isAlive() || target == null);

    TimerManager.addTimer(fireTimer);
}
项目:cgc-game    文件:SoundEffect.java   
public SoundEffect(FileHandle f)
{
    mySound = Gdx.audio.newSound(f);
    playTime = (float)(f.length())/(float)(16384);

    playTask = new Timer.Task() {

        public void run() 
        {
            if(!looping)
            {
                playing = false;
                paused = false;
            }
        }
    };

    playTimer = new CGCTimer(playTask, playTime, looping, "playTimer");
}
项目:cgc-game    文件:Credits.java   
private void setUpTimer()
{
    hidePromptTask = new Timer.Task()
    {
        public void run()
        {
            if (yDisplacement < creditsBottom)
            {
                showButtonPrompt = false;
            }
        }
    };

    autoScrollTask = new Timer.Task()
    {
        public void run()
        {
            autoScroll = true;
        }
    };

    hidePromptTimer = new CGCTimer(hidePromptTask, hidePromptTime, false, "hidePromptTimer");
    autoScrollTimer = new CGCTimer(autoScrollTask, autoScrollTime, false, "autoScrollTimer");
}
项目:ZombieInvadersVR    文件:Enemy.java   
public void keepAttacking() {
    changeState(Enemy.State.ATTACKING, 1, new GameObject.OnAnimationComplete() {
        @Override public void run(GameObject object) {
            changeState(Enemy.State.STANDING);
        }
    });

    context.removeLife();
    if(context.life.isEmpty()) return;

    int randomAttack = (int) Math.floor(context.soundsEffectEnemyAttack.size()*Math.random());
    context.soundsEffectEnemyAttack.get(randomAttack).play();

    Timer.schedule(new Timer.Task() {
        @Override
        public void run() {
            if(!state.equals(Enemy.State.DYING))
                keepAttacking();
        }
    }, TIME_TO_ATTACK);     
}
项目:ZombieInvadersVR    文件:Enemy.java   
public void die() {
    final Enemy enemy = this;
    enabled = false;
    context.tweenManager.killTarget(this, GameObjectAccessor.XYZ);
    context.tweenManager.killTarget(this, GameObjectAccessor.ROTATION);

    changeState(Enemy.State.DYING, 1);

    Timer.schedule(new Timer.Task() {
        @Override
        public void run() {
            Vector3 position = enemy.transform.getTranslation(new Vector3());
            enemy.moveToAnimation(position.x, -0.5f, position.z, 2, new GameObject.OnAnimationComplete() {
                @Override public void run(GameObject object) {
                    context.instances.remove(enemy);
                }
            });
        }
    }, TIME_TO_ATTACK);     
}
项目:cykacommander    文件:DeathScreen.java   
private void setGameScore(final int points) {
    numbersRunning.schedule(new Timer.Task(){
        int count = 0;
                       @Override
                       public void run() {
                           int a = count / 100;
                           int b = (count - (a * 100)) / 10;
                           int c = count - ((a * 100) +(b * 10));
                           count++;
                           hundredths = numbersFrames.getKeyFrame(a, true);
                           tens = numbersFrames.getKeyFrame(b, true);
                           ones = numbersFrames.getKeyFrame(c, true);
                       }
                   }
            , 0f
            , 0.5f/(points*2)
            , points
    );
}
项目:cykacommander    文件:ShopScreen.java   
private void cashDecrease(final int cashBefore, final int cashAfter) {
    changeNumbers.clear();
    changeNumbers.scheduleTask(new Timer.Task(){
                                   int a = cashBefore-1;
                                   @Override
                                   public void run() {
                                       thousandthsPlace = a / 1000;
                                       hundredthsPlace = (a - (thousandthsPlace * 1000)) / 100;
                                       tensPlace = (a - ((thousandthsPlace * 1000) + (hundredthsPlace * 100))) / 10;
                                       onesPlace = a - ((thousandthsPlace * 1000) + (hundredthsPlace * 100) + (tensPlace * 10));
                                       a--;
                                   }
                               }
            , 0f
            , 0.003f
            , cashBefore-cashAfter-1
    );
}
项目:Space-Bombs    文件:SpawnItemThread.java   
public SpawnItemThread(int numberOfItemFields, Server server)
{
    this.itemFields = numberOfItemFields;
    this.server = server;

    /*--------------INCREASE BOMB RANGE--------------*/
        Timer.schedule(new Timer.Task()
        {
            @Override
            public void run() 
            {
                if(cubicRange < Constants.MAXCUBICRANGE)
                {
                    cubicRange += 1;
                }

                if(normalRange < Constants.MAXBOMBRANGE)
                {
                    normalRange += 1;
                }
            }
        }
         ,60 // first execute delay
         ,60  // delay between executes     
        );
}
项目:joe    文件:VanishingPlatform.java   
private void scheduleReappear() {
    final int oldLevelId = Level.getInstance().getId();
    new Timer().scheduleTask(new Timer.Task() {
        @Override
        public void run() {
            Gdx.app.postRunnable(new Runnable() {
                @Override
                public void run() {
                    if (oldLevelId != Level.getInstance().getId()) {
                        return;
                    }

                    TiledEntityDefinition offspringDefinition =
                            new TiledEntityDefinition(UUID.randomUUID().toString(), (TiledEntityDefinition)definition);
                    VanishingPlatform offspring = (VanishingPlatform)Entity.build(offspringDefinition);
                    offspring.setReappearWait(true);
                    Level.getInstance().addEntity(offspring);
                    Canvas.getInstance().addToLayer(offspringDefinition.getLayer(), offspring);
                }
            });
        }
    }, reappearDelay / 1000);
}
项目:TempoGDX    文件:TapTempoCalculator.java   
public Integer tap() {
  if (currentClearTask != null) {
    currentClearTask.cancel();
  }

  currentClearTask = Timer.schedule(clearTask, clearInterval);

  if (tapTimes.size() == numberOfTaps) {
    tapTimes.remove(0);
  }

  tapTimes.add(TimeUtils.nanoTime());

  long sum = 0;
  if (tapTimes.size() > 1) {
    for (int i = 1; i < tapTimes.size(); i++) {
      sum += tapTimes.get(i) - tapTimes.get(i - 1);
    }
    float averageSeconds = sum / (tapTimes.size() - 1) / 1000000000f;
    int bpm = (int) (60f / averageSeconds);
    return bpm;
  } else {
    return null;
  }
}
项目:advio    文件:Level.java   
public void loadComplete() {
//      System.out.print("[");
//      for (Block b : blocks) {
//          System.out.print("[\"" + b.body.getPosition().x + "\"d \"" + b.body.getPosition().y + "\"d]");
//      }
//      System.out.println("]");
////        System.out.print("[");
////        for (Entity b : entities) {
////            System.out.print("[\"" + b.body.getPosition().x + "\"d \"" + b.body.getPosition().y + "\"d]");
////        }
////        System.out.println("]");
        Timer.schedule(new Task() {
            public void run() {
                loaded = true;
            }
        }, 1);
    }
项目:Inspiration    文件:BattleState.java   
public void playerAttacks(Role player){
        if( _currentOpponent == null ){
            return;
        }

        //Check for magic if used in attack; If we don't have enough MP, then return
//        int mpVal = ProfileManager.getInstance().getProperty("currentPlayerMP", Integer.class);
        int mpVal = player.getMagicPoint();
        battleUI.updateEvent(_currentOpponent, BattleEvent.PLAYER_TURN_START);

        if( _currentPlayerWandAPPoints == 0 ){
            if( !_playerAttackCalculations.isScheduled() ){
                Timer.schedule(_playerAttackCalculations, 1);
            }
        }else if(_currentPlayerWandAPPoints > mpVal ){
            BattleState.this.battleUI.updateEvent(_currentOpponent, BattleEvent.PLAYER_TURN_DONE);
            return;
        }else{
            if( !_checkPlayerMagicUse.isScheduled() && !_playerAttackCalculations.isScheduled() ){
                Timer.schedule(_checkPlayerMagicUse, .5f);
                Timer.schedule(_playerAttackCalculations, 1);
            }
        }
    }
项目:Inspiration    文件:WorldController.java   
/********************************************
 * Triggle Event
 *************************************/
public void Transfer(final String mapName, final Vector2 pos, final Role.Direction dir) {
    float delay = 0.1000f; // seconds
    player.setVisible(false);
    Timer.schedule(new Timer.Task() {
        @Override
        public void run() {
            mapMgr.loadMap(mapName);
            player.setCurrentDir(dir);
            player.setPosInMap(pos);
            player.setVisible(true);
            fighting = 0;
            cycleTime = 0;
        }
    }, delay);
}
项目:libgdxjam    文件:PlayerBulletContactListener.java   
@Override
public void beginContact(Contact contact) {
    Entity entity = getEntity(contact, PlayerComponent.class);

    spawnSmoke(entity);
    laserHit.play();
    engine.removeEntity(entity);
    Timer.instance().scheduleTask(
        new Task() {
            @Override
            public void run() {
                EventManager.fireEvent(
                    SceneManager.getCurrentScene(),
                    new Event(EventType.YOU_HAVE_BEEN_KILLED, false, false)
                );
            }
        },
        2.0f
    );
}
项目:KittenMaxit    文件:State.java   
public void create() {
    batch = new SpriteBatch();
    sr = new ShapeRenderer();

    bg[0] = new Sprite(new Texture(Gdx.files.internal("gfx/loadingscreens/layout.png")));
    bg[1] = new Sprite(new Texture(Gdx.files.internal("gfx/loadingscreens/layout-dif.png")));

    fps = new Button("Fps: " + 60, 32, 678);

    Timer.schedule(new Timer.Task() {
        @Override
        public void run() {
            fps.text = "Fps: " + (int) (1 / Gdx.graphics.getDeltaTime());
        }
    }, 1f, 1f);
}
项目:GDXJam    文件:GUISystem.java   
@Override
public boolean handleMessage (Telegram msg) {
    TelegramMessage telegramMsg = TelegramMessage.values()[msg.message];
    switch (telegramMsg) {

    case SQUAD_INPUT_SELECTED:
        int index = (Integer)msg.extraInfo;
        setSelected(index, true);
        return true;

    case GUI_INSUFFICIENT_RESOURCES:
        if(resourceAlertTask.isScheduled())
            resourceAlertTask.cancel();
        Timer.schedule(resourceAlertTask, 0.0f, 0.15f, 5);
        return true;

    default:
        return false;
    }
}
项目:OdysseeDesMaths    文件:Scene1.java   
@Override
public void aventure() {
    final OdysseeDesMaths gameReference = getMss().getJeu();
    getMss().getJeu().setScreen(new SimpleDialog(getMss().getJeu(), Assets.DLG_ARRIVEE_1, new EndButtonsListener() {
        @Override
        public void buttonPressed(String buttonName) {
            background = Assets.getManager().get(Assets.S01_FUITE, Texture.class);
            getMss().updateBackground();
            Timer.schedule(new Timer.Task() {
                @Override
                public void run() {
                    background = Assets.getManager().get(Assets.S01_PAYSAGE, Texture.class);
                    gameReference.setScreen(new ArriveeRemarquable(gameReference));
                }
            }, 3f);
        }
    }));
}
项目:OdysseeDesMaths    文件:MenuPrincipal.java   
private void play() {
    AlphaAction alphaAction = new AlphaAction();
    alphaAction.setAlpha(0);
    alphaAction.setDuration(0.5f);
    play.addAction(alphaAction);
    play.setTouchable(Touchable.disabled);

    MoveToAction moveToAction = new MoveToAction();
    moveToAction.setPosition(gameTitle.getX(), HEIGHT * 12 / 13 - gameTitle.getHeight());
    moveToAction.setDuration(2);
    gameTitle.addAction(moveToAction);

    Timer.instance().clear();
    gameTitle.setText("L'Odyssée des Maths");
    currentState = State.TRANSITION;
}
项目:OdysseeDesMaths    文件:MenuPrincipal.java   
private void encryptGameTitle() {
    char oldCharTmp;
    int indexTmp;

    do {
        indexTmp = (int)(Math.random() * gameTitle.getText().length());
        oldCharTmp = gameTitle.getText().charAt(indexTmp);
    } while (!Character.isLetter(oldCharTmp) || oldCharTmp == 'M');

    final char oldChar = oldCharTmp;
    final int index = indexTmp;
    int number = (int)(Math.random() * 10);

    gameTitle.setText(gameTitle.getText().substring(0, index) + number + gameTitle.getText().substring(index + 1));
    Timer.schedule(new Timer.Task() {
        @Override
        public void run() {
            gameTitle.setText(gameTitle.getText().substring(0, index) + oldChar + gameTitle.getText().substring(index + 1));
        }
    }, ENCRYPTION_DURATION);
}
项目:MathMemory    文件:GameScreen.java   
private void addMemoryItemButtonListener(final MemorySingle button) {
    button.addListener(new ClickListener(){
           @Override 
           public void clicked(InputEvent event, float x, float y){
            button.setText(Integer.toString(button.numb));
            addBouncyAction(button);
            stage.addActor(new Bubbles(Gdx.input.getX() - 100, game.getHeight() - Gdx.input.getY(),10));
            if(!checkedButtons.contains(button))
                checkedButtons.add(button);
            if(checkedButtons.size() == 2){
                disableAllButtons();
                Timer.schedule(new Task(){
                    @Override
                    public void run() {
                        checkIfMatch();
                        enableAllButtons();
                    }
                }, 1f);                 
            }
           }
       });      
}
项目:NerdShooter    文件:SplashScreen.java   
public void show() {
    splash0 = new Timer.Task(){
        public void run() {
            stage = 1;
            Timer.schedule(splash1, 1.5F);
            loadAssets();
        }
    };
    splash1 = new Timer.Task(){
        public void run() {
            NerdShooter.shooter.setScreen(new StartScreen());
        }
    };

    Timer.schedule(splash0, 1.5F);
}
项目:practicos    文件:Respawn.java   
public void RespawnEnemy() {     
     Timer.schedule(new Task(){
         @Override
         public void run() {
             tics++;
             if(tics > 25){                                                  
                 tics = 1;
             }
              if (tics == 1) {enemigoSpamea = true;}
              if (tics == 2) {enemigoSpamea = true;}
              if (tics == 3) {enemigoSpamea = true;}
              if (tics == 5) {enemigoSpamea = false;}
              if(tics % 2 == 0) {go=1;} else {go=0;}
             }
     }
     ,0,30/30.0f);   
}
项目:practicos    文件:PantallaGameOver.java   
public void animacionGameOver() {    
     Timer.schedule(new Task(){
         @Override
         public void run() {
             tics++;

             if(tics > 60){                                                  
                 tics = 0;                   
             }

             if(tics%10==0){if(timer>0 && Juego.gameOver==0 && Juego.titleScreen==0){timer--;}}
             if(tics==20 && Juego.gameOver==1){Juego.titleScreen=1;}
             if(tics==20){Juego.gameOver=0;}

          }
     }
     ,0,30/35.0f);   
}
项目:libgdxcn    文件:DragScrollListener.java   
public void drag (InputEvent event, float x, float y, int pointer) {
    if (x >= 0 && x < scroll.getWidth()) {
        if (y >= scroll.getHeight()) {
            scrollDown.cancel();
            if (!scrollUp.isScheduled()) {
                startTime = System.currentTimeMillis();
                Timer.schedule(scrollUp, tickSecs, tickSecs);
            }
            return;
        } else if (y < 0) {
            scrollUp.cancel();
            if (!scrollDown.isScheduled()) {
                startTime = System.currentTimeMillis();
                Timer.schedule(scrollDown, tickSecs, tickSecs);
            }
            return;
        }
    }
    scrollUp.cancel();
    scrollDown.cancel();
}
项目:libgdx-chat-example    文件:Chat.java   
public void startChatting() {
    userName = userNameTextField.getText();

    if (userName == null || userName.length() == 0) {
        return; // The user didn't enter anything valid, so we don't advance to the chat stage.
    }

    inChatUserNameLabel.setText(userName);

    isStarted = true;
    Gdx.input.setInputProcessor(chatStage);

    chatStage.setKeyboardFocus(newMessageTextField);

    timer = new Timer();
    timer.scheduleTask(new UpdateTask(this), 0, numberOfSecondsBetweenUpdateCalls);
}
项目:ludum30_a_hole_new_world    文件:Player.java   
public void beingHit() {
    if (!this.invincible) {
        Assets.playSound("playerHurt");
        this.invincible = true;

        this.state = Player.State.BeingHit;
        this.stateTime = 0;
        this.velocity.y = 150;
        this.noControl = true;

        int lifes = this.counter.lostLife();
        if (lifes <= 0) {
            this.die();
        }
        Timer.schedule(new Task() {
            @Override
            public void run() {
                Player.this.invincible = false;
                Player.this.state = Player.State.Standing;
            }
        }, 1.8f);
    }

}
项目:bladecoder-adventure-engine    文件:CreateProjectDialog.java   
@Override
protected void ok() {
    try {
        Ctx.project.getEditorConfig().setProperty(ANDROID_SDK_PROP, androidSdk.getText());
        Ctx.project.saveProject();
    } catch (Exception ex) {
        String msg = ex.getClass().getSimpleName()
                + " - " + ex.getMessage();
        Message.showMsgDialog(getStage(), "Error saving project", msg);
    }

    final Stage stage = getStage();

    Message.showMsg(getStage(), "Creating project...", true);
    Timer.schedule(new Task() {
        @Override
        public void run() {
            createProject(stage);
        }
    },1);
}
项目:bladecoder-adventure-engine    文件:CreateResolutionDialog.java   
@Override
protected void ok() {

    Message.showMsg(getStage(), "Creating resolution...", true);

    Timer.schedule(new Task() {
        @Override
        public void run() {         
            createResolution();

            String msg = scaleImages();             

            if(listener != null)
                listener.changed(new ChangeEvent(), CreateResolutionDialog.this);

            Message.hideMsg();

            if(msg != null)
                Message.showMsgDialog(getStage(), "Error creating resolution", msg);
        }
    },1);
}
项目:bladecoder-adventure-engine    文件:Message.java   
public static void showMsg(final Stage stage, final String text, final boolean modal) {

        Timer.post(new Task() {

            @Override
            public void run() {
                isModal = modal;

                if (text == null) {
                    hideMsg();
                    return;
                }

                add(stage, text);

                if (FADE_DURATION > 0) {
                    msg.getColor().a = 0;
                    msg.addAction(Actions.fadeIn(FADE_DURATION, Interpolation.fade));
                }

            }
        });
    }