void CheckToContinue() { if (this.isCharacterDataLoaded && this.isCharacterInventoryLoaded) { PF_PlayerData.PlayerClassTypes ponyType = (PF_PlayerData.PlayerClassTypes)Enum.Parse(typeof(PF_PlayerData.PlayerClassTypes), PF_PlayerData.activeCharacter.baseClass.CatalogCode); switch ((int)ponyType) { case 0: foreach (var item in this.colorize) { item.color = PF_GamePlay.ClassColor1; } break; case 1: foreach (var item in this.colorize) { item.color = PF_GamePlay.ClassColor2; } break; case 2: foreach (var item in this.colorize) { item.color = PF_GamePlay.ClassColor3; } break; default: Debug.LogWarning("Unknown Class type detected..."); break; } PF_PlayerData.UpdateActiveCharacterData(); foreach (Transform each in this.UiObjects) { each.gameObject.SetActive(true); //<---- BOOM Null Ref each.BroadcastMessage("Init", SendMessageOptions.DontRequireReceiver); } ResetDataChecks(); } }
public void SwitchPonyDetails(ArrowUI pony) { if (pony.details != null && pony.details.CatalogCode != null) { PF_PlayerData.PlayerClassTypes ponyType = (PF_PlayerData.PlayerClassTypes)Enum.Parse(typeof(PF_PlayerData.PlayerClassTypes), pony.details.CatalogCode); switch ((int)ponyType) { case 0: foreach (var item in this.colorize) { item.color = PF_GamePlay.ClassColor1; } break; case 1: foreach (var item in this.colorize) { item.color = PF_GamePlay.ClassColor2; } break; case 2: foreach (var item in this.colorize) { item.color = PF_GamePlay.ClassColor3; } break; default: Debug.LogWarning("Unknown Class type detected..."); break; } hp.text = string.Format("{0}", pony.details.BaseHP); dp.text = string.Format("{0}", pony.details.BaseDP); sp.text = string.Format("{0}", pony.details.BaseSP); if (PF_GameData.Spells.ContainsKey(pony.details.Spell1)) { spells[0].spellName.text = pony.details.Spell1; spells[0].spellImage.overrideSprite = GameController.Instance.iconManager.GetIconById(PF_GameData.Spells[pony.details.Spell1].Icon); spells[0].attackValue.text = "" + PF_GameData.Spells[pony.details.Spell1].BaseDmg; spells[0].upgradeLevels.text = "" + PF_GameData.Spells[pony.details.Spell1].UpgradeLevels; spells[0].cooldown.text = "" + PF_GameData.Spells[pony.details.Spell1].Cooldown; spells[0].levelReq.text = "" + PF_GameData.Spells[pony.details.Spell1].LevelReq; } if (PF_GameData.Spells.ContainsKey(pony.details.Spell2)) { spells[1].spellName.text = pony.details.Spell2; spells[1].spellImage.overrideSprite = GameController.Instance.iconManager.GetIconById(PF_GameData.Spells[pony.details.Spell2].Icon); spells[1].attackValue.text = "" + PF_GameData.Spells[pony.details.Spell2].BaseDmg; spells[1].upgradeLevels.text = "" + PF_GameData.Spells[pony.details.Spell2].UpgradeLevels; spells[1].cooldown.text = "" + PF_GameData.Spells[pony.details.Spell2].Cooldown; spells[1].levelReq.text = "" + PF_GameData.Spells[pony.details.Spell2].LevelReq; } if (PF_GameData.Spells.ContainsKey(pony.details.Spell3)) { spells[2].spellName.text = pony.details.Spell3; spells[2].spellImage.overrideSprite = GameController.Instance.iconManager.GetIconById(PF_GameData.Spells[pony.details.Spell3].Icon); spells[2].attackValue.text = "" + PF_GameData.Spells[pony.details.Spell3].BaseDmg; spells[2].upgradeLevels.text = "" + PF_GameData.Spells[pony.details.Spell3].UpgradeLevels; spells[2].cooldown.text = "" + PF_GameData.Spells[pony.details.Spell3].Cooldown; spells[2].levelReq.text = "" + PF_GameData.Spells[pony.details.Spell3].LevelReq; } } }
public void Init() { if (cPicker.selectedSlot.saved != null) { if (PF_GameData.Achievements != null && PF_GameData.Achievements.Count > 0) { while (items.Count < PF_GameData.Achievements.Count) { AchievementItem achvItem = Instantiate(achievementItemPrefab); achvItem.transform.SetParent(this.listView, false); items.Add(achvItem); } for (int z = 0; z < items.Count; z++) { var kvp = PF_GameData.Achievements.ElementAt(z); // check here for already awarded this.colorize.Add(items[z].coloredBar); items[z].icon.overrideSprite = GameController.Instance.iconManager.GetIconById(kvp.Value.Icon); items[z].Name.text = kvp.Key; items[z].progressBar.maxValue = kvp.Value.Threshold; if (PF_PlayerData.DoesCharacterHaveAchievement(this.cPicker.selectedSlot.saved.characterDetails.CharacterId, kvp.Key)) { items[z].CompleteAchievement(); StartCoroutine(items[z].progressBar.UpdateBar(kvp.Value.Threshold)); items[z].display.text = GlobalStrings.COMPLETE_MSG; } else { items[z].ResetImage(); int progress = CalcProgress(kvp.Value); items[z].display.text = string.Format("{0:n0}/{1:n0} {2}", AchievementDisplayNumber(progress), AchievementDisplayNumber(kvp.Value.Threshold), kvp.Value.MatchingStatistic); StartCoroutine(items[z].progressBar.UpdateBar(progress)); } } } } PF_PlayerData.PlayerClassTypes ponyType = (PF_PlayerData.PlayerClassTypes)Enum.Parse(typeof(PF_PlayerData.PlayerClassTypes), cPicker.selectedSlot.saved.baseClass.CatalogCode); switch ((int)ponyType) { case 0: foreach (var item in this.colorize) { item.color = PF_GamePlay.ClassColor1; } break; case 1: foreach (var item in this.colorize) { item.color = PF_GamePlay.ClassColor2; } break; case 2: foreach (var item in this.colorize) { item.color = PF_GamePlay.ClassColor3; } break; default: Debug.LogWarning("Unknown Class type detected..."); break; } }
public void SelectSlot(CharacterSlot go) { if (this.selectedSlot != null && go.gameObject != this.selectedSlot.gameObject) { this.pPicker.DeselectArrows(); this.pickedPonyDetails.gameObject.SetActive(false); } else if (this.selectedSlot == null) { this.pPicker.DeselectArrows(); } foreach (Transform child in slots) { if (child.gameObject == go.gameObject) { child.GetComponent <CharacterSlot>().SelectSlot(); this.selectedSlot = go; // need to adjust the arrrows here to be in sync with the saved chars if (this.selectedSlot.saved == null) { int rng = UnityEngine.Random.Range(0, 3); ArrowUI slot; if (rng == 0) { slot = this.pPicker.Arrow1; } else if (rng == 1) { slot = this.pPicker.Arrow2; } else { slot = this.pPicker.Arrow3; } this.pPicker.selectedSlot = null; this.pPicker.SelectSlot(slot); HidePickedPonyDetails(); } else { PF_PlayerData.PlayerClassTypes ponyType = (PF_PlayerData.PlayerClassTypes)Enum.Parse(typeof(PF_PlayerData.PlayerClassTypes), this.selectedSlot.saved.baseClass.CatalogCode); UnityEvent afterSelect = new UnityEvent(); afterSelect.AddListener(() => { //ShowButtons(); ShowPickedPonyDetails(); }); switch ((int)ponyType) { case 0: pPicker.SelectArrow(0, afterSelect); pPicker.DisablePulsingButtons(); break; case 1: pPicker.SelectArrow(1, afterSelect); pPicker.DisablePulsingButtons(); break; case 2: pPicker.SelectArrow(2, afterSelect); pPicker.DisablePulsingButtons(); break; default: Debug.LogWarning("Unknown Class type detected..."); break; } } } else { child.GetComponent <CharacterSlot>().DeselectSlot(); } } if (selectedSlot == null || selectedSlot.saved != null) { ArrowPickerController.instance.DisablePulsingButtons(); } else { ArrowPickerController.instance.EnablePulsingButtons(); } }