34 lines
676 B
ActionScript
34 lines
676 B
ActionScript
class ActiveEntity : ServiceScript {
|
|
Entity entity;
|
|
|
|
void onInit() {
|
|
entity = Engine::getMainEnvironment().getRootEntity();
|
|
}
|
|
|
|
[ServiceAPI]
|
|
Entity getActiveEntity() {
|
|
return entity;
|
|
}
|
|
|
|
[ServiceAPI]
|
|
void setActiveEntity(Entity ent) {
|
|
entity = ent;
|
|
}
|
|
|
|
[ServiceAPI]
|
|
void renameEntity(any@ data) {
|
|
Entity entity;
|
|
data.retrieve(entity);
|
|
|
|
string name = entity.name;
|
|
if (UI::inputText("##RENAME", name, name)) {
|
|
entity.name = name;
|
|
}
|
|
|
|
UI::sameline();
|
|
if (UI::button("Accept")) {
|
|
UI::closePopup();
|
|
}
|
|
}
|
|
}
|