Exemple #1
0
        private void EnsureSelectedSettingVisible()
        {
            if (Utils.GetMenuMovementVertical(InterfaceManager.m_Panel_OptionsMenu, true, false) == 0f)
            {
                return;
            }

            if (selectedIndex == 0)
            {
                scrollBarSlider.value = 0;
                return;
            }

            GameObject setting           = currentTab.menuItems[selectedIndex];
            float      settingY          = -setting.transform.localPosition.y;
            float      scrollPanelTop    = scrollPanelOffset.localPosition.y + GUIBuilder.gridCellHeight;
            float      scrollPanelBottom = scrollPanelOffset.localPosition.y + scrollPanel.height - GUIBuilder.gridCellHeight;

            if (settingY < scrollPanelTop)
            {
                scrollBarSlider.value += (settingY - scrollPanelTop) / currentTab.scrollBarHeight;
                GameAudioManager.PlayGUIScroll();
            }
            else if (settingY > scrollPanelBottom)
            {
                scrollBarSlider.value += (settingY - scrollPanelBottom) / currentTab.scrollBarHeight;
                GameAudioManager.PlayGUIScroll();
            }
        }
        public MainWindow()
        {
            InitializeComponent();

            #region load settings
            try
            {
                gridSide          = int.Parse(ConfigurationManager.AppSettings["gridSide"]);
                cellNumber        = gridSide * gridSide;
                shotLimit         = int.Parse(ConfigurationManager.AppSettings["shotLimit"]);
                shotAnimationTime = int.Parse(ConfigurationManager.AppSettings["shotAnimationTime"]);
                animationDuration = new TimeSpan(0, 0, shotAnimationTime).Ticks;

                shipNumbers = ConfigurationManager.AppSettings["shipNumbers"].Split(',').Select(s => int.Parse(s)).ToArray();

                cellImages = new Image[cellNumber];
            }
            catch (Exception)
            {
                MessageBox.Show("Invalid configuration file", "Error");
                Application.Current.Shutdown();
            }
            #endregion

            gameController = new GameController(shotLimit, gridSide, shipNumbers);
            ImageResourcesManager.Initialize();
            GameAudioManager.Initialize();
            InitializeCells();
            InitializeButtons();
            UpdateClicksUI();
        }
Exemple #3
0
        internal static void ExecuteTakeEmbers()
        {
            GearItem emberBox = GameManager.GetInventoryComponent().GetBestGearItemWithName("GEAR_EmberBox");

            if (emberBox == null)
            {
                GameAudioManager.PlayGUIError();
                HUDMessage.AddMessage(Localization.Get("GAMEPLAY_ToolRequiredToForceOpen").Replace("{item-name}", Localization.Get("GAMEPLAY_EmberBox")), false);
                return;
            }

            Panel_FeedFire panel = InterfaceManager.m_Panel_FeedFire;
            Fire           fire  = Traverse.Create(panel).Field("m_Fire").GetValue <Fire>();

            if (fire && !fire.m_IsPerpetual)
            {
                fire.ReduceHeatByDegrees(1);
            }

            GameManager.GetInventoryComponent().DestroyGear(emberBox.gameObject);
            GearItem activeEmberBox = GameManager.GetPlayerManagerComponent().InstantiateItemInPlayerInventory("GEAR_ActiveEmberBox");

            GearMessage.AddMessage(activeEmberBox, Localization.Get("GAMEPLAY_Harvested"), activeEmberBox.m_DisplayName, false);

            InterfaceManager.m_Panel_FeedFire.ExitFeedFireInterface();
        }
Exemple #4
0
    void Awake()
    {
        s_pInstance = this;
        s_pInstance.Initialise();

        DontDestroyOnLoad(this);
    }
Exemple #5
0
    public override void OnRoomEnter()
    {
        base.OnRoomEnter();

        // Verify...
        {
            m_gcAudioManager = GameInstance.Object.GetAudioManager();
            GAssert.Assert(null != m_gcAudioManager, "Unable to get audio manager");

            m_gcRenderer = GetComponent <SpriteRenderer>();
            GAssert.Assert(null != m_gcRenderer, "Unable to get sprite renderer!");

            GAssert.Assert(null != m_goLaser, "Floating Laser properties not setup in editor!");
            GAssert.Assert(null != m_WarmUpMat, "Floating Laser properties not setup in editor!");
            GAssert.Assert(null != m_InactiveMat, "Floating Laser properties not setup in editor!");
            GAssert.Assert(null != m_ActiveMat, "Floating Laser properties not setup in editor!");
        }


        // Init
        LaserOff(false);
        m_bBehaviourCanUpdate = true;
        m_iState = ELaserState._IDLE_OFF;
        m_gcRenderer.material = m_InactiveMat;
        m_fNextEventTime      = TimerManager.fGameTime + (m_fLaserInactiveTime - Types.s_fDUR_FloatingLaserWarmUp);

        // Warn Players that this level contains lasers...
        m_gcAudioManager.PlayAudio(EGameSFX._SFX_FLOATING_LASER_LEVEL_WARNING);
    }
    public static bool Prefix(Breath __instance)
    {
        bool suppress = (bool)AccessTools.Method(typeof(Breath), "ShouldSuppressBreathEffect").Invoke(__instance, new object[0]);

        if (suppress)
        {
            return(false);
        }

        HeavyBreathingState heavyBreathingState = GameManager.GetFatigueComponent().GetHeavyBreathingState();

        if (heavyBreathingState == HeavyBreathingState.Light)
        {
            GameAudioManager.PlaySound(AK.EVENTS.PLAY_VOBREATHELOWINTENSITYNOLOOP, GameManager.GetPlayerObject());
        }
        else if (heavyBreathingState == HeavyBreathingState.Medium)
        {
            GameAudioManager.PlaySound(AK.EVENTS.PLAY_VOBREATHMEDIUMINTENSITYNOLOOP, GameManager.GetPlayerObject());
        }
        else if (heavyBreathingState == HeavyBreathingState.Heavy)
        {
            GameAudioManager.PlaySound(AK.EVENTS.PLAY_VOBREATHHIGHINTENSITYNOLOOP, GameManager.GetPlayerObject());
        }
        return(false);
    }
Exemple #7
0
 public void Start()
 {
     animation.stateChanged += OnCycleComplete;
     animation.TransitionTo(Reloading);
     GameAudioManager.PlaySound(AK.EVENTS.PLAY_FPH_HUNTINGRIFLE_RELOAD_OPENBOLT, GameManager.GetPlayerObject());
     step = ReloadStep.OpenBolt;
 }
Exemple #8
0
        internal static void Refuel(GearItem gearItem)
        {
            Panel_Inventory_Examine panel = InterfaceManager.m_Panel_Inventory_Examine;

            float currentLiters  = GetCurrentLiters(panel.m_GearItem);
            float capacityLiters = GetCapacityLiters(panel.m_GearItem);

            if (Mathf.Approximately(currentLiters, capacityLiters))
            {
                GameAudioManager.PlayGUIError();
                HUDMessage.AddMessage(Localization.Get("GAMEPLAY_AlreadyFilled"), false);
                return;
            }

            float totalCurrent = GetTotalCurrentLiters(panel.m_GearItem);

            if (totalCurrent < Implementation.MIN_LITERS)
            {
                GameAudioManager.PlayGUIError();
                HUDMessage.AddMessage(Localization.Get("GAMEPLAY_NoKeroseneavailable"), false);
                return;
            }

            GameAudioManager.PlayGuiConfirm();
            InterfaceManager.m_Panel_GenericProgressBar.Launch(
                Localization.Get("GAMEPLAY_RefuelingProgress"),
                REFUEL_TIME,
                0,
                0,
                REFUEL_AUDIO,
                null,
                false,
                true,
                new OnExitDelegate(OnRefuelFinished));
        }
Exemple #9
0
    public void OnMuteSFXPressed(bool bState)
    {
        GameAudioManager gc = GameInstance.Object.GetAudioManager();

        GAssert.Assert(null != gc, "Unable to get Audio Manager");
        gc.MuteSFX(bState);
    }
Exemple #10
0
    public void OnSFXSlider(float fVal)
    {
        GameAudioManager gc = GameInstance.Object.GetAudioManager();

        GAssert.Assert(null != gc, "Unable to get Audio Manager");
        gc.SetSFXVol(fVal);
    }
Exemple #11
0
        private static void OnTransfer()
        {
            //MelonLoader.MelonLogger.Log("Transfer");
            var liquidItem = WaterButtons.currentLiquidItemShowing;

            if (liquidItem == null)
            {
                return;
            }
            if (Water.IsEmpty(liquidItem))             // If the selected liquid container is empty.
            {
                HUDMessage.AddMessage(Localization.Get("GAMEPLAY_BWM_Empty"));
                GameAudioManager.PlayGUIError();
                return;
            }
            float spaceAvailable = Water.GetRemainingCapacityEmpty() + Water.GetRemainingCapacity(liquidItem.m_LiquidQuality) - liquidItem.m_LiquidCapacityLiters + liquidItem.m_LiquidLiters;

            if (Water.IsNone(spaceAvailable))
            {
                HUDMessage.AddMessage(Localization.Get("GAMEPLAY_BWM_NoCapacityAvailable"));
                GameAudioManager.PlayGUIError();
                return;
            }
            float maximumWaterTransfer = Mathf.Min(spaceAvailable, liquidItem.m_LiquidLiters);

            GameAudioManager.PlayGuiConfirm();
            float refillDuration = Mathf.Max(maximumWaterTransfer * 4, 1);

            InterfaceManager.m_Panel_GenericProgressBar.Launch(Localization.Get("GAMEPLAY_BWM_TransferingProgress"), refillDuration, 0f, 0f,
                                                               "Play_SndActionRefuelLantern", null, false, true, new System.Action <bool, bool, float>(OnTransferFinished));
        }
Exemple #12
0
 public static void PlayAudio(string audioName)
 {
     if (audioName != null)
     {
         GameAudioManager.PlaySound(audioName, InterfaceManager.GetSoundEmitter());
     }
 }
 // Start is called before the first frame update
 void Start()
 {
     uiManager           = FindObjectOfType <GameUIManager>();
     audioManager        = FindObjectOfType <GameAudioManager>();
     aSource             = GetComponent <AudioSource>();
     playerShipColliders = GetShipColliders(playerFieldData);
     otherShipColliders  = GetShipColliders(otherPlayerFeildData);
 }
Exemple #14
0
 private void OnScroll(UISlider slider, bool playSound)
 {
     scrollPanelOffset.localPosition = new Vector2(0, slider.value * (currentTab?.scrollBarHeight ?? 0));
     if (playSound)
     {
         GameAudioManager.PlayGUIScroll();
     }
 }
Exemple #15
0
        private static bool Prefix(IceFishingHole __instance, GameObject go, ref float ___m_ElapsedFishingTimeMinutes)
        {
            GearItem component = go.GetComponent <GearItem>();

            if (!component)
            {
                return(false);
            }
            component.gameObject.SetActive(true);
            component.m_CurrentHP = UnityEngine.Random.Range(0.9f * component.m_MaxHP, component.m_MaxHP);

            float myrol1  = FishingHoles.FishingHolesPoisson();
            float myrol2  = FishingHoles.FishingHolesPoisson(); //do it twice to widen the tail of the distribution
            float FISHmod = (myrol1 * myrol2 + 0.25f) / 1.25f;  //ensure mod is Non-zero

            float skillmod = GameManager.GetSkillIceFishing().GetFishWeightScale();

            Debug.Log("Fish mod:" + FISHmod + "skill mod:" + skillmod + " changing " + component.name + " weight from:" + component.m_WeightKG + " to:" + component.m_WeightKG * FISHmod * skillmod);

            component.m_WeightKG = component.m_WeightKG * FISHmod * skillmod;
            float length = Mathf.Pow(component.m_WeightKG, 0.3333f);

            float lengthfactor = 1f;

            if (component.name == "GEAR_RawLakeWhiteFish")
            {
                lengthfactor = 0.8f;
            }
            if (component.name == "GEAR_RawSmallMouthBass")
            {
                lengthfactor = 0.9f;
            }
            if (component.name == "GEAR_RawRainbowTrout")
            {
                lengthfactor = 0.8f;
            }
            if (component.name == "GEAR_RawCohoSalmon")
            {
                lengthfactor = 0.74f;
            }

            component.gameObject.transform.localScale *= length * lengthfactor;

            component.m_FoodItem.m_CaloriesTotal     *= FISHmod * skillmod;
            component.m_FoodItem.m_CaloriesRemaining *= FISHmod * skillmod;


            GameManager.GetPlayerManagerComponent().EnterInspectGearModeFromFishingHole(component, __instance);

            InterfaceManager.m_Panel_GenericProgressBar.Pause();
            GameAudioManager.PlaySound(EVENTS.PAUSE_SEARCHCONTAINER, GameManager.GetPlayerObject());
            StatsManager.IncrementValue(StatID.FishCaught, component.GetItemWeightKG());
            GameManager.GetAchievementManagerComponent().CaughtFish(component);

            component.MarkAsHarvested();
            return(false);
        }
Exemple #16
0
 private void Awake()
 {
     Instance                     = this;
     _playerCharacter             = FindObjectOfType <PlayerCharacter>();
     _playerCharacter.PlayerHit  += OnPlayerHit;
     _playerCharacter.PlayerDown += OnPLayerDown;
     _uiConrtoller                = FindObjectOfType <UiConrtoller>();
     _audioManager                = GetComponent <GameAudioManager>();
 }
Exemple #17
0
 internal static void Postfix()
 {
     //If P has been pressed
     if (InputManager.GetKeyDown(InputManager.m_CurrentContext, UnityEngine.KeyCode.P))
     {
         //Play the sound
         GameAudioManager.PlaySound(SOUND_NAME, InterfaceManager.GetSoundEmitter());
     }
 }
Exemple #18
0
        internal static void FeedFire(Panel_FeedFire __instance)
        {
            Fire     _fire = __instance.m_Fire;
            string   guid  = Utils.GetGuidFromGameObject(_fire.gameObject);
            GearItem fuel  = __instance.GetSelectedFuelSource();

            // cool off fire with water
            if (fuel.name.ToLower().Contains("recycledcan") || fuel.name.ToLower().Contains("cookingpot"))
            {
                GearItem gi_wt = GameManager.GetInventoryComponent().GetPotableWaterSupply();
                if (gi_wt.m_WaterSupply.m_VolumeInLiters >= 0.25f && _fire.m_HeatSource.m_MaxTempIncrease > Settings.options.waterTempRemoveDeg)
                {
                    GameAudioManager.StopAllSoundsFromGameObject(InterfaceManager.GetSoundEmitter());
                    GameAudioManager.PlaySound(gi_wt.m_PickUpAudio, InterfaceManager.GetSoundEmitter());
                    gi_wt.m_WaterSupply.m_VolumeInLiters -= 0.25f;
                    _fire.ReduceHeatByDegrees(Settings.options.waterTempRemoveDeg);
                }
                else if (gi_wt.m_WaterSupply.m_VolumeInLiters < 0.25f)
                {
                    HUDMessage.AddMessage("Need water in inventory.", false);
                    GameAudioManager.StopAllSoundsFromGameObject(InterfaceManager.GetSoundEmitter());
                    GameAudioManager.PlayGUIError();
                }
                else
                {
                    HUDMessage.AddMessage("Temperature is too low.", false);
                    GameAudioManager.StopAllSoundsFromGameObject(InterfaceManager.GetSoundEmitter());
                    GameAudioManager.PlayGUIError();
                }

                /* we consume can/pot so recreate it
                 * we could hack it to not consume but after some time (minutes) of feed fire dialog, said object is getting corrupted in such way that it's lagging game
                 * on each interaction with said item
                 */
                GearItem clone = Utils.InstantiateGearFromPrefabName(fuel.name);
                clone.m_CurrentHP = fuel.m_CurrentHP;
                GameManager.GetInventoryComponent().AddGear(clone.gameObject);
                GameManager.GetInventoryComponent().DestroyGear(fuel.gameObject);
            }
            // added fuel while embers
            else if (_fire.m_EmberTimer > 0f)
            {
                ResetEmbersOnRestart(_fire);
            }
            // try add fuel to embers unless it wasn't comming out from ember state.
            else if (fuel.name.ToLower().Contains("wood") || fuel.name.ToLower().Contains("coal"))
            {
                if (_fire.GetRemainingLifeTimeSeconds() < 39600 && (_fire.m_EmberDurationSecondsTOD < (Settings.options.embersTime * 3600)))
                {
                    float fuelmove = fuel.m_FuelSourceItem.m_BurnDurationHours * Settings.options.embersFuelRatio;
                    _fire.m_MaxOnTODSeconds         -= fuelmove * 3600;
                    _fire.m_EmberDurationSecondsTOD += (fuelmove * 3600) * Settings.options.embersFuelEx;
                    _fire.m_BurningTimeTODHours     -= fuelmove;
                }
            }
        }
Exemple #19
0
    void Awake()
    {
        if (GameAudioManager.instance == null) {

                instance = this;
            } else if (instance != this) {
                Destroy(gameObject);
            }
            DontDestroyOnLoad(gameObject);
    }
Exemple #20
0
        public static bool Prefix(vp_FPSPlayer __instance)
        {
            if (__instance.Controller.StateEnabled("Reload") || Time.time < __instance.FPSCamera.CurrentShooter.NextAllowedReloadTime)
            {
                GameAudioManager.PlayGUIError();
                return(false);
            }

            return(true);
        }
Exemple #21
0
 private static bool Prefix(ref bool __result, GearItem gi)
 {
     if (gi.IsWornOut())
     {
         GameAudioManager.PlayGUIError();
         __result = false;
         return(false);
     }
     return(true);
 }
Exemple #22
0
 private static bool Prefix()
 {
     if (PlayerIsCarryingCarcass)
     {
         HUDMessage.AddMessage("CANNOT EQUIP ITEM WHILE CARRYING CARCASS", false);
         GameAudioManager.PlayGUIError();
         return(false);
     }
     return(true);
 }
 // Start is called before the first frame update
 void Start()
 {
     if (_instance == null)
     {
         _instance = this;
     }
     else if (_instance != this)
     {
         Destroy(this);
     }
 }
Exemple #24
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
 }
Exemple #25
0
        private void MakeMistake()
        {
            if (!Implementation.Mistakes)
            {
                return;
            }

            this.offset = Random.Range(-maxMistake, maxMistake);
            GameAudioManager.PlaySound(MistakeAudio, this.gameObject);

            this.nextMistake += getRandomDelay(averageMistakeDelay);
        }
Exemple #26
0
 /**********************************************************************************/
 // делаем себя бессмертными
 //
 /**********************************************************************************/
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
     }
     DontDestroyOnLoad(gameObject);
 }
        public void OnDisable()
        {
            if (this.gameObject.activeInHierarchy)
            {
                return;
            }

            EmitterProxy[] emitterProxies = this.gameObject.GetComponentsInChildren <EmitterProxy>();
            foreach (var eachEmitterProxy in emitterProxies)
            {
                GameAudioManager.StopAllSoundsFromGameObject(eachEmitterProxy.m_Proxy);
            }
        }
Exemple #28
0
    public static void ChangeScore(float change)
    {
        _i.currentScore += change;

        if (change >= 0)
        {
            GameAudioManager.GainScore();
        }
        else
        {
            GameAudioManager.LoseScore();
        }
    }
Exemple #29
0
        static bool Prefix(Panel_FireStart __instance, Campfire ___m_CampFireInstance, FireStarterItem ___m_KeroseneAccelerant, FireManager ___m_FireManager, bool skipResearchItemCheck = false)
        {
            var traverseInstance = Traverse.Create(__instance);

            traverseInstance.Field("m_FireManager").SetValue(GameManager.GetFireManagerComponent());

            var selectedFireStarter = traverseInstance.Method("GetSelectedFireStarter").GetValue <FireStarterItem>();
            var selectedTinder      = traverseInstance.Method("GetSelectedTinder").GetValue <FuelSourceItem>();
            var selectedFuelSource  = traverseInstance.Method("GetSelectedFuelSource").GetValue <FuelSourceItem>();
            var selectedAccelerant  = traverseInstance.Method("GetSelectedAccelerant").GetValue <FireStarterItem>();

            if (___m_CampFireInstance && ___m_CampFireInstance.TooWindyToStart())
            {
                GameAudioManager.PlayGUIError();
                HUDMessage.AddMessage(Localization.Get("GAMEPLAY_Itstoowindytostartafirethere"), false);
                return(false);
            }
            if (selectedFireStarter == null || (GameManager.GetSkillFireStarting().TinderRequired() && selectedTinder == null) || selectedFuelSource == null)
            {
                GameAudioManager.PlayGUIError();
                HUDMessage.AddMessage(Localization.Get("GAMEPLAY_Insufficientmaterialstocreatefire"), false);
                return(false);
            }

            if (selectedFireStarter.m_RequiresSunLight && !traverseInstance.Method("HasDirectSunlight").GetValue <bool>())
            {
                GameAudioManager.PlayGUIError();
                HUDMessage.AddMessage(Localization.Get("GAMEPLAY_Magnifyinglensrequiresdirectsunlight"), false);
                return(false);
            }
            if (!skipResearchItemCheck)
            {
                ResearchItem component = selectedFuelSource.GetComponent <ResearchItem>();
                if (component != null && !component.IsResearchComplete())
                {
                    Panel_Confirmation.CallbackDelegate forceBurnResearchItem = () => traverseInstance.Method("ForceBurnResearchItem").GetValue();
                    InterfaceManager.m_Panel_Confirmation.ShowBurnResearchNotification(forceBurnResearchItem);
                    return(false);
                }
            }
            if (selectedAccelerant != null && selectedAccelerant == ___m_KeroseneAccelerant)
            {
                GameManager.GetPlayerManagerComponent().DeductLiquidFromInventory(GameManager.GetFireManagerComponent().m_KeroseneLitersAccelerant, GearLiquidTypeEnum.Kerosene);
            }
            float percentChanceSuccess = TinderHelper.CalculateFireStartSuccess(selectedFireStarter, selectedTinder, selectedFuelSource, selectedAccelerant);

            ___m_FireManager.PlayerStartFire(___m_CampFireInstance, selectedFireStarter, selectedTinder, selectedFuelSource, selectedAccelerant, percentChanceSuccess);
            __instance.Enable(false);
            GameAudioManager.PlayGuiConfirm();
            return(false);
        }
    public void PopWrapping(Vector3 newVelocity)
    {
        Debug.Log("pop wrapping called");
        GameAudioManager.WrappingDestroy(this.transform.position);

        //shread wrapping (remove mesh layer, create pop particles, etc.) & remove this script
        GetComponent <MeshCollider>().enabled = true;
        GetComponent <MeshRenderer>().enabled = true;
        gameObject.AddComponent <Rigidbody>();
        GetComponent <Rigidbody>().velocity = newVelocity;
        Destroy(transform.parent.gameObject);
        gameObject.transform.SetParent(null);
        Destroy(this);
    }
            private static bool Prefix(Panel_OptionsMenu __instance)
            {
                ModSettingsGUI gui = GetModSettingsGUI(__instance);

                if (!gui.gameObject.activeInHierarchy)
                {
                    return(true);
                }

                GameAudioManager.PlayGuiConfirm();
                gui.CallOnConfirm();

                return(false);
            }
Exemple #32
0
 public void OnApplicationQuit()
 {
     GameAudioManager.instance = null;
 }
 void Awake()
 {
     instance = this;
 }