Exemple #1
0
    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();
    }