/// <summary>
        /// Called by the Visual Studio Shell to notify components of a broadcast message.
        /// </summary>
        /// <param name="msg">The message identifier.</param>
        /// <param name="wParam">First parameter associated with the message.</param>
        /// <param name="lParam">Second parameter associated with the message.</param>
        /// <returns>S_OK always.</returns>
        public int OnBroadcastMessage(uint msg, IntPtr wParam, IntPtr lParam)
        {
            switch (msg)
            {
            case VSConstants.VSM_VIRTUALMEMORYLOW:
            case VSConstants.VSM_VIRTUALMEMORYCRITICAL:
            {
                if (!_alreadyLogged)
                {
                    // record that we had hit critical memory barrier
                    Logger.Log(FunctionId.VirtualMemory_MemoryLow, KeyValueLogMessage.Create(m =>
                        {
                            // which message we are logging and memory left in bytes when this is called.
                            m["MSG"]        = msg;
                            m["MemoryLeft"] = (long)wParam;
                        }));

                    _alreadyLogged = true;
                }

                _workspaceCacheService?.FlushCaches();

                if (ShouldDisableBackgroundAnalysis((long)wParam))
                {
                    DisableBackgroundAnalysis();
                    ShowInfoBarIfRequired();
                }

                // turn off low latency GC mode.
                // once we hit this, not hitting "Out of memory" exception is more important than typing being smooth all the time.
                // once it is turned off, user will hit time to time keystroke which responsive time is more than 50ms. in our own perf lab,
                // about 1-2% was over 50ms with this off when we first introduced this GC mode.
                GCManager.TurnOffLowLatencyMode();

                break;
            }
            }

            return(VSConstants.S_OK);
        }
        public IEnumerator LoadSceneAdditive(string destScene)
        {
            Debug.Log("Loading " + destScene);
            destScene                    = ModHooks.Instance.BeforeSceneLoad(destScene);
            this.tilemapDirty            = true;
            this.startedOnThisScene      = false;
            this.nextSceneName           = destScene;
            this.waitForManualLevelStart = true;
            if (this.DestroyPersonalPools != null)
            {
                this.DestroyPersonalPools();
            }
            if (this.UnloadingLevel != null)
            {
                this.UnloadingLevel();
            }
            string         exitingScene = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;
            AsyncOperation loadop       = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(destScene, LoadSceneMode.Additive);

            loadop.allowSceneActivation = true;
            yield return(loadop);

            yield return(UnityEngine.SceneManagement.SceneManager.UnloadSceneAsync(exitingScene));

            ModHooks.Instance.OnSceneChanged(destScene);
            this.RefreshTilemapInfo(destScene);
            if (this.IsUnloadAssetsRequired(exitingScene, destScene))
            {
                Debug.LogFormat(this, "Unloading assets due to zone transition", new object[0]);
                yield return(Resources.UnloadUnusedAssets());
            }
            GCManager.Collect();
            this.SetupSceneRefs(true);
            this.BeginScene();
            this.OnNextLevelReady();
            this.waitForManualLevelStart = false;
            Debug.Log("Done Loading " + destScene);
            yield break;
        }
Example #3
0
    public virtual void Shoot(Vector2 _dir, AmmoData ammoData, LayerMask ammo_target_layer = default)
    {
        float _seg = weaponData.shoot_sight_angle / (weaponData.ammo_row_count + 1);
        //Vector2 _start_vec = Quaternion.AngleAxis(-weaponData.shoot_sight_angle * 0.5f, -transform.right) * _dir;
        Vector2 _start_vec = _dir.rotate(-weaponData.shoot_sight_angle * Mathf.Deg2Rad * 0.5f);

        Debug.Log("shoot dir " + _dir + " \nrotated dir " + _start_vec + " seg " + _seg);
        //multi row shoots (å¤šé‡å°„ę“Š)
        for (int i = 0; i < weaponData.ammo_row_count; i++)
        {
            Vector2 _divers_dir = _start_vec.rotate(_seg * Mathf.Deg2Rad);

            //generate ammo
            GameObject _obj = GCManager.Instantiate(ammoData.GC_key,
                                                    prefab: ammoData.ammo_prefab,
                                                    position: transform.position);
            if (_obj == null)
            {
                Debug.Log("_obj not registered " + ammoData.GC_key);
                return;
            }

            Ammo _ammo = _obj.GetComponent <Ammo>();
            //TODO: clean code

            //_ammo.transform.position = transform.position;
            //_ammo.dir = _dir;
            //_ammo.vec = _divers_dir;
            _ammo.SetUP(transform.position, _divers_dir);
            _ammo._total_damage = weaponData.damage_multiplier * ammoData.damage;
            //_ammo.targetLayer = ammo_target_layer;
            _ammo.SetTargetLayer(ammo_target_layer);

            _start_vec = _divers_dir;
        }

        //return _ammo;
    }
Example #4
0
        /// <summary>
        /// Called by the Visual Studio Shell to notify components of a broadcast message.
        /// </summary>
        /// <param name="msg">The message identifier.</param>
        /// <param name="wParam">First parameter associated with the message.</param>
        /// <param name="lParam">Second parameter associated with the message.</param>
        /// <returns>S_OK always.</returns>
        public int OnBroadcastMessage(uint msg, IntPtr wParam, IntPtr lParam)
        {
            switch (msg)
            {
            case VSConstants.VSM_VIRTUALMEMORYLOW:
            case VSConstants.VSM_VIRTUALMEMORYCRITICAL:
            {
                if (!_alreadyLogged)
                {
                    // record that we had hit critical memory barrier
                    Logger.Log(FunctionId.VirtualMemory_MemoryLow, KeyValueLogMessage.Create(m => m["Memory"] = msg));
                    _alreadyLogged = true;
                }

                _workspaceCacheService.FlushCaches();

                // turn off full solution analysis
                if (_workspace.Options.GetOption(RuntimeOptions.FullSolutionAnalysis))
                {
                    _workspace.Services.GetService <IOptionService>().SetOptions(_workspace.Options.WithChangedOption(RuntimeOptions.FullSolutionAnalysis, false));

                    // let user know full analysis is turned off due to memory concern
                    // no close info bar action
                    _workspace.Services.GetService <IErrorReportingService>().ShowErrorInfo(ServicesVSResources.FullSolutionAnalysisOff, () => { });
                }

                // turn off low latency GC mode.
                // once we hit this, not hitting "Out of memory" exception is more important than typing being smooth all the time.
                // once it is turned off, user will hit time to time keystroke which responsive time is more than 50ms. in our own perf lab,
                // about 1-2% was over 50ms with this off when we first introduced this GC mode.
                GCManager.TurnOffLowLatencyMode();

                break;
            }
            }

            return(VSConstants.S_OK);
        }
Example #5
0
    public override void SetUP(Vector2 _start_pos, Vector2 _vec)
    {
        //put hint in dest pos
        GameObject _hint = GCManager.Instantiate(hint_gc_key);

        //temp
        if (targetLayer == (targetLayer | (1 << LayerMask.NameToLayer("Player"))))
        {
            base.SetUP(_start_pos, _vec);
            _hint.transform.position = vec;
        }
        else
        {
            base.SetUP(_start_pos, CursorControl.instance.cursor_world_position + _vec.normalized * 5f);
            _hint.transform.position = CursorControl.instance.cursor_world_position;
        }

        //base.SetUP(_start_pos, CursorControl.instance.cursor_world_position);
        //_hint.transform.position = vec;
        //_hint.transform.position =CursorControl.instance.cursor_world_position;

        //move to the sky:
        transform.position = new Vector2(vec.x, vec.y + 50);
    }
 void DestorySelf()
 {
     GCManager.Destory(key, gameObject);
 }
Example #7
0
 private void Awake()
 {
     GCManager.RegisterObject(GC_key, gameObject);
 }
Example #8
0
 void DestorySelfOnDie()
 {
     GCManager.Destory(HPBAR_GC_KEY, gameObject);
 }
Example #9
0
 private void Awake()
 {
     Debug.Log("register hp bar");
     GCManager.RegisterObject(HPBAR_GC_KEY, gameObject);
 }
Example #10
0
 protected virtual void Start()
 {
     //gegister gc key
     GCManager.RegisterObject(ammoData.GC_key, gameObject);
 }
Example #11
0
 void DoDestory()
 {
     GCManager.Destory(DamagePopUpManager.DAMAGE_POPUP_GC_KEY, gameObject);
 }
Example #12
0
    public void Change(string _scene)
    {
        UnityEngine.SceneManagement.SceneManager.LoadScene(_scene);

        GCManager.Clear();
    }
Example #13
0
 // Use this for initialization
 void Start()
 {
     gcMan = gcManager.GetComponent <GCManager> ();
 }