mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-20 17:37: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,439 @@
|
||||
package game
|
||||
{
|
||||
import com.sbi.loader.LoaderCacheEntry_URL;
|
||||
import com.sbi.loader.LoaderEvent;
|
||||
import com.sbi.loader.SceneLoader;
|
||||
import com.sbi.popup.SBOkPopup;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
import flash.events.KeyboardEvent;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.media.Sound;
|
||||
import flash.media.SoundTransform;
|
||||
import flash.utils.getTimer;
|
||||
import gui.GuiManager;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class GameBase extends Sprite
|
||||
{
|
||||
|
||||
private var _activeDlgMC:MovieClip;
|
||||
|
||||
private var _activeDlg:GuiDialog;
|
||||
|
||||
private var _guiButtons:Array;
|
||||
|
||||
private var _gemMultiplierMC:MovieClip;
|
||||
|
||||
private var _gemMultiplierMediaHelper:MediaHelper;
|
||||
|
||||
private var _gameLoader:LoaderCacheEntry_URL;
|
||||
|
||||
private var _sceneName:String;
|
||||
|
||||
protected var _pauseGame:Boolean;
|
||||
|
||||
private var _trackerVal:Array;
|
||||
|
||||
protected var _scene:SceneLoader;
|
||||
|
||||
protected var _closeBtn:MovieClip;
|
||||
|
||||
protected var _guiLayer:Sprite;
|
||||
|
||||
private var _gameStartTime:int;
|
||||
|
||||
public var _totalGemsEarned:int;
|
||||
|
||||
protected var _gameIdleTimer:Number;
|
||||
|
||||
private var _trackerMain:Array;
|
||||
|
||||
private var _lastIdleTimer:Number;
|
||||
|
||||
private var _kickPopup:SBOkPopup;
|
||||
|
||||
protected var _miniGameDefID:int;
|
||||
|
||||
private var _inRoomGame:Boolean;
|
||||
|
||||
private var _trackerNum:Array;
|
||||
|
||||
public function GameBase()
|
||||
{
|
||||
super();
|
||||
MinigameManager._pvpPromptReplay = false;
|
||||
this._miniGameDefID = MinigameManager.minigameInfoCache.currMinigameId;
|
||||
this._trackerVal = new Array();
|
||||
this._trackerNum = new Array();
|
||||
this._trackerMain = new Array();
|
||||
if(this._miniGameDefID != -1)
|
||||
{
|
||||
this._inRoomGame = MinigameManager.minigameInfoCache.getMinigameInfo(this._miniGameDefID).isInRoomGame;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._inRoomGame = false;
|
||||
}
|
||||
this._gameIdleTimer = 0;
|
||||
this._totalGemsEarned = 0;
|
||||
this._guiButtons = [];
|
||||
this._gameStartTime = getTimer();
|
||||
}
|
||||
|
||||
protected function loadScene(param1:String) : void
|
||||
{
|
||||
this._sceneName = param1;
|
||||
this._gemMultiplierMediaHelper = new MediaHelper();
|
||||
this._gemMultiplierMediaHelper.init(1067,this.gemMultiplierMediaHandler);
|
||||
}
|
||||
|
||||
private function gemMultiplierMediaHandler(param1:MovieClip) : void
|
||||
{
|
||||
this._gemMultiplierMC = param1;
|
||||
this._gameLoader = new LoaderCacheEntry_URL(MainFrame.ROOMS_FOLDER + this._sceneName.toLowerCase());
|
||||
this._gameLoader.addEventListener(LoaderEvent.ON_LOAD_COMPLETE,this.loadComplete);
|
||||
this._gameLoader.load();
|
||||
}
|
||||
|
||||
private function loadComplete(param1:LoaderEvent) : void
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
_loc2_ = this._gameLoader.data;
|
||||
this._gameLoader.removeEventListener(LoaderEvent.ON_LOAD_COMPLETE,this.loadComplete);
|
||||
this._scene = new SceneLoader();
|
||||
this._scene.setScene(_loc2_,true);
|
||||
this._scene.addEventListener(Event.COMPLETE,this.sceneLoaded,false,0,true);
|
||||
}
|
||||
|
||||
protected function releaseBase() : void
|
||||
{
|
||||
var _loc2_:GuiButton = null;
|
||||
var _loc1_:Number = (getTimer() - this._gameStartTime) / 1000;
|
||||
if(this._kickPopup != null)
|
||||
{
|
||||
this._kickPopup.destroy();
|
||||
this._kickPopup = null;
|
||||
}
|
||||
stage.removeEventListener(KeyboardEvent.KEY_DOWN,this.resetKeyIdleTimer,false);
|
||||
stage.removeEventListener(MouseEvent.MOUSE_DOWN,this.resetMouseDownIdleTimer,false);
|
||||
stage.removeEventListener(MouseEvent.MOUSE_MOVE,this.resetMouseMoveIdleTimer,false);
|
||||
stage.removeEventListener(Event.ENTER_FRAME,this.gameBaseHeartbeat);
|
||||
for each(_loc2_ in this._guiButtons)
|
||||
{
|
||||
_loc2_.release();
|
||||
}
|
||||
this._guiButtons = [];
|
||||
if(this._scene)
|
||||
{
|
||||
this._scene.release();
|
||||
}
|
||||
this._gameLoader = null;
|
||||
}
|
||||
|
||||
protected function sceneLoaded(param1:Event) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc4_:Object = null;
|
||||
this._scene.removeEventListener(Event.COMPLETE,this.sceneLoaded);
|
||||
param1 = new Event(Event.COMPLETE);
|
||||
dispatchEvent(param1);
|
||||
var _loc3_:Array = this._scene.getActorList("ActorLayer");
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _loc3_.length)
|
||||
{
|
||||
_loc4_ = _loc3_[_loc2_];
|
||||
if(_loc4_.s.content is MovieClip)
|
||||
{
|
||||
LocalizationManager.findAllTextfields(_loc4_.s.content);
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
this._lastIdleTimer = getTimer();
|
||||
stage.addEventListener(KeyboardEvent.KEY_DOWN,this.resetKeyIdleTimer,false);
|
||||
stage.addEventListener(MouseEvent.MOUSE_DOWN,this.resetMouseDownIdleTimer,false);
|
||||
stage.addEventListener(MouseEvent.MOUSE_MOVE,this.resetMouseMoveIdleTimer,false);
|
||||
stage.addEventListener(Event.ENTER_FRAME,this.gameBaseHeartbeat);
|
||||
}
|
||||
|
||||
private function gameBaseHeartbeat(param1:Event) : void
|
||||
{
|
||||
var _loc2_:Number = (getTimer() - this._lastIdleTimer) / 1000;
|
||||
this._lastIdleTimer = getTimer();
|
||||
if(this._inRoomGame == false)
|
||||
{
|
||||
this._gameIdleTimer += _loc2_;
|
||||
if(this._gameIdleTimer > 3 * 60)
|
||||
{
|
||||
if(this._gameIdleTimer > 4 * 60)
|
||||
{
|
||||
if(this.hasOwnProperty("end"))
|
||||
{
|
||||
this["end"](null);
|
||||
}
|
||||
}
|
||||
else if(this._kickPopup == null)
|
||||
{
|
||||
this._kickPopup = new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14681),false,this.onKickWarningPopup);
|
||||
AJAudio.playIdleWarningSound();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onKickWarningPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
SBOkPopup.destroyInParentChain(param1.target.parent);
|
||||
this._kickPopup = null;
|
||||
this._gameIdleTimer = 0;
|
||||
}
|
||||
|
||||
private function resetKeyIdleTimer(param1:KeyboardEvent) : void
|
||||
{
|
||||
if(this._kickPopup != null)
|
||||
{
|
||||
this._kickPopup.destroy();
|
||||
this._kickPopup = null;
|
||||
}
|
||||
this._gameIdleTimer = 0;
|
||||
}
|
||||
|
||||
private function resetMouseMoveIdleTimer(param1:MouseEvent) : void
|
||||
{
|
||||
if(this._kickPopup == null)
|
||||
{
|
||||
this._gameIdleTimer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private function resetMouseDownIdleTimer(param1:Event) : void
|
||||
{
|
||||
if(this._kickPopup != null)
|
||||
{
|
||||
this._kickPopup.destroy();
|
||||
this._kickPopup = null;
|
||||
}
|
||||
this._gameIdleTimer = 0;
|
||||
}
|
||||
|
||||
protected function showGemMultiplierDlg(param1:Function) : MovieClip
|
||||
{
|
||||
var _loc2_:Number = NaN;
|
||||
var _loc3_:MovieClip = null;
|
||||
if(this._totalGemsEarned > 0)
|
||||
{
|
||||
_loc2_ = 1;
|
||||
if(this._miniGameDefID != -1)
|
||||
{
|
||||
_loc2_ = MinigameManager.minigameInfoCache.getMinigameInfo(this._miniGameDefID).gemMultiplier;
|
||||
}
|
||||
if(_loc2_ > 1)
|
||||
{
|
||||
if(this._activeDlg != null)
|
||||
{
|
||||
this.hideDlg();
|
||||
}
|
||||
if(this._activeDlg == null && Boolean(this._gemMultiplierMC))
|
||||
{
|
||||
if(this._closeBtn)
|
||||
{
|
||||
this._closeBtn.visible = false;
|
||||
}
|
||||
this._pauseGame = true;
|
||||
_loc3_ = this._gemMultiplierMC.getChildAt(0) as MovieClip;
|
||||
this._guiLayer.addChild(_loc3_);
|
||||
this._activeDlg = new GuiDialog(_loc3_,[{
|
||||
"name":"x_btn",
|
||||
"f":param1
|
||||
}]);
|
||||
this._activeDlgMC = _loc3_;
|
||||
_loc3_.x = 450;
|
||||
_loc3_.y = 275;
|
||||
_loc3_.Gems_Earned.text = this._totalGemsEarned / _loc2_;
|
||||
_loc3_.Gem_Bonus.text = _loc2_ + "x";
|
||||
_loc3_.Gems_Total.text = this._totalGemsEarned;
|
||||
return _loc3_;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function showDlg(param1:String, param2:Array, param3:Boolean = true) : MovieClip
|
||||
{
|
||||
var _loc4_:MovieClip = null;
|
||||
if(!param3)
|
||||
{
|
||||
_loc4_ = GETDEFINITIONBYNAME(param1);
|
||||
this._guiLayer.addChild(_loc4_);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(this._activeDlg != null)
|
||||
{
|
||||
this.hideDlg();
|
||||
}
|
||||
if(this._activeDlg == null)
|
||||
{
|
||||
if(this._closeBtn)
|
||||
{
|
||||
this._closeBtn.visible = false;
|
||||
}
|
||||
this._pauseGame = true;
|
||||
_loc4_ = GETDEFINITIONBYNAME(param1);
|
||||
this._guiLayer.addChild(_loc4_);
|
||||
this._activeDlg = new GuiDialog(_loc4_,param2);
|
||||
this._activeDlgMC = _loc4_;
|
||||
}
|
||||
}
|
||||
return _loc4_;
|
||||
}
|
||||
|
||||
protected function hideDlg() : void
|
||||
{
|
||||
if(this._activeDlg)
|
||||
{
|
||||
this._activeDlg.release();
|
||||
this._guiLayer.removeChild(this._activeDlgMC);
|
||||
this._activeDlg = null;
|
||||
this._activeDlgMC = null;
|
||||
this._pauseGame = false;
|
||||
if(this._closeBtn)
|
||||
{
|
||||
this._closeBtn.visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function addBtn(param1:String, param2:int, param3:int, param4:Function) : MovieClip
|
||||
{
|
||||
var _loc5_:MovieClip = GETDEFINITIONBYNAME(param1);
|
||||
_loc5_.x = param2;
|
||||
_loc5_.y = param3;
|
||||
this._guiLayer.addChild(_loc5_);
|
||||
var _loc6_:GuiButton = new GuiButton(_loc5_,param4);
|
||||
this._guiButtons.push(_loc6_);
|
||||
return _loc5_;
|
||||
}
|
||||
|
||||
private function mainTracker() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
if(this._miniGameDefID != -1)
|
||||
{
|
||||
_loc1_ = MinigameManager.minigameInfoCache.getMinigameInfo(this._miniGameDefID).lbUseVarRef;
|
||||
}
|
||||
this._trackerNum.push(this._trackerMain[this._trackerMain.length - 1] - _loc1_ * 7 - 78922);
|
||||
this.numTracker();
|
||||
}
|
||||
|
||||
protected function loadSound(param1:Class) : Sound
|
||||
{
|
||||
var _loc2_:Sound = new param1() as Sound;
|
||||
var _loc3_:SoundTransform = new SoundTransform(0,0);
|
||||
_loc2_.play(0,0,_loc3_);
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
public function valueTrackerCommit() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
if(this._miniGameDefID != -1)
|
||||
{
|
||||
_loc1_ = MinigameManager.minigameInfoCache.getMinigameInfo(this._miniGameDefID).lbUseVarRef;
|
||||
if(_loc1_ != 0)
|
||||
{
|
||||
MinigameManager.sendScore(this._trackerMain[this._trackerMain.length - 1],this._trackerVal[this._trackerVal.length - 1],this._trackerNum[this._trackerNum.length - 1],_loc1_,this._miniGameDefID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function removeLayer(param1:Sprite) : void
|
||||
{
|
||||
while(param1.numChildren)
|
||||
{
|
||||
param1.removeChild(param1.getChildAt(0));
|
||||
}
|
||||
param1.parent.removeChild(param1);
|
||||
}
|
||||
|
||||
protected function addToPetMastery(param1:int) : void
|
||||
{
|
||||
MinigameManager.awardPetMasteryPoints(param1);
|
||||
}
|
||||
|
||||
private function numTracker() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
if(this._miniGameDefID != -1)
|
||||
{
|
||||
_loc1_ = MinigameManager.minigameInfoCache.getMinigameInfo(this._miniGameDefID).lbUseVarRef;
|
||||
}
|
||||
this._trackerVal.push(this._trackerNum[this._trackerNum.length - 1] - _loc1_ * 9 + 15645);
|
||||
}
|
||||
|
||||
protected function addGemsToBalance(param1:int) : void
|
||||
{
|
||||
var _loc2_:Number = 1;
|
||||
if(this._miniGameDefID != -1)
|
||||
{
|
||||
_loc2_ = MinigameManager.minigameInfoCache.getMinigameInfo(this._miniGameDefID).gemMultiplier;
|
||||
}
|
||||
if(_loc2_ > 1)
|
||||
{
|
||||
param1 *= _loc2_;
|
||||
}
|
||||
this._totalGemsEarned += param1;
|
||||
MinigameManager.awardGems(param1,this._miniGameDefID);
|
||||
}
|
||||
|
||||
public function valueTrackerCurrent() : Number
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
if(this._trackerMain.length > 0)
|
||||
{
|
||||
_loc1_ = 0;
|
||||
if(this._miniGameDefID != -1)
|
||||
{
|
||||
_loc1_ = MinigameManager.minigameInfoCache.getMinigameInfo(this._miniGameDefID).lbUseVarRef;
|
||||
}
|
||||
return 9999999 - (this._trackerMain[this._trackerMain.length - 1] - _loc1_ * 5 + MinigameManager.getScoreSN());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function getScene() : SceneLoader
|
||||
{
|
||||
return this._scene;
|
||||
}
|
||||
|
||||
public function getPaused() : Boolean
|
||||
{
|
||||
return this._pauseGame;
|
||||
}
|
||||
|
||||
public function getGuiLayer() : Sprite
|
||||
{
|
||||
return this._guiLayer;
|
||||
}
|
||||
|
||||
public function valueTracker(param1:Number) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
if(this._miniGameDefID != -1)
|
||||
{
|
||||
_loc2_ = MinigameManager.minigameInfoCache.getMinigameInfo(this._miniGameDefID).lbUseVarRef;
|
||||
}
|
||||
this._trackerMain.push(9999999 - (param1 - _loc2_ * 5 + MinigameManager.getScoreSN()));
|
||||
if(this._trackerMain.length >= 3)
|
||||
{
|
||||
this._trackerMain.shift();
|
||||
}
|
||||
this.mainTracker();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package game
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
|
||||
public class GuiButton
|
||||
{
|
||||
|
||||
private var _mc:MovieClip;
|
||||
|
||||
private var _clickFunc:Function;
|
||||
|
||||
public function GuiButton(param1:MovieClip, param2:Function)
|
||||
{
|
||||
super();
|
||||
this._mc = param1;
|
||||
this._clickFunc = param2;
|
||||
this._mc.addEventListener(MouseEvent.ROLL_OVER,this.mouseOver);
|
||||
this._mc.addEventListener(MouseEvent.ROLL_OUT,this.mouseOut);
|
||||
this._mc.addEventListener(MouseEvent.MOUSE_DOWN,this.mouseClick);
|
||||
this._mc.gotoAndStop("off");
|
||||
}
|
||||
|
||||
public function release() : void
|
||||
{
|
||||
this._mc.removeEventListener(MouseEvent.ROLL_OVER,this.mouseOver);
|
||||
this._mc.removeEventListener(MouseEvent.ROLL_OUT,this.mouseOut);
|
||||
this._mc.removeEventListener(MouseEvent.MOUSE_DOWN,this.mouseClick);
|
||||
this._mc.parent.removeChild(this._mc);
|
||||
this._mc = null;
|
||||
}
|
||||
|
||||
private function mouseOver(param1:MouseEvent) : void
|
||||
{
|
||||
if(this._mc.currentFrameLabel != "on")
|
||||
{
|
||||
this._mc.gotoAndPlay("on");
|
||||
}
|
||||
AJAudio.playHudBtnRollover();
|
||||
}
|
||||
|
||||
private function mouseOut(param1:MouseEvent) : void
|
||||
{
|
||||
if(this._mc.currentFrameLabel != "off")
|
||||
{
|
||||
this._mc.gotoAndPlay("off");
|
||||
}
|
||||
}
|
||||
|
||||
private function mouseClick(param1:MouseEvent) : void
|
||||
{
|
||||
this._clickFunc();
|
||||
AJAudio.playHudBtnClick();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package game
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
|
||||
public class GuiDialog
|
||||
{
|
||||
|
||||
private var _mc:MovieClip;
|
||||
|
||||
private var _buttons:Array;
|
||||
|
||||
public function GuiDialog(param1:MovieClip, param2:Array)
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:Object = null;
|
||||
var _loc5_:MovieClip = null;
|
||||
var _loc6_:GuiButton = null;
|
||||
var _loc7_:String = null;
|
||||
var _loc8_:Object = null;
|
||||
var _loc9_:String = null;
|
||||
super();
|
||||
this._mc = param1;
|
||||
this._buttons = [];
|
||||
while(_loc3_ < param2.length)
|
||||
{
|
||||
_loc4_ = param2[_loc3_];
|
||||
_loc5_ = this._mc[_loc4_.name];
|
||||
if(!_loc5_)
|
||||
{
|
||||
_loc7_ = _loc4_.name;
|
||||
_loc8_ = this._mc;
|
||||
while(_loc7_.indexOf(".") != -1)
|
||||
{
|
||||
_loc9_ = _loc7_.substring(0,_loc7_.indexOf("."));
|
||||
_loc8_ = _loc8_[_loc9_];
|
||||
_loc7_ = _loc7_.substring(_loc7_.indexOf(".") + 1,_loc7_.length);
|
||||
}
|
||||
_loc5_ = _loc8_[_loc7_];
|
||||
if(!_loc5_)
|
||||
{
|
||||
throw new Error("ERROR: Button Not Found:\" " + _loc4_.name + "\" verify button names across SWF files.");
|
||||
}
|
||||
}
|
||||
_loc6_ = new GuiButton(_loc5_,_loc4_.f);
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
|
||||
public function release() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
while(_loc1_ < this._buttons.length)
|
||||
{
|
||||
this._buttons.release();
|
||||
_loc1_++;
|
||||
}
|
||||
this._buttons = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package game
|
||||
{
|
||||
public interface IMinigame
|
||||
{
|
||||
|
||||
function start(param1:uint, param2:Array, param3:Function, param4:Function) : void;
|
||||
|
||||
function message(param1:Array) : void;
|
||||
|
||||
function end(param1:Array) : void;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
package game
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import loader.MediaHelper;
|
||||
|
||||
public class MinigameInfo
|
||||
{
|
||||
|
||||
public var gameDefId:uint;
|
||||
|
||||
public var titleStrId:uint;
|
||||
|
||||
public var extName:String;
|
||||
|
||||
public var swfName:String;
|
||||
|
||||
public var minPlayers:uint;
|
||||
|
||||
public var maxPlayers:uint;
|
||||
|
||||
public var maxSpectators:uint;
|
||||
|
||||
public var type:uint;
|
||||
|
||||
public var gameCardMediaId:uint;
|
||||
|
||||
public var gameCountUserVarRef:uint;
|
||||
|
||||
public var custom1UserVarRef:uint;
|
||||
|
||||
public var custom2UserVarRef:uint;
|
||||
|
||||
public var readyForPVP:Boolean;
|
||||
|
||||
public var gemMultiplier:Number;
|
||||
|
||||
public var petDefId:int;
|
||||
|
||||
public var proModeUserVarRefId:int;
|
||||
|
||||
public var lbUseVarRef:int;
|
||||
|
||||
private var _gameCardScreen:MovieClip;
|
||||
|
||||
private var _hasLoadedScreen:Boolean;
|
||||
|
||||
public function MinigameInfo()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:uint, param2:uint, param3:String, param4:String, param5:uint, param6:uint, param7:uint, param8:uint, param9:uint, param10:uint, param11:uint, param12:uint, param13:uint, param14:Number, param15:MovieClip, param16:int, param17:int, param18:int) : void
|
||||
{
|
||||
this.gameDefId = param1;
|
||||
this.titleStrId = param2;
|
||||
this.extName = param3;
|
||||
this.swfName = param4;
|
||||
this.minPlayers = param5;
|
||||
this.maxPlayers = param6;
|
||||
this.maxSpectators = param7;
|
||||
this.type = param8;
|
||||
this.gameCardMediaId = param9;
|
||||
this.gameCountUserVarRef = param10;
|
||||
this.custom1UserVarRef = param11;
|
||||
this.custom2UserVarRef = param12;
|
||||
this.readyForPVP = param13 != 0;
|
||||
this.gemMultiplier = param14;
|
||||
this.gameCardScreen = param15;
|
||||
this.petDefId = param16;
|
||||
this.proModeUserVarRefId = param17;
|
||||
this.lbUseVarRef = param18;
|
||||
}
|
||||
|
||||
public function get isInRoomGame() : Boolean
|
||||
{
|
||||
return this.type == 0;
|
||||
}
|
||||
|
||||
public function get gameCardScreen() : MovieClip
|
||||
{
|
||||
var _loc1_:MediaHelper = null;
|
||||
if(this._hasLoadedScreen)
|
||||
{
|
||||
return this._gameCardScreen;
|
||||
}
|
||||
this._gameCardScreen = new MovieClip();
|
||||
_loc1_ = new MediaHelper();
|
||||
_loc1_.init(this.gameCardMediaId,this.onScreenLoaded);
|
||||
return this._gameCardScreen;
|
||||
}
|
||||
|
||||
public function set gameCardScreen(param1:MovieClip) : void
|
||||
{
|
||||
if(param1 != null)
|
||||
{
|
||||
this._hasLoadedScreen = true;
|
||||
}
|
||||
this._gameCardScreen = param1;
|
||||
}
|
||||
|
||||
private function onScreenLoaded(param1:MovieClip) : void
|
||||
{
|
||||
this._gameCardScreen.addChild(param1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package game
|
||||
{
|
||||
public class MinigameInfoCache
|
||||
{
|
||||
|
||||
public var currMinigameId:int;
|
||||
|
||||
private var minigameInfo:Object;
|
||||
|
||||
public function MinigameInfoCache()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init() : void
|
||||
{
|
||||
this.minigameInfo = new Object();
|
||||
this.currMinigameId = -1;
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
this.minigameInfo = null;
|
||||
}
|
||||
|
||||
public function get playerMinigameInfo() : MinigameInfo
|
||||
{
|
||||
return this.minigameInfo[this.currMinigameId];
|
||||
}
|
||||
|
||||
public function set playerMinigameInfo(param1:MinigameInfo) : void
|
||||
{
|
||||
this.currMinigameId = param1.gameDefId;
|
||||
this.minigameInfo[this.currMinigameId] = param1;
|
||||
}
|
||||
|
||||
public function getMinigameInfo(param1:int) : MinigameInfo
|
||||
{
|
||||
return this.minigameInfo[param1];
|
||||
}
|
||||
|
||||
public function getMinigameInfoByExtName(param1:String) : MinigameInfo
|
||||
{
|
||||
var _loc2_:MinigameInfo = null;
|
||||
for each(_loc2_ in this.minigameInfo)
|
||||
{
|
||||
if(_loc2_.extName == param1)
|
||||
{
|
||||
return _loc2_;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getMinigameInfoBySwfName(param1:String) : MinigameInfo
|
||||
{
|
||||
var _loc2_:MinigameInfo = null;
|
||||
for each(_loc2_ in this.minigameInfo)
|
||||
{
|
||||
if(_loc2_.swfName == param1)
|
||||
{
|
||||
return _loc2_;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getAllReadyForPvpGameDefs() : Array
|
||||
{
|
||||
var _loc1_:Array = null;
|
||||
var _loc2_:MinigameInfo = null;
|
||||
if(this.minigameInfo)
|
||||
{
|
||||
_loc1_ = [];
|
||||
for each(_loc2_ in this.minigameInfo)
|
||||
{
|
||||
if(_loc2_.readyForPVP)
|
||||
{
|
||||
_loc1_.push(_loc2_);
|
||||
}
|
||||
}
|
||||
_loc1_.sortOn(["gameDefId"],[Array.DESCENDING]);
|
||||
return _loc1_;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function setMinigameInfo(param1:int, param2:MinigameInfo) : void
|
||||
{
|
||||
this.minigameInfo[param1] = param2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,31 @@
|
||||
package game
|
||||
{
|
||||
import flash.utils.ByteArray;
|
||||
import mx.core.MovieClipLoaderAsset;
|
||||
|
||||
[Embed(source="/_assets/assets.swf", symbol="symbol6")]
|
||||
public class MinigameManager_GameTotem extends MovieClipLoaderAsset
|
||||
{
|
||||
|
||||
private static var bytes:ByteArray = null;
|
||||
|
||||
public var dataClass:Class = MinigameManager_GameTotem_dataClass;
|
||||
|
||||
public function MinigameManager_GameTotem()
|
||||
{
|
||||
super();
|
||||
initialWidth = 2000 / 20;
|
||||
initialHeight = 3000 / 20;
|
||||
}
|
||||
|
||||
override public function get movieClipData() : ByteArray
|
||||
{
|
||||
if(bytes == null)
|
||||
{
|
||||
bytes = ByteArray(new this.dataClass());
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package game
|
||||
{
|
||||
import mx.core.ByteArrayAsset;
|
||||
|
||||
[Embed(source="/_assets/9_game.MinigameManager_GameTotem_dataClass.bin", mimeType="application/octet-stream")]
|
||||
public class MinigameManager_GameTotem_dataClass extends ByteArrayAsset
|
||||
{
|
||||
|
||||
public function MinigameManager_GameTotem_dataClass()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
package game
|
||||
{
|
||||
import com.sbi.client.SFEvent;
|
||||
|
||||
public class MinigameXtCommManager
|
||||
{
|
||||
|
||||
private static var _miCallback:Function;
|
||||
|
||||
public static const PVP_REQUEST_OR_ACCEPT:int = 0;
|
||||
|
||||
public static const PVP_DENY_DENIED_OR_CANCEL:int = 1;
|
||||
|
||||
public function MinigameXtCommManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function init() : void
|
||||
{
|
||||
XtReplyDemuxer.addModule(handleXtReply,"m");
|
||||
}
|
||||
|
||||
public static function destroy() : void
|
||||
{
|
||||
XtReplyDemuxer.removeModule(handleXtReply);
|
||||
}
|
||||
|
||||
public static function sendMinigameInfoRequest(param1:Array, param2:Boolean = false, param3:Function = null) : void
|
||||
{
|
||||
_miCallback = param3;
|
||||
gMainFrame.server.setXtObject_Str("mi",param1,true,param2);
|
||||
}
|
||||
|
||||
public static function sendMinigameJoinRequest(param1:int, param2:Boolean = false, param3:Boolean = false, param4:int = 0) : void
|
||||
{
|
||||
var _loc5_:Array = [param1,param3 ? "1" : "0",param4];
|
||||
gMainFrame.server.setXtObject_Str("mj",_loc5_,true,param2);
|
||||
}
|
||||
|
||||
public static function sendMinigameStartRequest(param1:int, param2:Boolean = false) : void
|
||||
{
|
||||
var _loc3_:Array = [param1];
|
||||
gMainFrame.server.setXtObject_Str("ms",_loc3_,true,param2);
|
||||
}
|
||||
|
||||
public static function sendMinigameLeaveRequest() : void
|
||||
{
|
||||
gMainFrame.server.setXtObject_Str("ml",null,true,true);
|
||||
}
|
||||
|
||||
public static function sendMinigameMessageRequest(param1:Array, param2:Boolean) : void
|
||||
{
|
||||
gMainFrame.server.setXtObject_Str("mm",param1,true,param2);
|
||||
}
|
||||
|
||||
public static function sendMinigamePvpMsg(param1:int, param2:int, param3:String = "") : void
|
||||
{
|
||||
if(param3 != "")
|
||||
{
|
||||
gMainFrame.server.setXtObject_Str("mp",[param1,param2,param3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
gMainFrame.server.setXtObject_Str("mp",[param1,param2]);
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendMinigameCustomPvpJoinMsg(param1:int, param2:int, param3:String) : void
|
||||
{
|
||||
gMainFrame.server.setXtObject_Str("mcp",[param1,param2,param3]);
|
||||
}
|
||||
|
||||
public static function sendMinigameLeaderboardRequest(param1:int) : void
|
||||
{
|
||||
var _loc2_:Array = [param1];
|
||||
gMainFrame.server.setXtObject_Str("mlb",_loc2_);
|
||||
}
|
||||
|
||||
public static function handleXtReply(param1:SFEvent) : void
|
||||
{
|
||||
var _loc2_:* = param1.obj;
|
||||
switch(_loc2_[0])
|
||||
{
|
||||
case "mi":
|
||||
handleMinigameInfo(_loc2_);
|
||||
break;
|
||||
case "ms":
|
||||
MinigameManager.startGame(_loc2_);
|
||||
break;
|
||||
case "mj":
|
||||
MinigameManager.joinGameResponse(_loc2_);
|
||||
break;
|
||||
case "ml":
|
||||
case "mm":
|
||||
MinigameManager.messageGame(_loc2_);
|
||||
break;
|
||||
case "me":
|
||||
MinigameManager.minigameEndResponse(_loc2_);
|
||||
break;
|
||||
case "mr":
|
||||
MinigameManager.minigameRoomRemovedResponse(_loc2_);
|
||||
break;
|
||||
case "mp":
|
||||
MinigameManager.pvpResponse(_loc2_);
|
||||
break;
|
||||
case "mg":
|
||||
MinigameManager.minigameGems(_loc2_);
|
||||
break;
|
||||
case "ma":
|
||||
MinigameManager.minigamePetMastery(_loc2_);
|
||||
break;
|
||||
case "mlb":
|
||||
MinigameManager.leaderBoardResponse(_loc2_);
|
||||
break;
|
||||
default:
|
||||
throw new Error("MinigameManager illegal data:" + _loc2_[0]);
|
||||
}
|
||||
}
|
||||
|
||||
private static function handleMinigameInfo(param1:Object) : void
|
||||
{
|
||||
var _loc5_:MinigameInfo = null;
|
||||
var _loc2_:* = 2;
|
||||
var _loc3_:int = parseInt(param1[_loc2_++]);
|
||||
var _loc4_:int = 0;
|
||||
while(_loc4_ < _loc3_)
|
||||
{
|
||||
_loc5_ = new MinigameInfo();
|
||||
_loc5_.init(parseInt(param1[_loc2_++]),parseInt(param1[_loc2_++]),param1[_loc2_++],param1[_loc2_++],parseInt(param1[_loc2_++]),parseInt(param1[_loc2_++]),parseInt(param1[_loc2_++]),parseInt(param1[_loc2_++]),parseInt(param1[_loc2_++]),parseInt(param1[_loc2_++]),parseInt(param1[_loc2_++]),parseInt(param1[_loc2_++]),parseInt(param1[_loc2_++]),parseFloat(param1[_loc2_++]),null,parseInt(param1[_loc2_++]),parseInt(param1[_loc2_++]),parseInt(param1[_loc2_++]));
|
||||
MinigameManager.minigameInfoCache.setMinigameInfo(_loc5_.gameDefId,_loc5_);
|
||||
_loc4_++;
|
||||
}
|
||||
if(_miCallback != null)
|
||||
{
|
||||
_miCallback();
|
||||
_miCallback = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,237 @@
|
||||
package game
|
||||
{
|
||||
import com.sbi.corelib.audio.SBAudio;
|
||||
import com.sbi.corelib.audio.SBMusic;
|
||||
import com.sbi.loader.LoaderCache;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.Event;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.media.Sound;
|
||||
import flash.media.SoundChannel;
|
||||
import flash.media.SoundTransform;
|
||||
import flash.utils.Dictionary;
|
||||
|
||||
public class SoundManager
|
||||
{
|
||||
|
||||
private static const BARWIDTH:int = 136;
|
||||
|
||||
public var _soundVolume:Dictionary;
|
||||
|
||||
public var _soundChannel:Dictionary;
|
||||
|
||||
public var _sound:Dictionary;
|
||||
|
||||
private var _soundsPlaying:Dictionary;
|
||||
|
||||
private var _soundLimit:int;
|
||||
|
||||
public var _sounds:Array;
|
||||
|
||||
public var _soundToolInstace:MovieClip;
|
||||
|
||||
public var _barSound:Dictionary;
|
||||
|
||||
public var _minigame:GameBase;
|
||||
|
||||
private var _currentDragger:MovieClip;
|
||||
|
||||
private var _soundVolumeByName:Dictionary;
|
||||
|
||||
public function SoundManager(param1:GameBase, param2:int = 0)
|
||||
{
|
||||
super();
|
||||
this._soundVolume = new Dictionary(true);
|
||||
this._barSound = new Dictionary(true);
|
||||
this._soundChannel = new Dictionary(true);
|
||||
this._sound = new Dictionary(true);
|
||||
this._soundsPlaying = new Dictionary(true);
|
||||
this._soundVolumeByName = new Dictionary(true);
|
||||
this._sounds = new Array();
|
||||
this._minigame = param1;
|
||||
this._soundLimit = param2;
|
||||
if(!MainFrame.isInitialized())
|
||||
{
|
||||
LoaderCache.contentURL = "../../";
|
||||
}
|
||||
}
|
||||
|
||||
public function setVolumes(param1:Dictionary) : void
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
for(_loc2_ in param1)
|
||||
{
|
||||
this._soundVolumeByName[_loc2_] = param1[_loc2_];
|
||||
}
|
||||
}
|
||||
|
||||
private function getSound(param1:String) : Object
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
if(param1 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
for each(_loc2_ in this._sounds)
|
||||
{
|
||||
if(_loc2_.name == param1)
|
||||
{
|
||||
return _loc2_;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function addSound(param1:Class, param2:Number, param3:String = null) : void
|
||||
{
|
||||
var _loc4_:Object = this.getSound(param3);
|
||||
if(_loc4_ == null)
|
||||
{
|
||||
_loc4_ = new Object();
|
||||
_loc4_.sound = new param1() as Sound;
|
||||
if(param3)
|
||||
{
|
||||
_loc4_.name = param3;
|
||||
}
|
||||
this._sounds.push(_loc4_);
|
||||
this._sound[param1] = _loc4_.sound;
|
||||
}
|
||||
if(param2 >= 0)
|
||||
{
|
||||
this._soundVolume[_loc4_.sound] = param2;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._soundVolume[_loc4_.sound] = this._soundVolumeByName[param3];
|
||||
}
|
||||
this._soundsPlaying[_loc4_.sound] = 0;
|
||||
var _loc5_:SoundTransform = new SoundTransform(0,0);
|
||||
var _loc6_:SoundChannel = _loc4_.sound.play(0,0,_loc5_);
|
||||
if(_loc6_)
|
||||
{
|
||||
_loc6_.stop();
|
||||
}
|
||||
}
|
||||
|
||||
public function addStream(param1:String, param2:Number) : SBMusic
|
||||
{
|
||||
var _loc3_:Object = new Object();
|
||||
var _loc4_:SBMusic = new SBMusic(param1 + ".mp3",false,param2);
|
||||
_loc3_.sound = _loc4_;
|
||||
_loc3_.name = param1;
|
||||
this._soundVolume[_loc3_.sound] = param2;
|
||||
this._sounds.push(_loc3_);
|
||||
return _loc3_.sound;
|
||||
}
|
||||
|
||||
public function play(param1:Class, param2:Number = 0, param3:int = 0) : SoundChannel
|
||||
{
|
||||
var _loc5_:Number = NaN;
|
||||
var _loc6_:SoundTransform = null;
|
||||
var _loc7_:SoundChannel = null;
|
||||
var _loc4_:Sound = this._sound[param1];
|
||||
if(_loc4_)
|
||||
{
|
||||
if(SBAudio.isMusicMuted)
|
||||
{
|
||||
_loc5_ = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc5_ = Number(this._soundVolume[_loc4_]);
|
||||
}
|
||||
_loc6_ = new SoundTransform(_loc5_,0);
|
||||
if(this._soundLimit > 0)
|
||||
{
|
||||
if(this._soundsPlaying[_loc4_] >= this._soundLimit && param3 == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
_loc7_ = _loc4_.play(param2,param3,_loc6_);
|
||||
if(_loc7_)
|
||||
{
|
||||
this._soundsPlaying[_loc7_] = _loc4_;
|
||||
++this._soundsPlaying[_loc4_];
|
||||
if(param3 == 0)
|
||||
{
|
||||
_loc7_.addEventListener(Event.SOUND_COMPLETE,this.soundComplete);
|
||||
}
|
||||
}
|
||||
return _loc7_;
|
||||
}
|
||||
return _loc4_.play(param2,param3,_loc6_);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private function soundComplete(param1:Event) : void
|
||||
{
|
||||
param1.target.removeEventListener(Event.SOUND_COMPLETE,this.soundComplete);
|
||||
--this._soundsPlaying[this._soundsPlaying[param1.target]];
|
||||
this._soundsPlaying[param1.target] = null;
|
||||
}
|
||||
|
||||
public function playStream(param1:SBMusic, param2:Number = 0, param3:int = 0) : SoundChannel
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var _loc4_:Number = Number(this._soundVolume[param1]);
|
||||
var _loc5_:SoundTransform = new SoundTransform(_loc4_,0);
|
||||
param1.stop();
|
||||
param1.play(param2,param3,_loc5_);
|
||||
if(param1.sc == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
this._soundChannel[param1] = param1.sc;
|
||||
param1.sc.soundTransform = _loc5_;
|
||||
if(SBAudio.isMusicMuted)
|
||||
{
|
||||
param1.mute();
|
||||
}
|
||||
return param1.sc;
|
||||
}
|
||||
|
||||
public function pauseStream(param1:SBMusic) : void
|
||||
{
|
||||
param1.pause();
|
||||
}
|
||||
|
||||
public function unpauseStream(param1:SBMusic) : void
|
||||
{
|
||||
param1.unpause();
|
||||
}
|
||||
|
||||
public function togglePauseStream(param1:SBMusic) : void
|
||||
{
|
||||
param1.togglePause();
|
||||
}
|
||||
|
||||
public function stop(param1:SoundChannel) : void
|
||||
{
|
||||
--this._soundsPlaying[this._soundsPlaying[param1]];
|
||||
param1.stop();
|
||||
}
|
||||
|
||||
private function onPlay(param1:MouseEvent) : void
|
||||
{
|
||||
if(this._barSound[param1.target.parent] is Sound)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this.playStream(this._barSound[param1.target.parent],0,9999);
|
||||
}
|
||||
|
||||
private function onStop(param1:MouseEvent) : void
|
||||
{
|
||||
if(this._barSound[param1.target.parent] is Sound)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this._barSound[param1.target.parent].stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user