mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-20 09: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
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,378 @@
|
||||
package playerWall
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.net.SharedObject;
|
||||
import flash.utils.Timer;
|
||||
import gui.DarkenManager;
|
||||
import gui.GuiManager;
|
||||
|
||||
public class PlayerWallManager
|
||||
{
|
||||
|
||||
private static var _guiLayer:DisplayLayer;
|
||||
|
||||
private static var _hudWallBtn:MovieClip;
|
||||
|
||||
private static var _glowTimer:Timer;
|
||||
|
||||
private static var _openWallUpdateTimer:Timer;
|
||||
|
||||
private static var _myPlayerWallClosedTimer:Timer;
|
||||
|
||||
private static var _unreadCount:int;
|
||||
|
||||
private static var _inbox:Array;
|
||||
|
||||
private static var _strangerInbox:Array;
|
||||
|
||||
private static var _myPlayerWall:PlayerWallGui;
|
||||
|
||||
private static var _strangersPlayerWall:PlayerWallGui;
|
||||
|
||||
private static var _isFirstTime:Boolean;
|
||||
|
||||
private static var _statusText:String;
|
||||
|
||||
private static var _currentMessageColor:String;
|
||||
|
||||
private static var _currentMessagePattern:int;
|
||||
|
||||
private static var _privacyId:int;
|
||||
|
||||
private static var _reportedStrangerMessageIds:Array;
|
||||
|
||||
private static var _iconId:int;
|
||||
|
||||
public function PlayerWallManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function init(param1:MovieClip) : void
|
||||
{
|
||||
PlayerWallXtCommManager.init();
|
||||
PlayerWallXtCommManager.sendPrivacyGetRequest(gMainFrame.server.userName);
|
||||
_guiLayer = GuiManager.guiLayer;
|
||||
_hudWallBtn = param1;
|
||||
_unreadCount = 0;
|
||||
_isFirstTime = true;
|
||||
_hudWallBtn.newPostCount.visible = false;
|
||||
_hudWallBtn.newPostCount.postCountTxt.text = "";
|
||||
_hudWallBtn.glow.visible = true;
|
||||
_glowTimer = new Timer(5000);
|
||||
_glowTimer.addEventListener(TimerEvent.TIMER,glowTimerHandler,false,0,true);
|
||||
_glowTimer.start();
|
||||
_openWallUpdateTimer = new Timer(15000);
|
||||
_openWallUpdateTimer.addEventListener(TimerEvent.TIMER,onMessageUpdateTimer,false,0,true);
|
||||
_myPlayerWallClosedTimer = new Timer(60000);
|
||||
_myPlayerWallClosedTimer.addEventListener(TimerEvent.TIMER,onMessageUpdateTimer,false,0,true);
|
||||
_myPlayerWallClosedTimer.start();
|
||||
var _loc2_:SharedObject = GuiManager.sharedObj;
|
||||
if(Boolean(_loc2_) && Boolean(_loc2_.data))
|
||||
{
|
||||
_currentMessageColor = _loc2_.data.msgColor != null ? _loc2_.data.msgColor : "green";
|
||||
_currentMessagePattern = _loc2_.data.msgPattern != null ? int(_loc2_.data.msgPattern) : 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentMessageColor = "green";
|
||||
_currentMessagePattern = 1;
|
||||
}
|
||||
_inbox = [];
|
||||
_reportedStrangerMessageIds = [];
|
||||
_hudWallBtn.addEventListener(MouseEvent.MOUSE_DOWN,playerWallBtnDownHandler,false,0,true);
|
||||
}
|
||||
|
||||
public static function destroy() : void
|
||||
{
|
||||
_openWallUpdateTimer.reset();
|
||||
_openWallUpdateTimer = null;
|
||||
_myPlayerWallClosedTimer.reset();
|
||||
_myPlayerWallClosedTimer = null;
|
||||
}
|
||||
|
||||
public static function openStrangersPlayerWall(param1:String) : void
|
||||
{
|
||||
if(_strangersPlayerWall)
|
||||
{
|
||||
_strangersPlayerWall.destroy();
|
||||
_strangersPlayerWall = null;
|
||||
}
|
||||
_strangersPlayerWall = new PlayerWallGui();
|
||||
_strangerInbox = [];
|
||||
_strangersPlayerWall.init(_strangerInbox,param1,"",0,_currentMessagePattern,"",_currentMessageColor,1714,1714,onStrangerPlayerWallClose);
|
||||
}
|
||||
|
||||
public static function get isFirstTime() : Boolean
|
||||
{
|
||||
return _isFirstTime;
|
||||
}
|
||||
|
||||
public static function set isFirstTime(param1:Boolean) : void
|
||||
{
|
||||
_isFirstTime = param1;
|
||||
}
|
||||
|
||||
public static function get privacyId() : int
|
||||
{
|
||||
return _privacyId;
|
||||
}
|
||||
|
||||
public static function set privacyId(param1:int) : void
|
||||
{
|
||||
_privacyId = param1;
|
||||
}
|
||||
|
||||
public static function get reportedMessageIds() : Array
|
||||
{
|
||||
return _reportedStrangerMessageIds;
|
||||
}
|
||||
|
||||
public static function startMyWallTimer() : void
|
||||
{
|
||||
if(_openWallUpdateTimer)
|
||||
{
|
||||
_openWallUpdateTimer.start();
|
||||
}
|
||||
}
|
||||
|
||||
public static function onGetResponse(param1:Boolean, param2:Array, param3:Boolean) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
if(param3)
|
||||
{
|
||||
if(param2.length > _inbox.length && !isFirstTime)
|
||||
{
|
||||
_unreadCount = param2.length - _inbox.length;
|
||||
_hudWallBtn.newPostCount.visible = true;
|
||||
_hudWallBtn.newPostCount.postCountTxt.text = _unreadCount;
|
||||
_hudWallBtn.glow.visible = true;
|
||||
_glowTimer.start();
|
||||
}
|
||||
}
|
||||
else if(_myPlayerWall)
|
||||
{
|
||||
isFirstTime = false;
|
||||
_inbox = param2.concat();
|
||||
_myPlayerWall.reloadMessages(_inbox);
|
||||
}
|
||||
else if(_strangersPlayerWall)
|
||||
{
|
||||
_strangerInbox = param2.concat();
|
||||
_strangersPlayerWall.reloadMessages(_strangerInbox);
|
||||
}
|
||||
}
|
||||
else if(!param3)
|
||||
{
|
||||
if(_myPlayerWall)
|
||||
{
|
||||
isFirstTime = true;
|
||||
_myPlayerWall.reloadMessages(_inbox);
|
||||
}
|
||||
else if(_strangersPlayerWall)
|
||||
{
|
||||
_strangersPlayerWall.reloadMessages(_strangerInbox);
|
||||
}
|
||||
}
|
||||
if(!param3)
|
||||
{
|
||||
_openWallUpdateTimer.start();
|
||||
}
|
||||
else
|
||||
{
|
||||
_myPlayerWallClosedTimer.start();
|
||||
}
|
||||
}
|
||||
|
||||
public static function processMessagePush(param1:PostMessage) : void
|
||||
{
|
||||
if(_myPlayerWall)
|
||||
{
|
||||
_inbox.unshift(param1);
|
||||
if(_myPlayerWall)
|
||||
{
|
||||
_myPlayerWall.reloadMessages(_inbox);
|
||||
}
|
||||
}
|
||||
else if(_strangersPlayerWall)
|
||||
{
|
||||
_strangerInbox.unshift(param1);
|
||||
_strangersPlayerWall.reloadMessages(_strangerInbox);
|
||||
}
|
||||
}
|
||||
|
||||
public static function processMessageUpdate(param1:String, param2:String) : void
|
||||
{
|
||||
var _loc3_:PostMessage = null;
|
||||
var _loc4_:Array = [];
|
||||
if(_myPlayerWall)
|
||||
{
|
||||
_loc4_ = _inbox;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc4_ = _strangerInbox;
|
||||
}
|
||||
var _loc5_:int = 0;
|
||||
while(_loc5_ < _loc4_.length)
|
||||
{
|
||||
_loc3_ = _loc4_[_loc5_];
|
||||
if(_loc3_ != null && _loc3_.msgId == param1)
|
||||
{
|
||||
_loc3_.message = param2;
|
||||
if(_myPlayerWall)
|
||||
{
|
||||
_myPlayerWall.reloadMessages(_loc4_);
|
||||
}
|
||||
else if(_strangersPlayerWall)
|
||||
{
|
||||
_strangersPlayerWall.reloadMessages(_loc4_);
|
||||
}
|
||||
break;
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
}
|
||||
|
||||
public static function onAddResponse(param1:String, param2:Number, param3:int) : void
|
||||
{
|
||||
}
|
||||
|
||||
public static function onStrangerReport(param1:String) : void
|
||||
{
|
||||
_reportedStrangerMessageIds.push(param1);
|
||||
if(_strangersPlayerWall)
|
||||
{
|
||||
_strangersPlayerWall.reloadMessages(_strangerInbox);
|
||||
}
|
||||
}
|
||||
|
||||
public static function onDeleteResponse(param1:String, param2:String, param3:Boolean) : void
|
||||
{
|
||||
var _loc4_:String = null;
|
||||
var _loc6_:Boolean = false;
|
||||
var _loc7_:int = 0;
|
||||
var _loc5_:Array = [];
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
if(param3)
|
||||
{
|
||||
_loc6_ = param1 == gMainFrame.userInfo.myUserName;
|
||||
if(_loc6_)
|
||||
{
|
||||
_loc5_ = _inbox;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc5_ = _strangerInbox;
|
||||
}
|
||||
_loc7_ = 0;
|
||||
while(_loc7_ < _loc5_.length)
|
||||
{
|
||||
_loc4_ = _loc5_[_loc7_].msgId;
|
||||
if(_loc4_ == param2)
|
||||
{
|
||||
_loc5_.splice(_loc7_,1);
|
||||
break;
|
||||
}
|
||||
_loc7_++;
|
||||
}
|
||||
}
|
||||
if(_loc6_ && Boolean(_myPlayerWall))
|
||||
{
|
||||
_myPlayerWall.reloadMessages(_loc5_);
|
||||
}
|
||||
else if(_strangersPlayerWall)
|
||||
{
|
||||
_strangersPlayerWall.reloadMessages(_loc5_);
|
||||
}
|
||||
}
|
||||
|
||||
public static function onStatusResponse(param1:Boolean, param2:String, param3:String) : void
|
||||
{
|
||||
if(param1 && param2 == gMainFrame.userInfo.myUserName)
|
||||
{
|
||||
_statusText = param3;
|
||||
_iconId = 1714;
|
||||
}
|
||||
}
|
||||
|
||||
public static function onPrivacyResponse(param1:Boolean, param2:int) : void
|
||||
{
|
||||
if(param1 && Boolean(_myPlayerWall))
|
||||
{
|
||||
_privacyId = param2;
|
||||
}
|
||||
}
|
||||
|
||||
private static function playerWallBtnDownHandler(param1:MouseEvent) : void
|
||||
{
|
||||
_myPlayerWallClosedTimer.reset();
|
||||
_hudWallBtn.glow.visible = false;
|
||||
_glowTimer.reset();
|
||||
if(_myPlayerWall)
|
||||
{
|
||||
_myPlayerWall.destroy();
|
||||
_myPlayerWall = null;
|
||||
}
|
||||
_myPlayerWall = new PlayerWallGui();
|
||||
_myPlayerWall.init(_inbox,gMainFrame.server.userName,_statusText,_privacyId,_currentMessagePattern,_currentMessageColor,_currentMessageColor,_iconId,_iconId,onMyPlayerWallClose);
|
||||
_hudWallBtn.newPostCount.visible = false;
|
||||
_hudWallBtn.newPostCount.postCountTxt.text = "";
|
||||
_unreadCount = 0;
|
||||
}
|
||||
|
||||
private static function onMyPlayerWallClose() : void
|
||||
{
|
||||
_openWallUpdateTimer.reset();
|
||||
_myPlayerWallClosedTimer.start();
|
||||
_currentMessageColor = _myPlayerWall.myCurrMessageColor;
|
||||
_currentMessagePattern = _myPlayerWall.currMessagePattern;
|
||||
_myPlayerWall.destroy();
|
||||
_myPlayerWall = null;
|
||||
}
|
||||
|
||||
private static function onStrangerPlayerWallClose() : void
|
||||
{
|
||||
_openWallUpdateTimer.reset();
|
||||
_currentMessageColor = _strangersPlayerWall.myCurrMessageColor;
|
||||
_currentMessagePattern = _strangersPlayerWall.currMessagePattern;
|
||||
_strangersPlayerWall.destroy();
|
||||
_strangersPlayerWall = null;
|
||||
}
|
||||
|
||||
private static function glowTimerHandler(param1:TimerEvent) : void
|
||||
{
|
||||
_glowTimer.stop();
|
||||
_hudWallBtn.glow.visible = false;
|
||||
}
|
||||
|
||||
private static function onMessageUpdateTimer(param1:TimerEvent) : void
|
||||
{
|
||||
var _loc2_:Boolean = param1.currentTarget == _myPlayerWallClosedTimer;
|
||||
if(_loc2_)
|
||||
{
|
||||
_myPlayerWallClosedTimer.reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
_openWallUpdateTimer.reset();
|
||||
}
|
||||
if(_loc2_)
|
||||
{
|
||||
PlayerWallXtCommManager.sendPostGetRequest(gMainFrame.userInfo.myUserName,null,true);
|
||||
}
|
||||
else if(_strangersPlayerWall)
|
||||
{
|
||||
PlayerWallXtCommManager.sendPostGetRequest(_strangersPlayerWall.owner,null);
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerWallXtCommManager.sendPostGetRequest(gMainFrame.userInfo.myUserName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,495 @@
|
||||
package playerWall
|
||||
{
|
||||
import com.sbi.debug.DebugUtility;
|
||||
import com.sbi.popup.SBOkPopup;
|
||||
import flash.events.Event;
|
||||
import flash.events.IOErrorEvent;
|
||||
import flash.events.ProgressEvent;
|
||||
import flash.events.SecurityErrorEvent;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.net.Socket;
|
||||
import flash.utils.Timer;
|
||||
import gui.GuiManager;
|
||||
|
||||
public class PlayerWallXtCommManager
|
||||
{
|
||||
|
||||
private static var _deleteResponseCallback:Function;
|
||||
|
||||
private static var _getResponseCallback:Function;
|
||||
|
||||
private static var _addResponseCallback:Function;
|
||||
|
||||
private static var _setStatusResponseCallback:Function;
|
||||
|
||||
private static var _getStatusResponseCallback:Function;
|
||||
|
||||
private static var _socket:Socket;
|
||||
|
||||
private static var _stringToSend:String;
|
||||
|
||||
private static var _cmd:String;
|
||||
|
||||
private static var _currResponseFunction:Function;
|
||||
|
||||
private static var _numDataItemsToReceive:int;
|
||||
|
||||
private static var _numDataItemsReceived:int;
|
||||
|
||||
private static var _receivedData:String;
|
||||
|
||||
private static var _dataToProcess:Array;
|
||||
|
||||
private static var _setPrivacyResponseCallback:Function;
|
||||
|
||||
private static var _getPrivacyResponseCallback:Function;
|
||||
|
||||
private static var _isFromHudTimer:Boolean;
|
||||
|
||||
private static var _retryTimer:Timer;
|
||||
|
||||
private static var _waitingStringToSend:String;
|
||||
|
||||
private static var _waitingResponseCallback:Function;
|
||||
|
||||
private static var _waitingIsFromHudTimer:Boolean;
|
||||
|
||||
private static var _waitingRequestFunction:Function;
|
||||
|
||||
public function PlayerWallXtCommManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function init() : void
|
||||
{
|
||||
_socket = new Socket();
|
||||
_socket.addEventListener(Event.CONNECT,onConnected,false,0,true);
|
||||
_socket.addEventListener(IOErrorEvent.IO_ERROR,onIOError,false,0,true);
|
||||
_socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR,onSecurityError,false,0,true);
|
||||
_socket.addEventListener(ProgressEvent.SOCKET_DATA,onSocketData,false,0,true);
|
||||
_retryTimer = new Timer(50);
|
||||
_retryTimer.addEventListener(TimerEvent.TIMER,onRetryTimer,false,0,true);
|
||||
_numDataItemsToReceive = -1;
|
||||
_dataToProcess = [];
|
||||
}
|
||||
|
||||
public static function isSocketOpen() : Boolean
|
||||
{
|
||||
return _socket.connected;
|
||||
}
|
||||
|
||||
public static function sendPostDeleteRequest(param1:String, param2:Function = null) : void
|
||||
{
|
||||
if(canTryToConnect(sendPostDeleteRequest,param1,param2))
|
||||
{
|
||||
if(param2 != null)
|
||||
{
|
||||
_deleteResponseCallback = param2;
|
||||
}
|
||||
_currResponseFunction = deleteResponse;
|
||||
_cmd = "D";
|
||||
_stringToSend = param1;
|
||||
setupConnection();
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendPostGetRequest(param1:String, param2:Function = null, param3:Boolean = false) : void
|
||||
{
|
||||
if(canTryToConnect(sendPostGetRequest,param1,param2,param3))
|
||||
{
|
||||
if(param2 != null)
|
||||
{
|
||||
_getResponseCallback = param2;
|
||||
}
|
||||
_cmd = "G";
|
||||
_currResponseFunction = getResponse;
|
||||
_stringToSend = param1;
|
||||
_isFromHudTimer = param3;
|
||||
setupConnection();
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendPostAddRequest(param1:String, param2:Function = null) : void
|
||||
{
|
||||
if(canTryToConnect(sendPostAddRequest,param1,param2))
|
||||
{
|
||||
if(param2 != null)
|
||||
{
|
||||
_addResponseCallback = param2;
|
||||
}
|
||||
_cmd = "A";
|
||||
_currResponseFunction = addResponse;
|
||||
_stringToSend = param1;
|
||||
setupConnection();
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendStatusSetRequest(param1:String, param2:Function = null) : void
|
||||
{
|
||||
if(canTryToConnect(sendStatusSetRequest,param1,param2))
|
||||
{
|
||||
if(param2 != null)
|
||||
{
|
||||
_setStatusResponseCallback = param2;
|
||||
}
|
||||
_cmd = "SC";
|
||||
_currResponseFunction = setStatusResponse;
|
||||
_stringToSend = param1;
|
||||
setupConnection();
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendStatusGetRequest(param1:String, param2:Function = null) : void
|
||||
{
|
||||
if(canTryToConnect(sendStatusGetRequest,param1,param2))
|
||||
{
|
||||
if(param2 != null)
|
||||
{
|
||||
_getStatusResponseCallback = param2;
|
||||
}
|
||||
_cmd = "SG";
|
||||
_currResponseFunction = getStatusResponse;
|
||||
_stringToSend = param1;
|
||||
setupConnection();
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendPrivacyGetRequest(param1:String, param2:Function = null) : void
|
||||
{
|
||||
if(canTryToConnect(sendPrivacyGetRequest,param1,param2))
|
||||
{
|
||||
if(param2 != null)
|
||||
{
|
||||
_getPrivacyResponseCallback = param2;
|
||||
}
|
||||
_cmd = "OG";
|
||||
_currResponseFunction = getPrivacyResponse;
|
||||
_stringToSend = param1;
|
||||
setupConnection();
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendPrivacySetRequest(param1:String, param2:Function = null) : void
|
||||
{
|
||||
if(canTryToConnect(sendPrivacySetRequest,param1,param2))
|
||||
{
|
||||
if(param2 != null)
|
||||
{
|
||||
_setPrivacyResponseCallback = param2;
|
||||
}
|
||||
_cmd = "OC";
|
||||
_currResponseFunction = setPrivacyResponse;
|
||||
_stringToSend = param1;
|
||||
setupConnection();
|
||||
}
|
||||
}
|
||||
|
||||
private static function deleteResponse(param1:String) : void
|
||||
{
|
||||
var _loc3_:Array = null;
|
||||
var _loc2_:Boolean = param1 == "1" ? true : false;
|
||||
if(_deleteResponseCallback != null)
|
||||
{
|
||||
_loc3_ = _stringToSend.split("\n");
|
||||
_deleteResponseCallback(_loc3_[0],_loc3_[1],_loc2_);
|
||||
_deleteResponseCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function addResponse(param1:Array) : void
|
||||
{
|
||||
var _loc2_:Array = null;
|
||||
if(param1[1])
|
||||
{
|
||||
_loc2_ = param1[1].split("|");
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = [];
|
||||
}
|
||||
var _loc3_:Boolean = param1[0] == "1" ? true : false;
|
||||
var _loc4_:int = -1;
|
||||
if(!_loc3_)
|
||||
{
|
||||
if(_loc2_[0] != null)
|
||||
{
|
||||
_loc4_ = int(_loc2_[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc4_ = int(param1[0]);
|
||||
}
|
||||
}
|
||||
if(_addResponseCallback != null)
|
||||
{
|
||||
_addResponseCallback(_loc3_,_loc2_[1],Number(_loc2_[2]),_loc4_);
|
||||
_addResponseCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function getResponse(param1:Array) : void
|
||||
{
|
||||
var _loc3_:Array = null;
|
||||
var _loc4_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
var _loc2_:Array = [];
|
||||
var _loc6_:Boolean = param1[0] == "1" ? true : false;
|
||||
var _loc7_:int = 0;
|
||||
while(_loc7_ < param1.length)
|
||||
{
|
||||
_loc3_ = param1[_loc7_].split("|");
|
||||
if(Boolean(_loc3_) && _loc3_.length > 1)
|
||||
{
|
||||
_loc2_.push({
|
||||
"msgId":_loc3_[0],
|
||||
"message":_loc3_[3],
|
||||
"senderUserName":_loc3_[2],
|
||||
"iconId":1714,
|
||||
"patternId":int(_loc3_[4]),
|
||||
"color":_loc3_[5],
|
||||
"postTime":Number(_loc3_[1]),
|
||||
"isBuddy":false
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc5_++;
|
||||
}
|
||||
_loc7_++;
|
||||
}
|
||||
PlayerWallManager.onGetResponse(_loc6_,_loc2_,_isFromHudTimer);
|
||||
if(_getResponseCallback != null)
|
||||
{
|
||||
_getResponseCallback(_loc6_,_loc2_);
|
||||
_getResponseCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function setStatusResponse(param1:Array) : void
|
||||
{
|
||||
var _loc2_:Boolean = param1[0] == "1" ? true : false;
|
||||
var _loc3_:int = -1;
|
||||
var _loc4_:Array = _stringToSend.split("\n");
|
||||
if(!_loc2_)
|
||||
{
|
||||
_loc3_ = int(param1[0]);
|
||||
}
|
||||
PlayerWallManager.onStatusResponse(_loc2_,_loc4_[0],_loc4_[1]);
|
||||
if(_setStatusResponseCallback != null)
|
||||
{
|
||||
_setStatusResponseCallback(_loc2_,_loc3_);
|
||||
_setStatusResponseCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function getStatusResponse(param1:Array) : void
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
var _loc5_:String = null;
|
||||
var _loc2_:Boolean = param1[0] == "1" ? true : false;
|
||||
var _loc3_:String = "";
|
||||
if(param1[1] != null)
|
||||
{
|
||||
_loc3_ = param1[1];
|
||||
_loc4_ = 1714;
|
||||
_loc5_ = "green";
|
||||
}
|
||||
PlayerWallManager.onStatusResponse(_loc2_,_stringToSend,_loc3_);
|
||||
if(_getStatusResponseCallback != null)
|
||||
{
|
||||
_getStatusResponseCallback(_loc2_,_loc3_,_loc4_,_loc5_);
|
||||
_getStatusResponseCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function getPrivacyResponse(param1:Array) : void
|
||||
{
|
||||
var _loc2_:Boolean = param1[0] == "1" ? true : false;
|
||||
var _loc3_:int = 0;
|
||||
if(param1[1] != null)
|
||||
{
|
||||
_loc3_ = int(param1[1]);
|
||||
}
|
||||
PlayerWallManager.onPrivacyResponse(_loc2_,_loc3_);
|
||||
if(_getPrivacyResponseCallback != null)
|
||||
{
|
||||
_getPrivacyResponseCallback(_loc2_,_loc3_);
|
||||
_getPrivacyResponseCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function setPrivacyResponse(param1:Array) : void
|
||||
{
|
||||
var _loc2_:Boolean = param1[0] == "1" ? true : false;
|
||||
var _loc3_:int = int(_stringToSend.split("\n")[1]);
|
||||
PlayerWallManager.onPrivacyResponse(_loc2_,_loc3_);
|
||||
if(_setPrivacyResponseCallback != null)
|
||||
{
|
||||
_setPrivacyResponseCallback(_loc2_,_loc3_);
|
||||
_setPrivacyResponseCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function setupConnection() : void
|
||||
{
|
||||
if(_socket.connected)
|
||||
{
|
||||
new SBOkPopup(GuiManager.guiLayer,"Trying to setup a connection when one is already running. Should not be happening");
|
||||
}
|
||||
else
|
||||
{
|
||||
_socket.connect("playerwall.smartbombinteractive.com",6000);
|
||||
}
|
||||
}
|
||||
|
||||
private static function canTryToConnect(param1:Function, param2:String, param3:Function = null, param4:Boolean = false) : Boolean
|
||||
{
|
||||
if(_socket.connected)
|
||||
{
|
||||
if(_waitingRequestFunction == null)
|
||||
{
|
||||
_waitingRequestFunction = param1;
|
||||
_waitingStringToSend = param2;
|
||||
_waitingResponseCallback = param3;
|
||||
_waitingIsFromHudTimer = param4;
|
||||
_retryTimer.start();
|
||||
}
|
||||
else
|
||||
{
|
||||
new SBOkPopup(GuiManager.guiLayer,"We are setting up a retry but a current retry is already running");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static function onRetryTimer(param1:TimerEvent) : void
|
||||
{
|
||||
_retryTimer.reset();
|
||||
if(_socket.connected)
|
||||
{
|
||||
DebugUtility.debugTrace("Still retrying...",65280);
|
||||
_retryTimer.start();
|
||||
}
|
||||
else
|
||||
{
|
||||
_numDataItemsToReceive = -1;
|
||||
if(_waitingIsFromHudTimer)
|
||||
{
|
||||
_waitingRequestFunction(_waitingStringToSend,_waitingResponseCallback,_waitingIsFromHudTimer);
|
||||
}
|
||||
else
|
||||
{
|
||||
_waitingRequestFunction(_waitingStringToSend,_waitingResponseCallback);
|
||||
}
|
||||
_waitingRequestFunction = null;
|
||||
_waitingStringToSend = "";
|
||||
_waitingResponseCallback = null;
|
||||
_waitingIsFromHudTimer = false;
|
||||
}
|
||||
}
|
||||
|
||||
private static function onConnected(param1:Event) : void
|
||||
{
|
||||
}
|
||||
|
||||
private static function onSocketData(param1:ProgressEvent) : void
|
||||
{
|
||||
var _loc2_:Array = null;
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:String = null;
|
||||
var _loc5_:String = null;
|
||||
var _loc6_:int = 0;
|
||||
while(_socket.bytesAvailable > 0)
|
||||
{
|
||||
_loc4_ = _socket.readUTFBytes(_socket.bytesAvailable);
|
||||
_numDataItemsReceived += _loc4_.split("\n").length;
|
||||
if(_numDataItemsToReceive == -1)
|
||||
{
|
||||
_receivedData = _loc4_;
|
||||
}
|
||||
else
|
||||
{
|
||||
_receivedData += _loc4_;
|
||||
}
|
||||
}
|
||||
if(_numDataItemsToReceive == -1 || _numDataItemsReceived >= _numDataItemsToReceive)
|
||||
{
|
||||
_loc2_ = _receivedData.split("\r\n");
|
||||
_loc6_ = 0;
|
||||
while(_loc6_ < _loc2_.length)
|
||||
{
|
||||
_loc5_ = _loc2_[_loc6_];
|
||||
if(_loc5_ == "SID:")
|
||||
{
|
||||
_socket.writeUTFBytes("C:" + _cmd + "\n");
|
||||
DebugUtility.debugTrace("sending command: C:" + _cmd,65280);
|
||||
_socket.flush();
|
||||
}
|
||||
else if(_loc5_ == "*")
|
||||
{
|
||||
_socket.writeUTFBytes(_stringToSend + "\n");
|
||||
DebugUtility.debugTrace("sending string: " + _stringToSend,65280);
|
||||
_socket.flush();
|
||||
}
|
||||
else if(_loc5_.indexOf("Build") != -1)
|
||||
{
|
||||
if(gMainFrame.clientInfo.devMode)
|
||||
{
|
||||
_socket.writeUTFBytes("A:" + gMainFrame.userInfo.myUserName + "," + gMainFrame.userInfo.myUserName + "," + gMainFrame.server.serverIp + "\n");
|
||||
DebugUtility.debugTrace("sending command: A:" + gMainFrame.userInfo.myUserName + "," + gMainFrame.userInfo.myUserName + "," + gMainFrame.server.serverIp,65280);
|
||||
}
|
||||
else
|
||||
{
|
||||
_socket.writeUTFBytes("A:" + gMainFrame.clientInfo.authToken + "," + gMainFrame.userInfo.myUserName + "," + gMainFrame.server.serverIp + "\n");
|
||||
DebugUtility.debugTrace("sending command: A:" + gMainFrame.clientInfo.authToken + "," + gMainFrame.userInfo.myUserName + "," + gMainFrame.server.serverIp,65280);
|
||||
}
|
||||
_socket.flush();
|
||||
}
|
||||
else if(!(_loc5_ == "\r\n" || _loc5_ == ""))
|
||||
{
|
||||
if(!isNaN(Number(_loc5_)) && _numDataItemsToReceive == -1)
|
||||
{
|
||||
DebugUtility.debugTrace("number of items to receive = " + int(_loc5_),65280);
|
||||
_numDataItemsToReceive = int(_loc5_);
|
||||
if(_numDataItemsReceived < _numDataItemsToReceive)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(_loc5_ == "**done**")
|
||||
{
|
||||
DebugUtility.debugTrace("receiving **done**",65280);
|
||||
_socket.close();
|
||||
_numDataItemsToReceive = -1;
|
||||
_numDataItemsReceived = 0;
|
||||
_receivedData = "";
|
||||
_currResponseFunction(_dataToProcess);
|
||||
_dataToProcess = [];
|
||||
}
|
||||
else
|
||||
{
|
||||
_dataToProcess.push(_loc5_);
|
||||
DebugUtility.debugTrace("receiving data pieces: " + _loc5_,65280);
|
||||
}
|
||||
}
|
||||
_loc6_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function onIOError(param1:IOErrorEvent) : void
|
||||
{
|
||||
DebugUtility.debugTrace("IO error",65280);
|
||||
_socket.close();
|
||||
}
|
||||
|
||||
private static function onSecurityError(param1:SecurityErrorEvent) : void
|
||||
{
|
||||
DebugUtility.debugTrace("Security error",65280);
|
||||
_socket.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
package playerWall
|
||||
{
|
||||
public class PostMessage
|
||||
{
|
||||
|
||||
private var _message:String;
|
||||
|
||||
private var _senderUserName:String;
|
||||
|
||||
private var _patternId:int;
|
||||
|
||||
private var _color:String;
|
||||
|
||||
private var _msgId:String;
|
||||
|
||||
private var _postTime:Number;
|
||||
|
||||
private var _isBuddy:Boolean;
|
||||
|
||||
private var _iconId:int;
|
||||
|
||||
public function PostMessage(param1:String, param2:String, param3:String, param4:int, param5:int, param6:String, param7:Number, param8:Boolean)
|
||||
{
|
||||
super();
|
||||
this._msgId = param1;
|
||||
this._message = param2;
|
||||
this._senderUserName = param3;
|
||||
this._iconId = param4;
|
||||
this._patternId = param5;
|
||||
this._color = param6;
|
||||
this._postTime = param7;
|
||||
this._isBuddy = param8;
|
||||
}
|
||||
|
||||
public function get msgId() : String
|
||||
{
|
||||
return this._msgId;
|
||||
}
|
||||
|
||||
public function get message() : String
|
||||
{
|
||||
return this._message;
|
||||
}
|
||||
|
||||
public function get senderUserName() : String
|
||||
{
|
||||
return this._senderUserName;
|
||||
}
|
||||
|
||||
public function get iconId() : int
|
||||
{
|
||||
return this._iconId;
|
||||
}
|
||||
|
||||
public function get patternId() : int
|
||||
{
|
||||
return this._patternId;
|
||||
}
|
||||
|
||||
public function get color() : String
|
||||
{
|
||||
return this._color;
|
||||
}
|
||||
|
||||
public function get postTime() : Number
|
||||
{
|
||||
return this._postTime;
|
||||
}
|
||||
|
||||
public function get isBuddy() : Boolean
|
||||
{
|
||||
return this._isBuddy;
|
||||
}
|
||||
|
||||
public function set msgId(param1:String) : void
|
||||
{
|
||||
this._msgId = param1;
|
||||
}
|
||||
|
||||
public function set message(param1:String) : void
|
||||
{
|
||||
this._message = param1;
|
||||
}
|
||||
|
||||
public function set senderUserName(param1:String) : void
|
||||
{
|
||||
this._senderUserName = param1;
|
||||
}
|
||||
|
||||
public function set patternId(param1:int) : void
|
||||
{
|
||||
this._patternId = param1;
|
||||
}
|
||||
|
||||
public function set color(param1:String) : void
|
||||
{
|
||||
this._color = param1;
|
||||
}
|
||||
|
||||
public function set postTime(param1:Number) : void
|
||||
{
|
||||
this._postTime = param1;
|
||||
}
|
||||
|
||||
public function set isBuddy(param1:Boolean) : void
|
||||
{
|
||||
this._isBuddy = param1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user