Exemplo n.º 1
0
	public void ContinueClick()
	{
		if (MenuSystem.CanInvoke)
		{
			GameSave.GetLastSave(out int levelNumber, out int checkpoint, out int subObjectives, out float _);
			App.instance.LaunchSinglePlayer((ulong)levelNumber, GameSave.GetLastCheckpointLevelType(), checkpoint, subObjectives);
		}
	}
Exemplo n.º 2
0
	public override void OnGotFocus()
	{
		workshopButton.gameObject.SetActive(value: false);
		GameSave.GetLastSave(out int levelNumber, out int checkpoint, out int _, out float _);
		bool flag = levelNumber > 0 || checkpoint > 0 || GameSave.GetLastCheckpointLevelType() != WorkshopItemSource.BuiltIn;
		bool active = GameSave.IsLevelSelectEnabled();
		bool flag2 = false;
		if (DLC.instance.SupportsDLC() && flag && !DLC.instance.LevelIsAvailable(levelNumber))
		{
			flag2 = true;
		}
		newGameBigButton.gameObject.SetActive(!flag);
		newGameButton.gameObject.SetActive(flag && flag2);
		continueButton.gameObject.SetActive(flag && !flag2);
		selectLevelButton.SetActive(active);
		defaultElement = ((!flag) ? newGameBigButton.gameObject : ((!flag2) ? continueButton.gameObject : newGameButton.gameObject));
		GetComponent<AutoNavigation>().Invalidate();
		base.OnGotFocus();
	}
Exemplo n.º 3
0
    public void Rebind()
    {
        bool flag = displayMode == LevelSelectMenuMode.SubscribedWorkshop;

        UpdateTitle();
        DisableLevelContinue();
        bool flag2 = false;

        flag2             = SteamUser.BLoggedOn();
        InLevelSelectMenu = (displayMode != 0 && displayMode != LevelSelectMenuMode.LocalWorkshop);
        showCustomButton.SetActive(value: false);
        showSubscribedButton.SetActive(value: false);
        subscribedSubtitle.SetActive(value: false);
        customSubtitle.SetActive(value: false);
        ShowLocalLevelButton.SetActive(value: false);
        InvalidLevelInfoPanel.SetActive(value: false);
        noSubscribedPrompt.SetActive(value: false);
        offlinePanel.SetActive(value: false);
        noLocalPrompt.SetActive(value: false);
        List <WorkshopLevelMetadata> list = null;

        switch (displayMode)
        {
        case LevelSelectMenuMode.Campaign:
            WorkshopRepository.instance.LoadBuiltinLevels(isMultiplayer && IsLobbyMode());
            list = WorkshopRepository.instance.levelRepo.BySource(IsLobbyMode() ? WorkshopItemSource.BuiltInLobbies : WorkshopItemSource.BuiltIn);
            break;

        case LevelSelectMenuMode.EditorPicks:
            WorkshopRepository.instance.LoadEditorPickLevels();
            list = WorkshopRepository.instance.levelRepo.BySource(WorkshopItemSource.EditorPick);
            break;

        case LevelSelectMenuMode.SubscribedWorkshop:
            if (flag2)
            {
                WorkshopRepository.instance.ReloadSubscriptions();
                list = WorkshopRepository.instance.levelRepo.BySource(WorkshopItemSource.Subscription);
            }
            break;

        case LevelSelectMenuMode.LocalWorkshop:
            WorkshopRepository.instance.ReloadLocalLevels();
            list = WorkshopRepository.instance.levelRepo.BySource(WorkshopItemSource.LocalWorkshop);
            break;

        case LevelSelectMenuMode.BuiltInLobbies:
            WorkshopRepository.instance.LoadBuiltinLevels(requestLobbies: true);
            list = WorkshopRepository.instance.levelRepo.BySource(WorkshopItemSource.BuiltInLobbies);
            break;

        case LevelSelectMenuMode.WorkshopLobbies:
            if (flag2)
            {
                WorkshopRepository.instance.ReloadSubscriptions(isLobby: true);
                list = WorkshopRepository.instance.levelRepo.BySource(WorkshopItemSource.SubscriptionLobbies);
            }
            break;
        }
        if (list == null)
        {
            list = new List <WorkshopLevelMetadata>();
        }
        if (!CouldShowFindMore())
        {
            FindMoreButton.SetActive(value: false);
        }
        customFolder.text = CustomDataPath;
        if (list.Count == 0)
        {
            this.list.Bind(list);
            itemListImage.color = itemListError;
            if (!flag2)
            {
                offlinePanel.SetActive(value: true);
            }
            else if (IsLobbyMode())
            {
                noSubscribedPrompt.SetActive(value: true);
            }
            else if (displayMode == LevelSelectMenuMode.SubscribedWorkshop)
            {
                noSubscribedPrompt.SetActive(value: true);
            }
            else
            {
                noLocalPrompt.SetActive(value: true);
            }
            EventSystem.current.SetSelectedGameObject(BackButton.gameObject);
            levelImage.SetActive(value: false);
            LevelDescriptionPanel.SetActive(value: false);
        }
        else
        {
            itemListImage.color = itemListNormal;
            levelInfoPanel.SetActive(value: true);
            levelImage.SetActive(!flag);
            LevelDescriptionPanel.SetActive(flag);
            this.list.Bind(list);
            int num = 0;
            if (!string.IsNullOrEmpty(selectedPath))
            {
                for (int i = 0; i < list.Count; i++)
                {
                    if (FolderMatch(list[i].folder, selectedPath))
                    {
                        num = i;
                        break;
                    }
                }
            }
            GameSave.GetLastSave(out int levelNumber, out int _, out int _, out float _);
            WorkshopItemSource lastCheckpointLevelType = GameSave.GetLastCheckpointLevelType();
            bool flag3 = false;
            switch (lastCheckpointLevelType)
            {
            case WorkshopItemSource.BuiltIn:
                flag3 = (displayMode == LevelSelectMenuMode.Campaign);
                break;

            case WorkshopItemSource.EditorPick:
                flag3 = (displayMode == LevelSelectMenuMode.EditorPicks);
                break;

            default:
                flag3 = false;
                break;
            }
            if (flag3)
            {
                if (levelNumber < this.list.GetNumberItems - 1)
                {
                    this.list.FocusItem(levelNumber);
                }
                else
                {
                    this.list.FocusItem(0);
                }
            }
            else
            {
                this.list.FocusItem(0);
            }
        }
        topPanel.Invalidate();
        EnableShowLevelButtons();
        BindLevelIfNeeded(selectedMenuItem);
        if (previousSelectedItem != null)
        {
            StartCoroutine(WaitAndSelect());
        }
    }