first commit

This commit is contained in:
2026-06-14 01:40:04 +02:00
commit 5511354783
4787 changed files with 103543 additions and 0 deletions
@@ -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,102 @@
class fes_m_factionMenu extends Cafe2_BaseUIScreen
{
function fes_m_factionMenu(screen)
{
super(screen);
Cafe2_BaseUIScreen.m_thisClass = this;
_global.gSM.setOnExitScreen(_global.bind0(this,this.onScreenExit));
}
function frameDelayedInit()
{
trace("fes_m_factionMenu::frameDelayedInit()");
this.initGUI();
}
function initGUI()
{
this.m_localMessageHandlerFunc = _global.bind1DynamicParams(this,this.localMessageHandler);
_global.gMH.addMessageHandler(this.m_localMessageHandlerFunc);
Cafe2_BaseUIScreen.m_screen.sovietFaction.show();
Cafe2_BaseUIScreen.m_screen.sovietFaction.enable();
Cafe2_BaseUIScreen.m_screen.sovietFaction.noIntro();
Cafe2_BaseUIScreen.m_screen.sovietFaction.setOnMouseDownFunction(_global.bind0(this,this.sovietFactionButtonClicked));
Cafe2_BaseUIScreen.m_screen.alliesFaction.show();
Cafe2_BaseUIScreen.m_screen.alliesFaction.enable();
Cafe2_BaseUIScreen.m_screen.alliesFaction.setOnMouseDownFunction(_global.bind0(this,this.alliesFactionButtonClicked));
Cafe2_BaseUIScreen.m_screen.alliesFaction.noIntro();
Cafe2_BaseUIScreen.m_screen.japaneseFaction.show();
Cafe2_BaseUIScreen.m_screen.japaneseFaction.enable();
Cafe2_BaseUIScreen.m_screen.japaneseFaction.setOnMouseDownFunction(_global.bind0(this,this.japaneseFactionButtonClicked));
Cafe2_BaseUIScreen.m_screen.japaneseFaction.noIntro();
Cafe2_BaseUIScreen.m_screen.backButton.show();
Cafe2_BaseUIScreen.m_screen.backButton.enable();
Cafe2_BaseUIScreen.m_screen.backButton.setOnMouseUpFunction(_global.bind0(this,this.onBackButtonClick));
Cafe2_BaseUIScreen.m_screen.backButton.noIntro();
Cafe2_BaseUIScreen.m_screen.playButton.show();
Cafe2_BaseUIScreen.m_screen.playButton.enable();
Cafe2_BaseUIScreen.m_screen.playButton.setOnMouseUpFunction(_global.bind0(this,this.requestNewCampaign));
Cafe2_BaseUIScreen.m_screen.playButton.noIntro();
Cafe2_BaseUIScreen.m_screen.factionButtonController.SetSelectedRadioButton(Cafe2_BaseUIScreen.m_screen.sovietFaction);
this.sovietFactionButtonClicked();
}
function onScreenExit()
{
trace("fes_m_factionMenu::onScreenExit()");
_global.gMH.removeMessageHandler(this.m_localMessageHandlerFunc);
delete this.m_localMessageHandlerFunc;
this.clearData();
delete _global.fes_m_factionMenu;
delete _global.Cafe2_BaseUIScreen;
}
function sovietFactionButtonClicked()
{
trace("fes_m_factionMenu::sovietFactionButtonClicked()");
_global.GAME.MODE = _global.ENUM.GAME_MODE_CAMPAIGN;
_global.GAME.CAMPAIGN_TYPE = _global.ENUM.CAMPAIGN_TYPE_SOVIET;
factionDescriptionTF.text = "$SOVIET_FACTION_DESCRIPTION&Outline";
factionDescriptionShadowTF.text = "$SOVIET_FACTION_DESCRIPTION";
}
function alliesFactionButtonClicked()
{
trace("fes_m_factionMenu::alliesFactionButtonClicked()");
_global.GAME.MODE = _global.ENUM.GAME_MODE_CAMPAIGN;
_global.GAME.CAMPAIGN_TYPE = _global.ENUM.CAMPAIGN_TYPE_ALLIES;
factionDescriptionTF.text = "$ALLIES_FACTION_DESCRIPTION&Outline";
factionDescriptionShadowTF.text = "$ALLIES_FACTION_DESCRIPTION";
}
function japaneseFactionButtonClicked()
{
trace("fes_m_factionMenu::japaneseFactionButtonClicked()");
_global.GAME.MODE = _global.ENUM.GAME_MODE_CAMPAIGN;
_global.GAME.CAMPAIGN_TYPE = _global.ENUM.CAMPAIGN_TYPE_RISINGSUN;
factionDescriptionTF.text = "$JAPANESE_FACTION_DESCRIPTION&Outline";
factionDescriptionShadowTF.text = "$JAPANESE_FACTION_DESCRIPTION";
}
function requestNewCampaign()
{
trace("fes_m_factionMenu::requestNewCampaign()" + _global.GAME.CAMPAIGN_TYPE);
// Checked
getURL("FSCommand:CallGameFunction","%Campaign_SetFaction?FactionIndex=" + _global.GAME.CAMPAIGN_TYPE);
// Checked
getUrl("FSCommand:CallGameFunction", "%Campaign_NewGame");
}
function goToTutorialMenu()
{
gotoShellScreen(_global.SCREEN.FEG_TUTORIALMENU,[_global.SCREEN.FEG_MAIN_MENU]);
}
function localMessageHandler(messageCode)
{
var _loc3_ = false;
if(messageCode === _global.MSGCODE.FE_PROCEED_TO_TUTORIAL)
{
this.goToTutorialMenu();
_loc3_ = true;
}
return _loc3_;
}
function onBackButtonClick()
{
// Checked
getUrl("FSCommand:CallGameFunction", "%Campaign_ExitGame");
this.backButtonClicked();
}
}
@@ -0,0 +1,2 @@
var screen = new fes_m_factionMenu(this);
stop();
@@ -0,0 +1,10 @@
on(construct){
m_focusDirs = "Up/Down";
m_bEnabled = true;
m_refFM = "_global.gFM";
m_initiallySelected = false;
m_tabIndex = 0;
m_bVisible = true;
m_label = "$Back";
m_contentSymbol = "buttonContentSymbol";
}
@@ -0,0 +1,10 @@
on(construct){
m_focusDirs = "Up/Down";
m_bEnabled = true;
m_refFM = "_global.gFM";
m_initiallySelected = false;
m_tabIndex = 4;
m_bVisible = true;
m_label = "$Continue";
m_contentSymbol = "buttonContentSymbol";
}
@@ -0,0 +1,19 @@
on(construct){
m_width = 200;
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 = "";
m_bEnabled = true;
m_refFM = "_global.gFM";
m_initiallySelected = false;
m_tabIndex = 2;
m_bVisible = true;
m_contentSymbol = "AlliedFactionButtonContent Symbol";
m_controller = "factionButtonController";
}
@@ -0,0 +1,19 @@
on(construct){
m_width = 200;
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 = "";
m_bEnabled = true;
m_refFM = "_global.gFM";
m_initiallySelected = false;
m_tabIndex = 3;
m_bVisible = true;
m_contentSymbol = "JapaneseFactionButtonContent Symbol";
m_controller = "factionButtonController";
}
@@ -0,0 +1,19 @@
on(construct){
m_width = 200;
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 = "";
m_bEnabled = true;
m_refFM = "_global.gFM";
m_initiallySelected = false;
m_tabIndex = 1;
m_bVisible = true;
m_contentSymbol = "SovietFactionButtonContent Symbol";
m_controller = "factionButtonController";
}
@@ -0,0 +1,3 @@
on(construct){
m_name = "RadioButtonController";
}
@@ -0,0 +1,6 @@
on(construct){
m_title = "$FACTION_SELECT_SCREEN_TITLE";
m_DropShadow = true;
m_Outline = true;
m_visible = true;
}