Esempio n. 1
0
 public LoadProgressArguments(int number, UpdateStage stage, UpdateOperation operation, params object[] args)
 {
     Number    = number;
     Stage     = stage;
     Operation = operation;
     Argumens  = args;
 }
Esempio n. 2
0
 public UpdateRefreshEventArgs(UpdateStage stage, bool result, IEnumerable <StorePackageUpdate> updates = null)
 {
     UpdateStage = stage;
     Success     = result;
     Updates     = updates;
     UtcTime     = DateTime.UtcNow;
 }
Esempio n. 3
0
        public void RunFrame()
        {
            // This implementation gets a bit weird to avoid any use of Linq,
            // foreach or other enumerator code that would cause repeated
            // allocation/deallocation of managed memory and thus excessive
            // garbage collections.
            // registeredStages is used to hold a sorted duplicate of
            // registeredComponents.Keys for the same reason.

            long timestamp = Stopwatch.GetTimestamp();

            this.DeltaT        = (float)((timestamp - this.lastTimestamp) / (double)Stopwatch.Frequency);
            this.lastTimestamp = timestamp;

            for (int stageIndex = 0; stageIndex < this.registeredStages.Count; stageIndex++)
            {
                UpdateStage stage = this.registeredStages[stageIndex];

                for (int componentIndex = 0; componentIndex < this.registeredComponents[stage].Count; componentIndex++)
                {
                    this.registeredComponents[stage][componentIndex].Update();
                }

                for (int componentIndex = 0; componentIndex < this.componentsToDeregister.Count; componentIndex++)
                {
                    for (int removeStageIndex = 0; removeStageIndex < this.registeredStages.Count; removeStageIndex++)
                    {
                        UpdateStage removeStage = this.registeredStages[removeStageIndex];

                        this.registeredComponents[removeStage].Remove(this.componentsToDeregister[componentIndex]);
                    }
                }
            }
        }
Esempio n. 4
0
        // MARK: Internal methods

        private void sendMessageForStage(UpdateStage stage)
        {
            System.DateTime          startTime = System.DateTime.Now;
            Queue <Message.IMessage> queue     = this.messageQueues[stage];
            int count = 0;

            System.Func <bool> isWithinLimits = () => {
                float?timeLimit  = this.timeLimits.TryGetValue(stage);
                uint? countLimit = this.countLimits.TryGetValue(stage);
                if (timeLimit.HasValue && (System.DateTime.Now - startTime).TotalMilliseconds > timeLimit.Value)
                {
                    return(false);
                }
                if (countLimit.HasValue && count >= countLimit.Value)
                {
                    return(false);
                }
                return(queue.Count > 0);
            };
            while (isWithinLimits())
            {
                Messaging.Bus.main._sendMessageToHandlers(queue.Dequeue());
                count++;
            }
        }
Esempio n. 5
0
    // Use this for initialization
    new void Start()
    {
        base.Start();

        stageUpdater = GameObject.Find("SceneUpdater").GetComponent <UpdateStage>();
        audioSource  = GetComponent <AudioSource>();
    }
Esempio n. 6
0
 /// <summary>
 /// Constructor for UpdateProgressEventArgs
 /// </summary>
 /// <param name="currentUpdateStage">The current state of the updating progress</param>
 /// <param name="currentUpdateDescription">Description of the current update stage</param>
 /// <param name="currentStageProgress">Progress of the current stage</param>
 /// <param name="overallProgress">Overall progress of the update</param>
 public UpdateProgressEventArgs(UpdateStage currentUpdateStage, String currentUpdateDescription,
                                int currentStageProgress, int overallProgress)
 {
   CurrentUpdateStage = currentUpdateStage;
   CurrentUpdateDescription = currentUpdateDescription;
   CurrentStageProgress = currentStageProgress;
   OverallProgress = overallProgress;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="files"></param>
 public DownloadForm(List <PatchFile> files, LanguageHandler languageHandler, JsonFileProgress jsonFileProgress)
 {
     this.languageHandler  = languageHandler;
     this.files            = files;
     this.jsonFileProgress = jsonFileProgress;
     updateStage           = UpdateStage.None;
     InitializeComponent();
     CenterToScreen();
 }
Esempio n. 8
0
        /// <summary>
        /// 开启热更新
        /// </summary>
        /// <param name="httpServerIP"></param>
        public void StartUpdate(string httpServerIP, ProcessCompleteEvent allDoneEv)
        {
            Debug.Log("start update resource from " + httpServerIP);

            mHttpAddress  = "http://" + httpServerIP + "/" + ResUtils.BundleRootDirName + '/';
            mAllDoneEvent = allDoneEv;
            mStage        = UpdateStage.CheckDownloadIndex;

            StartCoroutine(AsyncCheckDownloadingList(OnCompleteCheckDownloadList));
        }
Esempio n. 9
0
    // Use this for initialization
    //---------------------------------------------------------------

    /*
     *  @breif      初期化処理
     */
    //---------------------------------------------------------------
    void Start()
    {
        updater = GameSceneManager.Instance.GetSceneUpdater() as UpdateStage;

        // RigidBodyの取得
        rb = GetComponent <Rigidbody>();
        rb.freezeRotation = true;
        rb.useGravity     = true;
        rb.isKinematic    = false;

        m_camera = null;

        if (updater)
        {
            m_camera = updater.CameraMngr.GetCurrentCameraComponent();
        }

        m_VRCameraRoot = GameObject.Find("VRCameraRoot");
        yaw            = 0.0f;

        m_gravity = BASE_GRAVITY;

        m_vectorToMove = Vector3.zero;

        m_StartPos = transform.position;
        m_StartRot = transform.rotation;

        bBlowOff = false;

        audioSource = GetComponent <AudioSource>();

        GameObject rocket = (GameObject)Instantiate(Resources.Load(GameResourcePath.GetRocketPath()), transform.position, transform.rotation);

        EquipItem(rocket);

        GameObject weight = (GameObject)Instantiate(Resources.Load(GameResourcePath.GetWeightPath()), transform.position, transform.rotation);

        EquipItem(weight);

        elapsedTime = 0;

        rocketRot = 180.0f;

        m_bCorrectX = false;
        m_diffX     = 0.0f;

        m_bGoal     = false;
        m_bGameOver = false;

        SetMoveMode(ACTION_MODE.ACT_MODE_BLOWOFF);
    }
Esempio n. 10
0
        public void Register(IUpdatable updatableComponent, UpdateStage stage)
        {
            if (stage == UpdateStage.None)
            {
                throw new ArgumentOutOfRangeException(nameof(stage));
            }

            if (!this.registeredComponents.TryGetValue(stage, out var componentList))
            {
                componentList = new List <IUpdatable>();

                this.registeredStages.Add(stage);
                this.registeredStages.Sort();

                this.registeredComponents.Add(stage, componentList);
            }

            componentList.Add(updatableComponent);
        }
Esempio n. 11
0
    // Use this for initialization
    new public void Start()
    {
        base.Start();

        stageUpdater = GameObject.Find("SceneUpdater").GetComponent <UpdateStage>();

        m_Angle   = RocketInitialAngle;
        m_Power   = RocketInitialPower;
        m_Gravity = RocketGravity;

        m_type    = GameDefine.ITEM_TYPE.ITEM_TYPE_ROCKET;
        m_state   = EItemUseState.ITEM_STAT_READY;
        m_useType = (GameDefine.ItemUseType_UseAgain | GameDefine.ItemUseType_Reload | GameDefine.ItemUseType_BtnTrigger);

        scrCamera     = GameObject.FindWithTag("CameraRoot").GetComponent <scr_VRCameraRoot>();
        rotateAxis    = Vector3.zero;
        m_rocketPower = 0.0f;

        effectMngr = GameObject.Find("EffectManager").GetComponent <EffectManager>();

        audioSource    = GetComponent <AudioSource>();
        m_bChargeStart = false;
    }
Esempio n. 12
0
 /// <summary>
 /// Constructor for UpdateProgressEventArgs
 /// </summary>
 /// <param name="_currentUpdateStage">The current state of the updating progress</param>
 /// <param name="_currentUpdateDescription">Description of the current update stage</param>
 /// <param name="_currentStageProgress">Progress of the current stage</param>
 /// <param name="_overallProgress">Overall progress of the update</param>
 public UpdateProgressEventArgs(UpdateStage _currentUpdateStage, String _currentUpdateDescription,
     int _currentStageProgress, int _overallProgress)
 {
     CurrentUpdateStage = _currentUpdateStage;
     CurrentUpdateDescription = _currentUpdateDescription;
     CurrentStageProgress = _currentStageProgress;
     OverallProgress = _overallProgress;
 }
Esempio n. 13
0
 public ReportingEventArgs(UpdateStage stage) : this(stage, 0, 0)
 {
 }
Esempio n. 14
0
 public ReportingEventArgs(UpdateStage stage, int number, int count)
 {
     Stage  = stage;
     Number = number;
     Count  = count;
 }
Esempio n. 15
0
        public override async Task RequestUpdate()
        {
            if (isUpdateInProgress || !isConnected || CMPedometer.AuthorizationStatus != CMAuthorizationStatus.Authorized)
            {
                return;
            }
            isUpdateInProgress = true;

#if DELETE_ON_STARTUP
            if (!hasDeleted)
            {
                await StorageService.Current.DeleteDataBaseTables(Table.All);

                hasDeleted = true;
            }
#endif

#if DEBUG
            DateTime profileStart = DateTime.Now;
#endif

            //NOTE: Run as iOS background task in case application is force closed so that no data is lost.
            nint taskId = UIApplication.SharedApplication.BeginBackgroundTask("UpdateWalkingHistory", () => isUpdateInProgress = false);


            List <WalkingDataPointModel> pedometerDataPoints = await GetPedometerData();

            try
            {
                // store walking data points
                await StorageService.Current.StoreWalkingDataPoints(pedometerDataPoints);

                // convert and delete walking points

                await ConvertAndStoreDataPoints();

                // store point from where to pick up updates
                switch (updateStage)
                {
                case UpdateStage.LoadToday:
                    updateStage = UpdateStage.LoadBackLog;
                    break;

                case UpdateStage.LoadBackLog:
                    var last = await StorageService.Current.GetLatestWalkingDataPoint();

                    if (last != null)
                    {
                        await StorageService.Current.StoreTimeOfLatestWalkingDataPointOrMidnight(last.Stop);
                    }
                    updateStage = UpdateStage.Regular;
                    break;

                case UpdateStage.Regular:
                    if (pedometerDataPoints.Count > 0)
                    {
                        await StorageService.Current.StoreTimeOfLatestWalkingDataPointOrMidnight(pedometerDataPoints
                                                                                                 .OrderByDescending(dp => dp.Stop).First().Stop);
                    }
                    break;
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }

            OnUpdateCompleted();
            isUpdateInProgress = false;
            UIApplication.SharedApplication.EndBackgroundTask(taskId);

#if DEBUG
            var timeSpent = DateTime.Now - profileStart;
            Debug.WriteLine("Time spent on walking data update: {0} ms", timeSpent.TotalMilliseconds);
#endif
        }
Esempio n. 16
0
        private async Task <List <WalkingDataPointModel> > GetPedometerData()
        {
            var pedometerData = new List <WalkingDataPointModel>();
            var debugStart    = DateTime.Now;


            DateTime from, to;


            switch (updateStage)
            {
            case UpdateStage.LoadToday:
#if DELETE_ON_STARTUP
                DateTime queryStartTime = DateTime.Today.AddDays(-7);
#else
                DateTime queryStartTime = await GetQueryStartTime(DateTime.Now);
#endif

                //if the QueryStartTime is midnight today or later, just run regular updates
#if true
                if (queryStartTime.CompareTo(DateTime.Today) >= 0)
                {
                    updateStage = UpdateStage.Regular;
                    from        = queryStartTime;
                }
                else
                {
                    from = DateTime.Today;
                }
#else
                from = DateTime.Today;
#endif
                to = DateTime.Now;
                break;

            case UpdateStage.LoadBackLog:
                to = DateTime.Today;
#if DELETE_ON_STARTUP
                from = DateTime.Now.AddDays(-7);
#else
                from = await GetQueryStartTime(to);
#endif
                break;

            default:
            case UpdateStage.Regular:
                to = DateTime.Now;
                //start from last time walking data was collected
                from = await GetQueryStartTime(to);

                break;
            }

#if DEBUG
            Debug.WriteLine($"Running walkingdataservice update at stage: {updateStage}");
            Debug.WriteLine("Running query from {0} to {1}", from.ToLongTimeString(), to.ToLongTimeString());
#endif

            pedometerData.AddRange(await RecursiveBinarySearch(from, to));

            var completionTime = (DateTime.Now - debugStart).TotalMilliseconds;
#if DEBUG
            Debug.WriteLine($"Finished query in {completionTime} ms with a search range of {BINARY_SEARCH_SECONDS_THRESHOLD / 60f} minutes");
#endif

            if (UpdateService.Current.GetUpdateMode() == UpdateMode.Background)
            {
                Analytics.TrackEvent(TrackingEvents.Background, new TrackingEvents.BackgroundArgs(completionTime));
            }

            return(pedometerData);
        }
Esempio n. 17
0
 public LoadProgressArguments(UpdateStage stage, UpdateOperation operation, params object[] args)
     : this(0, stage, operation, args)
 {
 }
Esempio n. 18
0
        void OnCompleteCheckDownloadList()
        {
            mStage = UpdateStage.Downloading;

            StartCoroutine(AsyncDownloading(OnCompleteDownloading));
        }
Esempio n. 19
0
        void OnCompleteDownloading()
        {
            mStage = UpdateStage.LoadLuaScript;

            StartCoroutine(AsyncLoadLua(OnCompleteLoadLua));
        }