Ejemplo n.º 1
0
    protected override void Awake()
    {
        base.Awake();
        this.m_audioLocation         = Path.Combine(DataLocation.gameContentPath, "Audio");
        this.m_currentMusicFile      = null;
        this.m_previousMusicFile     = null;
        this.m_streamCrossFade       = 0;
        this.m_listenerInfo          = new AudioManager.ListenerInfo();
        this.m_defaultGroup          = new AudioGroup(3, new SavedFloat(Settings.uiAudioVolume, Settings.gameSettingsFile, DefaultSettings.uiAudioVolume, true));
        this.m_ambientGroup          = new AudioGroup(3, new SavedFloat(Settings.ambientAudioVolume, Settings.gameSettingsFile, DefaultSettings.ambientAudioVolume, true));
        this.m_serviceProximity      = new float[21];
        this.m_subServiceProximity   = new float[20];
        this.m_eventBuffer           = new FastList <AudioManager.SimulationEvent>();
        this.m_mainAudioVolume       = new SavedFloat(Settings.mainAudioVolume, Settings.gameSettingsFile, DefaultSettings.mainAudioVolume, true);
        this.m_musicAudioVolume      = new SavedFloat(Settings.musicAudioVolume, Settings.gameSettingsFile, DefaultSettings.musicAudioVolume, true);
        this.m_tempBuffer1           = new byte[16384];
        this.m_tempBuffer2           = new byte[16384];
        this.m_streamBuffer          = new float[65536];
        this.m_streamLock            = new object();
        this.m_streamThread          = new Thread(new ThreadStart(this.StreamThread));
        this.m_streamThread.Name     = "Music Stream";
        this.m_streamThread.Priority = ThreadPriority.AboveNormal;
        this.m_streamThread.Start();
        if (!this.m_streamThread.IsAlive)
        {
            CODebugBase <LogChannel> .Error(LogChannel.Core, "Audio stream thread failed to start!");
        }
        GameObject gameObject = new GameObject("Audio Listener");

        Object.DontDestroyOnLoad(gameObject);
        this.m_audioListener         = gameObject.AddComponent <AudioListener>();
        this.m_audioListener.enabled = false;
        gameObject.AddComponent <MusicFilter>();
    }
Ejemplo n.º 2
0
 void LoadSaved()
 {
     try
     {
         SettingsFile settingsfile = new SettingsFile();
         settingsfile.fileName = FireworksMod.settingsfilename;
         GameSettings.AddSettingsFile(settingsfile);
         //FireworksUI.Init();
         LogMsg("file created");
     }
     catch (Exception ex)
     {
         LogErr(ex.ToString() + ex.StackTrace);
     }
     btnX       = new SavedFloat("btnx", FireworksMod.settingsfilename, 100);
     btnY       = new SavedFloat("btny", FireworksMod.settingsfilename, 100);
     panelX     = new SavedFloat("panelx", FireworksMod.settingsfilename, 200);
     panelY     = new SavedFloat("panely", FireworksMod.settingsfilename, 100);
     colorR     = new SavedFloat("colorr", FireworksMod.settingsfilename, 255);
     colorG     = new SavedFloat("colorg", FireworksMod.settingsfilename, 255);
     colorB     = new SavedFloat("colorb", FireworksMod.settingsfilename, 255);
     heightFrom = new SavedFloat("heightfrom", FireworksMod.settingsfilename, 50);
     heightTo   = new SavedFloat("heightto", FireworksMod.settingsfilename, 60);
     mulExpVel  = new SavedFloat("mulexpvel", FireworksMod.settingsfilename, 0);
     mulSize    = new SavedFloat("mulsize", FireworksMod.settingsfilename, 0);
     defaultstyle.height_from       = heightFrom.value;
     defaultstyle.height_to         = heightTo.value;
     defaultstyle.mul_exp_vel       = Mathf.Pow(10, mulExpVel.value);
     defaultstyle.mul_particle_size = Mathf.Pow(10, mulSize.value);
     hotkey = new SavedInputKey("key", FireworksMod.settingsfilename, SavedInputKey.Encode(KeyCode.F, true, true, false));
 }
Ejemplo n.º 3
0
 public mySavedFloat(string name, float defaultvalue)
 {
     f = new SavedFloat(name, Settings.gameSettingsFile, defaultvalue, true);
     if (!CSLStatsPanelConfigSettings.configurationsettings.Contains(f))
     {
         CSLStatsPanelConfigSettings.configurationsettings.Add(f);
     }
 }
Ejemplo n.º 4
0
        static bool Prefix(
            CameraController __instance,

            Camera ___m_camera,

            float ___m_originalNearPlane,
            float ___m_originalFarPlane,

            SavedFloat ___m_ShadowsDistance
            )
        {
            if (!App.Instance.IsDive)
            {
                return(true);
            }

            ___m_camera.nearClipPlane = Mathf.Max(___m_originalNearPlane, __instance.m_currentSize * 0.005f);
            ___m_camera.farClipPlane  = Mathf.Max(___m_originalFarPlane, __instance.m_currentSize * 2f);
            float num      = __instance.m_currentSize * Mathf.Max(0f, 1f - __instance.m_currentHeight / __instance.m_maxDistance) / Mathf.Tan(0.0174532924f * ___m_camera.fieldOfView);
            var   rotation = Quaternion.AngleAxis(__instance.m_currentAngle.x, Vector3.up) * Quaternion.AngleAxis(__instance.m_currentAngle.y, Vector3.right);
            var   vector   = __instance.m_currentPosition; // + rotation * new Vector3(0f, 0f, 0f - num);

            //float heightOfs = 0;
            //CalculateCameraHeightOffsetPatch.Prefix(__instance, ref heightOfs, vector, num);
            //vector.y += heightOfs;

            //vector = ___instance.ClampCameraPosition(vector);

            vector += __instance.m_cameraShake * Mathf.Sqrt(num);
            __instance.transform.rotation = rotation;
            __instance.transform.position = vector;

            float t    = Mathf.Clamp01(num / __instance.m_maxDistance * 5f / 6f);
            float num2 = 1f;

            if (___m_ShadowsDistance.value == 0)
            {
                num2 = 0.7f;
            }
            else if (___m_ShadowsDistance.value == 1)
            {
                num2 = 1f;
            }
            else if (___m_ShadowsDistance.value == 2)
            {
                num2 = 2f;
            }
            else if (___m_ShadowsDistance.value == 3)
            {
                num2 = 4f;
            }

            QualitySettings.shadowDistance = Mathf.Lerp(__instance.m_minShadowDistance * num2, __instance.m_maxShadowDistance * num2, t);
            Singleton <RenderManager> .instance.CameraHeight   = Mathf.Max(num * Mathf.Sin(__instance.m_currentAngle.y * 0.0174532924f), num * 0.168749988f);
            Singleton <RenderManager> .instance.ShadowDistance = 200f;
            return(false);
        }
Ejemplo n.º 5
0
 public SoundEffectOptions(string effectName, float defaultVolume)
 {
     this.effectName    = effectName;
     this.defaultVolume = defaultVolume;
     savedVolume        = new SavedFloat(effectName.Replace(" ", "") + "Volume", "VehicleEffectsMod", defaultVolume, true);
 }
Ejemplo n.º 6
0
        private static void AddFloatField(UIHelper group, string label, SavedFloat saved, float?defaultValue, float?min = null, float?max = null, Action onSubmit = null)
        {
            UITextField field = null;

            field = group.AddTextfield(label, saved.ToString(), OnChanged, OnSubmitted) as UITextField;