mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-19 01:27:51 -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;
|
||||
_box = new Sprite();
|
||||
_check = new Sprite();
|
||||
with(_box.graphics)
|
||||
{
|
||||
beginFill(BOX_COLOR);
|
||||
drawRect(0,0,CHKBOX_WIDTH,CHKBOX_HEIGHT);
|
||||
endFill();
|
||||
}
|
||||
with(_check.graphics)
|
||||
{
|
||||
lineStyle(2,CHK_COLOR);
|
||||
moveTo(0,0);
|
||||
lineTo(CHKBOX_WIDTH,CHKBOX_HEIGHT);
|
||||
}
|
||||
addEventListener("mouseDown",chkboxMouseDownHandler,false,0,true);
|
||||
_box.addChild(_check);
|
||||
addChild(_box);
|
||||
_label = new TextField();
|
||||
_label.x = 20;
|
||||
_label.height = 20;
|
||||
_label.text = initLabel;
|
||||
_label.selectable = false;
|
||||
addChild(_label);
|
||||
_check.visible = initChecked;
|
||||
visible = initVisible;
|
||||
valueChangedCallback = initValueChangedCallback;
|
||||
initParent.addChild(this);
|
||||
}
|
||||
|
||||
public function get checked() : Boolean
|
||||
{
|
||||
return _check.visible;
|
||||
}
|
||||
|
||||
public function set checked(param1:Boolean) : void
|
||||
{
|
||||
_check.visible = param1;
|
||||
}
|
||||
|
||||
public function get label() : TextField
|
||||
{
|
||||
return _label;
|
||||
}
|
||||
|
||||
public function toggleVisiblity() : void
|
||||
{
|
||||
visible = !visible;
|
||||
}
|
||||
|
||||
public function toggleChecked() : void
|
||||
{
|
||||
_check.visible = !_check.visible;
|
||||
}
|
||||
|
||||
private function chkboxMouseDownHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_check.visible = !_check.visible;
|
||||
if(valueChangedCallback != null)
|
||||
{
|
||||
valueChangedCallback(_check.visible);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
package room
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.KeyboardEvent;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.text.TextField;
|
||||
|
||||
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;
|
||||
_layerManager = LayerManager(initParent);
|
||||
initParent = initParent.fps;
|
||||
_slider = new Sprite();
|
||||
_nub = new Sprite();
|
||||
with(_nub.graphics)
|
||||
{
|
||||
beginFill(NUB_COLOR);
|
||||
drawRect(-NUB_WIDTH * 0.5,-NUB_HEIGHT * 0.5,NUB_WIDTH,NUB_HEIGHT);
|
||||
}
|
||||
_nub.x = 120 * 1;
|
||||
_nub.y = 0;
|
||||
with(_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);
|
||||
}
|
||||
_slider.x = 400;
|
||||
_slider.y = 200;
|
||||
gMainFrame.stage.addEventListener("keyDown",onKeyDown,false,0,true);
|
||||
_slider.addEventListener("mouseDown",sliderMouseDownHandler,false,0,true);
|
||||
_slider.addEventListener("mouseMove",sliderMouseMoveHandler,false,0,true);
|
||||
_slider.addEventListener("mouseOut",sliderMouseOutHandler,false,0,true);
|
||||
_slider.addEventListener("mouseUp",sliderMouseUpHandler,false,0,true);
|
||||
_slider.addChild(_nub);
|
||||
initParent.addChild(_slider);
|
||||
_value = new TextField();
|
||||
_value.x = 400 + 120 + 10 + 10 + 10;
|
||||
_value.y = _slider.y;
|
||||
_value.width = 32;
|
||||
_value.text = "1";
|
||||
initParent.addChild(_value);
|
||||
_visible = initVisible;
|
||||
_slider.visible = _visible;
|
||||
_value.visible = _visible;
|
||||
valueChangedCallback = initValueChangedCallback;
|
||||
}
|
||||
|
||||
public function toggleVisiblity() : void
|
||||
{
|
||||
_nub.x = 120 * _layerManager.bkg.scaleX;
|
||||
_value.text = String(_layerManager.bkg.scaleX);
|
||||
_visible = !_visible;
|
||||
_slider.visible = _visible;
|
||||
_value.visible = _visible;
|
||||
}
|
||||
|
||||
private function sliderMouseDownHandler(param1:MouseEvent) : void
|
||||
{
|
||||
_drag = true;
|
||||
sliderMouseMoveHandler(param1);
|
||||
}
|
||||
|
||||
private function onKeyDown(param1:KeyboardEvent) : void
|
||||
{
|
||||
var _loc3_:Boolean = false;
|
||||
var _loc2_:Number = NaN;
|
||||
if(param1.keyCode == 107)
|
||||
{
|
||||
_nub.x += 1;
|
||||
_loc3_ = true;
|
||||
}
|
||||
else if(param1.keyCode == 109)
|
||||
{
|
||||
_nub.x -= 1;
|
||||
_loc3_ = true;
|
||||
}
|
||||
else if(param1.keyCode == 187)
|
||||
{
|
||||
_nub.x += 0.1;
|
||||
_loc3_ = true;
|
||||
}
|
||||
else if(param1.keyCode == 189)
|
||||
{
|
||||
_nub.x -= 0.1;
|
||||
_loc3_ = true;
|
||||
}
|
||||
if(_loc3_)
|
||||
{
|
||||
_loc2_ = _nub.x * 1 / 120;
|
||||
_layerManager.bkg.scaleX = _layerManager.bkg.scaleY = _loc2_;
|
||||
_value.text = String(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
private function sliderMouseMoveHandler(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc3_:Number = NaN;
|
||||
var _loc2_:Number = NaN;
|
||||
if(_drag && param1.target is DisplayObject && _slider.contains(DisplayObject(param1.target)))
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_loc3_ = param1.localX;
|
||||
if(param1.target == _nub)
|
||||
{
|
||||
_loc3_ += _nub.x;
|
||||
}
|
||||
if(_loc3_ < 0)
|
||||
{
|
||||
_loc3_ = 0;
|
||||
}
|
||||
if(_loc3_ > 120)
|
||||
{
|
||||
_loc3_ = 120;
|
||||
}
|
||||
_nub.x = _loc3_;
|
||||
_loc2_ = _loc3_ * 1 / 120;
|
||||
_layerManager.bkg.scaleX = _layerManager.bkg.scaleY = _loc2_;
|
||||
_value.text = String(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
private function sliderMouseOutHandler(param1:MouseEvent) : void
|
||||
{
|
||||
if(!param1.relatedObject || !_slider.contains(param1.relatedObject))
|
||||
{
|
||||
_drag = false;
|
||||
}
|
||||
}
|
||||
|
||||
private function sliderMouseUpHandler(param1:MouseEvent) : void
|
||||
{
|
||||
_drag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,235 @@
|
||||
package room
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.text.TextField;
|
||||
import flash.text.TextFormat;
|
||||
|
||||
public class DebugGUITextbox extends Sprite
|
||||
{
|
||||
|
||||
private static const BG_HEADER_COLOR:Number = 0;
|
||||
|
||||
private static const BG_COLOR:Number = 6710886;
|
||||
|
||||
private static const BG_ALPHA:Number = 0.6;
|
||||
|
||||
private static const TXT_FONT:String = "Lucida Console";
|
||||
|
||||
private static const TXT_COLOR:Number = 16777215;
|
||||
|
||||
private static const TITLE_ROW_HEIGHT:int = 18;
|
||||
|
||||
private static const MAX_LINES:int = 500;
|
||||
|
||||
private var _parent:DisplayObjectContainer;
|
||||
|
||||
private var _titleTextField:TextField;
|
||||
|
||||
private var _textField:TextField;
|
||||
|
||||
public function DebugGUITextbox(param1:DisplayObjectContainer, param2:String = "", param3:String = "", param4:Boolean = false, param5:Boolean = false, param6:Boolean = true, param7:Number = 800, param8:Number = 18, param9:Boolean = false)
|
||||
{
|
||||
super();
|
||||
var _loc10_:Boolean = param3.length > 0;
|
||||
if(param6)
|
||||
{
|
||||
initBackgroundLayer(param7,param8,_loc10_);
|
||||
}
|
||||
if(_loc10_)
|
||||
{
|
||||
initTitleLayer(param3,param7,param6);
|
||||
}
|
||||
initTextLayer(param2,param7,param8,param5,_loc10_,param9);
|
||||
visible = param4;
|
||||
updateParent(false,param1);
|
||||
}
|
||||
|
||||
private function initBackgroundLayer(param1:Number, param2:Number, param3:Boolean) : void
|
||||
{
|
||||
var _loc4_:Sprite = new Sprite();
|
||||
_loc4_.alpha = 0.6;
|
||||
var _loc6_:int = 0;
|
||||
var _loc5_:int = param2;
|
||||
if(param3)
|
||||
{
|
||||
_loc6_ += 18;
|
||||
_loc5_ -= 18;
|
||||
}
|
||||
_loc4_.graphics.beginFill(6710886);
|
||||
_loc4_.graphics.drawRect(0,_loc6_,param1,_loc5_);
|
||||
addChild(_loc4_);
|
||||
}
|
||||
|
||||
private function initTitleLayer(param1:String, param2:Number, param3:Boolean) : void
|
||||
{
|
||||
var _loc5_:Sprite = null;
|
||||
if(param3)
|
||||
{
|
||||
_loc5_ = new Sprite();
|
||||
_loc5_.alpha = 0.6;
|
||||
_loc5_.graphics.beginFill(0);
|
||||
_loc5_.graphics.drawRect(0,0,param2,18);
|
||||
addChild(_loc5_);
|
||||
}
|
||||
_titleTextField = new TextField();
|
||||
var _loc4_:TextFormat = new TextFormat();
|
||||
_loc4_.font = "Lucida Console";
|
||||
_loc4_.size = 11;
|
||||
_loc4_.bold = true;
|
||||
_titleTextField.defaultTextFormat = _loc4_;
|
||||
_titleTextField.text = param1;
|
||||
_titleTextField.textColor = 16777215;
|
||||
_titleTextField.width = param2;
|
||||
_titleTextField.height = 18;
|
||||
_titleTextField.mouseEnabled = false;
|
||||
_titleTextField.selectable = false;
|
||||
addChild(_titleTextField);
|
||||
}
|
||||
|
||||
private function initTextLayer(param1:String, param2:Number, param3:Number, param4:Boolean, param5:Boolean, param6:Boolean) : void
|
||||
{
|
||||
_textField = new TextField();
|
||||
var _loc7_:TextFormat = new TextFormat();
|
||||
_loc7_.font = "Lucida Console";
|
||||
_loc7_.size = 10;
|
||||
_textField.defaultTextFormat = _loc7_;
|
||||
_textField.text = param1;
|
||||
_textField.textColor = 16777215;
|
||||
_textField.width = param2;
|
||||
_textField.height = param3;
|
||||
if(param5)
|
||||
{
|
||||
_textField.y = 18;
|
||||
_textField.height -= 18;
|
||||
}
|
||||
if(!param4)
|
||||
{
|
||||
_textField.mouseEnabled = false;
|
||||
_textField.selectable = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
addEventListener("mouseDown",stopPropagationMouseEventHandler,false,0,true);
|
||||
}
|
||||
if(param6)
|
||||
{
|
||||
_textField.wordWrap = true;
|
||||
_textField.multiline = true;
|
||||
}
|
||||
_textField.useRichTextClipboard = true;
|
||||
addChild(_textField);
|
||||
}
|
||||
|
||||
private function updateParent(param1:Boolean, param2:DisplayObjectContainer = null) : void
|
||||
{
|
||||
var _loc4_:Boolean = false;
|
||||
var _loc3_:Boolean = _parent == null;
|
||||
if(param2 && param2 != _parent)
|
||||
{
|
||||
if(_parent && param1)
|
||||
{
|
||||
_parent.removeChild(this);
|
||||
}
|
||||
_parent = param2;
|
||||
_loc4_ = true;
|
||||
}
|
||||
if(_parent)
|
||||
{
|
||||
if(visible)
|
||||
{
|
||||
_parent.addChild(this);
|
||||
}
|
||||
else if(!_loc3_ && !_loc4_)
|
||||
{
|
||||
_parent.removeChild(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function setVisibility(param1:Boolean, param2:DisplayObjectContainer = null) : void
|
||||
{
|
||||
var _loc3_:Boolean = visible;
|
||||
visible = param1;
|
||||
updateParent(visible,param2);
|
||||
}
|
||||
|
||||
public function toggleVisiblity(param1:DisplayObjectContainer = null) : Boolean
|
||||
{
|
||||
var _loc2_:Boolean = visible;
|
||||
visible = !visible;
|
||||
updateParent(_loc2_,param1);
|
||||
return visible;
|
||||
}
|
||||
|
||||
public function get textField() : TextField
|
||||
{
|
||||
return _textField;
|
||||
}
|
||||
|
||||
public function get text() : String
|
||||
{
|
||||
return _textField.text;
|
||||
}
|
||||
|
||||
public function set text(param1:String) : void
|
||||
{
|
||||
_textField.text = param1;
|
||||
}
|
||||
|
||||
public function append(param1:String) : void
|
||||
{
|
||||
appendToField(param1,false);
|
||||
}
|
||||
|
||||
public function appendHtml(param1:String) : void
|
||||
{
|
||||
appendToField(param1,true);
|
||||
}
|
||||
|
||||
private function appendToField(param1:String, param2:Boolean) : void
|
||||
{
|
||||
var _loc3_:Boolean = _textField.scrollV == _textField.maxScrollV;
|
||||
if(param2)
|
||||
{
|
||||
_textField.htmlText += param1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_textField.text += param1;
|
||||
}
|
||||
trimLines(param2);
|
||||
if(_loc3_)
|
||||
{
|
||||
textField.scrollV = _textField.maxScrollV;
|
||||
}
|
||||
}
|
||||
|
||||
private function trimLines(param1:Boolean) : void
|
||||
{
|
||||
while(_textField.numLines > 500)
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_textField.htmlText = _textField.htmlText.substr(_textField.htmlText.indexOf("</P>") + 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
_textField.replaceText(0,_textField.getLineOffset(1) - 1,"");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function get titleTextField() : TextField
|
||||
{
|
||||
return _titleTextField;
|
||||
}
|
||||
|
||||
private function stopPropagationMouseEventHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,31 @@
|
||||
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 var hasUpdates:Boolean;
|
||||
|
||||
public function DenItemHolderEvent(param1:String)
|
||||
{
|
||||
super(param1);
|
||||
}
|
||||
|
||||
override public function clone() : Event
|
||||
{
|
||||
return new DenItemHolderEvent(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
package room
|
||||
{
|
||||
import com.sbi.graphics.SortLayer;
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.Shape;
|
||||
|
||||
public class LayerManager
|
||||
{
|
||||
|
||||
private var _layer_bkg:DisplayLayer;
|
||||
|
||||
private var _layer_room_bkg:DisplayLayer;
|
||||
|
||||
private var _layer_room_bkg_group:DisplayLayer;
|
||||
|
||||
private var _layer_room_bkg_main:DisplayLayer;
|
||||
|
||||
private var _layer_room_avatars:SortLayer;
|
||||
|
||||
private var _layer_room_preview_avatar:SortLayer;
|
||||
|
||||
private var _layer_room_preview_flying_avatar:SortLayer;
|
||||
|
||||
private var _layer_room_fg:DisplayLayer;
|
||||
|
||||
private var _layer_flying_avatars:SortLayer;
|
||||
|
||||
private var _layer_room_super_fg:DisplayLayer;
|
||||
|
||||
private var _layer_room_chat:DisplayLayer;
|
||||
|
||||
private var _layer_room_orbs:DisplayLayer;
|
||||
|
||||
private var _layer_worldGame:DisplayLayer;
|
||||
|
||||
private var _layer_gui:DisplayLayer;
|
||||
|
||||
private var _layer_fps:DisplayLayer;
|
||||
|
||||
private var _layer_debug:DisplayLayer;
|
||||
|
||||
private var _debugShape:Shape;
|
||||
|
||||
public function LayerManager(param1:DisplayObjectContainer, param2:DisplayLayer)
|
||||
{
|
||||
super();
|
||||
_layer_bkg = new DisplayLayer();
|
||||
_layer_room_bkg = new DisplayLayer();
|
||||
_layer_room_bkg_group = new DisplayLayer();
|
||||
_layer_room_bkg_main = new DisplayLayer();
|
||||
_layer_room_avatars = new SortLayer();
|
||||
_layer_room_preview_avatar = new SortLayer();
|
||||
_layer_room_preview_flying_avatar = new SortLayer();
|
||||
_layer_room_fg = new DisplayLayer();
|
||||
_layer_room_super_fg = new DisplayLayer();
|
||||
_layer_flying_avatars = new SortLayer();
|
||||
_layer_room_chat = new DisplayLayer();
|
||||
_layer_room_orbs = new DisplayLayer();
|
||||
_layer_room_orbs.mouseEnabled = false;
|
||||
_layer_worldGame = new DisplayLayer();
|
||||
_layer_gui = new DisplayLayer();
|
||||
_layer_fps = new DisplayLayer();
|
||||
param1.addChildAt(_layer_bkg,param1.getChildIndex(param2));
|
||||
_layer_bkg.addChild(_layer_room_bkg);
|
||||
_layer_bkg.addChild(_layer_room_bkg_group);
|
||||
_layer_room_bkg_group.addChild(_layer_room_bkg_main);
|
||||
_layer_room_bkg_group.addChild(_layer_room_avatars);
|
||||
_layer_room_bkg_group.addChild(_layer_room_preview_avatar);
|
||||
_layer_bkg.addChild(_layer_room_fg);
|
||||
_layer_bkg.addChild(_layer_flying_avatars);
|
||||
_layer_bkg.addChild(_layer_room_preview_flying_avatar);
|
||||
_layer_bkg.addChild(_layer_room_super_fg);
|
||||
_layer_bkg.addChild(_layer_room_chat);
|
||||
_layer_bkg.addChild(_layer_room_orbs);
|
||||
_layer_room_fg.mouseChildren = false;
|
||||
_layer_room_fg.mouseEnabled = false;
|
||||
_layer_room_super_fg.mouseChildren = false;
|
||||
_layer_room_super_fg.mouseEnabled = false;
|
||||
param1.addChildAt(_layer_worldGame,param1.getChildIndex(param2));
|
||||
param1.addChildAt(_layer_gui,param1.getChildIndex(param2));
|
||||
_layer_debug = new DisplayLayer();
|
||||
_layer_fps.addChild(_layer_debug);
|
||||
param1.stage.addChild(_layer_fps);
|
||||
_debugShape = new Shape();
|
||||
}
|
||||
|
||||
public function showAvatarsAndRelatedItems(param1:Boolean) : void
|
||||
{
|
||||
_layer_flying_avatars.visible = param1;
|
||||
_layer_room_chat.visible = param1;
|
||||
_layer_room_orbs.visible = param1;
|
||||
_layer_room_avatars.visible = param1;
|
||||
_layer_room_bkg_main.visible = param1;
|
||||
_layer_room_preview_avatar.visible = !param1;
|
||||
_layer_room_preview_flying_avatar.visible = !param1;
|
||||
}
|
||||
|
||||
public function get gui() : DisplayLayer
|
||||
{
|
||||
return _layer_gui;
|
||||
}
|
||||
|
||||
public function get bkg() : DisplayLayer
|
||||
{
|
||||
return _layer_bkg;
|
||||
}
|
||||
|
||||
public function get fps() : DisplayLayer
|
||||
{
|
||||
return _layer_fps;
|
||||
}
|
||||
|
||||
public function get room_bkg_group() : DisplayLayer
|
||||
{
|
||||
return _layer_room_bkg_group;
|
||||
}
|
||||
|
||||
public function get room_bkg_main() : DisplayLayer
|
||||
{
|
||||
return _layer_room_bkg_main;
|
||||
}
|
||||
|
||||
public function get room_bkg() : DisplayLayer
|
||||
{
|
||||
return _layer_room_bkg;
|
||||
}
|
||||
|
||||
public function get room_fg() : DisplayLayer
|
||||
{
|
||||
return _layer_room_fg;
|
||||
}
|
||||
|
||||
public function get room_super_fg() : DisplayLayer
|
||||
{
|
||||
return _layer_room_super_fg;
|
||||
}
|
||||
|
||||
public function get room_avatars() : SortLayer
|
||||
{
|
||||
return _layer_room_avatars;
|
||||
}
|
||||
|
||||
public function get room_chat() : DisplayLayer
|
||||
{
|
||||
return _layer_room_chat;
|
||||
}
|
||||
|
||||
public function get flying_avatars() : SortLayer
|
||||
{
|
||||
return _layer_flying_avatars;
|
||||
}
|
||||
|
||||
public function get room_orbs() : DisplayLayer
|
||||
{
|
||||
return _layer_room_orbs;
|
||||
}
|
||||
|
||||
public function get layer_debug() : DisplayLayer
|
||||
{
|
||||
return _layer_debug;
|
||||
}
|
||||
|
||||
public function get layer_worldGame() : DisplayLayer
|
||||
{
|
||||
return _layer_worldGame;
|
||||
}
|
||||
|
||||
public function get preview_room_avatar() : SortLayer
|
||||
{
|
||||
return _layer_room_preview_avatar;
|
||||
}
|
||||
|
||||
public function get preview_room_flying_avatar() : SortLayer
|
||||
{
|
||||
return _layer_room_preview_flying_avatar;
|
||||
}
|
||||
|
||||
public function get debugShape() : Shape
|
||||
{
|
||||
return _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);
|
||||
_secondaryType = param2;
|
||||
_tertiaryType = param3;
|
||||
_persistent = param4;
|
||||
}
|
||||
|
||||
override public function clone() : Event
|
||||
{
|
||||
return new RoomEvent(type);
|
||||
}
|
||||
|
||||
override public function toString() : String
|
||||
{
|
||||
return formatToString("RoomEvent",type,_secondaryType,_tertiaryType,_persistent);
|
||||
}
|
||||
|
||||
public function get secondaryType() : String
|
||||
{
|
||||
return _secondaryType;
|
||||
}
|
||||
|
||||
public function get tertiaryType() : String
|
||||
{
|
||||
return _tertiaryType;
|
||||
}
|
||||
|
||||
public function get persistent() : Boolean
|
||||
{
|
||||
return _persistent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,599 @@
|
||||
package room
|
||||
{
|
||||
import avatar.AvatarManager;
|
||||
import com.baseoneonline.astar.AStar;
|
||||
import com.baseoneonline.astar.Graph;
|
||||
import flash.geom.Point;
|
||||
import flash.utils.ByteArray;
|
||||
import gui.GuiManager;
|
||||
|
||||
public class RoomGrid implements Graph
|
||||
{
|
||||
|
||||
public static const GRID_CELL_OPEN:uint = 0;
|
||||
|
||||
public static const GRID_CELL_WALL:uint = 1;
|
||||
|
||||
public static const GRID_CELL_AIR:uint = 2;
|
||||
|
||||
public static const GRID_CELL_PHANTOM:uint = 3;
|
||||
|
||||
private static const COST_DIAG:Number = Math.sqrt(2);
|
||||
|
||||
private var GRID_DEPTH_LIMIT:uint = 128;
|
||||
|
||||
private var startPos:Object;
|
||||
|
||||
private var _grid:Object;
|
||||
|
||||
private var _astar:AStar;
|
||||
|
||||
public function RoomGrid()
|
||||
{
|
||||
super();
|
||||
_astar = new AStar();
|
||||
}
|
||||
|
||||
public function setGridDepth(param1:uint) : void
|
||||
{
|
||||
GRID_DEPTH_LIMIT = param1;
|
||||
}
|
||||
|
||||
public function setGrid(param1:Object) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc7_:ByteArray = null;
|
||||
var _loc3_:* = undefined;
|
||||
var _loc5_:int = 0;
|
||||
var _loc4_:* = 0;
|
||||
var _loc8_:* = 0;
|
||||
var _loc6_:int = 0;
|
||||
if(param1.hasOwnProperty("packedGrid"))
|
||||
{
|
||||
_loc7_ = param1.packedGrid;
|
||||
_loc7_.position = 0;
|
||||
_loc3_ = new Vector.<uint>(param1.height * param1.width);
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < _loc7_.length / 2)
|
||||
{
|
||||
_loc4_ = _loc7_.readUnsignedShort();
|
||||
_loc8_ = uint(_loc4_ >> 14);
|
||||
if(GuiManager.isBeYourPetRoom())
|
||||
{
|
||||
if(_loc8_ & 2 && AvatarManager.playerAvatarWorldView && !AvatarManager.playerAvatarWorldView.isActivePetGroundPet())
|
||||
{
|
||||
_loc8_ = 0;
|
||||
}
|
||||
}
|
||||
else if(AvatarManager.playerAvatar)
|
||||
{
|
||||
if(Utility.isAir(AvatarManager.playerAvatar.enviroTypeFlag))
|
||||
{
|
||||
if((_loc8_ & 2) == 0)
|
||||
{
|
||||
_loc8_ = 0;
|
||||
}
|
||||
}
|
||||
else if(Utility.isLand(AvatarManager.playerAvatar.enviroTypeFlag))
|
||||
{
|
||||
if((_loc8_ & 1) == 0)
|
||||
{
|
||||
_loc8_ = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
_loc4_ &= 16383;
|
||||
_loc6_ = 0;
|
||||
while(_loc6_ < _loc4_)
|
||||
{
|
||||
_loc3_[_loc2_++] = _loc8_;
|
||||
_loc6_++;
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
param1.grid = _loc3_;
|
||||
}
|
||||
_grid = param1;
|
||||
_astar.setGraph(this);
|
||||
}
|
||||
|
||||
public function get hasReachedGoal() : Boolean
|
||||
{
|
||||
return _astar.hasReachedGoal();
|
||||
}
|
||||
|
||||
public function enableVolume(param1:String, param2:Boolean = true) : void
|
||||
{
|
||||
var _loc5_:Array = null;
|
||||
var _loc9_:int = 0;
|
||||
var _loc3_:Object = null;
|
||||
var _loc10_:int = 0;
|
||||
var _loc7_:int = 0;
|
||||
var _loc6_:int = 0;
|
||||
var _loc4_:int = 0;
|
||||
var _loc8_:* = 0;
|
||||
var _loc12_:* = 0;
|
||||
var _loc11_:int = 0;
|
||||
if(_grid.hasOwnProperty("dynamicVolumes"))
|
||||
{
|
||||
_loc5_ = _grid.dynamicVolumes;
|
||||
while(_loc9_ < _loc5_.length)
|
||||
{
|
||||
_loc3_ = _loc5_[_loc9_];
|
||||
if(_loc3_.name == param1)
|
||||
{
|
||||
_loc3_.packedBlock.position = 0;
|
||||
_loc10_ = int(_loc3_.y);
|
||||
_loc6_ = _loc3_.x + _loc3_.y * _grid.width;
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _loc3_.packedBlock.length / 2)
|
||||
{
|
||||
_loc8_ = uint(_loc3_.packedBlock.readUnsignedShort());
|
||||
_loc12_ = uint(_loc8_ >> 14);
|
||||
_loc8_ &= 16383;
|
||||
_loc11_ = 0;
|
||||
while(_loc11_ < _loc8_)
|
||||
{
|
||||
if(_loc12_ > 0)
|
||||
{
|
||||
_grid.grid[_loc6_] = param2 ? _loc12_ : 0;
|
||||
}
|
||||
_loc6_++;
|
||||
if(++_loc7_ == _loc3_.width)
|
||||
{
|
||||
_loc7_ = 0;
|
||||
_loc6_ += _grid.width - _loc3_.width;
|
||||
}
|
||||
_loc11_++;
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
}
|
||||
_loc9_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getCellIndex(param1:int, param2:int) : int
|
||||
{
|
||||
param1 -= _grid.min.x;
|
||||
param2 -= _grid.min.y;
|
||||
param1 /= _grid.r2;
|
||||
param2 /= _grid.r2;
|
||||
if(param1 < 0)
|
||||
{
|
||||
param1 = 0;
|
||||
}
|
||||
if(param1 >= _grid.width)
|
||||
{
|
||||
param1 = _grid.width - 1;
|
||||
}
|
||||
if(param2 < 0)
|
||||
{
|
||||
param2 = 0;
|
||||
}
|
||||
if(param2 >= _grid.height)
|
||||
{
|
||||
param2 = _grid.height - 1;
|
||||
}
|
||||
return int(param1 + param2 * _grid.width);
|
||||
}
|
||||
|
||||
public function convertWorldPosToGrid(param1:Number, param2:Number) : Object
|
||||
{
|
||||
param1 -= _grid.min.x;
|
||||
param2 -= _grid.min.y;
|
||||
param1 /= _grid.r2;
|
||||
param2 /= _grid.r2;
|
||||
var _loc3_:Boolean = true;
|
||||
if(param1 < 0 || param1 >= _grid.width || param2 < 0 || param2 >= _grid.height)
|
||||
{
|
||||
_loc3_ = false;
|
||||
}
|
||||
return {
|
||||
"x":int(param1),
|
||||
"y":int(param2),
|
||||
"bInBounds":_loc3_
|
||||
};
|
||||
}
|
||||
|
||||
public function convertCellToCoords(param1:int) : Object
|
||||
{
|
||||
var _loc3_:Number = int(param1 / _grid.width);
|
||||
var _loc2_:Number = Math.abs(param1 % _grid.width);
|
||||
return {
|
||||
"x":_loc2_,
|
||||
"y":_loc3_
|
||||
};
|
||||
}
|
||||
|
||||
public function getCellIndexToWorldPos(param1:int) : Object
|
||||
{
|
||||
var _loc3_:Number = int(param1 / _grid.width);
|
||||
var _loc2_:Number = param1 - _loc3_ * _grid.width;
|
||||
_loc2_ *= _grid.r2;
|
||||
_loc3_ *= _grid.r2;
|
||||
_loc2_ += _grid.min.x + _grid.r;
|
||||
_loc3_ += _grid.min.y + _grid.r;
|
||||
return {
|
||||
"x":_loc2_,
|
||||
"y":_loc3_
|
||||
};
|
||||
}
|
||||
|
||||
public function convertGridPosToWorld(param1:int, param2:int) : Object
|
||||
{
|
||||
var _loc4_:Number = param1 * _grid.r2 + _grid.min.x + _grid.r;
|
||||
var _loc3_:Number = param2 * _grid.r2 + _grid.min.y + _grid.r;
|
||||
return {
|
||||
"x":_loc4_,
|
||||
"y":_loc3_
|
||||
};
|
||||
}
|
||||
|
||||
public function getBottomYGridPosToWorld(param1:int) : Number
|
||||
{
|
||||
return param1 * _grid.r2 + _grid.min.y + _grid.r2;
|
||||
}
|
||||
|
||||
public function getLeftGridPosToWorld(param1:int) : Number
|
||||
{
|
||||
return param1 * _grid.r2 + _grid.min.x;
|
||||
}
|
||||
|
||||
public function getRightGridPosToWorld(param1:int) : Number
|
||||
{
|
||||
return param1 * _grid.r2 + _grid.min.x + _grid.r2;
|
||||
}
|
||||
|
||||
public function testGridCell(param1:int, param2:int) : uint
|
||||
{
|
||||
if(param1 >= 0 && param1 < _grid.width && param2 >= 0 && param2 < _grid.height)
|
||||
{
|
||||
return _grid.grid[param2 * _grid.width + param1];
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function findPath(param1:Point, param2:Point) : Vector.<int>
|
||||
{
|
||||
if(!_grid)
|
||||
{
|
||||
return new Vector.<int>();
|
||||
}
|
||||
return _astar.solve(getCellIndex(param1.x,param1.y),getCellIndex(param2.x,param2.y));
|
||||
}
|
||||
|
||||
public function findPathOptimized(param1:Point, param2:Point) : Vector.<int>
|
||||
{
|
||||
var _loc10_:int = 0;
|
||||
var _loc8_:int = 0;
|
||||
if(!_grid)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var _loc7_:int = getCellIndex(param1.x,param1.y);
|
||||
var _loc5_:int = getCellIndex(param2.x,param2.y);
|
||||
if(_loc7_ < 0 || _loc5_ < 0 || _loc7_ > size() || _loc5_ > size())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var _loc3_:Vector.<int> = _astar.solve(_loc7_,_loc5_);
|
||||
var _loc4_:Vector.<int> = new Vector.<int>();
|
||||
if(_loc3_.length == 1)
|
||||
{
|
||||
return _loc3_;
|
||||
}
|
||||
var _loc11_:int = getCellDir(_loc3_[0],_loc3_[1]);
|
||||
var _loc6_:int = int(_loc3_.length);
|
||||
var _loc9_:int = 0;
|
||||
_loc10_ = 1;
|
||||
while(_loc10_ < _loc6_)
|
||||
{
|
||||
_loc8_ = getCellDir(_loc3_[_loc10_ - 1],_loc3_[_loc10_]);
|
||||
if(_loc11_ != _loc8_)
|
||||
{
|
||||
_loc11_ = _loc8_;
|
||||
if(_loc9_ != _loc10_ - 1)
|
||||
{
|
||||
_loc4_.push(_loc3_[_loc10_]);
|
||||
_loc9_ = _loc10_;
|
||||
}
|
||||
}
|
||||
_loc10_++;
|
||||
}
|
||||
if(_loc4_.length == 0 || _loc4_.length && _loc4_[_loc4_.length - 1] != _loc3_[_loc3_.length - 1])
|
||||
{
|
||||
_loc4_.push(_loc3_[_loc3_.length - 1]);
|
||||
}
|
||||
return _loc4_;
|
||||
}
|
||||
|
||||
public function getCellDiameter() : int
|
||||
{
|
||||
return _grid.r2;
|
||||
}
|
||||
|
||||
private function getCellDir(param1:int, param2:int) : int
|
||||
{
|
||||
var _loc3_:int = -1;
|
||||
var _loc4_:int = int(_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
|
||||
{
|
||||
startPos = convertCellToCoords(param1);
|
||||
}
|
||||
|
||||
public function getNeighbors(param1:int, param2:Vector.<int>) : Vector.<int>
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
var _loc5_:Object = convertCellToCoords(param1);
|
||||
var _loc7_:int = int(_loc5_.x);
|
||||
var _loc9_:int = int(_loc5_.y);
|
||||
var _loc6_:int = int(_grid.width);
|
||||
var _loc8_:int = int(_grid.height);
|
||||
var _loc3_:Boolean = Math.abs(_loc5_.x - 1 - startPos.x) < GRID_DEPTH_LIMIT;
|
||||
var _loc10_:Boolean = Math.abs(_loc5_.x + 1 - startPos.x) < GRID_DEPTH_LIMIT;
|
||||
var _loc11_:Boolean = Math.abs(_loc5_.y - 1 - startPos.y) < GRID_DEPTH_LIMIT;
|
||||
var _loc12_:Boolean = Math.abs(_loc5_.y + 1 - startPos.y) < GRID_DEPTH_LIMIT;
|
||||
param2.length = 0;
|
||||
if(_loc7_ > 0)
|
||||
{
|
||||
_loc4_ = param1 - 1;
|
||||
if(!_grid.grid[_loc4_] && _loc3_)
|
||||
{
|
||||
param2.push(_loc4_);
|
||||
}
|
||||
}
|
||||
if(_loc9_ > 0)
|
||||
{
|
||||
_loc4_ = param1 - _loc6_;
|
||||
if(!_grid.grid[_loc4_] && _loc11_)
|
||||
{
|
||||
param2.push(_loc4_);
|
||||
}
|
||||
}
|
||||
if(_loc7_ < _loc6_ - 1)
|
||||
{
|
||||
_loc4_ = param1 + 1;
|
||||
if(!_grid.grid[_loc4_] && _loc10_)
|
||||
{
|
||||
param2.push(_loc4_);
|
||||
}
|
||||
}
|
||||
if(_loc9_ < _loc8_ - 1)
|
||||
{
|
||||
_loc4_ = param1 + _loc6_;
|
||||
if(!_grid.grid[_loc4_] && _loc12_)
|
||||
{
|
||||
param2.push(_loc4_);
|
||||
}
|
||||
}
|
||||
if(_loc7_ > 0 && _loc9_ > 0)
|
||||
{
|
||||
_loc4_ = param1 - 1 - _loc6_;
|
||||
if(!_grid.grid[_loc4_] && !_grid.grid[param1 - 1] && !_grid.grid[param1 - _loc6_] && _loc11_ && _loc3_)
|
||||
{
|
||||
param2.push(_loc4_);
|
||||
}
|
||||
}
|
||||
if(_loc7_ < _loc6_ - 1 && _loc9_ > 0)
|
||||
{
|
||||
_loc4_ = param1 + 1 - _loc6_;
|
||||
if(!_grid.grid[_loc4_] && !_grid.grid[param1 + 1] && !_grid.grid[param1 - _loc6_] && _loc11_ && _loc10_)
|
||||
{
|
||||
param2.push(_loc4_);
|
||||
}
|
||||
}
|
||||
if(_loc7_ > 0 && _loc9_ < _loc8_ - 1)
|
||||
{
|
||||
_loc4_ = param1 - 1 + _loc6_;
|
||||
if(!_grid.grid[_loc4_] && !_grid.grid[param1 - 1] && !_grid.grid[param1 + _loc6_] && _loc12_ && _loc3_)
|
||||
{
|
||||
param2.push(_loc4_);
|
||||
}
|
||||
}
|
||||
if(_loc7_ < _loc6_ - 1 && _loc9_ < _loc8_ - 1)
|
||||
{
|
||||
_loc4_ = param1 + 1 + _loc6_;
|
||||
if(!_grid.grid[_loc4_] && !_grid.grid[param1 + 1] && !_grid.grid[param1 + _loc6_] && _loc12_ && _loc10_)
|
||||
{
|
||||
param2.push(_loc4_);
|
||||
}
|
||||
}
|
||||
return param2;
|
||||
}
|
||||
|
||||
public function distance(param1:int, param2:int) : Number
|
||||
{
|
||||
var _loc3_:Object = getCellIndexToWorldPos(param1);
|
||||
var _loc5_:Object = getCellIndexToWorldPos(param2);
|
||||
var _loc4_:Number = Math.min(Math.abs(_loc3_.x - _loc5_.x),Math.abs(_loc3_.y - _loc5_.y));
|
||||
var _loc6_:Number = Math.abs(_loc3_.x - _loc5_.x) + Math.abs(_loc3_.y - _loc5_.y);
|
||||
return COST_DIAG * _loc4_ + _loc6_ - 2 * _loc4_;
|
||||
}
|
||||
|
||||
public function size() : int
|
||||
{
|
||||
if(_grid == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return _grid.width * _grid.height;
|
||||
}
|
||||
|
||||
public function getNearestEmptyCell(param1:Number, param2:Number) : Object
|
||||
{
|
||||
var _loc3_:Object = convertWorldPosToGrid(param1,param2);
|
||||
var _loc4_:int = int(_loc3_.x);
|
||||
var _loc5_:int = int(_loc3_.y);
|
||||
var _loc6_:Boolean = false;
|
||||
if(!_loc6_)
|
||||
{
|
||||
if(testGridCell(_loc4_,_loc5_))
|
||||
{
|
||||
if(!testGridCell(_loc4_ + 1,_loc5_))
|
||||
{
|
||||
_loc4_++;
|
||||
}
|
||||
else if(!testGridCell(_loc4_ - 1,_loc5_))
|
||||
{
|
||||
_loc4_--;
|
||||
}
|
||||
else if(!testGridCell(_loc4_,_loc5_ - 1))
|
||||
{
|
||||
_loc5_ -= 1;
|
||||
}
|
||||
else if(!testGridCell(_loc4_ + 1,_loc5_ - 1))
|
||||
{
|
||||
_loc4_++;
|
||||
_loc5_--;
|
||||
}
|
||||
else if(!testGridCell(_loc4_ - 1,_loc5_ - 1))
|
||||
{
|
||||
_loc4_--;
|
||||
_loc5_--;
|
||||
}
|
||||
else if(!testGridCell(_loc4_,_loc5_ + 1))
|
||||
{
|
||||
_loc5_++;
|
||||
}
|
||||
else if(!testGridCell(_loc4_ + 1,_loc5_ + 1))
|
||||
{
|
||||
_loc4_++;
|
||||
_loc5_++;
|
||||
}
|
||||
else if(!testGridCell(_loc4_ - 1,_loc5_ + 1))
|
||||
{
|
||||
_loc4_--;
|
||||
_loc5_++;
|
||||
}
|
||||
else
|
||||
{
|
||||
trace("failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
return convertGridPosToWorld(_loc4_,_loc5_);
|
||||
}
|
||||
|
||||
public function findClosestOpenGridCell(param1:Number, param2:Number, param3:Boolean = true) : Object
|
||||
{
|
||||
var _loc5_:int = 0;
|
||||
var _loc4_:Object = convertWorldPosToGrid(param1,param2);
|
||||
var _loc7_:int = int(_loc4_.x);
|
||||
var _loc9_:int = int(_loc4_.y);
|
||||
var _loc6_:int = int(_grid.width);
|
||||
var _loc8_:int = int(_grid.height);
|
||||
var _loc10_:int = 3;
|
||||
var _loc11_:int = 20;
|
||||
while(_loc10_ < _loc11_)
|
||||
{
|
||||
_loc4_ = scanBox(_loc7_,_loc9_,_loc10_,param3);
|
||||
if(_loc4_)
|
||||
{
|
||||
break;
|
||||
}
|
||||
_loc10_ += 2;
|
||||
_loc7_--;
|
||||
_loc9_--;
|
||||
}
|
||||
if(_loc4_)
|
||||
{
|
||||
_loc4_ = convertGridPosToWorld(_loc4_.x,_loc4_.y);
|
||||
}
|
||||
return _loc4_;
|
||||
}
|
||||
|
||||
private function scanBox(param1:int, param2:int, param3:int, param4:Boolean = true) : Object
|
||||
{
|
||||
var _loc6_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
param3--;
|
||||
param4 ? param1++ : param1--;
|
||||
while(_loc6_ < 4)
|
||||
{
|
||||
if(!testGridCell(param1,param2))
|
||||
{
|
||||
return {
|
||||
"x":param1,
|
||||
"y":param2
|
||||
};
|
||||
}
|
||||
if(++_loc5_ == param3)
|
||||
{
|
||||
_loc5_ = 0;
|
||||
_loc6_++;
|
||||
}
|
||||
if(param4)
|
||||
{
|
||||
switch(_loc6_)
|
||||
{
|
||||
case 0:
|
||||
param1++;
|
||||
break;
|
||||
case 1:
|
||||
param2++;
|
||||
break;
|
||||
case 2:
|
||||
param1--;
|
||||
break;
|
||||
case 3:
|
||||
param2--;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
switch(_loc6_)
|
||||
{
|
||||
case 0:
|
||||
param1--;
|
||||
break;
|
||||
case 1:
|
||||
param2++;
|
||||
break;
|
||||
case 2:
|
||||
param1++;
|
||||
break;
|
||||
case 3:
|
||||
param2--;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package room
|
||||
{
|
||||
public class RoomJoinType
|
||||
{
|
||||
|
||||
public static const AUTO:RoomJoinType = new RoomJoinType(0);
|
||||
|
||||
public static const DIRECT_JOIN_AND_HALT_ON_FAILURE:RoomJoinType = new RoomJoinType(1);
|
||||
|
||||
public static const DIRECT_JOIN_AND_SEARCH_ON_FAILURE:RoomJoinType = new RoomJoinType(2);
|
||||
|
||||
private var _id:int;
|
||||
|
||||
public function RoomJoinType(param1:int)
|
||||
{
|
||||
super();
|
||||
_id = param1;
|
||||
}
|
||||
|
||||
public function getInt() : int
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
public function toString() : String
|
||||
{
|
||||
return String(_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,66 @@
|
||||
package room
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
|
||||
public class RoomObject
|
||||
{
|
||||
|
||||
protected var _mc:MovieClip;
|
||||
|
||||
protected var _dir:int;
|
||||
|
||||
protected var _bHold:Boolean;
|
||||
|
||||
protected var _mouseOver:Boolean;
|
||||
|
||||
public function RoomObject(param1:MovieClip)
|
||||
{
|
||||
super();
|
||||
_dir = 0;
|
||||
_mc = param1;
|
||||
}
|
||||
|
||||
public function get hold() : Boolean
|
||||
{
|
||||
return _bHold;
|
||||
}
|
||||
|
||||
public function get mc() : MovieClip
|
||||
{
|
||||
return _mc;
|
||||
}
|
||||
|
||||
public function mouseDown(param1:Boolean) : void
|
||||
{
|
||||
_bHold = param1;
|
||||
}
|
||||
|
||||
public function release() : void
|
||||
{
|
||||
if(_mc)
|
||||
{
|
||||
_mc = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function setDir(param1:int) : void
|
||||
{
|
||||
_dir = param1;
|
||||
}
|
||||
|
||||
public function setMouseOver(param1:Boolean) : void
|
||||
{
|
||||
_mouseOver = param1;
|
||||
}
|
||||
|
||||
public function isMouseOver() : Boolean
|
||||
{
|
||||
return _mouseOver;
|
||||
}
|
||||
|
||||
public function onEnterFrame() : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package room
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
|
||||
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 public function onEnterFrame() : void
|
||||
{
|
||||
if(_mc)
|
||||
{
|
||||
if(_dir == 1 && _mc.currentFrame != _mc.totalFrames)
|
||||
{
|
||||
_mc.gotoAndStop(_mc.totalFrames);
|
||||
}
|
||||
else if(_dir == -1 && _mc.currentFrame != 1)
|
||||
{
|
||||
_mc.gotoAndStop(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,31 @@
|
||||
package room
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
|
||||
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 public function onEnterFrame() : void
|
||||
{
|
||||
if(_bHold && _mc.currentLabel == "idle")
|
||||
{
|
||||
_bHold = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package room
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
|
||||
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)
|
||||
{
|
||||
_frameCountdown = 5 + int(Math.random() * _mc.totalFrames) / 2;
|
||||
_bHold = true;
|
||||
}
|
||||
}
|
||||
|
||||
override public function onEnterFrame() : void
|
||||
{
|
||||
if(_bHold)
|
||||
{
|
||||
_mc.gotoAndStop(_mc.totalFrames);
|
||||
if(_frameCountdown == 0)
|
||||
{
|
||||
_bHold = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_frameCountdown = _frameCountdown - 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_mc.gotoAndStop(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
_stages = param1.stages;
|
||||
clearCount();
|
||||
update();
|
||||
}
|
||||
|
||||
public function clearCount() : void
|
||||
{
|
||||
_totalCount = 0;
|
||||
}
|
||||
|
||||
public function incCount() : void
|
||||
{
|
||||
_totalCount = _totalCount + 1;
|
||||
}
|
||||
|
||||
public function update() : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc1_:* = 0;
|
||||
while(_loc2_ < _stages.length)
|
||||
{
|
||||
if(_totalCount < _stages[_loc2_].total)
|
||||
{
|
||||
break;
|
||||
}
|
||||
_loc1_ = _loc2_;
|
||||
_loc2_++;
|
||||
}
|
||||
if(_currentStage != _loc1_)
|
||||
{
|
||||
_currentStage = _loc1_;
|
||||
_mc.gotoAndPlay(_stages[_currentStage].label);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,550 @@
|
||||
package room
|
||||
{
|
||||
import achievement.AchievementXtCommManager;
|
||||
import avatar.AvatarManager;
|
||||
import buddy.BuddyManager;
|
||||
import com.sbi.analytics.SBTracker;
|
||||
import com.sbi.client.SFEvent;
|
||||
import com.sbi.client.SFRoom;
|
||||
import com.sbi.debug.DebugUtility;
|
||||
import com.sbi.popup.SBOkPopup;
|
||||
import com.sbi.popup.SBStandardPopup;
|
||||
import com.sbi.popup.SBYesNoPopup;
|
||||
import den.DenXtCommManager;
|
||||
import game.MinigameManager;
|
||||
import gamePlayFlow.GamePlay;
|
||||
import gui.DarkenManager;
|
||||
import gui.GuiManager;
|
||||
import gui.WelcomeToCarnival;
|
||||
import loadProgress.LoadProgress;
|
||||
import loader.DefPacksDefHelper;
|
||||
import localization.LocalizationManager;
|
||||
import pet.PetManager;
|
||||
import quest.QuestXtCommManager;
|
||||
|
||||
public class RoomXtCommManager
|
||||
{
|
||||
|
||||
public static const RT_PARAM_GET_SHARD_FROM_DEN:int = -1;
|
||||
|
||||
public static const RT_PARAM_NEW_REGISTRANT_EXPERIENCE_REDIRECT:int = -2;
|
||||
|
||||
public static const RT_PARAM_SEEK_BUDDY:int = -3;
|
||||
|
||||
public static const RT_PARAM_PRIVATE_PARTY:int = -4;
|
||||
|
||||
public static var roomCountResponseCallback:Function;
|
||||
|
||||
public static var isSwitching:Boolean;
|
||||
|
||||
public static var _joinRoomName:String;
|
||||
|
||||
public static var _seekBuddyName:String;
|
||||
|
||||
public static var _loadingNewRoom:Boolean;
|
||||
|
||||
private static var _denJoinPending:Boolean;
|
||||
|
||||
private static var _waitForLangPack:Boolean;
|
||||
|
||||
private static var _savedRPData:Object;
|
||||
|
||||
private static var _roomMgr:RoomManagerWorld;
|
||||
|
||||
private static var _rfCallback:Function;
|
||||
|
||||
private static var _roomDefs:Object;
|
||||
|
||||
public static var _welcomePopup:WelcomeToCarnival;
|
||||
|
||||
public static var _joiningBuddyCrossNode:Boolean;
|
||||
|
||||
public function RoomXtCommManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function init() : void
|
||||
{
|
||||
_joiningBuddyCrossNode = false;
|
||||
_denJoinPending = false;
|
||||
_waitForLangPack = false;
|
||||
_savedRPData = null;
|
||||
_roomMgr = RoomManagerWorld.instance;
|
||||
XtReplyDemuxer.addModule(handleXtReply,"r");
|
||||
}
|
||||
|
||||
public static function destroy() : void
|
||||
{
|
||||
XtReplyDemuxer.removeModule(handleXtReply);
|
||||
roomCountResponseCallback = null;
|
||||
}
|
||||
|
||||
public static function sendRoomCountRequest() : void
|
||||
{
|
||||
gMainFrame.server.setXtObject_Str("rc",[],true,false,false);
|
||||
}
|
||||
|
||||
public static function sendMoreShardRequest() : void
|
||||
{
|
||||
gMainFrame.server.setXtObject_Str("rm",[]);
|
||||
}
|
||||
|
||||
public static function sendRoomFFMRequest(param1:Function) : void
|
||||
{
|
||||
_rfCallback = param1;
|
||||
gMainFrame.server.setXtObject_Str("rf",[]);
|
||||
}
|
||||
|
||||
public static function sendNonDenRoomJoinRequest(param1:String) : void
|
||||
{
|
||||
sendRoomJoinRequestFull(param1);
|
||||
}
|
||||
|
||||
public static function set waitForLangPack(param1:Boolean) : void
|
||||
{
|
||||
_waitForLangPack = param1;
|
||||
}
|
||||
|
||||
public static function sendRoomJoinRequest(param1:String, param2:int = -1, param3:Boolean = false, param4:Boolean = false, param5:Boolean = true, param6:RoomJoinType = null) : void
|
||||
{
|
||||
if(param1.slice(0,3) == "den" && !param3)
|
||||
{
|
||||
DenXtCommManager.requestDenJoinFull(param1,param2,param4,param5);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendRoomJoinRequestFull(param1,param4,param5,param6);
|
||||
}
|
||||
}
|
||||
|
||||
private static function sendRoomJoinRequestFull(param1:String, param2:Boolean = false, param3:Boolean = true, param4:RoomJoinType = null) : 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())
|
||||
{
|
||||
trace("WARNING: User is already in this room!");
|
||||
SBTracker.trackPageview("/game/play/error/rjRequestTriedToJoinAlreadyInRoom/",-1,1);
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
AvatarManager.joiningNewRoom = true;
|
||||
_loadingNewRoom = true;
|
||||
if(param4 == null)
|
||||
{
|
||||
param4 = RoomJoinType.AUTO;
|
||||
}
|
||||
var _loc6_:int = param1.indexOf("@");
|
||||
if(_loc6_ < 0)
|
||||
{
|
||||
_joinRoomName = param1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_joinRoomName = param1.substring(0,_loc6_);
|
||||
}
|
||||
if(RoomManagerWorld.instance.haveHadLastGoodRoomName())
|
||||
{
|
||||
SBTracker.trackPageview("/game/play/loading/changeRooms");
|
||||
}
|
||||
var _loc7_:String = param3 ? "1" : "0";
|
||||
var _loc5_:Boolean = param2 || _roomMgr.forceInvisMode;
|
||||
if(param1 == null || param1 == "")
|
||||
{
|
||||
DebugUtility.debugTrace("ERROR: tried to join empty string or null room! rjNameOrId:" + param1 + " joinType:" + param4 + " forceInvisNow:" + _loc5_ + " confirmLanguageChange:" + param3 + " _joinRoomName:" + _joinRoomName);
|
||||
SBTracker.trackPageview("/game/play/error/rjRequestTriedToJoinNullOrEmptyStringRoom/",-1,1);
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
return;
|
||||
}
|
||||
if(!_loc5_)
|
||||
{
|
||||
gMainFrame.server.setXtObject_Str("rj",[param1,_loc7_,"0",param4]);
|
||||
}
|
||||
else
|
||||
{
|
||||
gMainFrame.server.setXtObject_Str("rj",[param1,_loc7_,"1",param4]);
|
||||
_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 getRoomDef(param1:int) : Object
|
||||
{
|
||||
return _roomDefs[param1];
|
||||
}
|
||||
|
||||
public static function set loadingNewRoom(param1:Boolean) : void
|
||||
{
|
||||
_loadingNewRoom = param1;
|
||||
}
|
||||
|
||||
public static function startRoomLoadIfReady() : void
|
||||
{
|
||||
_waitForLangPack = false;
|
||||
if(_savedRPData)
|
||||
{
|
||||
roomPropertiesResponse(_savedRPData);
|
||||
_savedRPData = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static function roomDefResponse(param1:DefPacksDefHelper) : void
|
||||
{
|
||||
var _loc3_:Object = null;
|
||||
var _loc5_:Object = param1.def;
|
||||
DefPacksDefHelper.mediaArray[1011] = null;
|
||||
var _loc4_:Object = {};
|
||||
for each(var _loc2_:Object in param1.def)
|
||||
{
|
||||
_loc3_ = {
|
||||
"defId":int(_loc2_.id),
|
||||
"pathName":_loc2_.pathName,
|
||||
"enviroType":int(_loc2_.type),
|
||||
"isPlatformer":_loc2_.isPlatformer == "1"
|
||||
};
|
||||
_loc4_[_loc3_.defId] = _loc3_;
|
||||
}
|
||||
_roomDefs = _loc4_;
|
||||
}
|
||||
|
||||
public static function handleXtReply(param1:SFEvent) : void
|
||||
{
|
||||
var _loc2_:Object = param1.obj;
|
||||
switch(_loc2_[0])
|
||||
{
|
||||
case "rj":
|
||||
roomJoinResponse(_loc2_);
|
||||
break;
|
||||
case "rp":
|
||||
roomPropertiesResponse(_loc2_);
|
||||
break;
|
||||
case "rc":
|
||||
roomCountResponse(_loc2_);
|
||||
break;
|
||||
case "rf":
|
||||
roomFFMResponse(_loc2_);
|
||||
break;
|
||||
case "rl":
|
||||
roomListResponse(_loc2_);
|
||||
break;
|
||||
case "rm":
|
||||
roomMoreResponse(_loc2_);
|
||||
break;
|
||||
default:
|
||||
throw new Error("RoomXtCommManager: Received illegal cmd: " + _loc2_[0]);
|
||||
}
|
||||
}
|
||||
|
||||
private static function roomJoinResponse(param1:Object) : void
|
||||
{
|
||||
var _loc4_:SFRoom = null;
|
||||
var _loc6_:String = null;
|
||||
var _loc5_:Array = null;
|
||||
var _loc8_:int = 0;
|
||||
var _loc7_:int = 0;
|
||||
var _loc11_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc2_:String = null;
|
||||
var _loc12_:String = null;
|
||||
var _loc9_:int = 0;
|
||||
var _loc10_:int = 2;
|
||||
if(param1[_loc10_++] == "1")
|
||||
{
|
||||
_joiningBuddyCrossNode = false;
|
||||
_loc4_ = new SFRoom();
|
||||
_loc4_.name = param1[_loc10_++];
|
||||
_loc4_.id = int(param1[_loc10_++]);
|
||||
_loc4_.users = int(param1[_loc10_++]);
|
||||
_loc4_.maxUsers = int(param1[_loc10_++]);
|
||||
_loc4_.spectators = int(param1[_loc10_++]);
|
||||
_loc4_.maxSpectators = int(param1[_loc10_++]);
|
||||
_loc4_.isPrivate = param1[_loc10_++] == "1";
|
||||
_loc4_.isGame = param1[_loc10_++] == "1";
|
||||
_loc4_.isLimbo = param1[_loc10_++] == "1";
|
||||
_loc4_.isTemp = param1[_loc10_++] == "1";
|
||||
_loc4_.isSubRoom = param1[_loc10_++] == "1";
|
||||
_loc6_ = param1[_loc10_++];
|
||||
if(_loc4_.name.indexOf("pparty") == 0)
|
||||
{
|
||||
_loc5_ = _loc6_.split("|");
|
||||
_loc6_ = LocalizationManager.translateIdOnly(_loc5_[0]) + " " + LocalizationManager.translateIdOnly(_loc5_[1]) + " " + LocalizationManager.translateIdOnly(_loc5_[2]);
|
||||
}
|
||||
_loc8_ = int(param1[_loc10_++]);
|
||||
_loc7_ = int(param1[_loc10_++]);
|
||||
if(gMainFrame.userInfo.myPerUserAvId != _loc7_)
|
||||
{
|
||||
gMainFrame.userInfo.myPerUserAvId = _loc7_;
|
||||
if(AvatarManager.isMyUserInCustomAdventureHosting())
|
||||
{
|
||||
gMainFrame.userInfo.playerAvatarInfo.type = -1;
|
||||
}
|
||||
}
|
||||
PetManager.myActivePetInvId = int(param1[_loc10_++]);
|
||||
_loc11_ = int(param1[_loc10_++]);
|
||||
_roomMgr.customMusicDef = int(param1[_loc10_++]);
|
||||
if(param1.hasOwnProperty(_loc10_))
|
||||
{
|
||||
_loc3_ = int(param1[_loc10_++]);
|
||||
_roomMgr.shardId = _loc3_;
|
||||
}
|
||||
if(_loc11_ != LocalizationManager.currentLanguage && !MinigameManager.inInRoomGame())
|
||||
{
|
||||
LocalizationXtCommManager.requestLocalizationPack(_loc11_);
|
||||
}
|
||||
gMainFrame.server.handleRoomJoin(_loc4_);
|
||||
_roomMgr.forceInvisMode = false;
|
||||
if(!_loc4_.isGame || _loc4_.name.indexOf("den") == 0 || _loc4_.name.indexOf("party") == 0 || _loc4_.name.indexOf("pparty") == 0 || _loc4_.name.indexOf("staging") == 0)
|
||||
{
|
||||
GuiManager.setRoomNameDisplay(_loc6_,_loc8_);
|
||||
}
|
||||
if(_loc4_.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(_loc4_.name.indexOf("room_diamonds") != -1)
|
||||
{
|
||||
if(gMainFrame.userInfo.userVarCache.getUserVarValueById(368) < 1)
|
||||
{
|
||||
GuiManager.openDiamondShopInfo();
|
||||
AchievementXtCommManager.requestSetUserVar(368,1);
|
||||
}
|
||||
}
|
||||
delete gMainFrame.clientInfo.autoStartRoom;
|
||||
QuestXtCommManager.roomJoined(_loc4_.name);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_joiningBuddyCrossNode)
|
||||
{
|
||||
_joiningBuddyCrossNode = false;
|
||||
_loadingNewRoom = false;
|
||||
sendRoomJoinRequest(gMainFrame.clientInfo.startUpRoom + "#-1");
|
||||
return;
|
||||
}
|
||||
_loc2_ = param1[_loc10_++];
|
||||
if(_loc2_ == "N")
|
||||
{
|
||||
_loc12_ = param1[_loc10_++];
|
||||
if(_loc12_ == "null")
|
||||
{
|
||||
new SBStandardPopup(LoadProgress.loadLayer,LocalizationManager.translateIdOnly(14834),false);
|
||||
AvatarManager.joiningNewRoom = false;
|
||||
_denJoinPending = false;
|
||||
_seekBuddyName = null;
|
||||
return;
|
||||
}
|
||||
if(_denJoinPending)
|
||||
{
|
||||
gMainFrame.clientInfo.autoStartRoom = _joinRoomName;
|
||||
gMainFrame.clientInfo.autoStartRoomShardId = -1;
|
||||
DebugUtility.debugTrace("using autoStartRoom to prep resend join request after switching server nodes - room:" + _joinRoomName + " shardId:" + gMainFrame.clientInfo.autoStartRoomShardId);
|
||||
if(!gMainFrame.switchServersIfNeeded(_loc12_))
|
||||
{
|
||||
throw new Error("got join room response saying to switch server nodes, but was already on that node!");
|
||||
}
|
||||
}
|
||||
else if(_seekBuddyName)
|
||||
{
|
||||
gMainFrame.clientInfo.autoStartRoom = _seekBuddyName;
|
||||
gMainFrame.clientInfo.autoStartRoomShardId = -3;
|
||||
if(!gMainFrame.switchServersIfNeeded(_loc12_))
|
||||
{
|
||||
new SBStandardPopup(LoadProgress.loadLayer,LocalizationManager.translateIdOnly(14835),false);
|
||||
AvatarManager.joiningNewRoom = false;
|
||||
_denJoinPending = false;
|
||||
_seekBuddyName = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_joinRoomName.indexOf("#") < 0)
|
||||
{
|
||||
throw new Error("join room request for sfs room:" + _joinRoomName + " somehow is on another server node:" + _loc12_ + " (current node:" + gMainFrame.server.serverIp + ")?!");
|
||||
}
|
||||
gMainFrame.clientInfo.autoStartRoom = _joinRoomName;
|
||||
_loc9_ = int(_joinRoomName.substr(_joinRoomName.indexOf("#") + 1));
|
||||
if(_loc9_ == -1)
|
||||
{
|
||||
_loc9_ = -2;
|
||||
}
|
||||
gMainFrame.clientInfo.autoStartRoomShardId = _loc9_;
|
||||
DebugUtility.debugTrace("using autoStartRoom to prep resend join request after switching server nodes - room:" + _joinRoomName + " shardId:" + gMainFrame.clientInfo.autoStartRoomShardId);
|
||||
if(!gMainFrame.switchServersIfNeeded(_loc12_))
|
||||
{
|
||||
new SBStandardPopup(LoadProgress.loadLayer,LocalizationManager.translateIdOnly(14835),false);
|
||||
AvatarManager.joiningNewRoom = false;
|
||||
_denJoinPending = false;
|
||||
_seekBuddyName = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
_roomMgr.clearLastGoodRoomForServerSwitch();
|
||||
}
|
||||
else if(_loc2_.indexOf("DJE") == 0)
|
||||
{
|
||||
if(_loc2_.charAt(3) == "C")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBYesNoPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14836),true,GuiManager.switchToOceanAnimal,{
|
||||
"switchRooms":false,
|
||||
"switchDens":true
|
||||
});
|
||||
}
|
||||
else if(_loc2_.charAt(3) == "E")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBYesNoPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14836),true,GuiManager.switchToOceanAnimal,{
|
||||
"switchRooms":true,
|
||||
"switchDens":false
|
||||
});
|
||||
}
|
||||
else if(_loc2_.charAt(3) == "K")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBYesNoPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14837),true,GuiManager.switchToOceanAnimal,{
|
||||
"switchRooms":false,
|
||||
"switchDens":false
|
||||
});
|
||||
}
|
||||
}
|
||||
else if(_loc2_ == "BSJ" || _loc2_ == "BSJP")
|
||||
{
|
||||
_loadingNewRoom = false;
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14838));
|
||||
}
|
||||
else if(_loc2_ == "SSJ")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14839));
|
||||
}
|
||||
else if(_loc2_ == "CSJ")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14840));
|
||||
}
|
||||
else if(_loc2_ == "QSJL")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14841));
|
||||
}
|
||||
else if(_loc2_ == "BQSJ")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14842));
|
||||
}
|
||||
else if(_loc2_ == "RQJF")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14843));
|
||||
}
|
||||
else if(_loc2_ == "RQJF_NL")
|
||||
{
|
||||
_loadingNewRoom = false;
|
||||
if(!BuddyManager.joinBuddyInQuest())
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14843));
|
||||
}
|
||||
}
|
||||
else if(_loc2_ == "SQQJ")
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14844));
|
||||
}
|
||||
else if(_loc2_ != "LC")
|
||||
{
|
||||
gMainFrame.server.handleRoomJoinError(_loc2_,param1[_loc10_]);
|
||||
}
|
||||
_loadingNewRoom = false;
|
||||
}
|
||||
AvatarManager.joiningNewRoom = false;
|
||||
_denJoinPending = false;
|
||||
_seekBuddyName = null;
|
||||
}
|
||||
|
||||
private static function roomPropertiesResponse(param1:Object) : void
|
||||
{
|
||||
if(_waitForLangPack)
|
||||
{
|
||||
_savedRPData = param1;
|
||||
return;
|
||||
}
|
||||
_roomMgr.loadRoom(param1[2],int(param1[3]),int(param1[4]),int(param1[5]),int(param1[6]),int(param1[7]),param1[8] != null && param1[8] != "" ? JSON.parse(param1[8]) : null);
|
||||
AvatarManager.finishHandleAvatarCreate();
|
||||
}
|
||||
|
||||
private static function roomCountResponse(param1:Object) : void
|
||||
{
|
||||
if(roomCountResponseCallback != null)
|
||||
{
|
||||
roomCountResponseCallback(param1);
|
||||
}
|
||||
}
|
||||
|
||||
private static function roomMoreResponse(param1:Object) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
if(!isNaN(Number(param1[2])))
|
||||
{
|
||||
_loc2_ = int(param1[2]);
|
||||
if(_loc2_ <= 0)
|
||||
{
|
||||
new SBStandardPopup(LoadProgress.loadLayer,LocalizationManager.translateIdOnly(14847),false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
GamePlay(gMainFrame.gamePlay).showServerSelectorMore(param1);
|
||||
}
|
||||
|
||||
private static function roomFFMResponse(param1:Object) : void
|
||||
{
|
||||
if(param1[2] == "1" && _rfCallback != null)
|
||||
{
|
||||
_rfCallback();
|
||||
}
|
||||
}
|
||||
|
||||
private static function roomListResponse(param1:Object) : void
|
||||
{
|
||||
gMainFrame.server.setRoomList(param1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,667 @@
|
||||
package room
|
||||
{
|
||||
import com.sbi.loader.SceneLoader;
|
||||
import flash.display.MovieClip;
|
||||
import flash.geom.Point;
|
||||
|
||||
public class VolumeManager
|
||||
{
|
||||
|
||||
public static const VOLUMETYPE_NONE:int = 0;
|
||||
|
||||
public static const VOLUMETYPE_GAME:int = 1;
|
||||
|
||||
public static const VOLUMETYPE_DEN_VOLUME:int = 2;
|
||||
|
||||
public static const VOLUMETYPE_SPLASH:int = 3;
|
||||
|
||||
public static const VOLUMETYPE_STORE_PET:int = 4;
|
||||
|
||||
public static const VOLUMETYPE_SOCIAL_GROUP:int = 5;
|
||||
|
||||
public static const VOLUMETYPE_SOCIAL_EMOTICON:int = 6;
|
||||
|
||||
public static const VOLUMETYPE_GUI_ACTION:int = 7;
|
||||
|
||||
public static const VOLUMETYPE_RECYCLE_ACCESSORY:int = 8;
|
||||
|
||||
public static const VOLUMETYPE_RECYCLE_DEN_ITEM:int = 9;
|
||||
|
||||
public static const VOLUMETYPE_TRIGGER_WALKIN:int = 11;
|
||||
|
||||
public static const VOLUMETYPE_GENERIC_LIST:int = 12;
|
||||
|
||||
public static const VOLUMETYPE_CLICK_EMOTICON:int = 13;
|
||||
|
||||
public static const VOLUMETYPE_AIR:int = 14;
|
||||
|
||||
public static const VOLUMETYPE_DYNAMIC_COLLISION:int = 15;
|
||||
|
||||
public static const VOLUMETYPE_DYNAMIC_AIR:int = 16;
|
||||
|
||||
public static const VOLUMETYPE_DYNAMIC_PHANTOM_AIR:int = 17;
|
||||
|
||||
public static const VOLUMETYPE_PLANT:int = 18;
|
||||
|
||||
public static const VOLUMETYPE_STEALTH:int = 19;
|
||||
|
||||
public static const VOLUMETYPE_ADVENTURE_INTERACT:int = 20;
|
||||
|
||||
public static const VOLUMETYPE_DARKSOFT:int = 21;
|
||||
|
||||
public static const VOLUMETYPE_DARKHARD:int = 22;
|
||||
|
||||
public static const VOLUMETYPE_FALLINGPHANTOM:int = 23;
|
||||
|
||||
private var _scene:SceneLoader;
|
||||
|
||||
private var _volumes:Array;
|
||||
|
||||
private var _layers:Array;
|
||||
|
||||
private var _volumeActors:Array;
|
||||
|
||||
private var _roomObjs:Array;
|
||||
|
||||
private var _offset:Point;
|
||||
|
||||
private var _socialTriggersVolumes:Array;
|
||||
|
||||
private var _splashVolumes:Array;
|
||||
|
||||
private var _ladderVolumes:Array;
|
||||
|
||||
public function VolumeManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function setScene(param1:SceneLoader, param2:Point) : void
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:Object = null;
|
||||
release();
|
||||
_socialTriggersVolumes = [];
|
||||
_splashVolumes = [];
|
||||
_ladderVolumes = [];
|
||||
_roomObjs = [];
|
||||
_volumeActors = [];
|
||||
_scene = param1;
|
||||
_offset = param2;
|
||||
_volumes = param1.getActorList("ActorVolume");
|
||||
_layers = _scene.getActorList("ActorLayer");
|
||||
if(_volumes)
|
||||
{
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _volumes.length)
|
||||
{
|
||||
_loc4_ = _volumes[_loc3_];
|
||||
newVolume(_loc4_);
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function release() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
var _loc3_:* = null;
|
||||
if(_volumeActors)
|
||||
{
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < _volumeActors.length)
|
||||
{
|
||||
for each(var _loc2_ in _volumeActors[_loc1_].interactiveObjs)
|
||||
{
|
||||
_loc2_.release();
|
||||
}
|
||||
_loc1_++;
|
||||
}
|
||||
}
|
||||
if(_roomObjs)
|
||||
{
|
||||
for each(_loc3_ in _roomObjs)
|
||||
{
|
||||
_loc3_.release();
|
||||
}
|
||||
}
|
||||
_socialTriggersVolumes = null;
|
||||
_volumes = null;
|
||||
_layers = null;
|
||||
_splashVolumes = null;
|
||||
_ladderVolumes = null;
|
||||
}
|
||||
|
||||
public function get hasSplashVolume() : Boolean
|
||||
{
|
||||
return _splashVolumes && _splashVolumes.length;
|
||||
}
|
||||
|
||||
public function clearHold(param1:Boolean = true, param2:Boolean = false) : void
|
||||
{
|
||||
for each(var _loc3_:RoomObject in _roomObjs)
|
||||
{
|
||||
if(param2)
|
||||
{
|
||||
_loc3_.setMouseOver(false);
|
||||
}
|
||||
else if(!_loc3_.isMouseOver())
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_loc3_.mouseDown(false);
|
||||
}
|
||||
if(!_loc3_.hold)
|
||||
{
|
||||
_loc3_.setDir(-1);
|
||||
}
|
||||
_loc3_.onEnterFrame();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function testPointInVolume(param1:Point, param2:Object) : Boolean
|
||||
{
|
||||
return pointInVolume(param1,param2.v);
|
||||
}
|
||||
|
||||
public function testMouseVolumes(param1:Point, param2:Boolean, param3:Function = null) : Object
|
||||
{
|
||||
var _loc4_:Object = null;
|
||||
var _loc6_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
var _loc8_:Object = null;
|
||||
var _loc7_:RoomObject = null;
|
||||
if(_volumeActors)
|
||||
{
|
||||
clearHold(param2,true);
|
||||
if(param2)
|
||||
{
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < _volumeActors.length)
|
||||
{
|
||||
_loc8_ = _volumeActors[_loc5_];
|
||||
if(isMouseVolume(_loc8_.type) && pointInVolume(param1,_loc8_.v))
|
||||
{
|
||||
if(_loc8_.interactiveObjs)
|
||||
{
|
||||
_loc6_ = 0;
|
||||
while(_loc6_ < _loc8_.interactiveObjs.length)
|
||||
{
|
||||
if(param3 == null || param3 != null && param3(_loc8_.name))
|
||||
{
|
||||
_loc7_ = _loc8_.interactiveObjs[_loc6_];
|
||||
_loc7_.setDir(1);
|
||||
_loc7_.mouseDown(true);
|
||||
_loc7_.setMouseOver(true);
|
||||
_loc7_.onEnterFrame();
|
||||
}
|
||||
_loc6_++;
|
||||
}
|
||||
}
|
||||
_loc4_ = _loc8_;
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
}
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < _volumeActors.length)
|
||||
{
|
||||
_loc8_ = _volumeActors[_loc5_];
|
||||
if(isMouseVolume(_loc8_.type) && _loc8_.interactiveObjs && pointInVolume(param1,_loc8_.v))
|
||||
{
|
||||
_loc6_ = 0;
|
||||
while(_loc6_ < _loc8_.interactiveObjs.length)
|
||||
{
|
||||
if(param3 == null || param3 != null && param3(_loc8_.name))
|
||||
{
|
||||
_loc7_ = _loc8_.interactiveObjs[_loc6_];
|
||||
if(!_loc7_.hold)
|
||||
{
|
||||
_loc7_.setDir(1);
|
||||
_loc7_.setMouseOver(true);
|
||||
_loc7_.onEnterFrame();
|
||||
}
|
||||
}
|
||||
_loc6_++;
|
||||
}
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
clearHold(param2);
|
||||
}
|
||||
return _loc4_;
|
||||
}
|
||||
|
||||
public function testPlantVolumes(param1:Point) : Object
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:Object = null;
|
||||
var _loc2_:Object = null;
|
||||
if(_volumeActors)
|
||||
{
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _volumeActors.length)
|
||||
{
|
||||
_loc4_ = _volumeActors[_loc3_];
|
||||
if(isPlantVolume(_loc4_.type) && pointInVolume(param1,_loc4_.v))
|
||||
{
|
||||
_loc2_ = _loc4_;
|
||||
break;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
public function setVolumesEnabled(param1:String, param2:Boolean) : void
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:Object = null;
|
||||
if(_volumeActors)
|
||||
{
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _volumeActors.length)
|
||||
{
|
||||
_loc4_ = _volumeActors[_loc3_];
|
||||
if(_loc4_.name == param1)
|
||||
{
|
||||
_loc4_.enabled = param2;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function testStealthVolumes(param1:Point) : Object
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:Object = null;
|
||||
var _loc2_:Object = null;
|
||||
if(_volumeActors)
|
||||
{
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _volumeActors.length)
|
||||
{
|
||||
_loc4_ = _volumeActors[_loc3_];
|
||||
if(_loc4_.enabled && isStealthVolume(_loc4_.type) && pointInVolume(param1,_loc4_.v))
|
||||
{
|
||||
_loc2_ = _loc4_;
|
||||
break;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
public function testAvatarVolumes(param1:Point) : Object
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:Object = null;
|
||||
var _loc2_:Object = null;
|
||||
if(_volumeActors)
|
||||
{
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _volumeActors.length)
|
||||
{
|
||||
_loc4_ = _volumeActors[_loc3_];
|
||||
if(isAvatarVolume(_loc4_.type) && pointInVolume(param1,_loc4_.v))
|
||||
{
|
||||
_loc2_ = _loc4_;
|
||||
break;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
public function testAvatarVolume(param1:String, param2:Point) : Boolean
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:Object = null;
|
||||
if(_volumeActors)
|
||||
{
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _volumeActors.length)
|
||||
{
|
||||
_loc4_ = _volumeActors[_loc3_];
|
||||
if(_loc4_.name == param1)
|
||||
{
|
||||
if(pointInVolume(param2,_loc4_.v))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function testSplashVolumes(param1:Point) : Object
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:Object = null;
|
||||
var _loc2_:Object = null;
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _splashVolumes.length)
|
||||
{
|
||||
_loc4_ = _splashVolumes[_loc3_];
|
||||
if(pointInVolume(param1,_loc4_.v))
|
||||
{
|
||||
_loc2_ = _loc4_;
|
||||
break;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
public function testLadderVolumes(param1:Point) : Object
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:Object = null;
|
||||
var _loc2_:Object = null;
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _ladderVolumes.length)
|
||||
{
|
||||
_loc4_ = _ladderVolumes[_loc3_];
|
||||
if(pointInVolume(param1,_loc4_.v))
|
||||
{
|
||||
_loc2_ = _loc4_;
|
||||
break;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
public function isSceneSet() : Boolean
|
||||
{
|
||||
return _ladderVolumes != null;
|
||||
}
|
||||
|
||||
public function updateSocialTriggers(param1:Object) : void
|
||||
{
|
||||
var _loc2_:* = undefined;
|
||||
if(_socialTriggersVolumes && _socialTriggersVolumes.length)
|
||||
{
|
||||
clearSocialTriggers();
|
||||
for(var _loc3_:Object in param1)
|
||||
{
|
||||
_loc2_ = param1[_loc3_];
|
||||
testSocialTriggers(new Point(_loc2_.x,_loc2_.y),_loc2_.animId);
|
||||
}
|
||||
updateSocialTriggersStage();
|
||||
}
|
||||
}
|
||||
|
||||
private function clearSocialTriggers() : void
|
||||
{
|
||||
var _loc1_:* = null;
|
||||
var _loc2_:* = null;
|
||||
for each(_loc2_ in _socialTriggersVolumes)
|
||||
{
|
||||
for each(_loc1_ in _loc2_.interactiveObjs)
|
||||
{
|
||||
if(_loc1_ is RoomObject_SocialTrigger)
|
||||
{
|
||||
_loc1_.clearCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function testSocialTriggers(param1:Point, param2:int) : void
|
||||
{
|
||||
var _loc3_:* = null;
|
||||
var _loc4_:* = null;
|
||||
for each(_loc4_ in _socialTriggersVolumes)
|
||||
{
|
||||
if(pointInVolume(param1,_loc4_.v) && (!_loc4_.animIds || _loc4_.animIds.indexOf(param2) >= 0))
|
||||
{
|
||||
for each(_loc3_ in _loc4_.interactiveObjs)
|
||||
{
|
||||
if(_loc3_ is RoomObject_SocialTrigger)
|
||||
{
|
||||
_loc3_.incCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function updateSocialTriggersStage() : void
|
||||
{
|
||||
var _loc1_:* = null;
|
||||
var _loc2_:* = null;
|
||||
for each(_loc2_ in _socialTriggersVolumes)
|
||||
{
|
||||
for each(_loc1_ in _loc2_.interactiveObjs)
|
||||
{
|
||||
if(_loc1_ is RoomObject_SocialTrigger)
|
||||
{
|
||||
_loc1_.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 || param1 == 24;
|
||||
}
|
||||
|
||||
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 isLadderVolume(param1:int) : Boolean
|
||||
{
|
||||
return param1 == 11;
|
||||
}
|
||||
|
||||
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 _loc3_:int = 0;
|
||||
var _loc2_:Point = null;
|
||||
var _loc4_:Object = null;
|
||||
var _loc5_:Object = {
|
||||
"enabled":true,
|
||||
"name":param1.name,
|
||||
"v":param1.points.slice(),
|
||||
"status":0,
|
||||
"interactiveObjs":null,
|
||||
"message":param1.message,
|
||||
"type":param1.type,
|
||||
"typeDefId":param1.typeDefId,
|
||||
"bWalkTo":param1.walkTo
|
||||
};
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _loc5_.v.length)
|
||||
{
|
||||
_loc2_ = new Point(_loc5_.v[_loc3_].x,_loc5_.v[_loc3_].y);
|
||||
convertToWorldSpace(_loc2_);
|
||||
_loc5_.v[_loc3_] = _loc2_;
|
||||
_loc3_++;
|
||||
}
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _layers.length)
|
||||
{
|
||||
_loc4_ = _layers[_loc3_];
|
||||
if(_loc4_.name == param1.name)
|
||||
{
|
||||
if(!_loc5_.interactiveObjs)
|
||||
{
|
||||
_loc5_.interactiveObjs = [];
|
||||
}
|
||||
_loc5_.interactiveObjs.push(getRoomObject(_loc4_,param1.message));
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
_volumeActors.push(_loc5_);
|
||||
if(isSplashVolume(_loc5_.type))
|
||||
{
|
||||
_splashVolumes.push(_loc5_);
|
||||
}
|
||||
if(_loc5_.name == "ladder")
|
||||
{
|
||||
_ladderVolumes.push(_loc5_);
|
||||
}
|
||||
if(isSocialTriggerVolume(_loc5_.type))
|
||||
{
|
||||
_loc5_.animIds = null;
|
||||
if(_loc5_.message.length)
|
||||
{
|
||||
_loc5_.animIds = _loc5_.message.split(",");
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _loc5_.animIds.length)
|
||||
{
|
||||
_loc5_.animIds[_loc3_] = int(_loc5_.animIds[_loc3_]);
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
_socialTriggersVolumes.push(_loc5_);
|
||||
}
|
||||
}
|
||||
|
||||
private function getRoomObject(param1:Object, param2:String) : Object
|
||||
{
|
||||
var _loc4_:MovieClip = null;
|
||||
var _loc3_:Class = null;
|
||||
var _loc5_:RoomObject = _roomObjs[param1.name];
|
||||
if(!_loc5_)
|
||||
{
|
||||
_loc4_ = param1.s.content;
|
||||
var _loc6_:String = param2;
|
||||
if("gem" !== _loc6_)
|
||||
{
|
||||
if(_loc4_.stages != null)
|
||||
{
|
||||
_loc3_ = RoomObject_SocialTrigger;
|
||||
}
|
||||
else if(_loc4_.currentLabels.length)
|
||||
{
|
||||
if(_loc4_.currentLabels[0].name == "idle")
|
||||
{
|
||||
_loc3_ = RoomObject_IdleActive;
|
||||
}
|
||||
else if(_loc4_.currentLabels[0].name == "random")
|
||||
{
|
||||
_loc3_ = RoomObject_RandomClick;
|
||||
}
|
||||
}
|
||||
if(!_loc3_)
|
||||
{
|
||||
_loc3_ = RoomObject_ForwardReverseHold;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_ = RoomObject_GemPickup;
|
||||
}
|
||||
_loc5_ = new _loc3_(_loc4_);
|
||||
_roomObjs[param1.name] = _loc5_;
|
||||
}
|
||||
return _loc5_;
|
||||
}
|
||||
|
||||
private function pointInVolume(param1:Point, param2:Array) : Boolean
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc6_:Number = NaN;
|
||||
var _loc4_:Number = 0;
|
||||
var _loc5_:Number = param2.length - 1;
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _loc5_)
|
||||
{
|
||||
if(param2[_loc3_].y <= param1.y && param2[_loc3_ + 1].y > param1.y || param2[_loc3_].y > param1.y && param2[_loc3_ + 1].y <= param1.y)
|
||||
{
|
||||
_loc6_ = (param1.y - param2[_loc3_].y) / (param2[_loc3_ + 1].y - param2[_loc3_].y);
|
||||
if(param1.x < param2[_loc3_].x + _loc6_ * (param2[_loc3_ + 1].x - param2[_loc3_].x))
|
||||
{
|
||||
_loc4_++;
|
||||
}
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
return _loc4_ % 2 ? true : false;
|
||||
}
|
||||
|
||||
private function convertToWorldSpace(param1:Point) : void
|
||||
{
|
||||
param1.x -= _offset.x;
|
||||
param1.y -= _offset.y;
|
||||
}
|
||||
|
||||
public function findVolume(param1:String) : Array
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc2_:Array = null;
|
||||
if(_volumeActors != null)
|
||||
{
|
||||
while(_loc3_ < _volumeActors.length)
|
||||
{
|
||||
if(_volumeActors[_loc3_].name == param1)
|
||||
{
|
||||
if(_loc2_ == null)
|
||||
{
|
||||
_loc2_ = [];
|
||||
}
|
||||
_loc2_.push(_volumeActors[_loc3_]);
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
public function findVolumesByType(param1:int) : Array
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc2_:Array = null;
|
||||
if(_volumeActors != null)
|
||||
{
|
||||
while(_loc3_ < _volumeActors.length)
|
||||
{
|
||||
if(_volumeActors[_loc3_].type == param1)
|
||||
{
|
||||
if(_loc2_ == null)
|
||||
{
|
||||
_loc2_ = [];
|
||||
}
|
||||
_loc2_.push(_volumeActors[_loc3_]);
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user