public void OnClose() { FindObjectOfType <Sound>().PlaySound(FX.Click); fader.DOFade(0, .5f).OnComplete(() => { Transform content = transform.Find("Panel/content"); foreach (Transform tf in content) { Destroy(tf.gameObject); } //handle deployment if (allyToAdd != null) { FindObjectOfType <DeploymentGroupManager>().DeployHeroAlly(allyToAdd); } if (enemyToAdd != null) { if (DataStore.sessionData.gameVars.pauseDeployment) { GlowEngine.FindObjectsOfTypeSingle <QuickMessage>().Show($"Imperial Deployment is <color=\"red\">PAUSED</color>. The requested group [{enemyToAdd.name}] will not be deployed."); } else { FindObjectOfType <DeploymentGroupManager>().DeployGroup(enemyToAdd); } } gameObject.SetActive(false); callback?.Invoke(); }); cg.DOFade(0, .2f); transform.GetChild(0).DOScale(.85f, .5f).SetEase(Ease.OutExpo); }
void ContinueGame() { if (DataStore.LoadState()) { //restore deployed enemies and heroes/allies dgManager.RestoreState(); //update UI with loaded state //round # roundText.text = DataStore.uiLanguage.uiMainApp.roundHeading + "\r\n" + DataStore.sessionData.gameVars.round; //toggle pause threat/deployment buttons if (DataStore.sessionData.gameVars.pauseThreatIncrease) { pauseThreatToggle.isOn = true; } if (DataStore.sessionData.gameVars.pauseDeployment) { pauseDeploymentToggle.isOn = true; } fameButton.interactable = DataStore.sessionData.useAdaptiveDifficulty; GlowEngine.FindObjectsOfTypeSingle <QuickMessage>().Show(DataStore.uiLanguage.uiMainApp.restoredMsgUC); } else { GlowEngine.FindObjectsOfTypeSingle <QuickMessage>().Show(DataStore.uiLanguage.uiMainApp.restoreErrorMsgUC); } }
private void Update() { //check if mission can be started bool heroCheck = DataStore.sessionData.selectedDeploymentCards[4].cards.Count > 0; bool difficulty = DataStore.sessionData.difficulty != Difficulty.NotSet; bool allyRules = DataStore.sessionData.allyRules != AllyRules.NotSet; bool factions = DataStore.sessionData.includeImperials || DataStore.sessionData.includeMercs; if (heroCheck && difficulty && allyRules && factions) { startMissionButton.interactable = true; } else { startMissionButton.interactable = false; } if (Input.GetKeyDown(KeyCode.Escape) && !GlowEngine.FindObjectsOfTypeSingle <GroupChooserScreen>().gameObject.activeInHierarchy && !GlowEngine.FindObjectsOfTypeSingle <MissionTextBox>().gameObject.activeInHierarchy && !GlowEngine.FindObjectsOfTypeSingle <HeroChooser>().gameObject.activeInHierarchy && !GlowEngine.FindObjectsOfTypeSingle <CardViewPopup>().gameObject.activeInHierarchy) { OnBack(); } }
private void OnReturn() { if (GlowEngine.FindObjectsOfTypeSingle <EnemyActivationPopup>().gameObject.activeInHierarchy) { GlowEngine.FindObjectsOfTypeSingle <EnemyActivationPopup>().OnReturn(); } }
public void OnRollDefense() { OnOK(); DiceRoller diceRoller = GlowEngine.FindObjectsOfTypeSingle <DiceRoller>(); diceRoller.Show(card, false); }
public void OnRollAttack() { OnOK(); DiceRoller diceRoller = GlowEngine.FindObjectsOfTypeSingle <DiceRoller>(); diceRoller.Show(card, true); }
public void OnPauseDeploy(Toggle t) { sound.PlaySound(FX.Click); DataStore.sessionData.gameVars.pauseDeployment = t.isOn; string s = t.isOn ? DataStore.uiLanguage.uiMainApp.pauseDepMsgUC : DataStore.uiLanguage.uiMainApp.unPauseDepMsgUC; GlowEngine.FindObjectsOfTypeSingle <QuickMessage>().Show(s); }
public void OnViewCard() { spaceListen = false; EventSystem.current.SetSelectedGameObject(null); CardViewPopup cardViewPopup = GlowEngine.FindObjectsOfTypeSingle <CardViewPopup>(); cardViewPopup.Show(cardDescriptor, OnReturn); }
public void OnPointerClick() { if (cardDescriptor.isDummy || isHero) { return; } CardViewPopup cardViewPopup = GlowEngine.FindObjectsOfTypeSingle <CardViewPopup>(); cardViewPopup.Show(cardDescriptor); }
public void OnConfirm() { int c = mWheelHandler.wheelValue; CardDescriptor cd = null; List <CardDescriptor> list = new List <CardDescriptor>(); do { var p = DataStore.deploymentCards.cards .OwnedPlusOther() .MinusDeployed() .MinusInDeploymentHand() .MinusStarting() .MinusReserved() .MinusIgnored() .FilterByFaction() .Concat(DataStore.sessionData.EarnedVillains) .Where(x => x.cost <= c && !list.Contains(x)) .ToList(); if (p.Count > 0) { int[] rnd = GlowEngine.GenerateRandomNumbers(p.Count); cd = p[rnd[0]]; list.Add(cd); c -= cd.cost; } else { cd = null; } } while (cd != null); //deploy any groups picked foreach (var card in list) { FindObjectOfType <DeploymentGroupManager>().DeployGroup(card, true); } string s = DataStore.uiLanguage.uiMainApp.noRandomMatchesUC.Replace("{d}", mWheelHandler.wheelValue.ToString()); if (list.Count == 0) { GlowEngine.FindObjectsOfTypeSingle <QuickMessage>().Show($"<color=\"orange\">{s}</color>"); } OnCancel(); }
public void OnMissionInfo() { EventSystem.current.SetSelectedGameObject(null); sound.PlaySound(FX.Click); var txt = Resources.Load <TextAsset>($"Languages/{DataStore.languageCodeList[DataStore.languageCode]}/MissionText/{DataStore.sessionData.selectedMissionID}info"); if (txt != null) { if (GlowEngine.FindObjectsOfTypeSingle <EnemyActivationPopup>().gameObject.activeInHierarchy) { GlowEngine.FindObjectsOfTypeSingle <EnemyActivationPopup>().OnReturn(false); } missionTextBox.Show(txt.text, OnReturn); } else { GlowEngine.FindObjectsOfTypeSingle <QuickMessage>().Show("Could not find Mission Info: " + DataStore.sessionData.selectedMissionID); } }
public void RemoveSelf() { for (int i = 0; i < 3; i++) { countToggles[i].gameObject.SetActive(false); } selfButton.interactable = false; Transform tf = transform.GetChild(0); tf.DOScale(0, 1f).SetEase(Ease.InBounce).OnComplete(() => { //add card back to dep hand ONLY IF IT'S NOT THE CUSTOM GROUP //AND if it's NOT a villain if (cardDescriptor.id != "DG070" && !DataStore.villainCards.cards.Contains(cardDescriptor)) { DataStore.deploymentHand.Add(cardDescriptor); } //remove it from deployed list DataStore.deployedEnemies.Remove(cardDescriptor); //if it is an EARNED villain, add it back into manual deploy list if (DataStore.sessionData.EarnedVillains.Contains(cardDescriptor) && !DataStore.manualDeploymentList.Contains(cardDescriptor)) { DataStore.manualDeploymentList.Add(cardDescriptor); DataStore.SortManualDeployList(); } if (DataStore.sessionData.useAdaptiveDifficulty) { //add fame value DataStore.sessionData.gameVars.fame += cardDescriptor.fame; //reimburse some Threat DataStore.sessionData.ModifyThreat(cardDescriptor.reimb); //show fame popup GlowEngine.FindObjectsOfTypeSingle <QuickMessage>().Show($"{DataStore.uiLanguage.uiMainApp.fameIncreasedUC}: <color=\"red\">{cardDescriptor.fame}</color>"); } Object.Destroy(gameObject); }); }
private void Update() { bool allActivated = false; foreach (Transform enemy in dgManager.gridContainer) { DGPrefab dg = enemy.GetComponent <DGPrefab>(); if (!dg.IsExhausted) { allActivated = true; } } if (allActivated) { activateImperialButton.interactable = true; float s = GlowEngine.SineAnimation(.95f, 1, 10f); activateImperialButton.transform.localScale = new Vector3(s, s); } else { activateImperialButton.interactable = false; activateImperialButton.transform.localScale = Vector3.one; } endTurnButton.interactable = !activateImperialButton.interactable; if (Input.GetKeyDown(KeyCode.Escape)) { if (FindObjectOfType <DebugPopup>() != null) { FindObjectOfType <DebugPopup>().OnClose(); } else { EventSystem.current.SetSelectedGameObject(null); GlowEngine.FindObjectsOfTypeSingle <DebugPopup>().Show(); } } }
/// <summary> /// Takes an enemy or villain, applies difficulty modifier, deploys, removes from dep hand, adds to deployed list /// </summary> public void DeployGroup(CardDescriptor cardDescriptor, bool skipEliteModify = false) { cardDescriptor.hasActivated = false; // EASY: Any time an Elite group is deployed, it has a 15% chance to be downgraded to a normal group without refunding of threat. ( If the respective normal group is still available.) if (DataStore.sessionData.difficulty == Difficulty.Easy && !skipEliteModify && cardDescriptor.isElite && GlowEngine.RandomBool(15)) { //see if normal version exists, include dep hand var nonE = DataStore.GetNonEliteVersion(cardDescriptor); if (nonE != null) { Debug.Log("DeployGroup EASY mode Elite downgrade: " + nonE.name); cardDescriptor = nonE; GlowEngine.FindObjectsOfTypeSingle <QuickMessage>().Show(DataStore.uiLanguage.uiMainApp.eliteDowngradeMsgUC); } } //Hard: Threat increase x1.3 Any time a normal group is deployed, it has a 15 % chance to be upgraded to an Elite group at no additional threat cost. ( If the respective normal group is still available.) Deployment Modifier starts at 2 instead of 0. if (DataStore.sessionData.difficulty == Difficulty.Hard && !skipEliteModify && !cardDescriptor.isElite && GlowEngine.RandomBool(15)) { //see if elite version exists, include dep hand var elite = DataStore.GetEliteVersion(cardDescriptor); if (elite != null) { Debug.Log("DeployGroup HARD mode Elite upgrade: " + elite.name); cardDescriptor = elite; GlowEngine.FindObjectsOfTypeSingle <QuickMessage>().Show(DataStore.uiLanguage.uiMainApp.eliteUpgradeMsgUC); } else { Debug.Log("SKIPPED: " + cardDescriptor.name); } } if (DataStore.deployedEnemies.Contains(cardDescriptor)) { Debug.Log(cardDescriptor.name + " already deployed"); return; } cardDescriptor.currentSize = cardDescriptor.size; var go = Instantiate(dgPrefab, gridContainer); go.GetComponent <DGPrefab>().Init(cardDescriptor); //add it to deployed enemies DataStore.deployedEnemies.Add(cardDescriptor); //if it's FROM the dep hand, remove it //should have already been removed *IF* it's from DeploymentPopup //otherwise it just got (up/down)graded to/from Elite DataStore.deploymentHand.Remove(cardDescriptor); sound.playDeploymentSound(cardDescriptor.id); //var rt = gridContainer.GetComponent<RectTransform>(); //rt.localPosition = new Vector3( 20, -3000, 0 ); }
public void OnShowDebug() { EventSystem.current.SetSelectedGameObject(null); GlowEngine.FindObjectsOfTypeSingle <DebugPopup>().Show(); }
public void Show(CardDescriptor cd) { EventSystem.current.SetSelectedGameObject(null); //Debug.Log( "Showing: " + cd.name + " / " + cd.id ); //clear values thumbnail.color = new Color(1, 1, 1, 0); bonusNameText.text = ""; bonusText.text = ""; enemyName.text = ""; ignoreText.text = ""; spaceListen = true; colorPip.color = DataStore.pipColors[cd.colorIndex].ToColor(); continueText.text = DataStore.uiLanguage.uiSetup.continueBtn; cardDescriptor = cd; cardInstruction = DataStore.activationInstructions.Where(x => x.instID == cd.id).FirstOr(null); if (cardInstruction == null) { Debug.Log("cardInstruction is NULL: " + cd.id); GlowEngine.FindObjectsOfTypeSingle <QuickMessage>().Show("EnemyActivationPopup: cardInstruction is NULL: " + cd.id); return; } cardPrefab.InitCard(cd); //== no longer an issue //if ( cardInstruction == null ) //{ // //not all elites have their own instruction, resulting in null found, so get its regular version instruction set by name instead // int idx = cd.name.IndexOf( '(' ); // if ( idx > 0 ) // { // string nonelite = cd.name.Substring( 0, idx ).Trim(); // cardInstruction = DataStore.activationInstructions.Where( x => x.instName == nonelite ).FirstOr( null ); // Debug.Log( "TRYING REGULAR INSTRUCTION" ); // if ( cardInstruction == null ) // { // Debug.Log( "CAN'T FIND INSTRUCTION FOR: " + cd.id + "/" + nonelite ); // return; // } // } //} gameObject.SetActive(true); fader.color = new Color(0, 0, 0, 0); fader.DOFade(.95f, 1); cg.DOFade(1, .5f); transform.GetChild(1).localScale = new Vector3(.85f, .85f, .85f); transform.GetChild(1).DOScale(1, .5f).SetEase(Ease.OutExpo); SetThumbnail(cd); enemyName.text = cd.name.ToLower(); if (!string.IsNullOrEmpty(cd.ignored)) { ignoreText.text = $"<color=\"red\"><font=\"ImperialAssaultSymbols SDF\">F</font></color>" + cd.ignored; } else { ignoreText.text = ""; } if (!cardDescriptor.hasActivated) { //if multiple card instructions, pick 1 int[] rnd = GlowEngine.GenerateRandomNumbers(cardInstruction.content.Count); InstructionOption io = cardInstruction.content[rnd[0]]; CardDescriptor potentialRebel = FindRebel(); if (potentialRebel != null) { rebel1 = potentialRebel.name; } else { rebel1 = DataStore.uiLanguage.uiMainApp.noneUC; } ParseInstructions(io); ParseBonus(cd.id); //save this card's activation state cardDescriptor.hasActivated = true; cardDescriptor.rebelName = rebel1; cardDescriptor.instructionOption = io; cardDescriptor.bonusName = bonusNameText.text; cardDescriptor.bonusText = bonusText.text; } else { CardDescriptor potentialRebel = FindRebel(); if (cardDescriptor.rebelName != null) { rebel1 = cardDescriptor.rebelName; } else if (potentialRebel != null) { rebel1 = potentialRebel.name; } else { rebel1 = DataStore.uiLanguage.uiMainApp.noneUC; } if (cardDescriptor.instructionOption != null) { ParseInstructions(cardDescriptor.instructionOption); } else { InstructionOption io = cardInstruction.content[GlowEngine.GenerateRandomNumbers(cardInstruction.content.Count)[0]]; ParseInstructions(io); cardDescriptor.instructionOption = io; } if (cardDescriptor.bonusName != null && cardDescriptor.bonusText != null) { bonusNameText.text = cardDescriptor.bonusName; bonusText.text = cardDescriptor.bonusText; } else { ParseBonus(cd.id); cardDescriptor.bonusName = bonusNameText.text; cardDescriptor.bonusText = bonusText.text; } } }
public void OnPointerClick() { CardViewPopup cardViewPopup = GlowEngine.FindObjectsOfTypeSingle <CardViewPopup>(); cardViewPopup.Show(cardDescriptor); }
public void OnPointerEnter(PointerEventData eventData) { GlowEngine.FindObjectsOfTypeSingle <Tooltip>().Show(tooltip); }
public void OnPointerExit(PointerEventData eventData) { GlowEngine.FindObjectsOfTypeSingle <Tooltip>().Hide(); }
public void OnOptions() { EventSystem.current.SetSelectedGameObject(null); soundController.PlaySound(FX.Click); GlowEngine.FindObjectsOfTypeSingle <SettingsScreen>().Show(OnSettingsClose, true); }