public static MaterialPair GetMaterialPairFromRewardAndColor(string _rewardId, string _color1, string _color2) { Reward reward = RewardSystemManager.GetRewardById(_rewardId); MaterialPair mp = new MaterialPair(_color1, reward.Material1, _color2, reward.Material2); return(mp); }
protected override void GameSetup() { base.GameSetup(); if (AppConstants.DebugPanelEnabled) { SRDebug.Init(); } // GameplayModule if (GetComponentInChildren <ModuleInstaller <IGameplayModule> >()) { IGameplayModule moduleInstance = GetComponentInChildren <ModuleInstaller <IGameplayModule> >().InstallModule(); Modules.GameplayModule.SetupModule(moduleInstance, moduleInstance.Settings); } gameObject.AddComponent <MiniGameAPI>(); LogManager = new LogManager(); PlayerProfileManager = new PlayerProfileManager(); gameObject.AddComponent <DebugManager>(); gameObject.AddComponent <NavigationManager>(); gameObject.AddComponent <KeeperManager>(); RewardSystemManager.Init(); InitTeacherForPlayer(); GameSettings.HighQualityGfx = false; }
/// <summary> /// Gets the material pair for standard reward. /// </summary> /// <param name="_rewardId">The reward identifier.</param> /// <param name="_colorId">The color identifier.</param> /// <returns></returns> public static MaterialPair GetMaterialPairFromRewardIdAndColorId(string _rewardId, string _colorId) { Reward reward = RewardSystemManager.GetRewardById(_rewardId); RewardColor color = config.RewardsColorPairs.Find(c => c.ID == _colorId); MaterialPair mp = new MaterialPair(color.Color1Name, reward.Material1, color.Color2Name, reward.Material2); return(mp); }
public Reward GetReward() { if (Type != RewardTypes.reward) { return(null); } return(RewardSystemManager.GetConfig().Rewards.Find(r => r.ID == ItemID)); }
public static GameObject MountModel(string _id, Transform _parent, MaterialPair _materialPair, ModelType _type = ModelType.AnturaForniture) { CleanTranformChildren(_parent); GameObject returnObject = MountModel(_id, _parent, _type); Reward actualReward = RewardSystemManager.GetRewardById(_id); SwitchMaterial(returnObject, _materialPair); return(returnObject); }
/// <summary> /// Charges the category list. /// </summary> void chargeCategoryList() { foreach (var reward in RewardSystemManager.GetConfig().Rewards) { if (!categoryList.Contains(reward.Category)) { categoryList.Add(reward.Category); } } }
public string GetRewardCategory() { if (Type != RewardTypes.reward) { return(string.Empty); } Reward reward = RewardSystemManager.GetConfig().Rewards.Find(r => r.ID == ItemID); if (reward != null) { return(reward.Category); } return(string.Empty); }
void SelectSwatch(RewardColorItem _colorData) { foreach (AnturaSpaceSwatchButton item in btsSwatches) { item.Toggle(item.Data == _colorData); } if (_colorData != null) { RewardSystemManager.SelectRewardColorItem(_colorData.ID, currRewardType); } else { Debug.Log("SelectSwatch > _colorData is NULL!"); } }
void Start() { // Fill with data JourneyPosition journeyPos = AppManager.I.Player.CurrentJourneyPosition; TfTitle.text = journeyPos.ToString(); if (!journeyPos.isMinor(AppManager.I.Player.MaxJourneyPosition)) { // First time playing this session: 0 stars SetStars(0); } else { int unlockedRewards = RewardSystemManager.GetUnlockedRewardForPlaysession(AppManager.I.Player.CurrentJourneyPosition.ToString()); SetStars(unlockedRewards + 1); } // PlaySessionData playSessionData = AppManager.I.DB.GetPlaySessionDataById(journeyPos.PlaySession); }
/// <summary> /// Unlocks all rewards. /// </summary> public static void UnlockAllRewards() { Debug.Log("Unlocking a lot of rewards"); // First reward manual add AppManager.I.Player.AddRewardUnlocked(RewardSystemManager.GetFirstAnturaReward(RewardTypes.reward)); var actualCurrentJourneyPosition = AppManager.I.Player.CurrentJourneyPosition; var allPlaySessionInfos = AppManager.I.Teacher.scoreHelper.GetAllPlaySessionInfo(); for (int i = 0; i < allPlaySessionInfos.Count; i++) { AppManager.I.Player.SetCurrentJourneyPosition(AppManager.I.Teacher.journeyHelper.PlaySessionIdToJourneyPosition(allPlaySessionInfos[i].data.Id)); foreach (RewardPack pack in RewardSystemManager.GetNextRewardPack()) { AppManager.I.Player.AddRewardUnlocked(pack); } } AppManager.I.Player.SetCurrentJourneyPosition(actualCurrentJourneyPosition); }
IEnumerator StartReward() { // Wait for animation to complete //RewardsAnimator animator = this.GetComponent<RewardsAnimator>(); //while (!animator.IsComplete) // yield return null; yield return(new WaitForSeconds(3.5f)); /* FIRST CONTACT FEATURE */ if (AppManager.I.Player.IsFirstContact()) { KeeperManager.I.PlayDialog(Db.LocalizationDataId.Reward_Intro); // Clean and Charge antura reward. AnturaModelManager.Instance.ClearLoadedRewards(); RewardPack firstUnlockedReward = RewardSystemManager.GetFirstAnturaReward(RewardTypes.reward); AppManager.I.Player.AddRewardUnlocked(firstUnlockedReward); AnturaModelManager.Instance.LoadRewardPackOnAntura(firstUnlockedReward); } else { int rnd = Random.Range(1, 3); switch (rnd) { case 1: KeeperManager.I.PlayDialog(Db.LocalizationDataId.Reward_Big_1); break; case 3: KeeperManager.I.PlayDialog(Db.LocalizationDataId.Reward_Big_2); break; default: KeeperManager.I.PlayDialog(Db.LocalizationDataId.Reward_Big_3); break; } AnturaModelManager.Instance.ClearLoadedRewards(); RewardPack newUnlockedReward = RewardSystemManager.GetNextRewardPack()[0]; AppManager.I.Player.AddRewardUnlocked(newUnlockedReward); AnturaModelManager.Instance.LoadRewardPackOnAntura(newUnlockedReward); } /* --------------------- */ ContinueScreen.Show(Continue, ContinueScreenMode.Button); yield return(null); }
void Start() { // Navigation manager NavigationManager.I.CurrentScene = AppScene.PlaySessionResult; // Calculate items to unlock count int itemsToUnlock = NavigationManager.I.CalculateUnlockItemCount(); List <RewardPack> oldRewards = AppManager.I.Player.RewardsUnlocked.FindAll(ru => ru.PlaySessionId == AppManager.I.Player.CurrentJourneyPosition.ToString()); int itemAlreadyUnlocked = oldRewards.Count; for (int i = 0; i < itemsToUnlock - oldRewards.Count; i++) { // if necessary add one new random reward unlocked RewardPack newRewardToUnlock = RewardSystemManager.GetNextRewardPack()[0]; oldRewards.Add(newRewardToUnlock); AppManager.I.Player.AddRewardUnlocked(newRewardToUnlock); } // Show UI result and unlock transform parent where show unlocked items GameObject[] objs = new GameObject[] { }; objs = GameResultUI.ShowEndsessionResult(NavigationManager.I.UseEndSessionResults(), itemAlreadyUnlocked); for (int i = 0; i < objs.Length - oldRewards.Count; i++) { // if necessary add one new random reward not to be unlocked! oldRewards.Add(RewardSystemManager.GetNextRewardPack()[0]); } LogManager.I.LogPlaySessionScore(TeacherAI.I.journeyHelper.GetCurrentPlaySessionData().Id, objs.Length); // save max progression (internal check if necessary) NavigationManager.I.MaxJourneyPosistionProgress(); // for any rewards mount them model on parent transform object (objs) for (int i = 0; i < oldRewards.Count && i < objs.Length; i++) { ModelsManager.MountModel( oldRewards[i].ItemID, objs[i].transform, oldRewards[i].GetMaterialPair() ); } }
void LoadRewarsList(string _position = "") { ClearList(); List <Reward> rewards; if (_position != "") { rewards = RewardSystemManager.GetConfig().Rewards.FindAll(r => r.BoneAttach == _position); } else { rewards = RewardSystemManager.GetConfig().Rewards; } foreach (Reward reward in rewards) { Button b = Instantiate <Button>(ElementPrefab.GetComponent <Button>()); b.transform.SetParent(ElementContainer.transform); b.GetComponentInChildren <Text>().text = reward.RewardName; b.onClick.AddListener(delegate { OnClickButton(b.GetComponentInChildren <Text>().text); }); } }
/// <summary> /// Return PlayerProfile with avatar id in param. /// If not exist create new with default settings. /// </summary> /// <param name="_avatarId"></param> /// <returns></returns> public PlayerProfile CreateOrLoadPlayerProfile(int _avatarId) { bool isNew = false; PlayerProfile returnProfile = LoadPlayerProfileByAvatarId(_avatarId); if (returnProfile == null) { returnProfile = new PlayerProfile(); isNew = true; // create new returnProfile.Id = AvailablePlayerProfiles.Count + 1; returnProfile.AvatarId = _avatarId; returnProfile.Key = returnProfile.Id.ToString(); returnProfile = AppManager.I.Modules.PlayerProfile.CreateNewPlayer(returnProfile) as PlayerProfile; } // Create new antura skin RewardPack tileTexture = RewardSystemManager.GetFirstAnturaReward(RewardTypes.texture); returnProfile.AddRewardUnlocked(tileTexture); returnProfile.CurrentAnturaCustomizations.TileTexture = tileTexture; RewardPack decalTexture = RewardSystemManager.GetFirstAnturaReward(RewardTypes.decal); returnProfile.AddRewardUnlocked(decalTexture); returnProfile.CurrentAnturaCustomizations.DecalTexture = decalTexture; // ----- AppManager.I.PlayerProfileManager.CurrentPlayer = returnProfile as PlayerProfile; AppManager.I.PlayerProfileManager.availablePlayerProfiles.Add(AppManager.I.PlayerProfileManager.CurrentPlayer); AppManager.I.PlayerProfileManager.CurrentPlayer.Save(); SaveGameSettings(); if (isNew && OnNewProfileCreated != null) { OnNewProfileCreated(); } return(AppManager.I.PlayerProfileManager.CurrentPlayer); }
/// <summary> /// Loads the reward on model. /// </summary> /// <param name="_id">The identifier.</param> /// <returns></returns> public GameObject LoadRewardOnAntura(RewardPack _rewardPack) { Reward reward = RewardSystemManager.GetConfig().Rewards.Find(r => r.ID == _rewardPack.ItemID); if (reward == null) { Debug.LogFormat("Reward {0} not found!", _rewardPack.ItemID); return(null); } // Check if already charged reward of this category LoadedModel loadedModel = LoadedModels.Find(lm => lm.Reward.GetRewardCategory() == reward.Category); if (loadedModel != null) { Destroy(loadedModel.GO); LoadedModels.Remove(loadedModel); } // Load Model string boneParent = reward.BoneAttach; Transform transformParent = transform; GameObject rewardModel = null; switch (boneParent) { case "dog_head": transformParent = Dog_head; //if (Dog_head_pointer) // Destroy(Dog_head_pointer.gameObject); //Dog_head_pointer = ModelsManager.MountModel(reward.ID, transformParent).transform; rewardModel = ModelsManager.MountModel(reward.ID, transformParent); break; case "dog_spine01": transformParent = Dog_spine01; //if (Dog_spine01_pointer) // Destroy(Dog_spine01_pointer.gameObject); //Dog_spine01_pointer = ModelsManager.MountModel(reward.ID, transformParent).transform; rewardModel = ModelsManager.MountModel(reward.ID, transformParent); break; case "dog_jaw": transformParent = Dog_jaw; //if (Dog_jaw_pointer) // Destroy(Dog_jaw_pointer.gameObject); //Dog_jaw_pointer = ModelsManager.MountModel(reward.ID, transformParent).transform; rewardModel = ModelsManager.MountModel(reward.ID, transformParent); break; case "dog_Tail4": transformParent = Dog_Tail3; //if (Dog_Tail3_pointer) // Destroy(Dog_Tail3_pointer.gameObject); //Dog_Tail3_pointer = ModelsManager.MountModel(reward.ID, transformParent).transform; rewardModel = ModelsManager.MountModel(reward.ID, transformParent); break; case "dog_R_ear04": transformParent = Dog_R_ear04; //if (dog_R_ear04_pointer) // Destroy(dog_R_ear04_pointer.gameObject); //dog_R_ear04_pointer = ModelsManager.MountModel(reward.ID, transformParent).transform; rewardModel = ModelsManager.MountModel(reward.ID, transformParent); break; case "dog_L_ear04": transformParent = Dog_L_ear04; //if (dog_L_ear04_pointer) // Destroy(dog_L_ear04_pointer.gameObject); //dog_L_ear04_pointer = ModelsManager.MountModel(reward.ID, transformParent).transform; rewardModel = ModelsManager.MountModel(reward.ID, transformParent); break; default: break; } // Set materials ModelsManager.SwitchMaterial(rewardModel, _rewardPack.GetMaterialPair()); // Save on LoadedModel List LoadedModels.Add(new LoadedModel() { Reward = _rewardPack, GO = rewardModel }); return(rewardModel); }
public void GoUnlockAllRewards() { // moved to centralized location RewardSystemManager.UnlockAllRewards(); }
public MaterialPair GetMaterialPair() { return(RewardSystemManager.GetMaterialPairFromRewardIdAndColorId(ItemID, ColorId)); }
IEnumerator CO_SelectCategory(AnturaSpaceCategoryButton.AnturaSpaceCategory _category) { BTRemoveMods.gameObject.SetActive(false); // Get rewards list currCategory = _category; currRewardType = CategoryToRewardType(_category); bool useImages = _category == AnturaSpaceCategoryButton.AnturaSpaceCategory.Texture || _category == AnturaSpaceCategoryButton.AnturaSpaceCategory.Decal; foreach (AnturaSpaceItemButton item in btsItems) { item.SetImage(!useImages); } if (_category == AnturaSpaceCategoryButton.AnturaSpaceCategory.Ears) { currRewardDatas = RewardSystemManager.GetRewardItemsByRewardType(currRewardType, rewardsContainers, "EAR_L"); List <Transform> altRewardContainers = new List <Transform>(rewardsContainers); altRewardContainers.RemoveRange(0, currRewardDatas.Count); currRewardDatas.AddRange(RewardSystemManager.GetRewardItemsByRewardType(currRewardType, altRewardContainers, "EAR_R")); } else { currRewardDatas = RewardSystemManager.GetRewardItemsByRewardType(currRewardType, useImages ? rewardsImagesContainers : rewardsContainers, _category.ToString()); } yield return(null); // Hide non-existent items for (int i = currRewardDatas.Count - 1; i < btsItems.Length; ++i) { btsItems[i].gameObject.SetActive(false); } // Setup and show items RewardItem selectedRewardData = null; for (int i = 0; i < currRewardDatas.Count; ++i) { RewardItem rewardData = currRewardDatas[i]; AnturaSpaceItemButton item = btsItems[i]; item.gameObject.SetActive(true); item.Data = rewardData; if (rewardData != null) { if (!useImages) { item.RewardContainer.gameObject.SetLayerRecursive(GenericUtilities.LayerMaskToIndex(RewardsLayer)); CameraHelper.FitRewardToUICamera(item.RewardContainer.GetChild(0), item.RewardCamera, FlipRewards); } item.SetAsNew(rewardData.IsNew); item.Toggle(rewardData.IsSelected); if (rewardData.IsSelected) { selectedRewardData = rewardData; } } else { item.Toggle(false); } item.Lock(rewardData == null); } ItemsContainer.gameObject.SetActive(true); showItemsTween.PlayForward(); // Select eventual reward if (selectedRewardData != null) { SelectReward(selectedRewardData); } else { showSwatchesTween.Rewind(); } }
void SelectReward(RewardItem _rewardData) { showSwatchesTween.Rewind(); bool isTextureOrDecal = currCategory == AnturaSpaceCategoryButton.AnturaSpaceCategory.Texture || currCategory == AnturaSpaceCategoryButton.AnturaSpaceCategory.Decal; BTRemoveMods.gameObject.SetActive(!isTextureOrDecal && _rewardData != null); if (_rewardData == null) { foreach (AnturaSpaceItemButton item in btsItems) { item.Toggle(false); } if (currCategory == AnturaSpaceCategoryButton.AnturaSpaceCategory.Ears) { AnturaModelManager.Instance.ClearLoadedRewardInCategory("EAR_L"); AnturaModelManager.Instance.ClearLoadedRewardInCategory("EAR_R"); } else { AnturaModelManager.Instance.ClearLoadedRewardInCategory(currCategory.ToString()); } return; } foreach (AnturaSpaceItemButton item in btsItems) { item.Toggle(item.Data == _rewardData); } currSwatchesDatas = RewardSystemManager.SelectRewardItem(_rewardData.ID, currRewardType); if (currSwatchesDatas.Count == 0) { Debug.Log("No color swatches for the selected reward!"); return; } // Hide non-existent swatches for (int i = currSwatchesDatas.Count - 1; i < btsSwatches.Length; ++i) { btsSwatches[i].gameObject.SetActive(false); } // Setup and show swatches RewardColorItem selectedSwatchData = null; for (int i = 0; i < currSwatchesDatas.Count; ++i) { RewardColorItem swatchData = currSwatchesDatas[i]; AnturaSpaceSwatchButton swatch = btsSwatches[i]; swatch.gameObject.SetActive(true); swatch.Data = swatchData; if (swatchData != null) { swatch.SetAsNew(swatchData.IsNew); swatch.Toggle(swatchData.IsSelected); swatch.SetColors(GenericUtilities.HexToColor(swatchData.Color1RGB), GenericUtilities.HexToColor(swatchData.Color2RGB)); if (swatchData.IsSelected) { selectedSwatchData = swatchData; } } else { swatch.Toggle(false); } swatch.Lock(swatchData == null); } SwatchesContainer.gameObject.SetActive(true); showSwatchesTween.PlayForward(); // Select eventual color if (selectedSwatchData != null) { SelectSwatch(selectedSwatchData); } }