Пример #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
    public override void TriggerEvent()
    {
        if (dynamicCameraHorizontal)
        {
            StaticEvent.LoadLevel(new LevelRequirement(newPlayerPosition, newCameraPosition, level, dynamicCameraHorizontal, cameraLeftThreshold, cameraRightThreshold, cameraSize));
        }
        else
        {
            StaticEvent.LoadLevel(new LevelRequirement(newPlayerPosition, newCameraPosition, level, cameraSize));
        }

        if (levelMusic.Any())
        {
            ResetSceneMusic();
        }
        if (tasteAudio != null)
        {
            if (!removeTasteAudio)
            {
                AddTasteAudio();
            }
            else
            {
                RemoveTasteAudio();
            }
        }
    }
        public async Task Login(object parameter)
        {
            await RunCommand(() => this.LoginIsRunning, async() => {
                LoginButtonContent = "Login...";
                OnPropertyChanged("LoginButtonContent");
                var email = this.Email;
                var pass  = (parameter as IHavePassword).SecurePassword.Unsecure();
                DataManagers.account.account      = email;
                DataManagers.account.AccountReady = false;
                DataManagers.account.password     = pass;

                var Client = DataBaseManager.Instance.DataBaseClient;
                Client.Connect(Config.ConnectionStringEDP, 1433, "f");
                var Data = Client.GetServerDataByAccount(email).FirstOrDefault();
                if (Data.Password == pass)
                {
                    DataManagers.account.Complex  = Data;
                    DataManagers.account.UserID   = Data.id.ToString();
                    DataManagers.account.UserName = Data.Name;
                    StaticEvent.OnLoginEvent();
                }

                if (!Directory.Exists(@"C:\EDP\LocalData"))
                {
                    Directory.CreateDirectory(@"C:\EDP\LocalData");
                }

                File.WriteAllText(@"C:\EDP\LocalData\LocalContainer.json", email + "|" + pass);
            });
        }
Пример #4
0
 private void OnStaticEvent()
 {
     if (StaticEvent != null)
     {
         StaticEvent.BeginInvoke(null, null, null, null);
     }
 }
Пример #5
0
        public static StaticEvent <T> .Delegate removeParticularSubscriber <T>(MonoBehaviour component)
        {
            SubscriberList list = (SubscriberList)component
                                  .GetType()
                                  .GetField(
                "subscriberList_",
                BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static
                )
                                  .GetValue(component);

            StaticEvent <T> .Delegate func = null;
            var index = 0;

            foreach (var subscriber in list)
            {
                if (subscriber is StaticEvent <T> .Subscriber)
                {
                    func = (StaticEvent <T> .Delegate)subscriber
                           .GetType()
                           .GetField(
                        "func_",
                        BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static
                        )
                           .GetValue(subscriber);
                    subscriber.Unsubscribe();
                    break;
                }
                index++;
            }
            if (func != null)
            {
                list.RemoveAt(index);
            }
            return(func);
        }
Пример #6
0
 public void StartDialogue(GameObject dialogueTarget)
 {
     conversationEnsues = true;
     conversationCount  = 0;
     StaticEvent.StartDialogue(gameObject, true);
     manager.StartDialogue(objectiveDialogue[0], false);
 }
Пример #7
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));
            }
        }
Пример #8
0
        public void SubwayCarFlashStart()
        {
            var subwayCarFlashLR = LevelRequirements.PresetLevelRequirements["SubwayCarFlash"];

            subwayCarFlashLR.defaultCameraPosition = SubwayFlashPos.transform.position;
            SetCamera(subwayCarFlashLR);
            SetFader("fadeFastOpen");
            StaticEvent.CameraShake(3, 0.15f);
        }
Пример #9
0
        public void MysteryManSceneStart()
        {
            var mysteryManLR = LevelRequirements.PresetLevelRequirements["MysteryManIntro"];

            mysteryManLR.defaultCameraPosition = MysteryManCamPos.transform.position;
            SetCamera(mysteryManLR);
            SetFader("fadeSlowBlinkOpen");
            StaticEvent.CameraShake(10, 0.01f);

            MysteryMan.transform.position = MysteryManPos.transform.position;
        }
Пример #10
0
    // Use this for initialization
    void Start()
    {
        glitches     = new List <Action>();
        effectLength = 5f;
        glitches.Add(TeleportPlayer);
        glitches.Add(ShrinkPlayer);
        glitches.Add(ReverseControls);
        staticEvent = FindObjectOfType <StaticEvent>();

        originalSize = new Vector3(1.0f, 1.0f, 1.0f);
    }
Пример #11
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));
            }
        }
Пример #12
0
        public void PatchPostLoad(bool subscribe)
        {
            var audioManager = G.Sys.AudioManager_;

            RemoveParticularSubscriber <Events.Level.PostLoad.Data>(audioManager);

            var list = G.Sys.AudioManager_.subscriberList_;

            var item = new StaticEvent <Events.Level.PostLoad.Data> .Subscriber(new StaticEvent <Events.Level.PostLoad.Data> .Delegate(data => G.Sys.AudioManager_.OnEventPostLoad(data)));

            list.Add(item);

            if (subscribe)
            {
                (item as IEventSubscriber)?.Subscribe();
            }
        }
Пример #13
0
    // Use this for initialization
    void Start()
    {
        bsod              = crash = windows = intialStart = firstGlitch = false;
        intialTimer       = nextGlitchTimer = 0f;
        timeToFirstGlitch = intialDelay + Random.Range(-intialRandomOffset, intialRandomOffset);
        timeToNextGlitch  = 50f;

        gc = FindObjectOfType <GameController>();

        bsodEvent    = FindObjectOfType <EventBSOD>();
        windowsEvent = FindObjectOfType <WindowsEvent>();
        crashEvent   = FindObjectOfType <ProgCrashEvent>();
        staticEvent  = FindObjectOfType <StaticEvent>();

        //for testing only
        intialStart = true;
    }
Пример #14
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);
                }
            }
        }
Пример #15
0
 private void LoginWindow_Loaded(object sender, RoutedEventArgs e)
 {
     StaticEvent.LoginEvent += StaticEvent_LoginEvent;
     if (File.Exists(@"C:\EDP\LocalData\LocalContainer.json"))
     {
         var email  = File.ReadAllText(@"C:\EDP\LocalData\LocalContainer.json").Split('|')[0];
         var pass   = File.ReadAllText(@"C:\EDP\LocalData\LocalContainer.json").Split('|')[1];
         var Client = DataBaseManager.Instance.DataBaseClient;
         Client.Connect(Config.ConnectionStringEDP, 1433, "f");
         var Data = Client.GetServerDataByAccount(email).FirstOrDefault();
         if (Data.Password == pass)
         {
             DataManagers.account.Complex  = Data;
             DataManagers.account.UserID   = Data.id.ToString();
             DataManagers.account.UserName = Data.Name;
             StaticEvent.OnLoginEvent();
         }
     }
 }
Пример #16
0
        public static StaticEvent <T> .Delegate removeParticularSubscriber <T>(MonoBehaviour component)
        {
            SubscriberList list = (SubscriberList)PrivateUtilities.getPrivateField(component, "subscriberList_");

            StaticEvent <T> .Delegate func = null;
            var index = 0;

            foreach (var subscriber in list)
            {
                if (subscriber is StaticEvent <T> .Subscriber)
                {
                    func = (StaticEvent <T> .Delegate)PrivateUtilities.getPrivateField(subscriber, "func_");
                    subscriber.Unsubscribe();
                    break;
                }
                index++;
            }
            if (func != null)
            {
                list.RemoveAt(index);
            }
            return(func);
        }
Пример #17
0
    public EventBase GetEvent(int code, int frameCode)
    {
        EventBase eventBase;

        switch ((Events)code)
        {
        case Events.Test:
            eventBase = new TestEvent();
            break;

        case Events.ObjectCreate:
            eventBase = new ObjectCreateEvent(frameCode);
            break;

        case Events.EnemyCreate:
            eventBase = new EnemyCreateEvent(frameCode);
            break;

        case Events.Dialog:
            eventBase = new DialogEvent();
            break;

        case Events.Static:
            eventBase = new StaticEvent();
            break;

        case Events.WaitExtinc:
            eventBase = new WaitExtinc();
            break;

        default:
            eventBase = null;
            break;
        }

        return(eventBase);
    }
Пример #18
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);
        }
Пример #19
0
 public void TestStaticEventInvoke()
 {
     StaticEvent += EventHandler;
     StaticEvent.Invoke();
 }
Пример #20
0
 public void AddEvent(StaticEvent addEvent)
 {
     currentEvents.Add(addEvent);
 }
Пример #21
0
 public static void InvokeStaticEvent()
 {
     StaticEvent?.Invoke();
 }
Пример #22
0
 public override void TriggerEvent()
 {
     isActivated = true;
     StaticEvent.StartDialogue(dialogueTarget);
 }
Пример #23
0
 public static void RaiseStaticEvent(EventArgs eventArgs)
 {
     StaticEvent?.Invoke(null, eventArgs);
 }
Пример #24
0
 public static void RaiseStaticEvent()
 {
     StaticEvent.SafeInvoke(null, () => new ViewModelClosedEventArgs(new TestViewModel(), true));
 }
Пример #25
0
 private void Start()
 {
     StaticEvent.LoadLevel(gameStateData[currentGameState]);
 }
Пример #26
0
 public void InvokeOnButton()
 {
     StaticEvent.Invoke();
     StandartEvent = StandartEvents.ForStandartEvent.StandartEvent;
     StandartEvent.Invoke();
 }
Пример #27
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_;
                    }
                }
            }
        }
Пример #28
0
 public static void SendAction(string actionMessage)
 {
     StaticEvent <PlayerActionMessage.Data> .Broadcast(new PlayerActionMessage.Data(" " + actionMessage));
 }
Пример #29
0
 public static void StaticFireEvent(short arg)
 {
     StaticEvent?.Invoke(typeof(StaticTestClass), new TestEventArgs <short> {
         Arg = arg
     });
 }
Пример #30
0
 public static void SendMessage(string message)
 {
     StaticEvent <ChatSubmitMessage.Data> .Broadcast(new ChatSubmitMessage.Data(message));
 }