private void ValidatePublicMessage(AiWan sfs, List <string> errors) { if (this.message == null || this.message.Length == 0) { errors.Add("Public message is empty!"); } }
private void ValidateObjectMessage(AiWan sfs, List <string> errors) { if (this.parameters == null) { errors.Add("Object message is null!"); } }
public override void Validate(AiWan sfs) { if (this.type < 0) { throw new AWValidationError("PublicMessage request error", new string[] { "Unsupported message type: " + this.type }); } List <string> list = new List <string>(); switch (this.type) { case 0: this.ValidatePublicMessage(sfs, list); goto IL_A9; case 1: this.ValidatePrivateMessage(sfs, list); goto IL_A9; case 4: this.ValidateObjectMessage(sfs, list); goto IL_A9; } IL_A9: if (list.Count > 0) { throw new AWValidationError("Request error - ", list); } }
//---------------------------------------------------------- // Called when program starts //---------------------------------------------------------- void Start() { instance = this; DontDestroyOnLoad(this); // awnet = new AiWan(true); awnetgate = new AiWan(true); Debug.LogWarning("API Version: " + awnet.Version); // Register callback delegate awnet.AddEventListener(AWEvent.CONNECTION, OnConnectionLoginServer); awnet.AddEventListener(AWEvent.CONNECTION_LOST, OnConnectionLost); awnet.AddEventListener(AWEvent.LOGIN, OnLoginLoginServer); awnet.AddEventListener(AWEvent.LOGIN_ERROR, OnLoginError); awnet.AddLogListener(logLevel, OnDebugMessage); awnetgate.AddEventListener(AWEvent.CONNECTION, OnConnectionGateServer); awnetgate.AddEventListener(AWEvent.RESPONSE_MAILCONTENT, OnS2C_ResponseMailContent); awnetgate.AddEventListener(AWEvent.RESPONSE_PROOFTIME, OnS2C_ResponseProofTime); awnetgate.AddEventListener(AWEvent.S2C_INITCHAR, OnS2C_InitChar); AWConnection.awnetgate.AddEventListener(AWEvent.S2C_FIGHTBEGIN, OnS2C_ResponseFightBegin); Application.LoadLevelAsync("Login"); }
private void ExecuteSuperUserMessage(AiWan sfs) { this.sfso.PutUtfString(GenericMessageRequest.KEY_MESSAGE, this.message); if (this.parameters != null) { this.sfso.PutSFSObject(GenericMessageRequest.KEY_XTRA_PARAMS, this.parameters); } this.sfso.PutInt(GenericMessageRequest.KEY_RECIPIENT_MODE, this.sendMode); }
public BaseController(BitSwarmClient bitSwarm) { this.bitSwarm = bitSwarm; if (bitSwarm != null) { this.log = bitSwarm.Log; this.sfs = bitSwarm.Sfs; } }
private void ExecutePrivateMessage(AiWan sfs) { this.sfso.PutInt(GenericMessageRequest.KEY_RECIPIENT, (int)this.recipient); this.sfso.PutUtfString(GenericMessageRequest.KEY_MESSAGE, this.message); if (this.parameters != null) { this.sfso.PutSFSObject(GenericMessageRequest.KEY_XTRA_PARAMS, this.parameters); } }
private void ValidatePrivateMessage(AiWan sfs, List <string> errors) { if (this.message == null || this.message.Length == 0) { errors.Add("Private message is empty!"); } if ((int)this.recipient < 0) { errors.Add("Invalid recipient id: " + this.recipient); } }
public LagMonitor(AiWan sfs, int interval, int queueSize) { if (interval < 1) { interval = 1; } this.sfs = sfs; this.valueQueue = new List <int>(); this.interval = interval; this.queueSize = queueSize; this.pollTimer = new Timer(); this.pollTimer.Enabled = false; this.pollTimer.AutoReset = true; this.pollTimer.Elapsed += new ElapsedEventHandler(this.OnPollEvent); this.pollTimer.Interval = (double)(interval * 1000); }
public void Destroy() { this.Stop(); this.pollTimer.Dispose(); this.sfs = null; }
public override void Execute(AiWan sfs) { this.sfso.PutByte(GenericMessageRequest.KEY_MESSAGE_TYPE, Convert.ToByte(this.type)); this.ExecuteSuperUserMessage(sfs); }
public BitSwarmClient(AiWan sfs) { this.sfs = sfs; this.log = sfs.Log; this.debugSfs = sfs; }
public BitSwarmClient() { this.sfs = null; this.log = null; }
public LagMonitor(AiWan sfs, int interval) : this(sfs, interval, 10) { }
public LagMonitor(AiWan sfs) : this(sfs, 4, 10) { }
public ConfigLoader(AiWan AiWanNet) { this.AiWanNet = AiWanNet; this.dispatcher = new EventDispatcher(this); }
public override void Validate(AiWan sfs) { }
public override void Execute(AiWan sfs) { }
public virtual void Validate(AiWan sfs) { }
public virtual void Execute(AiWan sfs) { }
public Logger(AiWan AiWanNet) { this.AiWanNet = AiWanNet; this.loggingLevel = LogLevel.INFO; }
public void SendProtoBufMsg(ProtoBuf.IExtensible msg, AiWan fox) { fox.SendProtobufMsg(msg); }