Exemplo n.º 1
0
        public void Show(WorldMap.ViewModel viewModel, WorldSheet.Row worldRow, StageType stageType)
        {
            _sharedViewModel = viewModel;
            _sharedViewModel.SelectedStageId
            .Subscribe(stageId => UpdateStageInformation(
                           stageId,
                           States.Instance.CurrentAvatarState?.level ?? 1)
                       )
            .AddTo(gameObject);
            _sharedViewModel.WorldInformation.TryGetWorld(worldRow.Id, out var worldModel);
            UpdateStageInformation(_sharedViewModel.SelectedStageId.Value, States.Instance.CurrentAvatarState.level);
            if (_sharedViewModel.SelectedStageId.Value == 1)
            {
                stageHelpButton.Show();
            }
            else
            {
                stageHelpButton.Hide();
            }

            _stageType = stageType;
            SetBottomMenu(stageType);

            world.Set(worldRow);
            var questStageId = Game.Game.instance.States
                               .CurrentAvatarState.questList
                               .OfType <WorldQuest>()
                               .Where(x => !x.Complete)
                               .OrderBy(x => x.Goal)
                               .FirstOrDefault()?
                               .Goal ?? -1;

            world.ShowByStageId(_sharedViewModel.SelectedStageId.Value, questStageId);
            if (worldModel.IsUnlocked)
            {
                UnlockWorld(worldModel.GetNextStageIdForPlay(), worldModel.GetNextStageId());
            }
            else
            {
                LockWorld();
            }

            base.Show();
        }