first commit
This commit is contained in:
+193
@@ -0,0 +1,193 @@
|
||||
class Cafe2_BaseUIScreen
|
||||
{
|
||||
var m_changeToScreen = null;
|
||||
var m_executeOuttroCallBack = null;
|
||||
var m_uiComponentArray = new Array();
|
||||
function Cafe2_BaseUIScreen(screen)
|
||||
{
|
||||
Cafe2_BaseUIScreen.m_screen = screen;
|
||||
Cafe2_BaseUIScreen.m_screen.onEnterFrame = _global.bind0(this,this.frameDelayedInitCallback);
|
||||
}
|
||||
function frameDelayedInit()
|
||||
{
|
||||
trace("\n\nCafe2_BaseUIScreen::frameDelayedInitCallback() :");
|
||||
var _loc1_ = new Array("N.B. You *must* override frameDelayedInit() in your","\nscreens and move the call to initGUI() to frameDelayedInit().\n");
|
||||
trace(_loc1_[0] + _loc1_[1]);
|
||||
}
|
||||
function frameDelayedInitCallback()
|
||||
{
|
||||
Cafe2_BaseUIScreen.m_screen.onEnterFrame = null;
|
||||
this.frameDelayedInit();
|
||||
}
|
||||
function outtroComplete(theComponent)
|
||||
{
|
||||
trace("Cafe2_BaseUIScreen::outtroComplete() " + theComponent);
|
||||
var _loc2_ = 0;
|
||||
while(_loc2_ < Cafe2_BaseUIScreen.m_thisClass.m_uiComponentArray.length)
|
||||
{
|
||||
if(theComponent == Cafe2_BaseUIScreen.m_thisClass.m_uiComponentArray[_loc2_])
|
||||
{
|
||||
break;
|
||||
}
|
||||
_loc2_ = _loc2_ + 1;
|
||||
}
|
||||
Cafe2_BaseUIScreen.m_thisClass.m_uiComponentArray.splice(_loc2_,1);
|
||||
if(Cafe2_BaseUIScreen.m_thisClass.m_uiComponentArray.length <= 0)
|
||||
{
|
||||
if(Cafe2_BaseUIScreen.m_thisClass.m_changeToScreen != null)
|
||||
{
|
||||
_global.gSM.changeMainScreen(Cafe2_BaseUIScreen.m_thisClass.m_changeToScreen);
|
||||
}
|
||||
}
|
||||
}
|
||||
function introComplete(theComponent)
|
||||
{
|
||||
trace("Cafe2_BaseUIScreen::introComplete()");
|
||||
theComponent.restoreVisualState();
|
||||
Cafe2_BaseUIScreen.m_thisClass.m_introCount--;
|
||||
if(Cafe2_BaseUIScreen.m_thisClass.m_introCount <= 0)
|
||||
{
|
||||
Cafe2_BaseUIScreen.m_thisClass.onIntrosComplete();
|
||||
}
|
||||
}
|
||||
function onIntrosComplete()
|
||||
{
|
||||
trace("Cafe2_BaseUIScreen::onIntrosComplete()");
|
||||
_global.gEH.setLocalEventHandler(this.localEventHandler);
|
||||
_global.gEH.enableCurrentLocalEventHandler();
|
||||
}
|
||||
function registerIntroOuttroComponents(components)
|
||||
{
|
||||
trace("Cafe2_BaseUIScreen::registerIntroOuttroComponents()");
|
||||
this.m_uiComponentArray = components;
|
||||
this.m_introCount = this.m_uiComponentArray.length;
|
||||
var _loc2_ = 0;
|
||||
while(_loc2_ < this.m_introCount)
|
||||
{
|
||||
this.m_uiComponentArray[_loc2_].setIntroCallback(this.introComplete);
|
||||
_loc2_ = _loc2_ + 1;
|
||||
}
|
||||
}
|
||||
function executeBackFunction(theComponent)
|
||||
{
|
||||
trace("Cafe2_BaseUIScreen::executeBackFunction" + theComponent);
|
||||
var _loc2_ = 0;
|
||||
while(_loc2_ < Cafe2_BaseUIScreen.m_thisClass.m_uiComponentArray.length)
|
||||
{
|
||||
if(theComponent == Cafe2_BaseUIScreen.m_thisClass.m_uiComponentArray[_loc2_])
|
||||
{
|
||||
break;
|
||||
}
|
||||
_loc2_ = _loc2_ + 1;
|
||||
}
|
||||
Cafe2_BaseUIScreen.m_thisClass.m_uiComponentArray.splice(_loc2_,1);
|
||||
if(Cafe2_BaseUIScreen.m_thisClass.m_uiComponentArray.length <= 0)
|
||||
{
|
||||
_global.gSM.goBackScreen();
|
||||
}
|
||||
}
|
||||
function startIntro()
|
||||
{
|
||||
trace("Cafe2_BaseUIScreen::startIntro()");
|
||||
var _loc3_ = this.m_uiComponentArray.length;
|
||||
var _loc2_ = 0;
|
||||
while(_loc2_ < _loc3_)
|
||||
{
|
||||
this.m_uiComponentArray[_loc2_].intro();
|
||||
_loc2_ = _loc2_ + 1;
|
||||
}
|
||||
}
|
||||
function startOuttro(newScreen)
|
||||
{
|
||||
trace("Cafe2_BaseUIScreen::startOuttro");
|
||||
this.m_changeToScreen = newScreen;
|
||||
var _loc3_ = Cafe2_BaseUIScreen.m_thisClass.m_uiComponentArray.length;
|
||||
if(_loc3_ > 0)
|
||||
{
|
||||
var _loc2_ = 0;
|
||||
while(_loc2_ < _loc3_)
|
||||
{
|
||||
Cafe2_BaseUIScreen.m_thisClass.m_uiComponentArray[_loc2_].outtro(this.outtroComplete);
|
||||
_loc2_ = _loc2_ + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.outtroComplete(null);
|
||||
}
|
||||
}
|
||||
function startOuttroAndCallBack(doAfterOuttroComplete)
|
||||
{
|
||||
trace("Cafe2_BaseUIScreen::startOuttro");
|
||||
this.m_executeOuttroCallBack = doAfterOuttroComplete;
|
||||
var _loc3_ = Cafe2_BaseUIScreen.m_thisClass.m_uiComponentArray.length;
|
||||
if(_loc3_ > 0)
|
||||
{
|
||||
var _loc2_ = 0;
|
||||
while(_loc2_ < _loc3_)
|
||||
{
|
||||
Cafe2_BaseUIScreen.m_thisClass.m_uiComponentArray[_loc2_].outtro(this.outtroAndCallBackComplete);
|
||||
_loc2_ = _loc2_ + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.outtroAndCallBackComplete(null);
|
||||
}
|
||||
}
|
||||
function outtroAndCallBackComplete(theComponent)
|
||||
{
|
||||
trace("Cafe2_BaseUIScreen::outtroComplete() " + theComponent);
|
||||
var _loc1_ = 0;
|
||||
while(_loc1_ < Cafe2_BaseUIScreen.m_thisClass.m_uiComponentArray.length)
|
||||
{
|
||||
if(theComponent == Cafe2_BaseUIScreen.m_thisClass.m_uiComponentArray[_loc1_])
|
||||
{
|
||||
break;
|
||||
}
|
||||
_loc1_ = _loc1_ + 1;
|
||||
}
|
||||
Cafe2_BaseUIScreen.m_thisClass.m_uiComponentArray.splice(_loc1_,1);
|
||||
if(Cafe2_BaseUIScreen.m_thisClass.m_uiComponentArray.length <= 0)
|
||||
{
|
||||
Cafe2_BaseUIScreen.m_thisClass.m_executeOuttroCallBack();
|
||||
}
|
||||
}
|
||||
function backButtonClicked()
|
||||
{
|
||||
trace("Cafe2_BaseUIScreen::backButtonClicked()");
|
||||
var _loc3_ = Cafe2_BaseUIScreen.m_thisClass.m_uiComponentArray.length;
|
||||
if(_loc3_ > 0)
|
||||
{
|
||||
var _loc2_ = 0;
|
||||
while(_loc2_ < _loc3_)
|
||||
{
|
||||
Cafe2_BaseUIScreen.m_thisClass.m_uiComponentArray[_loc2_].outtro(Cafe2_BaseUIScreen.m_thisClass.executeBackFunction);
|
||||
_loc2_ = _loc2_ + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_global.gSM.goBackScreen();
|
||||
}
|
||||
}
|
||||
function localEventHandler(keyCode, controller)
|
||||
{
|
||||
trace("Cafe2_BaseUIScreen::localEventHandler() keyCode == " + keyCode);
|
||||
_global.gFM.handleDefaultInputs(keyCode);
|
||||
}
|
||||
function clearData()
|
||||
{
|
||||
Cafe2_BaseUIScreen.m_screen = null;
|
||||
Cafe2_BaseUIScreen.m_thisClass = null;
|
||||
this.m_changeToScreen = null;
|
||||
this.m_uiComponentArray = null;
|
||||
}
|
||||
function bind0(obj, func)
|
||||
{
|
||||
return function()
|
||||
{
|
||||
func.call(obj);
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,644 @@
|
||||
class GameSetupBase extends Cafe2_BaseUIScreen implements IListboxEventListener
|
||||
{
|
||||
function GameSetupBase(screen)
|
||||
{
|
||||
super(screen);
|
||||
trace("GameSetupBase::GameSetupBase()");
|
||||
Cafe2_BaseUIScreen.m_thisClass = this;
|
||||
this.m_localMessageDispatcher = _global.bind1DynamicParams(this,this.localMessageHandler);
|
||||
this.m_mapIds = new Array();
|
||||
this.m_screenButtons = new Array();
|
||||
_global.gSM.setOnExitScreen(_global.bind0(this,this.onScreenExit));
|
||||
}
|
||||
function frameDelayedInit()
|
||||
{
|
||||
var ret = new Object();
|
||||
// Checked
|
||||
loadVariables("QueryGameEngine?IsPcGameHost",ret);
|
||||
this.m_isHost = ret.IsPcGameHost == "1";
|
||||
this.initGUI();
|
||||
_global.gMH.addMessageHandler(this.m_localMessageDispatcher);
|
||||
}
|
||||
function OnListboxIndexMouseClick(index, previouslySelectedIndex)
|
||||
{
|
||||
this.OnMapListSelectionChanged(index);
|
||||
}
|
||||
function OnListboxIndexElementMouseClick(index, element, previouslySelectedIndex)
|
||||
{
|
||||
this.OnMapListSelectionChanged(index);
|
||||
}
|
||||
function initGUI()
|
||||
{
|
||||
trace("GameSetupBase::initGUI() ");
|
||||
this.initNavigationButtons(this.m_screenButtons);
|
||||
this.initMapPanel();
|
||||
this.initRulesPanel(this.m_screenButtons);
|
||||
this.initPlayerSlots();
|
||||
}
|
||||
function initNavigationButtons(navButtons)
|
||||
{
|
||||
trace("GameSetupBase::initNavigationButtons() ");
|
||||
if(this.m_isHost)
|
||||
{
|
||||
Cafe2_BaseUIScreen.m_screen.playButton.show();
|
||||
Cafe2_BaseUIScreen.m_screen.playButton.enable();
|
||||
Cafe2_BaseUIScreen.m_screen.playButton.setOnMouseUpFunction(_global.bind0(this,this.playGame));
|
||||
navButtons.push(Cafe2_BaseUIScreen.m_screen.playButton);
|
||||
}
|
||||
Cafe2_BaseUIScreen.m_screen.backButton.show();
|
||||
Cafe2_BaseUIScreen.m_screen.backButton.enable();
|
||||
Cafe2_BaseUIScreen.m_screen.backButton.setOnMouseUpFunction(_global.bind0(this,this.backButtonClicked));
|
||||
navButtons.push(Cafe2_BaseUIScreen.m_screen.backButton);
|
||||
}
|
||||
function initMapPanel()
|
||||
{
|
||||
trace("GameSetupBase::initMapPanel() Map panel movieclip: " + Cafe2_BaseUIScreen.m_screen.gameSettings.mapPanel);
|
||||
var mapPanelComponent = Cafe2_BaseUIScreen.m_screen.gameSettings.mapPanel;
|
||||
this.m_playerStartPosMCArray = [mapPanelComponent.startPosition0,mapPanelComponent.startPosition1,mapPanelComponent.startPosition2,mapPanelComponent.startPosition3,mapPanelComponent.startPosition4,mapPanelComponent.startPosition5];
|
||||
for(var i = 0; i < this.m_playerStartPosMCArray.length; ++i)
|
||||
{
|
||||
this.m_playerStartPosMCArray[i].hide();
|
||||
this.m_playerStartPosMCArray[i].disable();
|
||||
this.m_playerStartPosMCArray[i].setOnMouseUpFunction(_global.bind1(this,this.onStartPositionClicked,i));
|
||||
}
|
||||
mapPanelComponent.campaignCheckbox.show();
|
||||
mapPanelComponent.campaignCheckbox.enable();
|
||||
mapPanelComponent.campaignCheckbox.setOnMouseDownFunction(_global.bind0(this,this.onMapTypeChanged));
|
||||
this.createMapSelectionScrollList();
|
||||
}
|
||||
function initRulesPanel(buttons)
|
||||
{
|
||||
var rulesPanelComponent = Cafe2_BaseUIScreen.m_screen.gameSettings.rulesPanel;
|
||||
trace("GameSetupBase::initRulesPanel() Rules panel movieclip: " + Cafe2_BaseUIScreen.m_screen.gameSettings.rulesPanel);
|
||||
if(extern.RA3PublicBeta == "1")
|
||||
{
|
||||
rulesPanelComponent._visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
rulesPanelComponent.gameSpeedSlider.show();
|
||||
rulesPanelComponent.resourcesDropdown.show();
|
||||
rulesPanelComponent.cratesCheckbox.show();
|
||||
rulesPanelComponent.commentaryCheckbox.show();
|
||||
rulesPanelComponent.enableVoipCheckbox.show();
|
||||
this.setBroadcastCheckboxVisibility(false);
|
||||
if(this.m_isHost)
|
||||
{
|
||||
rulesPanelComponent.gameSpeedSlider.enable();
|
||||
rulesPanelComponent.resourcesDropdown.enable();
|
||||
rulesPanelComponent.cratesCheckbox.enable();
|
||||
rulesPanelComponent.commentaryCheckbox.enable();
|
||||
rulesPanelComponent.enableVoipCheckbox.enable();
|
||||
rulesPanelComponent.gameSpeedSlider.setOnChange(_global.bind2DynamicParams(this,this.onGameSpeedChanged));
|
||||
rulesPanelComponent.resourcesDropdown.setOnChange(_global.bind1DynamicParams(this,this.onResourcesChanged));
|
||||
rulesPanelComponent.cratesCheckbox.setOnMouseDownFunction(_global.bind0(this,this.onCratesChanged));
|
||||
rulesPanelComponent.commentaryCheckbox.setOnMouseDownFunction(_global.bind0(this,this.onCommentaryChanged));
|
||||
rulesPanelComponent.enableVoipCheckbox.setOnMouseDownFunction(_global.bind0(this,this.onVoipChanged));
|
||||
var defaultRulesComponent = rulesPanelComponent.defaultRules;
|
||||
defaultRulesComponent.show();
|
||||
defaultRulesComponent.enable();
|
||||
defaultRulesComponent.setOnMouseUpFunction(_global.bind0(this,this.onResetRules));
|
||||
buttons.push(defaultRulesComponent);
|
||||
}
|
||||
else
|
||||
{
|
||||
rulesPanelComponent.gameSpeedSlider.disable();
|
||||
rulesPanelComponent.resourcesDropdown.disable();
|
||||
rulesPanelComponent.cratesCheckbox.disable();
|
||||
rulesPanelComponent.commentaryCheckbox.disable();
|
||||
rulesPanelComponent.enableVoipCheckbox.disable();
|
||||
rulesPanelComponent.defaultRules.hide();
|
||||
rulesPanelComponent.defaultRules.disable();
|
||||
}
|
||||
}
|
||||
}
|
||||
function initPlayerSlots()
|
||||
{
|
||||
trace("GameSetupBase::initPlayerSlots() ");
|
||||
this.m_playerSlots = [
|
||||
Cafe2_BaseUIScreen.m_screen.slotMC_1,
|
||||
Cafe2_BaseUIScreen.m_screen.slotMC_2,
|
||||
Cafe2_BaseUIScreen.m_screen.slotMC_3,
|
||||
Cafe2_BaseUIScreen.m_screen.slotMC_4,
|
||||
Cafe2_BaseUIScreen.m_screen.slotMC_5,
|
||||
Cafe2_BaseUIScreen.m_screen.slotMC_6
|
||||
];
|
||||
for(var i = 0; i < this.m_playerSlots.length; ++i)
|
||||
{
|
||||
this.m_playerSlots[i].slotId = i;
|
||||
this.m_playerSlots[i].playerSlotOptions.show();
|
||||
this.m_playerSlots[i].playerSlotOptions.disable();
|
||||
this.m_playerSlots[i].playerSlotOptions.setOnChange(_global.bind1DynamicParams(this,this.onPlayerStatusChanged));
|
||||
this.m_playerSlots[i].factionOptions.show();
|
||||
this.m_playerSlots[i].factionOptions.setOnChange(_global.bind1DynamicParams(this,this.onFactionChanged));
|
||||
this.m_playerSlots[i].personalityOptions.show();
|
||||
this.m_playerSlots[i].personalityOptions.setOnChange(_global.bind1DynamicParams(this,this.onAIPersonalityChanged));
|
||||
this.m_playerSlots[i].teamOptions.show();
|
||||
this.m_playerSlots[i].teamOptions.setOnChange(_global.bind1DynamicParams(this,this.onTeamChanged));
|
||||
this.m_playerSlots[i].colorOptions.show();
|
||||
this.m_playerSlots[i].colorOptions.setOnChange(_global.bind1DynamicParams(this,this.onColorChanged));
|
||||
}
|
||||
}
|
||||
function initReadyControls()
|
||||
{
|
||||
for(var i = 0; i < this.m_playerSlots.length; ++i)
|
||||
{
|
||||
var readyCheckBoxComponent = this.m_playerSlots[i].readyCheckBox;
|
||||
readyCheckBoxComponent.show();
|
||||
readyCheckBoxComponent.disable();
|
||||
readyCheckBoxComponent.setOnMouseDownFunction(_global.bind0(this,this.onReadyStatusChanged));
|
||||
}
|
||||
}
|
||||
function initPlayButton()
|
||||
{
|
||||
if(this.m_isHost)
|
||||
{
|
||||
Cafe2_BaseUIScreen.m_screen.playButton.show();
|
||||
Cafe2_BaseUIScreen.m_screen.playButton.enable();
|
||||
}
|
||||
else
|
||||
{
|
||||
Cafe2_BaseUIScreen.m_screen.playButton.hide();
|
||||
Cafe2_BaseUIScreen.m_screen.playButton.disable();
|
||||
}
|
||||
}
|
||||
function setBroadcastCheckboxVisibility(isVisible)
|
||||
{
|
||||
var rulesPanelComponent = Cafe2_BaseUIScreen.m_screen.gameSettings.rulesPanel;
|
||||
if(isVisible)
|
||||
{
|
||||
rulesPanelComponent.broadcastCheckbox.show();
|
||||
rulesPanelComponent.broadcastCheckboxLabel._visible = true;
|
||||
rulesPanelComponent.broadcastCheckboxShadowLabel._visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
rulesPanelComponent.broadcastCheckbox.hide();
|
||||
rulesPanelComponent.broadcastCheckboxLabel._visible = false;
|
||||
rulesPanelComponent.broadcastCheckboxShadowLabel._visible = false;
|
||||
}
|
||||
}
|
||||
function createMapSelectionScrollList()
|
||||
{
|
||||
var mapListScrollbarComponent = Cafe2_BaseUIScreen.m_screen.gameSettings.mapPanel.mapListScrollbar;
|
||||
mapListScrollbarComponent.show();
|
||||
mapListScrollbarComponent.enable();
|
||||
var mapListComponent = Cafe2_BaseUIScreen.m_screen.gameSettings.mapPanel.mapList;
|
||||
mapListComponent.addListener(this);
|
||||
var mouseListboxArr = new Array();
|
||||
mouseListboxArr.push({symbol:"std_mouseListboxEntryTextElementSymbol",width:270,leftMargin:0,rightMargin:0});
|
||||
mouseListboxArr.push({symbol:"std_mouseListboxEntryTextElementSymbol",width:75,leftMargin:26,rightMargin:0});
|
||||
mapListComponent.init(mouseListboxArr,26);
|
||||
mapListComponent.attachScrollbarController(mapListScrollbarComponent);
|
||||
mapListComponent.show();
|
||||
mapListComponent.enable();
|
||||
mapListComponent.moveViewToFirst();
|
||||
mapListComponent.refreshDisplay();
|
||||
mapListComponent.refreshScrollbar();
|
||||
}
|
||||
function localMessageHandler(messageCode)
|
||||
{
|
||||
var flag = false;
|
||||
if(messageCode === _global.MSGCODE.FE_MP_UPDATE_GAME_SETTINGS)
|
||||
{
|
||||
this.refreshComponents();
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
function onScreenExit()
|
||||
{
|
||||
trace("GameSetupBase::onScreenExit()");
|
||||
// Checked
|
||||
getUrl("FSCommand:CallGameFunction", "%SetGameSetupMode?Mode=None");
|
||||
_global.gMH.removeMessageHandler(this.m_localMessageDispatcher);
|
||||
delete this.m_localMessageDispatcher;
|
||||
var map = Cafe2_BaseUIScreen.m_screen.gameSettings.mapPanel.mapList;
|
||||
map.removeListener(this);
|
||||
map.shutdown();
|
||||
this.clearData();
|
||||
delete _global.GameSetupBase;
|
||||
delete _global.Cafe2_BaseUIScreen;
|
||||
}
|
||||
function playGame()
|
||||
{
|
||||
trace("GameSetupBase::playGame()");
|
||||
// Checked
|
||||
getUrl("FSCommand:CallGameFunction", "%StartGame");
|
||||
}
|
||||
function onMapTypeChanged()
|
||||
{
|
||||
trace("GameSetupBase::onMapTypeChanged() " + Cafe2_BaseUIScreen.m_screen);
|
||||
var isCheckedCampaign = !Cafe2_BaseUIScreen.m_screen.gameSettings.mapPanel.campaignCheckbox.isChecked() ? "0" : "1";
|
||||
// Checked
|
||||
getURL("FSCommand:CallGameFunction","%SetMapType?MapType=" + isCheckedCampaign);
|
||||
if(isCheckedCampaign)
|
||||
{
|
||||
_global.GAME.MODE = _global.ENUM.GAME_MODE_CAMPAIGN;
|
||||
trace("GameSetupBase::onMapTypeChanged()- Game mode set to GAME_MODE_CAMPAIGN.");
|
||||
}
|
||||
else
|
||||
{
|
||||
_global.GAME.MODE = _global.ENUM.GAME_MODE_SKIRMISH;
|
||||
trace("GameSetupBase::onMapTypeChanged()- Game mode set to GAME_MODE_SKIRMISH.");
|
||||
}
|
||||
}
|
||||
function OnMapListSelectionChanged(index)
|
||||
{
|
||||
trace("GameSetupBase::OnMapListSelectionChanged(), index is " + index);
|
||||
// Checked
|
||||
getUrl("FSCommand:CallGameFunction","%SetMap\?Map=" + this.m_mapIds[index]);
|
||||
}
|
||||
function onShowMapPanel()
|
||||
{
|
||||
trace("GameSetupBase::onShowMapPanel()");
|
||||
Cafe2_BaseUIScreen.m_screen.gameSettings.mapPanel._visible = true;
|
||||
Cafe2_BaseUIScreen.m_screen.gameSettings.rulesPanel._visible = false;
|
||||
}
|
||||
function onShowRulesPanel()
|
||||
{
|
||||
trace("GameSetupBase::onShowRulesPanel()");
|
||||
Cafe2_BaseUIScreen.m_screen.gameSettings.mapPanel._visible = false;
|
||||
Cafe2_BaseUIScreen.m_screen.gameSettings.rulesPanel._visible = true;
|
||||
}
|
||||
function onPlayerStatusChanged(playerStatusMC)
|
||||
{
|
||||
var status = String(playerStatusMC.getValueAtIndex(playerStatusMC.getCurrentIndex()));
|
||||
var slotId = String(playerStatusMC._parent.slotId);
|
||||
// Checked
|
||||
getURL("FSCommand:CallGameFunction","%SetPlayerStatus?Slot=" + slotId + "|Status=" + status);
|
||||
}
|
||||
function onFactionChanged(factionsMC)
|
||||
{
|
||||
var index = String(factionsMC.getValueAtIndex(factionsMC.getCurrentIndex()));
|
||||
var slot = String(factionsMC._parent.slotId);
|
||||
// Checked
|
||||
getURL("FSCommand:CallGameFunction","%SetPlayerTemplate?Slot=" + slot + "|Template=" + index);
|
||||
}
|
||||
function onTeamChanged(teamsMC)
|
||||
{
|
||||
var index = String(teamsMC.getValueAtIndex(teamsMC.getCurrentIndex()));
|
||||
var slotId = String(teamsMC._parent.slotId);
|
||||
// Checked
|
||||
getURL("FSCommand:CallGameFunction","%SetTeam?Slot=" + slotId + "|Team=" + index);
|
||||
}
|
||||
function onColorChanged(colorsMC)
|
||||
{
|
||||
var color = String(colorsMC.getValueAtIndex(colorsMC.getCurrentIndex()));
|
||||
var slotId = String(colorsMC._parent.slotId);
|
||||
// Checked
|
||||
getURL("FSCommand:CallGameFunction","%SetColor?Slot=" + slotId + "|Color=" + color);
|
||||
}
|
||||
function onAIPersonalityChanged(personalitiesMC)
|
||||
{
|
||||
var index = String(personalitiesMC.getValueAtIndex(personalitiesMC.getCurrentIndex()));
|
||||
var slotId = String(personalitiesMC._parent.slotId);
|
||||
// Checked
|
||||
getURL("FSCommand:CallGameFunction","%SetAIPersonality?Slot=" + slotId + "|Personality=" + index);
|
||||
}
|
||||
function onReadyStatusChanged()
|
||||
{
|
||||
trace("GameSetupBase::onReadyStatusChanged()");
|
||||
// Checked
|
||||
getUrl("FSCommand:CallGameFunction", "%ToggleReadyStatus");
|
||||
}
|
||||
function onStartPositionClicked(startPosition)
|
||||
{
|
||||
trace("GameSetupBase::onStartPositionClicked() Position: " + startPosition);
|
||||
// Checked
|
||||
getURL("FSCommand:CallGameFunction","%CycleStartPositionOwner?Position=" + startPosition);
|
||||
}
|
||||
function onGameSpeedChanged(component, newSpeed)
|
||||
{
|
||||
trace("GameSetupBase::onGameSpeedChanged()");
|
||||
// Checked
|
||||
getURL("FSCommand:CallGameFunction","%SetGameSpeed?GameSpeed=" + String(newSpeed));
|
||||
}
|
||||
function onResourcesChanged(resourcesMC)
|
||||
{
|
||||
trace("GameSetupBase::onResourcesChanged()");
|
||||
var index = String(resourcesMC.getValueAtIndex(resourcesMC.getCurrentIndex()));
|
||||
// Checked
|
||||
getURL("FSCommand:CallGameFunction","%SetInitialResources?Resources=" + index);
|
||||
}
|
||||
function onVoipChanged()
|
||||
{
|
||||
trace("GameSetupBase::onVoipChanged()");
|
||||
// Checked
|
||||
getUrl("FSCommand:CallGameFunction", "%ToggleVoipRule");
|
||||
}
|
||||
function onCratesChanged()
|
||||
{
|
||||
trace("GameSetupBase::onCratesChanged()");
|
||||
// Checked
|
||||
getUrl("FSCommand:CallGameFunction", "%ToggleRandomCrates");
|
||||
}
|
||||
function onCommentaryChanged()
|
||||
{
|
||||
trace("GameSetupBase::onCommentaryChanged()");
|
||||
// Checked
|
||||
getUrl("FSCommand:CallGameFunction", "%ToggleCommentary");
|
||||
}
|
||||
function onResetRules()
|
||||
{
|
||||
trace("GameSetupBase::onResetRules()");
|
||||
// Checked
|
||||
getUrl("FSCommand:CallGameFunction", "%ResetRules");
|
||||
}
|
||||
function refreshComponents()
|
||||
{
|
||||
trace("GameSetupBase::refreshComponents()");
|
||||
this.refreshMapList();
|
||||
this.refreshSlotStatusControls();
|
||||
this.refreshCampaignMapControls();
|
||||
this.refreshResourcesControl();
|
||||
this.refreshRulesCheckbox("RANDOM_CRATES",Cafe2_BaseUIScreen.m_screen.gameSettings.rulesPanel.cratesCheckbox);
|
||||
this.refreshRulesCheckbox("ENABLE_VOIP",Cafe2_BaseUIScreen.m_screen.gameSettings.rulesPanel.enableVoipCheckbox);
|
||||
this.refreshRulesCheckbox("ALLOW_COMMENTARY",Cafe2_BaseUIScreen.m_screen.gameSettings.rulesPanel.commentaryCheckbox);
|
||||
this.refreshGameSpeedControls();
|
||||
this.refreshTeamControls();
|
||||
this.refreshFactionControls();
|
||||
this.refreshAIPersonalityControls();
|
||||
this.refreshStartPositionControls();
|
||||
this.refreshColorControls();
|
||||
}
|
||||
function refreshMapList()
|
||||
{
|
||||
trace("GameSetupBase::refreshMapList()");
|
||||
var mapListComponent = Cafe2_BaseUIScreen.m_screen.gameSettings.mapPanel.mapList;
|
||||
var ret = new Object();
|
||||
var mapList = new Array();
|
||||
var mapSizeList = new Array();
|
||||
// Checked
|
||||
loadVariables("QueryGameEngine?MP_MAP_LIST",ret);
|
||||
this.m_mapIds = ret.MP_MAP_LIST.split(",");
|
||||
var selectedIndex = Number(ret.MP_MAP_LIST_SELECTED_INDEX);
|
||||
if(this.m_isHost)
|
||||
{
|
||||
for(var i = 0; i < this.m_mapIds.length; ++i)
|
||||
{
|
||||
mapList[i] = "$MP_MAP_LIST_" + String(i);
|
||||
mapSizeList[i] = "$MP_MAP_SIZE_" + String(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mapList[0] = "$MP_MAP_LIST_0";
|
||||
mapSizeList[0] = "$MP_MAP_SIZE_0";
|
||||
}
|
||||
mapListComponent.setColumnData(0,mapList);
|
||||
mapListComponent.setColumnData(1,mapSizeList);
|
||||
mapListComponent.setSelectedIndex(selectedIndex);
|
||||
mapListComponent.refreshDisplay();
|
||||
mapListComponent.refreshScrollbar();
|
||||
}
|
||||
function refreshSlotStatusControls()
|
||||
{
|
||||
trace("GameSetupBase::refreshSlotStatusControls()");
|
||||
for(var i = 0; i < this.m_playerSlots.length; ++i)
|
||||
{
|
||||
var ret = new Object();
|
||||
var playerStatsSubList = new Array();
|
||||
var playerStatusList = new Array();
|
||||
var playerStatusFirst = 0;
|
||||
// Checked
|
||||
loadVariables("QueryGameEngine?PLAYER_STATUS?Slot=" + String(i),ret);
|
||||
playerStatusList = ret.PLAYER_STATUS.split(",");
|
||||
playerStatusFirst = Number(playerStatusList.shift());
|
||||
for(var i = 0; i < playerStatusList.length; ++i)
|
||||
{
|
||||
playerStatsSubList[i] = "$PLAYER_STATUS_" + String(i) + "_" + String(i);
|
||||
}
|
||||
this.enableControl(playerStatusList.length > 1,this.m_playerSlots[i].playerSlotOptions);
|
||||
this.m_playerSlots[i].playerSlotOptions.setData(playerStatsSubList,playerStatusList);
|
||||
this.m_playerSlots[i].playerSlotOptions.setSelectedIndex(playerStatusFirst);
|
||||
}
|
||||
}
|
||||
function refreshTeamControls()
|
||||
{
|
||||
trace("GameSetupBase::refreshTeamControls()");
|
||||
for(var i = 0; i < this.m_playerSlots.length; ++i)
|
||||
{
|
||||
var ret = new Object();
|
||||
var teamOptionsValuesSubList = new Array();
|
||||
var teamOptionValues = new Array();
|
||||
var teamOptionsFirst = 0;
|
||||
// Checked
|
||||
loadVariables("QueryGameEngine?TEAM_OPTIONS?Slot=" + String(i),ret);
|
||||
teamOptionValues = ret.TEAM_OPTIONS_VALUES.split(",");
|
||||
teamOptionsFirst = Number(teamOptionValues.shift());
|
||||
for(var i = 0; i < teamOptionValues.length; ++i)
|
||||
{
|
||||
teamOptionsValuesSubList[i] = "$TEAM_" + String(teamOptionValues[i]);
|
||||
}
|
||||
this.enableControl(ret.TEAM_OPTIONS_ENABLE == "1" && teamOptionValues.length > 1,this.m_playerSlots[i].teamOptions);
|
||||
this.m_playerSlots[i].teamOptions.setData(teamOptionsValuesSubList,teamOptionValues);
|
||||
this.m_playerSlots[i].teamOptions.setSelectedIndex(teamOptionsFirst);
|
||||
}
|
||||
}
|
||||
function refreshFactionControls()
|
||||
{
|
||||
trace("GameSetupBase::refreshFactionControls()");
|
||||
for(var i = 0; i < this.m_playerSlots.length; ++i)
|
||||
{
|
||||
var ret = new Object();
|
||||
// Checked
|
||||
loadVariables("QueryGameEngine?PLAYER_TEMPLATE_OPTIONS?Slot=" + String(i),ret);
|
||||
var playerTemplateOptionValues = new Array();
|
||||
playerTemplateOptionValues = ret.PLAYER_TEMPLATE_OPTIONS_VALUES.split(",");
|
||||
var playerTemplateOptionsValuesSubList = Number(playerTemplateOptionValues.shift());
|
||||
var playerTemplateOptionsImagesList = new Array();
|
||||
playerTemplateOptionsImagesList = ret.PLAYER_TEMPLATE_OPTIONS_IMAGES.split(",");
|
||||
this.enableControl(playerTemplateOptionValues.length > 1,this.m_playerSlots[i].factionOptions);
|
||||
this.m_playerSlots[i].factionOptions.setData(playerTemplateOptionsImagesList,playerTemplateOptionValues);
|
||||
this.m_playerSlots[i].factionOptions.setSelectedIndex(playerTemplateOptionsValuesSubList);
|
||||
}
|
||||
}
|
||||
function refreshAIPersonalityControls()
|
||||
{
|
||||
trace("GameSetupBase::refreshAIPersonalityControls() : m_playerSlots.length = " + this.m_playerSlots.length);
|
||||
for(var i = 0; i < this.m_playerSlots.length; ++i)
|
||||
{
|
||||
var ret = new Object();
|
||||
// Checked
|
||||
loadVariables("QueryGameEngine?AI_PERSONALITY_OPTIONS?Slot=" + String(i),ret);
|
||||
if(ret.AI_PERSONALITY_OPTIONS == undefined)
|
||||
{
|
||||
this.m_playerSlots[i].personalityOptions.clear();
|
||||
this.m_playerSlots[i].personalityOptions.disable();
|
||||
}
|
||||
else
|
||||
{
|
||||
var aiPersonalityOptionsList = new Array();
|
||||
aiPersonalityOptionsList = ret.AI_PERSONALITY_OPTIONS.split(",");
|
||||
var aiPersonalityOptionsFirst = Number(aiPersonalityOptionsList.shift());
|
||||
var aiPersonalityOptionsSubList = new Array();
|
||||
for(var i = 0; i < aiPersonalityOptionsList.length; ++i)
|
||||
{
|
||||
aiPersonalityOptionsSubList[i] = "$APT:AI_PERSONALITY_" + String(i) + "_" + String(aiPersonalityOptionsList[i]);
|
||||
}
|
||||
this.enableControl(aiPersonalityOptionsList.length > 1,this.m_playerSlots[i].personalityOptions);
|
||||
this.m_playerSlots[i].personalityOptions.setData(aiPersonalityOptionsSubList,aiPersonalityOptionsList);
|
||||
this.m_playerSlots[i].personalityOptions.setSelectedIndex(aiPersonalityOptionsFirst);
|
||||
}
|
||||
}
|
||||
}
|
||||
function refreshColorControls()
|
||||
{
|
||||
trace("GameSetupBase::refreshColorControls()");
|
||||
for(var i = 0; i < this.m_playerSlots.length; ++i)
|
||||
{
|
||||
var ret = new Object();
|
||||
// Checked
|
||||
loadVariables("QueryGameEngine?PLAYER_COLOR?Slot=" + i,ret);
|
||||
var playerColorValuesList = new Array();
|
||||
playerColorValuesList = ret.PLAYER_COLOR_VALUES.split(",");
|
||||
var playerColorValuesFirst = Number(playerColorValuesList.shift());
|
||||
var colorOptionsComponent = this.m_playerSlots[i].colorOptions;
|
||||
colorOptionsComponent.setData(playerColorValuesList,playerColorValuesList);
|
||||
colorOptionsComponent.setSelectedIndex(playerColorValuesFirst);
|
||||
if(ret.PLAYER_COLOR_ENABLE == "1")
|
||||
{
|
||||
colorOptionsComponent.enable();
|
||||
}
|
||||
else
|
||||
{
|
||||
colorOptionsComponent.disable();
|
||||
}
|
||||
}
|
||||
}
|
||||
function refreshStartPositionControls()
|
||||
{
|
||||
trace("GameSetupBase::refreshStartPositionControls()");
|
||||
var mapPreviewComponent = Cafe2_BaseUIScreen.m_screen.gameSettings.mapPanel.mapPreview;
|
||||
for(var i = 0; i < this.m_playerStartPosMCArray.length; ++i)
|
||||
{
|
||||
var ret = new Object();
|
||||
// Checked
|
||||
loadVariables("QueryGameEngine?START_POSITION?Position=" + String(i),ret);
|
||||
var isStartPositionValid = Boolean(ret.START_POSITION_VALID);
|
||||
this.m_playerStartPosMCArray[i].setText("$START_POSITION_" + String(i));
|
||||
if(isStartPositionValid)
|
||||
{
|
||||
var posX = Number(ret.START_POSITION_X);
|
||||
var posY = Number(ret.START_POSITION_Y);
|
||||
this.m_playerStartPosMCArray[i].show();
|
||||
this.m_playerStartPosMCArray[i].enable();
|
||||
this.m_playerStartPosMCArray[i]._x = posX * mapPreviewComponent._width + mapPreviewComponent._x;
|
||||
this.m_playerStartPosMCArray[i]._y = posY * mapPreviewComponent._height + mapPreviewComponent._y;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.m_playerStartPosMCArray[i].disable();
|
||||
this.m_playerStartPosMCArray[i].hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
function refreshCampaignMapControls()
|
||||
{
|
||||
trace("GameSetupBase::refreshCampaignMapControls()");
|
||||
var ret = new Object();
|
||||
// Checked
|
||||
loadVariables("QueryGameEngine?PLAY_AS_CAMPAIGN",ret);
|
||||
if(ret.PLAY_AS_CAMPAIGN_VALUE == "0")
|
||||
{
|
||||
Cafe2_BaseUIScreen.m_screen.gameSettings.mapPanel.campaignCheckbox.unCheck();
|
||||
}
|
||||
else
|
||||
{
|
||||
Cafe2_BaseUIScreen.m_screen.gameSettings.mapPanel.campaignCheckbox.check();
|
||||
}
|
||||
if(ret.PLAY_AS_CAMPAIGN_ENABLE == "0" || !this.m_isHost)
|
||||
{
|
||||
Cafe2_BaseUIScreen.m_screen.gameSettings.mapPanel.campaignCheckbox.disable();
|
||||
}
|
||||
else
|
||||
{
|
||||
Cafe2_BaseUIScreen.m_screen.gameSettings.mapPanel.campaignCheckbox.enable();
|
||||
}
|
||||
}
|
||||
function refreshResourcesControl()
|
||||
{
|
||||
trace("GameSetupBase::refreshResourcesControl()");
|
||||
var ret = new Object();
|
||||
// Checked
|
||||
loadVariables("QueryGameEngine?RESOURCES_OPTIONS",ret);
|
||||
var optionValues = new Array();
|
||||
optionValues = ret.RESOURCES_OPTIONS_VALUES.split(",");
|
||||
var optionValuesFirst = Number(optionValues.shift());
|
||||
var resourceOptionValues = new Array();
|
||||
resourceOptionValues = ret.RESOURCES_OPTIONS_STRINGS.split(",");
|
||||
var resourcesDropdownComponent = Cafe2_BaseUIScreen.m_screen.gameSettings.rulesPanel.resourcesDropdown;
|
||||
resourcesDropdownComponent.setData(resourceOptionValues,optionValues);
|
||||
resourcesDropdownComponent.setSelectedIndex(optionValuesFirst);
|
||||
}
|
||||
function refreshRulesCheckbox(ruleStr, checkbox)
|
||||
{
|
||||
trace("GameSetupBase::refreshRulesCheckbox() " + ruleStr + ":" + checkbox);
|
||||
var ret = new Object();
|
||||
// Checked
|
||||
loadVariables("QueryGameEngine?" + ruleStr,ret);
|
||||
trace(" " + ret[ruleStr + "_VALUE"]);
|
||||
if(ret[ruleStr + "_VALUE"] == "0")
|
||||
{
|
||||
checkbox.unCheck();
|
||||
}
|
||||
else
|
||||
{
|
||||
checkbox.check();
|
||||
}
|
||||
trace(" " + ret[ruleStr + "_ENABLE"]);
|
||||
if(ret[ruleStr + "_ENABLE"] == "0")
|
||||
{
|
||||
checkbox.disable();
|
||||
}
|
||||
else
|
||||
{
|
||||
checkbox.enable();
|
||||
}
|
||||
}
|
||||
function refreshGameSpeedControls()
|
||||
{
|
||||
trace("GameSetupBase::refreshGameSpeedControls()");
|
||||
var gameSpeedSliderComponent = Cafe2_BaseUIScreen.m_screen.gameSettings.rulesPanel.gameSpeedSlider;
|
||||
var ret = new Object();
|
||||
// Checked
|
||||
loadVariables("QueryGameEngine?GAMESPEED_OPTIONS",ret);
|
||||
gameSpeedSliderComponent.setIndexRange(Number(ret.GAMESPEED_OPTIONS_MIN),Number(ret.GAMESPEED_OPTIONS_MAX),Number(ret.GAMESPEED_OPTIONS_CURRENT));
|
||||
if(ret.GAMESPEED_OPTIONS_ENABLE == "0" || !this.m_isHost)
|
||||
{
|
||||
gameSpeedSliderComponent.disable();
|
||||
}
|
||||
else
|
||||
{
|
||||
gameSpeedSliderComponent.enable();
|
||||
}
|
||||
}
|
||||
function refreshReadyControls()
|
||||
{
|
||||
for(var i = 0; i < this.m_playerSlots.length; ++i)
|
||||
{
|
||||
var readyCheckboxComponent = this.m_playerSlots[i].readyCheckBox;
|
||||
this.refreshReadyCheckbox(readyCheckboxComponent,i);
|
||||
}
|
||||
}
|
||||
function refreshReadyCheckbox(checkbox, slotId)
|
||||
{
|
||||
var ret = new Object();
|
||||
// Checked
|
||||
loadVariables("QueryGameEngine?READY_STATUS?Slot=" + String(slotId),ret);
|
||||
ret.READY_STATUS_ENABLED != "1" ? checkbox.disable() : checkbox.enable();
|
||||
ret.READY_STATUS_VALUE != "1" ? checkbox.SetUnCheck() : checkbox.SetCheck();
|
||||
}
|
||||
function enableControl(enable, control)
|
||||
{
|
||||
if(enable)
|
||||
{
|
||||
control.enable();
|
||||
}
|
||||
else
|
||||
{
|
||||
control.disable();
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
interface IListboxEventListener
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,289 @@
|
||||
class fem_m_gameSetup extends GameSetupBase
|
||||
{
|
||||
function fem_m_gameSetup(screen)
|
||||
{
|
||||
super(screen);
|
||||
}
|
||||
function frameDelayedInit()
|
||||
{
|
||||
// Checked
|
||||
getUrl("FSCommand:CallGameFunction", "%SetGameSetupMode?Mode=Online");
|
||||
var ret = new Object();
|
||||
// Checked
|
||||
loadVariables("QueryGameEngine?IS_CLAN_GAME",ret);
|
||||
this.m_isClanGame = ret.IS_CLAN_GAME == "1";
|
||||
if(this.m_isClanGame)
|
||||
{
|
||||
Cafe2_BaseUIScreen.m_screen.playerSlotBg.personality.text = "$HeaderClanName";
|
||||
}
|
||||
super.frameDelayedInit();
|
||||
this.initVoiceIPControls();
|
||||
this.initBroadcastOption();
|
||||
this.initReadyControls();
|
||||
this.initPlayButton();
|
||||
if(this.m_isClanGame)
|
||||
{
|
||||
var rulesPanelComponent = Cafe2_BaseUIScreen.m_screen.gameSettings.rulesPanel;
|
||||
rulesPanelComponent.gameSpeedSlider.disable();
|
||||
rulesPanelComponent.resourcesDropdown.disable();
|
||||
rulesPanelComponent.cratesCheckbox.disable();
|
||||
rulesPanelComponent.defaultRules.disable();
|
||||
}
|
||||
if(this.m_isHost)
|
||||
{
|
||||
Cafe2_BaseUIScreen.m_screen.randomMap.show();
|
||||
Cafe2_BaseUIScreen.m_screen.randomMap.enable();
|
||||
Cafe2_BaseUIScreen.m_screen.randomMap.setOnMouseUpFunction(_global.bind0(this,this.onRandomMap));
|
||||
this.m_screenButtons.push(Cafe2_BaseUIScreen.m_screen.randomMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
Cafe2_BaseUIScreen.m_screen.randomMap.hide();
|
||||
}
|
||||
this.refreshComponents();
|
||||
this.registerIntroOuttroComponents(this.m_screenButtons);
|
||||
this.startIntro();
|
||||
}
|
||||
function initNavigationButtons(navButtons)
|
||||
{
|
||||
trace("fem_m_gameSetup::initNavigationButtons() ");
|
||||
super.initNavigationButtons(navButtons);
|
||||
Cafe2_BaseUIScreen.m_screen.gameSettings.mapTabButton.enable();
|
||||
Cafe2_BaseUIScreen.m_screen.gameSettings.mapTabButton.show();
|
||||
Cafe2_BaseUIScreen.m_screen.gameSettings.mapTabButton.setOnMouseUpFunction(_global.bind0(this,this.onShowMapPanel));
|
||||
navButtons.push(Cafe2_BaseUIScreen.m_screen.gameSettings.mapTabButton);
|
||||
if(extern.RA3PublicBeta == "1")
|
||||
{
|
||||
Cafe2_BaseUIScreen.m_screen.gameSettings.rulesTabButton.disable();
|
||||
Cafe2_BaseUIScreen.m_screen.gameSettings.rulesTabButton.hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
Cafe2_BaseUIScreen.m_screen.gameSettings.rulesTabButton.enable();
|
||||
Cafe2_BaseUIScreen.m_screen.gameSettings.rulesTabButton.show();
|
||||
Cafe2_BaseUIScreen.m_screen.gameSettings.rulesTabButton.setOnMouseUpFunction(_global.bind0(this,this.onShowRulesPanel));
|
||||
}
|
||||
navButtons.push(Cafe2_BaseUIScreen.m_screen.gameSettings.rulesTabButton);
|
||||
}
|
||||
function onScreenExit()
|
||||
{
|
||||
trace("fem_m_gameSetup::onScreenExit()");
|
||||
super.onScreenExit();
|
||||
delete _global.fem_m_gameSetup;
|
||||
}
|
||||
function localMessageHandler(messageCode)
|
||||
{
|
||||
var flag = false;
|
||||
switch(messageCode)
|
||||
{
|
||||
case _global.MSGCODE.FE_MP_ONLINE_GAME_COUNTDOWN_START:
|
||||
if(!this.m_isHost)
|
||||
{
|
||||
this.ConfigureClientForCountdown(true);
|
||||
}
|
||||
break;
|
||||
case _global.MSGCODE.FE_MP_ONLINE_GAME_COUNTDOWN_STOP:
|
||||
this.enableGameSetupUI();
|
||||
break;
|
||||
case _global.MSGCODE.FE_MP_COUNTDOWN_PAST_POINT_OF_NO_RETURN:
|
||||
this.disableGameSetupUI();
|
||||
break;
|
||||
default:
|
||||
flag = super.localMessageHandler(messageCode);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
function disableGameSetupUI()
|
||||
{
|
||||
var rulesPanelComponent = Cafe2_BaseUIScreen.m_screen.gameSettings.rulesPanel;
|
||||
rulesPanelComponent.gameSpeedSlider.disable();
|
||||
rulesPanelComponent.resourcesDropdown.disable();
|
||||
rulesPanelComponent.cratesCheckbox.disable();
|
||||
rulesPanelComponent.defaultRules.disable();
|
||||
rulesPanelComponent.commentaryCheckbox.disable();
|
||||
rulesPanelComponent.enableVoipCheckbox.disable();
|
||||
rulesPanelComponent.broadcastCheckbox.disable();
|
||||
Cafe2_BaseUIScreen.m_screen.randomMap.disable();
|
||||
Cafe2_BaseUIScreen.m_screen.gameSettings.mapPanel.mapList.disable();
|
||||
for(var i = 0; i < this.m_playerSlots.length; ++i)
|
||||
{
|
||||
var playerSlotsComponent = this.m_playerSlots[i];
|
||||
playerSlotsComponent.playerSlotOptions.disable();
|
||||
playerSlotsComponent.personalityOptions.disable();
|
||||
playerSlotsComponent.factionOptions.disable();
|
||||
playerSlotsComponent.teamOptions.disable();
|
||||
playerSlotsComponent.colorOptions.disable();
|
||||
}
|
||||
for(var i = 0; i < this.m_playerStartPosMCArray.length; ++i)
|
||||
{
|
||||
this.m_playerStartPosMCArray[i].disable();
|
||||
}
|
||||
Cafe2_BaseUIScreen.m_screen.playButton.disable();
|
||||
}
|
||||
function enableGameSetupUI()
|
||||
{
|
||||
if(this.m_isHost)
|
||||
{
|
||||
if(!this.m_isClanGame)
|
||||
{
|
||||
var rulesPanelComponent = Cafe2_BaseUIScreen.m_screen.gameSettings.rulesPanel;
|
||||
rulesPanelComponent.gameSpeedSlider.enable();
|
||||
rulesPanelComponent.resourcesDropdown.enable();
|
||||
rulesPanelComponent.cratesCheckbox.enable();
|
||||
rulesPanelComponent.defaultRules.enable();
|
||||
rulesPanelComponent.commentaryCheckbox.enable();
|
||||
rulesPanelComponent.enableVoipCheckbox.enable();
|
||||
rulesPanelComponent.broadcastCheckbox.enable();
|
||||
}
|
||||
Cafe2_BaseUIScreen.m_screen.randomMap.enable();
|
||||
Cafe2_BaseUIScreen.m_screen.gameSettings.mapPanel.mapList.enable();
|
||||
for(var i = 0; i < this.m_playerStartPosMCArray.length; ++i)
|
||||
{
|
||||
this.m_playerStartPosMCArray[i].enable();
|
||||
}
|
||||
this.m_playerSlots[0].factionOptions.enable();
|
||||
this.m_playerSlots[0].teamOptions.enable();
|
||||
this.m_playerSlots[0].colorOptions.enable();
|
||||
for(var i = 0; i < this.m_playerSlots.length; ++i)
|
||||
{
|
||||
var playerSlotsComponent = this.m_playerSlots[i];
|
||||
playerSlotsComponent.playerSlotOptions.enable();
|
||||
}
|
||||
Cafe2_BaseUIScreen.m_screen.playButton.enable();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ConfigureClientForCountdown(false);
|
||||
}
|
||||
}
|
||||
function initVoiceIPControls()
|
||||
{
|
||||
for(var i = 0; i < this.m_playerSlots.length; ++i)
|
||||
{
|
||||
var voipCheckBoxComponent = this.m_playerSlots[i].voipCheckBox;
|
||||
voipCheckBoxComponent.disable();
|
||||
voipCheckBoxComponent.setOnMouseDownFunction(_global.bind1(this,this.onVoipSendToStatusChanged,i));
|
||||
}
|
||||
for(var i = 0; i < this.m_playerSlots.length; ++i)
|
||||
{
|
||||
var muteCheckBoxComponent = this.m_playerSlots[i].muteCheckBox;
|
||||
muteCheckBoxComponent.disable();
|
||||
muteCheckBoxComponent.setOnMouseDownFunction(_global.bind1(this,onVoipMuteStatusChanged,i));
|
||||
}
|
||||
}
|
||||
function initBroadcastOption()
|
||||
{
|
||||
var broadcastCheckboxComponent = Cafe2_BaseUIScreen.m_screen.gameSettings.rulesPanel.broadcastCheckbox;
|
||||
this.setBroadcastCheckboxVisibility(true);
|
||||
broadcastCheckboxComponent.setOnMouseDownFunction(_global.bind0(this,this.onToggleBroadcastStatus));
|
||||
var ret = new Object();
|
||||
// Checked
|
||||
loadVariables("QueryGameEngine?GAME_BROADCASTER",ret);
|
||||
ret.GAME_BROADCASTER_ENABLE != "1" ? broadcastCheckboxComponent.disable() : broadcastCheckboxComponent.enable();
|
||||
ret.GAME_BROADCASTER_VALUE != "1" ? broadcastCheckboxComponent.unCheck() : broadcastCheckboxComponent.check();
|
||||
var ret = new Object();
|
||||
// Checked
|
||||
loadVariables("QueryGameEngine?DISABLE_BROADCAST_ON_MOD",ret);
|
||||
if(ret.DISABLE_BROADCAST_ON_MOD == 1)
|
||||
{
|
||||
this.setBroadcastCheckboxVisibility(false);
|
||||
}
|
||||
}
|
||||
function onVoipSendToStatusChanged(slotId)
|
||||
{
|
||||
// Checked
|
||||
getURL("FSCommand:CallGameFunction","%ChangePlayerSendStatus?Slot=" + String(slotId));
|
||||
}
|
||||
function onToggleBroadcastStatus()
|
||||
{
|
||||
// Checked
|
||||
getUrl("FSCommand:CallGameFunction", "%ToggleBroadcastGame");
|
||||
}
|
||||
function refreshComponents()
|
||||
{
|
||||
super.refreshComponents();
|
||||
this.refreshReadyControls();
|
||||
this.refreshVoiceIPControls();
|
||||
ConfigForCountdown();
|
||||
}
|
||||
function refreshAIPersonalityControls()
|
||||
{
|
||||
if(!this.m_isClanGame)
|
||||
{
|
||||
super.refreshAIPersonalityControls();
|
||||
return undefined;
|
||||
}
|
||||
for(var i = 0; i < this.m_playerSlots.length; ++i)
|
||||
{
|
||||
var ret = new Object();
|
||||
// Checked
|
||||
loadVariables("QueryGameEngine?GET_CLAN_NAME?Slot=" + String(i),ret);
|
||||
if(ret.GET_CLAN_NAME == undefined)
|
||||
{
|
||||
this.m_playerSlots[i].personalityOptions.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
var arr = new Array();
|
||||
arr.push(0);
|
||||
var clanGameFlags = new Array();
|
||||
clanGameFlags.push(ret.GET_CLAN_NAME);
|
||||
this.m_playerSlots[i].personalityOptions.setData(clanGameFlags,arr);
|
||||
this.m_playerSlots[i].personalityOptions.setSelectedIndex(0);
|
||||
}
|
||||
this.m_playerSlots[i].personalityOptions.disable();
|
||||
}
|
||||
}
|
||||
function refreshVoiceIPControls()
|
||||
{
|
||||
trace("fem_m_gameSetup::refreshVoipSendToCheckBox()");
|
||||
var size = this.m_playerSlots.length;
|
||||
for(var i = 0; i < size; ++i)
|
||||
{
|
||||
this.refreshVoipSendToCheckBox(this.m_playerSlots[i].voipCheckBox,i);
|
||||
this.refreshVoipMuteCheckBox(this.m_playerSlots[i].muteCheckBox,i);
|
||||
}
|
||||
}
|
||||
function refreshVoipSendToCheckBox(checkBox, slotId)
|
||||
{
|
||||
var ret = new Object();
|
||||
// Checked
|
||||
loadVariables("QueryGameEngine?VOIP_SEND_TO?Slot=" + String(slotId),ret);
|
||||
ret.VOIP_SEND_TO_ENABLED != "1" ? checkBox.disable() : checkBox.enable();
|
||||
ret.VOIP_SEND_TO_VALUE != "1" ? checkBox.unCheck() : checkBox.check();
|
||||
}
|
||||
function refreshVoipMuteCheckBox(checkBox, slotId)
|
||||
{
|
||||
var ret = new Object();
|
||||
// Checked
|
||||
loadVariables("QueryGameEngine?VOIP_MUTE?Slot=" + String(slotId),ret);
|
||||
ret.VOIP_MUTE_ENABLED != "1" ? checkBox.disable() : checkBox.enable();
|
||||
ret.VOIP_MUTE_VALUE != "1" ? checkBox.unCheck() : checkBox.check();
|
||||
}
|
||||
function ConfigureClientForCountdown(inCountdown)
|
||||
{
|
||||
var ret = new Object();
|
||||
// Checked
|
||||
loadVariables("QueryGameEngine?LOCAL_PLAYER_SLOT",ret);
|
||||
var localPlayerSlotsComponent = this.m_playerSlots[Number(ret.LOCAL_PLAYER_SLOT)];
|
||||
if(inCountdown)
|
||||
{
|
||||
localPlayerSlotsComponent.factionOptions.disable();
|
||||
localPlayerSlotsComponent.teamOptions.disable();
|
||||
localPlayerSlotsComponent.colorOptions.disable();
|
||||
}
|
||||
else
|
||||
{
|
||||
localPlayerSlotsComponent.factionOptions.enable();
|
||||
localPlayerSlotsComponent.teamOptions.enable();
|
||||
localPlayerSlotsComponent.colorOptions.enable();
|
||||
}
|
||||
}
|
||||
function onRandomMap()
|
||||
{
|
||||
// Checked
|
||||
getUrl("FSCommand:CallGameFunction", "%SetRandomMap");
|
||||
this.refreshStartPositionControls();
|
||||
this.refreshMapList();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
var screen = new fem_m_gameSetup(this);
|
||||
stop();
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
on(construct){
|
||||
m_numLines = 0;
|
||||
m_width = 399;
|
||||
m_chatMode = 1;
|
||||
m_preservePlacement = false;
|
||||
m_height = 259;
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
on(construct){
|
||||
m_title = "$MULTIPLAYER_LOBBY_SCREEN_TITLE";
|
||||
m_DropShadow = true;
|
||||
m_Outline = true;
|
||||
m_visible = true;
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
on(construct){
|
||||
m_focusDirs = "Up/Down";
|
||||
m_bEnabled = true;
|
||||
m_refFM = "_root.gFM";
|
||||
m_initiallySelected = false;
|
||||
m_tabIndex = -1;
|
||||
m_bVisible = true;
|
||||
m_label = "$GUI:RandomMap";
|
||||
m_contentSymbol = "buttonContentSymbol";
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
on(construct){
|
||||
m_width = 75;
|
||||
m_textAlign = false;
|
||||
m_labelPosition = "right align";
|
||||
m_label_x = 0;
|
||||
m_label_y = 0;
|
||||
m_focusDirs = "Up/Down";
|
||||
m_iconType = "default";
|
||||
m_extLabel = "";
|
||||
m_nTruncateType = 0;
|
||||
m_label = "$Back";
|
||||
m_bEnabled = true;
|
||||
m_refFM = "_global.gFM";
|
||||
m_initiallySelected = false;
|
||||
m_tabIndex = 10;
|
||||
m_bVisible = true;
|
||||
m_contentSymbol = "buttonContentSymbol";
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
on(construct){
|
||||
m_width = 75;
|
||||
m_textAlign = false;
|
||||
m_labelPosition = "right align";
|
||||
m_label_x = 0;
|
||||
m_label_y = 0;
|
||||
m_focusDirs = "Up/Down";
|
||||
m_iconType = "default";
|
||||
m_extLabel = "";
|
||||
m_nTruncateType = 0;
|
||||
m_label = "$StartGame";
|
||||
m_bEnabled = true;
|
||||
m_refFM = "_global.gFM";
|
||||
m_initiallySelected = false;
|
||||
m_tabIndex = 9;
|
||||
m_bVisible = true;
|
||||
m_contentSymbol = "buttonContentSymbol";
|
||||
}
|
||||
Reference in New Issue
Block a user