Пример #1
0
        public void AddCronRefreshExcuter(string name, IDictionary rule)
        {
            CronRefreshExcuter excuter = new CronRefreshExcuter(name);

            excuter.Init(rule);
            AddCronRefreshExcuter(excuter);
        }
Пример #2
0
        public void AddCronRefreshExcuter(CronRefreshExcuter excuter)
        {
            for (int i = 0; i < m_schedulers.Count; i++)
            {
                if (m_schedulers[i].Name == excuter.Name)
                {
                    EB.Debug.LogError("CronReFreshExcuter Multiple for Name = {0}", excuter.Name);
                    return;
                }
            }

            m_schedulers.Add(excuter);
        }
Пример #3
0
        public override void Awake()
        {
            base.Awake();

            var t = mDMono.transform;

            _controllerILR = t.GetComponentInParent <UIControllerILR>();
            Transform store_root = _controllerILR.transform;

            m_Scroll         = store_root.GetMonoILRComponent <UIStoreGridScroll>("Store/NewBlacksmithView/BlacksmithViews/Shared/SlotsContainer/Placeholder/Grid");
            m_GetDataRequest = t.GetComponent <UIServerRequest>("Extra/Get");
            m_RefreshRequest = t.GetComponent <UIServerRequest>("Extra/Refresh");
            m_BuyRequest     = store_root.GetComponent <UIServerRequest>("Store/NewBlacksmithView/BlacksmithViews/Shared/Extra/Buy");

            RefreshBtnRoot          = store_root.GetComponent <UIButton>("Store/BGs/Bottom/Button", false);
            RefreshCostLabel        = store_root.GetComponent <UILabel>("Store/BGs/Bottom/Button/Cost/Diamand/Label", false);
            m_RefreshTimeLabel      = store_root.GetComponent <UILabel>("Store/BGs/Bottom/RefreshTime", false);
            RefreshCostSprite       = store_root.GetComponent <UISprite>("Store/BGs/Bottom/Button/Cost/Diamand/Sprite", false);
            NewCurrencyCommonLabel  = store_root.GetComponent <UILabel>("UINormalFrameBG/NewCurrency/Table/1_Common/Label");
            NewCurrencyCommonSprite = store_root.GetComponent <UISprite>("UINormalFrameBG/NewCurrency/Table/1_Common/Icon");
            RefreshFxObj            = store_root.FindEx("Store/NewBlacksmithView/BlacksmithViews/Shared/Fx").gameObject;

            UIServerRequestHotFix mysGetRequest = t.GetMonoILRComponent <UIServerRequestHotFix>("Extra/Get");

            mysGetRequest.response = OnRequestStoreData;
            t.GetComponent <UIServerRequest>("Extra/Get").onResponse.Add(new EventDelegate(mysGetRequest.mDMono, "OnFetchData"));

            UIServerRequestHotFix mysRefreshRequest = t.GetMonoILRComponent <UIServerRequestHotFix>("Extra/Refresh");

            mysRefreshRequest.response = OnRefresh;
            t.GetComponent <UIServerRequest>("Extra/Refresh").onResponse.Add(new EventDelegate(mysRefreshRequest.mDMono, "OnFetchData"));

            UIServerRequestHotFix buyRequest = t.parent.GetMonoILRComponent <UIServerRequestHotFix>("Shared/Extra/Buy");

            if (buyRequest.response == null)
            {
                buyRequest.response = OnBuy;
                t.parent.GetComponent <UIServerRequest>("Shared/Extra/Buy").onResponse.Add(new EventDelegate(buyRequest.mDMono, "OnFetchData"));
            }

            m_DataID    = mDMono.StringParamList[0];
            m_StoreType = mDMono.StringParamList[1];
            m_StoreName = mDMono.StringParamList[2];
            m_StoreId   = mDMono.IntParamList[0];
            m_Columns   = mDMono.IntParamList[1];

            CronRefreshExcuter re = CreateShopRefresher();

            AutoRefreshingManager.Instance.AddCronRefreshExcuter(re);
        }
Пример #4
0
        void AddUserPrizeDataRefreshExcuter()
        {
            string taskRefreshTime = "0 0 0 * * *";
            //DataLookupsCache.Instance.SearchDataByID<string>("userTaskStatus.refreshTaskTime", out taskRefreshTime);
            Hashtable rule = Johny.HashtablePool.Claim();

            rule.Add("regular", TimerScheduler.AmendCronFormat(taskRefreshTime));
            rule.Add("url", "/sign_in/getUserPrizeData");
            CronRefreshExcuter excuter = new CronRefreshExcuter("refreshUserPrizeData", false);

            excuter.Init(rule, delegate(Hashtable hash) {
                if (hash != null)
                {
                    DataLookupsCache.Instance.CacheData(hash);
                    GameDataSparxManager.Instance.ProcessIncomingData(hash, false);
                }
            });
            AddCronRefreshExcuter(excuter);
        }
Пример #5
0
        void AddTaskRefreshExcuter()
        {
            string taskRefreshTime;

            DataLookupsCache.Instance.SearchDataByID <string>("userTaskStatus.refreshTaskTime", out taskRefreshTime);
            Hashtable rule = Johny.HashtablePool.Claim();

            rule.Add("regular", TimerScheduler.AmendCronFormat(taskRefreshTime));
            rule.Add("url", "/mhjtasks/refreshTaskState");
            CronRefreshExcuter excuter = new CronRefreshExcuter("refreshTaskState");

            excuter.Init(rule, delegate(Hashtable hash) {
                string npcLocator;
                DataLookupsCache.Instance.SearchDataByID <string>(string.Format("tasks.{0}.event_count.locator", LTBountyTaskHudController.TaskID()), out npcLocator);
                LTBountyTaskHudController.DeleteMonster(npcLocator);
                DataLookupsCache.Instance.CacheData("user_prize_data.taskliveness_reward", string.Empty);      //重置任务完成情况
                DataLookupsCache.Instance.CacheData("user_prize_data.taskliveness.curr", 0);
                DataLookupsCache.Instance.CacheData("user_prize_data.taskliveness_week_reward", string.Empty); //重置任务完成情况
                DataLookupsCache.Instance.CacheData("user_prize_data.taskweekliveness.curr", 0);
                DataLookupsCache.Instance.CacheData("task_refresh", 1);
            });
            AddCronRefreshExcuter(excuter);
        }
Пример #6
0
        CronRefreshExcuter CreateShopRefresher()
        {
            var    tpl  = Hotfix_LT.Data.ShopTemplateManager.Instance.GetShop(m_StoreId);
            string time = "";
            int    i    = 0;

            if (tpl.refresh_time_1 != -1)
            {
                time = time + tpl.refresh_time_1;
                i    = 1;
            }
            if (tpl.refresh_time_2 != -1)
            {
                if (i == 0)
                {
                    time = time + tpl.refresh_time_2;
                    i    = 1;
                }
                else
                {
                    time = time + "," + tpl.refresh_time_2;
                }
            }

            if (tpl.refresh_time_3 != -1)
            {
                if (i == 0)
                {
                    time = time + tpl.refresh_time_3;
                    i    = 1;
                }
                else
                {
                    time = time + "," + tpl.refresh_time_3;
                }
            }

            if (tpl.refresh_time_4 != -1)
            {
                if (i == 0)
                {
                    time = time + tpl.refresh_time_4;
                    i    = 1;
                }
                else
                {
                    time = time + "," + tpl.refresh_time_4;
                }
            }
            time = string.Format("0 {0} * * *", time);
            CronRefreshExcuter re   = new CronRefreshExcuter(m_DataID);
            Hashtable          data = Johny.HashtablePool.Claim();

            data.Add("regular", time);
            data.Add("url", "/shops/getShopInfo");
            data.Add("time_path", "");
            data.Add("level", 0);
            var ht = Johny.HashtablePool.Claim();

            ht.Add("shopType", tpl.shop_type);
            data.Add("parameters", ht);
            re.Init(data);
            return(re);
        }
Пример #7
0
 public void AddCronRefreshExcuter(CronRefreshExcuter excuter)
 {
     m_cronRefreshManager.AddCronRefreshExcuter(excuter);
 }