Пример #1
0
        public static void Create(string serverTitle, string password, int maxPlayerCount)
        {
            UnityEngine.Network.InitializeSecurity();
            try
            {
                G.Sys.NetworkingManager_.password_       = password;
                G.Sys.NetworkingManager_.serverTitle_    = serverTitle;
                G.Sys.NetworkingManager_.maxPlayerCount_ = maxPlayerCount;

                G.Sys.GameData_.SetString("ServerTitleDefault", serverTitle);
                G.Sys.GameData_.SetInt("MaxPlayersDefault", maxPlayerCount);

                var ncError = UnityEngine.Network.InitializeServer(maxPlayerCount - 1, 32323, true);

                if (ncError == NetworkConnectionError.NoError)
                {
                    StaticEvent <ServerCreatedEventArgs> .Broadcast(new ServerCreatedEventArgs(serverTitle, password, maxPlayerCount));

                    return;
                }

                Log.Error("Failed to start server");
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message);
            }
        }
Пример #2
0
        private void EnableCheats(bool byToggle)
        {
            var localCar = PlayerDataLocal.localCar_;

            localCar.invincible_ = true;
            localCar.minInstaRespawnTriggerTime_ = 0;
            localCar.minInstaRespawnTime_        = 0;

            var boost = localCar.GetComponent <BoostGadget>();

            boost.accelerationMul_ = 3;
            boost.heatUpRate_      = 0;

            if (byToggle)
            {
                JetsGadget.thrusterBoostFullPowerLimit_ = 3;
                JetsGadget.thrusterBoostDepletedLimit_  = 3;
            }

            foreach (var gadget in localCar.GetComponents <Gadget>())
            {
                gadget.SetAbilityEnabled(true, false);
            }

            if (byToggle)
            {
                // send the funny chat message
                const string MESSAGE = "I just turned cheats on. My leaderboard stuff wont be submitted. Make fun of me :)";
                StaticEvent <ChatSubmitMessage.Data> .Broadcast(new ChatSubmitMessage.Data(MESSAGE));
            }
        }
Пример #3
0
        internal static IEnumerator PatchCoroutine(HalloweenAudioLogic __instance)
        {
            for (; ;)
            {
                float randomShortTime = Random.Range(0.1f, 1.5f);
                float randomLongTime  = Random.Range(5f, 10f);

                if (__instance.vhs_)
                {
                    __instance.vhs_.enabled = false;
                }

                if (__instance.glitch_)
                {
                    __instance.glitch_.enabled = false;
                }

                AudioManager.PostEvent("Enable_Bypass_Darkness_Insane");

                if (__instance.pMan_ && __instance.pMan_.CurrentProfile_ && __instance.pMan_.CurrentProfile_.CarName_ == "Spectrum")
                {
                    __instance.FlickerObjects(true, randomLongTime);
                }

                yield return(new WaitForSeconds(randomLongTime));

                if (__instance.vhs_)
                {
                    __instance.vhs_.enabled = true;
                }

                if (__instance.glitch_)
                {
                    __instance.glitch_.enabled = true;
                }

                AudioManager.PostEvent("Disable_Bypass_Darkness_Insane");

                StaticEvent <VirusSpiritShake.Data> .Broadcast(new VirusSpiritShake.Data(0.075f));

                if (__instance.pMan_ && __instance.pMan_.CurrentProfile_ && __instance.pMan_.CurrentProfile_.CarName_ == "Spectrum")
                {
                    __instance.FlickerObjects(false, randomShortTime);
                }

                yield return(new WaitForSeconds(randomShortTime));
            }
        }
Пример #4
0
        public void AddPersonal(NetworkPlayer p, string message)
        {
            if (p.IsLocal())
            {
                StaticEvent <AddMessage.Data> .Broadcast(new AddMessage.Data(message));
            }
            var personalBuffer = GetPersonalBuffer(p);

            string[] array = message.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.None);
            foreach (string text in array)
            {
                if (text.Length > 0)
                {
                    personalBuffer.Add(text);
                }
            }
        }
Пример #5
0
        public static bool Prefix(AdventureMode __instance)
        {
            string path = Utils.Common.LevelFile;

            __instance.UpdateRaceModeDistanceToFinish();
            if (__instance.hasEnded_ || __instance.GetDisplayTime(0) > 0.0 || __instance.campaignPlusEnabled_)
            {
                return(false);
            }
            __instance.hasEnded_ = true;

            bool flag_a = Utils.Campaign.IsCustomCampaignLevel(path) && Utils.Campaign.GetLevelCountdown(path) > 0;

            flag_a |= !Utils.Campaign.IsCustomCampaignLevel(path);

            if (!__instance.countdownDisabled_ && flag_a)
            {
                int             currentPlaylistIndex = __instance.gameMan_.GetCurrentPlaylistIndex();
                PlayerDataLocal firstLocalPlayer     = PlayerDataLocal.FirstLocalPlayer_;

                bool flag_b = !Utils.Campaign.IsCustomCampaignLevel(path) && (currentPlaylistIndex == 0 || currentPlaylistIndex == __instance.gameMan_.LevelPlaylist_.Count_ - 1);

                if (flag_b || __instance.HasFinished(firstLocalPlayer) || firstLocalPlayer is null || (firstLocalPlayer.Car_ is null || __instance.finishTriggerObj_ is null))
                {
                    return(false);
                }
                __instance.finishTriggerObj_.transform.position = firstLocalPlayer.Car_.transform.position;
                __instance.finishTriggerObj_.SetActive(true);
            }
            else
            {
                StaticEvent <ZEvent.Data> .Broadcast(new ZEvent.Data("AdventureModeClockHitZero", true));
            }

            return(false);
        }
Пример #6
0
        public void AnalyzeData(Music music)
        {
            music.GetFFTSuperPosition(AudioResources.audioBufferArrayInS_);

            var num3 = Mathf.Log10(512);

            for (var i = 0; i < 512; i++)
            {
                AudioResources.audioBufferArrayInSSmooth_[i] = AudioResources.audioBufferArrayInSSmooth_[i] * 0.4f + AudioResources.audioBufferArrayInS_[i] * 0.6f;
                if (AudioResources.audioBufferArrayInS_[i] > AudioResources.audioBufferArrayInSPeak_[i])
                {
                    AudioResources.audioBufferArrayInSPeak_[i] = AudioResources.audioBufferArrayInS_[i];
                }
                int   num4 = (int)(Mathf.Log10(i + 1) * 512 / num3);
                int   num5 = (int)(Mathf.Log10(i + 2) * 512 / num3);
                float num6 = num5 - num4;
                for (int j = num4; j < num5; j++)
                {
                    float num7 = Mathf.Lerp(AudioResources.AudioBufferArray_[i] / AudioResources.AudioBufferPeakArray_[i], AudioResources.AudioBufferArray_[i + 1] / AudioResources.AudioBufferPeakArray_[i + 1], (j - num4) / num6);
                    float num8 = Mathf.Log10(num7 + 1f) * 512 / num3;
                    G.Sys.AudioManager_.ProcessedData_[j] = num8;
                }
            }

            float num9 = 0f;

            AudioResources.qSamples = 512;
            for (int i = 0; i < (int)(AudioResources.qSamples * 0.33f); i++)
            {
                AudioResources.dbValueL += G.Sys.AudioManager_.ProcessedData_[i];
                num9 += 1f;
            }
            AudioResources.dbValueL = Mathf.Clamp01(AudioResources.dbValueL / (num9 * 25f));
            num9 = 0f;
            for (int i = (int)(AudioResources.qSamples * 0.33f); i < (int)(AudioResources.qSamples * 0.66f); i++)
            {
                AudioResources.dbValueM += G.Sys.AudioManager_.ProcessedData_[i];
                num9 += 1f;
            }
            AudioResources.dbValueM = Mathf.Clamp01(AudioResources.dbValueM / (num9 * 25f));
            num9 = 0f;

            for (int i = (int)(AudioResources.qSamples * 0.66f); i < AudioResources.qSamples; i++)
            {
                AudioResources.dbValueH += G.Sys.AudioManager_.ProcessedData_[i];
                num9 += 1f;
            }

            AudioResources.dbValueH = Mathf.Clamp01(AudioResources.dbValueH / (num9 * 25f));

            if (AudioResources.dbValueL < 0f)
            {
                AudioResources.dbValueL = 0f;
            }

            if (AudioResources.dbValueM < 0f)
            {
                AudioResources.dbValueM = 0f;
            }

            if (AudioResources.dbValueH < 0f)
            {
                AudioResources.dbValueH = 0f;
            }

            G.Sys.AudioManager_.smoothH = AudioResources.dbValueH * 2;
            G.Sys.AudioManager_.smoothM = AudioResources.dbValueM * 2;
            G.Sys.AudioManager_.smoothL = AudioResources.dbValueL * 2;

            if (G.Sys.OptionsManager_.General_.BoomBoxMode_)
            {
                float num10 = G.Sys.OptionsManager_.General_.BoomBoxIntensity_;
                float num11 = G.Sys.OptionsManager_.General_.BoomBoxShakeIntensity_;
                float num12 = AudioResources.dbValueL;
                float num13 = num10 * num12 * 4f;
                float num14 = num11 * num12 * 4f;

                if (num13 > 1.5f)
                {
                    AudioResources.bloomVal_ = num13;
                }

                if (num14 > 1.5f)
                {
                    StaticEvent <VirusSpiritShake.Data> .Broadcast(new VirusSpiritShake.Data(num14 / 35f));
                }

                if (GameManager.IsInMainMenuScene_)
                {
                    foreach (PlayerDataBase current in PlayerDataBase.Players_)
                    {
                        current.GlowColor_ = current.OriginalGlowColor_ * num13;
                    }
                }
            }

            if (AudioResources.bloomVal_ > 0.5f)
            {
                AudioResources.bloomVal_ = Mathf.Clamp(AudioResources.bloomVal_ - Time.deltaTime * 2f, 0.5f, 2f);

                foreach (Camera current2 in OptimizationManager.Cameras_)
                {
                    Bloom component = current2.GetComponent <Bloom>();
                    if (component)
                    {
                        component.bloomIntensity = AudioResources.bloomVal_;
                    }
                }
            }
        }
Пример #7
0
 public static void SendAction(string actionMessage)
 {
     StaticEvent <PlayerActionMessage.Data> .Broadcast(new PlayerActionMessage.Data(" " + actionMessage));
 }
Пример #8
0
 public static void SendMessage(string message)
 {
     StaticEvent <ChatSubmitMessage.Data> .Broadcast(new ChatSubmitMessage.Data(message));
 }