first commit
This commit is contained in:
+135
@@ -0,0 +1,135 @@
|
||||
class Cafe2_BaseUIScreen
|
||||
{
|
||||
var m_changeToScreen = null;
|
||||
var m_uiComponentArray = new Array();
|
||||
function Cafe2_BaseUIScreen()
|
||||
{
|
||||
}
|
||||
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 backButtonClicked()
|
||||
{
|
||||
trace("Cafe2_BaseUIScreen::backButtonClicked()");
|
||||
var _loc2_ = Cafe2_BaseUIScreen.m_thisClass.m_uiComponentArray.length;
|
||||
var _loc1_ = 0;
|
||||
while(_loc1_ < _loc2_)
|
||||
{
|
||||
Cafe2_BaseUIScreen.m_thisClass.m_uiComponentArray[_loc1_].outtro(Cafe2_BaseUIScreen.m_thisClass.executeBackFunction);
|
||||
_loc1_ = _loc1_ + 1;
|
||||
}
|
||||
}
|
||||
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);
|
||||
};
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class autoMatchSetup extends Cafe2_BaseUIScreen
|
||||
{
|
||||
function autoMatchSetup(screen)
|
||||
{
|
||||
super();
|
||||
Cafe2_BaseUIScreen.m_screen = screen;
|
||||
Cafe2_BaseUIScreen.m_thisClass = this;
|
||||
}
|
||||
}
|
||||
+136
@@ -0,0 +1,136 @@
|
||||
class fem_m_autoMatchSetup extends autoMatchSetup
|
||||
{
|
||||
function fem_m_autoMatchSetup(screen)
|
||||
{
|
||||
super(screen);
|
||||
Cafe2_BaseUIScreen.m_screen = screen;
|
||||
Cafe2_BaseUIScreen.m_thisClass = this;
|
||||
this.initGUI();
|
||||
}
|
||||
function initGUI()
|
||||
{
|
||||
getUrl("FSCommand:CallGameFunction", "%PREPAREAUTOMATCHSETUPDEFAULTS");
|
||||
this.initButtons();
|
||||
this.initCheckBox();
|
||||
this.initMenus();
|
||||
this.registerIntroOuttroComponents([Cafe2_BaseUIScreen.m_screen.backButton,Cafe2_BaseUIScreen.m_screen.searchButton]);
|
||||
_global.gSM.setOnExitScreen(Cafe2_BaseUIScreen.m_thisClass.onScreenExit);
|
||||
this.startIntro();
|
||||
}
|
||||
function onScreenExit()
|
||||
{
|
||||
Cafe2_BaseUIScreen.m_thisClass.clearData();
|
||||
Cafe2_BaseUIScreen.m_screen = null;
|
||||
Cafe2_BaseUIScreen.m_thisClass = null;
|
||||
delete _global.fem_m_autoMatchSetup;
|
||||
delete _global.autoMatchSetup;
|
||||
delete _global.Cafe2_BaseUIScreen;
|
||||
}
|
||||
function initButtons()
|
||||
{
|
||||
var backButtonComponent = Cafe2_BaseUIScreen.m_screen.backButton;
|
||||
backButtonComponent.show();
|
||||
backButtonComponent.enable();
|
||||
backButtonComponent.setOnMouseUpFunction(_global.bind0(Cafe2_BaseUIScreen.m_thisClass,Cafe2_BaseUIScreen.m_thisClass.backButtonClicked));
|
||||
var searchButtonComponent = Cafe2_BaseUIScreen.m_screen.searchButton;
|
||||
searchButtonComponent.show();
|
||||
searchButtonComponent.enable();
|
||||
searchButtonComponent.setOnMouseUpFunction(_global.bind0(Cafe2_BaseUIScreen.m_thisClass,Cafe2_BaseUIScreen.m_thisClass.searchButtonClicked));
|
||||
}
|
||||
function initMenus()
|
||||
{
|
||||
this.populateAMTypesMenu();
|
||||
this.populateAMColorsMenu();
|
||||
this.populateAMFactionsMenu();
|
||||
Cafe2_BaseUIScreen.m_screen.gameTypesMenu.setOnChange(_global.bind0(Cafe2_BaseUIScreen.m_thisClass,Cafe2_BaseUIScreen.m_thisClass.setupSelectionsChanged));
|
||||
Cafe2_BaseUIScreen.m_screen.colorsMenu.setOnChange(_global.bind0(Cafe2_BaseUIScreen.m_thisClass,Cafe2_BaseUIScreen.m_thisClass.setupSelectionsChanged));
|
||||
Cafe2_BaseUIScreen.m_screen.factionsMenu.setOnChange(_global.bind0(Cafe2_BaseUIScreen.m_thisClass,Cafe2_BaseUIScreen.m_thisClass.setupSelectionsChanged));
|
||||
}
|
||||
function populateAMTypesMenu()
|
||||
{
|
||||
var ret = new Object();
|
||||
// Checked
|
||||
loadVariables("QueryGameEngine?AUTOMATCHTYPES",ret);
|
||||
var values = new Array();
|
||||
var strings = new Array();
|
||||
values = ret.AUTOMATCHTYPES_VALUES.split(",");
|
||||
strings = ret.AUTOMATCHTYPES_STRINGS.split(",");
|
||||
var firstVal = Number(values.shift());
|
||||
var menuComponent = Cafe2_BaseUIScreen.m_screen.gameTypesMenu;
|
||||
menuComponent.enable();
|
||||
menuComponent.setData(strings, values);
|
||||
menuComponent.setSelectedIndex(firstVal);
|
||||
menuComponent.show();
|
||||
}
|
||||
function populateAMColorsMenu()
|
||||
{
|
||||
var ret = new Object();
|
||||
// Checked
|
||||
loadVariables("QueryGameEngine?AUTOMATCHCOLORS",ret);
|
||||
var colorListStrRaw = ret.AUTOMATCHCOLORS.split(",");
|
||||
var firstVal = Number(colorListStrRaw.shift());
|
||||
var colorListSize = colorListStrRaw.length;
|
||||
var colorList = new Array();
|
||||
for(var i = 0; i < colorListSize; ++i)
|
||||
{
|
||||
colorList.push(Number(colorListStrRaw[i]));
|
||||
}
|
||||
var colorsMenuComponent = Cafe2_BaseUIScreen.m_screen.colorsMenu;
|
||||
colorsMenuComponent.enable();
|
||||
colorsMenuComponent.setData(colorListStrRaw,colorList);
|
||||
colorsMenuComponent.setSelectedIndex(firstVal);
|
||||
colorsMenuComponent.show();
|
||||
}
|
||||
function populateAMFactionsMenu()
|
||||
{
|
||||
var ret = new Object();
|
||||
// Checked
|
||||
loadVariables("QueryGameEngine?AUTOMATCHFACTIONS",ret);
|
||||
var values = new Array();
|
||||
var strings = new Array();
|
||||
values = ret.AUTOMATCHFACTIONS_VALUES.split(",");
|
||||
strings = ret.AUTOMATCHFACTIONS_STRINGS.split(",");
|
||||
var firstVal = Number(values.shift());
|
||||
var factionComponent = Cafe2_BaseUIScreen.m_screen.factionsMenu;
|
||||
factionComponent.enable();
|
||||
factionComponent.setData(strings,values);
|
||||
factionComponent.setSelectedIndex(firstVal);
|
||||
factionComponent.show();
|
||||
}
|
||||
function initCheckBox()
|
||||
{
|
||||
var checkBoxComponent = Cafe2_BaseUIScreen.m_screen.broadcastCheckBox;
|
||||
checkBoxComponent.show();
|
||||
checkBoxComponent.enable();
|
||||
var ret = new Object();
|
||||
// Checked
|
||||
loadVariables("QueryGameEngine?AUTOMATCHBROADCAST",ret);
|
||||
if(ret.AutoMatchBroadcast != 0)
|
||||
{
|
||||
checkBoxComponent.check();
|
||||
}
|
||||
checkBoxComponent.setOnMouseDownFunction(_global.bind0(Cafe2_BaseUIScreen.m_thisClass,Cafe2_BaseUIScreen.m_thisClass.setupSelectionsChanged));
|
||||
}
|
||||
function searchButtonClicked()
|
||||
{
|
||||
this.setupSelectionsChanged();
|
||||
Cafe2_BaseUIScreen.m_thisClass.startOuttro(_global.SCREEN.FEM_MP_AUTOMATCH_SEARCH);
|
||||
}
|
||||
function sendParamsToBackEnd(bcast, gtype, pcolor, pfaction)
|
||||
{
|
||||
trace("fem_m_autoMatchSetup::sendParamsToBackEnd() : Cast=" + bcast + ", Type=" + gtype + ", Color=" + pcolor + ", Faction=" + pfaction);
|
||||
// Checked
|
||||
getURL("FSCommand:CallGameFunction","%PROCESSAUTOMATCHSETUPCHOICES?CAST=" + bcast + "|TYPE=" + gtype + "|COLOR=" + pcolor + "|FACTION=" + pfaction);
|
||||
}
|
||||
function setupSelectionsChanged()
|
||||
{
|
||||
var isBroadcast = !Cafe2_BaseUIScreen.m_screen.broadcastCheckBox.isChecked() ? "0" : "1";
|
||||
var gameTypeComponentIndex = Cafe2_BaseUIScreen.m_screen.gameTypesMenu.getCurrentIndex();
|
||||
var gameType = String(Cafe2_BaseUIScreen.m_screen.gameTypesMenu.getValueAtIndex(gameTypeComponentIndex));
|
||||
var colorComponentIndex = Cafe2_BaseUIScreen.m_screen.colorsMenu.getCurrentIndex();
|
||||
var color = String(Cafe2_BaseUIScreen.m_screen.colorsMenu.getValueAtIndex(colorComponentIndex));
|
||||
var factionComponentIndex = Cafe2_BaseUIScreen.m_screen.factionsMenu.getCurrentIndex();
|
||||
var faction = String(Cafe2_BaseUIScreen.m_screen.factionsMenu.getValueAtIndex(factionComponentIndex));
|
||||
this.sendParamsToBackEnd(isBroadcast,gameType,color,faction);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
var screen = new fem_m_autoMatchSetup(this);
|
||||
stop();
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
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 = "$BroadcastGame";
|
||||
m_nTruncateType = 0;
|
||||
m_label = "$BroadcastGame";
|
||||
m_bEnabled = true;
|
||||
m_refFM = "_root.gFM";
|
||||
m_initiallySelected = false;
|
||||
m_tabIndex = 2;
|
||||
m_bVisible = true;
|
||||
m_contentSymbol = "checkBoxContentClipSymbol";
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
on(construct){
|
||||
m_focusDirs = "Up/Down";
|
||||
m_refFM = "_root.gFM";
|
||||
m_initiallySelected = false;
|
||||
m_tabIndex = 3;
|
||||
m_bVisible = true;
|
||||
m_visibleEntryCount = 4;
|
||||
m_width = 200;
|
||||
m_contentSymbol = "TextDropdownMenuContentSymbol";
|
||||
m_entrySymbol = "std_mouseListboxEntryTextElementSymbol";
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
on(construct){
|
||||
m_focusDirs = "Up/Down";
|
||||
m_refFM = "_root.gFM";
|
||||
m_initiallySelected = false;
|
||||
m_tabIndex = 4;
|
||||
m_bVisible = true;
|
||||
m_visibleEntryCount = 9;
|
||||
m_width = 50;
|
||||
m_contentSymbol = "ColorSwatchDropdownContentSymbol";
|
||||
m_entrySymbol = "std_mouseListboxEntryColorSwatchElementSymbol";
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
on(construct){
|
||||
m_focusDirs = "Up/Down";
|
||||
m_refFM = "_root.gFM";
|
||||
m_initiallySelected = false;
|
||||
m_tabIndex = 5;
|
||||
m_bVisible = true;
|
||||
m_visibleEntryCount = 2;
|
||||
m_width = 200;
|
||||
m_contentSymbol = "TextDropdownMenuContentSymbol";
|
||||
m_entrySymbol = "std_mouseListboxEntryTextElementSymbol";
|
||||
}
|
||||
+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 = "$StartSearch";
|
||||
m_contentSymbol = "buttonContentSymbol";
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
on(construct){
|
||||
m_focusDirs = "Up/Down";
|
||||
m_bEnabled = true;
|
||||
m_refFM = "_root.gFM";
|
||||
m_initiallySelected = false;
|
||||
m_tabIndex = 0;
|
||||
m_bVisible = true;
|
||||
m_label = "$Back";
|
||||
m_contentSymbol = "buttonContentSymbol";
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
6;__Packages.Cafe2_BaseUIScreen
|
||||
7;__Packages.autoMatchSetup
|
||||
8;__Packages.fem_m_autoMatchSetup
|
||||
|
@@ -0,0 +1 @@
|
||||
RA 3 - Automatch Setup Screen
|
||||
Reference in New Issue
Block a user