Exemplo n.º 1
0
 public void LevelLoadedServer(ulong level, WorkshopItemSource levelType, uint hash)
 {
     lock (stateLock)
     {
         if (state == AppSate.ServerLoadLevel)
         {
             Dialogs.HideProgress();
             MenuCameraEffects.FadeOut(1f);
             if (hash == 0 || hash == 57005)
             {
                 NetGame.instance.StopServer();
                 ExitGame();
                 EnterMenu();
                 UnityEngine.Debug.LogError("LevelNotNetReady");
                 Dialogs.CreateServerFailed("LevelNotNetReady", delegate
                 {
                     MenuSystem.instance.ShowMenu <MainMenu>();
                 });
             }
             else
             {
                 state = AppSate.ServerPlayLevel;
                 NetGame.instance.ServerLoadLevel(level, levelType, start: true, (hash != 0) ? hash : 57005u);
             }
         }
     }
 }
Exemplo n.º 2
0
 public void LaunchCustomLevel(string path, WorkshopItemSource levelType, int checkpoint, int subObjectives)
 {
     StartCoroutine(LaunchGame(path, 0uL, levelType, checkpoint, subObjectives, delegate
     {
         MenuCameraEffects.FadeOut(1f);
         state = AppSate.PlayLevel;
     }));
 }
Exemplo n.º 3
0
 public void LaunchSinglePlayer(ulong level, WorkshopItemSource levelType, int checkpoint, int subObjectives)
 {
     startedCheckpoint = checkpoint;
     LaunchGame(level, levelType, checkpoint, subObjectives, delegate
     {
         MenuCameraEffects.FadeOut(1f);
         state = AppSate.PlayLevel;
     });
 }
Exemplo n.º 4
0
    public void HideMenus()
    {
        MenuCameraEffects.FadeOut();
        MenuTransition menuTransition = activeMenu;

        instance.ExitMenus();
        if (menuTransition != null)
        {
            menuTransition.FadeOutBack();
        }
    }
Exemplo n.º 5
0
 private bool LevelLoadedClient()
 {
     lock (stateLock)
     {
         if (serverLoadedLevel == loadedLevel)
         {
             Dialogs.HideProgress();
             MenuCameraEffects.FadeOut(1f);
             if (loadedHash == serverLoadedHash)
             {
                 state = AppSate.ClientPlayLevel;
             }
             else
             {
                 NetGame.instance.LeaveGame();
                 ExitGame();
                 EnterMenu();
                 if (serverLoadedHash == 57005)
                 {
                     Dialogs.ConnectionFailed("LevelNotNetReady", delegate
                     {
                         MenuSystem.instance.ShowMainMenu();
                     });
                 }
                 else
                 {
                     UnityEngine.Debug.LogError("Incompatible level. Server hash: " + serverLoadedHash + ". Client Hash: " + loadedHash);
                     Dialogs.ConnectionFailed("IncompatibleLevel", delegate
                     {
                         MenuSystem.instance.ShowMainMenu();
                     });
                 }
                 queueAfterLevelLoad = null;
             }
             return(true);
         }
         return(false);
     }
 }
Exemplo n.º 6
0
    private void UpdateFromState()
    {
        if (state < State.Ground)
        {
            if (MenuCameraEffects.instance.creditsAdjust == 0f && MenuSystem.instance.state == MenuSystemState.Inactive)
            {
                MenuCameraEffects.FadeInCredits();
            }
        }
        else if (MenuCameraEffects.instance.creditsAdjust != 0f && !MenuCameraEffects.instance.CreditsAdjustInTransition && MenuSystem.instance.state == MenuSystemState.Inactive)
        {
            MenuCameraEffects.FadeOut(1.5f);
        }
        SetCloudState(state < State.Ground);
        if (!skipDrag)
        {
            bool flag = state < State.NearGround;
            if (flag != lastDrag)
            {
                lastDrag    = flag;
                currentDrag = ((!flag) ? 0.05f : 0.4f);
                for (int i = 0; i < Human.all.Count; i++)
                {
                    Human human = Human.all[i];
                    if (humansInLevel.Contains(human) && !skipDrag)
                    {
                        human.SetDrag(currentDrag);
                    }
                    human.state = HumanState.Spawning;
                }
            }
        }
        bool flag2 = state >= State.FadeOut;

        if (fadeRunning == flag2)
        {
            return;
        }
        fadeRunning = flag2;
        if (flag2)
        {
            CreditsFadeOutAndEnd.Trigger(base.gameObject, delegate
            {
                GetComponentInParent <Level>().respawnLocked = true;
                ClearDrag();
                hasFinishedCredits = true;
                startupDoor.SetActive(value: false);
                for (int j = 0; j < blocks.Count; j++)
                {
                    blocks[j].gameObject.SetActive(value: false);
                }
            });
            return;
        }
        CreditsFadeOutAndEnd component = base.gameObject.GetComponent <CreditsFadeOutAndEnd>();

        if (component != null)
        {
            component.Cancel();
        }
    }