mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-07 22:13:08 -04:00
Worked on City Maintenance Console
Implementation of SUI windows and menus
This commit is contained in:
@@ -28,6 +28,14 @@ import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import resources.common.OutOfBand;
|
||||
import resources.common.RGB;
|
||||
import resources.objects.building.BuildingObject;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import services.sui.SUIWindow;
|
||||
import services.sui.SUIWindow.SUICallback;
|
||||
import services.sui.SUIWindow.Trigger;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import engine.resources.service.INetworkDispatch;
|
||||
import engine.resources.service.INetworkRemoteEvent;
|
||||
import main.NGECore;
|
||||
@@ -38,6 +46,7 @@ public class PlayerCityService implements INetworkDispatch {
|
||||
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||
|
||||
private Vector<PlayerCity> playerCities = new Vector<PlayerCity>();
|
||||
private int cityID = 0; // This must be persisted or handled via objectservice somehow
|
||||
|
||||
public PlayerCityService(NGECore core) {
|
||||
this.core = core;
|
||||
@@ -70,6 +79,47 @@ public class PlayerCityService implements INetworkDispatch {
|
||||
playerCities.removeAll(Collections.singleton(null));
|
||||
}
|
||||
}
|
||||
|
||||
public PlayerCity addNewPlayerCity(CreatureObject founder) {
|
||||
PlayerCity newCity = null;
|
||||
synchronized(playerCities){
|
||||
newCity = new PlayerCity(founder,cityID++);
|
||||
playerCities.add(newCity);
|
||||
}
|
||||
newCitySUI1(founder,newCity);
|
||||
return newCity;
|
||||
}
|
||||
|
||||
public PlayerCity getPlayerCity(CreatureObject citizen) {
|
||||
PlayerCity foundCity = null;
|
||||
synchronized(playerCities){
|
||||
for (PlayerCity city : playerCities){
|
||||
int id = (int)citizen.getAttachment("residentCity");
|
||||
if (city.getCityID()==id){
|
||||
foundCity = city;
|
||||
}
|
||||
}
|
||||
}
|
||||
return foundCity;
|
||||
}
|
||||
|
||||
public void newCitySUI1(CreatureObject citizen, final PlayerCity newCity) {
|
||||
final SUIWindow window = core.suiService.createSUIWindow("Script.messageBox", citizen, citizen, 0);
|
||||
window.setProperty("bg.caption.lblTitle:Text", "@city/city:rank0");
|
||||
window.setProperty("Prompt.lblPrompt:Text", "@city/city:new_city_body");
|
||||
window.setProperty("btnOk:visible", "True");
|
||||
window.setProperty("btnCancel:visible", "True");
|
||||
window.setProperty("btnOk:Text", "@ok");
|
||||
window.setProperty("btnCancel:Text", "@cancel");
|
||||
Vector<String> returnList = new Vector<String>();
|
||||
window.addHandler(0, "", Trigger.TRIGGER_OK, returnList, new SUICallback() {
|
||||
@Override
|
||||
public void process(SWGObject owner, int eventType, Vector<String> returnList) {
|
||||
core.suiService.closeSUIWindow(owner, 0);
|
||||
}
|
||||
});
|
||||
core.suiService.openSUIWindow(window);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertOpcodes(Map<Integer, INetworkRemoteEvent> arg0,
|
||||
|
||||
Reference in New Issue
Block a user