mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27:50 -05:00
Brought up to date with the private repository (feea4c7)
This commit is contained in:
1 parent
1aa738d692
commit
1b1df1ae48
7925 files changed
+2617237
-20
No files matched your search
@@ -0,0 +1,205 @@
|
||||
package loadProgress
|
||||
{
|
||||
import com.sbi.loader.LoaderCacheEntry_Base;
|
||||
import com.sbi.loader.LoaderEvent;
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.Loader;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.Event;
|
||||
import flash.system.Capabilities;
|
||||
import flash.system.LoaderContext;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class LoadProgress
|
||||
{
|
||||
|
||||
public static const INITIALIZING:int = 2;
|
||||
|
||||
public static const LOAD_RESOURCES:int = 3;
|
||||
|
||||
public static const INIT_GAMEPLAY_OR_CREATE_ACCOUNT:int = 4;
|
||||
|
||||
public static const LOGGING_IN:int = 5;
|
||||
|
||||
public static const ON_LOGIN:int = 6;
|
||||
|
||||
public static const INIT_ASSETS:int = 7;
|
||||
|
||||
public static const LOADING_WORLDMAP:int = 8;
|
||||
|
||||
public static const SCENE_INIT:int = 9;
|
||||
|
||||
public static const LOADING_ROOM_OR_SERVER_JOIN:int = 10;
|
||||
|
||||
public static const LIST_TOP_LOAD_TEXT_ID:int = 697;
|
||||
|
||||
public static const LIST_BOTTOM_LOAD_TEXT_ID:int = 694;
|
||||
|
||||
public static const LIST_PROGRESS_TEXT_ID:int = 696;
|
||||
|
||||
private static var _entry:LoaderCacheEntry_Base;
|
||||
|
||||
private static var _loadScreen:Loader;
|
||||
|
||||
private static var _loadScreenContent:LoadProgressContent;
|
||||
|
||||
private static var _loadLayer:DisplayObjectContainer;
|
||||
|
||||
private static var _completeCallback:Function;
|
||||
|
||||
private static var _target:String;
|
||||
|
||||
private static var _bChangeLoadingScreen:Boolean;
|
||||
|
||||
private static var _progressCounter:int;
|
||||
|
||||
private static var _visible:Boolean;
|
||||
|
||||
private static const LoadScreenSWF:Class = Load_Screen_swf;
|
||||
|
||||
public function LoadProgress()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function get loadScreen() : Loader
|
||||
{
|
||||
return _loadScreen;
|
||||
}
|
||||
|
||||
public static function get entry() : LoaderCacheEntry_Base
|
||||
{
|
||||
return _entry;
|
||||
}
|
||||
|
||||
public static function get loadLayer() : DisplayObjectContainer
|
||||
{
|
||||
return _loadLayer;
|
||||
}
|
||||
|
||||
public static function get visible() : Boolean
|
||||
{
|
||||
return _visible;
|
||||
}
|
||||
|
||||
public static function init(param1:DisplayObjectContainer) : void
|
||||
{
|
||||
var _loc2_:LoaderContext = null;
|
||||
if(_loadScreen == null)
|
||||
{
|
||||
_bChangeLoadingScreen = true;
|
||||
_progressCounter = 0;
|
||||
_loadLayer = param1;
|
||||
_loadScreen = new Loader();
|
||||
_loc2_ = new LoaderContext();
|
||||
if(Capabilities.playerType === "Desktop")
|
||||
{
|
||||
_loc2_.allowCodeImport = true;
|
||||
}
|
||||
_loadScreen.contentLoaderInfo.addEventListener("complete",onLoadScreenComplete);
|
||||
_loadScreen.loadBytes(new LoadScreenSWF(),_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
public static function show(param1:Boolean, param2:Object = null) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_visible = true;
|
||||
if(!loadLayer.contains(_loadScreen))
|
||||
{
|
||||
loadLayer.addChild(_loadScreen);
|
||||
}
|
||||
if(_loadScreenContent && _bChangeLoadingScreen)
|
||||
{
|
||||
_loadScreenContent.showScreen(true);
|
||||
_loadScreenContent.setProgress(_progressCounter);
|
||||
_bChangeLoadingScreen = false;
|
||||
}
|
||||
}
|
||||
else if(loadLayer.contains(_loadScreen))
|
||||
{
|
||||
_visible = false;
|
||||
loadLayer.removeChild(_loadScreen);
|
||||
_bChangeLoadingScreen = true;
|
||||
_progressCounter = 0;
|
||||
if(_loadScreenContent)
|
||||
{
|
||||
_loadScreenContent.destroyScreens();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function updateProgress(param1:int) : void
|
||||
{
|
||||
_progressCounter = param1;
|
||||
if(_loadScreenContent)
|
||||
{
|
||||
_loadScreenContent.setProgress(param1);
|
||||
}
|
||||
}
|
||||
|
||||
public static function load(param1:String, param2:int, param3:Function) : void
|
||||
{
|
||||
_entry = null;
|
||||
_completeCallback = param3;
|
||||
_target = gMainFrame.path + param1;
|
||||
_progressCounter = param2;
|
||||
if(_loadScreenContent)
|
||||
{
|
||||
_loadScreenContent.setProgress(param2);
|
||||
}
|
||||
if(_loadScreen)
|
||||
{
|
||||
startLoad();
|
||||
return;
|
||||
}
|
||||
throw new Error("preloader was not embedded?!");
|
||||
}
|
||||
|
||||
public static function onLocalizationsReceived() : void
|
||||
{
|
||||
if(LocalizationManager.hasLocalizations)
|
||||
{
|
||||
if(_loadScreenContent)
|
||||
{
|
||||
_loadScreenContent.updateText();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function onLoadScreenComplete(param1:Event) : void
|
||||
{
|
||||
_loadScreenContent = new LoadProgressContent(MovieClip(_loadScreen.content));
|
||||
show(true);
|
||||
}
|
||||
|
||||
private static function startLoad() : void
|
||||
{
|
||||
show(true);
|
||||
_loadScreenContent.loadPercentageVisibility = true;
|
||||
gMainFrame.loaderCache.openFile(_target,loadCompleteHandler,loadProgressHandler);
|
||||
}
|
||||
|
||||
private static function loadCompleteHandler(param1:LoaderEvent) : void
|
||||
{
|
||||
_entry = param1.entry;
|
||||
_loadScreenContent.loadPercentageVisibility = false;
|
||||
if(_completeCallback != null)
|
||||
{
|
||||
_completeCallback();
|
||||
}
|
||||
}
|
||||
|
||||
private static function loadProgressHandler(param1:LoaderEvent) : void
|
||||
{
|
||||
if(param1.status && _loadScreen)
|
||||
{
|
||||
_loadScreenContent.loadPercentage = param1.entry.progress;
|
||||
return;
|
||||
}
|
||||
throw new Error("ERROR: Unable to show loading progress! status:" + param1.status + " preloader:" + _loadScreen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
package loadProgress
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
|
||||
public class LoadProgressContent extends MovieClip
|
||||
{
|
||||
|
||||
private var _content:MovieClip;
|
||||
|
||||
private var _textBox:LoadProgressTextBox;
|
||||
|
||||
private var _loadText:LoadProgressLoadText;
|
||||
|
||||
public function LoadProgressContent(param1:MovieClip)
|
||||
{
|
||||
super();
|
||||
_content = param1;
|
||||
_textBox = new LoadProgressTextBox(param1.textBox);
|
||||
_loadText = new LoadProgressLoadText(param1.loadText,_textBox);
|
||||
_content.loadPercentage.textBox.visible = false;
|
||||
}
|
||||
|
||||
public function get textBox() : LoadProgressTextBox
|
||||
{
|
||||
return _textBox;
|
||||
}
|
||||
|
||||
public function get loadText() : LoadProgressLoadText
|
||||
{
|
||||
return _loadText;
|
||||
}
|
||||
|
||||
public function set loadPercentage(param1:Number) : void
|
||||
{
|
||||
_content.loadPercentage.textBox.text = param1 + "%";
|
||||
}
|
||||
|
||||
public function set loadPercentageVisibility(param1:Boolean) : void
|
||||
{
|
||||
_content.loadPercentage.textBox.visible = param1;
|
||||
if(param1)
|
||||
{
|
||||
_content.loadPercentage.textBox.text = "0%";
|
||||
}
|
||||
}
|
||||
|
||||
public function showScreen(param1:Boolean = true) : void
|
||||
{
|
||||
_content.gotoAndStop(Math.ceil(Math.random() * 4));
|
||||
if(_loadText != null)
|
||||
{
|
||||
_textBox.destroy();
|
||||
_loadText.destroy();
|
||||
}
|
||||
_textBox = new LoadProgressTextBox(_content.textBox);
|
||||
_loadText = new LoadProgressLoadText(_content.loadText,_textBox);
|
||||
if(param1)
|
||||
{
|
||||
_textBox.displayText(true);
|
||||
_textBox.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_textBox.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function destroyScreens() : void
|
||||
{
|
||||
if(_loadText != null)
|
||||
{
|
||||
_textBox.destroy();
|
||||
_loadText.destroy();
|
||||
_textBox = null;
|
||||
_loadText = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function setProgress(param1:int) : void
|
||||
{
|
||||
_content.loadBar.gotoAndStop(param1 + 1);
|
||||
}
|
||||
|
||||
public function updateText() : void
|
||||
{
|
||||
if(_textBox)
|
||||
{
|
||||
_textBox.displayText();
|
||||
}
|
||||
if(_loadText)
|
||||
{
|
||||
_loadText.localizeTextBox();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package loadProgress
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.Event;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class LoadProgressLoadText extends MovieClip
|
||||
{
|
||||
|
||||
private var _loadText:MovieClip;
|
||||
|
||||
private var _loadStatus0:Array = [6652,15751,15752,15753,15754,15755,15756,15757,15758,15759,15761,15762,15763,15765,15766,15767,15768,15769,15770,15771,15772];
|
||||
|
||||
private var _loadStatus1:Array = [31552,31553,31554,31555,31556,31557,31558,31559,31560,31561,31562,31563,31564,31565,31566,31567,31568,31569,31570,31571,31572,31573,31574,31575,31576,31577,31578,31579,31580,31581,31582,31583,31584,31585,31586,31587,31588,32631,32632];
|
||||
|
||||
private var _frameCounter:int = 1;
|
||||
|
||||
private var _currentText:int = 0;
|
||||
|
||||
private var _holdTime:int;
|
||||
|
||||
private var _holdOn:Boolean = false;
|
||||
|
||||
private var _lptb:LoadProgressTextBox;
|
||||
|
||||
public function LoadProgressLoadText(param1:MovieClip, param2:LoadProgressTextBox)
|
||||
{
|
||||
super();
|
||||
_loadText = param1;
|
||||
_lptb = param2;
|
||||
gMainFrame.stage.addEventListener("enterFrame",changeText,false,0,true);
|
||||
_currentText = Math.floor(Math.random() * this["_loadStatus" + _lptb.headingNum].length);
|
||||
localizeTextBox();
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
gMainFrame.stage.removeEventListener("enterFrame",changeText);
|
||||
_loadStatus0 = null;
|
||||
_loadStatus1 = null;
|
||||
_loadText = null;
|
||||
}
|
||||
|
||||
public function changeText(param1:Event) : void
|
||||
{
|
||||
if(!_holdOn)
|
||||
{
|
||||
_holdTime = Math.ceil(Math.random() * 50) + 50;
|
||||
_holdOn = true;
|
||||
}
|
||||
if(_frameCounter >= _holdTime)
|
||||
{
|
||||
localizeTextBox();
|
||||
_frameCounter = 1;
|
||||
_currentText = _currentText + 1;
|
||||
if(_currentText >= this["_loadStatus" + _lptb.headingNum].length)
|
||||
{
|
||||
_currentText = 0;
|
||||
}
|
||||
_holdOn = false;
|
||||
}
|
||||
_frameCounter = _frameCounter + 1;
|
||||
}
|
||||
|
||||
public function localizeTextBox() : void
|
||||
{
|
||||
if(LocalizationManager.hasLocalizations)
|
||||
{
|
||||
LocalizationManager.translateId(_loadText.textBox,this["_loadStatus" + _lptb.headingNum][_currentText]);
|
||||
_loadText.textBox.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loadText.textBox.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
package loadProgress
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class LoadProgressTextBox extends MovieClip
|
||||
{
|
||||
|
||||
private var _textBox:MovieClip;
|
||||
|
||||
private var _headings:Array = new Array(6654,15774);
|
||||
|
||||
private var _messages:Array = new Array(31589,31590,31591,31592,31593,31594,31595,31596,31597,31598,31599,31600,31601,31602,31603,31604,31605,31606,31607,31608,31609,31610,31611,31612,31613,31614);
|
||||
|
||||
private var _headingNum:int = 0;
|
||||
|
||||
private var _textNum:int = 0;
|
||||
|
||||
public function LoadProgressTextBox(param1:MovieClip)
|
||||
{
|
||||
super();
|
||||
_textBox = param1;
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
_headings = null;
|
||||
_messages = null;
|
||||
_textBox = null;
|
||||
}
|
||||
|
||||
public function get headingNum() : int
|
||||
{
|
||||
return _headingNum;
|
||||
}
|
||||
|
||||
public function displayText(param1:Boolean = false) : void
|
||||
{
|
||||
if(param1 == false)
|
||||
{
|
||||
if(_textNum >= _messages.length && _headingNum == 0)
|
||||
{
|
||||
_textNum = 0;
|
||||
_headingNum = 1;
|
||||
_textBox.paw.visible = false;
|
||||
}
|
||||
if(_textNum >= _messages.length && _headingNum == 1)
|
||||
{
|
||||
_textNum = 0;
|
||||
_headingNum = 0;
|
||||
_textBox.paw.visible = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_headingNum = Math.floor(Math.random() * 2);
|
||||
_textNum = Math.floor(Math.random() * 5);
|
||||
_textBox.paw.visible = _headingNum == 0;
|
||||
}
|
||||
if(LocalizationManager.hasLocalizations)
|
||||
{
|
||||
LocalizationManager.translateId(_textBox.messageText,_messages[_textNum]);
|
||||
LocalizationManager.translateId(_textBox.headingText,_headings[_headingNum]);
|
||||
_textBox.messageText.visible = true;
|
||||
_textBox.headingText.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_textBox.messageText.visible = false;
|
||||
_textBox.headingText.visible = false;
|
||||
}
|
||||
_textNum = _textNum + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user