public void AchievementClaim(AchievementMissionBase m) { PlayerData.instance.ClaimAchievementMission(m); // Rebuild the UI with the new missions Open(); achievementPopup.gameObject.SetActive(true); rewardCount.text = m.reward.ToString(); }
public void AddAchievementMission(int num) { //int val = Random.Range(0, (int)MissionBase.MissionType.MAX); AchievementMissionBase newMission = AchievementMissionBase.GetNewMissionFromType((AchievementMissionBase.MissionType)num); newMission.Created(); achievementMissions.Add(newMission); }
public void FillWithMission(AchievementMissionBase m, MissionUI owner) { descText.text = m.GetMissionDesc(); rewardText.text = m.reward.ToString(); if (m.isComplete) { claimButton.gameObject.SetActive(true); if (!PlayerData.instance.koreanCheck) { claimButtonText.text = "CLAIM REWARD"; } else { claimButtonText.text = "보상 받기 !"; } progressText.gameObject.SetActive(false); background.color = completedColor; progressText.color = Color.white; descText.color = Color.white; rewardText.color = Color.white; claimButton.onClick.AddListener(delegate { owner.AchievementClaim(m); }); } else { claimButton.gameObject.SetActive(false); progressText.gameObject.SetActive(true); background.color = notCompletedColor; progressText.color = Color.black; descText.color = completedColor; progressText.text = ((int)m.progress) + " / " + ((int)m.max); } }
public void ClaimAchievementMission(AchievementMissionBase mission) { stars += mission.reward; #if UNITY_ANALYTICS // Using Analytics Standard Events v0.3.0 AnalyticsEvent.ItemAcquired( AcquisitionType.Premium, // Currency type "mission", // Context mission.reward, // Amount "coins", // Item ID //premium, // Item balance //"consumable", // Item type rank.ToString() // Level ); #endif achievementMissions.Remove(mission); //CheckMissionsCount(); Save(); }
public void Read() { BinaryReader r = new BinaryReader(new FileStream(saveFile, FileMode.Open)); int ver = r.ReadInt32(); if (ver < 6) { r.Close(); NewSave(); r = new BinaryReader(new FileStream(saveFile, FileMode.Open)); ver = r.ReadInt32(); } stars = r.ReadInt32(); /* * consumables.Clear(); * int consumableCount = r.ReadInt32(); * for (int i = 0; i < consumableCount; ++i) * { * consumables.Add((Consumable.ConsumableType)r.ReadInt32(), r.ReadInt32()); * } */ // Read character. characters.Clear(); int charCount = r.ReadInt32(); for (int i = 0; i < charCount; ++i) { string charName = r.ReadString(); /* * if (charName.Contains("Raccoon") && ver < 11) * {//in 11 version, we renamed Raccoon (fixing spelling) so we need to patch the save to give the character if player had it already * charName = charName.Replace("Racoon", "Raccoon"); * } */ characters.Add(charName); } // Read skin. skins.Clear(); int skinCount = r.ReadInt32(); for (int i = 0; i < skinCount; ++i) { string skinName = r.ReadString(); /* * if (charName.Contains("Raccoon") && ver < 11) * {//in 11 version, we renamed Raccoon (fixing spelling) so we need to patch the save to give the character if player had it already * charName = charName.Replace("Racoon", "Raccoon"); * } */ skins.Add(skinName); } tutorialCompletion = r.ReadBoolean(); tutorialCheck = r.ReadBoolean(); koreanCheck = r.ReadBoolean(); usedCharacter = r.ReadInt32(); usedSkin = r.ReadInt32(); /* * // Read character accesories. * characterAccessories.Clear(); * int accCount = r.ReadInt32(); * for (int i = 0; i < accCount; ++i) * { * characterAccessories.Add(r.ReadString()); * } * * // Read Themes. * themes.Clear(); * int themeCount = r.ReadInt32(); * for (int i = 0; i < themeCount; ++i) * { * themes.Add(r.ReadString()); * } * * usedTheme = r.ReadInt32(); */ // Save contains the version they were written with. If data are added bump the version & test for that version before loading that data. if (ver >= 2) { coins = r.ReadInt32(); } // Added highscores. if (ver >= 3) { highscores.Clear(); int count = r.ReadInt32(); for (int i = 0; i < count; ++i) { HighscoreEntry entry = new HighscoreEntry(); entry.name = r.ReadString(); entry.score = r.ReadInt32(); highscores.Add(entry); } } // Added missions. if (ver >= 4) { missions.Clear(); int count = r.ReadInt32(); for (int i = 0; i < count; ++i) { MissionBase.MissionType type = (MissionBase.MissionType)r.ReadInt32(); MissionBase tempMission = MissionBase.GetNewMissionFromType(type); tempMission.Deserialize(r); if (tempMission != null) { missions.Add(tempMission); } } achievementMissions.Clear(); int aCount = r.ReadInt32(); for (int i = 0; i < aCount; ++i) { AchievementMissionBase.MissionType type = (AchievementMissionBase.MissionType)r.ReadInt32(); AchievementMissionBase achievementTempMission = AchievementMissionBase.GetNewMissionFromType(type); achievementTempMission.Deserialize(r); if (achievementTempMission != null) { achievementMissions.Add(achievementTempMission); } } } // Added highscore previous name used. if (ver >= 7) { previousName = r.ReadString(); } /* * if (ver >= 8) * { * licenceAccepted = r.ReadBoolean(); * } */ if (ver >= 9) { masterVolume = r.ReadSingle(); musicVolume = r.ReadSingle(); masterSFXVolume = r.ReadSingle(); } if (ver >= 10) { ftueLevel = r.ReadInt32(); rank = r.ReadInt32(); adsActivatingTime = r.ReadInt64(); } r.Close(); }