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,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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,901 @@
|
||||
package room
|
||||
{
|
||||
import com.sbi.graphics.SortLayer;
|
||||
import den.DenItem;
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Loader;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
import flash.events.EventDispatcher;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.filters.GlowFilter;
|
||||
import flash.geom.Matrix;
|
||||
import flash.geom.Point;
|
||||
import flash.geom.Rectangle;
|
||||
import flash.utils.getDefinitionByName;
|
||||
import game.MinigameManager;
|
||||
import gui.GuiManager;
|
||||
import loader.DenItemHelper;
|
||||
|
||||
public class DenItemHolder extends EventDispatcher
|
||||
{
|
||||
|
||||
private const MOUSE_DOWN_TYPE:int = 0;
|
||||
|
||||
private const MOUSE_OVER_TYPE:int = 1;
|
||||
|
||||
private const MOUSE_OUT_TYPE:int = 2;
|
||||
|
||||
private var _currItems:Array;
|
||||
|
||||
private var _itemsInit:Array;
|
||||
|
||||
private var _layerManager:LayerManager;
|
||||
|
||||
private var _dragItem:Object;
|
||||
|
||||
private var _itemFilter:Object;
|
||||
|
||||
private var _dragPoint:Point;
|
||||
|
||||
private var _closeBtn:MovieClip;
|
||||
|
||||
private var _flipBtn:MovieClip;
|
||||
|
||||
private var _themePos:Point;
|
||||
|
||||
private var _isWaitingToSetItemsForFirstTime:Boolean;
|
||||
|
||||
private var _roomMode:int;
|
||||
|
||||
public function DenItemHolder(param1:LayerManager)
|
||||
{
|
||||
super();
|
||||
this._themePos = new Point();
|
||||
this._dragPoint = new Point();
|
||||
this._layerManager = param1;
|
||||
this._closeBtn = new (getDefinitionByName("closeBtn") as Class)();
|
||||
this._closeBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onCloseBtn,false,0,true);
|
||||
this._flipBtn = new (getDefinitionByName("itemRotateBtnCont") as Class)();
|
||||
this._flipBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onFlipBtn,false,0,true);
|
||||
this.release();
|
||||
}
|
||||
|
||||
public function release() : void
|
||||
{
|
||||
var _loc1_:Object = null;
|
||||
this._isWaitingToSetItemsForFirstTime = true;
|
||||
if(this._currItems)
|
||||
{
|
||||
for each(_loc1_ in this._currItems)
|
||||
{
|
||||
if(_loc1_.di)
|
||||
{
|
||||
_loc1_.di.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
this._currItems = [];
|
||||
this._itemsInit = [];
|
||||
this._dragItem = null;
|
||||
this.updateCloseBtn();
|
||||
}
|
||||
|
||||
public function get numberOfInUseItems() : int
|
||||
{
|
||||
return this._currItems.length;
|
||||
}
|
||||
|
||||
public function get isDragging() : Boolean
|
||||
{
|
||||
return this._dragItem != null;
|
||||
}
|
||||
|
||||
public function setItems(param1:Array, param2:Boolean = false) : void
|
||||
{
|
||||
var _loc3_:Object = null;
|
||||
var _loc4_:Object = null;
|
||||
var _loc5_:Boolean = false;
|
||||
var _loc7_:Boolean = false;
|
||||
var _loc8_:Number = NaN;
|
||||
var _loc9_:Number = NaN;
|
||||
if(this._isWaitingToSetItemsForFirstTime && param2)
|
||||
{
|
||||
this._isWaitingToSetItemsForFirstTime = false;
|
||||
}
|
||||
var _loc6_:int = 0;
|
||||
while(_loc6_ < param1.length)
|
||||
{
|
||||
_loc3_ = param1[_loc6_];
|
||||
if(_loc3_)
|
||||
{
|
||||
if(_loc3_.c > 0)
|
||||
{
|
||||
_loc5_ = false;
|
||||
for each(_loc4_ in this._currItems)
|
||||
{
|
||||
if(_loc3_.r == _loc4_.r && _loc3_.i == _loc4_.i)
|
||||
{
|
||||
_loc4_.f = _loc3_.f;
|
||||
_loc8_ = Number(_loc3_.x) + Number(_loc4_.offX);
|
||||
_loc9_ = Number(_loc3_.y) + Number(_loc4_.offY);
|
||||
this.setItemMatrix(_loc4_,_loc8_,_loc9_,_loc4_.f);
|
||||
if(_loc4_.s == DenItem.SORT_PET && Boolean(_loc4_.di))
|
||||
{
|
||||
_loc4_.di.setVersion(_loc3_.v,_loc3_.v2,_loc3_.v3);
|
||||
}
|
||||
_loc5_ = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!_loc5_)
|
||||
{
|
||||
this.setItem(_loc3_.i,_loc3_.p,_loc3_.x,_loc3_.y,_loc3_.l,_loc3_.c,_loc3_.s,_loc3_.f,_loc3_.mg,_loc3_.v,_loc3_.v2,_loc3_.v3,_loc3_.strmName,_loc3_.r,param2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for each(_loc4_ in this._currItems)
|
||||
{
|
||||
if(_loc3_.r == _loc4_.r && _loc3_.i == _loc4_.i)
|
||||
{
|
||||
this.releaseItem(_loc4_,param2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_loc6_++;
|
||||
}
|
||||
for each(_loc3_ in this._currItems)
|
||||
{
|
||||
if(_loc3_.s == DenItem.SORT_AUDIO)
|
||||
{
|
||||
_loc7_ = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!_loc7_)
|
||||
{
|
||||
this.setItem(DenItem.DEF_AUDIO_INVIDX,DenItem.DEF_AUDIO_PACKED_ID,0,0,0,DenItem.PLACE_CAT_ICONL,DenItem.SORT_AUDIO,0,0,0,DenItem.DEF_AUDIO_VOL,0,DenItem.DEF_AUDIO_STRMNAME,DenItem.REF_ID_DEN_ITEM,param2);
|
||||
}
|
||||
if(this._isWaitingToSetItemsForFirstTime)
|
||||
{
|
||||
this._isWaitingToSetItemsForFirstTime = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function removeItem(param1:int, param2:int) : void
|
||||
{
|
||||
var _loc3_:Object = null;
|
||||
for each(_loc3_ in this._currItems)
|
||||
{
|
||||
if(_loc3_.r == param2 && _loc3_.i == param1)
|
||||
{
|
||||
this.releaseItem(_loc3_);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function saveState() : void
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
var _loc3_:Object = null;
|
||||
var _loc4_:Boolean = false;
|
||||
var _loc5_:DenItemHolderEvent = null;
|
||||
var _loc6_:Array = null;
|
||||
var _loc7_:Object = null;
|
||||
var _loc8_:Object = null;
|
||||
var _loc9_:int = 0;
|
||||
var _loc10_:int = 0;
|
||||
var _loc1_:Array = [];
|
||||
for each(_loc2_ in this._itemsInit)
|
||||
{
|
||||
_loc4_ = false;
|
||||
for each(_loc3_ in this._currItems)
|
||||
{
|
||||
if(_loc3_.r == _loc2_.r && _loc3_.i == _loc2_.i)
|
||||
{
|
||||
_loc4_ = true;
|
||||
if(_loc3_.s != DenItem.SORT_AUDIO && (_loc3_.x != _loc2_.x || _loc3_.y != _loc2_.y || _loc3_.f != _loc2_.f))
|
||||
{
|
||||
_loc1_.push({
|
||||
"di":_loc3_.di,
|
||||
"f":_loc3_.f,
|
||||
"i":_loc3_.i,
|
||||
"x":_loc3_.x,
|
||||
"s":_loc3_.s,
|
||||
"y":_loc3_.y,
|
||||
"offX":_loc3_.offX,
|
||||
"offY":_loc3_.offY,
|
||||
"r":_loc3_.r
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!_loc4_)
|
||||
{
|
||||
_loc1_.push({
|
||||
"f":0,
|
||||
"i":_loc2_.i,
|
||||
"s":_loc2_.s,
|
||||
"x":0,
|
||||
"y":0,
|
||||
"d":0,
|
||||
"r":_loc2_.r
|
||||
});
|
||||
}
|
||||
}
|
||||
for each(_loc3_ in this._currItems)
|
||||
{
|
||||
_loc4_ = false;
|
||||
for each(_loc2_ in this._itemsInit)
|
||||
{
|
||||
if(_loc2_.r == _loc3_.r && _loc2_.i == _loc3_.i)
|
||||
{
|
||||
_loc4_ = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!_loc4_)
|
||||
{
|
||||
_loc1_.push({
|
||||
"f":_loc3_.f,
|
||||
"di":_loc3_.di,
|
||||
"i":_loc3_.i,
|
||||
"s":_loc3_.s,
|
||||
"x":_loc3_.x,
|
||||
"y":_loc3_.y,
|
||||
"offX":_loc3_.offX,
|
||||
"offY":_loc3_.offY,
|
||||
"r":_loc3_.r
|
||||
});
|
||||
}
|
||||
}
|
||||
if(_loc1_.length > 0)
|
||||
{
|
||||
this.updateInitialState();
|
||||
_loc5_ = new DenItemHolderEvent(DenItemHolderEvent.SAVE_STATE);
|
||||
_loc6_ = new Array();
|
||||
for each(_loc7_ in _loc1_)
|
||||
{
|
||||
if(_loc7_.i != -1)
|
||||
{
|
||||
if(_loc7_.di)
|
||||
{
|
||||
_loc9_ = int(_loc7_.x - _loc7_.offX);
|
||||
_loc10_ = int(_loc7_.y - _loc7_.offY);
|
||||
_loc8_ = {
|
||||
"i":_loc7_.i,
|
||||
"s":_loc7_.s,
|
||||
"d":1,
|
||||
"x":_loc9_,
|
||||
"y":_loc10_,
|
||||
"f":_loc7_.f,
|
||||
"r":_loc7_.r
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc8_ = {
|
||||
"i":_loc7_.i,
|
||||
"s":_loc7_.s,
|
||||
"d":0,
|
||||
"x":0,
|
||||
"y":0,
|
||||
"f":0,
|
||||
"r":_loc7_.r
|
||||
};
|
||||
}
|
||||
_loc6_.push(_loc8_);
|
||||
}
|
||||
}
|
||||
_loc5_.array = _loc6_;
|
||||
dispatchEvent(_loc5_);
|
||||
}
|
||||
}
|
||||
|
||||
public function removeHighlightState() : void
|
||||
{
|
||||
if(this._closeBtn.parent)
|
||||
{
|
||||
this._closeBtn.parent.removeChild(this._closeBtn);
|
||||
}
|
||||
if(this._flipBtn.parent)
|
||||
{
|
||||
this._flipBtn.parent.removeChild(this._flipBtn);
|
||||
}
|
||||
if(this._itemFilter)
|
||||
{
|
||||
if(this._itemFilter.di.displayObject)
|
||||
{
|
||||
this._itemFilter.di.displayObject.filters = [];
|
||||
}
|
||||
this._itemFilter = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function updateInitialState() : void
|
||||
{
|
||||
var _loc1_:Object = null;
|
||||
this._itemsInit = [];
|
||||
for each(_loc1_ in this._currItems)
|
||||
{
|
||||
this._itemsInit.push({
|
||||
"c":_loc1_.c,
|
||||
"di":_loc1_.di,
|
||||
"l":_loc1_.l,
|
||||
"i":_loc1_.i,
|
||||
"f":_loc1_.f,
|
||||
"s":_loc1_.x,
|
||||
"x":_loc1_.x,
|
||||
"y":_loc1_.y,
|
||||
"offX":_loc1_.offX,
|
||||
"offY":_loc1_.offY,
|
||||
"r":_loc1_.r
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function handleMouse(param1:Number, param2:Number, param3:Boolean) : void
|
||||
{
|
||||
var _loc4_:Number = NaN;
|
||||
var _loc5_:Number = NaN;
|
||||
if(param3)
|
||||
{
|
||||
if(this._dragItem)
|
||||
{
|
||||
_loc4_ = this._dragItem.x + param1 - this._dragPoint.x;
|
||||
_loc5_ = this._dragItem.y + param2 - this._dragPoint.y;
|
||||
this.setItemMatrix(this._dragItem,_loc4_,_loc5_,this._dragItem.f);
|
||||
this.setBtnPos(_loc4_ + this._dragItem.di.displayObject.width - 30,_loc5_);
|
||||
this._dragPoint.x = param1;
|
||||
this._dragPoint.y = param2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this._dragItem = this.hitTest(param1,param2);
|
||||
if(this._dragItem)
|
||||
{
|
||||
this._dragPoint.x = param1;
|
||||
this._dragPoint.y = param2;
|
||||
}
|
||||
this.updateCloseBtn();
|
||||
}
|
||||
}
|
||||
|
||||
public function setThemePosition(param1:int, param2:int) : void
|
||||
{
|
||||
this._themePos = new Point(param1,param2);
|
||||
}
|
||||
|
||||
public function setRoomMode(param1:int) : void
|
||||
{
|
||||
this._roomMode = param1;
|
||||
this.stopListenersOnPets(this._roomMode == RoomManagerWorld.ROOM_MODE_DEN);
|
||||
this.stopMouseOnNonMouseItems(this._roomMode == RoomManagerWorld.ROOM_MODE_DEN);
|
||||
}
|
||||
|
||||
public function stopListenersOnPets(param1:Boolean) : void
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
for each(_loc2_ in this._currItems)
|
||||
{
|
||||
if(Boolean(_loc2_.di) && Boolean(_loc2_.di.content) && Boolean(_loc2_.di.content.hasOwnProperty("listenToMouse")))
|
||||
{
|
||||
_loc2_.di.content.listenToMouse = !param1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function stopMouseOnNonMouseItems(param1:Boolean) : void
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
for each(_loc2_ in this._currItems)
|
||||
{
|
||||
if(Boolean(_loc2_.di) && Boolean(_loc2_.di.content) && Boolean(_loc2_.di.content.hasOwnProperty("ignoreMouseCompletely")) && Boolean(_loc2_.di.displayObject))
|
||||
{
|
||||
Sprite(_loc2_.di.displayObject).mouseEnabled = !param1;
|
||||
Sprite(_loc2_.di.displayObject).mouseChildren = !param1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function shouldStopMovement(param1:Point) : Boolean
|
||||
{
|
||||
var _loc3_:Object = null;
|
||||
var _loc4_:MovieClip = null;
|
||||
var _loc5_:int = 0;
|
||||
var _loc2_:int = int(this._currItems.length);
|
||||
if(_loc2_ > 0)
|
||||
{
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < _loc2_)
|
||||
{
|
||||
_loc3_ = this._currItems[_loc5_];
|
||||
if(!this.isTheme(_loc3_.s) && _loc3_.s != DenItem.SORT_AUDIO)
|
||||
{
|
||||
if(_loc3_.di.displayObject.numChildren > 0)
|
||||
{
|
||||
_loc4_ = _loc3_.di.displayObject.getChildAt(0).content;
|
||||
if(_loc4_.parent.name == "moveToDisabled")
|
||||
{
|
||||
if(_loc4_.hitTestPoint(param1.x,param1.y,true))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function isTheme(param1:int) : Boolean
|
||||
{
|
||||
return param1 > 1 && param1 < 4;
|
||||
}
|
||||
|
||||
private function setItem(param1:int, param2:int, param3:int, param4:int, param5:int, param6:int, param7:int, param8:int, param9:int, param10:int, param11:int, param12:int, param13:String, param14:int, param15:Boolean) : void
|
||||
{
|
||||
var _loc20_:Object = null;
|
||||
var _loc21_:DenItemHolderEvent = null;
|
||||
var _loc22_:Object = null;
|
||||
var _loc23_:DenItemHolderEvent = null;
|
||||
var _loc16_:int = param7 == DenItem.SORT_PET ? param11 : 0;
|
||||
var _loc17_:int = param7 == DenItem.SORT_PET ? param12 : 0;
|
||||
var _loc18_:DenItemHelper = new DenItemHelper();
|
||||
_loc18_.init(param2,this.itemLoaded,param10,param9,_loc16_,_loc17_);
|
||||
if(this.isTheme(param7))
|
||||
{
|
||||
for each(_loc20_ in this._currItems)
|
||||
{
|
||||
if(_loc20_.s == param7)
|
||||
{
|
||||
this.releaseItem(_loc20_);
|
||||
_loc21_ = new DenItemHolderEvent(DenItemHolderEvent.ITEM_REMOVED);
|
||||
_loc21_.id = _loc20_.i;
|
||||
_loc21_.refId = _loc20_.r;
|
||||
_loc21_.array = [_loc20_];
|
||||
dispatchEvent(_loc21_);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(param7 == DenItem.SORT_AUDIO)
|
||||
{
|
||||
for each(_loc22_ in this._currItems)
|
||||
{
|
||||
if(_loc22_.s == param7)
|
||||
{
|
||||
this.releaseItem(_loc22_);
|
||||
_loc23_ = new DenItemHolderEvent(DenItemHolderEvent.ITEM_REMOVED);
|
||||
_loc23_.id = _loc22_.i;
|
||||
_loc23_.refId = _loc22_.r;
|
||||
_loc23_.array = [_loc22_];
|
||||
dispatchEvent(_loc23_);
|
||||
break;
|
||||
}
|
||||
}
|
||||
RoomManagerWorld.instance.playMusic(param13 + ".mp3",param11 / 100);
|
||||
}
|
||||
var _loc19_:Object = {
|
||||
"c":param6,
|
||||
"s":param7,
|
||||
"di":_loc18_,
|
||||
"f":param8,
|
||||
"i":param1,
|
||||
"l":param5,
|
||||
"x":param3,
|
||||
"y":param4,
|
||||
"r":param14,
|
||||
"bNewPlaced":param15
|
||||
};
|
||||
this._currItems.push(_loc19_);
|
||||
if(this._roomMode == RoomManagerWorld.ROOM_MODE_DEN)
|
||||
{
|
||||
if(Boolean(_loc19_.di) && Boolean(_loc19_.di.content) && Boolean(_loc19_.di.content.hasOwnProperty("listenToMouse")))
|
||||
{
|
||||
_loc19_.di.content.listenToMouse = false;
|
||||
}
|
||||
}
|
||||
else if(Boolean(_loc19_.di) && Boolean(_loc19_.di.displayObject) && Boolean(_loc19_.di.content) && Boolean(_loc19_.di.content.hasOwnProperty("ignoreMouseCompletely")))
|
||||
{
|
||||
Sprite(_loc19_.di.displayObject).mouseEnabled = false;
|
||||
Sprite(_loc19_.di.displayObject).mouseChildren = false;
|
||||
}
|
||||
if(param9 > 0)
|
||||
{
|
||||
this.addListenersToItem(_loc18_,_loc19_);
|
||||
}
|
||||
if(this._isWaitingToSetItemsForFirstTime || !param15)
|
||||
{
|
||||
this._itemsInit.push({
|
||||
"c":_loc19_.c,
|
||||
"s":_loc19_.s,
|
||||
"di":_loc19_.di,
|
||||
"f":_loc19_.f,
|
||||
"i":_loc19_.i,
|
||||
"l":_loc19_.l,
|
||||
"x":_loc19_.x,
|
||||
"y":_loc19_.y,
|
||||
"r":param14,
|
||||
"bNewPlaced":_loc19_.bNewPlaced
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private function updateCloseBtn() : void
|
||||
{
|
||||
var _loc1_:Sprite = null;
|
||||
if(this._dragItem)
|
||||
{
|
||||
_loc1_ = this._dragItem.di.displayObject;
|
||||
if(this._closeBtn.parent != _loc1_)
|
||||
{
|
||||
this.setBtnPos(this._dragItem.x + _loc1_.width - 30,this._dragItem.y);
|
||||
this._layerManager.room_chat.addChild(this._closeBtn);
|
||||
this._layerManager.room_chat.addChild(this._flipBtn);
|
||||
}
|
||||
if(this._itemFilter != this._dragItem)
|
||||
{
|
||||
if(this._itemFilter)
|
||||
{
|
||||
this._itemFilter.di.displayObject.filters = [];
|
||||
}
|
||||
this._itemFilter = this._dragItem;
|
||||
this._itemFilter.di.displayObject.filters = [new GlowFilter(16777215,1,8,8,8)];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(this._closeBtn.parent)
|
||||
{
|
||||
this._closeBtn.parent.removeChild(this._closeBtn);
|
||||
}
|
||||
if(this._flipBtn.parent)
|
||||
{
|
||||
this._flipBtn.parent.removeChild(this._flipBtn);
|
||||
}
|
||||
if(this._itemFilter)
|
||||
{
|
||||
if(this._itemFilter.di.displayObject)
|
||||
{
|
||||
this._itemFilter.di.displayObject.filters = [];
|
||||
}
|
||||
this._itemFilter = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function setBtnPos(param1:Number, param2:Number) : void
|
||||
{
|
||||
this._closeBtn.x = param1;
|
||||
this._closeBtn.y = param2;
|
||||
this._flipBtn.x = param1 + 15;
|
||||
this._flipBtn.y = param2 + 55;
|
||||
}
|
||||
|
||||
private function onCloseBtn(param1:Event) : void
|
||||
{
|
||||
var _loc2_:DenItemHolderEvent = null;
|
||||
param1.stopPropagation();
|
||||
if(this._dragItem)
|
||||
{
|
||||
_loc2_ = new DenItemHolderEvent(DenItemHolderEvent.ITEM_REMOVED);
|
||||
_loc2_.id = this._dragItem.i;
|
||||
_loc2_.refId = this._dragItem.r;
|
||||
_loc2_.array = [this._dragItem];
|
||||
this.releaseItem(this._dragItem);
|
||||
this._dragItem = null;
|
||||
this.updateCloseBtn();
|
||||
dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
private function onFlipBtn(param1:Event) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(this._dragItem)
|
||||
{
|
||||
this._dragItem.f = this._dragItem.f == 0 ? 1 : 0;
|
||||
this.setItemMatrix(this._dragItem,this._dragItem.x,this._dragItem.y,this._dragItem.f);
|
||||
}
|
||||
}
|
||||
|
||||
private function isInInitList(param1:int, param2:int) : Boolean
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
while(_loc3_ < this._itemsInit.length)
|
||||
{
|
||||
if(this._itemsInit[_loc3_].refId == param2 && this._itemsInit[_loc3_].i == param1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function releaseItem(param1:Object, param2:Boolean = true) : void
|
||||
{
|
||||
var _loc3_:int = this._currItems.indexOf(param1);
|
||||
if(_loc3_ >= 0)
|
||||
{
|
||||
this._currItems.splice(_loc3_,1);
|
||||
if(param1.di)
|
||||
{
|
||||
if(param1.di.displayObject.parent)
|
||||
{
|
||||
param1.di.displayObject.parent.removeChild(param1.di.displayObject);
|
||||
}
|
||||
if(param1.di.minigameDefId > 0)
|
||||
{
|
||||
this.removeListenersFromItem(param1.di);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!param2)
|
||||
{
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < this._itemsInit.length)
|
||||
{
|
||||
if(this._itemsInit[_loc3_].i == param1.i)
|
||||
{
|
||||
this._itemsInit.splice(_loc3_,1);
|
||||
break;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function setItemMatrix(param1:Object, param2:Number, param3:Number, param4:int = 0) : void
|
||||
{
|
||||
var _loc9_:Sprite = null;
|
||||
var _loc10_:Loader = null;
|
||||
var _loc11_:MovieClip = null;
|
||||
var _loc12_:Number = NaN;
|
||||
var _loc13_:Number = NaN;
|
||||
var _loc5_:DisplayObject = param1.di.displayObject;
|
||||
param1.x = param2;
|
||||
param1.y = param3;
|
||||
var _loc6_:Matrix = _loc5_.transform.matrix;
|
||||
_loc6_.identity();
|
||||
var _loc7_:Number = param2;
|
||||
var _loc8_:Number = param3;
|
||||
if(param1.di.bFlipLabel)
|
||||
{
|
||||
_loc9_ = _loc5_ as Sprite;
|
||||
_loc10_ = _loc9_.getChildAt(0) as Loader;
|
||||
_loc11_ = _loc10_.content as MovieClip;
|
||||
_loc11_.gotoAndStop(param4 ? "flip" : 1);
|
||||
}
|
||||
else if(param4)
|
||||
{
|
||||
_loc12_ = 1;
|
||||
_loc13_ = 1;
|
||||
_loc12_ *= -1;
|
||||
_loc7_ += _loc5_.width;
|
||||
_loc6_.scale(_loc12_,_loc13_);
|
||||
}
|
||||
_loc6_.translate(_loc7_,_loc8_);
|
||||
_loc5_.transform.matrix = _loc6_;
|
||||
}
|
||||
|
||||
private function hitTest(param1:int, param2:int) : Object
|
||||
{
|
||||
var _loc5_:Object = null;
|
||||
var _loc7_:int = 0;
|
||||
var _loc8_:Object = null;
|
||||
var _loc9_:DisplayObject = null;
|
||||
var _loc10_:Rectangle = null;
|
||||
var _loc11_:Number = NaN;
|
||||
var _loc3_:Number = -999999999;
|
||||
var _loc4_:int = 99999999;
|
||||
var _loc6_:int = int(this._currItems.length);
|
||||
while(_loc7_ < _loc6_)
|
||||
{
|
||||
_loc8_ = this._currItems[_loc7_];
|
||||
if(!this.isTheme(_loc8_.s))
|
||||
{
|
||||
_loc9_ = _loc8_.di.displayObject;
|
||||
_loc10_ = _loc9_.getBounds(this._layerManager.room_avatars);
|
||||
_loc11_ = _loc10_.bottom - Number(_loc9_.name);
|
||||
if(param1 > _loc10_.left && param1 < _loc10_.right && param2 > _loc10_.top && param2 < _loc10_.bottom)
|
||||
{
|
||||
if(_loc8_.l <= _loc4_)
|
||||
{
|
||||
if(_loc8_.l == 1 || _loc11_ > _loc3_)
|
||||
{
|
||||
_loc4_ = int(_loc8_.l);
|
||||
_loc3_ = _loc11_;
|
||||
_loc5_ = _loc8_;
|
||||
if(_loc4_ == 1)
|
||||
{
|
||||
_loc3_ = -999999999;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_loc7_++;
|
||||
}
|
||||
return _loc5_;
|
||||
}
|
||||
|
||||
private function itemLoaded(param1:DenItemHelper) : void
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
var _loc3_:Object = null;
|
||||
var _loc4_:DisplayObject = null;
|
||||
var _loc5_:Number = NaN;
|
||||
var _loc6_:Number = NaN;
|
||||
var _loc7_:int = 0;
|
||||
var _loc8_:int = 0;
|
||||
var _loc9_:Object = null;
|
||||
var _loc10_:SortLayer = null;
|
||||
for each(_loc3_ in this._currItems)
|
||||
{
|
||||
if(_loc3_.di == param1)
|
||||
{
|
||||
_loc2_ = _loc3_;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(_loc2_)
|
||||
{
|
||||
_loc4_ = param1.displayObject;
|
||||
_loc2_.offX = -(_loc4_.width * 0.5);
|
||||
_loc2_.offY = -_loc4_.height;
|
||||
_loc5_ = _loc2_.x + _loc2_.offX;
|
||||
_loc6_ = _loc2_.y + _loc2_.offY;
|
||||
if(_loc2_.bNewPlaced)
|
||||
{
|
||||
_loc6_ += _loc4_.height * 0.5;
|
||||
_loc2_.bNewPlaced = false;
|
||||
}
|
||||
if(this._roomMode == RoomManagerWorld.ROOM_MODE_DEN)
|
||||
{
|
||||
if(Boolean(_loc2_.di) && Boolean(_loc2_.di.content) && Boolean(_loc2_.di.content.hasOwnProperty("listenToMouse")))
|
||||
{
|
||||
_loc2_.di.content.listenToMouse = false;
|
||||
}
|
||||
}
|
||||
else if(Boolean(_loc4_) && Boolean(_loc2_.di) && Boolean(_loc2_.di.content) && Boolean(_loc2_.di.content.hasOwnProperty("ignoreMouseCompletely")))
|
||||
{
|
||||
Sprite(_loc4_).mouseEnabled = false;
|
||||
Sprite(_loc4_).mouseChildren = false;
|
||||
}
|
||||
_loc8_ = int(_loc2_.l);
|
||||
this.setItemMatrix(_loc2_,_loc5_,_loc6_,_loc2_.f);
|
||||
if(this.isTheme(_loc2_.s))
|
||||
{
|
||||
_loc8_ = 100;
|
||||
_loc4_.x = 0;
|
||||
_loc4_.y = 0;
|
||||
this.setItemMatrix(_loc2_,0,0);
|
||||
}
|
||||
for each(_loc9_ in this._itemsInit)
|
||||
{
|
||||
if(_loc2_.r == _loc9_.r && _loc2_.i == _loc9_.i)
|
||||
{
|
||||
if(_loc2_.x != _loc9_.x || _loc2_.y != _loc9_.y)
|
||||
{
|
||||
_loc9_.x = _loc2_.x;
|
||||
_loc9_.y = _loc2_.y;
|
||||
_loc9_.offX = _loc2_.offX;
|
||||
_loc9_.offY = _loc2_.offY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
switch(_loc8_)
|
||||
{
|
||||
default:
|
||||
_loc7_ = param1.sortOffset;
|
||||
_loc10_ = this._layerManager.room_avatars;
|
||||
if(_loc7_)
|
||||
{
|
||||
_loc4_.name = String(_loc7_);
|
||||
}
|
||||
_loc10_.addChild(_loc4_);
|
||||
break;
|
||||
case 1:
|
||||
this._layerManager.room_bkg_main.addChild(_loc4_);
|
||||
break;
|
||||
case 100:
|
||||
this._layerManager.room_bkg_main.addChildAt(_loc4_,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function addListenersToItem(param1:DenItemHelper, param2:Object) : void
|
||||
{
|
||||
param1.addMouseListeners(param2,this.onItemDown,this.onItemOver,this.onItemOut);
|
||||
}
|
||||
|
||||
private function removeListenersFromItem(param1:DenItemHelper) : void
|
||||
{
|
||||
param1.removeMouseListeners();
|
||||
}
|
||||
|
||||
private function onItemDown(param1:MouseEvent, param2:int) : void
|
||||
{
|
||||
if(this._roomMode != RoomManagerWorld.ROOM_MODE_AVATAR)
|
||||
{
|
||||
return;
|
||||
}
|
||||
param1.stopPropagation();
|
||||
this.sendMouseEvent(param1);
|
||||
var _loc3_:Object = {"typeDefId":param2};
|
||||
MinigameManager.handleGameClick(_loc3_,null);
|
||||
}
|
||||
|
||||
private function onItemOver(param1:MouseEvent, param2:Object, param3:int) : void
|
||||
{
|
||||
if(this._roomMode != RoomManagerWorld.ROOM_MODE_AVATAR)
|
||||
{
|
||||
return;
|
||||
}
|
||||
param1.stopPropagation();
|
||||
this.sendMouseEvent(param1);
|
||||
var _loc4_:Sprite = Sprite(param1.currentTarget);
|
||||
GuiManager.toolTip.init(this._layerManager.room_orbs,MinigameManager.getGameName(param3),param2.x + _loc4_.width * 0.5,param2.y + _loc4_.height - 75);
|
||||
GuiManager.toolTip.startTimer(param1);
|
||||
}
|
||||
|
||||
private function onItemOut(param1:MouseEvent) : void
|
||||
{
|
||||
if(this._roomMode != RoomManagerWorld.ROOM_MODE_AVATAR)
|
||||
{
|
||||
return;
|
||||
}
|
||||
param1.stopPropagation();
|
||||
this.sendMouseEvent(param1);
|
||||
GuiManager.toolTip.resetTimerAndSetVisibility();
|
||||
}
|
||||
|
||||
private function sendMouseEvent(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc3_:Sprite = null;
|
||||
var _loc4_:Loader = null;
|
||||
var _loc5_:MovieClip = null;
|
||||
var _loc2_:int = -1;
|
||||
switch(param1.type)
|
||||
{
|
||||
case MouseEvent.MOUSE_DOWN:
|
||||
_loc2_ = this.MOUSE_DOWN_TYPE;
|
||||
break;
|
||||
case MouseEvent.MOUSE_OVER:
|
||||
_loc2_ = this.MOUSE_OVER_TYPE;
|
||||
break;
|
||||
case MouseEvent.MOUSE_OUT:
|
||||
_loc2_ = this.MOUSE_OUT_TYPE;
|
||||
}
|
||||
if(_loc2_ >= 0)
|
||||
{
|
||||
_loc3_ = Sprite(param1.currentTarget);
|
||||
_loc4_ = Loader(_loc3_.getChildAt(0));
|
||||
if(_loc4_)
|
||||
{
|
||||
_loc5_ = MovieClip(_loc4_.content);
|
||||
if(_loc5_)
|
||||
{
|
||||
if(_loc5_.hasOwnProperty("handleMouse"))
|
||||
{
|
||||
_loc5_.handleMouse(_loc2_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,135 @@
|
||||
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_chat:DisplayLayer;
|
||||
|
||||
private var _layer_room_orbs:DisplayLayer;
|
||||
|
||||
private var _layer_room_fg: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_fg = new DisplayLayer();
|
||||
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_bkg.addChild(this._layer_room_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;
|
||||
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 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_avatars() : SortLayer
|
||||
{
|
||||
return this._layer_room_avatars;
|
||||
}
|
||||
|
||||
public function get room_chat() : DisplayLayer
|
||||
{
|
||||
return this._layer_room_chat;
|
||||
}
|
||||
|
||||
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 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,479 @@
|
||||
package room
|
||||
{
|
||||
import com.baseoneonline.astar.AStar;
|
||||
import com.baseoneonline.astar.Graph;
|
||||
import flash.geom.Point;
|
||||
import flash.utils.ByteArray;
|
||||
|
||||
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;
|
||||
_loc4_ = new Vector.<uint>(param1.height * param1.width);
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < _loc3_.length / 2)
|
||||
{
|
||||
_loc6_ = _loc3_.readUnsignedShort();
|
||||
_loc7_ = uint(_loc6_ >> 14);
|
||||
_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
@@ -0,0 +1,685 @@
|
||||
package room
|
||||
{
|
||||
import avatar.AvatarManager;
|
||||
import avatar.AvatarSwitch;
|
||||
import avatar.AvatarWorldView;
|
||||
import flash.events.Event;
|
||||
import flash.events.FocusEvent;
|
||||
import flash.events.KeyboardEvent;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.geom.Point;
|
||||
import flash.ui.Keyboard;
|
||||
import flash.utils.getTimer;
|
||||
import gui.DarkenManager;
|
||||
import gui.GuiManager;
|
||||
import quest.QuestManager;
|
||||
|
||||
public class RoomManagerView extends RoomManagerBase
|
||||
{
|
||||
|
||||
protected static const USE_PLAYER_GOTO_SPAWN_LOCATION:String = "use_player_goto_spawn_location";
|
||||
|
||||
private static const TAN_30:Number = 0.5773502691896;
|
||||
|
||||
protected var _mousePos:Point;
|
||||
|
||||
protected var _bMouseMove:Boolean;
|
||||
|
||||
protected var _bMouseDown:Boolean;
|
||||
|
||||
protected var _bMouseDownNew:Boolean;
|
||||
|
||||
protected var _bTestPortal:Boolean;
|
||||
|
||||
protected var _playerGotoSpawnPoint:String;
|
||||
|
||||
protected var _playerGotoSpawnLocationX:int;
|
||||
|
||||
protected var _playerGotoSpawnLocationY:int;
|
||||
|
||||
protected var _leftArrow:Boolean;
|
||||
|
||||
protected var _rightArrow:Boolean;
|
||||
|
||||
protected var _upArrow:Boolean;
|
||||
|
||||
protected var _downArrow:Boolean;
|
||||
|
||||
protected var _avatarDirection:Point;
|
||||
|
||||
protected var _keyboardEnabled:Boolean;
|
||||
|
||||
private var _followPath:Vector.<int>;
|
||||
|
||||
private var _movePlayerToPos:Point;
|
||||
|
||||
private var _lastGridCell:int;
|
||||
|
||||
private var _avLastValidCell:int;
|
||||
|
||||
private var _followCursorPos:Point;
|
||||
|
||||
private var _followCursorThrottle:int;
|
||||
|
||||
private var _playerSlideSpawnPoint:String;
|
||||
|
||||
private var _slideList:Array;
|
||||
|
||||
private var _socialTriggerThrottle:int;
|
||||
|
||||
private var _drawPath:Boolean;
|
||||
|
||||
private var _debugLog:String;
|
||||
|
||||
private var _startTime:int;
|
||||
|
||||
private var _computeCoordinates:Boolean;
|
||||
|
||||
private var _immediateCoordinates:Point;
|
||||
|
||||
private var _frameTime:Number;
|
||||
|
||||
public function RoomManagerView()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
override public function init(param1:LayerManager) : void
|
||||
{
|
||||
super.init(param1);
|
||||
this._followCursorPos = new Point();
|
||||
this._mousePos = new Point();
|
||||
this._slideList = [];
|
||||
this._keyboardEnabled = true;
|
||||
this._debugLog = new String();
|
||||
gMainFrame.stage.addEventListener(MouseEvent.MOUSE_MOVE,this.onMouseMoveEvt);
|
||||
gMainFrame.stage.addEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDownEvt);
|
||||
gMainFrame.stage.addEventListener(MouseEvent.MOUSE_UP,this.onMouseUpEvt);
|
||||
gMainFrame.stage.addEventListener(FocusEvent.FOCUS_OUT,this.onDeactivate);
|
||||
gMainFrame.stage.addEventListener(Event.DEACTIVATE,this.onDeactivate);
|
||||
gMainFrame.stage.addEventListener(KeyboardEvent.KEY_DOWN,this.onKeyDownEvt);
|
||||
gMainFrame.stage.addEventListener(KeyboardEvent.KEY_UP,this.onKeyUpEvt);
|
||||
this._avatarDirection = new Point();
|
||||
}
|
||||
|
||||
override public function destroy() : void
|
||||
{
|
||||
super.destroy();
|
||||
gMainFrame.stage.removeEventListener(MouseEvent.MOUSE_MOVE,this.onMouseMoveEvt);
|
||||
gMainFrame.stage.removeEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDownEvt);
|
||||
gMainFrame.stage.removeEventListener(MouseEvent.MOUSE_UP,this.onMouseUpEvt);
|
||||
gMainFrame.stage.removeEventListener(FocusEvent.FOCUS_OUT,this.onDeactivate);
|
||||
gMainFrame.stage.removeEventListener(Event.DEACTIVATE,this.onDeactivate);
|
||||
gMainFrame.stage.removeEventListener(KeyboardEvent.KEY_DOWN,this.onKeyDownEvt);
|
||||
gMainFrame.stage.removeEventListener(KeyboardEvent.KEY_UP,this.onKeyUpEvt);
|
||||
}
|
||||
|
||||
override public function exitRoom() : void
|
||||
{
|
||||
super.exitRoom();
|
||||
this._movePlayerToPos = null;
|
||||
this._bMouseDown = false;
|
||||
this._bMouseDownNew = false;
|
||||
this._bMouseMove = false;
|
||||
this._bTestPortal = false;
|
||||
this._playerSlideSpawnPoint = null;
|
||||
if(this._slideList.length)
|
||||
{
|
||||
this._slideList = [];
|
||||
}
|
||||
}
|
||||
|
||||
override protected function onRoomLoaded_base(param1:Function) : void
|
||||
{
|
||||
this._movePlayerToPos = null;
|
||||
this._followPath = null;
|
||||
this._bMouseDown = false;
|
||||
this._bMouseDownNew = false;
|
||||
this._lastGridCell = -1;
|
||||
this._avLastValidCell = -1;
|
||||
super.onRoomLoaded_base(param1);
|
||||
}
|
||||
|
||||
public function setGotoSpawnLocation(param1:int, param2:int) : void
|
||||
{
|
||||
this._playerGotoSpawnLocationX = param1;
|
||||
this._playerGotoSpawnLocationY = param2;
|
||||
this._playerGotoSpawnPoint = USE_PLAYER_GOTO_SPAWN_LOCATION;
|
||||
}
|
||||
|
||||
public function setGotoSpawnPoint(param1:String) : void
|
||||
{
|
||||
this._playerGotoSpawnPoint = param1;
|
||||
}
|
||||
|
||||
public function resetThrottle() : void
|
||||
{
|
||||
this._followCursorThrottle = 0;
|
||||
}
|
||||
|
||||
protected function walkToSpawn(param1:String) : void
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
var _loc3_:Point = null;
|
||||
_loc2_ = findSpawn(_spawns,param1);
|
||||
if(_loc2_)
|
||||
{
|
||||
this._bTestPortal = false;
|
||||
this._movePlayerToPos = new Point(_loc2_.x,_loc2_.y);
|
||||
_loc3_ = getRandomRadiusOffset(_loc2_.r);
|
||||
this._movePlayerToPos.x += _loc3_.x;
|
||||
this._movePlayerToPos.y += _loc3_.y;
|
||||
convertToWorldSpace(this._movePlayerToPos);
|
||||
}
|
||||
}
|
||||
|
||||
private function onKeyDownEvt(param1:KeyboardEvent) : void
|
||||
{
|
||||
var _loc2_:Boolean = false;
|
||||
switch(param1.keyCode)
|
||||
{
|
||||
case Keyboard.LEFT:
|
||||
if(this._avatarDirection.x >= 0)
|
||||
{
|
||||
this._leftArrow = true;
|
||||
_loc2_ = true;
|
||||
this._avatarDirection.x = -1;
|
||||
}
|
||||
break;
|
||||
case Keyboard.RIGHT:
|
||||
if(this._avatarDirection.x <= 0)
|
||||
{
|
||||
this._rightArrow = true;
|
||||
_loc2_ = true;
|
||||
this._avatarDirection.x = 1;
|
||||
}
|
||||
break;
|
||||
case Keyboard.UP:
|
||||
if(this._avatarDirection.y >= 0)
|
||||
{
|
||||
this._upArrow = true;
|
||||
_loc2_ = true;
|
||||
this._avatarDirection.y = -1;
|
||||
}
|
||||
break;
|
||||
case Keyboard.DOWN:
|
||||
if(this._avatarDirection.y <= 0)
|
||||
{
|
||||
this._downArrow = true;
|
||||
_loc2_ = true;
|
||||
this._avatarDirection.y = 1;
|
||||
}
|
||||
}
|
||||
if(_loc2_)
|
||||
{
|
||||
if(AvatarManager.roomEnviroType == Utility.ENVIRO_LAND && Math.abs(this._avatarDirection.x) > 0 && Math.abs(this._avatarDirection.y) > 0)
|
||||
{
|
||||
this._avatarDirection.y = (this._avatarDirection.y > 0 ? 1 : -1) * TAN_30 * Math.abs(this._avatarDirection.x);
|
||||
}
|
||||
this._avatarDirection.normalize(1);
|
||||
}
|
||||
}
|
||||
|
||||
private function onKeyUpEvt(param1:KeyboardEvent) : void
|
||||
{
|
||||
var _loc2_:Boolean = false;
|
||||
switch(param1.keyCode)
|
||||
{
|
||||
case Keyboard.LEFT:
|
||||
if(this._leftArrow)
|
||||
{
|
||||
this._leftArrow = false;
|
||||
if(this._avatarDirection.x < 0)
|
||||
{
|
||||
this._avatarDirection.x = this._rightArrow ? 1 : 0;
|
||||
_loc2_ = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Keyboard.RIGHT:
|
||||
if(this._rightArrow)
|
||||
{
|
||||
this._rightArrow = false;
|
||||
if(this._avatarDirection.x > 0)
|
||||
{
|
||||
this._avatarDirection.x = this._leftArrow ? -1 : 0;
|
||||
_loc2_ = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Keyboard.UP:
|
||||
if(this._upArrow)
|
||||
{
|
||||
this._upArrow = false;
|
||||
if(this._avatarDirection.y < 0)
|
||||
{
|
||||
this._avatarDirection.y = this._downArrow ? 1 : 0;
|
||||
_loc2_ = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Keyboard.DOWN:
|
||||
if(this._downArrow)
|
||||
{
|
||||
this._downArrow = false;
|
||||
if(this._avatarDirection.y > 0)
|
||||
{
|
||||
this._avatarDirection.y = this._upArrow ? -1 : 0;
|
||||
_loc2_ = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(_loc2_)
|
||||
{
|
||||
this._avatarDirection.normalize(1);
|
||||
}
|
||||
}
|
||||
|
||||
private function onDeactivate(param1:Event) : void
|
||||
{
|
||||
this._leftArrow = this._rightArrow = this._upArrow = this._downArrow = false;
|
||||
this._avatarDirection.x = this._avatarDirection.y = 0;
|
||||
}
|
||||
|
||||
private function onMouseMoveEvt(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_:AvatarWorldView = null;
|
||||
if(GuiManager.isModal() || DarkenManager.isDarkened)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(_layerManager.bkg == null || _mainBackObj == null || !this._bTestPortal)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(this._bMouseDown)
|
||||
{
|
||||
this._followCursorPos.x = param1.stageX;
|
||||
this._followCursorPos.y = param1.stageY;
|
||||
if(this._drawPath)
|
||||
{
|
||||
this._debugLog = this._debugLog.concat(getTimer() - this._startTime + " MOUSE_MOVE, stageX=" + param1.stageX + ", stageY=" + param1.stageY);
|
||||
if(this._computeCoordinates)
|
||||
{
|
||||
this._immediateCoordinates = convertScreenToWorldSpace(this._followCursorPos.x,this._followCursorPos.y);
|
||||
this._debugLog = this._debugLog.concat(" worldX=" + this._immediateCoordinates.x + ", worldY=" + this._immediateCoordinates.y);
|
||||
}
|
||||
this._debugLog = this._debugLog.concat("\n");
|
||||
}
|
||||
}
|
||||
this._mousePos.x = param1.stageX;
|
||||
this._mousePos.y = param1.stageY;
|
||||
this._bMouseMove = true;
|
||||
for each(_loc2_ in AvatarManager.avatarViewList)
|
||||
{
|
||||
_loc2_.checkSelnub(param1);
|
||||
}
|
||||
}
|
||||
|
||||
private function onMouseDownEvt(param1:MouseEvent) : void
|
||||
{
|
||||
GuiManager.handleMouseDown();
|
||||
if(GuiManager.isModal() || AvatarSwitch.isSwitching())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(_layerManager.bkg == null || _mainBackObj == null || !this._bTestPortal)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(QuestManager.mouseHandleDown(param1) == false)
|
||||
{
|
||||
if(this._drawPath)
|
||||
{
|
||||
if(this._startTime < 0)
|
||||
{
|
||||
this._startTime = getTimer();
|
||||
}
|
||||
this._debugLog = this._debugLog.concat(getTimer() - this._startTime + " MOUSE_DOWN, stageX=" + param1.stageX + ", stageY=" + param1.stageY);
|
||||
if(this._computeCoordinates)
|
||||
{
|
||||
this._immediateCoordinates = convertScreenToWorldSpace(this._followCursorPos.x,this._followCursorPos.y);
|
||||
this._debugLog = this._debugLog.concat(" worldX=" + this._immediateCoordinates.x + ", worldY=" + this._immediateCoordinates.y);
|
||||
}
|
||||
this._debugLog = this._debugLog.concat("\n");
|
||||
}
|
||||
this._bMouseDown = true;
|
||||
this._bMouseDownNew = true;
|
||||
this._followCursorPos.x = param1.stageX;
|
||||
this._followCursorPos.y = param1.stageY;
|
||||
this._followCursorThrottle = 0;
|
||||
this._mousePos.x = param1.stageX;
|
||||
this._mousePos.y = param1.stageY;
|
||||
this._bMouseMove = true;
|
||||
}
|
||||
}
|
||||
|
||||
private function onMouseUpEvt(param1:MouseEvent) : void
|
||||
{
|
||||
this.forceMouseUp();
|
||||
if(this._drawPath)
|
||||
{
|
||||
this._debugLog = this._debugLog.concat(getTimer() - this._startTime + " MOUSE_UP\n");
|
||||
}
|
||||
}
|
||||
|
||||
private function forceMouseUp() : void
|
||||
{
|
||||
this._bMouseDown = false;
|
||||
this._bMouseDownNew = false;
|
||||
this._lastGridCell = -1;
|
||||
}
|
||||
|
||||
public function setFocus(param1:Boolean = true) : void
|
||||
{
|
||||
if(!param1)
|
||||
{
|
||||
this.forceMouseUp();
|
||||
}
|
||||
}
|
||||
|
||||
public function heartbeat_movePlayer(param1:int, param2:int) : void
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:Object = null;
|
||||
this._frameTime = param2 / 1000;
|
||||
if(this._frameTime > 0.5)
|
||||
{
|
||||
this._frameTime = 0.5;
|
||||
}
|
||||
if(this._movePlayerToPos)
|
||||
{
|
||||
this.movePlayerToLocation(this._movePlayerToPos.x,this._movePlayerToPos.y);
|
||||
this._movePlayerToPos = null;
|
||||
}
|
||||
else if(AvatarManager.playerAvatarWorldView != null && !AvatarManager.playerAvatarWorldView.moving)
|
||||
{
|
||||
if(this._playerSlideSpawnPoint)
|
||||
{
|
||||
this.walkToSpawn(this._playerSlideSpawnPoint);
|
||||
this._playerSlideSpawnPoint = null;
|
||||
}
|
||||
else if(this._followPath)
|
||||
{
|
||||
this.movePlayerOnPath();
|
||||
}
|
||||
else
|
||||
{
|
||||
this._bTestPortal = true;
|
||||
}
|
||||
}
|
||||
else if(_mainBackObj)
|
||||
{
|
||||
if(AvatarManager.playerAvatarWorldView != null && _mainBackObj != null)
|
||||
{
|
||||
_loc3_ = _roomGrid.getCellIndex(AvatarManager.playerAvatarWorldView.x + _mainBackObj.x,AvatarManager.playerAvatarWorldView.y + _mainBackObj.y);
|
||||
if(this._avLastValidCell != _loc3_)
|
||||
{
|
||||
_loc4_ = _roomGrid.convertCellToCoords(_loc3_);
|
||||
if(!_roomGrid.testGridCell(_loc4_.x,_loc4_.y))
|
||||
{
|
||||
this._avLastValidCell = _loc3_;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function followCursorTest() : void
|
||||
{
|
||||
var _loc1_:Point = null;
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:Number = NaN;
|
||||
var _loc5_:Number = NaN;
|
||||
var _loc6_:Boolean = false;
|
||||
if(this._followCursorThrottle <= 0 && this._bMouseDown)
|
||||
{
|
||||
if(this._computeCoordinates)
|
||||
{
|
||||
_loc1_ = this._immediateCoordinates;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = convertScreenToWorldSpace(this._followCursorPos.x,this._followCursorPos.y);
|
||||
}
|
||||
_loc2_ = _roomGrid.getCellIndex(_loc1_.x + _mainBackObj.x,_loc1_.y + _mainBackObj.y);
|
||||
if(this._lastGridCell != _loc2_)
|
||||
{
|
||||
this._lastGridCell = _loc2_;
|
||||
this._movePlayerToPos = _loc1_;
|
||||
this._followPath = null;
|
||||
this._followCursorThrottle = 12;
|
||||
if(this._drawPath)
|
||||
{
|
||||
this._debugLog = this._debugLog.concat(getTimer() - this._startTime + " Processing cursor posX=" + this._followCursorPos.x + ", cursor posY=" + this._followCursorPos.y + ", moving to " + _loc1_.x + "," + _loc1_.y + "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
--this._followCursorThrottle;
|
||||
}
|
||||
if(Boolean(this._keyboardEnabled && !DarkenManager.isDarkened && !GuiManager.volumeMgr.visible && AvatarManager.playerAvatarWorldView && this._movePlayerToPos == null && this._followPath == null) && Boolean(this._playerSlideSpawnPoint == null) && this._bTestPortal)
|
||||
{
|
||||
if(this._avatarDirection.x != 0 || this._avatarDirection.y != 0)
|
||||
{
|
||||
_loc1_ = new Point();
|
||||
_loc3_ = 24 * this._frameTime / 0.07;
|
||||
_loc4_ = this._avatarDirection.x * _loc3_;
|
||||
_loc5_ = this._avatarDirection.y * _loc3_;
|
||||
_loc1_.x = AvatarManager.playerAvatarWorldView.x;
|
||||
_loc1_.y = AvatarManager.playerAvatarWorldView.y;
|
||||
_loc6_ = true;
|
||||
if((_loc6_) && collisionTestGrid(_loc1_.x + _loc4_,_loc1_.y + _loc5_) != 0)
|
||||
{
|
||||
if(_loc4_ != 0 && _loc5_ != 0)
|
||||
{
|
||||
if(collisionTestGrid(_loc1_.x,_loc1_.y + _loc5_) != 0)
|
||||
{
|
||||
if(collisionTestGrid(_loc1_.x + _loc4_,_loc1_.y) == 0)
|
||||
{
|
||||
AvatarManager.movePlayer(_loc1_.x + _loc4_,_loc1_.y);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AvatarManager.movePlayer(_loc1_.x,_loc1_.y + _loc5_);
|
||||
}
|
||||
}
|
||||
else if(_loc4_ == 0)
|
||||
{
|
||||
_loc4_ = Math.abs(_loc5_);
|
||||
if(collisionTestGrid(_loc1_.x + 25,_loc1_.y + _loc5_) != 0)
|
||||
{
|
||||
if(collisionTestGrid(_loc1_.x - 25,_loc1_.y + _loc5_) == 0)
|
||||
{
|
||||
AvatarManager.movePlayer(_loc1_.x - _loc4_,_loc1_.y + _loc5_);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AvatarManager.movePlayer(_loc1_.x + _loc4_,_loc1_.y + _loc5_);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc5_ = Math.abs(_loc4_);
|
||||
if(collisionTestGrid(_loc1_.x + _loc4_,_loc1_.y - 25) != 0)
|
||||
{
|
||||
if(collisionTestGrid(_loc1_.x + _loc4_,_loc1_.y + 25) == 0)
|
||||
{
|
||||
AvatarManager.movePlayer(_loc1_.x + _loc4_,_loc1_.y + _loc5_);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AvatarManager.movePlayer(_loc1_.x + _loc4_,_loc1_.y - _loc5_);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AvatarManager.movePlayer(_loc1_.x + _loc4_,_loc1_.y + _loc5_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function updateSplashVolumes() : void
|
||||
{
|
||||
var _loc1_:Object = null;
|
||||
var _loc2_:Object = null;
|
||||
var _loc3_:* = undefined;
|
||||
var _loc4_:Object = null;
|
||||
var _loc5_:String = null;
|
||||
if(_volumeManager.hasSplashVolume)
|
||||
{
|
||||
_loc1_ = AvatarManager.avatarViewList;
|
||||
for(_loc2_ in _loc1_)
|
||||
{
|
||||
_loc3_ = _loc1_[_loc2_];
|
||||
_loc4_ = _volumeManager.testSplashVolumes(new Point(_loc3_.x,_loc3_.y));
|
||||
if(_loc4_)
|
||||
{
|
||||
_loc5_ = _loc4_.message;
|
||||
}
|
||||
_loc3_.setSplashVolume(_loc4_ != null,_loc5_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function updateSocialVolumes() : void
|
||||
{
|
||||
++this._socialTriggerThrottle;
|
||||
if(this._socialTriggerThrottle > 20)
|
||||
{
|
||||
this._socialTriggerThrottle = 0;
|
||||
_volumeManager.updateSocialTriggers(AvatarManager.avatarViewList);
|
||||
}
|
||||
}
|
||||
|
||||
private function movePlayerToLocation(param1:int, param2:int) : void
|
||||
{
|
||||
var _loc3_:Object = null;
|
||||
var _loc4_:Number = NaN;
|
||||
var _loc5_:Number = NaN;
|
||||
if(AvatarManager.playerAvatar)
|
||||
{
|
||||
_loc4_ = AvatarManager.playerAvatarWorldView.x;
|
||||
_loc5_ = AvatarManager.playerAvatarWorldView.y;
|
||||
if(_roomGrid)
|
||||
{
|
||||
_loc3_ = _roomGrid.convertCellToCoords(_roomGrid.getCellIndex(_loc4_ + _mainBackObj.x,_loc5_ + _mainBackObj.y));
|
||||
if(Boolean(_roomGrid.testGridCell(_loc3_.x,_loc3_.y)) && this._avLastValidCell >= 0)
|
||||
{
|
||||
_loc3_ = _roomGrid.getCellIndexToWorldPos(this._avLastValidCell);
|
||||
_loc4_ = _loc3_.x - _mainBackObj.x;
|
||||
_loc5_ = _loc3_.y - _mainBackObj.y;
|
||||
}
|
||||
_loc3_ = _roomGrid.findClosestOpenGridCell(param1 + _mainBackObj.x,param2 + _mainBackObj.y);
|
||||
if(_loc3_)
|
||||
{
|
||||
param1 = _loc3_.x - _mainBackObj.x;
|
||||
param2 = _loc3_.y - _mainBackObj.y;
|
||||
this._followPath = _roomGrid.findPathOptimized(new Point(_loc4_ + _mainBackObj.x,_loc5_ + _mainBackObj.y),new Point(param1 + _mainBackObj.x,param2 + _mainBackObj.y));
|
||||
if(this._followPath == null || this._followPath.length == 0)
|
||||
{
|
||||
this._followPath = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(this._drawPath)
|
||||
{
|
||||
drawDebugLayer(this._followPath);
|
||||
}
|
||||
this.movePlayerOnPath();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function setGridDepth(param1:uint) : void
|
||||
{
|
||||
_roomGrid.setGridDepth(param1);
|
||||
}
|
||||
|
||||
private function movePlayerOnPath() : void
|
||||
{
|
||||
var _loc1_:Object = null;
|
||||
if(_mainBackObj)
|
||||
{
|
||||
_loc1_ = _roomGrid.getCellIndexToWorldPos(this._followPath[0]);
|
||||
AvatarManager.movePlayer(_loc1_.x - _mainBackObj.x,_loc1_.y - _mainBackObj.y);
|
||||
if(this._followPath.length == 1)
|
||||
{
|
||||
this._followPath = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._followPath.splice(0,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function killPlayerPath() : void
|
||||
{
|
||||
this._followPath = null;
|
||||
}
|
||||
|
||||
public function attachAvatarToSlide(param1:AvatarWorldView, param2:String, param3:String = null) : void
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
var _loc8_:Object = null;
|
||||
var _loc9_:* = undefined;
|
||||
var _loc6_:Point = new Point();
|
||||
var _loc7_:Array = this._slideList[param2];
|
||||
if(param3)
|
||||
{
|
||||
this._playerSlideSpawnPoint = param3;
|
||||
}
|
||||
if(_loc7_ == null && Boolean(_layers))
|
||||
{
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _layers.length)
|
||||
{
|
||||
_loc8_ = _layers[_loc4_];
|
||||
if(_loc8_.name == param2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
if(_loc8_)
|
||||
{
|
||||
_loc9_ = _loc8_.s.content;
|
||||
_loc7_ = [];
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _loc9_.totalFrames)
|
||||
{
|
||||
_loc9_.gotoAndStop(_loc4_);
|
||||
_loc6_.x = _loc9_.player.x + _loc8_.x;
|
||||
_loc6_.y = _loc9_.player.y + _loc8_.y;
|
||||
convertToWorldSpace(_loc6_);
|
||||
_loc7_[_loc4_] = {
|
||||
"x":_loc6_.x,
|
||||
"y":_loc6_.y
|
||||
};
|
||||
_loc4_++;
|
||||
}
|
||||
this._slideList[param2] = _loc7_;
|
||||
}
|
||||
}
|
||||
if(Boolean(_loc7_) && Boolean(param1))
|
||||
{
|
||||
param1.startSlide(_loc7_);
|
||||
}
|
||||
this._movePlayerToPos = null;
|
||||
this._followPath = null;
|
||||
this._bMouseDown = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,421 @@
|
||||
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 gamePlayFlow.GamePlay;
|
||||
import gui.DarkenManager;
|
||||
import gui.GuiManager;
|
||||
import gui.WelcomeToCarnival;
|
||||
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 shardSelectionUsername:String;
|
||||
|
||||
public static var _loadingNewRoom:Boolean;
|
||||
|
||||
private static var _denJoinPending:Boolean;
|
||||
|
||||
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;
|
||||
_roomMgr = RoomManagerWorld.instance;
|
||||
shardSelectionUsername = "";
|
||||
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 sendRoomShardRequest() : void
|
||||
{
|
||||
gMainFrame.server.setXtObject_Str("rs",[_roomMgr.shardId]);
|
||||
}
|
||||
|
||||
public static function sendMoreShardRequest() : void
|
||||
{
|
||||
gMainFrame.server.setXtObject_Str("rm",[shardSelectionUsername],false);
|
||||
}
|
||||
|
||||
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 sendRoomJoinRequest(param1:String, param2:Boolean = false, param3:Boolean = false) : void
|
||||
{
|
||||
if(param1.slice(0,3) == "den" && !param2)
|
||||
{
|
||||
DenXtCommManager.requestDenJoinFull(param1,param3);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendRoomJoinRequestFull(param1,param3);
|
||||
}
|
||||
}
|
||||
|
||||
private static function sendRoomJoinRequestFull(param1:String, param2:Boolean = false) : 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())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
AvatarManager.joiningNewRoom = true;
|
||||
_loadingNewRoom = true;
|
||||
_joinRoomName = param1;
|
||||
if(RoomManagerWorld.instance.haveHadLastGoodRoomName())
|
||||
{
|
||||
SBTracker.trackPageview("/game/play/loading/changeRooms");
|
||||
}
|
||||
var _loc3_:Boolean = param2 || _roomMgr.forceInvisMode;
|
||||
if(!_loc3_)
|
||||
{
|
||||
gMainFrame.server.setXtObject_Str("rj",[param1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
gMainFrame.server.setXtObject_Str("rj",[param1,"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 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 "rs":
|
||||
roomShardResponse(_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_:String = null;
|
||||
var _loc6_:String = null;
|
||||
var _loc7_:int = 0;
|
||||
var _loc8_: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_++];
|
||||
gMainFrame.userInfo.myDbAvId = int(param1[_loc2_++]);
|
||||
PetManager.myActivePetInvId = int(param1[_loc2_++]);
|
||||
if(param1.hasOwnProperty(_loc2_))
|
||||
{
|
||||
_roomMgr.shardId = int(param1[_loc2_++]);
|
||||
}
|
||||
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_);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
QuestXtCommManager.roomJoined(_loc3_.name);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc5_ = param1[_loc2_++];
|
||||
if(_loc5_ == "N")
|
||||
{
|
||||
_loc6_ = param1[_loc2_++];
|
||||
if(_loc6_ == "null")
|
||||
{
|
||||
new SBStandardPopup(LoadProgress.loadLayer,"Could not join room: World error! Please refresh and try another world or try again later.",false);
|
||||
AvatarManager.joiningNewRoom = false;
|
||||
_denJoinPending = false;
|
||||
return;
|
||||
}
|
||||
_loc7_ = int(param1[_loc2_++]);
|
||||
gMainFrame.userInfo.myDbAvId = _loc7_;
|
||||
if(_denJoinPending)
|
||||
{
|
||||
gMainFrame.clientInfo.autoStartRoom = _joinRoomName;
|
||||
gMainFrame.clientInfo.autoStartRoomShardId = RT_PARAM_GET_SHARD_FROM_DEN;
|
||||
gMainFrame.clientInfo.autoStartRoomServerNode = _loc6_;
|
||||
DebugUtility.debugTrace("using autoStartRoom to prep resend join request after switching server nodes - room:" + _joinRoomName + " shardId:" + gMainFrame.clientInfo.autoStartRoomShardId);
|
||||
if(!gMainFrame.switchServersIfNeeded(_loc6_))
|
||||
{
|
||||
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:" + _loc6_ + " (current node:" + gMainFrame.server.serverIp + ")?!");
|
||||
}
|
||||
gMainFrame.clientInfo.autoStartRoom = _joinRoomName;
|
||||
_loc8_ = int(_joinRoomName.substr(_joinRoomName.indexOf("#") + 1));
|
||||
if(_loc8_ == -1)
|
||||
{
|
||||
_loc8_ = RT_PARAM_NEW_REGISTRANT_EXPERIENCE_REDIRECT;
|
||||
}
|
||||
gMainFrame.clientInfo.autoStartRoomShardId = _loc8_;
|
||||
gMainFrame.clientInfo.autoStartRoomServerNode = _loc6_;
|
||||
DebugUtility.debugTrace("using autoStartRoom to prep resend join request after switching server nodes - room:" + _joinRoomName + " shardId:" + gMainFrame.clientInfo.autoStartRoomShardId);
|
||||
if(!gMainFrame.switchServersIfNeeded(_loc6_))
|
||||
{
|
||||
new SBStandardPopup(LoadProgress.loadLayer,"Join world error! Please refresh and try another world or try again later.",false);
|
||||
AvatarManager.joiningNewRoom = false;
|
||||
_denJoinPending = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
_roomMgr.clearLastGoodRoomForServerSwitch();
|
||||
}
|
||||
else if(_loc5_.indexOf("DJE") == 0)
|
||||
{
|
||||
if(_loc5_.charAt(3) == "C")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBYesNoPopup(GuiManager.guiLayer,"You need to be an ocean animal to enter this den. Become one now?",true,GuiManager.switchToOceanAnimal,false);
|
||||
}
|
||||
else if(_loc5_.charAt(3) == "E")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBYesNoPopup(GuiManager.guiLayer,"You need to be an ocean animal to enter this den. Become one now?",true,GuiManager.switchToOceanAnimal,true);
|
||||
}
|
||||
else if(_loc5_.charAt(3) == "K")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBYesNoPopup(GuiManager.guiLayer,"The den you were in is now an ocean den. You need to be an ocean animal to enter this den. Become one now?",true,GuiManager.switchToOceanAnimal,false);
|
||||
}
|
||||
}
|
||||
else if(_loc5_ == "BSJ")
|
||||
{
|
||||
_loadingNewRoom = false;
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,"This party is full. Please try again.");
|
||||
}
|
||||
else if(_loc5_ == "SSJ")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,"You are already in the most popular party!");
|
||||
}
|
||||
else if(_loc5_ == "CSJ")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,"You can\'t join this party right now. Please try again.");
|
||||
}
|
||||
else if(_loc5_ == "QSJL")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,"You can\'t join this adventure because your level is not high enough.");
|
||||
}
|
||||
else if(_loc5_ == "BQSJ")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,"This Adventure Base Camp is full. Please try again.");
|
||||
}
|
||||
else if(_loc5_ == "RQJF")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,"You can\'t join this adventure.");
|
||||
}
|
||||
else if(_loc5_ == "SQQJ")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,"You are already in the most popular Adventure Base Camp!");
|
||||
}
|
||||
else
|
||||
{
|
||||
gMainFrame.server.handleRoomJoinError(_loc5_,param1[_loc2_]);
|
||||
}
|
||||
_loadingNewRoom = false;
|
||||
}
|
||||
AvatarManager.joiningNewRoom = false;
|
||||
_denJoinPending = false;
|
||||
}
|
||||
|
||||
private static function roomPropertiesResponse(param1:Object) : void
|
||||
{
|
||||
_roomMgr.loadRoom(param1[2],int(param1[3]),int(param1[4]),int(param1[5]));
|
||||
}
|
||||
|
||||
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,"World list error or all worlds are full! Please reload the page or try again later.",false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
GamePlay(gMainFrame.gamePlay).showServerSelectorMore(param1);
|
||||
}
|
||||
|
||||
private static function roomShardResponse(param1:Object) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
if(!isNaN(Number(param1[2])))
|
||||
{
|
||||
_loc2_ = int(param1[2]);
|
||||
if(_loc2_ <= 0)
|
||||
{
|
||||
new SBStandardPopup(LoadProgress.loadLayer,"World error or all worlds are full! Please reload the page or try again later.",false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
GamePlay(gMainFrame.gamePlay).showServerSelector(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,506 @@
|
||||
package room
|
||||
{
|
||||
import com.sbi.loader.SceneLoader;
|
||||
import flash.display.MovieClip;
|
||||
import flash.geom.Point;
|
||||
|
||||
public class VolumeManager
|
||||
{
|
||||
|
||||
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 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(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 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 = {
|
||||
"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_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user