本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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);
}
示例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);
}
}
示例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));
}
}
示例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);
}
示例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);
}
}
}
}
}
示例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;
}
示例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;
}
示例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();
}
});
}
}
示例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()
+ " ничего не ответил.");
}
}
示例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());
}
}
示例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;
}
示例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);
}
}
}