/* (non-Javadoc)
* @see java.util.Observer#update(java.util.Observable, java.lang.Object)
*/
public void update(Observable observable, Object input) {
InteractionManager im = (InteractionManager) observable;
if ("keyReleased".equals(input)){
if (im.getKeyReleased_key() == Input.KEY_C || im.getKeyReleased_key() == Input.KEY_I) {
CursorManager.getInstance().setCursor(CursorManager.SWORD, TyrelionContainer.getInstance().getContainer());
showCharinfo = !showCharinfo;
if (showCharinfo){
TyrelionContainer.getInstance().getContainer().pause();
} else { TyrelionContainer.getInstance().getContainer().resume(); }
}
if (im.getKeyReleased_key() == Input.KEY_ESCAPE) {
CursorManager.getInstance().setCursor(CursorManager.SWORD, TyrelionContainer.getInstance().getContainer());
if (showCharinfo){
showCharinfo = false;
TyrelionContainer.getInstance().getContainer().resume();
}
}
if (im.getKeyReleased_key() == Input.KEY_LSHIFT || im.getKeyReleased_key() == Input.KEY_RSHIFT) {
split = false;
}
}
if ("keyPressed".equals(input)){
if (im.getKeyPressed_key() == Input.KEY_LSHIFT || im.getKeyPressed_key() == Input.KEY_RSHIFT) {
split = true;
}
}
if ("mousePressed".equals(input)){
int x = im.getMousePressed_x(); int y = im.getMousePressed_y();
if (isMouseOverInventory(x, y)){
item = inventory.isOverItem(x-posX-577, y-posY-236);
mousePressed = true;
if (item != null) {
if(split && item.getCount()>1){
item.toggleShow(split);
itemAtCursor = inventory.new InventoryField(item.getItem());
} else{
item.toggleShow(false);
itemAtCursor = item;
}
}
}
if (isMouseOverCharacterIcon(x, y)) {
CursorManager.getInstance().setCursor(CursorManager.SWORD, TyrelionContainer.getInstance().getContainer());
showCharinfo = !showCharinfo;
if (showCharinfo){
TyrelionContainer.getInstance().getContainer().pause();
} else { TyrelionContainer.getInstance().getContainer().resume(); }
}
}
if ("mouseMoved".equals(input)){
//get current mouse position
mouseX = im.getMouseMoved_newx();
mouseY = im.getMouseMoved_newy();
}
if ("mouseReleased".equals(input)){
int x = im.getMouseReleased_x(); int y = im.getMouseReleased_y();
mousePressed = false;
if (item != null) {
if (isMouseOverInventory(x, y)){
int fieldX = (x-posX-577) / 56;