home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Joystick Magazine 2003 November
/
CD1_JOY_153.iso
/
demos
/
NHL2004Demo.exe
/
fe
/
nhl
/
js
/
controller_config_interface.js
< prev
next >
Wrap
Text File
|
2003-08-20
|
7KB
|
327 lines
//Copyright (c) 2002 Electronic Arts Inc. All rights reserved.
var currentControl = 0;
var aItems = new Array('srcBasic', 'srcAdvanced', 'srcOther');
DialogWindow = top.DialogWindow;
var inputDevice;
var myDialog;
var oAudioInterface = oGameFace.AudioInterface;
var controlConfig;
var nAction1 = 0;
var nAction2 = 0;
var nAction3 = 0;
var nAction4 = 0;
var nAction5 = 0;
var nAction6 = 0;
var nAction7 = 0;
var nAction8 = 0;
var nAction9 = 0;
var nAction10 = 0;
var nAction11 = 0;
var nControllerCount = 0;
function doSkin()
{
skinTable1Header.background = "../images2/common/" + System.GUI.getTeamSkin() + "/1x1_subhead.gif";
}
function initSettings()
{
doSkin();
if (!oLeagueFace.ProviderInterface.IsInSetup())
{
oLeagueFace.ProviderInterface.EnterSetup();
}
//System.GUI.setTitleMovie("Controller_Config.swf");
controlConfig = new ControlConfigObject();
//init game interface
oCallbackTable = new CallbackTableObject();
initGameInterface( oCallbackTable );
inputDevice = new InputDeviceObject();
initDrpScreens();
initDrpControllers();
// get the control config -- will be keyboard
initControl();
displayFirstScreen();
}
function canExitScreen()
{
oGameFace.DeviceInterface.SaveInputDeviceConfig(currentControl);
oGameFace.RemoveLocalEventTable();
//oLeagueFace.ManagerInterface.SaveGameSettings( oGameData );
removeCallbackTable();
return true;
}
function clearSettings()
{
}
function ControlConfigObject()
{
this.Action1 = "";
this.Action2 = "";
this.Action3 = "";
this.Action4 = "";
this.Action5 = "";
this.Action6 = "";
this.Action7 = "";
this.Action8 = "";
this.Action9= "";
this.Action10= "";
this.Action11= "";
}
function CallbackTableObject()
{
this.ControlConfigChanged = onControlConfigChanged;
}
function InputDeviceObject()
{
this.keyboard = 0;
this.joystick1 = 0;
this.joystick2 = 0;
this.joystick3 = 0;
this.joystick4 = 0;
this.joystick5 = 0;
this.joystick6 = 0;
this.joystick1Name = "";
this.joystick2Name = "";
this.joystick3Name = "";
this.joystick4Name = "";
this.joystick5Name = "";
this.joystick6Name = "";
oGameFace.DeviceInterface.GetInputDevices(this);
//alert("joystick1Name " + this.joystick1Name);
//alert("joystick2Name " + this.joystick2Name);
}
function changeController()
{
switch( drpController.Selected )
{
case 0:
addKeyboardOption();
break;
default:
removeKeyboardOption();
}
doController();
}
function changeScreen()
{
var nExpression = (arguments.length == 0 ) ? parseInt( drpScreen.Selected ) : arguments[0];
// first make everything hidden
srcBasic.style.visibility = "hidden";
srcAdvanced.style.visibility = "hidden";
srcOther.style.visibility = "hidden";
switch( nExpression )
{
case 0:
toggleVisibility(srcBasic);
break;
case 1:
toggleVisibility(srcAdvanced);
break;
case 2:
toggleVisibility(srcOther);
break;
}
}
function onControlConfigChanged()
{
if (System.GUI.dialog)
{
System.GUI.dialog.hide();
}
oGameFace.DeviceInterface.GetInputDeviceConfig(currentControl, controlConfig);
//drpController.Selected = controlConfig.Name;
txtKey01.innerText = controlConfig.Action1;
txtKey02.innerText = controlConfig.Action2;
txtKey03.innerText = controlConfig.Action3;
txtKey04.innerText = controlConfig.Action4;
txtKey05.innerText = controlConfig.Action5;
txtKey06.innerText = controlConfig.Action6;
txtKey07.innerText = controlConfig.Action7;
txtKey08.innerText = controlConfig.Action8;
txtKey09.innerText = controlConfig.Action9;
txtKey10.innerText = controlConfig.Action10;
txtKey11.innerText = controlConfig.Action8;
txtKey12.innerText = controlConfig.Action11;
}
function toggleVisibility( srcItem )
{
srcItem.style.visibility = 'visible';
hideOthers( srcItem );
}
function hideOthers( srcItem )
{
//for( var index = 0 ; index < aItems.length ; index ++ )
//{
// if(aItems[ index ] != srcItem.id)
// {
// var oScreen = document.all[ aItems[ index ]];
// oScreen.style.visibility = 'hidden';
// }
// }
//srcDirectional.style.visibility = 'hidden';
}
function initDrpControllers()
{
var aComboBox = new ComboBox("drpController", 24, 165, 300, 18, 80, "divController");
drpController.ClearAll();
nControllerCount = 0;
drpController.AddString(nhlMsg('KEYBOARD'));
nControllerCount++;
if(inputDevice.joystick1)
{
//drpController.AddString(nhlMsg('JOYPAD'));
drpController.AddString(inputDevice.joystick1Name);
nControllerCount++;
}
if(inputDevice.joystick2)
{
//drpController.AddString(nhlMsg('JOYPAD'));
drpController.AddString(inputDevice.joystick2Name);
nControllerCount++;
}
if(inputDevice.joystick3)
{
//drpController.AddString(nhlMsg('JOYPAD'));
drpController.AddString(inputDevice.joystick3Name);
nControllerCount++;
}
if(inputDevice.joystick4)
{
//drpController.AddString(nhlMsg('JOYPAD'));
drpController.AddString(inputDevice.joystick4Name);
nControllerCount++;
}
if(inputDevice.joystick5)
{
//drpController.AddString(nhlMsg('JOYPAD'));
drpController.AddString(inputDevice.joystick5Name);
nControllerCount++;
}
drpController.Selected = 0;
}
function initDrpScreens()
{
var aComboBox = new ComboBox("drpScreen", 50, 48, 171, 18, 80, "divScreen");
drpScreen.ClearAll();
drpScreen.AddString(nhlMsg('BASIC_CONTROLS'));
drpScreen.AddString(nhlMsg('ADVANCED_CONTROLS'));
drpScreen.AddString(nhlMsg('OTHER'));
//addKeyboardOption();
}
function addKeyboardOption()
{
if (drpScreen.Selected == 4)
srcDirectional.style.visibility = 'visible';
}
function removeKeyboardOption()
{
//srcDirectional.style.visibility = 'hidden';
}
function initControl()
{
onControlConfigChanged();
}
function displayFirstScreen()
{
changeScreen( 0 );
drpScreen.Selected = 0;
}
function doClick( controlEvent )
{
oAudioInterface.PlayWarningSFX();
System.GUI.dialog.innerHTML = nhlMsg("CONTROLLER_CONFIG_INSTRUCTIONS");
System.GUI.dialog.setSize( 350 , 100 );
System.GUI.dialog.align = "center";
System.GUI.dialog.addButton( "cancelButton" , nhlMsg("CANCEL"), cancelController);
System.GUI.dialog.show( true );
oGameFace.DeviceInterface.ConfigureInputDeviceItem( currentControl , controlEvent );
}
function doController()
{
oGameFace.DeviceInterface.SaveInputDeviceConfig(currentControl);
currentControl = parseInt( drpController.Selected );
onControlConfigChanged();
}
function cancelController()
{
oGameFace.DeviceInterface.CancelConfigureInputDevice();
}
function doDefault()
{
oAudioInterface.PlaySFX(1099);
oGameFace.DeviceInterface.DefaultInputDeviceConfig(currentControl);
oGameFace.DeviceInterface.SaveInputDeviceConfig(currentControl);
}
function drpControllerOnDropDown()
{
drpController.style.height=20+(20*nControllerCount);
drpController.style.zIndex=100;
}
function drpControllerOnPullUp()
{
drpController.style.zIndex=0;
drpController.style.height=20;
}
function drpScreenOnDropDown()
{
drpScreen.style.height=130;
drpScreen.style.zIndex=100;
}
function drpScreenOnPullUp()
{
drpScreen.style.zIndex=0;
drpScreen.style.height=20;
}