mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-21 01: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,106 @@
|
||||
package room
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.text.TextField;
|
||||
|
||||
public class DebugGUICheckbox extends Sprite
|
||||
{
|
||||
|
||||
private static const BOX_COLOR:Number = 16777215;
|
||||
|
||||
private static const CHK_COLOR:Number = 0;
|
||||
|
||||
private static const CHKBOX_WIDTH:Number = 20;
|
||||
|
||||
private static const CHKBOX_HEIGHT:Number = 20;
|
||||
|
||||
private var _box:Sprite;
|
||||
|
||||
private var _check:Sprite;
|
||||
|
||||
private var _label:TextField;
|
||||
|
||||
private var _visible:Boolean;
|
||||
|
||||
public var valueChangedCallback:Function;
|
||||
|
||||
public function DebugGUICheckbox()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:DisplayObjectContainer, param2:Function, param3:String, param4:Boolean = false, param5:Boolean = false) : void
|
||||
{
|
||||
var initParent:DisplayObjectContainer = param1;
|
||||
var initValueChangedCallback:Function = param2;
|
||||
var initLabel:String = param3;
|
||||
var initChecked:Boolean = param4;
|
||||
var initVisible:Boolean = param5;
|
||||
this._box = new Sprite();
|
||||
this._check = new Sprite();
|
||||
with(this._box.graphics)
|
||||
{
|
||||
beginFill(BOX_COLOR);
|
||||
drawRect(0,0,CHKBOX_WIDTH,CHKBOX_HEIGHT);
|
||||
endFill();
|
||||
}
|
||||
with(this._check.graphics)
|
||||
{
|
||||
lineStyle(2,CHK_COLOR);
|
||||
moveTo(0,0);
|
||||
lineTo(CHKBOX_WIDTH,CHKBOX_HEIGHT);
|
||||
}
|
||||
addEventListener(MouseEvent.MOUSE_DOWN,this.chkboxMouseDownHandler,false,0,true);
|
||||
this._box.addChild(this._check);
|
||||
addChild(this._box);
|
||||
this._label = new TextField();
|
||||
this._label.x = CHKBOX_WIDTH;
|
||||
this._label.height = CHKBOX_HEIGHT;
|
||||
this._label.text = initLabel;
|
||||
this._label.selectable = false;
|
||||
addChild(this._label);
|
||||
this._check.visible = initChecked;
|
||||
visible = initVisible;
|
||||
this.valueChangedCallback = initValueChangedCallback;
|
||||
initParent.addChild(this);
|
||||
}
|
||||
|
||||
public function get checked() : Boolean
|
||||
{
|
||||
return this._check.visible;
|
||||
}
|
||||
|
||||
public function set checked(param1:Boolean) : void
|
||||
{
|
||||
this._check.visible = param1;
|
||||
}
|
||||
|
||||
public function get label() : TextField
|
||||
{
|
||||
return this._label;
|
||||
}
|
||||
|
||||
public function toggleVisiblity() : void
|
||||
{
|
||||
visible = !visible;
|
||||
}
|
||||
|
||||
public function toggleChecked() : void
|
||||
{
|
||||
this._check.visible = !this._check.visible;
|
||||
}
|
||||
|
||||
private function chkboxMouseDownHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
this._check.visible = !this._check.visible;
|
||||
if(this.valueChangedCallback != null)
|
||||
{
|
||||
this.valueChangedCallback(this._check.visible);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
package room
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.KeyboardEvent;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.text.TextField;
|
||||
import flash.ui.Keyboard;
|
||||
|
||||
public class DebugGUISlider
|
||||
{
|
||||
|
||||
private static const SLIDER_X:Number = 400;
|
||||
|
||||
private static const SLIDER_Y:Number = 200;
|
||||
|
||||
private static const NUB_COLOR:Number = 16776960;
|
||||
|
||||
private static const NUB_WIDTH:Number = 10;
|
||||
|
||||
private static const NUB_HEIGHT:Number = 20;
|
||||
|
||||
private static const SLIDER_WIDTH:Number = 120;
|
||||
|
||||
private static const SLIDER_MAX:Number = 1;
|
||||
|
||||
private static const SLIDER_INIT:Number = 1;
|
||||
|
||||
private var _drag:Boolean;
|
||||
|
||||
private var _slider:Sprite;
|
||||
|
||||
private var _nub:Sprite;
|
||||
|
||||
private var _value:TextField;
|
||||
|
||||
private var _visible:Boolean;
|
||||
|
||||
private var _layerManager:LayerManager;
|
||||
|
||||
public var valueChangedCallback:Function;
|
||||
|
||||
public function DebugGUISlider()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:Object, param2:Function, param3:Boolean = false) : void
|
||||
{
|
||||
var initParent:Object = param1;
|
||||
var initValueChangedCallback:Function = param2;
|
||||
var initVisible:Boolean = param3;
|
||||
this._layerManager = LayerManager(initParent);
|
||||
initParent = initParent.fps;
|
||||
this._slider = new Sprite();
|
||||
this._nub = new Sprite();
|
||||
with(this._nub.graphics)
|
||||
{
|
||||
beginFill(NUB_COLOR);
|
||||
drawRect(-NUB_WIDTH * 0.5,-NUB_HEIGHT * 0.5,NUB_WIDTH,NUB_HEIGHT);
|
||||
}
|
||||
this._nub.x = SLIDER_WIDTH * SLIDER_INIT;
|
||||
this._nub.y = 0;
|
||||
with(this._slider.graphics)
|
||||
{
|
||||
lineStyle(2);
|
||||
moveTo(0,0);
|
||||
lineTo(SLIDER_WIDTH,0);
|
||||
beginFill(0,0);
|
||||
drawRect(-NUB_WIDTH,-NUB_HEIGHT,SLIDER_WIDTH + NUB_WIDTH + NUB_WIDTH,NUB_HEIGHT + NUB_HEIGHT);
|
||||
}
|
||||
this._slider.x = SLIDER_X;
|
||||
this._slider.y = SLIDER_Y;
|
||||
gMainFrame.stage.addEventListener(KeyboardEvent.KEY_DOWN,this.onKeyDown,false,0,true);
|
||||
this._slider.addEventListener(MouseEvent.MOUSE_DOWN,this.sliderMouseDownHandler,false,0,true);
|
||||
this._slider.addEventListener(MouseEvent.MOUSE_MOVE,this.sliderMouseMoveHandler,false,0,true);
|
||||
this._slider.addEventListener(MouseEvent.MOUSE_OUT,this.sliderMouseOutHandler,false,0,true);
|
||||
this._slider.addEventListener(MouseEvent.MOUSE_UP,this.sliderMouseUpHandler,false,0,true);
|
||||
this._slider.addChild(this._nub);
|
||||
initParent.addChild(this._slider);
|
||||
this._value = new TextField();
|
||||
this._value.x = SLIDER_X + SLIDER_WIDTH + NUB_WIDTH + NUB_WIDTH + NUB_WIDTH;
|
||||
this._value.y = this._slider.y;
|
||||
this._value.width = 32;
|
||||
this._value.text = String(SLIDER_INIT);
|
||||
initParent.addChild(this._value);
|
||||
this._visible = initVisible;
|
||||
this._slider.visible = this._visible;
|
||||
this._value.visible = this._visible;
|
||||
this.valueChangedCallback = initValueChangedCallback;
|
||||
}
|
||||
|
||||
public function toggleVisiblity() : void
|
||||
{
|
||||
this._nub.x = SLIDER_WIDTH * this._layerManager.bkg.scaleX;
|
||||
this._value.text = String(this._layerManager.bkg.scaleX);
|
||||
this._visible = !this._visible;
|
||||
this._slider.visible = this._visible;
|
||||
this._value.visible = this._visible;
|
||||
}
|
||||
|
||||
private function sliderMouseDownHandler(param1:MouseEvent) : void
|
||||
{
|
||||
this._drag = true;
|
||||
this.sliderMouseMoveHandler(param1);
|
||||
}
|
||||
|
||||
private function onKeyDown(param1:KeyboardEvent) : void
|
||||
{
|
||||
var _loc2_:Boolean = false;
|
||||
var _loc3_:Number = NaN;
|
||||
if(param1.keyCode == Keyboard.NUMPAD_ADD)
|
||||
{
|
||||
this._nub.x += 1;
|
||||
_loc2_ = true;
|
||||
}
|
||||
else if(param1.keyCode == Keyboard.NUMPAD_SUBTRACT)
|
||||
{
|
||||
--this._nub.x;
|
||||
_loc2_ = true;
|
||||
}
|
||||
else if(param1.keyCode == Keyboard.EQUAL)
|
||||
{
|
||||
this._nub.x += 0.1;
|
||||
_loc2_ = true;
|
||||
}
|
||||
else if(param1.keyCode == Keyboard.MINUS)
|
||||
{
|
||||
this._nub.x -= 0.1;
|
||||
_loc2_ = true;
|
||||
}
|
||||
if(_loc2_)
|
||||
{
|
||||
_loc3_ = this._nub.x * SLIDER_MAX / SLIDER_WIDTH;
|
||||
this._layerManager.bkg.scaleX = this._layerManager.bkg.scaleY = _loc3_;
|
||||
this._value.text = String(_loc3_);
|
||||
}
|
||||
}
|
||||
|
||||
private function sliderMouseMoveHandler(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_:Number = NaN;
|
||||
var _loc3_:Number = NaN;
|
||||
if(this._drag && param1.target is DisplayObject && this._slider.contains(DisplayObject(param1.target)))
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_loc2_ = param1.localX;
|
||||
if(param1.target == this._nub)
|
||||
{
|
||||
_loc2_ += this._nub.x;
|
||||
}
|
||||
if(_loc2_ < 0)
|
||||
{
|
||||
_loc2_ = 0;
|
||||
}
|
||||
if(_loc2_ > SLIDER_WIDTH)
|
||||
{
|
||||
_loc2_ = SLIDER_WIDTH;
|
||||
}
|
||||
this._nub.x = _loc2_;
|
||||
_loc3_ = _loc2_ * SLIDER_MAX / SLIDER_WIDTH;
|
||||
this._layerManager.bkg.scaleX = this._layerManager.bkg.scaleY = _loc3_;
|
||||
this._value.text = String(_loc3_);
|
||||
}
|
||||
}
|
||||
|
||||
private function sliderMouseOutHandler(param1:MouseEvent) : void
|
||||
{
|
||||
if(!param1.relatedObject || !this._slider.contains(param1.relatedObject))
|
||||
{
|
||||
this._drag = false;
|
||||
}
|
||||
}
|
||||
|
||||
private function sliderMouseUpHandler(param1:MouseEvent) : void
|
||||
{
|
||||
this._drag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
package room
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.text.TextField;
|
||||
|
||||
public class DebugGUITextbox extends Sprite
|
||||
{
|
||||
|
||||
private static const BG_COLOR:Number = 16777215;
|
||||
|
||||
private static const TXT_COLOR:Number = 0;
|
||||
|
||||
private static const TXTBOX_HEIGHT:Number = 22;
|
||||
|
||||
private var _bg:Sprite;
|
||||
|
||||
private var _txt:TextField;
|
||||
|
||||
public function DebugGUITextbox()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:DisplayObjectContainer, param2:String = "", param3:Boolean = false, param4:Boolean = false, param5:Boolean = false, param6:Number = 800) : void
|
||||
{
|
||||
var initParent:DisplayObjectContainer = param1;
|
||||
var initTxtText:String = param2;
|
||||
var initVisible:Boolean = param3;
|
||||
var initSelectable:Boolean = param4;
|
||||
var initNoBackground:Boolean = param5;
|
||||
var initWidth:Number = param6;
|
||||
if(!initNoBackground)
|
||||
{
|
||||
this._bg = new Sprite();
|
||||
with(this._bg.graphics)
|
||||
{
|
||||
|
||||
beginFill(BG_COLOR);
|
||||
drawRect(0,0,initWidth,TXTBOX_HEIGHT);
|
||||
}
|
||||
addChild(this._bg);
|
||||
}
|
||||
this._txt = new TextField();
|
||||
with(this._txt)
|
||||
{
|
||||
text = initTxtText;
|
||||
textColor = TXT_COLOR;
|
||||
width = initWidth;
|
||||
height = TXTBOX_HEIGHT;
|
||||
if(!initSelectable)
|
||||
{
|
||||
mouseEnabled = false;
|
||||
selectable = false;
|
||||
}
|
||||
}
|
||||
addChild(this._txt);
|
||||
visible = initVisible;
|
||||
addEventListener(MouseEvent.MOUSE_DOWN,this.txtboxMouseDownHandler,false,0,true);
|
||||
initParent.addChild(this);
|
||||
}
|
||||
|
||||
public function toggleVisiblity() : void
|
||||
{
|
||||
visible = !visible;
|
||||
}
|
||||
|
||||
public function get txt() : TextField
|
||||
{
|
||||
return this._txt;
|
||||
}
|
||||
|
||||
public function get text() : String
|
||||
{
|
||||
return this._txt.text;
|
||||
}
|
||||
|
||||
public function set text(param1:String) : void
|
||||
{
|
||||
this._txt.text = param1;
|
||||
}
|
||||
|
||||
private function txtboxMouseDownHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,29 @@
|
||||
package room
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
public class DenItemHolderEvent extends Event
|
||||
{
|
||||
|
||||
public static const ITEM_REMOVED:String = "OnItemRemoved";
|
||||
|
||||
public static const SAVE_STATE:String = "OnSaveState";
|
||||
|
||||
public var id:uint;
|
||||
|
||||
public var refId:int;
|
||||
|
||||
public var array:Array;
|
||||
|
||||
public function DenItemHolderEvent(param1:String)
|
||||
{
|
||||
super(param1);
|
||||
}
|
||||
|
||||
override public function clone() : Event
|
||||
{
|
||||
return new DenItemHolderEvent(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
package room
|
||||
{
|
||||
import com.sbi.graphics.SortLayer;
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.Shape;
|
||||
|
||||
public class LayerManager
|
||||
{
|
||||
|
||||
private var _layer_bkg:DisplayLayer;
|
||||
|
||||
private var _layer_room_bkg:DisplayLayer;
|
||||
|
||||
private var _layer_room_bkg_group:DisplayLayer;
|
||||
|
||||
private var _layer_room_bkg_main:DisplayLayer;
|
||||
|
||||
private var _layer_room_avatars:SortLayer;
|
||||
|
||||
private var _layer_room_preview_avatar:SortLayer;
|
||||
|
||||
private var _layer_room_preview_flying_avatar:SortLayer;
|
||||
|
||||
private var _layer_room_fg:DisplayLayer;
|
||||
|
||||
private var _layer_flying_avatars:SortLayer;
|
||||
|
||||
private var _layer_room_super_fg:DisplayLayer;
|
||||
|
||||
private var _layer_room_chat:DisplayLayer;
|
||||
|
||||
private var _layer_room_orbs:DisplayLayer;
|
||||
|
||||
private var _layer_worldGame:DisplayLayer;
|
||||
|
||||
private var _layer_gui:DisplayLayer;
|
||||
|
||||
private var _layer_fps:DisplayLayer;
|
||||
|
||||
private var _layer_debug:DisplayLayer;
|
||||
|
||||
private var _debugShape:Shape;
|
||||
|
||||
public function LayerManager(param1:DisplayObjectContainer, param2:DisplayLayer)
|
||||
{
|
||||
super();
|
||||
this._layer_bkg = new DisplayLayer();
|
||||
this._layer_room_bkg = new DisplayLayer();
|
||||
this._layer_room_bkg_group = new DisplayLayer();
|
||||
this._layer_room_bkg_main = new DisplayLayer();
|
||||
this._layer_room_avatars = new SortLayer();
|
||||
this._layer_room_preview_avatar = new SortLayer();
|
||||
this._layer_room_preview_flying_avatar = new SortLayer();
|
||||
this._layer_room_fg = new DisplayLayer();
|
||||
this._layer_room_super_fg = new DisplayLayer();
|
||||
this._layer_flying_avatars = new SortLayer();
|
||||
this._layer_room_chat = new DisplayLayer();
|
||||
this._layer_room_orbs = new DisplayLayer();
|
||||
this._layer_room_orbs.mouseEnabled = false;
|
||||
this._layer_worldGame = new DisplayLayer();
|
||||
this._layer_gui = new DisplayLayer();
|
||||
this._layer_fps = new DisplayLayer();
|
||||
param1.addChildAt(this._layer_bkg,param1.getChildIndex(param2));
|
||||
this._layer_bkg.addChild(this._layer_room_bkg);
|
||||
this._layer_bkg.addChild(this._layer_room_bkg_group);
|
||||
this._layer_room_bkg_group.addChild(this._layer_room_bkg_main);
|
||||
this._layer_room_bkg_group.addChild(this._layer_room_avatars);
|
||||
this._layer_room_bkg_group.addChild(this._layer_room_preview_avatar);
|
||||
this._layer_bkg.addChild(this._layer_room_fg);
|
||||
this._layer_bkg.addChild(this._layer_flying_avatars);
|
||||
this._layer_bkg.addChild(this._layer_room_preview_flying_avatar);
|
||||
this._layer_bkg.addChild(this._layer_room_super_fg);
|
||||
this._layer_bkg.addChild(this._layer_room_chat);
|
||||
this._layer_bkg.addChild(this._layer_room_orbs);
|
||||
this._layer_room_fg.mouseChildren = false;
|
||||
this._layer_room_fg.mouseEnabled = false;
|
||||
this._layer_room_super_fg.mouseChildren = false;
|
||||
this._layer_room_super_fg.mouseEnabled = false;
|
||||
param1.addChildAt(this._layer_worldGame,param1.getChildIndex(param2));
|
||||
param1.addChildAt(this._layer_gui,param1.getChildIndex(param2));
|
||||
this._layer_debug = new DisplayLayer();
|
||||
this._layer_fps.addChild(this._layer_debug);
|
||||
param1.stage.addChild(this._layer_fps);
|
||||
this._debugShape = new Shape();
|
||||
}
|
||||
|
||||
public function showAvatarsAndRelatedItems(param1:Boolean) : void
|
||||
{
|
||||
this._layer_flying_avatars.visible = param1;
|
||||
this._layer_room_chat.visible = param1;
|
||||
this._layer_room_orbs.visible = param1;
|
||||
this._layer_room_avatars.visible = param1;
|
||||
this._layer_room_bkg_main.visible = param1;
|
||||
this._layer_room_preview_avatar.visible = !param1;
|
||||
this._layer_room_preview_flying_avatar.visible = !param1;
|
||||
}
|
||||
|
||||
public function get gui() : DisplayLayer
|
||||
{
|
||||
return this._layer_gui;
|
||||
}
|
||||
|
||||
public function get bkg() : DisplayLayer
|
||||
{
|
||||
return this._layer_bkg;
|
||||
}
|
||||
|
||||
public function get fps() : DisplayLayer
|
||||
{
|
||||
return this._layer_fps;
|
||||
}
|
||||
|
||||
public function get room_bkg_group() : DisplayLayer
|
||||
{
|
||||
return this._layer_room_bkg_group;
|
||||
}
|
||||
|
||||
public function get room_bkg_main() : DisplayLayer
|
||||
{
|
||||
return this._layer_room_bkg_main;
|
||||
}
|
||||
|
||||
public function get room_bkg() : DisplayLayer
|
||||
{
|
||||
return this._layer_room_bkg;
|
||||
}
|
||||
|
||||
public function get room_fg() : DisplayLayer
|
||||
{
|
||||
return this._layer_room_fg;
|
||||
}
|
||||
|
||||
public function get room_super_fg() : DisplayLayer
|
||||
{
|
||||
return this._layer_room_super_fg;
|
||||
}
|
||||
|
||||
public function get room_avatars() : SortLayer
|
||||
{
|
||||
return this._layer_room_avatars;
|
||||
}
|
||||
|
||||
public function get room_chat() : DisplayLayer
|
||||
{
|
||||
return this._layer_room_chat;
|
||||
}
|
||||
|
||||
public function get flying_avatars() : SortLayer
|
||||
{
|
||||
return this._layer_flying_avatars;
|
||||
}
|
||||
|
||||
public function get room_orbs() : DisplayLayer
|
||||
{
|
||||
return this._layer_room_orbs;
|
||||
}
|
||||
|
||||
public function get layer_debug() : DisplayLayer
|
||||
{
|
||||
return this._layer_debug;
|
||||
}
|
||||
|
||||
public function get layer_worldGame() : DisplayLayer
|
||||
{
|
||||
return this._layer_worldGame;
|
||||
}
|
||||
|
||||
public function get preview_room_avatar() : SortLayer
|
||||
{
|
||||
return this._layer_room_preview_avatar;
|
||||
}
|
||||
|
||||
public function get preview_room_flying_avatar() : SortLayer
|
||||
{
|
||||
return this._layer_room_preview_flying_avatar;
|
||||
}
|
||||
|
||||
public function get debugShape() : Shape
|
||||
{
|
||||
return this._debugShape;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package room
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
public class RoomEvent extends Event
|
||||
{
|
||||
|
||||
public static const LOAD_SFX:String = "RoomEventLoadSfx";
|
||||
|
||||
public static const PLAY_SFX:String = "RoomEventPlaySfx";
|
||||
|
||||
public static const PLAY_SWFSFX:String = "RoomEventPlaySwfSfx";
|
||||
|
||||
public static const PLAY_SWFSFXBYCLASS:String = "RoomEventPlaySwfSfxByClass";
|
||||
|
||||
public static const ATTACH_EMOTE:String = "RoomEventAttachEmote";
|
||||
|
||||
private var _secondaryType:String;
|
||||
|
||||
private var _tertiaryType:String;
|
||||
|
||||
private var _persistent:Boolean;
|
||||
|
||||
public function RoomEvent(param1:String, param2:String = "", param3:String = "", param4:Boolean = false)
|
||||
{
|
||||
super(param1,true,false);
|
||||
this._secondaryType = param2;
|
||||
this._tertiaryType = param3;
|
||||
this._persistent = param4;
|
||||
}
|
||||
|
||||
override public function clone() : Event
|
||||
{
|
||||
return new RoomEvent(type);
|
||||
}
|
||||
|
||||
override public function toString() : String
|
||||
{
|
||||
return formatToString("RoomEvent",type,this._secondaryType,this._tertiaryType,this._persistent);
|
||||
}
|
||||
|
||||
public function get secondaryType() : String
|
||||
{
|
||||
return this._secondaryType;
|
||||
}
|
||||
|
||||
public function get tertiaryType() : String
|
||||
{
|
||||
return this._tertiaryType;
|
||||
}
|
||||
|
||||
public function get persistent() : Boolean
|
||||
{
|
||||
return this._persistent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,503 @@
|
||||
package room
|
||||
{
|
||||
import avatar.AvatarManager;
|
||||
import com.baseoneonline.astar.AStar;
|
||||
import com.baseoneonline.astar.Graph;
|
||||
import flash.geom.Point;
|
||||
import flash.utils.ByteArray;
|
||||
import gui.GuiManager;
|
||||
|
||||
public class RoomGrid implements Graph
|
||||
{
|
||||
|
||||
public static const GRID_CELL_OPEN:uint = 0;
|
||||
|
||||
public static const GRID_CELL_WALL:uint = 1;
|
||||
|
||||
public static const GRID_CELL_AIR:uint = 2;
|
||||
|
||||
public static const GRID_CELL_PHANTOM:uint = 3;
|
||||
|
||||
private static const COST_DIAG:Number = Math.sqrt(2);
|
||||
|
||||
private var GRID_DEPTH_LIMIT:uint = 128;
|
||||
|
||||
private var startPos:Object;
|
||||
|
||||
private var _grid:Object;
|
||||
|
||||
private var _astar:AStar;
|
||||
|
||||
public function RoomGrid()
|
||||
{
|
||||
super();
|
||||
this._astar = new AStar();
|
||||
}
|
||||
|
||||
public function setGridDepth(param1:uint) : void
|
||||
{
|
||||
this.GRID_DEPTH_LIMIT = param1;
|
||||
}
|
||||
|
||||
public function setGrid(param1:Object) : void
|
||||
{
|
||||
var _loc2_:* = 0;
|
||||
var _loc3_:ByteArray = null;
|
||||
var _loc4_:Vector.<uint> = null;
|
||||
var _loc5_:int = 0;
|
||||
var _loc6_:uint = 0;
|
||||
var _loc7_:uint = 0;
|
||||
var _loc8_:int = 0;
|
||||
if(param1.hasOwnProperty("packedGrid"))
|
||||
{
|
||||
_loc3_ = param1.packedGrid;
|
||||
_loc3_.position = 0;
|
||||
_loc4_ = new Vector.<uint>(param1.height * param1.width);
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < _loc3_.length / 2)
|
||||
{
|
||||
_loc6_ = _loc3_.readUnsignedShort();
|
||||
_loc7_ = uint(_loc6_ >> 14);
|
||||
if(GuiManager.isBeYourPetRoom())
|
||||
{
|
||||
if(Boolean(_loc7_ & 1 << 1) && Boolean(AvatarManager.playerAvatarWorldView) && !AvatarManager.playerAvatarWorldView.isActivePetGroundPet())
|
||||
{
|
||||
_loc7_ = 0;
|
||||
}
|
||||
}
|
||||
else if(AvatarManager.playerAvatar.enviroTypeFlag & 1 << SbiConstants.ENVIRO_AIR)
|
||||
{
|
||||
if((_loc7_ & 1 << 1) == 0)
|
||||
{
|
||||
_loc7_ = 0;
|
||||
}
|
||||
}
|
||||
else if(AvatarManager.playerAvatar.enviroTypeFlag & 1 << SbiConstants.ENVIRO_LAND)
|
||||
{
|
||||
if((_loc7_ & 1 << 0) == 0)
|
||||
{
|
||||
_loc7_ = 0;
|
||||
}
|
||||
}
|
||||
_loc6_ &= 16383;
|
||||
_loc8_ = 0;
|
||||
while(_loc8_ < _loc6_)
|
||||
{
|
||||
var _loc9_:Number;
|
||||
_loc4_[_loc9_ = _loc2_++] = _loc7_;
|
||||
_loc8_++;
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
param1.grid = _loc4_;
|
||||
}
|
||||
this._grid = param1;
|
||||
this._astar.setGraph(this);
|
||||
}
|
||||
|
||||
public function get hasReachedGoal() : Boolean
|
||||
{
|
||||
return this._astar.hasReachedGoal();
|
||||
}
|
||||
|
||||
public function enableVolume(param1:String, param2:Boolean = true) : void
|
||||
{
|
||||
var _loc3_:Array = null;
|
||||
var _loc4_:int = 0;
|
||||
var _loc5_:Object = null;
|
||||
var _loc6_:int = 0;
|
||||
var _loc7_:int = 0;
|
||||
var _loc8_:int = 0;
|
||||
var _loc9_:int = 0;
|
||||
var _loc10_:uint = 0;
|
||||
var _loc11_:uint = 0;
|
||||
var _loc12_:int = 0;
|
||||
if(this._grid.hasOwnProperty("dynamicVolumes"))
|
||||
{
|
||||
_loc3_ = this._grid.dynamicVolumes;
|
||||
while(_loc4_ < _loc3_.length)
|
||||
{
|
||||
_loc5_ = _loc3_[_loc4_];
|
||||
if(_loc5_.name == param1)
|
||||
{
|
||||
_loc5_.packedBlock.position = 0;
|
||||
_loc6_ = int(_loc5_.y);
|
||||
_loc8_ = _loc5_.x + _loc5_.y * this._grid.width;
|
||||
_loc9_ = 0;
|
||||
while(_loc9_ < _loc5_.packedBlock.length / 2)
|
||||
{
|
||||
_loc10_ = uint(_loc5_.packedBlock.readUnsignedShort());
|
||||
_loc11_ = uint(_loc10_ >> 14);
|
||||
_loc10_ &= 16383;
|
||||
_loc12_ = 0;
|
||||
while(_loc12_ < _loc10_)
|
||||
{
|
||||
if(_loc11_ > 0)
|
||||
{
|
||||
this._grid.grid[_loc8_] = param2 ? _loc11_ : 0;
|
||||
}
|
||||
_loc8_++;
|
||||
if(++_loc7_ == _loc5_.width)
|
||||
{
|
||||
_loc7_ = 0;
|
||||
_loc8_ += this._grid.width - _loc5_.width;
|
||||
}
|
||||
_loc12_++;
|
||||
}
|
||||
_loc9_++;
|
||||
}
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getCellIndex(param1:Number, param2:Number) : int
|
||||
{
|
||||
param1 -= this._grid.min.x;
|
||||
param2 -= this._grid.min.y;
|
||||
param1 /= this._grid.r2;
|
||||
param2 /= this._grid.r2;
|
||||
if(param1 < 0)
|
||||
{
|
||||
param1 = 0;
|
||||
}
|
||||
if(param1 >= this._grid.width)
|
||||
{
|
||||
param1 = this._grid.width - 1;
|
||||
}
|
||||
if(param2 < 0)
|
||||
{
|
||||
param2 = 0;
|
||||
}
|
||||
if(param2 >= this._grid.height)
|
||||
{
|
||||
param2 = this._grid.height - 1;
|
||||
}
|
||||
return int(int(param1) + int(param2) * this._grid.width);
|
||||
}
|
||||
|
||||
public function convertWorldPosToGrid(param1:Number, param2:Number) : Object
|
||||
{
|
||||
param1 -= this._grid.min.x;
|
||||
param2 -= this._grid.min.y;
|
||||
param1 /= this._grid.r2;
|
||||
param2 /= this._grid.r2;
|
||||
var _loc3_:Boolean = true;
|
||||
if(param1 < 0 || param1 >= this._grid.width || param2 < 0 || param2 >= this._grid.height)
|
||||
{
|
||||
_loc3_ = false;
|
||||
}
|
||||
return {
|
||||
"x":int(param1),
|
||||
"y":int(param2),
|
||||
"bInBounds":_loc3_
|
||||
};
|
||||
}
|
||||
|
||||
public function convertCellToCoords(param1:int) : Object
|
||||
{
|
||||
var _loc2_:Number = int(param1 / this._grid.width);
|
||||
var _loc3_:Number = Math.abs(param1 % this._grid.width);
|
||||
return {
|
||||
"x":_loc3_,
|
||||
"y":_loc2_
|
||||
};
|
||||
}
|
||||
|
||||
public function getCellIndexToWorldPos(param1:int) : Object
|
||||
{
|
||||
var _loc2_:Number = int(param1 / this._grid.width);
|
||||
var _loc3_:Number = param1 - _loc2_ * this._grid.width;
|
||||
_loc3_ *= this._grid.r2;
|
||||
_loc2_ *= this._grid.r2;
|
||||
_loc3_ += this._grid.min.x + this._grid.r;
|
||||
_loc2_ += this._grid.min.y + this._grid.r;
|
||||
return {
|
||||
"x":_loc3_,
|
||||
"y":_loc2_
|
||||
};
|
||||
}
|
||||
|
||||
public function convertGridPosToWorld(param1:int, param2:int) : Object
|
||||
{
|
||||
var _loc3_:Number = param1 * this._grid.r2 + this._grid.min.x + this._grid.r;
|
||||
var _loc4_:Number = param2 * this._grid.r2 + this._grid.min.y + this._grid.r;
|
||||
return {
|
||||
"x":_loc3_,
|
||||
"y":_loc4_
|
||||
};
|
||||
}
|
||||
|
||||
public function testGridCell(param1:int, param2:int) : uint
|
||||
{
|
||||
if(param1 >= 0 && param1 < this._grid.width && param2 >= 0 && param2 < this._grid.height)
|
||||
{
|
||||
return this._grid.grid[param2 * this._grid.width + param1];
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function findPath(param1:Point, param2:Point) : Vector.<int>
|
||||
{
|
||||
if(!this._grid)
|
||||
{
|
||||
return new Vector.<int>();
|
||||
}
|
||||
return this._astar.solve(this.getCellIndex(param1.x,param1.y),this.getCellIndex(param2.x,param2.y));
|
||||
}
|
||||
|
||||
public function findPathOptimized(param1:Point, param2:Point) : Vector.<int>
|
||||
{
|
||||
var _loc11_:int = 0;
|
||||
if(!this._grid)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var _loc3_:int = this.getCellIndex(param1.x,param1.y);
|
||||
var _loc4_:int = this.getCellIndex(param2.x,param2.y);
|
||||
if(_loc3_ < 0 || _loc4_ < 0 || _loc3_ > this.size() || _loc4_ > this.size())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var _loc5_:Vector.<int> = this._astar.solve(_loc3_,_loc4_);
|
||||
var _loc6_:Vector.<int> = new Vector.<int>();
|
||||
if(_loc5_.length == 1)
|
||||
{
|
||||
return _loc5_;
|
||||
}
|
||||
var _loc7_:int = this.getCellDir(_loc5_[0],_loc5_[1]);
|
||||
var _loc8_:int = int(_loc5_.length);
|
||||
var _loc9_:int = 0;
|
||||
var _loc10_:int = 1;
|
||||
while(_loc10_ < _loc8_)
|
||||
{
|
||||
_loc11_ = this.getCellDir(_loc5_[_loc10_ - 1],_loc5_[_loc10_]);
|
||||
if(_loc7_ != _loc11_)
|
||||
{
|
||||
_loc7_ = _loc11_;
|
||||
if(_loc9_ != _loc10_ - 1)
|
||||
{
|
||||
_loc6_.push(_loc5_[_loc10_]);
|
||||
_loc9_ = _loc10_;
|
||||
}
|
||||
}
|
||||
_loc10_++;
|
||||
}
|
||||
if(_loc6_.length == 0 || Boolean(_loc6_.length) && Boolean(_loc6_[_loc6_.length - 1] != _loc5_[_loc5_.length - 1]))
|
||||
{
|
||||
_loc6_.push(_loc5_[_loc5_.length - 1]);
|
||||
}
|
||||
return _loc6_;
|
||||
}
|
||||
|
||||
private function getCellDir(param1:int, param2:int) : int
|
||||
{
|
||||
var _loc3_:int = -1;
|
||||
var _loc4_:int = int(this._grid.width);
|
||||
if(param1 - _loc4_ == param2)
|
||||
{
|
||||
_loc3_ = 0;
|
||||
}
|
||||
else if(param1 - _loc4_ + 1 == param2)
|
||||
{
|
||||
_loc3_ = 1;
|
||||
}
|
||||
else if(param1 + 1 == param2)
|
||||
{
|
||||
_loc3_ = 2;
|
||||
}
|
||||
else if(param1 + _loc4_ + 1 == param2)
|
||||
{
|
||||
_loc3_ = 3;
|
||||
}
|
||||
else if(param1 + _loc4_ == param2)
|
||||
{
|
||||
_loc3_ = 4;
|
||||
}
|
||||
else if(param1 + _loc4_ - 1 == param2)
|
||||
{
|
||||
_loc3_ = 5;
|
||||
}
|
||||
else if(param1 - 1 == param2)
|
||||
{
|
||||
_loc3_ = 6;
|
||||
}
|
||||
else if(param1 - _loc4_ - 1 == param2)
|
||||
{
|
||||
_loc3_ = 7;
|
||||
}
|
||||
return _loc3_;
|
||||
}
|
||||
|
||||
public function setStartGridPos(param1:int) : void
|
||||
{
|
||||
this.startPos = this.convertCellToCoords(param1);
|
||||
}
|
||||
|
||||
public function getNeighbors(param1:int, param2:Vector.<int>) : Vector.<int>
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:Object = this.convertCellToCoords(param1);
|
||||
var _loc5_:int = int(_loc4_.x);
|
||||
var _loc6_:int = int(_loc4_.y);
|
||||
var _loc7_:int = int(this._grid.width);
|
||||
var _loc8_:int = int(this._grid.height);
|
||||
var _loc9_:Boolean = Math.abs(_loc4_.x - 1 - this.startPos.x) < this.GRID_DEPTH_LIMIT;
|
||||
var _loc10_:Boolean = Math.abs(_loc4_.x + 1 - this.startPos.x) < this.GRID_DEPTH_LIMIT;
|
||||
var _loc11_:Boolean = Math.abs(_loc4_.y - 1 - this.startPos.y) < this.GRID_DEPTH_LIMIT;
|
||||
var _loc12_:Boolean = Math.abs(_loc4_.y + 1 - this.startPos.y) < this.GRID_DEPTH_LIMIT;
|
||||
param2.length = 0;
|
||||
if(_loc5_ > 0)
|
||||
{
|
||||
_loc3_ = param1 - 1;
|
||||
if(!this._grid.grid[_loc3_] && _loc9_)
|
||||
{
|
||||
param2.push(_loc3_);
|
||||
}
|
||||
}
|
||||
if(_loc6_ > 0)
|
||||
{
|
||||
_loc3_ = param1 - _loc7_;
|
||||
if(!this._grid.grid[_loc3_] && _loc11_)
|
||||
{
|
||||
param2.push(_loc3_);
|
||||
}
|
||||
}
|
||||
if(_loc5_ < _loc7_ - 1)
|
||||
{
|
||||
_loc3_ = param1 + 1;
|
||||
if(!this._grid.grid[_loc3_] && _loc10_)
|
||||
{
|
||||
param2.push(_loc3_);
|
||||
}
|
||||
}
|
||||
if(_loc6_ < _loc8_ - 1)
|
||||
{
|
||||
_loc3_ = param1 + _loc7_;
|
||||
if(!this._grid.grid[_loc3_] && _loc12_)
|
||||
{
|
||||
param2.push(_loc3_);
|
||||
}
|
||||
}
|
||||
if(_loc5_ > 0 && _loc6_ > 0)
|
||||
{
|
||||
_loc3_ = param1 - 1 - _loc7_;
|
||||
if(!this._grid.grid[_loc3_] && !this._grid.grid[param1 - 1] && !this._grid.grid[param1 - _loc7_] && _loc11_ && _loc9_)
|
||||
{
|
||||
param2.push(_loc3_);
|
||||
}
|
||||
}
|
||||
if(_loc5_ < _loc7_ - 1 && _loc6_ > 0)
|
||||
{
|
||||
_loc3_ = param1 + 1 - _loc7_;
|
||||
if(!this._grid.grid[_loc3_] && !this._grid.grid[param1 + 1] && !this._grid.grid[param1 - _loc7_] && _loc11_ && _loc10_)
|
||||
{
|
||||
param2.push(_loc3_);
|
||||
}
|
||||
}
|
||||
if(_loc5_ > 0 && _loc6_ < _loc8_ - 1)
|
||||
{
|
||||
_loc3_ = param1 - 1 + _loc7_;
|
||||
if(!this._grid.grid[_loc3_] && !this._grid.grid[param1 - 1] && !this._grid.grid[param1 + _loc7_] && _loc12_ && _loc9_)
|
||||
{
|
||||
param2.push(_loc3_);
|
||||
}
|
||||
}
|
||||
if(_loc5_ < _loc7_ - 1 && _loc6_ < _loc8_ - 1)
|
||||
{
|
||||
_loc3_ = param1 + 1 + _loc7_;
|
||||
if(!this._grid.grid[_loc3_] && !this._grid.grid[param1 + 1] && !this._grid.grid[param1 + _loc7_] && _loc12_ && _loc10_)
|
||||
{
|
||||
param2.push(_loc3_);
|
||||
}
|
||||
}
|
||||
return param2;
|
||||
}
|
||||
|
||||
public function distance(param1:int, param2:int) : Number
|
||||
{
|
||||
var _loc3_:Object = this.getCellIndexToWorldPos(param1);
|
||||
var _loc4_:Object = this.getCellIndexToWorldPos(param2);
|
||||
var _loc5_:Number = Math.min(Math.abs(_loc3_.x - _loc4_.x),Math.abs(_loc3_.y - _loc4_.y));
|
||||
var _loc6_:Number = Math.abs(_loc3_.x - _loc4_.x) + Math.abs(_loc3_.y - _loc4_.y);
|
||||
return COST_DIAG * _loc5_ + _loc6_ - 2 * _loc5_;
|
||||
}
|
||||
|
||||
public function size() : int
|
||||
{
|
||||
if(this._grid == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return this._grid.width * this._grid.height;
|
||||
}
|
||||
|
||||
public function findClosestOpenGridCell(param1:Number, param2:Number) : Object
|
||||
{
|
||||
var _loc8_:int = 0;
|
||||
var _loc3_:Object = this.convertWorldPosToGrid(param1,param2);
|
||||
var _loc4_:* = int(_loc3_.x);
|
||||
var _loc5_:* = int(_loc3_.y);
|
||||
var _loc6_:int = int(this._grid.width);
|
||||
var _loc7_:int = int(this._grid.height);
|
||||
var _loc9_:int = 3;
|
||||
var _loc10_:int = 20;
|
||||
while(_loc9_ < _loc10_)
|
||||
{
|
||||
_loc3_ = this.scanBox(_loc4_,_loc5_,_loc9_);
|
||||
if(_loc3_)
|
||||
{
|
||||
break;
|
||||
}
|
||||
_loc9_ += 2;
|
||||
_loc4_--;
|
||||
_loc5_--;
|
||||
}
|
||||
if(_loc3_)
|
||||
{
|
||||
_loc3_ = this.convertGridPosToWorld(_loc3_.x,_loc3_.y);
|
||||
}
|
||||
return _loc3_;
|
||||
}
|
||||
|
||||
private function scanBox(param1:int, param2:int, param3:int) : Object
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
param3--;
|
||||
param1++;
|
||||
while(_loc4_ < 4)
|
||||
{
|
||||
if(!this.testGridCell(param1,param2))
|
||||
{
|
||||
return {
|
||||
"x":param1,
|
||||
"y":param2
|
||||
};
|
||||
}
|
||||
if(++_loc5_ == param3)
|
||||
{
|
||||
_loc5_ = 0;
|
||||
_loc4_++;
|
||||
}
|
||||
switch(_loc4_)
|
||||
{
|
||||
case 0:
|
||||
param1++;
|
||||
break;
|
||||
case 1:
|
||||
param2++;
|
||||
break;
|
||||
case 2:
|
||||
param1--;
|
||||
break;
|
||||
case 3:
|
||||
param2--;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,52 @@
|
||||
package room
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.Event;
|
||||
|
||||
public class RoomObject
|
||||
{
|
||||
|
||||
protected var _mc:MovieClip;
|
||||
|
||||
protected var _dir:int;
|
||||
|
||||
protected var _bHold:Boolean;
|
||||
|
||||
public function RoomObject(param1:MovieClip)
|
||||
{
|
||||
super();
|
||||
this._dir = 0;
|
||||
this._mc = param1;
|
||||
param1.addEventListener(Event.ENTER_FRAME,this.onEnterFrame);
|
||||
}
|
||||
|
||||
public function get hold() : Boolean
|
||||
{
|
||||
return this._bHold;
|
||||
}
|
||||
|
||||
public function mouseDown(param1:Boolean) : void
|
||||
{
|
||||
this._bHold = param1;
|
||||
}
|
||||
|
||||
public function release() : void
|
||||
{
|
||||
if(this._mc)
|
||||
{
|
||||
this._mc.removeEventListener(Event.ENTER_FRAME,this.onEnterFrame);
|
||||
this._mc = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function setDir(param1:int) : void
|
||||
{
|
||||
this._dir = param1;
|
||||
}
|
||||
|
||||
protected function onEnterFrame(param1:Event) : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package room
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.Event;
|
||||
|
||||
public class RoomObject_ForwardReverseHold extends RoomObject
|
||||
{
|
||||
|
||||
public function RoomObject_ForwardReverseHold(param1:MovieClip)
|
||||
{
|
||||
super(param1);
|
||||
param1.gotoAndStop(1);
|
||||
}
|
||||
|
||||
override public function mouseDown(param1:Boolean) : void
|
||||
{
|
||||
if(param1 && _bHold == false && _mc.hasOwnProperty("mouseDown"))
|
||||
{
|
||||
_mc.mouseDown();
|
||||
}
|
||||
_bHold = param1;
|
||||
}
|
||||
|
||||
override protected function onEnterFrame(param1:Event) : void
|
||||
{
|
||||
var _loc2_:* = _mc.currentFrame;
|
||||
if(_dir == 1)
|
||||
{
|
||||
if(++_loc2_ <= _mc.totalFrames)
|
||||
{
|
||||
_mc.gotoAndStop(_loc2_);
|
||||
}
|
||||
else
|
||||
{
|
||||
_dir = 0;
|
||||
}
|
||||
}
|
||||
else if(_dir == -1)
|
||||
{
|
||||
_loc2_--;
|
||||
if(_loc2_ > 0)
|
||||
{
|
||||
_mc.gotoAndStop(_loc2_);
|
||||
}
|
||||
else
|
||||
{
|
||||
_dir = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package room
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
|
||||
public class RoomObject_GemPickup extends RoomObject
|
||||
{
|
||||
|
||||
public function RoomObject_GemPickup(param1:MovieClip)
|
||||
{
|
||||
super(param1);
|
||||
}
|
||||
|
||||
override public function mouseDown(param1:Boolean) : void
|
||||
{
|
||||
if(param1 && _bHold == false)
|
||||
{
|
||||
_mc.visible = false;
|
||||
_bHold = true;
|
||||
release();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package room
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.Event;
|
||||
|
||||
public class RoomObject_IdleActive extends RoomObject
|
||||
{
|
||||
|
||||
public function RoomObject_IdleActive(param1:MovieClip)
|
||||
{
|
||||
super(param1);
|
||||
}
|
||||
|
||||
override public function mouseDown(param1:Boolean) : void
|
||||
{
|
||||
if(param1 && _bHold == false)
|
||||
{
|
||||
_mc.gotoAndPlay("active");
|
||||
_bHold = true;
|
||||
}
|
||||
}
|
||||
|
||||
override protected function onEnterFrame(param1:Event) : void
|
||||
{
|
||||
if(_bHold && _mc.currentLabel == "idle")
|
||||
{
|
||||
_bHold = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package room
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.Event;
|
||||
|
||||
public class RoomObject_RandomClick extends RoomObject
|
||||
{
|
||||
|
||||
private var _frameCountdown:int;
|
||||
|
||||
public function RoomObject_RandomClick(param1:MovieClip)
|
||||
{
|
||||
super(param1);
|
||||
param1.stop();
|
||||
}
|
||||
|
||||
override public function mouseDown(param1:Boolean) : void
|
||||
{
|
||||
if(_bHold == false && param1 == true)
|
||||
{
|
||||
this._frameCountdown = 5 + int(Math.random() * _mc.totalFrames) / 2;
|
||||
_bHold = true;
|
||||
}
|
||||
}
|
||||
|
||||
override protected function onEnterFrame(param1:Event) : void
|
||||
{
|
||||
if(_bHold)
|
||||
{
|
||||
if(_mc.currentFrame == _mc.totalFrames)
|
||||
{
|
||||
_mc.gotoAndStop(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
_mc.nextFrame();
|
||||
}
|
||||
if(this._frameCountdown == 0)
|
||||
{
|
||||
_bHold = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
--this._frameCountdown;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package room
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
|
||||
public class RoomObject_SocialTrigger extends RoomObject
|
||||
{
|
||||
|
||||
private var _currentStage:int;
|
||||
|
||||
private var _stages:Array;
|
||||
|
||||
private var _totalCount:int;
|
||||
|
||||
public function RoomObject_SocialTrigger(param1:MovieClip)
|
||||
{
|
||||
super(param1);
|
||||
this._stages = param1.stages;
|
||||
this.clearCount();
|
||||
this.update();
|
||||
}
|
||||
|
||||
public function clearCount() : void
|
||||
{
|
||||
this._totalCount = 0;
|
||||
}
|
||||
|
||||
public function incCount() : void
|
||||
{
|
||||
++this._totalCount;
|
||||
}
|
||||
|
||||
public function update() : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc1_:int = 0;
|
||||
while(_loc2_ < this._stages.length)
|
||||
{
|
||||
if(this._totalCount < this._stages[_loc2_].total)
|
||||
{
|
||||
break;
|
||||
}
|
||||
_loc1_ = _loc2_;
|
||||
_loc2_++;
|
||||
}
|
||||
if(this._currentStage != _loc1_)
|
||||
{
|
||||
this._currentStage = _loc1_;
|
||||
_mc.gotoAndPlay(this._stages[this._currentStage].label);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,460 @@
|
||||
package room
|
||||
{
|
||||
import achievement.AchievementXtCommManager;
|
||||
import avatar.AvatarManager;
|
||||
import com.sbi.analytics.SBTracker;
|
||||
import com.sbi.client.SFEvent;
|
||||
import com.sbi.client.SFRoom;
|
||||
import com.sbi.debug.DebugUtility;
|
||||
import com.sbi.popup.SBOkPopup;
|
||||
import com.sbi.popup.SBStandardPopup;
|
||||
import com.sbi.popup.SBYesNoPopup;
|
||||
import den.DenXtCommManager;
|
||||
import game.MinigameManager;
|
||||
import gamePlayFlow.GamePlay;
|
||||
import gui.BuddyCard;
|
||||
import gui.DarkenManager;
|
||||
import gui.GuiManager;
|
||||
import gui.WelcomeToCarnival;
|
||||
import localization.LocalizationManager;
|
||||
import pet.PetManager;
|
||||
import quest.QuestXtCommManager;
|
||||
|
||||
public class RoomXtCommManager
|
||||
{
|
||||
|
||||
public static var roomCountResponseCallback:Function;
|
||||
|
||||
public static var isSwitching:Boolean;
|
||||
|
||||
public static var _joinRoomName:String;
|
||||
|
||||
public static var _loadingNewRoom:Boolean;
|
||||
|
||||
private static var _denJoinPending:Boolean;
|
||||
|
||||
private static var _waitForLangPack:Boolean;
|
||||
|
||||
private static var _savedRPData:Object;
|
||||
|
||||
private static var _roomMgr:RoomManagerWorld;
|
||||
|
||||
private static var _rfCallback:Function;
|
||||
|
||||
public static var _welcomePopup:WelcomeToCarnival;
|
||||
|
||||
public static const RT_PARAM_GET_SHARD_FROM_DEN:int = -1;
|
||||
|
||||
public static const RT_PARAM_NEW_REGISTRANT_EXPERIENCE_REDIRECT:int = -2;
|
||||
|
||||
public function RoomXtCommManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function init() : void
|
||||
{
|
||||
_denJoinPending = false;
|
||||
_waitForLangPack = false;
|
||||
_savedRPData = null;
|
||||
_roomMgr = RoomManagerWorld.instance;
|
||||
XtReplyDemuxer.addModule(handleXtReply,"r");
|
||||
}
|
||||
|
||||
public static function destroy() : void
|
||||
{
|
||||
XtReplyDemuxer.removeModule(handleXtReply);
|
||||
roomCountResponseCallback = null;
|
||||
}
|
||||
|
||||
public static function sendRoomCountRequest(param1:Array) : void
|
||||
{
|
||||
gMainFrame.server.setXtObject_Str("rc",param1,true,false,false);
|
||||
}
|
||||
|
||||
public static function sendMoreShardRequest() : void
|
||||
{
|
||||
gMainFrame.server.setXtObject_Str("rm",[]);
|
||||
}
|
||||
|
||||
public static function sendRoomFFMRequest(param1:Function) : void
|
||||
{
|
||||
_rfCallback = param1;
|
||||
gMainFrame.server.setXtObject_Str("rf",[]);
|
||||
}
|
||||
|
||||
public static function sendNonDenRoomJoinRequest(param1:String) : void
|
||||
{
|
||||
sendRoomJoinRequestFull(param1);
|
||||
}
|
||||
|
||||
public static function set waitForLangPack(param1:Boolean) : void
|
||||
{
|
||||
_waitForLangPack = param1;
|
||||
}
|
||||
|
||||
public static function sendRoomJoinRequest(param1:String, param2:int = -1, param3:Boolean = false, param4:Boolean = false, param5:Boolean = true) : void
|
||||
{
|
||||
if(param1.slice(0,3) == "den" && !param3)
|
||||
{
|
||||
DenXtCommManager.requestDenJoinFull(param1,param2,param4,param5);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendRoomJoinRequestFull(param1,param4,param5);
|
||||
}
|
||||
}
|
||||
|
||||
private static function sendRoomJoinRequestFull(param1:String, param2:Boolean = false, param3:Boolean = true) : void
|
||||
{
|
||||
if(_loadingNewRoom)
|
||||
{
|
||||
DebugUtility.debugTrace("IGNORING rj request to room=" + param1 + " because user is already joining a new room!");
|
||||
return;
|
||||
}
|
||||
if(isSwitching)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
return;
|
||||
}
|
||||
if(gMainFrame.server.getCurrentRoom())
|
||||
{
|
||||
if(param1 == gMainFrame.server.getCurrentRoomName())
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
AvatarManager.joiningNewRoom = true;
|
||||
_loadingNewRoom = true;
|
||||
var _loc4_:int = param1.indexOf("@");
|
||||
if(_loc4_ < 0)
|
||||
{
|
||||
_joinRoomName = param1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_joinRoomName = param1.substring(0,_loc4_);
|
||||
}
|
||||
if(RoomManagerWorld.instance.haveHadLastGoodRoomName())
|
||||
{
|
||||
SBTracker.trackPageview("/game/play/loading/changeRooms");
|
||||
}
|
||||
var _loc5_:String = param3 ? "1" : "0";
|
||||
var _loc6_:Boolean = param2 || _roomMgr.forceInvisMode;
|
||||
if(!_loc6_)
|
||||
{
|
||||
gMainFrame.server.setXtObject_Str("rj",[param1,_loc5_]);
|
||||
}
|
||||
else
|
||||
{
|
||||
gMainFrame.server.setXtObject_Str("rj",[param1,_loc5_,"1"]);
|
||||
_roomMgr.forceInvisMode = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendRoomLeaveRequest(param1:int, param2:Boolean = false) : void
|
||||
{
|
||||
gMainFrame.server.setXtObject_Str("rl",[param1],true,param2);
|
||||
gMainFrame.server.handleSubRoomExit();
|
||||
}
|
||||
|
||||
public static function denJoinRequested(param1:String) : void
|
||||
{
|
||||
_loadingNewRoom = true;
|
||||
_joinRoomName = param1;
|
||||
_denJoinPending = true;
|
||||
}
|
||||
|
||||
public static function get loadingNewRoom() : Boolean
|
||||
{
|
||||
return _loadingNewRoom;
|
||||
}
|
||||
|
||||
public static function set loadingNewRoom(param1:Boolean) : void
|
||||
{
|
||||
_loadingNewRoom = param1;
|
||||
}
|
||||
|
||||
public static function startRoomLoadIfReady() : void
|
||||
{
|
||||
_waitForLangPack = false;
|
||||
if(_savedRPData)
|
||||
{
|
||||
roomPropertiesResponse(_savedRPData);
|
||||
_savedRPData = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static function handleXtReply(param1:SFEvent) : void
|
||||
{
|
||||
var _loc2_:Object = param1.obj;
|
||||
switch(_loc2_[0])
|
||||
{
|
||||
case "rj":
|
||||
roomJoinResponse(_loc2_);
|
||||
break;
|
||||
case "rp":
|
||||
roomPropertiesResponse(_loc2_);
|
||||
break;
|
||||
case "rc":
|
||||
roomCountResponse(_loc2_);
|
||||
break;
|
||||
case "rf":
|
||||
roomFFMResponse(_loc2_);
|
||||
break;
|
||||
case "rl":
|
||||
roomListResponse(_loc2_);
|
||||
break;
|
||||
case "rm":
|
||||
roomMoreResponse(_loc2_);
|
||||
break;
|
||||
default:
|
||||
throw new Error("RoomXtCommManager: Received illegal cmd: " + _loc2_[0]);
|
||||
}
|
||||
}
|
||||
|
||||
private static function roomJoinResponse(param1:Object) : void
|
||||
{
|
||||
var _loc3_:SFRoom = null;
|
||||
var _loc4_:String = null;
|
||||
var _loc5_:int = 0;
|
||||
var _loc6_:int = 0;
|
||||
var _loc7_:int = 0;
|
||||
var _loc8_:String = null;
|
||||
var _loc9_:String = null;
|
||||
var _loc10_:int = 0;
|
||||
var _loc2_:* = 2;
|
||||
if(param1[_loc2_++] == "1")
|
||||
{
|
||||
_loc3_ = new SFRoom();
|
||||
_loc3_.name = param1[_loc2_++];
|
||||
_loc3_.id = int(param1[_loc2_++]);
|
||||
_loc3_.users = int(param1[_loc2_++]);
|
||||
_loc3_.maxUsers = int(param1[_loc2_++]);
|
||||
_loc3_.spectators = int(param1[_loc2_++]);
|
||||
_loc3_.maxSpectators = int(param1[_loc2_++]);
|
||||
_loc3_.isPrivate = param1[_loc2_++] == "1";
|
||||
_loc3_.isGame = param1[_loc2_++] == "1";
|
||||
_loc3_.isLimbo = param1[_loc2_++] == "1";
|
||||
_loc3_.isTemp = param1[_loc2_++] == "1";
|
||||
_loc4_ = param1[_loc2_++];
|
||||
_loc5_ = int(param1[_loc2_++]);
|
||||
gMainFrame.userInfo.myPerUserAvId = int(param1[_loc2_++]);
|
||||
PetManager.myActivePetInvId = int(param1[_loc2_++]);
|
||||
_loc6_ = int(param1[_loc2_++]);
|
||||
if(param1.hasOwnProperty(_loc2_))
|
||||
{
|
||||
_loc7_ = int(param1[_loc2_++]);
|
||||
_roomMgr.shardId = _loc7_;
|
||||
}
|
||||
if(_loc6_ != LocalizationManager.currentLanguage && !MinigameManager.inInRoomGame())
|
||||
{
|
||||
LocalizationXtCommManager.requestLocalizationPack(_loc6_);
|
||||
}
|
||||
gMainFrame.server.handleRoomJoin(_loc3_);
|
||||
_roomMgr.forceInvisMode = false;
|
||||
if(!_loc3_.isGame || _loc3_.name.indexOf("den") == 0 || _loc3_.name.indexOf("party") == 0 || _loc3_.name.indexOf("staging") == 0)
|
||||
{
|
||||
GuiManager.setRoomNameDisplay(_loc4_,_loc5_);
|
||||
}
|
||||
if(_loc3_.name.indexOf("venue_carnival") != -1)
|
||||
{
|
||||
if(gMainFrame.userInfo.userVarCache.getUserVarValueById(343) < 1)
|
||||
{
|
||||
_welcomePopup = new WelcomeToCarnival();
|
||||
_welcomePopup.init();
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
AchievementXtCommManager.requestSetUserVar(343,1);
|
||||
}
|
||||
}
|
||||
else if(_loc3_.name.indexOf("room_diamonds") != -1)
|
||||
{
|
||||
if(gMainFrame.userInfo.userVarCache.getUserVarValueById(368) < 1)
|
||||
{
|
||||
GuiManager.openDiamondShopInfo();
|
||||
AchievementXtCommManager.requestSetUserVar(368,1);
|
||||
}
|
||||
}
|
||||
delete gMainFrame.clientInfo.autoStartRoom;
|
||||
QuestXtCommManager.roomJoined(_loc3_.name);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc8_ = param1[_loc2_++];
|
||||
if(_loc8_ == "N")
|
||||
{
|
||||
_loc9_ = param1[_loc2_++];
|
||||
if(_loc9_ == "null")
|
||||
{
|
||||
new SBStandardPopup(LoadProgress.loadLayer,LocalizationManager.translateIdOnly(14834),false);
|
||||
AvatarManager.joiningNewRoom = false;
|
||||
_denJoinPending = false;
|
||||
return;
|
||||
}
|
||||
gMainFrame.userInfo.myPerUserAvId = int(param1[_loc2_++]);
|
||||
if(_denJoinPending)
|
||||
{
|
||||
gMainFrame.clientInfo.autoStartRoom = _joinRoomName;
|
||||
gMainFrame.clientInfo.autoStartRoomShardId = RT_PARAM_GET_SHARD_FROM_DEN;
|
||||
DebugUtility.debugTrace("using autoStartRoom to prep resend join request after switching server nodes - room:" + _joinRoomName + " shardId:" + gMainFrame.clientInfo.autoStartRoomShardId);
|
||||
if(!gMainFrame.switchServersIfNeeded(_loc9_))
|
||||
{
|
||||
throw new Error("got join room response saying to switch server nodes, but was already on that node!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_joinRoomName.indexOf("#") < 0)
|
||||
{
|
||||
throw new Error("join room request for sfs room:" + _joinRoomName + " somehow is on another server node:" + _loc9_ + " (current node:" + gMainFrame.server.serverIp + ")?!");
|
||||
}
|
||||
gMainFrame.clientInfo.autoStartRoom = _joinRoomName;
|
||||
_loc10_ = int(_joinRoomName.substr(_joinRoomName.indexOf("#") + 1));
|
||||
if(_loc10_ == -1)
|
||||
{
|
||||
_loc10_ = RT_PARAM_NEW_REGISTRANT_EXPERIENCE_REDIRECT;
|
||||
}
|
||||
gMainFrame.clientInfo.autoStartRoomShardId = _loc10_;
|
||||
DebugUtility.debugTrace("using autoStartRoom to prep resend join request after switching server nodes - room:" + _joinRoomName + " shardId:" + gMainFrame.clientInfo.autoStartRoomShardId);
|
||||
if(!gMainFrame.switchServersIfNeeded(_loc9_))
|
||||
{
|
||||
new SBStandardPopup(LoadProgress.loadLayer,LocalizationManager.translateIdOnly(14835),false);
|
||||
AvatarManager.joiningNewRoom = false;
|
||||
_denJoinPending = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
_roomMgr.clearLastGoodRoomForServerSwitch();
|
||||
}
|
||||
else if(_loc8_.indexOf("DJE") == 0)
|
||||
{
|
||||
if(_loc8_.charAt(3) == "C")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBYesNoPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14836),true,GuiManager.switchToOceanAnimal,{
|
||||
"switchRooms":false,
|
||||
"switchDens":true
|
||||
});
|
||||
}
|
||||
else if(_loc8_.charAt(3) == "E")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBYesNoPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14836),true,GuiManager.switchToOceanAnimal,{
|
||||
"switchRooms":true,
|
||||
"switchDens":false
|
||||
});
|
||||
}
|
||||
else if(_loc8_.charAt(3) == "K")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBYesNoPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14837),true,GuiManager.switchToOceanAnimal,{
|
||||
"switchRooms":false,
|
||||
"switchDens":false
|
||||
});
|
||||
}
|
||||
}
|
||||
else if(_loc8_ == "BSJ")
|
||||
{
|
||||
_loadingNewRoom = false;
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14838));
|
||||
}
|
||||
else if(_loc8_ == "SSJ")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14839));
|
||||
}
|
||||
else if(_loc8_ == "CSJ")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14840));
|
||||
}
|
||||
else if(_loc8_ == "QSJL")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14841));
|
||||
}
|
||||
else if(_loc8_ == "BQSJ")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14842));
|
||||
}
|
||||
else if(_loc8_ == "RQJF")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14843));
|
||||
}
|
||||
else if(_loc8_ == "RQJF_NL")
|
||||
{
|
||||
_loadingNewRoom = false;
|
||||
if(!BuddyCard.joinBuddyInQuest())
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14843));
|
||||
}
|
||||
}
|
||||
else if(_loc8_ == "SQQJ")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14844));
|
||||
}
|
||||
else if(_loc8_ != "LC")
|
||||
{
|
||||
gMainFrame.server.handleRoomJoinError(_loc8_,param1[_loc2_]);
|
||||
}
|
||||
_loadingNewRoom = false;
|
||||
}
|
||||
AvatarManager.joiningNewRoom = false;
|
||||
_denJoinPending = false;
|
||||
}
|
||||
|
||||
private static function roomPropertiesResponse(param1:Object) : void
|
||||
{
|
||||
if(_waitForLangPack)
|
||||
{
|
||||
_savedRPData = param1;
|
||||
return;
|
||||
}
|
||||
_roomMgr.loadRoom(param1[2],int(param1[3]),int(param1[4]),int(param1[5]),int(param1[6]));
|
||||
AvatarManager.finishHandleAvatarCreate();
|
||||
}
|
||||
|
||||
private static function roomCountResponse(param1:Object) : void
|
||||
{
|
||||
if(roomCountResponseCallback != null)
|
||||
{
|
||||
roomCountResponseCallback(param1);
|
||||
}
|
||||
}
|
||||
|
||||
private static function roomMoreResponse(param1:Object) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
if(!isNaN(Number(param1[2])))
|
||||
{
|
||||
_loc2_ = int(param1[2]);
|
||||
if(_loc2_ <= 0)
|
||||
{
|
||||
new SBStandardPopup(LoadProgress.loadLayer,LocalizationManager.translateIdOnly(14847),false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
GamePlay(gMainFrame.gamePlay).showServerSelectorMore(param1);
|
||||
}
|
||||
|
||||
private static function roomFFMResponse(param1:Object) : void
|
||||
{
|
||||
if(param1[2] == "1" && _rfCallback != null)
|
||||
{
|
||||
_rfCallback();
|
||||
}
|
||||
}
|
||||
|
||||
private static function roomListResponse(param1:Object) : void
|
||||
{
|
||||
gMainFrame.server.setRoomList(param1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,618 @@
|
||||
package room
|
||||
{
|
||||
import com.sbi.loader.SceneLoader;
|
||||
import flash.display.MovieClip;
|
||||
import flash.geom.Point;
|
||||
|
||||
public class VolumeManager
|
||||
{
|
||||
|
||||
public static const VOLUMETYPE_NONE:int = 0;
|
||||
|
||||
public static const VOLUMETYPE_GAME:int = 1;
|
||||
|
||||
public static const VOLUMETYPE_DEN_VOLUME:int = 2;
|
||||
|
||||
public static const VOLUMETYPE_SPLASH:int = 3;
|
||||
|
||||
public static const VOLUMETYPE_STORE_PET:int = 4;
|
||||
|
||||
public static const VOLUMETYPE_SOCIAL_GROUP:int = 5;
|
||||
|
||||
public static const VOLUMETYPE_SOCIAL_EMOTICON:int = 6;
|
||||
|
||||
public static const VOLUMETYPE_GUI_ACTION:int = 7;
|
||||
|
||||
public static const VOLUMETYPE_RECYCLE_ACCESSORY:int = 8;
|
||||
|
||||
public static const VOLUMETYPE_RECYCLE_DEN_ITEM:int = 9;
|
||||
|
||||
public static const VOLUMETYPE_TRIGGER_WALKIN:int = 11;
|
||||
|
||||
public static const VOLUMETYPE_GENERIC_LIST:int = 12;
|
||||
|
||||
public static const VOLUMETYPE_CLICK_EMOTICON:int = 13;
|
||||
|
||||
public static const VOLUMETYPE_AIR:int = 14;
|
||||
|
||||
public static const VOLUMETYPE_DYNAMIC_COLLISION:int = 15;
|
||||
|
||||
public static const VOLUMETYPE_DYNAMIC_AIR:int = 16;
|
||||
|
||||
public static const VOLUMETYPE_DYNAMIC_PHANTOM_AIR:int = 17;
|
||||
|
||||
public static const VOLUMETYPE_PLANT:int = 18;
|
||||
|
||||
public static const VOLUMETYPE_STEALTH:int = 19;
|
||||
|
||||
public static const VOLUMETYPE_ADVENTURE_INTERACT:int = 20;
|
||||
|
||||
public static const VOLUMETYPE_DARKSOFT:int = 21;
|
||||
|
||||
public static const VOLUMETYPE_DARKHARD:int = 22;
|
||||
|
||||
public static const VOLUMETYPE_FALLINGPHANTOM:int = 23;
|
||||
|
||||
private var _scene:SceneLoader;
|
||||
|
||||
private var _volumes:Array;
|
||||
|
||||
private var _layers:Array;
|
||||
|
||||
private var _volumeActors:Array;
|
||||
|
||||
private var _roomObjs:Array;
|
||||
|
||||
private var _offset:Point;
|
||||
|
||||
private var _socialTriggersVolumes:Array;
|
||||
|
||||
private var _splashVolumes:Array;
|
||||
|
||||
public function VolumeManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function setScene(param1:SceneLoader, param2:Point) : void
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:Object = null;
|
||||
this.release();
|
||||
this._socialTriggersVolumes = [];
|
||||
this._splashVolumes = [];
|
||||
this._roomObjs = [];
|
||||
this._volumeActors = [];
|
||||
this._scene = param1;
|
||||
this._offset = param2;
|
||||
this._volumes = param1.getActorList("ActorVolume");
|
||||
this._layers = this._scene.getActorList("ActorLayer");
|
||||
if(this._volumes)
|
||||
{
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < this._volumes.length)
|
||||
{
|
||||
_loc4_ = this._volumes[_loc3_];
|
||||
this.newVolume(_loc4_);
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function release() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
var _loc2_:Object = null;
|
||||
var _loc3_:* = undefined;
|
||||
if(this._volumeActors)
|
||||
{
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < this._volumeActors.length)
|
||||
{
|
||||
for each(_loc3_ in this._volumeActors[_loc1_].interactiveObjs)
|
||||
{
|
||||
_loc3_.release();
|
||||
}
|
||||
_loc1_++;
|
||||
}
|
||||
}
|
||||
if(this._roomObjs)
|
||||
{
|
||||
for each(_loc2_ in this._roomObjs)
|
||||
{
|
||||
_loc2_.release();
|
||||
}
|
||||
}
|
||||
this._socialTriggersVolumes = null;
|
||||
this._volumes = null;
|
||||
this._layers = null;
|
||||
this._splashVolumes = null;
|
||||
}
|
||||
|
||||
public function get hasSplashVolume() : Boolean
|
||||
{
|
||||
return Boolean(this._splashVolumes) && Boolean(this._splashVolumes.length);
|
||||
}
|
||||
|
||||
public function clearHold(param1:Boolean = true) : void
|
||||
{
|
||||
var _loc2_:RoomObject = null;
|
||||
for each(_loc2_ in this._roomObjs)
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_loc2_.mouseDown(false);
|
||||
}
|
||||
if(!_loc2_.hold)
|
||||
{
|
||||
_loc2_.setDir(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function testPointInVolume(param1:Point, param2:Object) : Boolean
|
||||
{
|
||||
return this.pointInVolume(param1,param2.v);
|
||||
}
|
||||
|
||||
public function testMouseVolumes(param1:Point, param2:Boolean, param3:Function = null) : Object
|
||||
{
|
||||
var _loc4_:Object = null;
|
||||
var _loc5_:int = 0;
|
||||
var _loc6_:int = 0;
|
||||
var _loc7_:Object = null;
|
||||
var _loc8_:RoomObject = null;
|
||||
if(this._volumeActors)
|
||||
{
|
||||
this.clearHold(param2);
|
||||
if(param2)
|
||||
{
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < this._volumeActors.length)
|
||||
{
|
||||
_loc7_ = this._volumeActors[_loc5_];
|
||||
if(this.isMouseVolume(_loc7_.type) && this.pointInVolume(param1,_loc7_.v))
|
||||
{
|
||||
if(_loc7_.interactiveObjs)
|
||||
{
|
||||
_loc6_ = 0;
|
||||
while(_loc6_ < _loc7_.interactiveObjs.length)
|
||||
{
|
||||
if(param3 == null || Boolean(param3 != null) && Boolean(param3(_loc7_.name)))
|
||||
{
|
||||
_loc8_ = _loc7_.interactiveObjs[_loc6_];
|
||||
_loc8_.setDir(1);
|
||||
_loc8_.mouseDown(true);
|
||||
}
|
||||
_loc6_++;
|
||||
}
|
||||
}
|
||||
_loc4_ = _loc7_;
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
}
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < this._volumeActors.length)
|
||||
{
|
||||
_loc7_ = this._volumeActors[_loc5_];
|
||||
if(Boolean(this.isMouseVolume(_loc7_.type)) && Boolean(_loc7_.interactiveObjs) && this.pointInVolume(param1,_loc7_.v))
|
||||
{
|
||||
_loc6_ = 0;
|
||||
while(_loc6_ < _loc7_.interactiveObjs.length)
|
||||
{
|
||||
if(param3 == null || Boolean(param3 != null) && Boolean(param3(_loc7_.name)))
|
||||
{
|
||||
_loc8_ = _loc7_.interactiveObjs[_loc6_];
|
||||
if(!_loc8_.hold)
|
||||
{
|
||||
_loc8_.setDir(1);
|
||||
}
|
||||
}
|
||||
_loc6_++;
|
||||
}
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
}
|
||||
return _loc4_;
|
||||
}
|
||||
|
||||
public function testPlantVolumes(param1:Point) : Object
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:Object = null;
|
||||
var _loc4_:Object = null;
|
||||
if(this._volumeActors)
|
||||
{
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < this._volumeActors.length)
|
||||
{
|
||||
_loc3_ = this._volumeActors[_loc2_];
|
||||
if(this.isPlantVolume(_loc3_.type) && this.pointInVolume(param1,_loc3_.v))
|
||||
{
|
||||
_loc4_ = _loc3_;
|
||||
break;
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
return _loc4_;
|
||||
}
|
||||
|
||||
public function setVolumesEnabled(param1:String, param2:Boolean) : void
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:Object = null;
|
||||
if(this._volumeActors)
|
||||
{
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < this._volumeActors.length)
|
||||
{
|
||||
_loc4_ = this._volumeActors[_loc3_];
|
||||
if(_loc4_.name == param1)
|
||||
{
|
||||
_loc4_.enabled = param2;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function testStealthVolumes(param1:Point) : Object
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:Object = null;
|
||||
var _loc4_:Object = null;
|
||||
if(this._volumeActors)
|
||||
{
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < this._volumeActors.length)
|
||||
{
|
||||
_loc3_ = this._volumeActors[_loc2_];
|
||||
if(Boolean(_loc3_.enabled) && Boolean(this.isStealthVolume(_loc3_.type)) && this.pointInVolume(param1,_loc3_.v))
|
||||
{
|
||||
_loc4_ = _loc3_;
|
||||
break;
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
return _loc4_;
|
||||
}
|
||||
|
||||
public function testAvatarVolumes(param1:Point) : Object
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:Object = null;
|
||||
var _loc4_:Object = null;
|
||||
if(this._volumeActors)
|
||||
{
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < this._volumeActors.length)
|
||||
{
|
||||
_loc3_ = this._volumeActors[_loc2_];
|
||||
if(this.isAvatarVolume(_loc3_.type) && this.pointInVolume(param1,_loc3_.v))
|
||||
{
|
||||
_loc4_ = _loc3_;
|
||||
break;
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
return _loc4_;
|
||||
}
|
||||
|
||||
public function testAvatarVolume(param1:String, param2:Point) : Boolean
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:Object = null;
|
||||
if(this._volumeActors)
|
||||
{
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < this._volumeActors.length)
|
||||
{
|
||||
_loc4_ = this._volumeActors[_loc3_];
|
||||
if(_loc4_.name == param1)
|
||||
{
|
||||
if(this.pointInVolume(param2,_loc4_.v))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function testSplashVolumes(param1:Point) : Object
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:Object = null;
|
||||
var _loc4_:Object = null;
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < this._splashVolumes.length)
|
||||
{
|
||||
_loc3_ = this._splashVolumes[_loc2_];
|
||||
if(this.pointInVolume(param1,_loc3_.v))
|
||||
{
|
||||
_loc4_ = _loc3_;
|
||||
break;
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
return _loc4_;
|
||||
}
|
||||
|
||||
public function updateSocialTriggers(param1:Object) : void
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
var _loc3_:* = undefined;
|
||||
if(Boolean(this._socialTriggersVolumes) && Boolean(this._socialTriggersVolumes.length))
|
||||
{
|
||||
this.clearSocialTriggers();
|
||||
for(_loc2_ in param1)
|
||||
{
|
||||
_loc3_ = param1[_loc2_];
|
||||
this.testSocialTriggers(new Point(_loc3_.x,_loc3_.y),_loc3_.animId);
|
||||
}
|
||||
this.updateSocialTriggersStage();
|
||||
}
|
||||
}
|
||||
|
||||
private function clearSocialTriggers() : void
|
||||
{
|
||||
var _loc1_:Object = null;
|
||||
var _loc2_:Object = null;
|
||||
for each(_loc1_ in this._socialTriggersVolumes)
|
||||
{
|
||||
for each(_loc2_ in _loc1_.interactiveObjs)
|
||||
{
|
||||
if(_loc2_ is RoomObject_SocialTrigger)
|
||||
{
|
||||
_loc2_.clearCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function testSocialTriggers(param1:Point, param2:int) : void
|
||||
{
|
||||
var _loc3_:Object = null;
|
||||
var _loc4_:Object = null;
|
||||
for each(_loc3_ in this._socialTriggersVolumes)
|
||||
{
|
||||
if(this.pointInVolume(param1,_loc3_.v) && (!_loc3_.animIds || _loc3_.animIds.indexOf(param2) >= 0))
|
||||
{
|
||||
for each(_loc4_ in _loc3_.interactiveObjs)
|
||||
{
|
||||
if(_loc4_ is RoomObject_SocialTrigger)
|
||||
{
|
||||
_loc4_.incCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function updateSocialTriggersStage() : void
|
||||
{
|
||||
var _loc1_:Object = null;
|
||||
var _loc2_:Object = null;
|
||||
for each(_loc1_ in this._socialTriggersVolumes)
|
||||
{
|
||||
for each(_loc2_ in _loc1_.interactiveObjs)
|
||||
{
|
||||
if(_loc2_ is RoomObject_SocialTrigger)
|
||||
{
|
||||
_loc2_.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function isMouseVolume(param1:int) : Boolean
|
||||
{
|
||||
return param1 == 0 || param1 == 1 || param1 == 4 || param1 == 7 || param1 == 8 || param1 == 9 || param1 == 10 || param1 == 12 || param1 == 13;
|
||||
}
|
||||
|
||||
private function isSocialTriggerVolume(param1:int) : Boolean
|
||||
{
|
||||
return param1 == 5;
|
||||
}
|
||||
|
||||
private function isAvatarVolume(param1:int) : Boolean
|
||||
{
|
||||
return param1 == 6 || param1 == 11;
|
||||
}
|
||||
|
||||
private function isSplashVolume(param1:int) : Boolean
|
||||
{
|
||||
return param1 == 3;
|
||||
}
|
||||
|
||||
private function isPlantVolume(param1:int) : Boolean
|
||||
{
|
||||
return param1 == 18;
|
||||
}
|
||||
|
||||
private function isStealthVolume(param1:int) : Boolean
|
||||
{
|
||||
return param1 == 19;
|
||||
}
|
||||
|
||||
private function newVolume(param1:Object) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc4_:Point = null;
|
||||
var _loc5_:Object = null;
|
||||
var _loc3_:Object = {
|
||||
"enabled":true,
|
||||
"name":param1.name,
|
||||
"v":param1.points.slice(),
|
||||
"status":0,
|
||||
"interactiveObjs":null,
|
||||
"message":param1.message,
|
||||
"type":param1.type,
|
||||
"typeDefId":param1.typeDefId,
|
||||
"bWalkTo":param1.walkTo
|
||||
};
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _loc3_.v.length)
|
||||
{
|
||||
_loc4_ = new Point(_loc3_.v[_loc2_].x,_loc3_.v[_loc2_].y);
|
||||
this.convertToWorldSpace(_loc4_);
|
||||
_loc3_.v[_loc2_] = _loc4_;
|
||||
_loc2_++;
|
||||
}
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < this._layers.length)
|
||||
{
|
||||
_loc5_ = this._layers[_loc2_];
|
||||
if(_loc5_.name == param1.name)
|
||||
{
|
||||
if(!_loc3_.interactiveObjs)
|
||||
{
|
||||
_loc3_.interactiveObjs = [];
|
||||
}
|
||||
_loc3_.interactiveObjs.push(this.getRoomObject(_loc5_,param1.message));
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
this._volumeActors.push(_loc3_);
|
||||
if(this.isSplashVolume(_loc3_.type))
|
||||
{
|
||||
this._splashVolumes.push(_loc3_);
|
||||
}
|
||||
if(this.isSocialTriggerVolume(_loc3_.type))
|
||||
{
|
||||
_loc3_.animIds = null;
|
||||
if(_loc3_.message.length)
|
||||
{
|
||||
_loc3_.animIds = _loc3_.message.split(",");
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _loc3_.animIds.length)
|
||||
{
|
||||
_loc3_.animIds[_loc2_] = int(_loc3_.animIds[_loc2_]);
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
this._socialTriggersVolumes.push(_loc3_);
|
||||
}
|
||||
}
|
||||
|
||||
private function getRoomObject(param1:Object, param2:String) : Object
|
||||
{
|
||||
var _loc4_:MovieClip = null;
|
||||
var _loc5_:Class = null;
|
||||
var _loc3_:RoomObject = this._roomObjs[param1.name];
|
||||
if(!_loc3_)
|
||||
{
|
||||
_loc4_ = param1.s.content;
|
||||
switch(param2)
|
||||
{
|
||||
case "gem":
|
||||
_loc5_ = RoomObject_GemPickup;
|
||||
break;
|
||||
default:
|
||||
if(_loc4_.stages != null)
|
||||
{
|
||||
_loc5_ = RoomObject_SocialTrigger;
|
||||
}
|
||||
else if(_loc4_.currentLabels.length)
|
||||
{
|
||||
if(_loc4_.currentLabels[0].name == "idle")
|
||||
{
|
||||
_loc5_ = RoomObject_IdleActive;
|
||||
}
|
||||
else if(_loc4_.currentLabels[0].name == "random")
|
||||
{
|
||||
_loc5_ = RoomObject_RandomClick;
|
||||
}
|
||||
}
|
||||
if(!_loc5_)
|
||||
{
|
||||
_loc5_ = RoomObject_ForwardReverseHold;
|
||||
}
|
||||
}
|
||||
_loc3_ = new _loc5_(_loc4_);
|
||||
this._roomObjs[param1.name] = _loc3_;
|
||||
}
|
||||
return _loc3_;
|
||||
}
|
||||
|
||||
private function pointInVolume(param1:Point, param2:Array) : Boolean
|
||||
{
|
||||
var _loc6_:Number = NaN;
|
||||
var _loc3_:Number = 0;
|
||||
var _loc4_:Number = param2.length - 1;
|
||||
var _loc5_:int = 0;
|
||||
while(_loc5_ < _loc4_)
|
||||
{
|
||||
if(param2[_loc5_].y <= param1.y && param2[_loc5_ + 1].y > param1.y || param2[_loc5_].y > param1.y && param2[_loc5_ + 1].y <= param1.y)
|
||||
{
|
||||
_loc6_ = (param1.y - param2[_loc5_].y) / (param2[_loc5_ + 1].y - param2[_loc5_].y);
|
||||
if(param1.x < param2[_loc5_].x + _loc6_ * (param2[_loc5_ + 1].x - param2[_loc5_].x))
|
||||
{
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
return _loc3_ % 2 ? true : false;
|
||||
}
|
||||
|
||||
private function convertToWorldSpace(param1:Point) : void
|
||||
{
|
||||
param1.x -= this._offset.x;
|
||||
param1.y -= this._offset.y;
|
||||
}
|
||||
|
||||
public function findVolume(param1:String) : Array
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc2_:Array = null;
|
||||
if(this._volumeActors != null)
|
||||
{
|
||||
while(_loc3_ < this._volumeActors.length)
|
||||
{
|
||||
if(this._volumeActors[_loc3_].name == param1)
|
||||
{
|
||||
if(_loc2_ == null)
|
||||
{
|
||||
_loc2_ = new Array();
|
||||
}
|
||||
_loc2_.push(this._volumeActors[_loc3_]);
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
public function findVolumesByType(param1:int) : Array
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc2_:Array = null;
|
||||
if(this._volumeActors != null)
|
||||
{
|
||||
while(_loc3_ < this._volumeActors.length)
|
||||
{
|
||||
if(this._volumeActors[_loc3_].type == param1)
|
||||
{
|
||||
if(_loc2_ == null)
|
||||
{
|
||||
_loc2_ = new Array();
|
||||
}
|
||||
_loc2_.push(this._volumeActors[_loc3_]);
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user