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);
|
||||
};
|
||||
}
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
class feg_m_newLoadContinue extends Cafe2_BaseUIScreen
|
||||
{
|
||||
function feg_m_newLoadContinue(screen)
|
||||
{
|
||||
super();
|
||||
trace("feg_m_newLoadContinue::feg_m_newLoadContinue() screen = " + screen);
|
||||
Cafe2_BaseUIScreen.m_screen = screen;
|
||||
Cafe2_BaseUIScreen.m_thisClass = this;
|
||||
Cafe2_BaseUIScreen.m_thisClass.onLoad();
|
||||
}
|
||||
function onLoad()
|
||||
{
|
||||
trace("feg_m_newLoadContinue::onLoad");
|
||||
Cafe2_BaseUIScreen.m_thisClass.initGUI();
|
||||
_global.GAME.MODE = _global.ENUM.GAME_MODE_SHELL;
|
||||
trace("feg_m_newLoadContinue::onLoad()- Game mode set to GAME_MODE_SHELL.");
|
||||
}
|
||||
function initGUI()
|
||||
{
|
||||
trace("feg_m_newLoadContinue::initGUI() " + _global.gEH);
|
||||
_global.gSM.setOnExitScreen(Cafe2_BaseUIScreen.m_thisClass.onScreenExit);
|
||||
Cafe2_BaseUIScreen.m_screen.button_New.SetOnMouseUpFunction(_global.bind0(this,this.OnNewButtonClick));
|
||||
Cafe2_BaseUIScreen.m_screen.button_Continue.SetOnMouseUpFunction(_global.bind0(this,this.OnContinueButtonClick));
|
||||
Cafe2_BaseUIScreen.m_screen.button_Load.SetOnMouseUpFunction(_global.bind0(this,this.OnLoadButtonClick));
|
||||
Cafe2_BaseUIScreen.m_screen.button_Back.SetOnMouseUpFunction(_global.bind0(this,this.OnBackButtonClick));
|
||||
Cafe2_BaseUIScreen.m_screen.button_New.enable();
|
||||
Cafe2_BaseUIScreen.m_screen.button_Continue.disable();
|
||||
Cafe2_BaseUIScreen.m_screen.button_Load.enable();
|
||||
Cafe2_BaseUIScreen.m_screen.button_Back.enable();
|
||||
this.registerIntroOuttroComponents([Cafe2_BaseUIScreen.m_screen.button_New,Cafe2_BaseUIScreen.m_screen.button_Continue,Cafe2_BaseUIScreen.m_screen.button_Load,Cafe2_BaseUIScreen.m_screen.button_Back]);
|
||||
this.startIntro();
|
||||
}
|
||||
function OnNewButtonClick()
|
||||
{
|
||||
trace("feg_m_newLoadContinue::OnNewButtonClick()");
|
||||
var campaignType = -1;
|
||||
switch(_global.GAME.CAMPAIGN_TYPE)
|
||||
{
|
||||
case _global.ENUM.CAMPAIGN_TYPE_ALLIES:
|
||||
campaignType = 0;
|
||||
break;
|
||||
case _global.ENUM.CAMPAIGN_TYPE_RISINGSUN:
|
||||
campaignType = 1;
|
||||
break;
|
||||
case _global.ENUM.CAMPAIGN_TYPE_SOVIET:
|
||||
campaignType = 2;
|
||||
break;
|
||||
default:
|
||||
trace("ERROR: invalid campain type in feg_m_newLoadContinue::OnNewButtonClick()");
|
||||
}
|
||||
trace("feg_m_newLoadContinue::OnNewButtonClick() - Starting new game with id=" + campaignType);
|
||||
// Checked
|
||||
getURL("FSCommand:CallGameFunction","Campaign_SetFaction&" + campaignType);
|
||||
// Checked
|
||||
getUrl("FSCommand:CallGameFunction", "Campaign_NewGame");
|
||||
Cafe2_BaseUIScreen.m_thisClass.startOuttro(_global.SCREEN.FES_COOP_MISSION_BRIEFING);
|
||||
}
|
||||
function OnContinueButtonClick()
|
||||
{
|
||||
trace("feg_m_newLoadContinue::OnContinueButtonClick()");
|
||||
}
|
||||
function OnLoadButtonClick()
|
||||
{
|
||||
trace("feg_m_newLoadContinue::OnLoadButtonClick()");
|
||||
_global.GAME.MODE = _global.ENUM.GAME_MODE_CAMPAIGN;
|
||||
_global.GAME.SAVELOADSCREEN_TYPE = _global.ENUM.SAVELOADSCREEN_LOAD;
|
||||
this.startOuttro(_global.SCREEN.FEG_SAVELOAD);
|
||||
}
|
||||
function OnBackButtonClick()
|
||||
{
|
||||
trace("feg_m_newLoadContinue::OnBackButtonClick()");
|
||||
this.backButtonClicked();
|
||||
}
|
||||
function onScreenExit()
|
||||
{
|
||||
trace("feg_m_newLoadContinue::onScreenExit()");
|
||||
this.clearData();
|
||||
Cafe2_BaseUIScreen.m_screen = null;
|
||||
Cafe2_BaseUIScreen.m_thisClass = null;
|
||||
delete _global.feg_m_newLoadContinue;
|
||||
delete _global.Cafe2_BaseUIScreen;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
var screen = new feg_m_newLoadContinue(this);
|
||||
stop();
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
on(construct){
|
||||
m_width = 200;
|
||||
m_textAlign = true;
|
||||
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 = "New";
|
||||
m_bEnabled = true;
|
||||
m_refFM = "_global.gFM";
|
||||
m_initiallySelected = false;
|
||||
m_tabIndex = 0;
|
||||
m_bVisible = true;
|
||||
m_contentSymbol = "buttonContentSymbol";
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
on(construct){
|
||||
m_width = 200;
|
||||
m_textAlign = true;
|
||||
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 = "Continue";
|
||||
m_bEnabled = true;
|
||||
m_refFM = "_global.gFM";
|
||||
m_initiallySelected = false;
|
||||
m_tabIndex = 1;
|
||||
m_bVisible = true;
|
||||
m_contentSymbol = "buttonContentSymbol";
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
on(construct){
|
||||
m_width = 200;
|
||||
m_textAlign = true;
|
||||
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 = "Load";
|
||||
m_bEnabled = true;
|
||||
m_refFM = "_global.gFM";
|
||||
m_initiallySelected = false;
|
||||
m_tabIndex = 2;
|
||||
m_bVisible = true;
|
||||
m_contentSymbol = "buttonContentSymbol";
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
on(construct){
|
||||
m_width = 200;
|
||||
m_textAlign = true;
|
||||
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 = 3;
|
||||
m_bVisible = true;
|
||||
m_contentSymbol = "buttonContentSymbol";
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
4;__Packages.Cafe2_BaseUIScreen
|
||||
5;__Packages.feg_m_newLoadContinue
|
||||
|
Reference in New Issue
Block a user