void Update() { if (API_Storymode.getStoryQDone) { API_Storymode.getStoryQDone = false; current_question = new StoryModeQuestion(API_Storymode.jsonNodeStoryQ); populateFields(); panelObject.gameObject.SetActive(true); } }
//use this for initialization void Start() { editStoryModeQ = new StoryModeQuestion(questionId); selectedWorld = World_Select_Script.worldChoice; selectedSectionUnformat = Section_Select_Script.sectionChoice; selectedSection = selectedSectionUnformat.Replace(" ", "%20"); transform.Find("Panel_00").Find("World_Section_Subheader_Text").GetComponent <Text>().text = selectedWorld + "/ " + selectedSectionUnformat; transform.Find("Panel_00").Find("Button_Add_Question").GetComponent <Button>().onClick.AddListener(addStoryModeQuestion); baseQuestionInfoURL = "https://seheroes.herokuapp.com/storyModeQuestion?world=" + selectedWorld + "§ion=" + selectedSection; StartCoroutine(GetQuestionInfo()); }
// Deletes a story mode question public IEnumerator deleteStoryQ(StoryModeQuestion storyModeQ) { deleteStoryQDone = false; API_Connection conn = new API_Connection(); yield return(StartCoroutine(conn.DeleteData("StoryModeQuestion/" + storyModeQ.storyModeQuestionId, s => { Debug.Log(JSON.Parse(s)); }))); deleteStoryQDone = true; }
// Adds a story mode question public IEnumerator addStoryQ(StoryModeQuestion storyModeQ) { addStoryQDone = false; API_Connection conn = new API_Connection(); string jsonString = JsonUtility.ToJson(storyModeQ); yield return(StartCoroutine(conn.PostData("StoryModeQuestion/", jsonString, s => { storyModeQ.storyModeQuestionId = JSON.Parse(s); }))); addStoryQDone = true; }
// Updates an existing story mode question public IEnumerator updateStoryQ(StoryModeQuestion storyModeQ) { updateStoryQDone = false; API_Connection conn = new API_Connection(); string jsonString = JsonUtility.ToJson(storyModeQ); yield return(StartCoroutine(conn.PutData("StoryModeQuestion/" + storyModeQ.storyModeQuestionId, jsonString, s => { Debug.Log(JSON.Parse(s)); }))); updateStoryQDone = true; }
void Start() { // display popUp = mainContentPanel.transform.Find("Panel_Messages").gameObject; entryContainer = panelObject.transform.Find("Panel_Question_Creation_Story"); dropdownAnswer = entryContainer.Find("Dropdown_Answer").GetComponent <Dropdown>(); dropdownLevel = entryContainer.Find("Dropdown_Level").GetComponent <Dropdown>(); popUp.SetActive(false); conn = (API_Storymode)transform.GetComponent(typeof(API_Storymode)); // button events panelObject.transform.Find("Button_Return").GetComponent <Button>().onClick.AddListener(ClickReturn); panelObject.transform.Find("Button_Save").GetComponent <Button>().onClick.AddListener(ClickSave); panelObject.transform.Find("Button_Clear").GetComponent <Button>().onClick.AddListener(ClickClear); popUp.transform.Find("Popup_Incomplete").Find("Button_Confirm").GetComponent <Button>().onClick.AddListener(popupQuestionIncompleteAcknowledge); popUp.transform.Find("Popup_Info").Find("Button_Confirm").GetComponent <Button>().onClick.AddListener(popupQuestionInfoAcknowledge); current_question = new StoryModeQuestion(World_Select_Script.worldChoice, Section_Select_Script.sectionChoice); }