本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.utils.Disableable类的典型用法代码示例。如果您正苦于以下问题:Java Disableable类的具体用法?Java Disableable怎么用?Java Disableable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Disableable类属于com.badlogic.gdx.scenes.scene2d.utils包,在下文中一共展示了Disableable类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
import com.badlogic.gdx.scenes.scene2d.utils.Disableable; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Actor actor, final String rawAttributeData) {
final ActorConsumer<?, Color> listener = parser.parseAction(rawAttributeData, Color.WHITE);
if (listener == null) {
parser.throwErrorIfStrict(
"Color picker attribute needs a reference to an action that consumes a Color instance. No method found for ID: "
+ rawAttributeData);
return;
}
final ColorPickerListener colorPickerListener = getListener(listener);
actor.addListener(new ClickListener() {
@Override
public void clicked(final InputEvent event, final float x, final float y) {
if (actor instanceof Disableable && ((Disableable) actor).isDisabled()) {
return;
}
final ColorPicker colorPicker = ColorPickerContainer.requestInstance();
colorPicker.setListener(null);
colorPicker.setColor(actor.getColor());
colorPicker.setListener(colorPickerListener);
colorPicker.centerWindow();
actor.getStage().addActor(colorPicker.fadeIn());
}
});
}
示例2: updateWidgets
import com.badlogic.gdx.scenes.scene2d.utils.Disableable; //导入依赖的package包/类
private void updateWidgets () {
for (Disableable disableable : disableTargets) {
disableable.setDisabled(formInvalid);
}
if (messageLabel != null) {
if (errorMsgText != null) {
messageLabel.setText(errorMsgText);
} else {
messageLabel.setText(successMsg); //setText will default to "" if successMsg is null
}
Color targetColor = errorMsgText != null ? style.errorLabelColor : style.validLabelColor;
if (targetColor != null && style.colorTransitionDuration != 0) {
messageLabel.addAction(Actions.color(targetColor, style.colorTransitionDuration));
} else {
messageLabel.setColor(targetColor);
}
}
}
示例3: process
import com.badlogic.gdx.scenes.scene2d.utils.Disableable; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Actor actor, final String rawAttributeData) {
if (actor instanceof Disableable) {
((Disableable) actor).setDisabled(parser.parseBoolean(rawAttributeData, actor));
} else {
parser.throwErrorIfStrict(
"This widget cannot be disabled, as it does not implement Disableable interface. Received disabled attribute on tag: "
+ tag.getTagName() + " with actor: " + actor);
}
}
示例4: processFormAttribute
import com.badlogic.gdx.scenes.scene2d.utils.Disableable; //导入依赖的package包/类
@Override
protected void processFormAttribute(final LmlParser parser, final LmlTag tag, final VisFormTable parent,
final Actor actor, final String rawAttributeData) {
if (actor instanceof Disableable) {
if (parser.parseBoolean(rawAttributeData, actor)) {
parent.addWidgetToDisable((Disableable) actor);
}
} else {
parser.throwErrorIfStrict(
"Only Disableable widgets can be attached to the form with this attribute. Found widget that does not implement Disableable attribute: "
+ actor + " with tag: " + tag.getTagName());
}
}
示例5: clicked
import com.badlogic.gdx.scenes.scene2d.utils.Disableable; //导入依赖的package包/类
@Override
public void clicked(final InputEvent event, final float x, final float y) {
if (actor instanceof Disableable && ((Disableable) actor).isDisabled()) {
return;
}
actor.getStage().addActor(visWindow.fadeIn());
}
示例6: enableComponents
import com.badlogic.gdx.scenes.scene2d.utils.Disableable; //导入依赖的package包/类
/**
* Sets the enabled property on the given components
*
* @param enabled
* @param components
*/
protected void enableComponents(boolean enabled, Disableable... components) {
for (Disableable c : components) {
if (c != null)
c.setDisabled(!enabled);
}
}
示例7: addWidgetToDisable
import com.badlogic.gdx.scenes.scene2d.utils.Disableable; //导入依赖的package包/类
/** See {@link SimpleFormValidator#addDisableTarget(Disableable)}.
*
* @param disableable will be disabled if any errors are found in the form. */
public void addWidgetToDisable(final Disableable disableable) {
formValidator.addDisableTarget(disableable);
}
示例8: SimpleFormValidator
import com.badlogic.gdx.scenes.scene2d.utils.Disableable; //导入依赖的package包/类
/**
* @param targetToDisable target actor that will be disabled if form is invalid. Eg. you can pass form Confirm button.
* May be null.
* @param messageLabel label that text will be changed if from is valid or invalid. May be null.
*/
public SimpleFormValidator (Disableable targetToDisable, Label messageLabel, FormValidatorStyle style) {
this.style = style;
if (targetToDisable != null) disableTargets.add(targetToDisable);
this.messageLabel = messageLabel;
}
示例9: addDisableTarget
import com.badlogic.gdx.scenes.scene2d.utils.Disableable; //导入依赖的package包/类
public void addDisableTarget (Disableable disableable) {
disableTargets.add(disableable);
updateWidgets();
}
示例10: removeDisableTarget
import com.badlogic.gdx.scenes.scene2d.utils.Disableable; //导入依赖的package包/类
public boolean removeDisableTarget (Disableable disableable) {
boolean result = disableTargets.removeValue(disableable, true);
updateWidgets();
return result;
}
示例11: FormValidator
import com.badlogic.gdx.scenes.scene2d.utils.Disableable; //导入依赖的package包/类
/** @see SimpleFormValidator#SimpleFormValidator(Disableable) */
public FormValidator (Disableable targetToDisable) {
super(targetToDisable);
}
示例12: EnableActionListener
import com.badlogic.gdx.scenes.scene2d.utils.Disableable; //导入依赖的package包/类
public EnableActionListener(Disableable disableable) {
this.disableable = disableable;
}
示例13: isDisabled
import com.badlogic.gdx.scenes.scene2d.utils.Disableable; //导入依赖的package包/类
/**
* @param actor might be a {@link Disableable}.
* @return true if actor is disabled.
*/
protected boolean isDisabled (final Actor actor) {
return actor instanceof Disableable && ((Disableable) actor).isDisabled();
}