コード例 #1
0
    private void OnPopupButtonPressedEvent(string givenString, AskNamePopUp.ButtonType buttonType, AskNamePopUp popup)
    {
        namePopUp.PopupButtonPressedEvent -= OnPopupButtonPressedEvent;
        if (buttonType == AskNamePopUp.ButtonType.Create)
        {
            if (allData.GetFullWordListByListName(givenString) != null)
            {
                popup.SetWarningText("Name '" + givenString + "' already in use!");
                CreateNewList();
                return;
            }

            allData.AllWordlists.Add(new FullWordListData(givenString, new WordListSectionData[] { new WordListSectionData(FullWordListData.BASE_LANGUAGE, new string[] { }) }));
            SaveModifiedData();
            OpenModifyScreen(givenString);
        }

        popup.Clean();
    }
コード例 #2
0
    private void OnPopupButtonPressedEvent(string givenName, AskNamePopUp.ButtonType buttonType, AskNamePopUp popUp)
    {
        askNamePopUp.PopupButtonPressedEvent -= OnPopupButtonPressedEvent;
        if (buttonType == AskNamePopUp.ButtonType.Create)
        {
            if (currentData.GetSectionByLanguage(givenName) != null)
            {
                popUp.SetWarningText("Language name '" + givenName + "' already in use!");
                CreateLanguage();
                return;
            }

            List <string> translationWordsList = new List <string>();
            foreach (string word in currentData.GetSectionByLanguage(FullWordListData.BASE_LANGUAGE).Words)
            {
                translationWordsList.Add("");
            }
            string languageName = givenName;
            WordListSectionData newLanguageSection = new WordListSectionData(languageName, translationWordsList.ToArray());
            currentData.AllWordListDatas.Add(newLanguageSection);
            SelectLanguage(languageName);
        }
        popUp.Clean();
    }