예제 #1
0
        public void TimerProc(object sender, EventArgs e)
        {
            try
            {
                string uri = _CoreInterface.GetRuntimeVariable(RuntimeVariableNames.SpreadUri, null);
                if (_RemoteServiceUri != uri)
                {
                    _RemoteServiceUri = uri;
                }

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

                CheckSpreadData();
            }
            catch (System.Exception ex)
            {
                ResetKuaFuService();
            }
        }
예제 #2
0
        public void TimerProc(object sender, EventArgs e)
        {
            try
            {
                DateTime now = TimeUtil.NowDateTime();
                if (NextClearFuBenTime < now)
                {
                    NextClearFuBenTime = now.AddHours(1);
                    ClearOverTimeFuBen(now);
                }

                string YongZheZhanChangUri = CoreInterface.GetRuntimeVariable(RuntimeVariableNames.YongZheZhanChangUri, null);
                if (RemoteServiceUri != YongZheZhanChangUri)
                {
                    RemoteServiceUri = YongZheZhanChangUri;
                }

                IYongZheZhanChangService kuaFuService = GetKuaFuService();
                if (null != kuaFuService)
                {
                    if (ClientInfo.ClientId > 0)
                    {
                        List <KuaFuServerInfo> dict = kuaFuService.GetKuaFuServerInfoData(ServerInfoAsyncAge);
                        if (null != dict && dict.Count > 0)
                        {
                            lock (Mutex)
                            {
                                ServerIdServerInfoDict.Clear();
                                bool first = true;
                                foreach (var item in dict)
                                {
                                    ServerIdServerInfoDict[item.ServerId] = item;
                                    if (first)
                                    {
                                        first = false;
                                        ServerInfoAsyncAge = item.Age;
                                    }
                                    if (ClientInfo.ServerId == item.ServerId)
                                    {
                                        LocalServerFlags = item.Flags;
                                    }
                                }
                            }
                        }

                        //同步数据
                        AsyncDataItem[] items = kuaFuService.GetClientCacheItems(ClientInfo.ServerId);
                        if (null != items && items.Length > 0)
                        {
                            //ThreadPool.QueueUserWorkItem(new WaitCallback(ExecuteEventCallBackAsync), items);
                            ExecuteEventCallBackAsync(items);
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                ResetKuaFuService();
            }
        }
예제 #3
0
        public void TimerProc(object sender, EventArgs e)
        {
            try
            {
                string moRiJudgeUri = CoreInterface.GetRuntimeVariable(RuntimeVariableNames.KuaFuCopyUri, null);
                if (RemoteServiceUri != moRiJudgeUri)
                {
                    RemoteServiceUri = moRiJudgeUri;
                }

                IKuaFuCopyService kuaFuService = GetKuaFuService();
                if (null != kuaFuService)
                {
                    if (ClientInfo.ClientId > 0)
                    {
                        List <KuaFuServerInfo> dict = kuaFuService.GetKuaFuServerInfoData(ServerInfoAsyncAge);
                        if (null != dict && dict.Count > 0)
                        {
                            lock (Mutex)
                            {
                                ServerIdServerInfoDict.Clear();
                                bool first = true;
                                foreach (var item in dict)
                                {
                                    ServerIdServerInfoDict[item.ServerId] = item;
                                    if (first)
                                    {
                                        first = false;
                                        ServerInfoAsyncAge = item.Age;
                                    }
                                    if (ClientInfo.ServerId == item.ServerId)
                                    {
                                        LocalServerFlags = item.Flags;
                                    }
                                }
                            }
                        }

                        //同步数据
                        AsyncDataItem[] items = kuaFuService.GetClientCacheItems(ClientInfo.ServerId);
                        if (null != items && items.Length > 0)
                        {
                            foreach (var item in items)
                            {
                                EventCallBackHandler((int)item.EventType, item.Args);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Error, "KFCopyRpcClient.TimerProc调度异常", ex);
                ResetKuaFuService();
            }
        }
예제 #4
0
        public void TimerProc(object sender, EventArgs e)
        {
            try
            {
                string huanYingSiYuanUri = CoreInterface.GetRuntimeVariable(RuntimeVariableNames.HuanYingSiYuanUri, null);
                if (RemoteServiceUri != huanYingSiYuanUri)
                {
                    RemoteServiceUri = huanYingSiYuanUri;
                }

                IKuaFuService kuaFuService = GetKuaFuService();
                if (null != kuaFuService)
                {
                    if (ClientInfo.ClientId > 0)
                    {
                        List <KuaFuServerInfo> dict = kuaFuService.GetKuaFuServerInfoData(ServerInfoAsyncAge);
                        if (null != dict && dict.Count > 0)
                        {
                            lock (Mutex)
                            {
                                ServerIdServerInfoDict.Clear();
                                bool first = true;
                                foreach (var item in dict)
                                {
                                    ServerIdServerInfoDict[item.ServerId] = item;
                                    if (first)
                                    {
                                        first = false;
                                        ServerInfoAsyncAge = item.Age;
                                    }
                                    if (ClientInfo.ServerId == item.ServerId)
                                    {
                                        LocalServerFlags = item.Flags;
                                    }
                                }
                            }
                        }

                        //同步数据
                        AsyncDataItem[] items = kuaFuService.GetClientCacheItems(ClientInfo.ServerId);
                        if (null != items && items.Length > 0)
                        {
                            //ThreadPool.QueueUserWorkItem(new WaitCallback(ExecuteEventCallBackAsync), items);
                            ExecuteEventCallBackAsync(items);
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                ResetKuaFuService();
            }
        }
예제 #5
0
        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();
            }
        }