public void CreateAndLogin(string nickName) { if (!Regex.IsMatch(nickName, GameConfig.AvatarNickNamePattern)) { Find <Alert>().Show("UI_ERROR", "UI_NICKNAME_CONDITION"); return; } Mixpanel.Track("Unity/Choose Nickname"); Find <GrayLoadingScreen>().Show(); Game.Game.instance.ActionManager .CreateAvatar(_selectedIndex, nickName, _hair, _lens, _ear, _tail) .Subscribe(eval => { var avatarState = States.Instance.SelectAvatar(_selectedIndex); StartCoroutine(CreateAndLoginAnimation(avatarState)); ActionRenderHandler.Instance.RenderQuest(avatarState.address, avatarState.questList.completedQuestIds); //[TentuPlay] new TPStashEvent().CharacterLogin( player_uuid: States.Instance.AgentState.address.ToHex(), character_uuid: States.Instance.CurrentAvatarState.address.ToHex().Substring(0, 4) ); }, e => { ActionRenderHandler.PopupError(e); Find <GrayLoadingScreen>().Close(); }); AudioController.PlayClick(); }
// TODO: QuestPreparation.Quest(bool repeat) 와 로직이 흡사하기 때문에 정리할 여지가 있습니다. private void HackAndSlash(int stageId) { var sheets = Game.Game.instance.TableSheets; var stageRow = sheets.StageSheet.OrderedList.FirstOrDefault(row => row.Id == stageId); if (stageRow is null) { return; } var requiredCost = stageRow.CostAP; if (States.Instance.CurrentAvatarState.actionPoint < requiredCost) { // NOTE: AP가 부족합니다. return; } if (!sheets.WorldSheet.TryGetByStageId(stageId, out var worldRow)) { return; } var worldId = worldRow.Id; Find <BottomMenu>().Close(true); Find <LoadingScreen>().Show(); var stage = Game.Game.instance.Stage; stage.isExitReserved = false; stage.repeatStage = false; var player = stage.GetPlayer(); player.StartRun(); ActionCamera.instance.ChaseX(player.transform); ActionRenderHandler.Instance.Pending = true; Game.Game.instance.ActionManager .HackAndSlash(player, worldId, stageId) .Subscribe(_ => { LocalLayerModifier.ModifyAvatarActionPoint( States.Instance.CurrentAvatarState.address, requiredCost); }, e => ActionRenderHandler.BackToMain(false, e)) .AddTo(this); LocalLayerModifier.ModifyAvatarActionPoint(States.Instance.CurrentAvatarState.address, -requiredCost); var props = new Value { ["StageID"] = stageId, }; Mixpanel.Track("Unity/Click Guided Quest Enter Dungeon", props); }
private IEnumerator CoInitialize() { //#if !UNITY_EDITOR yield return(new WaitForSeconds(2f)); //#endif panelManager.introPanel.Hide(); var agentInitialized = false; InitializeLogger(); Agent.Initialize(); var innerAgent = AgentHelper.InnerAgent; innerAgent.PreloadProcessed += (sender, state) => { switch (state) { case BlockDownloadState s: panelManager.loadingPanel.progressCircle.ProgressValue = (float)s.ReceivedBlockCount / s.TotalBlockCount * .5f; break; } }; innerAgent.PreloadEnded += (sender, args) => { Debug.Log($"{nameof(MainController)}: {nameof(innerAgent)}.{nameof(innerAgent.PreloadEnded)} called."); panelManager.loadingPanel.progressCircle.ProgressValue = .5f; agentInitialized = true; }; yield return(new WaitUntil(() => agentInitialized)); yield return(new WaitUntil(() => innerAgent.BlockIndex > 0)); while (panelManager.loadingPanel.progressCircle.ProgressValue < 1f) { panelManager.loadingPanel.progressCircle.ProgressValue += Time.deltaTime * .2f; yield return(null); } gameController = new GameController(panelManager.gamePanel); actionRenderHandler = new ActionRenderHandler(innerAgent.Address); actionRenderHandler.UpdateBoardState(innerAgent.GetState, innerAgent.BlockIndex); actionRenderHandler.Start(); panelManager.loadingPanel.Hide(); }
private IEnumerator CoRepeatCurrentOrProceedNextStage() { if (!submitButton.interactable) { yield break; } if (Find <Menu>().IsActive()) { yield break; } var isNext = !SharedModel.ShouldRepeat; closeButton.interactable = false; submitButton.interactable = false; actionPoint.SetEventTriggerEnabled(false); StopCoUpdateBottomText(); StartCoroutine(CoFadeOut()); var stage = Game.Game.instance.Stage; var stageLoadingScreen = Find <StageLoadingScreen>(); stageLoadingScreen.Show(stage.zone, SharedModel.WorldName, isNext ? SharedModel.StageID + 1: SharedModel.StageID, isNext, SharedModel.StageID); Find <Status>().Close(); StopVFX(); var player = stage.RunPlayerForNextStage(); player.DisableHUD(); var worldId = stage.worldId; var stageId = SharedModel.ShouldRepeat ? stage.stageId : stage.stageId + 1; ActionRenderHandler.Instance.Pending = true; var props = new Value { ["StageId"] = stageId, }; var eventKey = "Next Stage"; if (SharedModel.ShouldRepeat) { eventKey = SharedModel.ClearedWaveNumber == 3 ? "Repeat" : "Retry"; } var eventName = $"Unity/Stage Exit {eventKey}"; Mixpanel.Track(eventName, props); yield return(Game.Game.instance.ActionManager .HackAndSlash( player.Costumes, player.Equipments, new List <Consumable>(), worldId, stageId) .Subscribe(_ => { }, e => ActionRenderHandler.BackToMain(false, e))); }
private static void OnRPCAgentRetryAndPreloadEnded(RPCAgent rpcAgent) { if (Widget.Find <Intro>().IsActive() || Widget.Find <PreloadingScreen>().IsActive() || Widget.Find <Synopsis>().IsActive()) { // NOTE: 타이틀 화면에서 리트라이와 프리로드가 완료된 상황입니다. // FIXME: 이 경우에는 메인 로비가 아니라 기존 초기화 로직이 흐르도록 처리해야 합니다. return; } var needToBackToMain = false; var showLoadingScreen = false; var widget = (Widget)Widget.Find <BlockSyncLoadingScreen>(); if (widget.IsActive()) { widget.Close(); } if (Widget.Find <LoadingScreen>().IsActive()) { Widget.Find <LoadingScreen>().Close(); widget = Widget.Find <QuestPreparation>(); if (widget.IsActive()) { widget.Close(true); needToBackToMain = true; } widget = Widget.Find <Menu>(); if (widget.IsActive()) { widget.Close(true); needToBackToMain = true; } } else if (Widget.Find <StageLoadingScreen>().IsActive()) { Widget.Find <StageLoadingScreen>().Close(); if (Widget.Find <BattleResult>().IsActive()) { Widget.Find <BattleResult>().Close(true); } needToBackToMain = true; showLoadingScreen = true; } else if (Widget.Find <ArenaBattleLoadingScreen>().IsActive()) { Widget.Find <ArenaBattleLoadingScreen>().Close(); needToBackToMain = true; } else if (Widget.Find <MimisbrunnrPreparation>().IsActive()) { Widget.Find <MimisbrunnrPreparation>().Close(true); needToBackToMain = true; } if (!needToBackToMain) { return; } ActionRenderHandler.BackToMain( showLoadingScreen, new UnableToRenderWhenSyncingBlocksException()); }