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


Java Entity類代碼示例

本文整理匯總了Java中localhost.iillyyaa2033.nmud.core.services.domain.world.Entity的典型用法代碼示例。如果您正苦於以下問題:Java Entity類的具體用法?Java Entity怎麽用?Java Entity使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Entity類屬於localhost.iillyyaa2033.nmud.core.services.domain.world包,在下文中一共展示了Entity類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: showDelEntityDialog

import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //導入依賴的package包/類
@Override
void showDelEntityDialog(final Entity item) {
	AlertDialog.Builder ab = new AlertDialog.Builder(this);
	ab.setTitle("Rm entity");
	ab.setMessage("Do you wanna del " + item + "?");
	ab.setPositiveButton("Yeah", new DialogInterface.OnClickListener(){

			@Override
			public void onClick(DialogInterface p1, int p2) {
				Entity expandingEntity = manager.getParent(item);
				domainEntity.remove(item);
				refillTree(manager, expandingEntity);
			}
		});
	ab.show();
}
 
開發者ID:nmud,項目名稱:nmud,代碼行數:17,代碼來源:ObjectsLocalActivity.java

示例2: check

import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //導入依賴的package包/類
private void check(MassiveStatement s, final MassiveAction a) {
	final ArrayList<Entity> list = massiveSearch(s);

	String ts = "Нашось " + list.size() + " сущностей:";

	for (Entity e :list) {
		ts += "\n • " + e + ";";
	}

	new AlertDialog.Builder(this)
		.setTitle("Подтвердите действие")
		.setMessage(ts)
		.setPositiveButton("О да!", new DialogInterface.OnClickListener(){

			@Override
			public void onClick(DialogInterface p1, int p2) {
				massiveEdit(list, a);
			}
		})
		.show();
}
 
開發者ID:nmud,項目名稱:nmud,代碼行數:22,代碼來源:ObjectsLocalActivity.java

示例3: showRotDegDialog

import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //導入依賴的package包/類
private void showRotDegDialog() {
	AlertDialog.Builder ab = new AlertDialog.Builder(getActivity());
	String angle = entity.getParam(Entity.P.EDITOR_ROT_ANGLE);
	final EditText field = new EditText(getActivity());
	field.setText(angle);
	ab.setView(field);
	ab.setPositiveButton("Accept", new DialogInterface.OnClickListener(){

			@Override
			public void onClick(DialogInterface p1, int p2) {
				entity.addParam(Entity.P.EDITOR_ROT_ANGLE, field.getText().toString());
				((ObjectsActivity) getActivity()).doRecountAngles();
			}
		});
	ab.show();
}
 
開發者ID:nmud,項目名稱:nmud,代碼行數:17,代碼來源:EntityFragment.java

示例4: onCreate

import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.objects_presets);
	if(DataHolder.presets == null) DataHolder.presets = new ArrayList<Entity>();
	
	Button btn = new Button(this);
	btn.setText("New preset");
	btn.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View p1) {
				showNewPresetDialog();
			}
		});
	
	adapter = new ArrayAdapter<Entity>(this,android.R.layout.simple_list_item_1,DataHolder.presets);
	
	list = (ListView) findViewById(R.id.objects_presets_list);
	list.setAdapter(adapter);
	list.addFooterView(btn);
}
 
開發者ID:nmud,項目名稱:nmud,代碼行數:23,代碼來源:PresetsActivity.java

示例5: setShape

import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //導入依賴的package包/類
private void setShape(Entity entity, double[] offset, double rot) {
		deepness = new int[]{
			(int)offset[2] - (int) entity.getPosition()[2] + entity.getDeepnessMin(),
			(int)offset[2] - (int) entity.getPosition()[2] + entity.getDeepnessMax()};

//		Log.d("runt", entity + " " + Utils.ats(deepness));

		/*	double[] noffs = Arrays.copyOf(offset, 3);
		 if (isChild) noffs = ShapeHelper.rotate(entity.getPosition(), offset, rot, Entity.COORDS_COUNT_POSITION);
		 double[] shape = ShapeHelper.rotate(entity.getShape(), noffs, rot, Entity.COORDS_COUNT_SHAPE);
		 */
		shape = entity.getShape(offset);

		if (shape.length < Entity.COORDS_COUNT_SHAPE) {
			shape = Arrays.copyOf(shape, Entity.COORDS_COUNT_SHAPE);
		}
	}
 
開發者ID:nmud,項目名稱:nmud,代碼行數:18,代碼來源:DrawingEntity.java

示例6: selectObject

import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //導入依賴的package包/類
void selectObject(Entity e) {
	EntityHolder.e = e;

	if (frame != null) {
		EntityFragment efr = new EntityFragment(e);

		if (e instanceof DomainEntity) {
			efr = new DomainFragment((DomainEntity) e);
		}

		efr.setOnShowMapListener(new OnClickListener(){

				@Override
				public void onClick(View p1) {
					startActivity(new Intent(ObjectsActivity.this, MapActivity.class));
				}
			});

		getFragmentManager().beginTransaction().replace(R.id.objects_main_frame, efr).commit();
		if (e.getName() != null) getActionBar().setTitle("Editing: " + e.getName().toString().toLowerCase());
		else getActionBar().setTitle("Editing: noname");
	} else {
		startActivity(new Intent(this, FragmentActivity.class));
	}
}
 
開發者ID:nmud,項目名稱:nmud,代碼行數:26,代碼來源:ObjectsActivity.java

示例7: linkDoor

import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //導入依賴的package包/類
private void linkDoor(int index, Entity parent, Entity door) {

		double[] parentPosition = domains[index].getGlobalPositonOf(parent
				.getId());
		double[] exitPosition = getExitCoords(index, door);

		String exit = domains[index].getEntityAt(exitPosition, true);

		/*
		 * d("Linked: " + parent + " (" + door + ") → " +
		 * domains[index].getByIdWithFirstLvlChildOnly(exit) + " [" +
		 * Utils.ats(exitPosition) + "]");
		 */

		int nodeIdFrom = getNodeIndex(index, parent.getId());
		int nodeIdTo = getNodeIndex(index, exit);

		Link data = new Link();
		data.doorId = door.getId();
		data.moveLength = (float) Utils.distance(parentPosition, exitPosition);

		graphs[index].addLink(nodeIdFrom, nodeIdTo, data);
	}
 
開發者ID:nmud,項目名稱:nmud-core,代碼行數:24,代碼來源:AI.java

示例8: sendToNearest

import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //導入依賴的package包/類
public void sendToNearest(Client c, String message) {
	Entity[] ents = c.getVisibleEntities();

	for (Entity e : ents) {
		if (e instanceof Creature) {
			String id = e.getId();
			d("Found creature " + id);

			if (isAvatar(id)) {
				d(id + " is avatar");
				Client cln = getClientByCurrentAvatarId(id);

				if (cln != null) {
					d("Sending to " + cln.getAvatarId());
					cln.send(message);
				}
			}
		}
	}
}
 
開發者ID:nmud,項目名稱:nmud-core,代碼行數:21,代碼來源:ClientManager.java

示例9: pickUp

import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //導入依賴的package包/類
public String pickUp(String objName) {
	objName = objName.toLowerCase();

	String res = "";
	Entity[] rz = getVisibleEntities(objName);

	Entity d = chooseFrom(rz);
	if (d != null) {
		if (d.hasTag("pickable")) avatar.pickUp(d);
		else send("Вы не можете взять " + d.toString().toLowerCase() + ".");
	} else {
		send("Не удалось найти " + objName);
	}

	return res;
}
 
開發者ID:nmud,項目名稱:nmud-core,代碼行數:17,代碼來源:Client.java

示例10: kill

import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //導入依賴的package包/類
public String kill(String entityName) {
	entityName = entityName.toLowerCase();

	String res = "";
	Entity[] rz = getVisibleEntities(entityName);

	Entity d = chooseFrom(rz);
	if (d != null) {
		if (d instanceof Creature) {
			avatar.kill((Creature) d);
			factory.notifyStateHasChanged();
			send("Такие дела.");
		} else
			send("Как можно убить " + d.toString().toLowerCase() + "?");
	}

	return res;
}
 
開發者ID:nmud,項目名稱:nmud-core,代碼行數:19,代碼來源:Client.java

示例11: connectTo

import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //導入依賴的package包/類
public void connectTo(Creature cr) {
	if (cr != null) {
		this.creature = cr;
		cr.aiPart.controlledByPlayer = true;

		cr.addToNotifWhitelist(Entity.N.avatar_action);
		cr.addToNotifWhitelist(Entity.N.avatar_speech);

		client.factory.notifyStateHasChanged();
		cr.addListener(new Creature.OnEnvChangedListener(){

				@Override
				public void onEnvChanged() {
					client.factory.notifyStateHasChanged();
				}
			});
	}
}
 
開發者ID:nmud,項目名稱:nmud-core,代碼行數:19,代碼來源:Avatar.java

示例12: ask

import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //導入依賴的package包/類
public void ask(String name, String subject) {
	client.parent.d("asking " + name + " for " + subject);

	Entity target = client.getVisibleEntityByName(name);

	if (target == null) {
		client.send(name + " нет в области видимости.");
	} else if (target instanceof Creature) {
		if (((Creature)target).aiPart.controlledByPlayer) {
			say(target.getName().toString() + ", расскажи про " + subject);
		} else {
			act(creature.getName().toString() + " спросил у " + target.getName().toString() + " про " + subject + ".");
			client.domain.notifyChilds(client.domain.getParent(creature).getId(), Entity.N.avatar_asked_npc, target.getId(), subject);
		}
	} else {
		act(creature.getName().toString() + " спросил у " + target.getName().toString()
			+ " про " + subject + ". Разумеется, " + target.getName().toString() 
			+ " ничего не ответил.");
	}
}
 
開發者ID:nmud,項目名稱:nmud-core,代碼行數:21,代碼來源:Avatar.java

示例13: openOrClose

import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //導入依賴的package包/類
private void openOrClose(String target, boolean isOpen) {
	Entity tg = client.getVisibleEntityByName(target);

	boolean success = false;

	if (tg != null) {
		if (tg.hasTag(Entity.T.DOOR)) {
			tg.addParam(Entity.P.IS_OPEN, (isOpen ? "true" : "false"));
			success = true;
		}
	}

	if (success) {
		act(creature.getName().toString() + (isOpen ? " открыл ": " закрыл ") + tg.getName().toString());
	}
}
 
開發者ID:nmud,項目名稱:nmud-core,代碼行數:17,代碼來源:Avatar.java

示例14: getGlobalPositonOf

import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //導入依賴的package包/類
@Override
public double[] getGlobalPositonOf(String entityId) {
	double[] rz = null;

	Entity e = getById(entityId);

	if (e != null) {
		rz = e.getPosition();
		Entity parent;

		while (!((parent = getParent(e)) instanceof DomainEntity)) {
			offsetArray(rz, parent.getPosition());
			e = parent;
		}
		offsetArray(rz, parent.getPosition());
	}

	return rz;
}
 
開發者ID:nmud,項目名稱:nmud-core,代碼行數:20,代碼來源:Domain.java

示例15: jump

import localhost.iillyyaa2033.nmud.core.services.domain.world.Entity; //導入依賴的package包/類
@Override
public void jump(String entityId, String parentId, double[] position) {
	Entity child = getById(entityId);
	Entity oldpar = getParent(child);
	Entity newpar = getById(parentId);

	synchronized (child) {
		synchronized (oldpar) {
			oldpar.remove(child);
		}

		synchronized (newpar) {
			newpar.add(child);
		}
	}
}
 
開發者ID:nmud,項目名稱:nmud-core,代碼行數:17,代碼來源:Domain.java


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