private void CreateCategory(string _title, Texture2D _img, AudioClip _clip, List <string> _cardKeys = null, List <bool> _cardVisibles = null) { var categoryKey = $"{patientDataManager.GetUserLogin()}{_title}{saveSystem.GetCustomCategoryData().keys.Count}"; var image1Key = $"{patientDataManager.GetUserLogin()}{saveSystem.GetCustomCategoryData().keys.Count}image1"; var audio1Key = $"{patientDataManager.GetUserLogin()}{saveSystem.GetCustomCategoryData().keys.Count}audio1"; var size = (_img.height > _img.width) ? _img.width : _img.height; var rect = new Rect(0, 0, size, size); categoryData = new CategoryData( (int)categoryManager.gameName, _title, Sprite.Create(_img, rect, Vector2.zero), _clip, true, (_cardKeys == null) ? new List <string>() : _cardKeys, (_cardVisibles == null) ? new List <bool>() : _cardVisibles, true); saveSystem.SaveCustomCategoryFromLocal(categoryData, categoryKey, image1Key, audio1Key); storage.AddCategoryToBase(categoryData, categoryKey, image1Key, audio1Key); categoryManager.AddCategory(categoryKey); Reset(); }
public CategorySaveData LoadCustomCategoriesFromLocal() { string key = $"{patientDataManager.GetUserLogin()}_Custom_categories"; if (!PlayerPrefs.HasKey(key)) { return(new CategorySaveData(null, null, null, null, null, null)); } else { return(JsonUtility.FromJson <CategorySaveData>(PlayerPrefs.GetString(key))); } }
private void CreateCard( string _title, string _titleForm, Texture2D _image1data, Texture2D _image2data, Texture2D _image3data, AudioClip _audioClip, AudioClip _audioClipForm) { var cardKey = $"{patientDataManager.GetUserLogin()}_{_title}_{saveSystem.GetCustomCardsData().keys.Count}"; var image1Key = $"{patientDataManager.GetUserLogin()}_{saveSystem.GetCustomCardsData().keys.Count}_image1"; var image2Key = $"{patientDataManager.GetUserLogin()}_{saveSystem.GetCustomCardsData().keys.Count}_image2"; var image3Key = $"{patientDataManager.GetUserLogin()}_{saveSystem.GetCustomCardsData().keys.Count}_image3"; var audio1Key = $"{patientDataManager.GetUserLogin()}{saveSystem.GetCustomCardsData().keys.Count}audio1"; var audio2Key = $"{patientDataManager.GetUserLogin()}{saveSystem.GetCustomCardsData().keys.Count}audio2"; var size1 = (_image1data.height > _image1data.width) ? _image1data.width : _image1data.height; var rect1 = new Rect(0, 0, size1, size1); var size2 = (_image2data.height > _image2data.width) ? _image2data.width : _image2data.height; var rect2 = new Rect(0, 0, size2, size2); var size3 = (_image3data.height > _image3data.width) ? _image3data.width : _image3data.height; var rect3 = new Rect(0, 0, size3, size3); data = new CardData( _title, _titleForm, Sprite.Create(_image1data, rect1, Vector2.zero), Sprite.Create(_image2data, rect2, Vector2.zero), Sprite.Create(_image2data, rect3, Vector2.zero), _audioClip, _audioClipForm, true); saveSystem.SaveCustomCardFromLocal(data, cardKey, image1Key, image2Key, image3Key, audio1Key, audio2Key); storage.AddNewCardToBase(data, cardKey); categoryManager.AddCard(cardKey); Reset(); }