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,3 @@
interface IListboxEventListener
{
}
@@ -0,0 +1,119 @@
class fes_m_singleplayerMenu extends Cafe2_BaseUIScreen implements IListboxEventListener
{
static var DIFFICULTY_EASY = 0;
static var DIFFICULTY_MEDIUM = 1;
static var DIFFICULTY_HARD = 2;
var m_names = new Array();
var m_values = new Array();
var m_difficulty = 0;
var m_mapIndex = -1;
function fes_m_singleplayerMenu(screen)
{
super();
trace("fes_m_singleplayerMenu::fes_m_singleplayerMenu() screen = " + screen);
Cafe2_BaseUIScreen.m_screen = screen;
Cafe2_BaseUIScreen.m_thisClass = this;
Cafe2_BaseUIScreen.m_thisClass.initGUI();
_global.GAME.MODE = _global.ENUM.GAME_MODE_CAMPAIGN;
}
function OnListboxIndexMouseClick(index, previouslySelectedIndex)
{
this.OnMapNameClicked(index);
}
function OnListboxIndexElementMouseClick(index, element, previouslySelectedIndex)
{
}
function initGUI()
{
trace("fes_m_singleplayerMenu::initGUI()");
Cafe2_BaseUIScreen.m_screen.difficultyRadioButtonController.SetSelectedRadioButton(Cafe2_BaseUIScreen.m_screen.easyRadioButton);
Cafe2_BaseUIScreen.m_screen.easyRadioButton.SetUserObject({difficulty:fes_m_singleplayerMenu.DIFFICULTY_EASY});
Cafe2_BaseUIScreen.m_screen.mediumRadioButton.SetUserObject({difficulty:fes_m_singleplayerMenu.DIFFICULTY_MEDIUM});
Cafe2_BaseUIScreen.m_screen.hardRadioButton.SetUserObject({difficulty:fes_m_singleplayerMenu.DIFFICULTY_HARD});
Cafe2_BaseUIScreen.m_screen.uiScrollBar._visible = true;
Cafe2_BaseUIScreen.m_screen.uiScrollBar.enable();
var ret = new Object();
// Checked
loadVariables("QueryGameEngine?MAP_LIST?Official=1|User=1|Multiplayer=1|SinglePlayer=1",ret);
if(ret.MAP_LIST == undefined)
{
ret.MAP_LIST = "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15";
ret.MAP_LIST += ",16,17,18,19,20,21,22,23,24,25,26,27,28,29";
}
Cafe2_BaseUIScreen.m_thisClass.m_values = ret.MAP_LIST.split(",");
for(var i = 0; i < Cafe2_BaseUIScreen.m_thisClass.m_values.length; ++i)
{
Cafe2_BaseUIScreen.m_thisClass.m_names.push("$MapList_" + i);
}
Cafe2_BaseUIScreen.m_screen.uiScrollingTextBox.setNumEntries(15);
Cafe2_BaseUIScreen.m_screen.uiScrollingTextBox.setVerticalPadding(1);
Cafe2_BaseUIScreen.m_screen.uiScrollingTextBox.addListener(this);
var elementList = new Array();
elementList.push({symbol:"std_mouseListboxEntryTextElementSymbol",width:300,leftMargin:0,rightMargin:0});
Cafe2_BaseUIScreen.m_screen.uiScrollingTextBox.init(elementList,25);
Cafe2_BaseUIScreen.m_screen.uiScrollingTextBox.attachScrollbarController(Cafe2_BaseUIScreen.m_screen.uiScrollBar);
Cafe2_BaseUIScreen.m_screen.uiScrollingTextBox.setColumnData(0,this.m_names);
Cafe2_BaseUIScreen.m_screen.uiScrollingTextBox.moveViewToFirst();
Cafe2_BaseUIScreen.m_screen.uiScrollingTextBox.refreshDisplay();
Cafe2_BaseUIScreen.m_screen.uiScrollingTextBox.refreshScrollbar();
Cafe2_BaseUIScreen.m_screen.playButton._visible = true;
Cafe2_BaseUIScreen.m_screen.playButton.enable();
Cafe2_BaseUIScreen.m_screen.playButton.setOnFocus(Cafe2_BaseUIScreen.m_thisClass.playButtonGotFocus);
Cafe2_BaseUIScreen.m_screen.playButton.setOnBlur(Cafe2_BaseUIScreen.m_thisClass.playButtonLostFocus);
Cafe2_BaseUIScreen.m_screen.playButton.setOnMouseUpFunction(Cafe2_BaseUIScreen.m_thisClass.playExecute);
Cafe2_BaseUIScreen.m_screen.backButton._visible = true;
Cafe2_BaseUIScreen.m_screen.backButton.enable();
Cafe2_BaseUIScreen.m_screen.backButton.setOnFocus(Cafe2_BaseUIScreen.m_thisClass.backButtonGotFocus);
Cafe2_BaseUIScreen.m_screen.backButton.setOnBlur(Cafe2_BaseUIScreen.m_thisClass.backButtonLostFocus);
Cafe2_BaseUIScreen.m_screen.backButton.setOnMouseUpFunction(Cafe2_BaseUIScreen.m_thisClass.backButtonClicked);
_global.gSM.setOnExitScreen(this.onScreenExit);
}
function onScreenExit()
{
trace("fes_m_singleplayerMenu::onScreenExit()");
Cafe2_BaseUIScreen.m_screen.uiScrollingTextBox.removeListener(this);
Cafe2_BaseUIScreen.m_screen.uiScrollingTextBox.shutdown();
this.clearData();
Cafe2_BaseUIScreen.m_screen = null;
Cafe2_BaseUIScreen.m_thisClass = null;
delete _global.fes_m_singleplayerMenu;
delete _global.Cafe2_BaseUIScreen;
}
function scrollBarGotFocus()
{
trace("fes_m_singleplayerMenu::scrollBar got focus");
}
function scrollBarLostFocus()
{
trace("fes_m_singleplayerMenu::scrollBar lost focus");
}
function backButtonGotFocus()
{
trace("fes_m_singleplayerMenu::Back button got focus");
}
function backButtonLostFocus()
{
trace("fes_m_singleplayerMenu::Back button lost focus");
}
function playButtonGotFocus()
{
trace("fes_m_singleplayerMenu::Back button got focus");
}
function playButtonLostFocus()
{
trace("fes_m_singleplayerMenu::Back button lost focus");
}
function playExecute()
{
var buttonComponent = Cafe2_BaseUIScreen.m_screen.difficultyRadioButtonController.GetSelectedRadioButton();
Cafe2_BaseUIScreen.m_thisClass.m_difficulty = buttonComponent.GetUserObject().difficulty;
// Checked
getURL("FSCommand:CallGameFunction","%StartMap?MapId=" + Cafe2_BaseUIScreen.m_thisClass.m_values[Cafe2_BaseUIScreen.m_thisClass.m_mapIndex] + "|Difficulty=" + Cafe2_BaseUIScreen.m_thisClass.m_difficulty);
}
function OnMapNameClicked(index)
{
trace("fes_m_singleplayerMenu::OnMapNameClicked(), index is " + index);
Cafe2_BaseUIScreen.m_thisClass.m_mapIndex = index;
Cafe2_BaseUIScreen.m_screen.playButton.enable();
}
}
@@ -0,0 +1,2 @@
var screen = new fes_m_singleplayerMenu(this);
stop();
@@ -0,0 +1,13 @@
on(construct){
m_focusDirs = "Up/Down";
m_numEntries = 15;
m_vPadding = 1;
m_bEnabled = true;
m_refFM = "_global.gFM";
m_initiallySelected = false;
m_tabIndex = 0;
m_bVisible = true;
m_scrollbarOffset = [];
m_scrollbarOffset[0] = 10;
m_scrollbarOffset[1] = 0;
}
@@ -0,0 +1,6 @@
on(construct){
m_nLength = 100;
m_nMax = 19;
m_nMin = 0;
m_nValue = 0;
}
@@ -0,0 +1,10 @@
on(construct){
m_focusDirs = "Up/Down";
m_bEnabled = true;
m_refFM = "_root.gFM";
m_initiallySelected = false;
m_tabIndex = 5;
m_bVisible = true;
m_label = "$Back";
m_contentSymbol = "buttonContentSymbol";
}
@@ -0,0 +1,10 @@
on(construct){
m_focusDirs = "Up/Down";
m_bEnabled = true;
m_refFM = "_root.gFM";
m_initiallySelected = false;
m_tabIndex = 4;
m_bVisible = true;
m_label = "$StartGame";
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 = "Easy";
m_bEnabled = true;
m_refFM = "_root.gFM";
m_initiallySelected = false;
m_tabIndex = -1;
m_bVisible = true;
m_contentSymbol = "radioButtonContentClip";
m_controller = "difficultyRadioButtonController";
}
@@ -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 = "Medium";
m_bEnabled = true;
m_refFM = "_root.gFM";
m_initiallySelected = false;
m_tabIndex = -1;
m_bVisible = true;
m_contentSymbol = "radioButtonContentClip";
m_controller = "difficultyRadioButtonController";
}
@@ -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 = "Hard";
m_bEnabled = true;
m_refFM = "_root.gFM";
m_initiallySelected = false;
m_tabIndex = -1;
m_bVisible = true;
m_contentSymbol = "radioButtonContentClip";
m_controller = "difficultyRadioButtonController";
}
@@ -0,0 +1,3 @@
on(construct){
m_name = "RadioButtonController";
}