Games\Empires\Game.js
GamesByEmail
Array
GamesByEmail.Territories
All Implemented Interfaces:
GamesByEmail.EmpiresTerritories
extendsTerritories
Constructor Summary |
Creates a territory collection.
|
Field Summary |
Fields inherited from GamesByEmail.Territories |
game |
Fields inherited from Array |
length |
Method Summary | |
|
Override to add HTML that shows above all the territories.
|
|
|
|
|
|
|
|
|
|
|
|
/*
findAtPoint:function(point,checkThisIndexFirst)
var TGridIndex=Math.floor(point.y/this.iCellSize )*this.tGridW +
Math.floor(point.x/this.iCellSize );
var ters=this.TGrid[ TGridIndex ];
for(var i=0;i<ters.length;i++)
if( ters[i].containsPoint(point) )
return ters[i];
return null;
,
*/
//Minor fix to find at point to account for Continental tags
// findAtPointOldWay:function(point,checkThisIndexFirst) |
|
|
|
|
|
|
|
//3 possible regions where battle dialog can appear.
//dlgRegion contains an array of territories which are hidden by a specific
//region. Later, these ae used to pick the region that won't hide the
//attacker or defender territory.
|
|
//offset members are used to position overlays and highlights.
|
|
|
|
|
|
|
|
|
|
/*
registerTerritoriesWithTGrid:function()
for(var a=0;a<this.TGrid.length;a++)
this.TGrid[a]=new Array();
var t=null;
var tCell=new Foundation.Point();
var cellCache = null;
var tlen=this.length;
for( var i=0;i<tlen; i++ ) //for each territory
undefined
t=this[i];
cellCache=new Array(); // array of cell points.
var poly=t.polygon , plen=t.polygon.length;
for( var j=0;j<plen;j++ )
undefined
tCell.x=Math.floor(poly[j].x/this.iCellSize);
tCell.y=Math.floor(poly[j].y/this.iCellSize);
for(var k=0; k<cellCache.length;k++)
if(tCell.equals( cellCache[k] ))
continue;
//otherwise append this territory to TGrid
var idx=tCell.y * this.tGridW + tCell.x;
if(idx < 0 || idx >= this.TGrid.length )
this.game.debug("Oooops");
this.TGrid[ idx ].push( t );
cellCache.push( tCell.clone() );
|
|
|
|
//Same concept as Scott's setBlink in GamesByEmail.Territories.
|
|
|
|
|
|
|
Methods inherited from GamesByEmail.Territories |
appendHtml , clearMouseEvents , hideHilites |
Methods inherited from Array |
indexOf |
Methods inherited from Foundation.Class |
getTypePath , isInstanceOf |
Constructor Detail |
GamesByEmail.EmpiresTerritories(/*Game
*/ game,
/*Class
*/ territoryClass,
/*Array
*/ territories)
Creates a territory collection.
Parameters:game -The parent game object.
territoryClass -The class to use for individual territories.
territories -The data for the territories to inherit.
Method Detail |
StringBuilder
appendOverlayHtml(/*StringBuilder
*/ htmlBuilder)
Override to add HTML that shows above all the territories.
Overrides:appendOverlayHtml
in class Territories
htmlBuilder -The builder to append the HTML for the territory.
assignDlgRegion(iRegion,
aTerritoryIds)
iRegion -
aTerritoryIds -
clear()
clearSpecialIcons()
clearThrob()
dispose()
dispose
in class Territories
findAtPoint()
/*
findAtPoint:function(point,checkThisIndexFirst)
var TGridIndex=Math.floor(point.y/this.iCellSize )*this.tGridW +
Math.floor(point.x/this.iCellSize );
var ters=this.TGrid[ TGridIndex ];
for(var i=0;i<ters.length;i++)
if( ters[i].containsPoint(point) )
return ters[i];
return null;
,
*/
//Minor fix to find at point to account for Continental tags
// findAtPointOldWay:function(point,checkThisIndexFirst)
findAtPoint
in class Territories
getString()
hasResource(index)
index -
initalizeContinentsWithLands()
initializeTerritoriesWithDlgRegion()
//3 possible regions where battle dialog can appear. //dlgRegion contains an array of territories which are hidden by a specific //region. Later, these ae used to pick the region that won't hide the //attacker or defender territory.
initializeTerritoriesWithOffsets()
//offset members are used to position overlays and highlights.
removeShipsFromBoard()
setBase64String(sB64Data)
sB64Data -
setBitDataToTerritories(aBits)
aBits -
setBlinkAll(bBlinkOn)
bBlinkOn -
setString()
/*
registerTerritoriesWithTGrid:function()
for(var a=0;a<this.TGrid.length;a++)
this.TGrid[a]=new Array();
var t=null;
var tCell=new Foundation.Point();
var cellCache = null;
var tlen=this.length;
for( var i=0;i<tlen; i++ ) //for each territory
undefined
t=this[i];
cellCache=new Array(); // array of cell points.
var poly=t.polygon
, plen=t.polygon.length;
for( var j=0;j<plen;j++ )
undefined
tCell.x=Math.floor(poly[j].x/this.iCellSize);
tCell.y=Math.floor(poly[j].y/this.iCellSize);
for(var k=0; k<cellCache.length;k++)
if(tCell.equals( cellCache[k] ))
continue;
//otherwise append this territory to TGrid
var idx=tCell.y * this.tGridW + tCell.x;
if(idx < 0 || idx >= this.TGrid.length )
this.game.debug("Oooops");
this.TGrid[ idx ].push( t );
cellCache.push( tCell.clone() );
setTerritoriesToBitData(aBits)
aBits -
setThrob()
//Same concept as Scott's setBlink in GamesByEmail.Territories.
throbEvent()
toBase64String()
updateHtml()