Exemplo n.º 1
0
 public void Start()
 {
     animation.stateChanged += OnCycleComplete;
     animation.TransitionTo(Reloading);
     GameAudioManager.PlaySound(AK.EVENTS.PLAY_FPH_HUNTINGRIFLE_RELOAD_OPENBOLT, GameManager.GetPlayerObject());
     step = ReloadStep.OpenBolt;
 }
        private IEnumerator <YieldInstruction> ContractConfiguratorReload()
        {
            // Clear contract configurator
            reloading  = true;
            reloadStep = ReloadStep.CLEAR_CONFIG;
            yield return(new WaitForEndOfFrame());

            ClearContractConfig();

            // Load contract configurator
            reloadStep = ReloadStep.LOAD_CONFIG;
            IEnumerator <YieldInstruction> iterator = LoadAllContractConfig();

            while (iterator.MoveNext())
            {
                yield return(iterator.Current);
            }

            // We're done!
            reloading = false;
            ScreenMessages.PostScreenMessage("Loaded " + successContracts + " out of " + totalContracts
                                             + " contracts successfully.", 5, ScreenMessageStyle.UPPER_CENTER);

            yield return(new WaitForEndOfFrame());

            DebugWindow.scrollPosition  = new Vector2();
            DebugWindow.scrollPosition2 = new Vector2();
        }
Exemplo n.º 3
0
            public void OnCycleComplete(State oldState, State newState)
            {
                if (oldState != Reloading || newState != Reloading)
                {
                    return;
                }

                switch (step)
                {
                case ReloadStep.CloseBolt:
                    animation.stateChanged -= OnCycleComplete;
                    reloadCompleteEventCallback?.Invoke();
                    animation.TransitionTo(Showing);
                    return;

                case ReloadStep.OpenBolt:
                    break;

                case ReloadStep.LoadClip:
                    remainingBullets -= 5;
                    clipLoadedEventCallback?.Invoke();
                    break;

                case ReloadStep.LoadRound:
                    remainingBullets--;
                    roundLoadedEventCallback?.Invoke();
                    break;
                }

                if (remainingBullets >= 5)
                {
                    GameAudioManager.PlaySound(AK.EVENTS.PLAY_FPH_HUNTINGRIFLE_RELOAD_CARTRIDGE_LOOP_, GameManager.GetPlayerObject());
                    step = ReloadStep.LoadClip;
                }
                else if (remainingBullets > 0)
                {
                    GameAudioManager.PlaySound(AK.EVENTS.PLAY_FPH_HUNTINGRIFLE_RELOAD_SINGLE_LOOP, GameManager.GetPlayerObject());
                    step = ReloadStep.LoadRound;
                }
                else
                {
                    GameAudioManager.PlaySound(AK.EVENTS.PLAY_FPH_HUNTINGRIFLE_RELOAD_SINGLE_CLOSEBOLT, GameManager.GetPlayerObject());
                    step = ReloadStep.CloseBolt;
                }
            }
        /// <summary>
        /// Reloads all contract types from the config nodes.  Also re-runs ModuleManager if it is installed.
        /// </summary>
        private IEnumerator <YieldInstruction> ReloadContractTypes()
        {
            reloading  = true;
            reloadStep = ReloadStep.GAME_DATABASE;

            GameDatabase.Instance.Recompile = true;
            GameDatabase.Instance.StartLoad();

            // Wait for the reload
            while (!GameDatabase.Instance.IsReady())
            {
                yield return(new WaitForEndOfFrame());
            }

            // Attempt to find module manager and do their reload
            reloadStep = ReloadStep.MODULE_MANAGER;
            var allMM = from loadedAssemblies in AssemblyLoader.loadedAssemblies
                        let assembly = loadedAssemblies.assembly
                                       where assembly.GetName().Name.StartsWith("ModuleManager")
                                       orderby assembly.GetName().Version descending, loadedAssemblies.path ascending
            select loadedAssemblies;

            // Reload module manager
            if (allMM.Count() > 0)
            {
                Assembly mmAssembly = allMM.First().assembly;
                LoggingUtil.LogVerbose(this, "Reloading config using ModuleManager: " + mmAssembly.FullName);

                // Get the module manager object
                Type          mmPatchType   = mmAssembly.GetType("ModuleManager.MMPatchLoader");
                LoadingSystem mmPatchLoader = (LoadingSystem)FindObjectOfType(mmPatchType);

                // Do the module manager load
                mmPatchLoader.StartLoad();
                while (!mmPatchLoader.IsReady())
                {
                    yield return(new WaitForEndOfFrame());
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Reloads all contract types from the config nodes.  Also re-runs ModuleManager if it is installed.
        /// </summary>
        private IEnumerator <YieldInstruction> ReloadContractTypes()
        {
            reloading  = true;
            reloadStep = ReloadStep.GAME_DATABASE;

            GameDatabase.Instance.Recompile = true;
            GameDatabase.Instance.StartLoad();

            // Wait for the reload
            while (!GameDatabase.Instance.IsReady())
            {
                yield return(new WaitForEndOfFrame());
            }

            // Attempt to find module manager and do their reload
            reloadStep = ReloadStep.MODULE_MANAGER;
            var allMM = from loadedAssemblies in AssemblyLoader.loadedAssemblies
                        let assembly = loadedAssemblies.assembly
                                       where assembly.GetName().Name.StartsWith("ModuleManager")
                                       orderby assembly.GetName().Version descending, loadedAssemblies.path ascending
            select loadedAssemblies;

            // Reload module manager
            if (allMM.Count() > 0)
            {
                Assembly mmAssembly = allMM.First().assembly;
                LoggingUtil.LogVerbose(this, "Reloading config using ModuleManager: " + mmAssembly.FullName);

                // Get the module manager object
                Type          mmPatchType   = mmAssembly.GetType("ModuleManager.MMPatchLoader");
                LoadingSystem mmPatchLoader = (LoadingSystem)FindObjectOfType(mmPatchType);

                // Do the module manager load
                mmPatchLoader.StartLoad();
                while (!mmPatchLoader.IsReady())
                {
                    yield return(new WaitForEndOfFrame());
                }
            }

            // Clear contract configurator
            reloadStep = ReloadStep.CLEAR_CONFIG;
            yield return(new WaitForEndOfFrame());

            ClearContractConfig();

            // Load contract configurator
            reloadStep = ReloadStep.LOAD_CONFIG;
            IEnumerator <YieldInstruction> iterator = LoadContractConfig();

            while (iterator.MoveNext())
            {
                yield return(iterator.Current);
            }

            // Adjust contract types
            reloadStep = ReloadStep.ADJUST_TYPES;
            yield return(new WaitForEndOfFrame());

            AdjustContractTypes();

            // We're done!
            reloading = false;
            ScreenMessages.PostScreenMessage("Loaded " + successContracts + " out of " + totalContracts
                                             + " contracts successfully.", 5, ScreenMessageStyle.UPPER_CENTER);

            yield return(new WaitForEndOfFrame());

            DebugWindow.scrollPosition  = new Vector2();
            DebugWindow.scrollPosition2 = new Vector2();
        }