// Submit // public void SubmitSubinteraction() { if (currentSubint == null) { Debug.Log("SubmitSubinteraction: currentSubInt is null"); int i = subIntTypeDropdown.value; string subIntType = subIntTypeList [i]; currentSubint = new SubInteraction(subIntType); subinteractable.SubIntList.Add(currentSubint); } // Reseting data fields, then filling them again currentSubint.ResetDataFields(); switch (currentSubint.interactionType) { case "showMonologue": currentSubint.RawText = textInputBig.text; break; case "showDialogue": currentSubint.dialogueOptionTitle = textInputSmall.text; break; case "showDialogueTree": currentSubint.dialogueTreeName = textInputSmall.text; break; case "PlaySound": currentSubint.soundToPlay = playSound.Find("SoundNameInput").GetComponent <InputField> ().text; string numberOfPlaysString = playSound.Find("NumberOfPlaysInput").GetComponent <InputField> ().text; if ((numberOfPlaysString == null) || (numberOfPlaysString == string.Empty)) { currentSubint.numberOfPlays = 1; break; } currentSubint.numberOfPlays = int.Parse(numberOfPlaysString); break; case "StopSound": currentSubint.soundToStop = textInputSmall.text; break; case "PlayAnimation": int i = playAnimation.Find("AnimationDropdown").GetComponent <Dropdown> ().value; currentSubint.animationToPlay = playAnimation.Find("AnimationDropdown").GetComponent <Dropdown> ().options [i].text; currentSubint.targetFurniture = playAnimation.Find("FurnitureNameInput").GetComponent <InputField> ().text; break; case "moveToRoom": currentSubint.destinationRoomName = moveToRoom.Find("TextInputSmall1").GetComponent <InputField> ().text; Vector2 entrancePoint = new Vector2(int.Parse(moveToRoom.Find("InputX").GetComponent <InputField> ().text), int.Parse(moveToRoom.Find("InputY").GetComponent <InputField> ().text)); currentSubint.entrancePoint = entrancePoint; break; case "intoShadows": case "outOfShadows": break; case "pickUpItem": string itemFileName = recieveItem.Find("TextInputSmall1").GetComponent <InputField> ().text; string itemTitleName = recieveItem.Find("TextInputSmall2").GetComponent <InputField> ().text; currentSubint.inventoryItem = new InventoryItem(itemFileName, itemTitleName); break; case "useItem": break; case "addEvent": currentSubint.eventToAdd = textInputSmall.text; break; case "removeEvent": currentSubint.eventToRemove = textInputSmall.text; break; } EventsHandler.Invoke_cb_subinteractionChanged(); Destroy(subinteractionPanelObject); }
// Submit // public void SubmitSubinteraction() { if (currentSubint == null) { int i = subIntTypeDropdown.value; string subIntType = subIntTypeList [i]; currentSubint = new SubInteraction(subIntType); subinteractable.SubIntList.Add(currentSubint); } // Reseting data fields, then filling them again currentSubint.ResetDataFields(); switch (currentSubint.interactionType) { case "showMonologue": currentSubint.RawText = textInputBig.text; currentSubint.isImportant = importantToggle.isOn; break; case "showDialogue": currentSubint.dialogueOptionTitle = textInputSmall.text; break; case "showDialogueTree": currentSubint.dialogueTreeName = textInputSmall.text; break; case "PlaySound": currentSubint.soundToPlay = playSound.Find("SoundNameInput").GetComponent <InputField> ().text; string numberOfPlaysString = playSound.Find("NumberOfPlaysInput").GetComponent <InputField> ().text; if ((numberOfPlaysString == null) || (numberOfPlaysString == string.Empty)) { currentSubint.numberOfPlays = 1; break; } int.TryParse(numberOfPlaysString, out currentSubint.numberOfPlays); // FIXME: what happens if it is a vlid format? will it change anything? break; case "StopSound": currentSubint.soundToStop = textInputSmall.text; break; case "PlayAnimation": int i = playAnimation.Find("AnimationDropdown").GetComponent <Dropdown> ().value; currentSubint.animationToPlay = playAnimation.Find("AnimationDropdown").GetComponent <Dropdown> ().options [i].text; currentSubint.targetFurniture = InspectorManager.instance.chosenFurniture.identificationName; break; case "PlayAnimationOn": currentSubint.animationToPlayOn = playAnimationOn.Find("AnimationNameInput").GetComponent <InputField> ().text; currentSubint.targetFurniture = playAnimationOn.Find("FurnitureNameInput").GetComponent <InputField> ().text; break; case "moveToRoom": currentSubint.destinationRoomName = moveToRoom.Find("TextInputSmall1").GetComponent <InputField> ().text; // currently if the format is invalid, it will give it a default value of 0 int x = 0; int y = 0; int.TryParse(moveToRoom.Find("InputX").GetComponent <InputField> ().text, out x); int.TryParse(moveToRoom.Find("InputY").GetComponent <InputField> ().text, out y); currentSubint.entrancePoint = new Vector2(x, y); break; case "intoShadows": case "outOfShadows": break; case "pickUpItem": string itemFileName = recieveItem.Find("TextInputSmall1").GetComponent <InputField> ().text; string itemTitleName = recieveItem.Find("TextInputSmall2").GetComponent <InputField> ().text; currentSubint.inventoryItem = new InventoryItem(itemFileName, itemTitleName); break; case "useItem": break; case "addEvent": currentSubint.eventToAdd = textInputSmall.text; break; case "removeEvent": currentSubint.eventToRemove = textInputSmall.text; break; case "PlayCutscene": currentSubint.cutsceneToPlay = textInputSmall.text; break; case "hidePI": currentSubint.PItoHide = textInputSmall.text; break; case "showPI": currentSubint.PItoShow = textInputSmall.text; break; case "special": currentSubint.specialSubInt = textInputSmall.text; break; } EventsHandler.Invoke_cb_subinteractionChanged(); Destroy(subinteractionPanelObject); }