Java Code Examples for com.badlogic.gdx.utils.Array#contains()

The following examples show how to use com.badlogic.gdx.utils.Array#contains() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FilePopupMenu.java    From vis-ui with Apache License 2.0 6 votes vote down vote up
public void build (Array<FileHandle> favorites, FileHandle file) {
	sortingPopupMenu.build();
	this.file = file;

	clearChildren();

	addItem(newDirectory);
	addItem(sortBy);
	addItem(refresh);
	addSeparator();

	if (file.type() == FileType.Absolute || file.type() == FileType.External) addItem(delete);

	if (file.type() == FileType.Absolute) {
		addItem(showInExplorer);

		if (file.isDirectory()) {
			if (favorites.contains(file, false))
				addItem(removeFromFavorites);
			else
				addItem(addToFavorites);
		}
	}
}
 
Example 2
Source File: DriveCheckerService.java    From vis-ui with Apache License 2.0 6 votes vote down vote up
private void addListener (File root, RootMode mode, DriveCheckerListener listener, Array<File> cachedRoots, Map<File, ListenerSet> listeners) {
	if (cachedRoots.contains(root, false)) {
		listener.rootMode(root, mode);
		return;
	}

	ListenerSet set = listeners.get(root);

	if (set == null) {
		set = new ListenerSet();
		listeners.put(root, set);
	}

	set.add(listener);
	processRoot(root);
}
 
Example 3
Source File: FilteredTree.java    From talos with Apache License 2.0 5 votes vote down vote up
public void gatherMatchingScores (Array<Node<T>> nodes, String filter, Array<MatchingNode<T>> results) {
    for (int i = 0; i < nodes.size; i++) {
        MatchingNode<T> mNode = new MatchingNode<>(nodes.get(i),
                getSimilarityScore(nodes.get(i).getName().toLowerCase(), filter.toLowerCase()),
                nodes.get(i).getName().toLowerCase().contains(filter.toLowerCase()));
        if(!results.contains(mNode, false)) {
            results.add(mNode);
        }
        gatherMatchingScores(nodes.get(i).children, filter, results);
    }
}
 
Example 4
Source File: AiDefaultProfessionAbilityProcessor.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
@Override public int preProcess(TurnParams params) {
    if (params.creature.profession != profession)
        return -1;
    Array<Ability> abilities = profession.getAvailableAbilities(params.creature.getCurrentLevel());
    if (!abilities.contains(ability, true))
        return -1;
    if (!ability.action.canBeApplied(params.creature))
        return -1;
    return preProcess(params.creature, ability);
}
 
Example 5
Source File: HTMLGDXFacebook.java    From gdx-facebook with Apache License 2.0 5 votes vote down vote up
private boolean areSamePermissionsOrMore(Array<String> requiredPermissions, Array<String> allPermissions) {

        for (String s : requiredPermissions) {
            if (!allPermissions.contains(s, false)) {
                return false;
            }
        }
        return true;
    }
 
Example 6
Source File: SceneList.java    From bladecoder-adventure-engine with Apache License 2.0 5 votes vote down vote up
public void addChapters() {
	Array<String> array = new Array<>();

	if (Ctx.project.isLoaded()) {

		String[] nl = Ctx.project.getChapter().getChapters();

		for (int i = 0; i < nl.length; i++) {
			array.add(nl[i]);
		}

		chapters.setItems(array);

		String init = Ctx.project.getEditorConfig().getProperty("project.selectedChapter",
				Ctx.project.getWorld().getInitChapter());

		if (init != null) {
			if (array.contains(init, false)) {
				chapters.setSelected(init);
			} else if (array.size > 0) {
				chapters.setSelected(Ctx.project.getChapter().getInitChapter());
			}
		}
	} else {
		chapters.setItems(array);
	}

	chapterListener.changed(null, null);

	invalidate();
}
 
Example 7
Source File: Event.java    From uracer-kotd with Apache License 2.0 4 votes vote down vote up
public void addListener (Listener<T, O> listener, T type, O order) {
	Array<Listener<T, O>> ls = listeners[type.ordinal()][order.ordinal()];
	if (!ls.contains(listener, true)) {
		ls.add(listener);
	}
}
 
Example 8
Source File: ModelUtils.java    From gdx-texture-packer-gui with Apache License 2.0 4 votes vote down vote up
private void ensurePackExists(PackModel pack) {
    Array<PackModel> packs = getProject().getPacks();
    if (!packs.contains(pack, true)) {
        throw new IllegalArgumentException("Current project doesn't contain pack: " + pack.getName());
    }
}
 
Example 9
Source File: Animation.java    From riiablo with Apache License 2.0 4 votes vote down vote up
public boolean containsAnimationListener(int frame, AnimationListener l) {
  if (l == null || animationListeners == EMPTY_MAP) return false;
  Array<AnimationListener> listeners = animationListeners.get(frame);
  if (listeners == null) return false;
  return listeners.contains(l, true);
}
 
Example 10
Source File: FilePopupMenu.java    From vis-ui with Apache License 2.0 3 votes vote down vote up
public void buildForFavorite (Array<FileHandle> favorites, File file) {
	this.file = Gdx.files.absolute(file.getAbsolutePath());

	clearChildren();

	addItem(showInExplorer);

	if (favorites.contains(this.file, false)) addItem(removeFromFavorites);
}