File: Games\Empires\Game.js

GamesByEmail
Class EmpiresTerritories

Array
  
 
 
GamesByEmail.Territories
 
 
GamesByEmail.EmpiresTerritories

All Implemented Interfaces:

Class


GamesByEmail.EmpiresTerritories

extends Territories

Constructor Summary
GamesByEmail.EmpiresTerritories(/*Game*/ game, /*Class*/ territoryClass, /*Array*/ territories)
Creates a territory collection.

Field Summary

Fields inherited from GamesByEmail.Territories
game

Fields inherited from Array
length

Method Summary
StringBuilderappendOverlayHtml(/*StringBuilder*/ htmlBuilder)
Override to add HTML that shows above all the territories.
 assignDlgRegion(iRegion, aTerritoryIds)
 clear()
 clearSpecialIcons()
 clearThrob()
 dispose()
 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)
 getString()
 hasResource(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)
 setBitDataToTerritories(aBits)
 setBlinkAll(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)
 setThrob()
//Same concept as Scott's setBlink in GamesByEmail.Territories.
 throbEvent()
 toBase64String()
 updateHtml()

Methods inherited from GamesByEmail.Territories
appendHtml, clearMouseEvents, hideHilites

Methods inherited from Array
indexOf

Methods inherited from Foundation.Class
getTypePath, isInstanceOf

Constructor Detail

EmpiresTerritories

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

appendOverlayHtml

StringBuilder appendOverlayHtml(/*StringBuilder*/ htmlBuilder)

Override to add HTML that shows above all the territories.

Overrides:
appendOverlayHtml in class Territories
Parameters:
htmlBuilder - 
The builder to append the HTML for the territory.
Returns:
The string builder.

assignDlgRegion

assignDlgRegion(iRegion,
                aTerritoryIds)
Parameters:
iRegion - 

aTerritoryIds - 


clear

clear()

clearSpecialIcons

clearSpecialIcons()

clearThrob

clearThrob()

dispose

dispose()
Overrides:
dispose in class Territories

findAtPoint

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)

Overrides:
findAtPoint in class Territories

getString

getString()

hasResource

hasResource(index)
Parameters:
index - 


initalizeContinentsWithLands

initalizeContinentsWithLands()

initializeTerritoriesWithDlgRegion

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

initializeTerritoriesWithOffsets()

//offset members are used to position overlays and highlights.


removeShipsFromBoard

removeShipsFromBoard()

setBase64String

setBase64String(sB64Data)
Parameters:
sB64Data - 


setBitDataToTerritories

setBitDataToTerritories(aBits)
Parameters:
aBits - 


setBlinkAll

setBlinkAll(bBlinkOn)
Parameters:
bBlinkOn - 


setString

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

setTerritoriesToBitData(aBits)
Parameters:
aBits - 


setThrob

setThrob()

//Same concept as Scott's setBlink in GamesByEmail.Territories.


throbEvent

throbEvent()

toBase64String

toBase64String()

updateHtml

updateHtml()