home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Joystick Magazine 2003 November
/
CD1_JOY_153.iso
/
demos
/
NHL2004Demo.exe
/
fe
/
nhl
/
js
/
game_setup_interface.js
< prev
next >
Wrap
Text File
|
2003-08-20
|
53KB
|
1,815 lines
//Copyright (c) 2002 Electronic Arts Inc. All rights reserved.
var oGameFace = window.external.GameInterface;
var oLeagueServer = oGameFace.LeagueServerInterface;
var oExecutorServer = oGameFace.ExecutorServerInterface;
var homeTeamOwnerID;
var awayTeamOwnerID;
var skillArray = new Array('0' , nhlMsg('TASKLIST_LEVEL_BEGINNER', true) , '1' , nhlMsg('TASKLIST_LEVEL_EASY', true), '2', nhlMsg('TASKLIST_LEVEL_MEDIUM', true) , '3' , nhlMsg('TASKLIST_LEVEL_DIFFICULT', true));
var awayTeamArray = new Array();
var homeTeamArray = new Array();
var leagueArray = new Array('0' , 'NHL' , '1' , 'International' , '2', 'Elitserien' , '3' , 'SM-liiga', '4', 'DEL');
var leagueAbbrevArray = new Array('NHL/' , 'NHL/' , 'ES/' , 'SM/' , 'DEL/');
var nullTeamID = 255;
var readyClicked = false;
var gameLaunched = false;
var bRandom = false;
var imgPath ="../../NHL/images2/logos/";
var oAudioInterface = oGameFace.AudioInterface;
var bIsOnline = false;
var nAwayTeamIndex = 62;
var nHomeTeamIndex = 62;
var bUniformDialog = false;
var bReadyForSecondInit = false;
var bDoneFirstInit = false;
var nEASOHomeTeam = 255;
var nEASOAwayTeam = 255;
var proPlay = System.GUI.general.data[0]; //boolean
var gameType = System.GUI.general.data[1]; //int
var bHost = System.GUI.general.data[5];
var nAwaySide = 1; // this is AWAY from the backend
var nHomeSide = 0; // this is HOME from the backend
var nDefaultHomeTeam = 17;
var nDefaultAwayTeam = 0;
function doSkin()
{
skinChatTab.src = "../images2/widgets/" + System.GUI.getTeamSkin() + "/chat_tab.gif";
skinChatWindow.src = "../images2/widgets/" + System.GUI.getTeamSkin() + "/chat_window.gif";
}
function initSettings()
{
oLeagueServer.LoadLeagueInternal(0,"");
System.Session.setPostGameLeague( "", 0 );
oExecutorServer.LoadExecutorInternal(0);
doSkin();
// first thing to do is place ourselves in central if we are not currently
if (!oLeagueFace.ProviderInterface.IsInSetup())
{
oLeagueFace.ProviderInterface.EnterSetup();
}
else
{
bReadyForSecondInit = true;
}
oCallbackTable = new CallbackTableObject();
inputDevice = new InputDeviceObject();
initGameInterface( oCallbackTable );
if (oLeagueServer.LeagueType == 2)
initEASOGameType();
initSkillLevels();
initDrpAwayLeague();
initDrpHomeLeague();
drpAwayLeagues.Selected = getAwayLeagueIndex();
initDrpAwayTeam();
drpHomeLeagues.Selected = getHomeLeagueIndex();
initDrpHomeTeam();
initPlayers();
initOnline();
initControllers();
if( !oLeagueFace.ProviderInterface.IsOnlineSetup() )
{
bReadyForSecondInit = true;
}
//else have to wait for gameInitClient 'ok' to proceed..
bDoneFirstInit = true;
if( bReadyForSecondInit )
{
initSettings2();
}
//demo
drpAwayLeagues.style.visibility = "hidden";
drpHomeLeagues.style.visibility = "hidden";
drpAwayTeams.style.visibility = "hidden";
drpHomeTeams.style.visibility = "hidden";
}
function OnReceivedGameSetup()
{
bReadyForSecondInit = true;
if( bDoneFirstInit )
{
initSettings2();
}
}
//hooked to ReceivedGameSetup event in online case..
function initSettings2()
{
//gameInitClient is up, can proceed with init..
if (!oGameData.CanSelectSide(1)) //can't select away
{
leftPlayers.style.visibility = 'hidden';
drpAwayLeagues.style.visibility = 'hidden';
drpAwayTeams.style.visibility = 'hidden';
arrow_0_left.style.visibility = 'hidden';
arrow_1_left.style.visibility = 'hidden';
arrow_2_left.style.visibility = 'hidden';
arrow_3_left.style.visibility = 'hidden';
arrow_4_left.style.visibility = 'hidden';
arrow_5_left.style.visibility = 'hidden';
btnSwap.style.visibility = 'hidden';
ratingsText.style.visibility = 'visible';
//awayRosterText.style.visibility = 'hidden';
//btnAwayRandom.style.visibility = 'hidden';
controller_0.sliceTargetsHome();
controller_1.sliceTargetsHome();
controller_2.sliceTargetsHome();
controller_3.sliceTargetsHome();
controller_4.sliceTargetsHome();
controller_5.sliceTargetsHome();
controller_0.targets="home_0,home_1,home_2,home_3,home_4,home_5";
controller_1.targets="home_0,home_1,home_2,home_3,home_4,home_5";
controller_2.targets="home_0,home_1,home_2,home_3,home_4,home_5";
controller_3.targets="home_0,home_1,home_2,home_3,home_4,home_5";
controller_4.targets="home_0,home_1,home_2,home_3,home_4,home_5";
controller_5.targets="home_0,home_1,home_2,home_3,home_4,home_5";
}
if (!oGameData.CanSelectSide(0)) //can select away
{
rightPlayers.style.visibility = 'hidden';
drpHomeLeagues.style.visibility = 'hidden';
drpHomeTeams.style.visibility = 'hidden';
arrow_0_right.style.visibility = 'hidden';
arrow_1_right.style.visibility = 'hidden';
arrow_2_right.style.visibility = 'hidden';
arrow_3_right.style.visibility = 'hidden';
arrow_4_right.style.visibility = 'hidden';
arrow_5_right.style.visibility = 'hidden';
btnSwap.style.visibility = 'hidden';
ratingsText.style.visibility = 'visible';
//homeRosterText.style.visibility = 'hidden';
//btnHomeRandom.style.visibility = 'hidden';
controller_0.sliceTargetsAway();
controller_1.sliceTargetsAway();
controller_2.sliceTargetsAway();
controller_3.sliceTargetsAway();
controller_4.sliceTargetsAway();
controller_5.sliceTargetsAway();
controller_0.targets="away_0,away_1,away_2,away_3,away_4,away_5";
controller_1.targets="away_0,away_1,away_2,away_3,away_4,away_5";
controller_2.targets="away_0,away_1,away_2,away_3,away_4,away_5";
controller_3.targets="away_0,away_1,away_2,away_3,away_4,away_5";
controller_4.targets="away_0,away_1,away_2,away_3,away_4,away_5";
controller_5.targets="away_0,away_1,away_2,away_3,away_4,away_5";
}
if (oGameData.getTeamList(1) == "")
{
//hide drpdwn & arrows
drpAwayLeagues.style.visibility = 'hidden';
drpAwayTeams.style.visibility = 'hidden';
btnSwap.style.visibility = 'hidden';
ratingsText.style.visibility = 'visible';
drpSkillLevel.style.visibility = 'hidden';
skillHeader.style.visibility = 'visible';
//btnAwayRandom.style.visibility = 'hidden';
}
if (oGameData.getTeamList(0) == "")
{
//hide drpdwn & arrows
drpHomeLeagues.style.visibility = 'hidden';
drpHomeTeams.style.visibility = 'hidden';
btnSwap.style.visibility = 'hidden';
ratingsText.style.visibility = 'visible';
drpSkillLevel.style.visibility = 'hidden';
skillHeader.style.visibility = 'visible';
//btnHomeRandom.style.visibility = 'hidden';
}
//FIXME Implement this: isLeagueGame()
if (!oGameData.canChangeRules() || oLeagueServer.LeagueType == 2)
{
drpSkillLevel.style.visibility = 'hidden';
skillHeader.style.visibility = 'visible';
}
else
{
drpSkillLevel.style.visibility = 'visible';
skillHeader.style.visibility = 'hidden';
}
// add the play now button
System.GUI.nowBtns.showPlay();
System.GUI.nowBtns.onplayclick = OnReadyGame;
readyClicked = false;
// set up the device callback
oGameFace.DeviceInterface.StartDevicePoll();
localizeArt();
}
function localizeArt()
{
var sFolder = "";
switch (window.external.GameInterface.ActiveLanguage)
{
case 1: sFolder = "local_SWED"; break;
case 2: sFolder = "local_GER"; break;
case 3: sFolder = "local_FINN"; break;
case 4: sFolder = "local_FR"; break;
}
btnSwapImg.src = "../../nhl/images2/widgets/" + sFolder + "/swap00.gif";
top.document.all.menu_1_toggler_img.src = "../../nhl/images2/common/" + sFolder + "/top_menu_gamemodes00.gif";
top.document.all.menu_2_toggler_img.src = "../../nhl/images2/common/" + sFolder + "/top_menu_mynhl00.gif";
top.document.all.menu_3_toggler_img.src = "../../nhl/images2/common/" + sFolder + "/top_menu_options00.gif";
top.document.all.playNow_btn.children(0).src = "../../nhl/images2/widgets/" + sFolder + "/play_00.gif";
}
function initEASOGameType()
{
System.Session.setPostGameNavigation( "1899", nhlMsg("EASO_MATCHUP_LOBBY") );
proPlay = System.GUI.general.data[0]; //boolean
gameType = System.GUI.general.data[1]; //int
//get awayTeam to appropriately display in game setup
if (System.GUI.general.data[2] != "")
{
setTimeout("initEASOAwayTeam()", 2000);
}
//get homeTeam to appropriately display in game setup
if (System.GUI.general.data[3] != "")
{
setTimeout("initEASOHomeTeam()", 2000);
}
setEASOObjects();
}
function initEASOAwayTeam()
{
if (oGameData.HomeTeam != nullTeamID)
{
oGameData.AwayTeam = nEASOAwayTeam = parseInt(System.GUI.general.data[2]);
System.GUI.general.data[2] = "";
}
else
{
OnHomeTeamChanged();
setTimeout("initEASOAwayTeam()", 2000);
}
}
function initEASOHomeTeam()
{
oGameData.HomeTeam = nEASOHomeTeam = parseInt(System.GUI.general.data[3]);
System.GUI.general.data[3] = "";
if (parseInt(System.GUI.general.data[4]) != 0)
{
oGameData.LineChange(0) = parseInt(System.GUI.general.data[4]);
oGameData.LineChange(1) = parseInt(System.GUI.general.data[4]);
}
}
function setEASOObjects()
{
if (gameType == 0) //tournament
{
//can't select teams
//hide dropdowns & dice
//btnAwayRandom.style.visibility = "hidden";
//btnHomeRandom.style.visibility = "hidden";
drpAwayLeagues.style.visibility = "hidden";
drpAwayTeams.style.visibility = "hidden";
drpHomeLeagues.style.visibility = "hidden";
drpHomeTeams.style.visibility = "hidden";
}
else //matchup
{
if (proPlay == "true")
{
//can't select teams
//hide dropdowns & dice
//btnAwayRandom.style.visibility = "hidden";
//btnHomeRandom.style.visibility = "hidden";
drpAwayLeagues.style.visibility = "hidden";
drpAwayTeams.style.visibility = "hidden";
drpHomeLeagues.style.visibility = "hidden";
drpHomeTeams.style.visibility = "hidden";
}
}
//hide "AT" & "SKILL LEVEL"
//drpSkillLevel.style.visibility = "hidden";
btnSwap.style.visibility = "hidden";
drpSkillLevel.style.visibility = "hidden";
skillText.style.visibility = "visible";
}
function clearSettings()
{
oGameFace.RemoveLocalEventTable();
}
function canExitScreen( /*screenID*/ )
{
// drop the play now button
System.GUI.nowBtns.hide();
// any access of transient interfaces needs to be handled in canExit
shutdownOnline();
// kill the device callback
oGameFace.DeviceInterface.StopDevicePoll();
//oLeagueFace.ManagerInterface.SaveGameSettings( oGameData );
//mprjk: this check may be excessive, as canExitScreen currently isn't called on game launch..
/*
if( !gameLaunched )
{
oGameFace.CommInterface.ReportNoStart();
oGameFace.CommInterface.PurgeGameReporter();
}
*/
return true;
}
var nCount = 0;
function doRandom( nTeamSide )
{
bRandom = true;
//var aTeamId = oGameData.getTeamList( nTeamSide ).split(',');
//var nRandomNumber = Math.round(Math.random()*parseInt(aTeamId.length/2 -1));
// temporary random function for NHL teams only
//oLeagueFace.ManagerInterface.GetTeamInfo( aTeamId[nRandomNumber*2], oTeamInfo );
if ( nTeamSide )
{
var nRandomNumber = Math.round(Math.random()*parseInt(drpAwayTeams.Lists-1));
var oTeamInfo = new TeamInfoObject();
oLeagueFace.ManagerInterface.GetTeamInfo( awayTeamArray[nRandomNumber*2], oTeamInfo );
}
else
{
var nRandomNumber = Math.round(Math.random()*parseInt(drpHomeTeams.Lists-1));
var oTeamInfo = new TeamInfoObject();
oLeagueFace.ManagerInterface.GetTeamInfo( homeTeamArray[nRandomNumber*2], oTeamInfo );
}
var sTeamLogoPath = "";
sTeamLogoPath = imgPath + oTeamInfo.sLogoFile;
if ( nTeamSide )
{
window.document.all.awayTeamImage.src = sTeamLogoPath;
}
else
{
window.document.all.homeTeamImage.src = sTeamLogoPath;
}
if (nCount < 5)
{
setTimeout("doRandom("+ nTeamSide + ")", 0);
}
else
{
nCount = 0;
( nTeamSide ) ? changeAwayTeam( nRandomNumber ) : changeHomeTeam( nRandomNumber );
oAudioInterface.PlaySFX(1066);
}
bRandom = false;
nCount++;
}
function initOnline()
{
if (oLeagueFace.ProviderInterface.IsOnlineSetup())
{
drawerSpan.style.visibility = "visible";
initChat(20, 87, true);
bIsOnline = true;
}
else
{
drawerSpan.style.visibility = "hidden";
bIsOnline = false;
}
}
function initSkillLevels()
{
drpSkillLevel.Justify(0);
drpSkillLevel.FontPercent(95);
drpSkillLevel.ClearAll();
for (var i=1; i<skillArray.length; i+=2)
{
drpSkillLevel.AddString(skillArray[i]);
}
oCallbackTable.LevelChanged();
}
function initDrpAwayLeague()
{
drpAwayLeagues.ClearAll();
var leagueArray = oGameData.GetLeagueList().split(',');
for (var i=0; i<leagueArray.length; i++)
{
drpAwayLeagues.AddString(leagueArray[i]);
}
}
function initDrpAwayTeam()
{
drpAwayTeams.ClearAll();
if (oLeagueFace.ProviderInterface.IsOnlineSetup())
awayTeamArray = oGameData.GetLeagueTeamListOnline( drpAwayLeagues.Selected ).split(',');
else
awayTeamArray = oGameData.GetLeagueTeamList( drpAwayLeagues.Selected ).split(',');
for (var i=1; i<awayTeamArray.length; i+=2)
{
drpAwayTeams.AddString(awayTeamArray[i]);
}
drpAwayTeams.Selected = getIntArrayIndex(oGameData.AwayTeam, awayTeamArray);
oCallbackTable.AwayTeamChanged();
}
function initDrpHomeLeague()
{
drpHomeLeagues.ClearAll();
var leagueArray = oGameData.GetLeagueList().split(',');
for (var i=0; i<leagueArray.length; i++)
{
drpHomeLeagues.AddString(leagueArray[i]);
}
}
function initDrpHomeTeam()
{
drpHomeTeams.ClearAll();
if (oLeagueFace.ProviderInterface.IsOnlineSetup())
homeTeamArray = oGameData.GetLeagueTeamListOnline( drpHomeLeagues.Selected ).split(',');
else
homeTeamArray = oGameData.GetLeagueTeamList( drpHomeLeagues.Selected ).split(',');
for (var i=1; i<homeTeamArray.length; i+=2)
{
drpHomeTeams.AddString(homeTeamArray[i]);
}
drpHomeTeams.Selected = getIntArrayIndex(oGameData.HomeTeam, homeTeamArray);
oCallbackTable.HomeTeamChanged();
}
function updateAwayTeam()
{
oGameData.AwayTeam = awayTeamArray[0];
oCallbackTable.AwayTeamChanged();
}
function updateHomeTeam()
{
oGameData.HomeTeam = homeTeamArray[0];
oCallbackTable.HomeTeamChanged();
}
function initControllers()
{
if(inputDevice.keyboard)
{
controller_0.style.visibility = 'visible';
if(controller_0.playerId == null )
{
arrow_0_left.style.visibility = 'visible';
arrow_0_right.style.visibility = 'visible';
}
}
else
{
controller_0.style.visibility = 'hidden';
arrow_0_left.style.visiblity = 'hidden';
arrow_0_right.style.visiblity = 'hidden';
}
if(inputDevice.joystick1)
{
controller_1.style.visibility = 'visible';
if(controller_1.playerId == null )
{
arrow_1_left.style.visibility = 'visible';
arrow_1_right.style.visibility = 'visible';
}
}
else
{
controller_1.style.visibility = 'hidden';
arrow_1_left.style.visibility = 'hidden';
arrow_1_right.style.visibility = 'hidden';
}
if(inputDevice.joystick2)
{
controller_2.style.visibility = 'visible';
if(controller_2.playerId == null )
{
arrow_2_left.style.visibility = 'visible';
arrow_2_right.style.visibility = 'visible';
}
}
else
{
controller_2.style.visibility = 'hidden';
arrow_2_left.style.visibility = 'hidden';
arrow_2_right.style.visibility = 'hidden';
}
if(inputDevice.joystick3)
{
controller_3.style.visibility = 'visible';
if(controller_3.playerId == null )
{
arrow_3_left.style.visibility = 'visible';
arrow_3_right.style.visibility = 'visible';
}
}
else
{
controller_3.style.visibility = 'hidden';
arrow_3_left.style.visibility = 'hidden';
arrow_3_right.style.visibility = 'hidden';
}
if(inputDevice.joystick4)
{
controller_4.style.visibility = 'visible';
if(controller_4.playerId == null )
{
arrow_4_left.style.visibility = 'visible';
arrow_4_right.style.visibility = 'visible';
}
}
else
{
controller_4.style.visibility = 'hidden';
arrow_4_left.style.visibility = 'hidden';
arrow_4_right.style.visibility = 'hidden';
}
if(inputDevice.joystick5)
{
controller_5.style.visibility = 'visible';
if(controller_5.playerId == null )
{
arrow_5_left.style.visibility = 'visible';
arrow_5_right.style.visibility = 'visible';
}
}
else
{
controller_5.style.visibility = 'hidden';
arrow_5_left.style.visibility = 'hidden';
arrow_5_right.style.visibility = 'hidden';
}
}
function initPlayers()
{
oCallbackTable.ControlsChanged();
}
function chatUsersUpdatedCallback()
{
}
function TeamInfoObject()
{
this.OwnerID = 0;
this.Name = "";
this.FullName ="";
this.sLogoFile = "";
this.AbbrName = "";
this.Overall = 0;
this.Scoring = 0;
this.Defense = 0;
this.Checking = 0;
this.Powerplay = 0;
this.Goaltending = 0;
this.ArtID = -1;
}
function getIntArrayIndex(nInt, oArray)
{
if (nInt != "")
{
for (var i=0; i<oArray.length; i+=2)
{
if (oArray[i] == nInt)
{
return i/2;
}
}
}
}
function OnHomeTeamChanged()
{
if (oGameData.HomeTeam != nullTeamID)
{
if (oLeagueServer.LeagueType != 2)
{
setHomeTeam();
}
else //easo
{
//if server
if (bHost)
{
if (!System.GUI.general.data[6])
{
//if home team is easo team
if (oGameData.HomeTeam == nEASOHomeTeam)
{
setHomeTeam();
System.GUI.general.data[6] = true;
}
else //display Waiting for player msg
{
error_box_home.style.visibility = "visible";
}
}
else
{
setHomeTeam();
}
}
else
{
setHomeTeam();
}
}
}
else //display Waiting for player msg
{
error_box_home.style.visibility = "visible";
}
}
function setHomeTeam()
{
teamInfo = new TeamInfoObject();
oGameData.GetTeamInfo(0,teamInfo);
error_box_home.style.visibility = "hidden";
changeTeamProperties( teamInfo , 0 );
if (drpHomeLeagues.Selected != oGameData.HomeLeague)
{
drpHomeLeagues.Selected = oGameData.HomeLeague;
setTimeout("initDrpHomeTeam()", 100);
}
drpHomeTeams.Selected = getIntArrayIndex(oGameData.HomeTeam, homeTeamArray);
}
function setEASOHomeTeam()
{
if (oGameData.HomeTeam == nEASOHomeTeam && !bHomeSet)
{
bHomeSet = true;
teamInfo = new TeamInfoObject();
oGameData.GetTeamInfo(0,teamInfo);
error_box_home.style.visibility = "hidden";
changeTeamProperties( teamInfo , 0 );
if (drpHomeLeagues.Selected != oGameData.HomeLeague)
{
drpHomeLeagues.Selected = oGameData.HomeLeague;
setTimeout("initDrpHomeTeam()", 100);
}
drpHomeTeams.Selected = getIntArrayIndex(nEASOHomeTeam, homeTeamArray);
}
else if (oGameData.HomeTeam != nEASOHomeTeam)
{
oGameData.HomeTeam = nEASOHomeTeam;
}
}
function OnAwayTeamChanged()
{
if (oGameData.AwayTeam != nullTeamID)
{
if (oLeagueServer.LeagueType != 2)
{
setAwayTeam();
}
else //easo
{
//if client
if (!bHost)
{
//easo away team not yet set
if (!System.GUI.general.data[6])
{
//if away team is easo team
if (oGameData.AwayTeam == nEASOAwayTeam)
{
setAwayTeam();
System.GUI.general.data[6] = true;
}
else //display Waiting for player msg
{
error_box_away.style.visibility = "visible";
}
}
// now set.. so continue as usual
else
{
setAwayTeam();
}
}
//if host... continue as usual
else
{
setAwayTeam();
}
}
}
else //display Waiting for player msg
{
error_box_away.style.visibility = "visible";
}
}
function setAwayTeam()
{
teamInfo = new TeamInfoObject();
oGameData.GetTeamInfo( 1,teamInfo );
error_box_away.style.visibility = "hidden";
changeTeamProperties( teamInfo , 1 );
if (drpAwayLeagues.Selected != oGameData.AwayLeague)
{
drpAwayLeagues.Selected = oGameData.AwayLeague;
setTimeout("initDrpAwayTeam()", 100);
}
drpAwayTeams.Selected = getIntArrayIndex(oGameData.AwayTeam, awayTeamArray);
}
function setEASOAwayTeam()
{
if (oGameData.AwayTeam == nEASOAwayTeam && !bAwaySet)
{
bAwaySet = true;
nEASOAwayTeam = -1;
teamInfo = new TeamInfoObject();
oGameData.GetTeamInfo(0,teamInfo);
error_box_away.style.visibility = "hidden";
changeTeamProperties( teamInfo , 0 );
if (drpAwayLeagues.Selected != oGameData.AwayLeague)
{
drpAwayLeagues.Selected = oGameData.AwayLeague;
setTimeout("initDrpAwayTeam()", 100);
}
drpAwayTeams.Selected = getIntArrayIndex(nEASOAwayTeam, awayTeamArray);
}
else if (oGameData.AwayTeam != nEASOAwayTeam && !bHost)
{
oGameData.AwayTeam = nEASOAwayTeam;
}
}
function OnLevelChanged()
{
drpSkillLevel.Selected = oGameData.Level;
skillText.innerText = skillArray[(oGameData.Level*2)+1];
}
function ControlSetObject()
{
this.homeSlot0Local = 0;
this.homeSlot0Name = 0;
this.homeSlot0Control = 0;
this.homeSlot0Locked = 0;
this.homeSlot0Ready = 0;
this.homeSlot1Local = 0;
this.homeSlot1Name = 0;
this.homeSlot1Control = 0;
this.homeSlot1Locked = 0;
this.homeSlot1Ready = 0;
this.homeSlot2Local = 0;
this.homeSlot2Name = 0;
this.homeSlot2Control = 0;
this.homeSlot2Locked = 0;
this.homeSlot2Ready = 0;
this.homeSlot3Local = 0;
this.homeSlot3Name = 0;
this.homeSlot3Control = 0;
this.homeSlot3Locked = 0;
this.homeSlot3Ready = 0;
this.homeSlot4Local = 0;
this.homeSlot4Name = 0;
this.homeSlot4Control = 0;
this.homeSlot4Locked = 0;
this.homeSlot4Ready = 0;
this.homeSlot5Local = 0;
this.homeSlot5Name = 0;
this.homeSlot5Control = 0;
this.homeSlot5Locked = 0;
this.homeSlot5Ready = 0;
this.awaySlot0Local = 0;
this.awaySlot0Name = 0;
this.awaySlot0Control = 0;
this.awaySlot0Locked = 0;
this.awaySlot0Ready = 0;
this.awaySlot1Local = 0;
this.awaySlot1Name = 0;
this.awaySlot1Control = 0;
this.awaySlot1Locked = 0;
this.awaySlot1Ready = 0;
this.awaySlot2Local = 0;
this.awaySlot2Name = 0;
this.awaySlot2Control = 0;
this.awaySlot2Locked = 0;
this.awaySlot2Ready = 0;
this.awaySlot3Local = 0;
this.awaySlot3Name = 0;
this.awaySlot3Control = 0;
this.awaySlot3Locked = 0;
this.awaySlot3Ready = 0;
this.awaySlot4Local = 0;
this.awaySlot4Name = 0;
this.awaySlot4Control = 0;
this.awaySlot4Locked = 0;
this.awaySlot4Ready = 0;
this.awaySlot5Local = 0;
this.awaySlot5Name = 0;
this.awaySlot5Control = 0;
this.awaySlot5Locked = 0;
this.awaySlot5Ready = 0;
}
function setSlotIcon (slot, slotName, slotLocal, slotReady)
{
if (slotName != "")
{
if (!slotLocal)
{
if (!slotReady)
{
document.all[slot.id + "_icon"].style.visibility = "visible";
document.all[slot.id + "_ready"].style.visibility = "hidden";
}
else
{
document.all[slot.id + "_icon"].style.visibility = "hidden";
document.all[slot.id + "_ready"].style.visibility = "visible";
}
}
}
else
{
document.all[slot.id + "_icon"].style.visibility = "hidden";
document.all[slot.id + "_ready"].style.visibility = "hidden";
}
}
function OnControlsChanged()
{
controlSet = new ControlSetObject();
oGameData.GetSlotControllers(controlSet);
home_0.controllerLocal = controlSet.homeSlot0Local;
home_0.controllerName = controlSet.homeSlot0Name;
home_0.controllerId = controlSet.homeSlot0Control;
home_0_lock.controllerLocked = controlSet.homeSlot0Locked;
setSlotIcon(home_0, controlSet.homeSlot0Name, controlSet.homeSlot0Local, controlSet.homeSlot0Ready);
home_1.controllerLocal = controlSet.homeSlot1Local;
home_1.controllerName = controlSet.homeSlot1Name;
home_1.controllerId = controlSet.homeSlot1Control;
home_1_lock.controllerLocked = controlSet.homeSlot1Locked;
//(!controlSet.homeSlot1Local && controlSet.homeSlot1Name!="") ? home_1_icon.style.visibility = "visible" : home_1_icon.style.visibility = "hidden";
//(controlSet.homeSlot1Ready) ? home_1_icon.style.visibility = "hidden" : home_1_ready.visibility = "visible";
setSlotIcon(home_1, controlSet.homeSlot1Name, controlSet.homeSlot1Local, controlSet.homeSlot1Ready);
home_2.controllerLocal = controlSet.homeSlot2Local;
home_2.controllerName = controlSet.homeSlot2Name;
home_2.controllerId = controlSet.homeSlot2Control;
home_2_lock.controllerLocked = controlSet.homeSlot2Locked;
//(!controlSet.homeSlot2Local && controlSet.homeSlot2Name!="") ? home_2_icon.style.visibility = "visible" : home_2_icon.style.visibility = "hidden";
//(controlSet.homeSlot2Ready) ? home_2_icon.style.visibility = "hidden" : home_2_ready.visibility = "visible";
setSlotIcon(home_2, controlSet.homeSlot2Name, controlSet.homeSlot2Local, controlSet.homeSlot2Ready);
home_3.controllerLocal = controlSet.homeSlot3Local;
home_3.controllerName = controlSet.homeSlot3Name;
home_3.controllerId = controlSet.homeSlot3Control;
home_3_lock.controllerLocked = controlSet.homeSlot3Locked;
//(!controlSet.homeSlot3Local && controlSet.homeSlot3Name!="") ? home_3_icon.style.visibility = "visible" : home_3_icon.style.visibility = "hidden";
//(controlSet.homeSlot3Ready) ? home_3_icon.style.visibility = "hidden" : home_3_ready.visibility = "visible";
setSlotIcon(home_3, controlSet.homeSlot3Name, controlSet.homeSlot3Local, controlSet.homeSlot3Ready);
home_4.controllerLocal = controlSet.homeSlot4Local;
home_4.controllerName = controlSet.homeSlot4Name;
home_4.controllerId = controlSet.homeSlot4Control;
home_4_lock.controllerLocked = controlSet.homeSlot4Locked;
//(!controlSet.homeSlot4Local && controlSet.homeSlot4Name!="") ? home_4_icon.style.visibility = "visible" : home_4_icon.style.visibility = "hidden";
//(controlSet.homeSlot4Ready) ? home_4_icon.style.visibility = "hidden" : home_4_ready.visibility = "visible";
setSlotIcon(home_4, controlSet.homeSlot4Name, controlSet.homeSlot4Local, controlSet.homeSlot4Ready);
home_5.controllerLocal = controlSet.homeSlot5Local;
home_5.controllerName = controlSet.homeSlot5Name;
home_5.controllerId = controlSet.homeSlot5Control;
home_5_lock.controllerLocked = controlSet.homeSlot5Locked;
//(!controlSet.homeSlot5Local && controlSet.homeSlot5Name!="") ? home_5_icon.style.visibility = "visible" : home_5_icon.style.visibility = "hidden";
//(controlSet.homeSlot5Ready) ? home_5_icon.style.visibility = "hidden" : home_5_ready.visibility = "visible";
setSlotIcon(home_5, controlSet.homeSlot5Name, controlSet.homeSlot5Local, controlSet.homeSlot5Ready);
away_0.controllerLocal = controlSet.awaySlot0Local;
away_0.controllerName = controlSet.awaySlot0Name;
away_0.controllerId = controlSet.awaySlot0Control;
away_0_lock.controllerLocked = controlSet.awaySlot0Locked;
//(!controlSet.awaySlot0Local && controlSet.awaySlot0Name!="") ? away_0_icon.style.visibility = "visible" : away_0_icon.style.visibility = "hidden";
//(controlSet.awaySlot0Ready) ? away_0_icon.style.visibility = "hidden" : away_0_ready.visibility = "visible";
setSlotIcon(away_0, controlSet.awaySlot0Name, controlSet.awaySlot0Local, controlSet.awaySlot0Ready);
away_1.controllerLocal = controlSet.awaySlot1Local;
away_1.controllerName = controlSet.awaySlot1Name;
away_1.controllerId = controlSet.awaySlot1Control;
away_1_lock.controllerLocked = controlSet.awaySlot1Locked;
//(!controlSet.awaySlot1Local && controlSet.awaySlot1Name!="") ? away_1_icon.style.visibility = "visible" : away_1_icon.style.visibility = "hidden";
//(controlSet.awaySlot1Ready) ? away_1_icon.style.visibility = "hidden" : away_1_ready.visibility = "visible";
setSlotIcon(away_1, controlSet.awaySlot1Name, controlSet.awaySlot1Local, controlSet.awaySlot1Ready);
away_2.controllerLocal = controlSet.awaySlot2Local;
away_2.controllerName = controlSet.awaySlot2Name;
away_2.controllerId = controlSet.awaySlot2Control;
away_2_lock.controllerLocked = controlSet.awaySlot2Locked;
//(!controlSet.awaySlot2Local && controlSet.awaySlot2Name!="") ? away_2_icon.style.visibility = "visible" : away_2_icon.style.visibility = "hidden";
//(controlSet.awaySlot2Ready) ? away_2_icon.style.visibility = "hidden" : away_2_ready.visibility = "visible";
setSlotIcon(away_2, controlSet.awaySlot2Name, controlSet.awaySlot2Local, controlSet.awaySlot2Ready);
away_3.controllerLocal = controlSet.awaySlot3Local;
away_3.controllerName = controlSet.awaySlot3Name;
away_3.controllerId = controlSet.awaySlot3Control;
away_3_lock.controllerLocked = controlSet.awaySlot3Locked;
//(!controlSet.awaySlot3Local && controlSet.awaySlot3Name!="") ? away_3_icon.style.visibility = "visible" : away_3_icon.style.visibility = "hidden";
//(controlSet.awaySlot3Ready) ? away_3_icon.style.visibility = "hidden" : away_3_ready.visibility = "visible";
setSlotIcon(away_3, controlSet.awaySlot3Name, controlSet.awaySlot3Local, controlSet.awaySlot3Ready);
away_4.controllerLocal = controlSet.awaySlot4Local;
away_4.controllerName = controlSet.awaySlot4Name;
away_4.controllerId = controlSet.awaySlot4Control;
away_4_lock.controllerLocked = controlSet.awaySlot4Locked;
//(!controlSet.awaySlot4Local && controlSet.awaySlot4Name!="") ? away_4_icon.style.visibility = "visible" : away_4_icon.style.visibility = "hidden";
//(controlSet.awaySlot4Ready) ? away_4_icon.style.visibility = "hidden" : away_4_ready.visibility = "visible";
setSlotIcon(away_4, controlSet.awaySlot4Name, controlSet.awaySlot4Local, controlSet.awaySlot4Ready);
away_5.controllerLocal = controlSet.awaySlot5Local;
away_5.controllerName = controlSet.awaySlot5Name;
away_5.controllerId = controlSet.awaySlot5Control;
away_5_lock.controllerLocked = controlSet.awaySlot5Locked;
//(!controlSet.awaySlot5Local && controlSet.awaySlot5Name!="") ? away_5_icon.style.visibility = "visible" : away_5_icon.style.visibility = "hidden";
//(controlSet.awaySlot5Ready) ? away_5_icon.style.visibility = "hidden" : away_5_ready.visibility = "visible";
setSlotIcon(away_5, controlSet.awaySlot5Name, controlSet.awaySlot5Local, controlSet.awaySlot5Ready);
}
/* Game Launch */
function OnReadyGame()
{
if (System.GUI.isNavigating()) { return; }
//if easo or online mode, make sure user has selected a side
//if (oLeagueServer.LeagueType == 1 || oLeagueServer.LeagueType == 2)
//{
//}
if (!readyClicked)
{
// put up a dialog box and indicate we are in ready to go mode
if (oLeagueFace.ProviderInterface.IsOnlineSetup())
{
//if (oGameData.CanAlterSide(0) || oGameData.CanAlterSide(1))
//{
if (controller_0.playerId == null && controller_1.playerId == null &&
controller_2.playerId == null && controller_3.playerId == null &&
controller_4.playerId == null && controller_5.playerId == null)
{
oAudioInterface.PlayWarningSFX();
System.GUI.dialog.innerHTML = nhlMsg("NO_SIDE_MESSAGE");
System.GUI.dialog.setSize( 350 , 120 );
System.GUI.dialog.align = "center";
System.GUI.dialog.addButton( "okButton" , nhlMsg("OK", true), OnUnReadyGame);
System.GUI.dialog.show(true);
}
else
{
oAudioInterface.PlayWarningSFX();
System.GUI.dialog.innerHTML = nhlMsg("WAITING_READY");
System.GUI.dialog.setSize( 350 , 120 );
System.GUI.dialog.align = "center";
System.GUI.dialog.addButton( "okButton" , nhlMsg("NOT_READY", true), OnUnReadyGame);
System.GUI.dialog.show(true);
//halt chat detection..
shutdownOnline();
// kill the device callback
oGameFace.DeviceInterface.StopDevicePoll();
oGameData.ReadyGame();
readyClicked = true;
}
/*
}
else
{
oAudioInterface.PlayWarningSFX();
// need to select a side
System.GUI.dialog.innerHTML = nhlMsg("HUMAN_CONTROLLED_MSG");
System.GUI.dialog.setSize( 350 , 120 );
System.GUI.dialog.align = "center";
System.GUI.dialog.addButton( "okButton" , nhlMsg("OKAY", true));
System.GUI.dialog.show(true);
}
*/
}
else
{
// kill the device callback
oGameFace.DeviceInterface.StopDevicePoll();
oGameData.ReadyGame();
readyClicked = true;
}
}
}
function OnUnReadyGame()
{
if (readyClicked && !gameLaunched)
{
oGameData.UnReadyGame();
// set up the device callback
oGameFace.DeviceInterface.StartDevicePoll();
oGameFace.CommInterface.InitGameChat();
readyClicked = false;
}
}
function OnStartGame()
{
if (oLeagueServer.LeagueType == 2)
{
oGameFace.OnlinGameState = "EASO";
}
gameLaunched = true;
oAudioInterface.PlayPlayGameSFX();
// tell the user we are going into game
System.GUI.dialog.innerHTML = "<center>" + nhlMsg("LOADING_GAME") + "</center><br><br><img src='" + System.getInstallFolder() + "fe/nhl/images2/widgets/load_sm.gif'>";
System.GUI.dialog.setSize( 400 , 100 );
System.GUI.dialog.align = "center";
System.GUI.dialog.setStyle("NONE");
System.GUI.dialog.show( true );
}
function OnExecuteGame()
{
//oLeagueFace.ManagerInterface.SaveGameSettings( oGameData );
oLeagueFace.ProviderInterface.ExitSetup(0);
// the correct executor should have been loaded
oGameFace.ExecutorServerInterface.ExecutorDispatch.ExecuteGame(oLeagueFace.ProviderInterface.GameDataInterface,oLeagueFace.ProviderInterface.GleanDataInterface);
}
/* End Game Launch */
function CallbackTableObject()
{
this.HomeTeamChanged = OnHomeTeamChanged;
this.AwayTeamChanged = OnAwayTeamChanged;
this.LevelChanged = OnLevelChanged;
this.ControlsChanged = OnControlsChanged;
this.ExecuteGame = OnExecuteGame;
this.StartGame = OnStartGame;
this.ChatUsersUpdated = OnChatUsersUpdated;
this.ChatUpdated = OnChatUpdated;
this.DeviceInputDetected = OnDeviceMove;
this.ReceivedGameSetup = OnReceivedGameSetup;
}
function OnDeviceMove()
{
// this means someone has moved a device attached to the game
// we can choose to do what we want with it.
var deviceEvent = new Object();
deviceEvent.deviceID = 0;
deviceEvent.event = 0;
var controller;
if (oGameFace.DeviceInterface.GetDevicePoll(deviceEvent))
{
switch (deviceEvent.deviceID)
{
case 0:
//keyboard
controller = controller_0;
break;
case 1:
//joystick
controller = controller_1;
break;
case 2:
//joystick
controller = controller_2;
break;
case 3:
//joystick
controller = controller_3;
break;
case 4:
//joystick
controller = controller_4;
break;
case 5:
//joystick
controller = controller_5;
break;
}
if (!(deviceEvent.deviceID == 0 && bChatHasFocus))
{
switch (deviceEvent.event)
{
case 0:
//up
moveControllerUp(controller);
break;
case 1:
//down
moveControllerDown(controller);
break;
case 2:
//left
moveControllerLeft(controller);
break;
case 3:
// right
moveControllerRight(controller);
break;
}
}
}
}
function moveControllerLeft(controllerId)
{
//find out where the keyboard pog is
if (controllerId.playerId != null)
{
//if it's on home_x then move back to the middle
if (controllerId.playerId.match("home"))
{
controllerId.resetPosition();
controllerId.DoSetController(0);
oAudioInterface.PlayControllerMoveSFX();
}
}
else
{
//else if it's on the middle then move to away_x
if(controllerId.targets.match("away"))
{
controllerId.moveToPlayer("away_0");
//moveController(away_0, 0);
controllerId.DoSetController(0);
oAudioInterface.PlayControllerMoveSFX();
}
}
}
function moveControllerRight(controllerId)
{
//find out where the keyboard pog is
if (controllerId.playerId != null)
{
//if it's on away_x then move back to the middle
if (controllerId.playerId.match("away"))
{
controllerId.resetPosition();
controllerId.DoSetController(0);
oAudioInterface.PlayControllerMoveSFX();
}
}
else
{
//else if it's on the middle then move to home_x
if(controllerId.targets.match("home"))
{
controllerId.moveToPlayer("home_0");
//moveController(home_0, 0);
controllerId.DoSetController(0);
oAudioInterface.PlayControllerMoveSFX();
}
}
}
function moveControllerUp(controllerId)
{
var i = 0;
var count = 1;
//find out where the keyboard pog is
if (controllerId.playerId != null)
{
//if it's not on 0 slot move it up
if (!controllerId.playerId.match("_0"))
{
//parse the number out of the id
var nSlotNum = parseInt(controllerId.playerId.substring(controllerId.playerId.indexOf("_")+1, controllerId.playerId.length));
//parse the name out of the id
var sSlotName = controllerId.playerId.substring(0, controllerId.playerId.indexOf("_")+1);
//loop if spot is taken until first available slot
do
{
i = nSlotNum - count;
count++;
}
while (document.all[sSlotName + i].hasController == "true" && i > 0)
//if -1, no avail. spots: do not move controller
if (i > -1)
{
controllerId.moveToPlayer(sSlotName + i);
//moveController(document.all[sSlotName + i], 0);
oAudioInterface.PlayControllerMoveSFX();
if (!bIsOnline)
controllerId.DoSetController((count-1));
else
controllerId.DoSetController(0);
}
}
}
}
function moveControllerDown(controllerId)
{
var i = 0;
var count = 1;
//find out where the keyboard pog is
if (controllerId.playerId != null)
{
//if it's not on 5th slot move it down
if (!controllerId.playerId.match("_5"))
{
//parse the number out of the id
var nSlotNum = parseInt(controllerId.playerId.substring(controllerId.playerId.indexOf("_")+1, controllerId.playerId.length));
//parse the name out of the id
var sSlotName = controllerId.playerId.substring(0, controllerId.playerId.indexOf("_")+1);
//loop if spot is taken until last available slot
do
{
i = nSlotNum + count;
count++;
if (i == 6)
break;
}
while (document.all[sSlotName + i].hasController == "true")
//if -1, no avail. spots: do not move controller
if (i < 6)
{
controllerId.moveToPlayer(sSlotName + i);
//moveController(document.all[sSlotName + i], 0);
oAudioInterface.PlayControllerMoveSFX();
if (!bIsOnline)
controllerId.DoSetController((count-1)*-1);
else
controllerId.DoSetController(0);
}
}
}
}
function InputDeviceObject()
{
this.keyboard = 0;
this.joystick1 = 0;
this.joystick2 = 0;
this.joystick3 = 0;
this.joystick4 = 0;
this.joystick5 = 0;
oGameFace.DeviceInterface.GetInputDevices(this);
}
function changeLevel()
{
oGameData.Level = drpSkillLevel.Selected;
}
function changeHomeTeam( nIndex )
{
//(arguments.length == 0) ? oGameData.HomeTeam = drpHomeTeam.value : oGameData.HomeTeam = nIndex;
(arguments.length == 0) ? oGameData.HomeTeam = homeTeamArray[drpHomeTeam.Selected*2] : oGameData.HomeTeam = homeTeamArray[nIndex*2];
}
function changeAwayTeam( nIndex )
{
//(arguments.length == 0) ? oGameData.AwayTeam = drpAwayTeam.value : oGameData.AwayTeam = nIndex;
(arguments.length == 0) ? oGameData.AwayTeam = awayTeamArray[drpAwayTeams.Selected*2] : oGameData.AwayTeam = awayTeamArray[nIndex*2];
}
function changeController(team, control, slot)
{
oGameData.SetControllerToSlot(team, control, slot);
}
function removeController(team, control, slot)
{
oGameData.RemoveControllerFromSlot(team, control, slot)
}
function changeControllerLock(team, lock, slot)
{
if( lock )
{
oAudioInterface.PlayLockCloseSFX();
}
else
{
oAudioInterface.PlayLockOpenSFX();
}
oGameData.SetSlotLockStatus(team, lock, slot);
}
function SwapTeams()
{
oAudioInterface.PlaySFX(1103);
//swap league drop downs
var nHomeLeague = drpHomeLeagues.Selected;
var nAwayLeague = drpAwayLeagues.Selected;
drpHomeLeagues.Selected = nAwayLeague;
drpAwayLeagues.Selected = nHomeLeague;
initDrpHomeTeam();
initDrpAwayTeam();
oGameData.SwapTeams();
}
/* ////////////////// DROP DOWN ///////////////////////////*/
function nextItem( oSelectBox , nAway )
{
oAudioInterface.PlaySpinnerSFX();
if (nAway==1)
var nNextIndex = nAwayTeamIndex + 1;
else
var nNextIndex = nHomeTeamIndex + 1;
( nNextIndex < oSelectBox.length ) ? oSelectBox.SetSelectionIndex( nNextIndex ):oSelectBox.SetSelectionIndex( 1 );
( nAway == 1 ) ? changeAwayTeam( oSelectBox.value ) : changeHomeTeam( oSelectBox.value );
}
function previousItem( oSelectBox , nAway )
{
oAudioInterface.PlaySpinnerSFX();
if (nAway==1)
var nPrevIndex = nAwayTeamIndex - 1;
else
var nPrevIndex = nHomeTeamIndex - 1;
( nPrevIndex > 0 ) ? oSelectBox.SetSelectionIndex( nPrevIndex ) : oSelectBox.SetSelectionIndex( oSelectBox.length-1 );
( nAway == 1 ) ? changeAwayTeam( oSelectBox.value ) : changeHomeTeam( oSelectBox.value );
}
/* TEAM SWAP*/
function changeTeamProperties( oTeam , nAway )
{
var oOverall;
var oScoring;
var oDefense;
var oChecking;
var oPowerPlay;
var oGoalTending;
var oFullName;
var oImage=null;
if(!nAway)
{
oOverall = window.document.all.homeTeamOverall;
oScoring = window.document.all.homeTeamScoring;
oDefense = window.document.all.homeTeamDefense;
oChecking = window.document.all.homeTeamChecking;
oPowerPlay = window.document.all.homeTeamPowerPlay;
oGoalTending = window.document.all.homeTeamGoalTending;
oFullName = window.document.all.homeTeamFullName;
oImage = window.document.all.homeTeamImage;
//homeTeam_name_white.innerText = oTeam.Name.toUpperCase();
//homeTeam_name.innerText = oTeam.Name.toUpperCase();
homeTeamOwnerID = oTeam.OwnerID;
//homeRosterText.innerText = nhlMsg("ROSTER") + ": " + getPlayerName(homeTeamOwnerID);
}
else
{
oOverall = window.document.all.awayTeamOverall;
oScoring = window.document.all.awayTeamScoring;
oDefense = window.document.all.awayTeamDefense;
oChecking = window.document.all.awayTeamChecking;
oPowerPlay = window.document.all.awayTeamPowerPlay;
oGoalTending = window.document.all.awayTeamGoalTending;
oFullName = window.document.all.awayTeamFullName;
oImage = window.document.all.awayTeamImage;
//awayTeam_name_white.innerText = oTeam.Name.toUpperCase();
//awayTeam_name.innerText = oTeam.Name.toUpperCase();
awayTeamOwnerID = oTeam.OwnerID;
//awayRosterText.innerText = nhlMsg("ROSTER") + ": " + getPlayerName(awayTeamOwnerID);
}
oOverall.innerText = oTeam.Overall;
oScoring.innerText = oTeam.Scoring;
oDefense.innerText = oTeam.Defense;
oChecking.innerText = oTeam.Checking;
oPowerPlay.innerText = oTeam.Powerplay;
oGoalTending.innerText = oTeam.Goaltending;
//oFullName.innerText = oTeam.FullName;
var sTeamLogoPath = imgPath + oTeam.sLogoFile;
if (!bRandom)
xFadeTransition(oImage, sTeamLogoPath);
else
oImage.src = sTeamLogoPath;
}
function xFadeTransition (oImage, sNewImage)
{
oImage.style.filter = "progid:DXImageTransform.Microsoft.Fade(duration=.15);";
oImage.filters[0].Apply();
oImage.src=sNewImage;
oImage.filters[0].Play();
}
/* PLAYER */
//var nCount=0;
function doSelect()
{
//System.GUI.console.println(nCount);
//nCount++;
var oPlayer = event.srcElement;
/*controller event */
if(event.propertyName == "newController" )
{
var oController = document.all[oPlayer.newController];
var intSlot = returnObjectId( oPlayer.id );
var intController = returnObjectId( oController.id );
var intTeam = String(oPlayer.id).match(RegExp("home")) ? 0 : 1;
var oLock = document.all[oPlayer.id + "_lock"];
changeController( intTeam , intController , intSlot);
if(returnObjectId( oPlayer.id ) == 5)
{
var oLock = document.all[oPlayer.id + "_lock"];
doLock( true , oLock )
}
}
if(event.propertyName == "oldController" )
{
var oController = document.all[oPlayer.oldController];
var intSlot = returnObjectId( oPlayer.id );
var intController = returnObjectId( oController.id );
var intTeam = String(oPlayer.id).match(RegExp("home")) ? 0 : 1;
var oLock = document.all[oPlayer.id + "_lock"]
removeController( intTeam , intController , intSlot);
}
/*
if(event.propertyName == "controllerLocked")
{
var oLock = document.all[oPlayer.id + "_lock"];
doLock( element.controllerLocked , oLock);
}
*/
/*game interface callback */
if(event.propertyName == "controllerId")
{
var oController;
/*debug */
var intSlot = returnObjectId( oPlayer.id );
var intControllerId = oPlayer.controllerId;
var intTeam = String(oPlayer.id).match(RegExp("home")) ? 0 : 1;
switch( oPlayer.controllerId)
{
case 6:
toggleVisibility( oPlayer , false );
break;
case 5:
moveController( oPlayer , "5");
break;
case 4:
moveController( oPlayer , "4");
break;
case 3:
moveController( oPlayer , "3");
break;
case 2:
moveController( oPlayer , "2");
break;
case 1:
moveController( oPlayer , "1");
break;
case 0:
moveController( oPlayer , "0");
break;
}
}
}
function moveController( oPlayer, sId )
{
var oController = document.all["controller_" + sId]
//if (oController.playerId != null)
// document.all[oController.playerId].hasController = "false";
oPlayer.hasController = "true";
if(oPlayer.controllerLocal)
oController.moveToPlayer( oPlayer.id );
toggleVisibility( oPlayer , true );
}
function toggleVisibility( oPlayer , visible )
{
//var oText = document.getElementById(oPlayer.id + "_position");
var oStatus = document.getElementById(oPlayer.id + "_status");
var oLock = document.getElementById(oPlayer.id + "_lock");
if(visible)
{
//oText.style.visibility = 'visible';
oStatus.style.visibility = 'visible';
oLock.style.visibility = 'visible';
oStatus.innerText = oPlayer.controllerName;
}
else
{
// oText.style.visibility = 'hidden';
oStatus.style.visibility = 'hidden';
oLock.style.visibility = 'hidden';
oStatus.innerText = "";
oPlayer.hasController = "false";
}
}
function returnObjectId( sValue )
{
var intPos = 1;
intPos += sValue.search( RegExp( "_" ));
return parseInt( sValue.substr( intPos ));
}
/* END PLAYER */
/* LOCK */
function handleLock()
{
if(event.propertyName == "controllerLocked")
{
var oLock = event.srcElement;
toggleLock( oLock );
var intPos = 2;
intPos += oLock.id.search( RegExp( "_" ));
var sPlayerId = oLock.id.substr( 0, intPos );
var oPlayerPosition = document.all[ sPlayerId + "_position" ];
( parseInt(oLock.controllerLocked) ) ? oPlayerPosition.style.visibility = 'visible' : oPlayerPosition.style.visibility = 'hidden';
}
}
function toggleLock( oLock )
{
var sPropsUnlocked = "../images2/screen_images/gamesetup_unlock00.gif";
var sPropsLocked = "../images2/screen_images/gamesetup_lock00.gif";
( oLock.controllerLocked == 1 ) ? oLock.src = sPropsLocked : oLock.src = sPropsUnlocked;
}
function doClick()
{
var oLock = event.srcElement;
var locked = (oLock.src.indexOf('unlock') != -1) ? 1 : 0;
var intSlot = returnObjectId( oLock.id );
var intTeam = String(oLock.id).match(RegExp("home")) ? 0 : 1;
changeControllerLock( intTeam , locked , intSlot);
}
function doLock( bValue , oLock )
{
var intLocked = bValue ? 1 : 0 ;
var intSlot = returnObjectId( oLock.id );
var intTeam = String(oLock.id).match(RegExp("home")) ? 0 : 1;
changeControllerLock( intTeam , intLocked , intSlot);
}
function doMouseOver()
{
var oLock = event.srcElement;
var sPropsUnlocked = "../images2/screen_images/gamesetup_unlock01.gif";
var sPropsLocked = "../images2/screen_images/gamesetup_lock01.gif";
System.GUI.console.println(oLock);
System.GUI.console.println(oLock.id);
if (oLock.src != null)
{
if ( oLock.src.match(/unlock/) )
oLock.src = sPropsUnlocked
else if ( oLock.src.match(/lock/) )
oLock.src = sPropsLocked;
}
}
function doMouseOut()
{
var oLock = event.srcElement;
var sPropsUnlocked = "../images2/screen_images/gamesetup_unlock00.gif";
var sPropsLocked = "../images2/screen_images/gamesetup_lock00.gif";
if (oLock.src != null)
{
if ( oLock.src.match(/unlock/) )
oLock.src = sPropsUnlocked
else if ( oLock.src.match(/lock/) )
oLock.src = sPropsLocked;
}
}
/* END LOCK */
function drpSkillLevelOnDropDown()
{
drpSkillLevel.style.height=90;
drpSkillLevel.style.zIndex=100;
}
function drpSkillLevelOnPullUp()
{
drpSkillLevel.style.zIndex=0;
drpSkillLevel.style.height=20;
}
function drpAwayTeamsOnDropDown()
{
drpAwayTeams.style.height=115;
drpAwayTeams.style.zIndex=100;
}
function drpAwayTeamsOnPullUp()
{
drpAwayTeams.style.zIndex=0;
drpAwayTeams.style.height=20;
}
function drpHomeTeamsOnDropDown()
{
drpHomeTeams.style.height=115;
drpHomeTeams.style.zIndex=100;
}
function drpHomeTeamsOnPullUp()
{
drpHomeTeams.style.zIndex=0;
drpHomeTeams.style.height=20;
}
function drpAwayLeaguesOnDropDown()
{
drpAwayLeagues.style.height=120;
drpAwayLeagues.style.zIndex=100;
}
function drpAwayLeaguesOnPullUp()
{
drpAwayLeagues.style.zIndex=0;
drpAwayLeagues.style.height=20;
}
function drpHomeLeaguesOnDropDown()
{
drpHomeLeagues.style.height=120;
drpHomeLeagues.style.zIndex=100;
}
function drpHomeLeaguesOnPullUp()
{
drpHomeLeagues.style.zIndex=0;
drpHomeLeagues.style.height=20;
}
function showUniform()
{
oAudioInterface.PlaySFX(1099);
clearSettings();
System.GUI.dialog.document_src = "fe/nhl/html/uniforms.html";
System.GUI.dialog.addButton("btnBuddyCancel", scMsg("OK", true), function() { bUniformDialog = true;removeCallbackTable();initGameInterface( oCallbackTable ); OnHomeTeamChanged(); OnAwayTeamChanged(); });
System.GUI.dialog.setSize(515, 295);
System.GUI.dialog.show();
System.GUI.dialog.setBackgroundImage("fe/nhl/images2/screen_images/gamesetup_pop.gif", -15);
}
function hideDialogCallback()
{
}
function getHomeLeagueIndex()
{
switch (oLeagueServer.LeagueType)
{
case 5:
return 1;
case 8:
return 2;
case 9:
return 3;
case 10:
return 4;
default:
return oGameData.HomeLeague;
}
}
function getAwayLeagueIndex()
{
switch (oLeagueServer.LeagueType)
{
case 5:
return 1;
case 8:
return 2;
case 9:
return 3;
case 10:
return 4;
default:
return oGameData.AwayLeague;
}
}