コード例 #1
0
    public void CreateGroupFuncDropDown()
    {
        string groupNameText = groupNameField.GetComponent <InputField>().text;

        if (groupNameText == "" || groupNameText == null)
        {
            errorObj.SetActive(true);
        }
        else
        {
            errorObj.SetActive(false);

            so = SaveManager.Load();

            SerializableGroupClass sc = new SerializableGroupClass();
            sc.GroupName = groupNameText;
            sc.cards     = new List <SerialisableCardClass>();

            sc.dateCreated = System.DateTime.Now.ToString("yyyy/MM/dd/HH/mm/ss");

            so.cardGroups.Add(sc);

            SaveManager.Save(so);
            Debug.Log("Added " + groupNameText + " to card groups");

            ClearInputField();
            updateDropDown();
            ClosePanel();
        }
    }
コード例 #2
0
    //hard codes the flashcard templates into "so"
    public void createNotifTemps()
    {
        PlayerPrefs.SetInt("CreateCardTemps", 0);
        closePanel();
        so = SaveManager.Load();

        //sets flashcard group details
        SerializableGroupClass newGroup = new SerializableGroupClass();

        newGroup.GroupName   = "Example flashcard group";
        newGroup.dateCreated = System.DateTime.Now.ToString("YYYY/MM/DD/HH/mm/ss");
        newGroup.cards       = new List <SerialisableCardClass>();

        //adds the newcards to the new flashcard group
        newGroup.cards.Add(createCard("Write the word on the front", "Write the definition or important point on the back and keep " +
                                      "it short, to the point and in your own words."));
        newGroup.cards.Add(createCard("Goodbye (To French) #Translation", "Au revoir"));
        newGroup.cards.Add(createCard("heritage #Definition", "noun; practices that are handed down from the past by tradition"));
        newGroup.cards.Add(createCard("4x4 = ? #Answer", "4x4 = 16"));
        newGroup.cards.Add(createCard("How tall is Mount Everest? #Facts", "8,848 metres above sea level"));

        //create an image example card
        SerialisableCardClass newCard = new SerialisableCardClass();
        string newPath = saveImage();

        newCard.FirstContent    = "Weight #add your own images";
        newCard.SecondImagePath = newPath;
        newCard.dateCreated     = System.DateTime.Now.ToString("YYYY/MM/DD/HH/mm/ss");
        newGroup.cards.Add(newCard);

        so.cardGroups.Add(newGroup);
        SaveManager.Save(so);

        ListControl.GetComponent <ButtonListControl>().UpdateList();//update scrollable list to show new group of flashcards
    }
コード例 #3
0
    public void EditGroupNameFunc()
    {
        string groupNameText = groupNameField.GetComponent <InputField>().text;

        if (groupNameText == "" || groupNameText == null)
        {
            errorObj.SetActive(true);
        }
        else
        {
            errorObj.SetActive(false);

            so = SaveManager.Load();
            int curGroupIndex = PlayerPrefs.GetInt("CurrentGroupIndex");

            //save group
            SerializableGroupClass sc = new SerializableGroupClass();
            sc = so.cardGroups[curGroupIndex];

            //remove group
            so.cardGroups.RemoveAt(curGroupIndex);

            sc.GroupName = groupNameText;
            so.cardGroups.Add(sc);

            SaveManager.Save(so);
            Debug.Log("Added " + groupNameText + " to card groups");

            ClearInputField();
            UpdateDispList();
            ClosePanel();
        }
    }