private void AnimationComplete(object sender, AnimationEventArgs eventArgs) { if (eventArgs.AnimationName.Equals("planet_primaryToRest")) { NavigationController.IsWaitingForAnimationToComplete = false; } if (DeepLinkOnLoad) { if (!isWaitingForPillarsForDeepLinkOnLoadAction) { isWaitingForPillarsForDeepLinkOnLoadAction = true; StartCoroutine(CheckUntilPillarsForDeepLinkOnLoad()); } return; } // galaxy animation completed if (eventArgs.AnimationName.Equals("GalaxyMapTurnsOn")) { ContainerAPI container = new ContainerAPI(Game.ForceVision); // checking if player has defeated Grand Inquisitor bool hasDefeatedGrandInquisitor = ContainerAPI.GetDuelApi().Progress.HasCompleted(SG.Lonestar.DuelAPI.Duelist.GrandInquisitor, 1); // checking if Crait unlock animation has played already bool hasCraitUnlockAnimationPlayed = container.PlayerPrefs.PrefKeyExists(Constants.CraitUnlocked); if (hasDefeatedGrandInquisitor && !hasCraitUnlockAnimationPlayed) { // checking for player rank JediRank playerRank = ContainerAPI.GetJediRank(); if (playerRank <= JediRank.Padawan) { AudioEvent.Play(AudioEventName.GalaxyMap.UnlockCraitNewUser, Holocron, (object in_cookie, AkCallbackType in_type, object in_info) => { PlayCraitUnlockAnimation(); }); } else { // playing unlock animation PlayCraitUnlockAnimation(); } // setting player pref that Crait unlock animation has played container.PlayerPrefs.SetPrefInt(Constants.CraitUnlocked, 1); } // checking if player has completed Crait content bool hasDefeatedPraetorianGuards = ContainerAPI.GetDuelApi().Progress.HasCompleted(SG.Lonestar.DuelAPI.Duelist.PraetorianGuards, 1); bool hasCompletedTowerDefense = BSG.SWARTD.TDAPI.GetInstance().HasWonBattle(BSG.SWARTD.TDAPI.Battles.Crait_3); bool hasPorgUnlockAnimationPlayed = container.PlayerPrefs.PrefKeyExists(Constants.PorgUnlocked); if (hasDefeatedPraetorianGuards && hasCompletedTowerDefense && !hasPorgUnlockAnimationPlayed) { // disabling user input on node selection Animating = true; DG.Tweening.DOVirtual.DelayedCall(3f, () => { MenuAudioController.DidAutoSelectNode = true; NodeSelected(CraitPlanetNode); pillars.PorgUnlockFX.SetActive(true); // enabling user input on node selection Animating = false; }); // saving player prefs for porg unlocking container.PlayerPrefs.SetPrefInt(Constants.PorgUnlocked, 1); } } lastNode.OnAnimationComplete -= AnimationComplete; selectedNode.OnAnimationComplete -= AnimationComplete; // Reattach after animations if (selectedNode.NodeType == MenuNodeType.Galaxy && lastNode.NodeType == MenuNodeType.Planet) { lastNode.GetRootTransform().SetParent(lastNodeParent, true); } // displaying holocron effects (if needed) for (int i = 0; i < HolocronFX.transform.childCount; i++) { Transform child = HolocronFX.transform.GetChild(i); if (!child.gameObject.activeSelf) { child.gameObject.SetActive(true); } } Animating = false; }
/// <summary> /// Select the current focused node. /// </summary> public virtual void NodeSelected() { // Difficulty Button if (pillars != null && pillars.UIController.GazeClick()) { return; } // Nothing selected, or we are animating, or you selected something in the same view as you're aleady in. if (Animating || focusedNode == null || (focusedNode != null && focusedNode.NodeType == selectedNode.NodeType)) { return; } // Locked Planet if (focusedNode is PlanetMenuNode && (focusedNode as PlanetMenuNode).Locked) { // Locked Planet Audio (4 cases) PlanetMenuNode planetNode = focusedNode as PlanetMenuNode; bool tdComplete = ContainerAPI.IsLevelComplete(planetNode.PreviousTDConfig, 1); bool chessComplete = ContainerAPI.IsLevelComplete(planetNode.PreviousChessConfig, 1); bool playAnimation = true; if (tdComplete && chessComplete) { AudioEvent.Play(AudioEventName.Archivist.GalaxyMap.PlanetLockedBoth, Holocron); } else if (tdComplete) { AudioEvent.Play(AudioEventName.Archivist.GalaxyMap.PlanetLockedTowerDefense, Holocron); } else if (chessComplete) { AudioEvent.Play(AudioEventName.Archivist.GalaxyMap.PlanetLockedChess, Holocron); } else { AudioEvent.Play(AudioEventName.Archivist.GalaxyMap.PlanetLockedGeneral, Holocron); playAnimation = false; } if (playAnimation) { GameObject lockedEffect = (focusedNode as PlanetMenuNode).PreviousPlanetEffect; if (lockedEffect != null) { lockedEffect.SetActive(true); } } AudioEvent.Play(AudioEventName.GalaxyMap.NodeLocked, gameObject); return; } // Clicked the same pillar twice if (selectedPillarNode != null && !selectedPillarNode.Locked && focusedNode == selectedPillarNode) { DeepLinkOnLoad = true; DifficultyToLoad = pillars.UIController.CurrentDifficulty; GetComponent <Animator>().Play("menuFull_hide"); AudioEvent.Play(AudioEventName.GalaxyMap.LaunchActivity, gameObject); StartCoroutine(LaunchGame()); return; } if (selectedPillarNode != null) { selectedPillarNode.Selected = false; selectedPillarNode = null; } // Pillar Selected, show the screen. if (focusedNode.NodeType == MenuNodeType.Pillar) { selectedPillarNode = (PillarMenuNode)focusedNode; selectedPillarNode.Selected = true; pillars.UIController.Setup(selectedPillarNode); selectedPillarNode.AnimatePillar(); AudioEvent.Play(AudioEventName.GalaxyMap.BeginActivity, gameObject); return; } if (focusedNode != null && focusedNode is PorgMenuNode) { focusedNode.Selected = true; return; } // Animating and set the new current view Animating = true; // Last and Current Nodes lastNode = selectedNode; lastNodeParent = selectedNodeParent; selectedNode = focusedNode; selectedNode.Focused = false; focusedNode = null; // Selected lastNode.Selected = false; selectedNode.Selected = true; // Galaxy to Planet if (selectedNode.NodeType == MenuNodeType.Planet && lastNode.NodeType == MenuNodeType.Galaxy) { PlanetMenuNode currentPlanetNode = ((PlanetMenuNode)selectedNode); previousMenuNode = lastNode; if (currentPlanetNode.IsBonusPlanet) { DeepLinkToBonusPlanet = currentPlanetNode.BonusPlanet; } else { DeepLinkToPlanet = currentPlanetNode.Planet; DeepLinkToBonusPlanet = null; } // Break Planet Out selectedNodeParent = selectedNode.GetRootTransform().parent; selectedNode.GetRootTransform().SetParent(Galaxy.transform.parent, true); // Animate Planet selectedNode.Animator.Play("planet_restToPrimary"); ((PlanetMenuNode)selectedNode).SurfaceAnimator.Play("planetSurface_show"); ((PlanetMenuNode)selectedNode).FacePlayer(stereoCamera.transform); // Face player pillars.FacePlayer(stereoCamera.transform); // Animate Galaxy lastNode.OnAnimationComplete += AnimationComplete; lastNode.Animator.Play("galaxy_primaryToSecondary"); // Animate New Pillars if (!currentPlanetNode.IsBonusPlanet) { pillars.GetPlanetAnimator(((PlanetMenuNode)selectedNode).Planet).Play("planetPillars_hiddenToPlanet"); } else { pillars.GetPlanetAnimator(((PlanetMenuNode)selectedNode).BonusPlanet).Play("planetPillars_hiddenToPlanet"); } // Show 3rd Pillar Pin if needed pillars.CheckToShowSecondLevelPin(((PlanetMenuNode)selectedNode).Planet); } // Planet to Galaxy else if (selectedNode.NodeType == MenuNodeType.Galaxy && lastNode.NodeType == MenuNodeType.Planet) { PlanetMenuNode lastPlanet = (PlanetMenuNode)lastNode; // Animate Galaxy previousMenuNode = null; selectedNode.Animator.Play("galaxy_secondaryToPrimary"); // Animate Planet //disabling to potentially fix DCM-1751 //NavigationController.IsWaitingForAnimationToComplete = true; lastNode.OnAnimationComplete += AnimationComplete; lastNode.Animator.Play("planet_primaryToRest"); ((PlanetMenuNode)lastNode).SurfaceAnimator.Play("planetSurface_hide"); // Animate New Pillars if (!lastPlanet.IsBonusPlanet) { pillars.GetPlanetAnimator(((PlanetMenuNode)lastNode).Planet).Play("planetPillars_planetToHidden"); // Hide 3rd Pillar Pin if needed pillars.CheckToHideSecondLevelPin(((PlanetMenuNode)lastNode).Planet); } else { pillars.GetPlanetAnimator(((PlanetMenuNode)lastNode).BonusPlanet).Play("planetPillars_planetToHidden"); // Hide 3rd Pillar Pin if needed //pillars.CheckToHideSecondLevelPin(((PlanetMenuNode)lastNode).BonusPlanet); } } // Planet to Surface else if (selectedNode.NodeType == MenuNodeType.Surface && lastNode.NodeType == MenuNodeType.Planet) { PlanetMenuNode lastPlanetNode = (PlanetMenuNode)lastNode; previousMenuNode = lastNode; DeepLinkToGame = ((SurfaceMenuNode)selectedNode).LaunchGame; if (!lastPlanetNode.IsBonusPlanet) { pillars.UIController.Setup((SurfaceMenuNode)selectedNode, ((PlanetMenuNode)lastNode).Planet); } else { pillars.UIController.Setup((SurfaceMenuNode)selectedNode, ((PlanetMenuNode)lastNode).BonusPlanet); } Galaxy.GetComponent <Animator>().Play("galaxy_secondaryToTertiary"); if (!lastPlanetNode.IsBonusPlanet) { pillars.GetPlanetAnimator(((PlanetMenuNode)lastNode).Planet).Play("planetPillars_planetTo" + GetGameName(((SurfaceMenuNode)selectedNode).LaunchGame)); } else { pillars.GetPlanetAnimator(((PlanetMenuNode)lastNode).BonusPlanet).Play("planetPillars_planetTo" + GetGameName(((SurfaceMenuNode)selectedNode).LaunchGame)); } lastNode.OnAnimationComplete += AnimationComplete; lastNode.Animator.Play("planet_primaryToSecondary"); ((PlanetMenuNode)lastNode).SurfaceAnimator.Play("planetSurface_hide"); AudioEvent.Play(AudioEventName.GalaxyMap.SelectActivity, gameObject); // Play the ambience for the planet surface if (!lastPlanetNode.IsBonusPlanet) { AudioEvent.Play("MAP_SFX_GalaxyMap_Ambience_" + ((PlanetMenuNode)lastNode).Planet + "_Play", selectedNode.gameObject); } // Play the ambience for bonus planet else { AudioEvent.Play("MAP_SFX_GalaxyMap_Ambience_" + ((PlanetMenuNode)lastNode).BonusPlanet + "_Play", selectedNode.gameObject); // checking for assault mode completion on easy if (ConfigToLoad != null && ContainerAPI.IsLevelComplete(ConfigToLoad, 1)) { AudioEvent.PlayOnceEver("MAP_DX_Arch_Crait_000_004", selectedNode.gameObject); } } } // Surface to Planet else if (selectedNode.NodeType == MenuNodeType.Planet && lastNode.NodeType == MenuNodeType.Surface) { PlanetMenuNode selectedPlanet = (PlanetMenuNode)selectedNode; previousMenuNode = Galaxy.GetComponent <MenuNode>(); pillars.UIController.Hide(); // Hide Lock Icons PillarMenuNode[] pillarNodes = lastNode.gameObject.GetComponentsInChildren <PillarMenuNode>(); for (int i = 0; i < pillarNodes.Length; i++) { pillarNodes[i].LockObject.SetActive(false); } Galaxy.GetComponent <Animator>().Play("galaxy_tertiaryToSecondary"); if (!selectedPlanet.IsBonusPlanet) { pillars.GetPlanetAnimator(((PlanetMenuNode)selectedNode).Planet).Play("planetPillars_" + GetGameName(((SurfaceMenuNode)lastNode).LaunchGame).ToLower() + "ToPlanet"); } else { pillars.GetPlanetAnimator(((PlanetMenuNode)selectedNode).BonusPlanet).Play("planetPillars_" + GetGameName(((SurfaceMenuNode)lastNode).LaunchGame).ToLower() + "ToPlanet"); } selectedNode.OnAnimationComplete += AnimationComplete; selectedNode.Animator.Play("planet_secondaryToPrimary"); ((PlanetMenuNode)selectedNode).SurfaceAnimator.Play("planetSurface_show"); ((PlanetMenuNode)selectedNode).FacePlayer(stereoCamera.transform); // Show 3rd Pillar Pin if needed if (!selectedPlanet.IsBonusPlanet) { pillars.CheckToShowSecondLevelPin(((PlanetMenuNode)selectedNode).Planet); } else { pillars.CheckToShowSecondLevelPin(((PlanetMenuNode)selectedNode).BonusPlanet); } AudioEvent.Play(AudioEventName.GalaxyMap.SelectBack, gameObject); // Stop the ambience for the planet surface if (!selectedPlanet.IsBonusPlanet) { AudioEvent.Play("MAP_SFX_GalaxyMap_Ambience_" + ((PlanetMenuNode)selectedNode).Planet + "_Stop", lastNode.gameObject); } else { AudioEvent.Play("MAP_SFX_GalaxyMap_Ambience_" + ((PlanetMenuNode)selectedNode).BonusPlanet + "_Stop", lastNode.gameObject); } } }