当前位置: 首页>>代码示例>>Java>>正文


Java ChangeEvent类代码示例

本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent的典型用法代码示例。如果您正苦于以下问题:Java ChangeEvent类的具体用法?Java ChangeEvent怎么用?Java ChangeEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ChangeEvent类属于com.badlogic.gdx.scenes.scene2d.utils.ChangeListener包,在下文中一共展示了ChangeEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addTab

import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
public void addTab(String tabTitle, final ITabContent tabContent,
		Skin skin) {

	TextButton button = new TextButton(tabTitle, skin);
	button.align(Align.left);
	//button.setFillParent(true);
	button.addListener(new ChangeListener() {
		@Override
		public void changed(ChangeEvent event, Actor actor) {
			tabContent.setContent(content);
			content.pack();
			setWidth(preferedContentWidth);
			setHeight(preferedContentHeight);
			
		}
	});
	
	tabHeaders.add(button);
	contents.add(tabContent);
	
	preferedContentWidth = Math.max(preferedContentWidth, tabContent.getWidth());
	preferedContentHeight = Math.max(preferedContentHeight, tabContent.getHeight() + tabHeaders.get(0).getHeight());
}
 
开发者ID:game-libgdx-unity,项目名称:GDX-Engine,代码行数:24,代码来源:TabPane.java

示例2: GameDialog

import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
public GameDialog(Skin skin) {
super("", skin);

waveLevel = new Label("", skin);
monsHP = new Label("", skin);
monsBonus = new Label("", skin);
monsSpeed = new Label("", skin);
monsNumber = new Label("", skin);
btnOK = new TextButton("Okay, Let them come!", skin);
btnOK.addListener(new ChangeListener() {

    @Override
    public void changed(ChangeEvent event, Actor actor) {
	// TODO Auto-generated method stub
	setVisible(false);

    }
});
setTitle(" There are more monsters are coming to you... ");
   }
 
开发者ID:game-libgdx-unity,项目名称:GDX-Engine,代码行数:21,代码来源:GameDialog.java

示例3: handle

import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
@Override
public boolean handle(Event event) {
	if (event instanceof ChangeEvent) {
		Actor target = event.getTarget();
		boolean isDecrease = target.equals(decreaseButton);
		int skillIncreases = stats.getSkillIncreasesThisLevel(skill);
		
		if (isDecrease && increases > 0) {
			--increases;
			stats.decrementSkillIncreasesThisLevel(skill);
			stats.setSkillPoints(stats.getSkillPoints()+1);
			stats.skills().decreaseSkillRank(skill);
			return true;
		} else if (!isDecrease && skillIncreases < Configuration.getSkillIncreasesPerLevel()) {
			++increases;
			stats.incrementSkillIncreasesThisLevel(skill);
			stats.setSkillPoints(stats.getSkillPoints()-1);
			stats.skills().increaseSkillRank(skill);
			return true;
		}
	}
	return false;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:24,代码来源:SkillChangeButton.java

示例4: changed

import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
public boolean changed (ChangeEvent event, Actor actor) {
	if (endTurnButton.equals(actor) && GameState.isPlayersTurn()) {
		UIManager.hideToolTip();
		gameState.unpauseGame();
		gameState.switchToNextSide();
		endTurnButton.setDisabled(true);
		ignoreEvent = true;
		endTurnButton.setChecked(true);
		ignoreEvent = false;
		return true;
	} else if (endCombatButton.equals(actor)) {
		if (GameState.canPlayerEndCombat()) {
			gameState.endCombat();
		}
	}
	return false;		
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:18,代码来源:CombatButtons.java

示例5: handle

import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
@Override
public boolean handle(Event event) {
	if (event instanceof ChangeEvent) {
		if ("EXIT".equals(event.getTarget().getName())) {
			dispose();
			Gdx.app.exit();
		} else if ("OK".equals(event.getTarget().getName())) {
			SelectOption<String> selected = moduleSelectBox.getSelected(); 
			if (selected != null) {
				FileHandle currentModuleFile = Gdx.files.local(Configuration.FILE_LAST_MODULE);
				currentModuleFile.writeString(selected.value, false);
				dispose();
				game.reloadGame();
			}
		}
		return true;
	}
	return false;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:20,代码来源:ModuleSelectionScreen.java

示例6: setValue

import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
/**
 * Sets the progress bar position, rounded to the nearest step size and clamped to the minumum and maximim values.
 * {@link #clamp(float)} can be overidden to allow values outside of the progress bars min/max range.
 *
 * @return false if the value was not changed because the progress bar already had the value or it was canceled by a listener.
 */
public boolean setValue(float value) {
    value = snap(clamp(Math.round(value / stepSize) * stepSize));
    float oldValue = this.value;
    if (value == oldValue) {
        return false;
    }
    float oldVisualValue = getVisualValue();
    this.value = value;
    ChangeEvent changeEvent = Pools.obtain(ChangeEvent.class);
    boolean cancelled = fire(changeEvent);
    if (cancelled) {
        this.value = oldValue;
    } else if (animateDuration > 0) {
        animateFromValue = oldVisualValue;
        animateTime = animateDuration;
    }
    Pools.free(changeEvent);
    return !cancelled;
}
 
开发者ID:varFamily,项目名称:cocos-ui-libgdx,代码行数:26,代码来源:ProgressBar.java

示例7: setValue

import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
/** Sets the progress bar position, rounded to the nearest step size and clamped to the minimum and maximum values.
 * {@link #clamp(float)} can be overridden to allow values outside of the progress bar's min/max range.
 * @return false if the value was not changed because the progress bar already had the value or it was canceled by a listener. */
public boolean setValue (float value) {
	value = clamp(Math.round(value / stepSize) * stepSize);
	if (!shiftIgnoresSnap || (!Gdx.input.isKeyPressed(Keys.SHIFT_LEFT) && !Gdx.input.isKeyPressed(Keys.SHIFT_RIGHT)))
		value = snap(value);
	float oldValue = this.value;
	if (value == oldValue) return false;
	float oldVisualValue = getVisualValue();
	this.value = value;
	ChangeEvent changeEvent = Pools.obtain(ChangeEvent.class);
	boolean cancelled = fire(changeEvent);
	if (cancelled)
		this.value = oldValue;
	else if (animateDuration > 0) {
		animateFromValue = oldVisualValue;
		animateTime = animateDuration;
	}
	Pools.free(changeEvent);
	return !cancelled;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:23,代码来源:ProgressBar.java

示例8: getActors

import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
@Override
   public Actor[] getActors(Skin skin) {
ImageButton musicTooltip = new OwnImageButton(skin, "tooltip");
musicTooltip.addListener(new TextTooltip(
	I18n.bundle.format("gui.tooltip.music", SysUtilsFactory.getSysUtils().getDefaultMusicDir()), skin));

ImageButton reloadMusic = new OwnImageButton(skin, "reload");
reloadMusic.setName("reload music");
reloadMusic.addListener(new EventListener() {
    @Override
    public boolean handle(Event event) {
	if (event instanceof ChangeEvent) {
	    EventManager.instance.post(Events.MUSIC_RELOAD_CMD);
	    return true;
	}
	return false;
    }
});
reloadMusic.addListener(new TextTooltip(I18n.bundle.get("gui.music.reload"), skin));

return new Actor[] { musicTooltip, reloadMusic };
   }
 
开发者ID:langurmonkey,项目名称:gaiasky,代码行数:23,代码来源:DesktopMusicActors.java

示例9: ok

import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
/**
 * Override to append all animations if selected.
 */
@Override
protected void ok() {
	@SuppressWarnings("unchecked")
	SelectBox<String> cb = (SelectBox<String>) id.getField();

	if (e == null && cb.getSelectedIndex() == 0) {
		for (int i = 1; i < cb.getItems().size; i++) {
			cb.setSelectedIndex(i);
			inputsToModel(true);
			// doc.setId(e, cb.getItems().get(i));

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

	} else {
		super.ok();
	}
}
 
开发者ID:bladecoder,项目名称:bladecoder-adventure-engine,代码行数:23,代码来源:EditAnimationDialog.java

示例10: ok

import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
@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);
}
 
开发者ID:bladecoder,项目名称:bladecoder-adventure-engine,代码行数:23,代码来源:CreateResolutionDialog.java

示例11: handle

import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
@Override
public boolean handle(Event event) {
	if (event instanceof ChangeEvent) {
		currentState = State.PLAYBACK;
		final InputPlayer player = new InputPlayer(writer.getReader());
		player.addPlaybackListener(new PlaybackAdapter() {
			@Override
			public void onSyncPropertiesFinish() {
				player.stopPlayback();
				currentState = State.BEFORE_RECORD;
				layout();
			}
		});
		layout();
		player.startPlayback();
	}
	return true;
}
 
开发者ID:suluke,项目名称:gdx.automation,代码行数:19,代码来源:SimpleRecordPlaybackScreen.java

示例12: setValue

import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
public boolean setValue(float value) {
	value = clamp(Math.round(value / stepSize) * stepSize);
	if (!shiftIgnoresSnap || (!Gdx.input.isKeyPressed(Keys.SHIFT_LEFT) && !Gdx.input.isKeyPressed(Keys.SHIFT_RIGHT))) value = snap(value);
	float oldValue = this.value;
	if (value == oldValue) return false;
	float oldVisualValue = getVisualValue();
	this.value = value;
	ChangeEvent changeEvent = Pools.obtain(ChangeEvent.class);
	boolean cancelled = fire(changeEvent);
	if (cancelled) this.value = oldValue;
	else if (animateDuration > 0) {
		animateFromValue = oldVisualValue;
		animateTime = animateDuration;
	}
	Pools.free(changeEvent);
	return !cancelled;
}
 
开发者ID:Dakror,项目名称:Vloxlands,代码行数:18,代码来源:DProgressBar.java

示例13: setChecked

import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
public void setChecked(boolean paramBoolean)
{
  if (this.isChecked == paramBoolean);
  do
  {
    do
      return;
    while ((this.buttonGroup != null) && (!this.buttonGroup.canCheck(this, paramBoolean)));
    this.isChecked = paramBoolean;
  }
  while (this.isDisabled);
  ChangeListener.ChangeEvent localChangeEvent = (ChangeListener.ChangeEvent)Pools.obtain(ChangeListener.ChangeEvent.class);
  if (fire(localChangeEvent))
    if (paramBoolean)
      break label73;
  label73: for (boolean bool = true; ; bool = false)
  {
    this.isChecked = bool;
    Pools.free(localChangeEvent);
    return;
  }
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:23,代码来源:Button.java

示例14: touchDown

import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
public boolean touchDown(InputEvent paramInputEvent, float paramFloat1, float paramFloat2, int paramInt1, int paramInt2)
{
  if ((paramInt1 == 0) && (paramInt2 != 0))
    return false;
  this.this$1.stageToLocalCoordinates(Vector2.tmp);
  float f1 = Vector2.tmp.x;
  float f2 = Vector2.tmp.y;
  if ((f1 > 0.0F) && (f1 < this.this$1.getWidth()) && (f2 > 0.0F) && (f2 < this.this$1.getHeight()))
  {
    this.this$1.listSelectedIndex = ((int)((this.this$1.getHeight() - f2) / this.this$1.itemHeight));
    this.this$1.listSelectedIndex = Math.max(0, this.this$1.listSelectedIndex);
    this.this$1.listSelectedIndex = Math.min(-1 + this.this$1.this$0.items.length, this.this$1.listSelectedIndex);
    this.this$1.this$0.selectedIndex = this.this$1.listSelectedIndex;
    if (this.this$1.this$0.items.length > 0)
    {
      ChangeListener.ChangeEvent localChangeEvent = (ChangeListener.ChangeEvent)Pools.obtain(ChangeListener.ChangeEvent.class);
      this.this$1.this$0.fire(localChangeEvent);
      Pools.free(localChangeEvent);
    }
  }
  return true;
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:23,代码来源:SelectBox$SelectList$1.java

示例15: render

import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent; //导入依赖的package包/类
/**------------------------RENDER------------------------**/
@Override
public void render(float f) 
{
    //Debug
    //stage.setDebugAll(true);
    
    //Clear Screen
    Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1);
    Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT);
    
    //Set background image
    rootTable.background(new TextureRegionDrawable(new TextureRegion(TextureManager.menuBackground)));
    
    //Render stage
    stage.act(Constants.DELTATIME);
    stage.draw();
    
    /*------------------SWITCH TO FULLSCREEN AND BACK------------------*/
    super.changeToFullScreenOnF12();
    
    /*------------------QUIT GAME------------------*/
    if (Gdx.input.isKeyPressed(Input.Keys.ESCAPE))
    {
        game.setScreen(new MenuScreen(game, client, server));
    }
    
    /*------------------JOIN GAME WITH ENTER------------------*/
    if(Gdx.input.isKeyJustPressed(Input.Keys.ENTER))
    {
        ChangeEvent event1 = new ChangeEvent();
        joinButton.fire(event1);
    }
}
 
开发者ID:Aeo-Informatik,项目名称:Space-Bombs,代码行数:35,代码来源:JoinScreen.java


注:本文中的com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。