//public void AddGold(int amount) //{ // Gold += amount; // EventData eventData = new EventData("OnGoldCountChangedEvent"); // GameManager.Instance.EventManager.CallOnGoldCountChangedEvent(eventData); // //TROPHY EarnXGoldCumulatively // GameManager.Instance.Player.OnTrophyEvent(ETrophyType.EarnXGoldCumulatively, amount); // //TROPHY HaveXGoldInTheBank // int val = GameManager.Instance.Player.TrophiesItems[ETrophyType.HaveXGoldInTheBank].Param; // GameManager.Instance.Player.OnTrophyEvent(ETrophyType.HaveXGoldInTheBank, val, false); // // //} //public void RemoveGold(int amount) //{ // Gold -= amount; // EventData eventData = new EventData("OnGoldCountChangedEvent"); // GameManager.Instance.EventManager.CallOnGoldCountChangedEvent(eventData); //} ////Trophies public void OnTrophyEvent(ETrophyType tType, int param, bool commulative = true) { if (TrophiesItems[tType].Completed) { return; } int newParam = 0; if (commulative) { newParam = TrophiesItems[tType].Param + param; } else { newParam = param; } TrophyData tData = GameManager.Instance.GameData.XMLtrophiesData[tType]; if (newParam > tData.Param) { newParam = tData.Param; } TrophiesItems[tType].Param = newParam; if (newParam == tData.Param) { // completed Debug.Log("Trophy " + tType.ToString() + " completed!"); TrophiesItems[tType].Completed = true; EventData eventData = new EventData("OnTrophyCompletedEvent"); eventData.Data["type"] = tType; GameManager.Instance.EventManager.CallOnTrophyCompletedEvent(eventData); //TROPHY GetAllOtherTrophies - check if final trophy completed int completedAmount = 0; foreach (var trophy in TrophiesItems) { if (trophy.Value.Completed) { ++completedAmount; } } if (completedAmount == TrophiesItems.Count - 1) { // completed all trophies! Debug.Log("All trophies " + tType.ToString() + " completed!"); TrophiesItems[ETrophyType.GetAllOtherTrophies].Param = 1; TrophiesItems[ETrophyType.GetAllOtherTrophies].Completed = true; EventData eventData2 = new EventData("OnTrophyCompletedEvent"); eventData2.Data["type"] = ETrophyType.GetAllOtherTrophies; GameManager.Instance.EventManager.CallOnTrophyCompletedEvent(eventData2); } } }
public static TrophyData[] GetCachedTrophyData() { PrxTrophyLockList(); int num = PrxTrophyGetTrophyDataCount(); TrophyData[] array = new TrophyData[num]; for (int i = 0; i < num; i++) { PrxTrophyGetTrophyData(i, out array[i]); } PrxTrophyUnlockList(); return(array); }
public void UpdateTrophy(ETrophyType id) { Id = id; Group.alpha = 1; TrophyData trophyData = GameManager.Instance.GameData.XMLtrophiesData[id]; TrophyCompleteData completeData = GameManager.Instance.Player.TrophiesItems[id]; // progress if (trophyData.Param <= 1 || trophyData.IsSingle) { ProgressText.gameObject.SetActive(false); } else { ProgressText.gameObject.SetActive(true); //if (Id == ETrophyType.PlayMoreThan5hoursCumulative) //{ // int hours = completeData.Param / (60 * 60); // ProgressText.text = hours.ToString() + "/5"; //} else { ProgressText.text = completeData.Param.ToString() + "/" + trophyData.Param.ToString(); } } // money MoneyText.text = trophyData.Reward.ToString(); // description text DescriptionText.text = Localer.GetText(id.ToString()); // trophy icon if (completeData.Completed) { CompleteObj.SetActive(true); Filler.gameObject.SetActive(false); } else { CompleteObj.SetActive(false); if (completeData.Param <= 0) { Filler.gameObject.SetActive(false); } else { Filler.gameObject.SetActive(true); Filler.fillAmount = (float)completeData.Param / (float)trophyData.Param; } } }
public void SaveTrophyData(TrophyData trophyData) { var yamlFile = Path.Combine(GameFolder, YamlFiles[6]); _skeletonGameSerializer.SerializeYaml(yamlFile, trophyData); }
public void Initialize(TrophyData data) { this.data = data; Refresh(); }
private static extern ErrorCode PrxTrophyGetTrophyData(int index, out TrophyData data);