コード例 #1
0
 private void ValidatePublicMessage(AiWan sfs, List <string> errors)
 {
     if (this.message == null || this.message.Length == 0)
     {
         errors.Add("Public message is empty!");
     }
 }
コード例 #2
0
 private void ValidateObjectMessage(AiWan sfs, List <string> errors)
 {
     if (this.parameters == null)
     {
         errors.Add("Object message is null!");
     }
 }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
    //----------------------------------------------------------
    // 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");
    }
コード例 #5
0
 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);
 }
コード例 #6
0
 public BaseController(BitSwarmClient bitSwarm)
 {
     this.bitSwarm = bitSwarm;
     if (bitSwarm != null)
     {
         this.log = bitSwarm.Log;
         this.sfs = bitSwarm.Sfs;
     }
 }
コード例 #7
0
 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);
     }
 }
コード例 #8
0
 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);
     }
 }
コード例 #9
0
 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);
 }
コード例 #10
0
 public void Destroy()
 {
     this.Stop();
     this.pollTimer.Dispose();
     this.sfs = null;
 }
コード例 #11
0
        public override void Execute(AiWan sfs)
        {
            this.sfso.PutByte(GenericMessageRequest.KEY_MESSAGE_TYPE, Convert.ToByte(this.type));

            this.ExecuteSuperUserMessage(sfs);
        }
コード例 #12
0
 public BitSwarmClient(AiWan sfs)
 {
     this.sfs      = sfs;
     this.log      = sfs.Log;
     this.debugSfs = sfs;
 }
コード例 #13
0
 public BitSwarmClient()
 {
     this.sfs = null;
     this.log = null;
 }
コード例 #14
0
 public LagMonitor(AiWan sfs, int interval) : this(sfs, interval, 10)
 {
 }
コード例 #15
0
 public LagMonitor(AiWan sfs) : this(sfs, 4, 10)
 {
 }
コード例 #16
0
ファイル: ConfigLoader.cs プロジェクト: zgq974751608/OurGame
 public ConfigLoader(AiWan AiWanNet)
 {
     this.AiWanNet   = AiWanNet;
     this.dispatcher = new EventDispatcher(this);
 }
コード例 #17
0
 public override void Validate(AiWan sfs)
 {
 }
コード例 #18
0
 public override void Execute(AiWan sfs)
 {
 }
コード例 #19
0
ファイル: BaseRequest.cs プロジェクト: zgq974751608/OurGame
 public virtual void Validate(AiWan sfs)
 {
 }
コード例 #20
0
ファイル: BaseRequest.cs プロジェクト: zgq974751608/OurGame
 public virtual void Execute(AiWan sfs)
 {
 }
コード例 #21
0
 public Logger(AiWan AiWanNet)
 {
     this.AiWanNet     = AiWanNet;
     this.loggingLevel = LogLevel.INFO;
 }
コード例 #22
0
 public void SendProtoBufMsg(ProtoBuf.IExtensible msg, AiWan fox)
 {
     fox.SendProtobufMsg(msg);
 }