In-game resources views

* Added session records to carry resource information over to the
clients

* Added SQL support code for the various views

* Added interface and implementation of the resource information access
component

* Hooked resources information queries into both the empire and planet
management component

* Added resources display to planet and overview pages
This commit is contained in:
Emmanuel BENOîT 2012-02-04 10:43:12 +01:00
parent 56eddcc4f0
commit 597429fadf
45 changed files with 3211 additions and 52 deletions
legacyworlds-server-beans-simple/src/main
java/com/deepclone/lw/beans
resources/configuration

View file

@ -25,6 +25,7 @@ import com.deepclone.lw.interfaces.game.BattlesCache;
import com.deepclone.lw.interfaces.game.BattlesDAO;
import com.deepclone.lw.interfaces.game.EmpireDAO;
import com.deepclone.lw.interfaces.game.EmpireManagement;
import com.deepclone.lw.interfaces.game.resources.ResourcesInformationDAO;
import com.deepclone.lw.interfaces.naming.NamingDAO;
import com.deepclone.lw.interfaces.prefs.AccountPreferences;
import com.deepclone.lw.interfaces.prefs.PreferencesDAO;
@ -46,6 +47,7 @@ public class EmpireManagementBean
private EmpireDAO empireDao;
private PreferencesDAO prefsDao;
private BattlesDAO battlesDao;
private ResourcesInformationDAO resourcesInformationDao;
@Autowired( required = true )
@ -83,6 +85,13 @@ public class EmpireManagementBean
}
@Autowired( required = true )
public void setResourcesInformationDao( ResourcesInformationDAO resourcesInformationDao )
{
this.resourcesInformationDao = resourcesInformationDao;
}
@Override
public Integer getEmpireId( EmailAddress address )
{
@ -103,8 +112,9 @@ public class EmpireManagementBean
AccountPreferences prefs = this.prefsDao.getPreferences( generalInformation.getAccountId( ) );
boolean rlTime = prefs.getPreference( "useRLTime" , Boolean.class );
return new GamePageData( generalInformation.getName( ) , generalInformation.getStatus( ) , generalInformation
.getTag( ) , generalInformation.getCash( ) , generalInformation.getNextTick( ) , planets , rlTime );
return new GamePageData( generalInformation.getName( ) , generalInformation.getStatus( ) ,
generalInformation.getTag( ) , generalInformation.getCash( ) , generalInformation.getNextTick( ) ,
planets , rlTime );
}
@ -150,6 +160,8 @@ public class EmpireManagementBean
battles.add( entry );
}
overview.setEconomy( this.resourcesInformationDao.getEmpireInformation( empireId ) );
return new EmpireResponse( this.getGeneralInformation( empireId ) , overview , research , battles );
}

View file

@ -19,6 +19,7 @@ import com.deepclone.lw.cmd.player.planets.ViewPlanetResponse;
import com.deepclone.lw.interfaces.game.EmpireManagement;
import com.deepclone.lw.interfaces.game.PlanetDAO;
import com.deepclone.lw.interfaces.game.PlanetsManagement;
import com.deepclone.lw.interfaces.game.resources.ResourcesInformationDAO;
import com.deepclone.lw.interfaces.naming.NamingDAO;
import com.deepclone.lw.sqld.game.PlanetData;
import com.deepclone.lw.sqld.game.PlanetData.AccessType;
@ -36,6 +37,7 @@ public class PlanetsManagementBean
private EmpireManagement empireManagement;
private PlanetDAO planetDao;
private NamingDAO namingDao;
private ResourcesInformationDAO resourcesInformationDao;
@Autowired( required = true )
@ -59,6 +61,13 @@ public class PlanetsManagementBean
}
@Autowired( required = true )
public void setResourcesInformationDao( ResourcesInformationDAO resourcesInformationDao )
{
this.resourcesInformationDao = resourcesInformationDao;
}
private PlanetOrbitalView getOrbitalView( int empireId , int planetId , AccessType access )
{
if ( access == AccessType.BASIC ) {
@ -107,6 +116,8 @@ public class PlanetsManagementBean
view.setbBuildings( this.planetDao.getAvailableBuildings( planetId ) );
view.setbShips( this.planetDao.getAvailableShips( planetId ) );
view.setResources( this.resourcesInformationDao.getPlanetInformation( planetId ) );
return view;
}
@ -199,8 +210,8 @@ public class PlanetsManagementBean
if ( one == null ) {
return new ViewPlanetResponse( planetId , page , this.getBasicView( basic ) , orbital , owner );
}
return new RenamePlanetResponse( planetId , page , this.getBasicView( basic ) , orbital , owner , name , one
.toString( ) );
return new RenamePlanetResponse( planetId , page , this.getBasicView( basic ) , orbital , owner , name ,
one.toString( ) );
}

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
<import resource="game/resources-beans.xml" />
</beans>