Beispiel #1
0
 private void Update()
 {
     if (FindObjectOfType <MusicVolume>() != null)
     {
         mv = FindObjectOfType <MusicVolume>();
     }
 }
Beispiel #2
0
 internal override void Awake()
 {
     base.Awake();
     singleton   = this;
     audioSource = GetComponent <AudioSource>();
     LoadPlayerVolume();
 }
Beispiel #3
0
 private void Start()
 {
     rs     = FindObjectOfType <RunScript>();
     anim   = GetComponent <Animator>();
     mv     = FindObjectOfType <MusicVolume>();
     mv.ded = false;
 }
Beispiel #4
0
        public bool Equals(SimpleVariables other)
        {
            if (other == null)
            {
                return(false);
            }

            return(CurrentLevel.Equals(other.CurrentLevel) &&
                   CurrentArea.Equals(other.CurrentArea) &&
                   Language.Equals(other.Language) &&
                   MillisecondsPerGameMinute.Equals(other.MillisecondsPerGameMinute) &&
                   LastClockTick.Equals(other.LastClockTick) &&
                   GameClockHours.Equals(other.GameClockHours) &&
                   GameClockMinutes.Equals(other.GameClockMinutes) &&
                   GameClockSeconds.Equals(other.GameClockSeconds) &&
                   TimeInMilliseconds.Equals(other.TimeInMilliseconds) &&
                   TimeScale.Equals(other.TimeScale) &&
                   TimeStep.Equals(other.TimeStep) &&
                   TimeStepNonClipped.Equals(other.TimeStepNonClipped) &&
                   FramesPerUpdate.Equals(other.FramesPerUpdate) &&
                   FrameCounter.Equals(other.FrameCounter) &&
                   OldWeatherType.Equals(other.OldWeatherType) &&
                   NewWeatherType.Equals(other.NewWeatherType) &&
                   ForcedWeatherType.Equals(other.ForcedWeatherType) &&
                   WeatherTypeInList.Equals(other.WeatherTypeInList) &&
                   WeatherInterpolationValue.Equals(other.WeatherInterpolationValue) &&
                   CameraPosition.Equals(other.CameraPosition) &&
                   CameraModeInCar.Equals(other.CameraModeInCar) &&
                   CameraModeOnFoot.Equals(other.CameraModeOnFoot) &&
                   ExtraColor.Equals(other.ExtraColor) &&
                   IsExtraColorOn.Equals(other.IsExtraColorOn) &&
                   ExtraColorInterpolation.Equals(other.ExtraColorInterpolation) &&
                   Brightness.Equals(other.Brightness) &&
                   DisplayHud.Equals(other.DisplayHud) &&
                   ShowSubtitles.Equals(other.ShowSubtitles) &&
                   RadarMode.Equals(other.RadarMode) &&
                   BlurOn.Equals(other.BlurOn) &&
                   UseWideScreen.Equals(other.UseWideScreen) &&
                   MusicVolume.Equals(other.MusicVolume) &&
                   SfxVolume.Equals(other.SfxVolume) &&
                   RadioStation.Equals(other.RadioStation) &&
                   StereoOutput.Equals(other.StereoOutput) &&
                   PadMode.Equals(other.PadMode) &&
                   InvertLook.Equals(other.InvertLook) &&
                   UseVibration.Equals(other.UseVibration) &&
                   SwapNippleAndDPad.Equals(other.SwapNippleAndDPad) &&
                   HasPlayerCheated.Equals(other.HasPlayerCheated) &&
                   AllTaxisHaveNitro.Equals(other.AllTaxisHaveNitro) &&
                   TargetIsOn.Equals(other.TargetIsOn) &&
                   TargetPosition.Equals(other.TargetPosition) &&
                   PlayerPosition.Equals(other.PlayerPosition) &&
                   TrailsOn.Equals(other.TrailsOn) &&
                   TimeStamp.Equals(other.TimeStamp) &&
                   Unknown78hPS2.Equals(other.Unknown78hPS2) &&
                   Unknown7ChPS2.Equals(other.Unknown7ChPS2) &&
                   Unknown90hPS2.Equals(other.Unknown90hPS2) &&
                   UnknownB8hPSP.Equals(other.UnknownB8hPSP) &&
                   UnknownD8hPS2.Equals(other.UnknownD8hPS2) &&
                   UnknownD9hPS2.Equals(other.UnknownD9hPS2));
        }
Beispiel #5
0
 public override void Close()
 {
     base.Close();
     button.SetActive(true);
     MusicVolume.CloseSingleton();
     Controller.state = GameState.Game;
 }
Beispiel #6
0
        public void Break()
        {
            Weapon.OnBeat(false, Combo);

            Combo = 0;
            ComboScale.Set(Combo);
            MusicVolume.Set(0.1f);
        }
Beispiel #7
0
 private void Start()
 {
     // Force mixer to update volumes (does not work in init if init is called too early?)
     MasterVolume.ForceUpdateMixer();
     MusicVolume.ForceUpdateMixer();
     WorldVolume.ForceUpdateMixer();
     UIVolume.ForceUpdateMixer();
 }
Beispiel #8
0
 public override void Open()
 {
     base.Open();
     button.SetActive(false);
     MusicVolume.OpenSingleton();
     TimeController.ChangeState(TimeState.Slow);
     Controller.state = GameState.Pause;
 }
Beispiel #9
0
    private void UpdateMusicVolumn()
    {
        musicSource.volume = MusicVolume / 100.0f;

        var config = Config.Instance;
        var volumn = MusicVolume.ToString();

        config.SetValue("Audio", "MusicVolumn", volumn);
    }
Beispiel #10
0
 private void Start()
 {
     audioS     = GetComponent <AudioSource>();
     clip       = audioS.clip;
     mv         = FindObjectOfType <MusicVolume>();
     speed      = 1;
     sb         = FindObjectOfType <scoreboard>();
     loseScreen = GameObject.Find("LSparent").transform.GetChild(0).gameObject;
 }
Beispiel #11
0
 protected virtual void DoWriteToXml(System.Xml.XmlWriter writer)
 {
     writer.WriteAttributeString("Id", Id.ToString(System.Globalization.CultureInfo.InvariantCulture));
     writer.WriteAttributeString("Title", Title);
     writer.WriteAttributeString("SetsMusicVolume", SetsMusicVolume ? "true" : "false");
     writer.WriteAttributeString("SetsSoundVolume", SetsSoundVolume ? "true" : "false");
     writer.WriteAttributeString("MusicVolume", MusicVolume.ToString(System.Globalization.CultureInfo.InvariantCulture));
     writer.WriteAttributeString("SoundVolume", SoundVolume.ToString(System.Globalization.CultureInfo.InvariantCulture));
 }
 public static void ResetVolumes()
 {
     Mixer.SetFloat("masterVolume", MasterVolume.todB());
     Mixer.SetFloat("effectsVolume", SoundEffectsVolume.todB());
     Mixer.SetFloat("ambianceVolume", AmbienceVolume.todB());
     Mixer.SetFloat("interfaceVolume", InterfaceVolume.todB());
     Mixer.SetFloat("musicVolume", MusicVolume.todB());
     Mixer.SetFloat("dialogueVolume", DialogueVolume.todB());
 }
Beispiel #13
0
 public void Pause()
 {
     if (!Paused)
     {
         MusicVolume.Set(0f);
         Music.Pause();
         Paused = true;
         Visibility.Set(0f);
     }
 }
Beispiel #14
0
        public void Beat()
        {
            Combo++;
            ComboScale.Set(Combo);

            BeatScale = new InterpolatedFloat(1f, 0.25f);
            BeatScale.Set(0f);
            Weapon.OnBeat(true, Combo);
            MusicVolume.Set(0.1f + Utils.Clamp(Combo, 0, 10) * 0.09f);
        }
Beispiel #15
0
        public override void OnInitialized()
        {
            WorldClock.Get.TimeActions.Subscribe(TimeActionType.DaytimeStart, new ActionListener(DaytimeChange));
            WorldClock.Get.TimeActions.Subscribe(TimeActionType.NightTimeStart, new ActionListener(DaytimeChange));
            Player.Get.AvatarActions.Subscribe(AvatarAction.LocationStructureEnter, new ActionListener(LocationStructureEnterOrExit));
            Player.Get.AvatarActions.Subscribe(AvatarAction.LocationStructureExit, new ActionListener(LocationStructureEnterOrExit));
            Player.Get.AvatarActions.Subscribe(AvatarAction.LocationUndergroundEnter, new ActionListener(LocationUndergroundEnterOrExit));
            Player.Get.AvatarActions.Subscribe(AvatarAction.LocationUndergroundExit, new ActionListener(LocationUndergroundEnterOrExit));
            Player.Get.AvatarActions.Subscribe(AvatarAction.SurvivalDangerExit, new ActionListener(DangerExit));
            Player.Get.AvatarActions.Subscribe(AvatarAction.SurvivalDangerEnter, new ActionListener(DangerEnter));

            CurrentMusic  = MusicType.MainMenu;
            CurrentVolume = MusicVolume.Default;
            //StartCoroutine (PlayMusic (CurrentMusic, CurrentVolume));
        }
        public bool Equals(SimpleVariables other)
        {
            if (other == null)
            {
                return(false);
            }

            return(LastMissionPassedName.Equals(other.LastMissionPassedName) &&
                   TimeStamp.Equals(other.TimeStamp) &&
                   SizeOfGameInBytes.Equals(other.SizeOfGameInBytes) &&
                   CurrentLevel.Equals(other.CurrentLevel) &&
                   CameraPosition.Equals(other.CameraPosition) &&
                   MillisecondsPerGameMinute.Equals(other.MillisecondsPerGameMinute) &&
                   LastClockTick.Equals(other.LastClockTick) &&
                   GameClockHours.Equals(other.GameClockHours) &&
                   GameClockMinutes.Equals(other.GameClockMinutes) &&
                   CurrPadMode.Equals(other.CurrPadMode) &&
                   TimeInMilliseconds.Equals(other.TimeInMilliseconds) &&
                   TimeScale.Equals(other.TimeScale) &&
                   TimeStep.Equals(other.TimeStep) &&
                   TimeStepNonClipped.Equals(other.TimeStepNonClipped) &&
                   FrameCounter.Equals(other.FrameCounter) &&
                   TimeStep2.Equals(other.TimeStep2) &&
                   FramesPerUpdate.Equals(other.FramesPerUpdate) &&
                   TimeScale2.Equals(other.TimeScale2) &&
                   OldWeatherType.Equals(other.OldWeatherType) &&
                   NewWeatherType.Equals(other.NewWeatherType) &&
                   ForcedWeatherType.Equals(other.ForcedWeatherType) &&
                   WeatherInterpolation.Equals(other.WeatherInterpolation) &&
                   MusicVolume.Equals(other.MusicVolume) &&
                   SfxVolume.Equals(other.SfxVolume) &&
                   UseVibration.Equals(other.UseVibration) &&
                   StereoOutput.Equals(other.StereoOutput) &&
                   RadioStation.Equals(other.RadioStation) &&
                   Brightness.Equals(other.Brightness) &&
                   ShowSubtitles.Equals(other.ShowSubtitles) &&
                   Language.Equals(other.Language) &&
                   UseWideScreen.Equals(other.UseWideScreen) &&
                   BlurOn.Equals(other.BlurOn) &&
                   CompileDateAndTime.Equals(other.CompileDateAndTime) &&
                   WeatherTypeInList.Equals(other.WeatherTypeInList) &&
                   CameraModeInCar.Equals(other.CameraModeInCar) &&
                   CameraModeOnFoot.Equals(other.CameraModeOnFoot) &&
                   IsQuickSave.Equals(other.IsQuickSave));
        }
        public override void SetListBytes(ref List <byte> listBytes)
        {
            sectionIdentifier = Section.PREF;

            int previousSize = listBytes.Count;

            listBytes.AddRange(((int)SoundMode).Reverse());
            listBytes.AddRange(MusicVolume.Reverse());
            listBytes.AddRange(SfxVolume.Reverse());
            listBytes.AddRange(((int)Rumble).Reverse());

            bytesUsed = listBytes.Count - previousSize;

            for (int i = bytesUsed; i < 0x20; i++)
            {
                listBytes.Add(0xBF);
            }

            blockSize = listBytes.Count - previousSize;
        }
Beispiel #18
0
        public virtual void Update(float deltaTime)
        {
            bool m1 = Mouse.GetState().LeftButton == ButtonState.Pressed;
            bool m2 = Mouse.GetState().RightButton == ButtonState.Pressed;

            if (!Paused)
            {
                if (((m1 && !lastM1) || (m2 && !lastM2)) && !Notes.Any(n => n.CanBeHit()))
                {
                    Break();
                }

                foreach (var note in Notes.ToList())
                {
                    note.Update(deltaTime, m1, lastM1);
                }



                timer += deltaTime;

                if (timer >= maxTime)
                {
                    timer -= maxTime;

                    Notes.Add(new RhythmNote(this));
                }
            }

            ComboScale.Process(deltaTime);
            BeatScale.Process(deltaTime);
            MusicVolume.Process(deltaTime);
            Visibility.Process(deltaTime);

            Music.Volume = MusicVolume * Main.soundVolume;

            lastM1     = m1;
            lastM2     = m2;
            lastPaused = Paused;
        }
Beispiel #19
0
 /// <summary>
 /// Saves settings.
 /// </summary>
 public void SaveSettings()
 {
     PlayerPrefs.SetFloat(SFXVolume.ToString(), SFXVolume);
     PlayerPrefs.SetFloat(MusicVolume.ToString(), MusicVolume);
     Utils.SetBool(MuteAudio.ToString(), MuteAudio);
 }
Beispiel #20
0
    // Inspector

    private void Start()
    {
        Open();
        MusicVolume.OpenSingleton();
        Controller.state = GameState.Menu;
    }
Beispiel #21
0
 private void WriteSettings(XmlWriter writer)
 {
     writer.WriteStartElement("Settings");
     writer.WriteAttributeString("Version", 1.ToString(System.Globalization.CultureInfo.InvariantCulture));
     writer.WriteElementString("MusicDirectory", MusicDirectory);
     writer.WriteElementString("SoundsDirectory", SoundDirectory);
     writer.WriteElementString("LastDownloadLocation", LastDownloadLocation);
     writer.WriteStartElement("WindowLayout");
     writer.WriteRaw(WindowLayout);
     writer.WriteEndElement();
     writer.WriteStartElement("Volumes");
     writer.WriteAttributeString("Overall", GlobalVolume.ToString(System.Globalization.CultureInfo.InvariantCulture));
     writer.WriteAttributeString("Music", MusicVolume.ToString(System.Globalization.CultureInfo.InvariantCulture));
     writer.WriteAttributeString("Sound", SoundVolume.ToString(System.Globalization.CultureInfo.InvariantCulture));
     writer.WriteEndElement();
     writer.WriteStartElement("Network");
     writer.WriteAttributeString("TcpPort", TcpPort.ToString(System.Globalization.CultureInfo.InvariantCulture));
     writer.WriteAttributeString("UdpPort", UdpPort.ToString(System.Globalization.CultureInfo.InvariantCulture));
     writer.WriteAttributeString("IPAddress", IPAddress);
     writer.WriteAttributeString("CheckForUpdate", CheckForUpdate ? "true" : "false");
     writer.WriteAttributeString("Enabled", UseLegacyNetwork ? "true" : "false");
     writer.WriteAttributeString("WebTcpPort", WebTcpPort.ToString(System.Globalization.CultureInfo.InvariantCulture));
     writer.WriteAttributeString("UseWebNetwork", UseWebNetwork ? "true" : "false");
     writer.WriteEndElement();
     RecentFiles.WriteFiles(writer);
     writer.WriteStartElement("Tools");
     writer.WriteElementString("SoundFileEditor", SoundFileEditor);
     writer.WriteElementString("ExternalMusicPlayer", ExternalMusicPlayer);
     writer.WriteEndElement();
     writer.WriteStartElement("Options");
     writer.WriteAttributeString("MessageFilterLevel", MessageFilterLevel.ToString(System.Globalization.CultureInfo.InvariantCulture));
     writer.WriteAttributeString("ShowKeys", ShowKeysInButtons ? "true" : "false");
     writer.WriteAttributeString("GlobalKeyHook", GlobalKeyHook ? "true" : "false");
     writer.WriteAttributeString("OutputDevice", OutputDeviceIndex.ToString(System.Globalization.CultureInfo.InvariantCulture));
     writer.WriteEndElement();
     writer.WriteStartElement("Streaming");
     writer.WriteAttributeString("Active", UseStreaming ? "true" : "false");
     writer.WriteAttributeString("Address", StreamingServerAddress);
     writer.WriteAttributeString("Port", StreamingServerPort.ToString(System.Globalization.CultureInfo.InvariantCulture));
     writer.WriteAttributeString("Password", StreamingPassword);
     writer.WriteAttributeString("Encoding", StreamingEncoder.ToString(System.Globalization.CultureInfo.InvariantCulture));
     writer.WriteAttributeString("StreamName", StreamingStreamName);
     writer.WriteAttributeString("Bitrate", StreamingBitrate.ToString(System.Globalization.CultureInfo.InvariantCulture));
     writer.WriteAttributeString("UserName", StreamingUserName);
     writer.WriteEndElement();
     writer.WriteStartElement("OnlineDB");
     writer.WriteAttributeString("UserId", OnlineDBUserId);
     writer.WriteAttributeString("DialogAfterDownload", ShowDialogAfterDownload ? "true" : "false");
     writer.WriteAttributeString("DialogAfterUpload", ShowDialogAfterUpload ? "true" : "false");
     writer.WriteEndElement();
     writer.WriteStartElement("TagMusicFading");
     writer.WriteAttributeString("FadeTime", TagMusicFadeTime.ToString(System.Globalization.CultureInfo.InvariantCulture));
     writer.WriteAttributeString("FadeOnlyOnChange", TagMusicFadeOnlyOnChange ? "true" : "false");
     writer.WriteEndElement();
     writer.WriteStartElement("Music");
     writer.WriteAttributeString("PlayOnAllSpeakers", PlayMusicOnAllSpeakers ? "true" : "false");
     writer.WriteAttributeString("ButtonFadeMode", ButtonMusicFadeMode.ToString(System.Globalization.CultureInfo.InvariantCulture));
     writer.WriteAttributeString("ButtonFadeTime", ButtonMusicFadeTime.ToString(System.Globalization.CultureInfo.InvariantCulture));
     writer.WriteEndElement();
     writer.WriteStartElement("Controllers");
     writer.WriteAttributeString("LocalPlayerPath", LocalPlayerPath);
     writer.WriteEndElement();
     writer.WriteStartElement("TipOfTheDay");
     writer.WriteAttributeString("ShowTip", ShowTipOfTheDay ? "true" : "false");
     writer.WriteAttributeString("LastTip", LastTipOfTheDay.ToString(System.Globalization.CultureInfo.InvariantCulture));
     writer.WriteEndElement();
     writer.WriteStartElement("Tpm2NetTarget");
     writer.WriteAttributeString("Host", Tpm2NetTargetHost);
     writer.WriteAttributeString("Port", Tpm2NetTargetPort.ToString(System.Globalization.CultureInfo.InvariantCulture));
     writer.WriteEndElement();
     writer.WriteEndElement();
 }
Beispiel #22
0
        public string DescribeValue(GameMode mode, IDs option)
        {
            switch (option)
            {
            case IDs.GAME_AGGRESSIVE_HUNGRY_CIVILIANS:
                return(IsAggressiveHungryCiviliansOn ? "ON    (default ON)" : "OFF   (default ON)");

            case IDs.GAME_ALLOW_UNDEADS_EVOLUTION:
                return(AllowUndeadsEvolution ? "YES   (default YES)" : "NO    (default YES)");

            case IDs.GAME_CITY_SIZE:
                return(String.Format("{0:D2}*   (default {1:D2})", CitySize, GameOptions.DEFAULT_CITY_SIZE));

            case IDs.GAME_DAY_ZERO_UNDEADS_PERCENT:
                return(String.Format("{0:D3}%  (default {1:D3}%)", DayZeroUndeadsPercent, GameOptions.DEFAULT_DAY_ZERO_UNDEADS_PERCENT));

            case IDs.GAME_DEATH_SCREENSHOT:
                return(IsDeathScreenshotOn ? "YES   (default YES)" : "NO    (default YES)");

            case IDs.GAME_DISTRICT_SIZE:
                return(String.Format("{0:D2}*   (default {1:D2})", DistrictSize, GameOptions.DEFAULT_DISTRICT_SIZE));

            case IDs.GAME_MAX_CIVILIANS:
                return(String.Format("{0:D3}*  (default {1:D3})", MaxCivilians, GameOptions.DEFAULT_MAX_CIVILIANS));

            case IDs.GAME_MAX_DOGS:
                return(String.Format("{0:D3}*  (default {1:D3})", MaxDogs, GameOptions.DEFAULT_MAX_DOGS));

            case IDs.GAME_MAX_REINCARNATIONS:
                return(String.Format("{0:D3}   (default {1:D3})", MaxReincarnations, GameOptions.DEFAULT_MAX_REINCARNATIONS));

            case IDs.GAME_MAX_UNDEADS:
                return(String.Format("{0:D3}*  (default {1:D3})", MaxUndeads, GameOptions.DEFAULT_MAX_UNDEADS));

            case IDs.GAME_NATGUARD_FACTOR:
                return(String.Format("{0:D3}%  (default {1:D3}%)", NatGuardFactor, GameOptions.DEFAULT_NATGUARD_FACTOR));

            case IDs.GAME_NPC_CAN_STARVE_TO_DEATH:
                return(NPCCanStarveToDeath ? "YES   (default YES)" : "NO    (default YES)");

            case IDs.GAME_PERMADEATH:
                return(IsPermadeathOn ? "YES   (default NO)" : "NO    (default NO)");

            case IDs.GAME_RATS_UPGRADE:
                return(RatsUpgrade ? "YES   (default NO)" : "NO    (default NO)");

            case IDs.GAME_REINC_LIVING_RESTRICTED:
                return(IsLivingReincRestricted ? "YES   (default NO)" : "NO    (default NO)");

            case IDs.GAME_REINCARNATE_AS_RAT:
                return(CanReincarnateAsRat ? "YES   (default NO)" : "NO    (default NO)");

            case IDs.GAME_REINCARNATE_TO_SEWERS:
                return(CanReincarnateToSewers ? "YES   (default NO)" : "NO    (default NO)");

            case IDs.GAME_REVEAL_STARTING_DISTRICT:
                return(RevealStartingDistrict ? "YES   (default YES)" : "NO    (default YES)");

            case IDs.GAME_SHAMBLERS_UPGRADE:
                return(ShamblersUpgrade ? "YES   (default NO)" : "NO    (default NO)");

            case IDs.GAME_SKELETONS_UPGRADE:
                return(SkeletonsUpgrade ? "YES   (default NO)" : "NO    (default NO)");

            case IDs.GAME_SIM_THREAD:
                return(SimThread ? "YES*  (default YES)" : "NO*   (default YES)");

            case IDs.GAME_SIMULATE_DISTRICTS:
                return(String.Format("{0,-4}* (default {1})", GameOptions.Name(SimulateDistricts), GameOptions.Name(GameOptions.DEFAULT_SIM_DISTRICTS)));

            case IDs.GAME_SIMULATE_SLEEP:
                return(SimulateWhenSleeping ? "YES*  (default NO)" : "NO*   (default NO)");

            case IDs.GAME_STARVED_ZOMBIFICATION_CHANCE:
                return(String.Format("{0:D3}%  (default {1:D3}%)", StarvedZombificationChance, GameOptions.DEFAULT_STARVED_ZOMBIFICATION_CHANCE));

            case IDs.GAME_SUPPLIESDROP_FACTOR:
                return(String.Format("{0:D3}%  (default {1:D3}%)", SuppliesDropFactor, GameOptions.DEFAULT_SUPPLIESDROP_FACTOR));

            case IDs.GAME_ZOMBIE_INVASION_DAILY_INCREASE:
                return(String.Format("{0:D3}%  (default {1:D3}%)", ZombieInvasionDailyIncrease, GameOptions.DEFAULT_ZOMBIE_INVASION_DAILY_INCREASE));

            case IDs.GAME_ZOMBIFICATION_CHANCE:
                return(String.Format("{0:D3}%  (default {1:D3}%)", ZombificationChance, GameOptions.DEFAULT_ZOMBIFICATION_CHANCE));

            case IDs.GAME_UNDEADS_UPGRADE_DAYS:
                return(String.Format("{0:D3}   (default {1:D3})", GameOptions.Name(ZombifiedsUpgradeDays), GameOptions.Name(GameOptions.DEFAULT_ZOMBIFIEDS_UPGRADE_DAYS)));

            case IDs.UI_ADVISOR:
                return(IsAdvisorEnabled ? "YES" : "NO ");

            case IDs.UI_ANIM_DELAY:
                return(IsAnimDelayOn ? "ON " : "OFF");

            case IDs.UI_COMBAT_ASSISTANT:
                return(IsCombatAssistantOn ? "ON    (default OFF)" : "OFF   (default OFF)");

            case IDs.UI_MUSIC:
                return(PlayMusic ? "ON " : "OFF");

            case IDs.UI_MUSIC_VOLUME:
                return(MusicVolume.ToString() + "%");

            case IDs.UI_SHOW_MINIMAP:
                return(IsMinimapOn ? "ON " : "OFF");

            case IDs.UI_SHOW_PLAYER_TAG_ON_MINIMAP:
                return(ShowPlayerTagsOnMinimap ? "YES" : "NO ");

            case IDs.UI_SHOW_PLAYER_TARGETS:
                return(ShowPlayerTargets ? "ON    (default ON)" : "OFF   (default ON)");

            case IDs.UI_SHOW_TARGETS:
                return(ShowTargets ? "ON    (default ON)" : "OFF   (default ON)");

            case IDs.GAME_AUTOSAVE_PERIOD:
                return(String.Format("{0,-4}  (default {1}h)",
                                     m_AutoSavePeriodInHours == 0 ? "OFF" : m_AutoSavePeriodInHours.ToString() + "h",
                                     GameOptions.DEFAULT_AUTOSAVE_PERIOD));

            default:
                return("???");
            }
        }
Beispiel #23
0
        public void UpdateMusicState()
        {
            //Debug.Log ("Updating music state");
            MusicType   shouldBePlaying   = MusicType.Regional;
            MusicVolume musicTargetVolume = MusicVolume.Quiet;

            PlayList.Regional    = GameWorld.Get.CurrentRegion.DayMusic;
            PlayList.Night       = GameWorld.Get.CurrentRegion.NightMusic;
            PlayList.Underground = GameWorld.Get.CurrentRegion.UndergroundMusic;
            bool               isDaytime    = WorldClock.IsDay;
            PlayerStatus       status       = Player.Local.Status;
            PlayerSurroundings surroundings = Player.Local.Surroundings;

            if (surroundings.IsInDanger)
            {
                //same day or night
                //Debug.Log ("We're in danger - should be playing combat");
                shouldBePlaying = MusicType.Combat;
            }
            else if (surroundings.IsInSafeLocation)
            {
                //same day or night
                shouldBePlaying = MusicType.SafeLocation;
            }
            else if (surroundings.IsUnderground)
            {
                //same day or night
                shouldBePlaying = MusicType.Underground;
            }
            else
            {
                if (isDaytime)
                {
                    shouldBePlaying = MusicType.Regional;
                    if (surroundings.IsInsideStructure)
                    {
                        musicTargetVolume = MusicVolume.Quiet;
                    }
                    else
                    {
                        musicTargetVolume = MusicVolume.Default;
                    }
                }
                else
                {
                    //night
                    shouldBePlaying = MusicType.Night;
                    if (surroundings.IsInsideStructure)
                    {
                        musicTargetVolume = MusicVolume.Quiet;
                    }
                    else
                    {
                        musicTargetVolume = MusicVolume.Default;
                    }
                }
            }

            bool updateMusic = false;

            if (shouldBePlaying == MusicType.Regional && mPreviousRegionalTrack != PlayList.Regional)
            {
                //Debug.Log ("Switching regional music to " + PlayList.Regional);
                mPreviousRegionalTrack = PlayList.Regional;
                updateMusic            = true;
            }
            else if (shouldBePlaying == MusicType.Night && mPreviousNightTrack != PlayList.Night)
            {
                //Debug.Log ("Switching night music to " + PlayList.Night);
                mPreviousNightTrack = PlayList.Night;
                updateMusic         = true;
            }
            else if (shouldBePlaying != CurrentMusic)
            {
                updateMusic = true;
            }

            if (updateMusic)
            {
                //Debug.Log("AUDIO MANAGER: Trying to switch music to " + shouldBePlaying.ToString());
                StartCoroutine(PlayMusic(shouldBePlaying, musicTargetVolume));
            }
        }
Beispiel #24
0
        public IEnumerator PlayMusic(MusicType music, MusicVolume volume)
        {
            //TEMP
            //TODO UNITY 5
            yield break;
            //TEMP

            while (!Manager.IsAwake <Mods> ())
            {
                yield return(null);
            }

            CurrentMusic  = music;
            CurrentVolume = volume;

            while (mUpdatingMusicFade)
            {
                yield return(null);
            }

            //see if we're still needed
            if (CurrentMusic != music)
            {
                //Debug.Log("AUDIOMANAGER: whoops, we got changed in the meantime, no longer trying to play " + music.ToString());
                yield break;
            }
            //start updating!
            mUpdatingMusicFade = true;

            //figure out which clip we're using
            string fileName = PlayList.GetByType(music);

            //this is the audio source we're fading out
            FadingOutAudio = ActiveMusic;
            if (FadingOutAudio == Music2)
            {
                FadingInAudio = Music1;
            }
            else
            {
                FadingInAudio = Music2;
            }
            if (music == MusicType.MainMenu)
            {
                FadingInAudio.loop = false;
            }
            else
            {
                FadingInAudio.loop = true;
            }
            yield return(null);

            //load the new clip
            FadeInAudioTargetVolume = 1.0f;
            if (volume == MusicVolume.Quiet)
            {
                FadeInAudioTargetVolume = 0.5f;
            }

            //reset fade in audio
            FadingInAudio.volume = 0f;
            //if it has a clip destroy it to prevent memory leaks
            if (FadingInAudio.clip != null && FadingInAudio.clip.name != fileName)
            {
                FadingInAudio.Stop();
                //Debug.Log("Destroying clip " + FadingInAudio.clip.name + " because it doesn't match " + fileName);
                GameObject.Destroy(FadingInAudio.clip);
                FadingInAudio.clip = null;
            }

            if (FadingInAudio.clip == null)
            {
                string fullPath = Mods.Get.Runtime.FullPath(fileName, "Music", Frontiers.Data.GameData.IO.gAudioExtension, DataType.World);
                if (!System.IO.File.Exists(fullPath))
                {
                    fullPath = Mods.Get.Runtime.FullPath(fileName, "Music", Frontiers.Data.GameData.IO.gAudioExtension, DataType.Base);
                }
                if (!System.IO.File.Exists(fullPath))
                {
                    Debug.Log("AUDIO MANAGER: Couldn't find music " + fullPath);
                    mUpdatingMusicFade = false;
                    yield break;
                }

                WWW loader = null;
                //Debug.Log(fullPath);
                loader = new WWW("file:///" + System.Uri.EscapeDataString(fullPath));
                //Debug.Log("AUDIO MANAGER: loading " + fullPath);
                //TODO UNITY 5
                try {
                    FadingInAudio.clip = loader.GetAudioClip(false, true, AudioType.OGGVORBIS);
                } catch (Exception e) {
                    Debug.Log("AUDIO MANAGER: ERROR when loading audio clip: " + e.ToString());
                    yield break;
                }
                if (!string.IsNullOrEmpty(loader.error))
                {
                    Debug.Log("AUDIO MANAGER: ERROR when loading audio clip: " + loader.error);
                    loader.Dispose();
                    //GameObject.Destroy(loader);
                    loader             = null;
                    mUpdatingMusicFade = false;
                    yield break;
                }
                FadingInAudio.clip.name = fileName;                //convenience

                while (!loader.isDone)
                {
                    if (loader == null)
                    {
                        Debug.Log("AUDIO MANAGER: Loader was NULL in audio manager, quitting");
                        mUpdatingMusicFade = false;
                        yield break;
                    }
                    double waitUntil = WorldClock.RealTime + 0.1f;
                    while (WorldClock.RealTime < waitUntil)
                    {
                        yield return(null);
                    }
                    yield return(null);
                }
                //also kill the loader since we don't need it any more
                if (loader != null)
                {
                    loader.Dispose();
                    //GameObject.Destroy(loader);
                    loader = null;
                }
            }
            if (!FadingInAudio.isPlaying)
            {
                Debug.Log("AUDIO MANAGER: Playing audio clip " + FadingInAudio.clip.name);
                FadingInAudio.Play();
            }

            bool  doneFadingIn            = false;
            bool  doneFadingOut           = false;
            float fadeInTargetAudioVolume = FadeInAudioTargetVolume;

            while (!(doneFadingIn && doneFadingOut))
            {
                //fade in new audio over time
                if (!GameManager.Is(FGameState.GameLoading))
                {
                    float musicCrossFadeSpeed = Globals.MusicCrossfadeSpeed;
                    if (CurrentMusic != music)
                    {
                        //whoops, we're waiting on something to load, make it fade faster
                        musicCrossFadeSpeed *= 5;
                    }

                    FadingInAudio.volume = Mathf.Clamp01(Mathf.Lerp(FadingInAudio.volume, fadeInTargetAudioVolume, (float)(WorldClock.RTDeltaTimeSmooth * musicCrossFadeSpeed)));
                    doneFadingIn         = Mathf.Abs(FadingInAudio.volume - fadeInTargetAudioVolume) < 0.01f;
                    //fade out existing audio over time
                    if (FadingOutAudio != null)
                    {
                        FadingOutAudio.volume = Mathf.Clamp01(Mathf.Lerp(FadingOutAudio.volume, 0f, (float)(WorldClock.RTDeltaTimeSmooth * musicCrossFadeSpeed)));
                        doneFadingOut         = (FadingOutAudio.volume < 0.01f);
                    }
                    else
                    {
                        doneFadingOut = true;
                    }
                }
                yield return(null);
            }
            //before we leave set everything one last time
            //and destroy the fading out clip
            FadingInAudio.volume = FadeInAudioTargetVolume;
            if (FadingOutAudio != null)
            {
                FadingOutAudio.volume = 0f;
            }
            FadingOutAudio     = null;
            mUpdatingMusicFade = false;
            yield break;
        }