當前位置: 首頁>>代碼示例>>Java>>正文


Java TaskAttribute類代碼示例

本文整理匯總了Java中com.badlogic.gdx.ai.btree.annotation.TaskAttribute的典型用法代碼示例。如果您正苦於以下問題:Java TaskAttribute類的具體用法?Java TaskAttribute怎麽用?Java TaskAttribute使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TaskAttribute類屬於com.badlogic.gdx.ai.btree.annotation包,在下文中一共展示了TaskAttribute類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: findMetadata

import com.badlogic.gdx.ai.btree.annotation.TaskAttribute; //導入依賴的package包/類
private Metadata findMetadata (Class<?> clazz) {
	Metadata metadata = metadataCache.get(clazz);
	if (metadata == null) {
		Annotation tca = ClassReflection.getAnnotation(clazz, TaskConstraint.class);
		if (tca != null) {
			TaskConstraint taskConstraint = tca.getAnnotation(TaskConstraint.class);
			ObjectMap<String, AttrInfo> taskAttributes = new ObjectMap<String, AttrInfo>();
			Field[] fields = ClassReflection.getFields(clazz);
			for (Field f : fields) {
				Annotation a = f.getDeclaredAnnotation(TaskAttribute.class);
				if (a != null) {
					AttrInfo ai = new AttrInfo(f.getName(), a.getAnnotation(TaskAttribute.class));
					taskAttributes.put(ai.name, ai);
				}
			}
			metadata = new Metadata(taskConstraint.minChildren(), taskConstraint.maxChildren(), taskAttributes);
			metadataCache.put(clazz, metadata);
		}
	}
	return metadata;
}
 
開發者ID:Mignet,項目名稱:Inspiration,代碼行數:22,代碼來源:BehaviorTreeParser.java

示例2: appendFieldString

import com.badlogic.gdx.ai.btree.annotation.TaskAttribute; //導入依賴的package包/類
private static void appendFieldString (StringBuilder sb, Task<?> task, TaskAttribute ann, Field field) {
	// prefer name from annotation if there is one
	String name = ann.name();
	if (name == null || name.length() == 0) name = field.getName();
	Object value;
	try {
		field.setAccessible(true);
		value = field.get(task);
	} catch (ReflectionException e) {
		Gdx.app.error("", "Failed to get field", e);
		return;
	}
	sb.append(name).append(":");
	Class<?> fieldType = field.getType();
	if (fieldType.isEnum() || fieldType == String.class) {
		sb.append('\"').append(value).append('\"');
	} else if (Distribution.class.isAssignableFrom(fieldType)) {
		sb.append('\"').append(DAs.toString((Distribution)value)).append('\"');
	} else
		sb.append(value);
}
 
開發者ID:libgdx,項目名稱:gdx-ai,代碼行數:22,代碼來源:BehaviorTreeViewer.java

示例3: appendTaskAttributes

import com.badlogic.gdx.ai.btree.annotation.TaskAttribute; //導入依賴的package包/類
private static StringBuilder appendTaskAttributes (StringBuilder attrs, Task<?> task) {
	Class<?> aClass = task.getClass();
	Field[] fields = ClassReflection.getFields(aClass);
	for (Field f : fields) {
		Annotation a = f.getDeclaredAnnotation(TaskAttribute.class);
		if (a == null) continue;
		TaskAttribute annotation = a.getAnnotation(TaskAttribute.class);
		attrs.append('\n');
		appendFieldString(attrs, task, annotation, f);
	}
	return attrs;
}
 
開發者ID:libgdx,項目名稱:gdx-ai,代碼行數:13,代碼來源:BehaviorTreeViewer.java

示例4: AttrInfo

import com.badlogic.gdx.ai.btree.annotation.TaskAttribute; //導入依賴的package包/類
AttrInfo (String fieldName, TaskAttribute annotation) {
	this(annotation.name(), fieldName, annotation.required());
}
 
開發者ID:Mignet,項目名稱:Inspiration,代碼行數:4,代碼來源:BehaviorTreeParser.java


注:本文中的com.badlogic.gdx.ai.btree.annotation.TaskAttribute類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。