2016-08-24 31 views
0

我已經創建了一個重新啓動按鈕,然後將其添加到表中。當我將表格設置爲不可見時,並單擊重新啓動按鈕所在的位置(現在不可見),我的播放器類中的touchDown InputProcessor甚至不會觸發。但是,當我點擊其他地方時,它會觸發玩家touchDown。不知何故,即使該按鈕不可見,該按鈕仍然存在干擾。一些額外的信息:Libgdx | Scene2d | touchDown輸入處理器方法點擊不可見按鈕時不會觸發

- 我的按鈕是一個自定義類,我會把下面
-Restart按鈕代碼有clickListener,不過,除去這不能解決問題
-The表是一個單獨的舞臺和視屆時玩家

的CustomButton代碼(重啓按鈕):在重啓按鈕,當你把它無形

class CustomDrawable implements Drawable { 

private Sprite sprite; 
private Actor actor; 

public CustomDrawable(Actor actor, Sprite sprite) { 
    this.actor = actor; 
    this.sprite = sprite; 
} 

@Override 
public void draw(Batch batch, float x, float y, float width, float height) { 
    sprite.setPosition(x, y); 
    sprite.setSize(width, height); 
    sprite.setColor(actor.getColor()); 
    sprite.draw(batch); 
} 
} 

回答

1

呼叫setTouchable(Touchable.disabled)。 (使其可見時啓用它。)

相關問題