first commit
This commit is contained in:
BIN
Binary file not shown.
|
After Width: | Height: | Size: 5.7 KiB |
@@ -0,0 +1,188 @@
|
||||
class feg_m_main
|
||||
{
|
||||
var m_callbackCount = 0;
|
||||
var m_transitionScreenIntervalId = -1;
|
||||
static var LAYER_BUTTONGUARD = 5;
|
||||
static var LAYER_CONTEXTMENU = 4;
|
||||
static var LAYER_COMLINK = 3;
|
||||
static var LAYER_SHELLSCREEN = 2;
|
||||
static var LAYER_BACKGROUNDSCREEN = 1;
|
||||
static var FADE_STEP = 25;
|
||||
function feg_m_main(screen)
|
||||
{
|
||||
this.m_screen = screen;
|
||||
this.m_messageHandler = _global.bind1DynamicParams(this,this.localMessageHandler);
|
||||
gMH.addMessageHandler(this.m_messageHandler);
|
||||
}
|
||||
function shutdown()
|
||||
{
|
||||
gMH.removeMessageHandler(this.m_messageHandler);
|
||||
delete this.m_messageHandler;
|
||||
delete this.m_screen.onChildLoad;
|
||||
delete _global.feg_m_main;
|
||||
}
|
||||
function localMessageHandler(messageCode)
|
||||
{
|
||||
var _loc3_ = true;
|
||||
switch(messageCode)
|
||||
{
|
||||
case _global.MSGCODE.FE_LOAD_SHELL:
|
||||
this.loadContent();
|
||||
break;
|
||||
case _global.MSGCODE.FE_UNLOAD:
|
||||
this.unloadContent();
|
||||
break;
|
||||
default:
|
||||
_loc3_ = false;
|
||||
}
|
||||
return _loc3_;
|
||||
}
|
||||
function loadContent()
|
||||
{
|
||||
this.m_screen.createEmptyMovieClip("backgroundMC",feg_m_main.LAYER_BACKGROUNDSCREEN);
|
||||
this.m_screen.createEmptyMovieClip("shellScreenMC",feg_m_main.LAYER_SHELLSCREEN);
|
||||
this.m_buttonGuard = this.m_screen.attachMovie("FullScreenButtonGuard","transitionButtonGuard",feg_m_main.LAYER_BUTTONGUARD);
|
||||
this.m_buttonGuard._alpha = 0;
|
||||
this.m_buttonGuard._visible = false;
|
||||
_global.contextMenu = this.m_screen.createEmptyMovieClip("contextMenuMC",feg_m_main.LAYER_CONTEXTMENU);
|
||||
_global.comLink = this.m_screen.createEmptyMovieClip("comLinkMC",feg_m_main.LAYER_COMLINK);
|
||||
this.m_screen.onChildLoad = _global.bind0(this,this.OnChildLoaded);
|
||||
this.registerOnLoadCallback();
|
||||
this.m_screen.backgroundMC.loadMovie(_global.SCREEN.FEG_BACKGROUND + ".swf");
|
||||
this.m_screen.contextMenuMC.loadMovie(_global.SCREEN.FEG_CONTEXTMENU + ".swf");
|
||||
this.hideBackgroundMovie();
|
||||
if(!extern.InGame)
|
||||
{
|
||||
this.m_screen.shellScreenMC.loadMovie(_global.SCREEN.FEG_MAIN_MENU + ".swf");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.m_screen.shellScreenMC.loadMovie(_global.SCREEN.NONE);
|
||||
}
|
||||
this.initComLink();
|
||||
}
|
||||
function unloadContent()
|
||||
{
|
||||
this.m_screen.backgroundMC.unloadMovie();
|
||||
this.m_screen.shellScreenMC.unloadMovie();
|
||||
this.m_screen.comLinkMC.screen.shutdown();
|
||||
this.m_screen.comLinkMC.unloadMovie();
|
||||
this.m_buttonGuard.unloadMovie();
|
||||
}
|
||||
function changeScreen()
|
||||
{
|
||||
this.m_transitionScreenState = "Start";
|
||||
this.screenTransition();
|
||||
}
|
||||
function screenTransition()
|
||||
{
|
||||
if(this.doScreenTransition())
|
||||
{
|
||||
if(this.m_transitionScreenIntervalId != -1)
|
||||
{
|
||||
clearInterval(this.m_transitionScreenIntervalId);
|
||||
this.m_transitionScreenIntervalId = -1;
|
||||
delete this.m_transitionFunc;
|
||||
}
|
||||
}
|
||||
else if(this.m_transitionScreenIntervalId == -1)
|
||||
{
|
||||
this.m_transitionFunc = _global.bind0(this,this.screenTransition);
|
||||
this.m_transitionScreenIntervalId = setInterval(this.m_transitionFunc,30);
|
||||
}
|
||||
}
|
||||
function doScreenTransition()
|
||||
{
|
||||
trace("doScreenTransition() - " + this.m_transitionScreenState);
|
||||
switch(this.m_transitionScreenState)
|
||||
{
|
||||
case "Start":
|
||||
this.m_buttonGuard._visible = true;
|
||||
if(this.m_screen.shellScreenMC == undefined)
|
||||
{
|
||||
this.m_transitionScreenState = "ChangeScreen";
|
||||
return this.doScreenTransition();
|
||||
}
|
||||
this.m_transitionScreenState = "FadeOut";
|
||||
this.m_screen.shellScreenMC._alpha -= feg_m_main.FADE_STEP;
|
||||
break;
|
||||
case "FadeOut":
|
||||
if(this.m_screen.shellScreenMC._alpha <= feg_m_main.FADE_STEP)
|
||||
{
|
||||
this.m_screen.shellScreenMC._alpha = 0;
|
||||
this.m_transitionScreenState = "ChangeScreen";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.m_screen.shellScreenMC._alpha -= feg_m_main.FADE_STEP;
|
||||
}
|
||||
break;
|
||||
case "ChangeScreen":
|
||||
if(this.m_screen.shellScreenMC != undefined)
|
||||
{
|
||||
_global.gCT.unregisterFromRoot(this.m_screen.shellScreenMC);
|
||||
this.m_screen.shellScreenMC.unloadMovie();
|
||||
}
|
||||
this.m_screen.createEmptyMovieClip("shellScreenMC",feg_m_main.LAYER_SHELLSCREEN);
|
||||
this.m_screen.shellScreenMC.loadMovie(_global.gSM.m_file);
|
||||
this.m_screen.shellScreenMC._alpha = 0;
|
||||
this.m_transitionScreenState = "FadeIn";
|
||||
break;
|
||||
case "FadeIn":
|
||||
this.m_screen.shellScreenMC._alpha += feg_m_main.FADE_STEP;
|
||||
if(this.m_screen.shellScreenMC._alpha >= 100)
|
||||
{
|
||||
this.m_transitionScreenState = "Done";
|
||||
this.m_screen.shellScreenMC._alpha = 100;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case "Done":
|
||||
this.m_buttonGuard._visible = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function hideForeground()
|
||||
{
|
||||
this.m_screen.shellScreenMC._visible = false;
|
||||
}
|
||||
function showForeground()
|
||||
{
|
||||
this.m_screen.shellScreenMC._visible = true;
|
||||
}
|
||||
function hideBackgroundMovie()
|
||||
{
|
||||
this.m_screen.backgroundMC._visible = false;
|
||||
}
|
||||
function showBackgroundMovie()
|
||||
{
|
||||
this.m_screen.backgroundMC._visible = true;
|
||||
}
|
||||
function backgroundUnload()
|
||||
{
|
||||
this.m_screen.backgroundMC.screen.onUnload();
|
||||
this.m_screen.backgroundMC.unloadMovie();
|
||||
}
|
||||
function registerOnLoadCallback()
|
||||
{
|
||||
this.m_callbackCount = this.m_callbackCount + 1;
|
||||
}
|
||||
function OnChildLoaded()
|
||||
{
|
||||
this.m_callbackCount = this.m_callbackCount - 1;
|
||||
if(this.m_callbackCount == 0)
|
||||
{
|
||||
// Checked
|
||||
getUrl("FSCommand:CallGameFunction", "OnFrameworkInitialized");
|
||||
}
|
||||
}
|
||||
function initComLink()
|
||||
{
|
||||
this.m_screen.comLinkMC._x = 0;
|
||||
this.m_screen.comLinkMC._y = 0;
|
||||
this.m_screen.comLinkMC._visible = true;
|
||||
this.m_screen.comLinkMC.loadMovie(_global.SCREEN.FEG_COMLINK + ".swf");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
var screen = new feg_m_main(this);
|
||||
stop();
|
||||
@@ -0,0 +1,2 @@
|
||||
2;FullScreenButtonGuard
|
||||
3;__Packages.feg_m_main
|
||||
|
Reference in New Issue
Block a user