コード例 #1
0
ファイル: SystemGlobal.cs プロジェクト: dongliang/Scut
        public static void Run()
        {
            AppstoreClientManager.Current.InitConfig();
            InitProtoBufType();
            var dispatch = TaskDispatch.StartTask();

            dispatch.Add(new FightCombatTask());
            //dispatch.Start(););)

            lock (thisLock)
            {
                _isRunning = false;
            }
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            RegisterCacheSet();
            ConfigCacheGlobal.Load();
            LoadGlobalData();
            LoadUser();

            GameUser.Callback = new AsyncDataChangeCallback(UserHelper.TriggerUserCallback);
            //UserGeneral.EscalateHandle += UserHelper.TriggerGeneral;
            new GameActiveCenter(null);
            new GuildGameActiveCenter(null);

            InitRanking();
            stopwatch.Stop();
            new BaseLog().SaveLog("系统全局运行环境加载所需时间:" + stopwatch.Elapsed.TotalMilliseconds + "ms");

            lock (thisLock)
            {
                _isRunning = true;
            }
        }
コード例 #2
0
        public override void Process(JsonParameter[] paramList)
        {
            JsonParameterList parameters = JsonParameter.Convert(paramList);

            if (parameters["op"].Length > 0)
            {
                string userID = parameters["UserId"];
                if (!string.IsNullOrEmpty(userID) && userID.ToUpper().StartsWith("Z"))
                {
                    string          pid  = userID;
                    List <GameUser> list = new List <GameUser>();
                    new GameDataCacheSet <GameUser>().Foreach((personalId, key, user) =>
                    {
                        if (user.Pid.ToUpper() == pid.ToUpper())
                        {
                            list.Add(user);
                        }
                        return(true);
                    });
                    if (list.Count > 0)
                    {
                        userID = list[0].UserID;
                    }
                }
                if (!string.IsNullOrEmpty(userID) && parameters["op"].Equals("1"))
                {
                    UserCacheGlobal.ReLoad(userID);
                }
                else
                {
                    var cacheSet = new ConfigCacheSet <CareerInfo>();
                    if (parameters["op"].Equals("0"))
                    {
                        ConfigCacheGlobal.Load();
                        UserCacheGlobal.ReLoad(string.Empty);
                        SystemGlobal.LoadGlobalData();
                        GameConfigSet.Initialize();
                    }
                    else if (parameters["op"].Equals("2"))
                    {
                        //刷新data配置表
                        SystemGlobal.LoadGlobalData();
                        GameConfigSet.Initialize();
                    }
                    else if (parameters["op"].Equals("3"))
                    {
                        //刷新config配置表
                        ConfigCacheGlobal.Load();
                        GameConfigSet.Initialize();
                    }
                }
            }
        }
コード例 #3
0
ファイル: CacheCommand.cs プロジェクト: dongliang/Scut
        protected override void ProcessCmd(string[] args)
        {
            string childType = args.Length > 0 ? args[0].Trim() : string.Empty;

            if (childType.Equals("all"))
            {
                ConfigCacheGlobal.Load();
                ClearUser(string.Empty);
            }
            else if (string.IsNullOrEmpty(childType) || childType.Equals("self"))
            {
                //清自己
                ClearUser(UserID);
            }
            else if (childType.ToUpper().StartsWith("Z"))
            {
                string userId = "";
                string pid    = childType;
                new GameDataCacheSet <GameUser>().Foreach((personalId, key, value) =>
                {
                    if (value != null && value.Pid.Equals(pid))
                    {
                        userId = value.UserID;
                        return(false);
                    }
                    return(true);
                });
                if (!string.IsNullOrEmpty(userId))
                {
                    ClearUser(userId);
                }
            }
            else
            {
                throw new Exception(string.Format(CmdError, childType));
            }
        }