コード例 #1
0
ファイル: AllyClient.cs プロジェクト: chenchungit/ky
        public void TimerProc(object sender, EventArgs e)
        {
            try
            {
                string uri = _CoreInterface.GetRuntimeVariable(RuntimeVariableNames.AllyUri, null);
                if (_RemoteServiceUri != uri)
                {
                    _RemoteServiceUri = uri;
                }

                IAllyService kuaFuService = GetKuaFuService();
                if (null != kuaFuService)
                {
                    if (_ClientInfo.ClientId > 0)
                    {
                        //同步数据
                        AsyncDataItem[] items = kuaFuService.GetClientCacheItems(_ClientInfo.ServerId);
                        if (null != items && items.Length > 0)
                        {
                            ExecuteEventCallBackAsync(items);
                        }
                    }
                }

                DateTime now = DateTime.Now;
                if (now > _versionTime)
                {
                    _versionTime = now.AddSeconds(ALLY_VERSION_SPAN_SECOND);
                    if (!VersionIsEqual())
                    {
                        _unionDic.Clear();
                        _allyDic.Clear();
                        _requestDic.Clear();
                        _acceptDic.Clear();

                        _CoreInterface.GetEventSourceInterface().fireEvent(new KFNotifyAllyStartGameEvent(), (int)_sceneType);
                    }
                }
            }
            catch (System.Exception ex)
            {
                ResetKuaFuService();
            }
        }
コード例 #2
0
ファイル: AllyClient.cs プロジェクト: songxiaopeng/mu_server
 public void TimerProc(object sender, EventArgs e)
 {
     try
     {
         string uri = this._CoreInterface.GetRuntimeVariable("AllyUri", null);
         if (this._RemoteServiceUri != uri)
         {
             this._RemoteServiceUri = uri;
         }
         IAllyService kuaFuService = this.GetKuaFuService(false);
         if (null != kuaFuService)
         {
             if (this._ClientInfo.ClientId > 0)
             {
                 AsyncDataItem[] items = kuaFuService.GetClientCacheItems(this._ClientInfo.ServerId);
                 if (items != null && items.Length > 0)
                 {
                     this.ExecuteEventCallBackAsync(items);
                 }
             }
         }
         DateTime now = TimeUtil.NowDateTime();
         if (now > this._versionTime)
         {
             this._versionTime = now.AddSeconds(30.0);
             if (!this.VersionIsEqual())
             {
                 this._unionDic.Clear();
                 this._allyDic.Clear();
                 this._requestDic.Clear();
                 this._acceptDic.Clear();
                 this._CoreInterface.GetEventSourceInterface().fireEvent(new KFNotifyAllyStartGameEvent(), 10004);
             }
         }
     }
     catch (Exception ex)
     {
         this.ResetKuaFuService();
     }
 }