コード例 #1
0
ファイル: Menu.cs プロジェクト: hunj/NineChronicles
        public void MimisbrunnrClick()
        {
            if (!btnMimisbrunnr.IsUnlocked)
            {
                btnMimisbrunnr.JingleTheCat();
                return;
            }

            const int worldId    = GameConfig.MimisbrunnrWorldId;
            var       worldSheet = Game.Game.instance.TableSheets.WorldSheet;
            var       worldRow   =
                worldSheet.OrderedList.FirstOrDefault(
                    row => row.Id == worldId);

            if (worldRow is null)
            {
                Notification.Push(MailType.System, L10nManager.Localize("ERROR_WORLD_DOES_NOT_EXIST"));
                return;
            }

            var wi = States.Instance.CurrentAvatarState.worldInformation;

            if (!wi.TryGetWorld(worldId, out var world))
            {
                LocalLayerModifier.AddWorld(
                    States.Instance.CurrentAvatarState.address,
                    worldId);

                if (!wi.TryGetWorld(worldId, out world))
                {
                    // Do nothing.
                    return;
                }
            }

            if (!world.IsUnlocked)
            {
                // Do nothing.
                return;
            }

            var SharedViewModel = new WorldMap.ViewModel
            {
                WorldInformation = wi,
            };

            if (mimisbrunnrExclamationMark.gameObject.activeSelf)
            {
                var addressHax = ReactiveAvatarState.Address.Value.ToHex();
                var key        = string.Format(FirstOpenMimisbrunnrKeyFormat, addressHax);
                PlayerPrefs.SetInt(key, 1);
            }

            Mixpanel.Track("Unity/Enter Mimisbrunnr");
            _coLazyClose = StartCoroutine(CoLazyClose());
            AudioController.PlayClick();
            AnalyticsManager.Instance.OnEvent(AnalyticsManager.EventName.ClickHardBattle);

            SharedViewModel.SelectedWorldId.SetValueAndForceNotify(world.Id);
            SharedViewModel.SelectedStageId.SetValueAndForceNotify(world.GetNextStageId());
            var stageInfo = Find <UI.StageInformation>();

            stageInfo.Show(SharedViewModel, worldRow, StageInformation.StageType.Mimisbrunnr);
            var status = Find <Status>();

            status.Close(true);
        }