public void OnConfirmed() { Dialogue dialogue = ScriptableObject.CreateInstance <Dialogue>(); dialogue.nodes = new List <Dialogue.Node>(); var node = new Dialogue.Node(); node.ID = 0; node.text = taskConfirmedDialogue != null ? taskConfirmedDialogue : "Complete the task."; // TODO: Why is this (and the color(?)) sometimes null? Is the task node not loaded correctly? node.textColor = dialogueColor; node.nextNodes = new List <int>() { 1 }; var node1 = new Dialogue.Node(); node1.ID = 1; node1.action = Dialogue.DialogueAction.Exit; node1.buttonText = "Alright."; // TODO: allow customizing in World Creator? dialogue.nodes.Add(node); dialogue.nodes.Add(node1); TaskManager.speakerID = entityIDforConfirmedResponse; DialogueSystem.StartDialogue(dialogue, TaskManager.GetSpeaker()); }
void Start() { DS = GameObject.Find("DialogueSystem").GetComponent("DialogueSystem") as DialogueSystem; TS = GameObject.Find("TaskSystem").GetComponent("TaskSystem") as TaskSystem; S = GameObject.Find("Status").GetComponent("Status") as Status; StartCoroutine(Wait1()); }
public void NextSpeak(int index) { dialogueUI = GameObject.Find("Canvas").transform.Find("DialogueUI").gameObject; speak = transform.Find("Sprite").transform.Find("Speak").GetComponent<TextMesh>(); GameObject answers = dialogueUI.transform.Find("Answers").gameObject; dialogue = GetComponent<DialogueSystem>(); Text question = dialogueUI.transform.Find("Question").transform.GetComponent<Text>(); foreach (Transform child in answers.transform) { Destroy(child.gameObject); } int answersCount = dialogue.nodes[index].answers.Length; question.text = dialogue.nodes[index].speak; for (int i = 0; i <= answersCount - 1; i++) { GameObject answer = GameObject.Instantiate(answerModel, Vector3.zero, Quaternion.identity) as GameObject; answer.GetComponent<AnswerUI>().answer = dialogue.nodes[index].answers[i]; answer.GetComponent<AnswerUI>().SetAnswer(); int id = dialogue.nodes[index].paths[i]; answer.GetComponent<Button>().onClick.AddListener(() => { OnClickAnswer(id); }); answer.transform.parent = answers.transform; } }
public override bool ExecuteAction(GameObject other) { if (!balloonIsActive) { DialogueSystem d = GameObject.FindObjectOfType <DialogueSystem>(); if (d == null) { //Dialogue System is not in the scene Debug.LogWarning(_("You need a UI in the scene to display dialogue!")); return(false); } //Dialogue System is found b = d.CreateBalloon(textToDisplay, (disappearMode == DisappearMode.ButtonPress), keyToPress, timeToDisappear, backgroundColor, textColor, targetObject); b.BalloonDestroyed += OnBalloonDestroyed; balloonIsActive = true; StartCoroutine(WaitForBallonDestroyed()); return(true); } else { return(false); } }
private void Awake() { animator = GetComponentInChildren<SimpleAnimator>(); rbody2D = GetComponent<Rigidbody2D>(); nsystem = GameObject.FindGameObjectWithTag("Scene").GetComponent<NotesSystem>(); dsystem = GameObject.FindGameObjectWithTag("Scene").GetComponent<DialogueSystem>(); }
public void Update() { if (WaitingOnDialogue) { Cursor.SetCursor(chatCursor, Vector2.zero, CursorMode.Auto); if (Input.GetMouseButtonDown(0)) { WaitingOnDialogue = false; Time.timeScale = 1; DialogueSystem.NextClick(); } return; } if (grabbed != null && grabbed.isGrabbed) { Cursor.SetCursor(grabbed.defaultCursor, Vector2.zero, CursorMode.Auto); if (Input.GetMouseButtonDown(0)) { grabbed.OnClick(this); } return; } Vector3 point = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0)); point = new Vector3(point.x, point.y, 0); Texture2D cursor = defaultCursor; if (point.y <= transform.position.y) { cursor = defaultNoCursor; } Collider2D[] colls = Physics2D.OverlapPointAll(point, mask, 10); clickAction = false; foreach (Collider2D c in colls) { CursorSetter s = c.GetComponent <CursorSetter>(); if (s != null) { cursor = s.myCursor; if (Input.GetMouseButtonDown(0)) { IMouseClickable m = s.GetComponent <IMouseClickable>(); if (m != null) { clickAction = m.OnClick(this) || clickAction; } } } } Cursor.SetCursor(cursor, Vector2.zero, CursorMode.Auto); if (Input.GetMouseButtonDown(0) && !clickAction) { Arc.Apex(this.GetComponent <Rigidbody2D>(), Camera.main.ScreenToWorldPoint(Input.mousePosition)); } }
public override int Traverse() { if (showPopup) { AudioManager.PlayClipByID("clip_victory", true); DialogueSystem.ShowReward(wrapper); } SectorManager.instance.player.AddCredits(wrapper.creditReward); SectorManager.instance.player.reputation += wrapper.reputationReward; SectorManager.instance.player.shards += wrapper.shardReward; if (wrapper.partReward) { SectorManager.instance.player.cursave.partInventory.Add( new EntityBlueprint.PartInfo { partID = wrapper.partID, abilityID = wrapper.partAbilityID, tier = wrapper.partTier, secondaryData = wrapper.partSecondaryData }); } return(0); }
private void closeDialogue() { DialogueSystem dialogueSystem = _systemManager.getSystem(SystemType.Dialogue) as DialogueSystem; string levelUid = LevelSystem.currentLevelUid; dialogueSystem.endDialogue(levelUid); }
private void OnDestroy() { if (_instance == this) { _instance = null; } }
void OnTriggerEnter(Collider other) { if (DialogueSystem.getGlobalCollected() == 11 && !DialogueSystem.getMissionComplete()) { SceneManager.LoadScene("Scene 2"); } }
void OnTriggerEnter(Collider other) { // If the object collided with is a machine piece... if (other.gameObject.CompareTag("Machine Piece") && itemCount < DialogueSystem.getCollectNumber()) { // To check the global collect variable. //print(DialogueSystem.getCollectNumber()); // Make the item disappear. other.gameObject.SetActive(false); // Then update the item count. itemCountText.text = ++itemCount + "/" + DialogueSystem.getCollectNumber(); // Add to the global counter. DialogueSystem.addToGlobalCollected(1); } // When the number of collected items is equal to the global collect number and the global // collect number isn't 0, then set the global mission boolean to true. if (itemCount == DialogueSystem.getCollectNumber() && DialogueSystem.getCollectNumber() != 0) { DialogueSystem.setMissionComplete(true); } }
public void OnGet() { Dialogues = DialogueSystem.GetDialogues(); DialogueId = DialogueSystem.DialogueId; SubDialogueId = DialogueSystem.SubDialogueId; SubDialogue = DialogueSystem.GetSubDialogue(DialogueId, SubDialogueId); }
// </sector> public Character(string name) { Debug.Log("char constructor"); CharacterManager cm = CharacterManager.instance; Debug.Log(Resources.Load(@"Prefabs/VN Characters/" + name).name); GameObject characterPref = Resources.Load(@"Prefabs/VN Characters/" + name) as GameObject; GameObject characterObj = GameObject.Instantiate(characterPref, cm.characterPanel); root = characterObj.GetComponent <RectTransform>(); characterName = name; renderers.renderer = characterObj.GetComponentInChildren <RawImage>(); if (isMultiLayer) { renderers.bodyRenderer = characterObj.transform.Find("bodyLayer").GetComponent <Image>(); renderers.expressionRenderer = characterObj.transform.Find("expressionLayer").GetComponent <Image>(); } dialogue = DialogueSystem.instance; Sprite[] spriteList = Resources.LoadAll <Sprite>("Sprites/" + characterName); foreach (var t in spriteList) { spriteDictionary.Add(t.name, t); Debug.Log("Sprite \"" + t.name + "\" loaded successfully!"); } Debug.Log(spriteList.Length + " sprites loaded of character " + characterName); }
private void Awake() { dialogueActive = false; dialoguePanel.SetActive(true); selectPanel.SetActive(true); dialogueText = dialoguePanel.transform.GetChild(0).GetComponent <Text>(); continueButton = dialoguePanel.transform.GetChild(1).GetComponent <Button>(); nameText = dialoguePanel.transform.GetChild(2).GetComponent <Text>(); choicePanel = selectPanel.transform.GetChild(0).GetChild(0).gameObject; continueButton.onClick.AddListener(delegate { ContinueDialogue(); }); dialoguePanel.SetActive(false); selectPanel.SetActive(false); if (Instance != null && Instance != this) { Destroy(gameObject); } else { Instance = this; } }
//This checks the scene to ensure that there //Is only one instance of this system in the scene at any given time private void Awake() { nextButton = dialoguePanel.transform.Find("NextButton").GetComponent <Button>(); backButton = dialoguePanel.transform.Find("BackButton").GetComponent <Button>(); endButton = dialoguePanel.transform.Find("EndButton").GetComponent <Button>(); nextButton.onClick.AddListener(delegate { NextDialogue(); }); backButton.onClick.AddListener(delegate { PreviousDialogue(); }); endButton.onClick.AddListener(delegate { EndDialogue(); }); dialogueText = dialoguePanel.transform.Find("DialogueText").GetComponent <TextMeshProUGUI>(); nameText = dialoguePanel.transform.Find("NPCNamePanel").GetChild(0).GetComponent <TextMeshProUGUI>(); //is this good enough? There is probably a more efficient way of handeling this //COME BACK TO THIS AND HOOK UP ANIMATION //WHEN YOUR FINISHED dialoguePanel.SetActive(false); if (instance != null && instance != this) { Destroy(gameObject); } else { instance = this; } }
// Start is called before the first frame update void Awake() { cam = Camera.main; // Wiring up the continue button, dialogue text, name text and the onClick event! continueButton = dialoguePanel.transform.Find("Continue").GetComponent <Button>(); dialogueText = dialoguePanel.transform.Find("Text").GetComponent <Text>(); roleText = dialoguePanel.transform.Find("Role").GetChild(0).GetComponent <Text>(); nameText = dialoguePanel.transform.Find("Name").GetChild(0).GetComponent <Text>(); sellButton = dialoguePanel.transform.Find("Sell").GetComponent <Button>(); abortButton = dialoguePanel.transform.Find("Abort").GetComponent <Button>(); sellButton.onClick.AddListener(delegate { Sell(); }); abortButton.onClick.AddListener(delegate { Abort(); }); continueButton.onClick.AddListener(delegate { ContinueDialogue(); }); dialoguePanel.SetActive(false); // If conditions are met an instance exists that is not this instance, lets delete it if (Instance != null && Instance != this) { Destroy(gameObject); } else { // Reference to this instance Instance = this; } }
void UpdateVariable() { Variable variable = null; if (isGlobal) { variable = DialogueSystem.GetGlobalVariable(variableName); } else { variable = uiController.behavior.GetLocalVariable(variableName); } if (variable != null) { switch (InputUI.contentType) { case InputField.ContentType.Standard: variable.Value = InputUI.text; break; case InputField.ContentType.IntegerNumber: variable.Value = int.Parse(InputUI.text); break; case InputField.ContentType.DecimalNumber: variable.Value = float.Parse(InputUI.text); break; } } Select(); }
// Use this for initialization void Start () { if (system == MessageSystems.Dsystem) dsystem = GameObject.FindGameObjectWithTag("Scene").GetComponent<DialogueSystem>(); if (system == MessageSystems.Nsystem) nsystem = GameObject.FindGameObjectWithTag("Scene").GetComponent<NotesSystem>(); }
/// <summary> /// Create a new character. /// </summary> /// <param name="_name">Name.</param> public Character(string _name, bool enableOnStart = true) { CharacterManager cm = CharacterManager.instance; //locate the character prefab. GameObject prefab = Resources.Load("Characters/Character[" + _name + "]") as GameObject; //spawn an instance of the prefab directly on the character panel. GameObject ob = GameObject.Instantiate(prefab, cm.characterPanel); root = ob.GetComponent <RectTransform>(); canvasGroup = ob.GetComponent <CanvasGroup>(); canvasGroup.alpha = 0; characterName = _name; displayName = characterName; //get the renderer(s) renderers.bodyRenderer = ob.transform.Find("BodyLayer").GetComponentInChildren <Image>(); renderers.expressionRenderer = ob.transform.Find("ExpressionLayer").GetComponentInChildren <Image>(); renderers.allBodyRenderers.Add(renderers.bodyRenderer); renderers.allExpressionRenderers.Add(renderers.expressionRenderer); dialogue = DialogueSystem.instance; enabled = enableOnStart; }
/// <summary> /// Create a new character. /// </summary> /// <param name="_name">Name.</param> public Character(string _name, bool enableOnStart = true) { CharacterManager cm = CharacterManager.instance; //locate the character prefab. GameObject prefab = Resources.Load("Characters/Character[" + _name + "]") as GameObject; //spawn an instance of the prefab directly on the character panel. //Debug.Log("Trying to spawn: " + _name); GameObject ob = GameObject.Instantiate(prefab, cm.characterPanel); root = ob.GetComponent <RectTransform>(); characterName = _name; //get the renderer(s) /* TEMP TODO + FIX THIS FOR MLC * renderers.bodyRenderer = ob.transform.Find("BodyLayer").GetComponentInChildren<Image>(); * renderers.expressionRenderer = ob.transform.Find("ExpressionLayer").GetComponentInChildren<Image>(); * renderers.allBodyRenderers.Add(renderers.bodyRenderer); * renderers.allExpressionRenderers.Add(renderers.expressionRenderer); */ //Single Image: renderers.renderer = ob.GetComponentInChildren <RawImage>(); dialogue = DialogueSystem.instance; enabled = enableOnStart; visibleInScene = enabled; }
void Start() { gm = GameObject.Find("GlobalManager").GetComponent <GlobalManager>(); ds = GameObject.Find("PlayerCanvas").GetComponent <DialogueSystem>(); SetVictim(); Invoke("SetPerp", 3f); }
void Start() { //find inputfield chatBox = GameObject.FindGameObjectWithTag("chatbox").GetComponent <TMP_InputField>() as TMP_InputField; //find chat panel contentHolder = GameObject.FindGameObjectWithTag("Content"); //Get dialogue panel child...Next button nextButton = dialoguePanel.transform.Find("NextButton").GetComponent <Button>(); //grab the dialogue text dialogueText = dialoguePanel.transform.Find("TextPanel/dialogueText").GetComponent <Text>(); //grab Npc Name npcNameText = dialoguePanel.transform.Find("NamePanel/NpcName").GetComponent <Text>(); //listen to player click next button //get annoucement Text announcementText = GameObject.FindGameObjectWithTag("systemDialogue").GetComponent <Text>(); //deactivate system message announcementText.enabled = false; nextButton.onClick.AddListener(delegate { CountinueDialogue(); }); //turn off dialogue dialoguePanel.SetActive(false); //if instance exist is it null...if it does exist is it equal to dialogue system if (instance != null && instance != this) { // instance is exist that not this istance Destroy(gameObject); } else { //instance doesn't exist instance = this; } }
void Awake() { /* The strings are the children of the dialogue panel. References to the UI */ continueButton = dialoguePanel.transform.Find("Continue").GetComponent <Button>(); dialogueText = dialoguePanel.transform.Find("Text").GetComponent <Text>(); nameText = dialoguePanel.transform.Find("Name").GetChild(0).GetComponent <Text>(); // Get the 1st child of the child Name /* Event that happens when the buttonClick is pressed. * When onClick occurs, the event is added, and this event must be a delegate. * * delegate is a reference type variable that holds the reference to a method. * The reference can be changed at runtime. */ continueButton.onClick.AddListener(delegate { ContinueDialogue(); }); dialoguePanel.SetActive(false); // Start with no dialogue in display. /* An Instance exist that is not this Instance -> destory. */ /* Prevent multiple dialouge pop ups if talking to different NPC's at once. */ if (Instance != null && Instance != this) { Destroy(gameObject); } else { /* If the instance doesn't exist, then now exist, reference to THIS instance of this object. */ Instance = this; } }
public override int Traverse() { if (!PlayerCore.Instance || PlayerCore.Instance.cursave == null || PlayerCore.Instance.cursave.missions == null) { return(-1); } // TODO: prevent using this node in DialogueCanvases var mission = PlayerCore.Instance.cursave.missions.Find( (m) => m.name == (Canvas as QuestCanvas).missionName); mission.status = Mission.MissionStatus.Complete; if (MissionCondition.OnMissionStatusChange != null) { MissionCondition.OnMissionStatusChange.Invoke(mission); } // try loading all missions for which this mission is a prerequisite //PlayerCore.Instance.cursave.missions.FindAll(m => m.prerequisites != null && m.prerequisites.Contains(mission.name)) // .ForEach(m => TaskManager.Instance.startNewQuest(m.name)); DialogueSystem.ShowMissionComplete(mission, rewardsText); AudioManager.OverrideMusicTemporarily(jingleID); if (TaskManager.objectiveLocations.ContainsKey((Canvas as QuestCanvas).missionName)) { TaskManager.objectiveLocations[(Canvas as QuestCanvas).missionName].Clear(); } (Canvas.Traversal as Traverser).lastCheckpointName = mission.name + "_complete"; TaskManager.Instance.AttemptAutoSave(); return(-1); }
void Awake() { FatherDestroy = false; DS = GameObject.Find("DialogueSystem").GetComponent("DialogueSystem") as DialogueSystem; TS = GameObject.Find("TaskSystem").GetComponent("TaskSystem") as TaskSystem; S = GameObject.Find("Status").GetComponent("Status") as Status; }
private void Start() { dialogueSystem = MainInstances.Get <DialogueSystem>(); InteractionHandler.Instance.RegisterObject("Room and Door", () => dialogueSystem.Present(dialogueGraph), 0); }
public void SimulateShake() { if (AcceptingInputStatus.isAcceptingInput) { DialogueSystem.Trigger(LevelEnd.SHAKE); } }
void NextDialogue() { if (dialogue != null) { dialogue.enabled = false; dialogue.OnDialogueEnd.RemoveAllListeners(); DialogueList.Remove(dialogue); Destroy(dialogue); Index++; } if (DialogueList.Count != 0) { combatManager.ChangeCombatState(CombatState.DialogueMode); dialogue = DialogueList.First(); dialogue.enabled = true; } else { Debug.Log("Tutorial Done"); OnTutorialEnd.Invoke(); } NextLineOfDialogue(); }
private void Awake() { Instance = this; dialogueStyle = (DialogueStyle)PlayerPrefs.GetInt("DialogueSystem_dialogueStyle", 0); isInCutscene = false; CameraScript.panning = false; }
public override string ErrorCheck() { Variable variable = null; if (IsGlobal.Value) { variable = DialogueSystem.GetGlobalVariable(VariableName.Value); } else { var go = Fsm.GetOwnerDefaultTarget(Actor); if (go == null) { return("Actor is needed for getting a local variable!"); } DialogueBehaviour b = go.GetComponent <DialogueBehaviour>(); variable = b.GetLocalVariable(VariableName.Value); } // Variable doesn't exists if (variable == null) { return(VariableName.Value + " doesn't exists in the " + ((IsGlobal.Value) ? "Dialogue Editor Global Variables" : "")); } // Variable type is not the right one if (!FsmVariableUtils.CheckType(variable, typeof(T))) { return("The value type should be " + variable.type); } return(base.ErrorCheck()); }
private void Start() { ds = GetComponent <DialogueSystem>(); /*som = FindObjectOfType<Som>(); * comunicator = GetComponent<CapsuleCollider2D>(); * area = GetComponent<BoxCollider2D>(); * cameraController = FindObjectOfType<CameraController>(); * if (nameSpoken && cutscene2) * { * dialogue.sentences[0] = "SOCORRO!!! SOCORRO!!!"; * dialogue.sentences[1] = "Porque os bons morrem tão cedo?"; * dialoguePart2.sentences[0] = "Você me salvou!!! Nem sei como te agradecer… Como se chama a pessoa que salvou minha vida?"; * dialoguePart2.sentences[1] = GameGlobalInfo.playerName + * ", eu te devo tanto… Por hora, você pode ficar com a minha mais nova invenção!"; * dialoguePart2.sentences[2] = "Com essas botas, você poderá pular enquanto está no ar."; * dialoguePart2.sentences[3] = "É bom ter mais de nós por aqui… Espero te encontrar novamente."; * } * else if (nameSpoken && cutscene3) * { * dialogue.sentences[0] = "Obrigada, " + GameGlobalInfo.playerName + ". É bom finalmente te conhecer pessoalmente."; * dialoguePart2.sentences[4] = GameGlobalInfo.playerName + ", CUIDADO!!!"; * } * else if (nameSpoken && cutscene2_0) * { * dialogue.sentences[0] = GameGlobalInfo.playerName + " ... está me escut..."; * } * if (cutscene2_0) { Invoke("f2D0",4); } * */ }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.isTrigger) { return; } DialogueSystem d = collision.GetComponentInParent <DialogueSystem>(); if (d != null) { foreach (var i in itemsToQueue) { d.Enqueue(i); } var c = d.GetComponent <CarController>(); if (doBrake) { c.isRunning = false; d.Enqueue(new DialogueSystem.DialogueItem("", "", 0.001f, d.OnStart)); } if (oneShot) { gameObject.SetActive(false); } } }
// Start is called before the first frame update void Start() { ds = FindObjectOfType <DialogueSystem>(); narrativePoint = 0; startPanel.gameObject.SetActive(true); player.gameObject.SetActive(false); }
private static ChatMapper.Actor ActorToCmp(DialogueSystem.Actor actor) { ChatMapper.Actor cmpActor = new ChatMapper.Actor(); cmpActor.ID = actor.id; cmpActor.Fields = FieldsToCmp(actor.fields); AddRequiredActorFields(cmpActor.Fields); return cmpActor; }
void CheckSetup () { if (atributes.actorName == "") Debug.LogError ("The actor " + gameObject + " has no name"); if (actorControll == null) Debug.LogError ("The actor " + gameObject + " has not controller"); if (atributes.hasDialouge) dialouge = GetComponent<DialogueSystem> (); if (atributes.isMerchant) { } }
public void Awake() { // Get reference to Text component _text = GetComponent<Text>(); if (_text == null) { Debug.LogError(string.Format("({0}) Unable to find Text component on this object", this.name)); } // Get reference to Dialogue System _dialogueSystem = FindObjectOfType<DialogueSystem>(); if (_dialogueSystem == null) { Debug.LogError(string.Format("({0}) Unable to find Dialogue System within scene", this.name)); } // Save text within message _dialogue = _text.text; }
private static ChatMapper.Conversation ConversationToCmp(DialogueSystem.Conversation conversation) { ChatMapper.Conversation cmpConversation = new ChatMapper.Conversation(); cmpConversation.ID = conversation.id; cmpConversation.NodeColor = string.IsNullOrEmpty(conversation.nodeColor) ? "Red" : conversation.nodeColor; cmpConversation.LockedMode = "Unlocked"; cmpConversation.Fields = FieldsToCmp(conversation.fields); AddRequiredConversationFields(cmpConversation.Fields); cmpConversation.DialogEntries = DialogEntriesToCmp(conversation.dialogueEntries); return cmpConversation; }
private static ChatMapper.DialogEntry DialogEntryToCmp(DialogueSystem.DialogueEntry entry) { ChatMapper.DialogEntry cmpEntry = new DialogEntry(); cmpEntry.ID = entry.id; cmpEntry.IsRoot = entry.isRoot || ((entry.id == 0) && string.Equals(entry.Title, "START")); cmpEntry.IsGroup = entry.isGroup; cmpEntry.NodeColor = string.IsNullOrEmpty(entry.nodeColor) ? "White" : entry.nodeColor; cmpEntry.DelaySimStatus = entry.delaySimStatus; cmpEntry.FalseCondtionAction = GetValidFalseConditionAction(entry.falseConditionAction); cmpEntry.ConditionPriority = entry.conditionPriority.ToString(); cmpEntry.Fields = FieldsToCmp(entry.fields); AddRequiredDialogEntryFields(cmpEntry.Fields); cmpEntry.Fields.ForEach(cmpField => { if (cmpField.Title.StartsWith("Dialogue Text")) cmpField.Type = "Localization"; }); cmpEntry.OutgoingLinks = LinksToCmp(entry.outgoingLinks); foreach (var link in cmpEntry.OutgoingLinks) { link.OriginConvoID = entry.conversationID; link.OriginDialogID = entry.id; } cmpEntry.ConditionsString = entry.conditionsString; cmpEntry.UserScript = entry.userScript; return cmpEntry; }
private static ChatMapper.Item ItemToCmp(DialogueSystem.Item item) { ChatMapper.Item cmpItem = new ChatMapper.Item(); cmpItem.ID = item.id; cmpItem.Fields = FieldsToCmp(item.fields); AddRequiredItemFields(cmpItem.Fields); Field entryCount = Field.Lookup(item.fields, "Entry Count"); if (entryCount != null) maxEntryCount = Mathf.Max(maxEntryCount, Tools.StringToInt(entryCount.value)); return cmpItem; }
private static ChatMapper.Field FieldToCmp(DialogueSystem.Field field) { return NewCmpField(field.title, field.type.ToString(), field.value, string.Empty); }
private static ChatMapper.Location LocationToCmp(DialogueSystem.Location location) { ChatMapper.Location cmpLocation = new ChatMapper.Location(); cmpLocation.ID = location.id; cmpLocation.Fields = FieldsToCmp(location.fields); AddRequiredLocationFields(cmpLocation.Fields); return cmpLocation; }
private static ChatMapper.Link LinkToCmp(DialogueSystem.Link link) { ChatMapper.Link cmpLink = new ChatMapper.Link(); cmpLink.ConversationID = link.originConversationID; cmpLink.OriginConvoID = link.originConversationID; cmpLink.DestinationConvoID = link.destinationConversationID; cmpLink.OriginDialogID = link.originDialogueID; cmpLink.DestinationDialogID = link.destinationDialogueID; cmpLink.IsConnector = link.isConnector; return cmpLink; }
// Use this for initialization void Start() { m_FacingRight = false; originalSpeed = speed; m_Game = GameObject.FindGameObjectWithTag("Manager").GetComponent<GameManager>(); m_Combat = GetComponent<Combat> (); m_Input = m_Game.GetInputManager (); m_Audio = m_Game.GetAudioManager (); m_Dialogue = m_Game.GetDialogueSystem (); m_Animator = GetComponent<Animator>(); gatherFrom = null; m_Inventory = GameObject.Find("Inventory").GetComponent<Inventory>(); hpBar = GameObject.Find ( "HealthSlider" ).GetComponent<Slider> (); hpBG = hpBar.transform.Find( "Background" ).gameObject; hpFill = hpBar.transform.Find( "Fill Area" ).gameObject; hungerBar = GameObject.Find ( "HungerSlider" ).GetComponent<Slider> (); hungerFill = hungerBar.transform.Find ( "Fill Area" ).transform.Find ( "Fill" ).GetComponent<Image> (); arrowUIText = GameObject.Find("ArrowCount").GetComponent<Text>(); hungerColorDefault = hungerFill.color; hpFillWidth = hungerFill.rectTransform.rect.width; // Set max and starting value of health and hunger hpBar.maxValue = health; hpBar.value = health; hungerBar.maxValue = hunger; hungerBar.value = hunger; }
private static ChatMapper.UserVariable VariableToCmp(DialogueSystem.Variable variable) { ChatMapper.UserVariable cmpUserVariable = new ChatMapper.UserVariable(); cmpUserVariable.Fields = FieldsToCmp(variable.fields); AddRequiredUserVariableFields(cmpUserVariable.Fields); return cmpUserVariable; }
// Use this for initialization void Start() { m_Char = GameObject.FindGameObjectWithTag("Char").GetComponent<Character> (); m_Input = GameObject.FindGameObjectWithTag("Manager").GetComponent<InputManager>(); m_Camera = GameObject.Find ( "Main Camera" ).GetComponent<CameraFollow> (); m_Game = GameObject.FindGameObjectWithTag("Manager").GetComponent<GameManager>(); m_Dialogue = m_Game.GetDialogueSystem(); m_CharAnimator =m_Char.GetComponent<Animator>(); m_Inventory = GameObject.Find("Inventory UI").transform.GetChild(0).GetComponent<Inventory>(); m_Journal = GameObject.Find("Journal UI").GetComponent<Journal>(); //if this is the first time visiting the wetlands, have the campfire give a journal page when she gets there if ( !m_Game.GetHasVisitedWetlands() ) { willRecieveWetlandJP = true; m_Game.SetHasVisitedWetlands(true); } }
// Use this for initialization void Start() { mInput = GameObject.FindGameObjectWithTag ( "Manager" ).GetComponent<InputManager> (); mAudio = GameObject.FindGameObjectWithTag ( "Manager" ).GetComponent<AudioManager> (); mDialogue = GameObject.FindGameObjectWithTag ( "Manager" ).GetComponent<DialogueSystem> (); mJournal = GameObject.FindGameObjectWithTag ( "Journal" ).GetComponent<Journal> (); mGame = GameObject.FindGameObjectWithTag ( "Manager" ).GetComponent<GameManager> (); mCombat = GameObject.FindGameObjectWithTag ( "Char" ).GetComponent<Combat> (); buttonsUI = GameObject.Find ( "Buttons UI" ); journalUI = GameObject.Find ( "Journal UI" ); }
// Persistent (Singleton) /* void Awake () { if ( instance == null ) { instance = this; DontDestroyOnLoad ( gameObject ); } else { Destroy ( this ); } }*/ // Use this for initialization void Start() { KeyItems = new Dictionary<string,bool>(); m_audio = GetComponent<AudioManager> (); m_input = GetComponent<InputManager> (); m_daynight = GetComponent<DayNightManager> (); m_dialogue = GetComponent<DialogueSystem> (); KeyItems.Add ( "Backpack", true ); KeyItems.Add ( "Boat", true ); KeyItems.Add ( "Bow", true ); KeyItems.Add("wood", true); KeyItems.Add("rope", true); KeyItems.Add("hammer", true); KeyItems.Add ( "JournalPageBeach", true ); KeyItems.Add ( "JournalPageSeaCave", true ); KeyItems.Add ( "JournalPageDocks", true ); KeyItems.Add ( "JournalPagePlains", true); KeyItems.Add("watch", true); KeyItems.Add("glasses", true); KeyItems.Add("map", true); KeyItems.Add("photo", true); CurrentSceneIndex = 0; PreviousSceneIndex = -1; // On purpose for day night check m_audio.PlayLoop ( "main" ); // Start with main theme music locationTimestamps.Add ( "Main Menu - " + Time.time ); if (Application.loadedLevelName != "0_MainMenu") { m_Char = GameObject.FindGameObjectWithTag("Char").GetComponent<Character>(); } }
void OnEnable() { dialogue = (DialogueSystem)target; GetTarget = new SerializedObject(dialogue); list = GetTarget.FindProperty("nodes"); }
public void OnGUI() { selectedObject = Selection.activeGameObject; if (!Application.isPlaying) { saved = false; if (selectedObject == null || selectedObject.GetComponent<NPC_Generic> () == null) //no actor selected { GUILayout.Label ("Please select and Actor in the Hierarchy", EditorStyles.boldLabel); } if (selectedObject != null && selectedObject.GetComponent<NPC_Generic> () != null) //if the selected gameObject is an actor { selectedActor = selectedObject.GetComponent <NPC_Generic> (); if (selectedObject.GetComponent<DialogueSystem> () == null) //has no dialouge, enter create mode { GUILayout.Label ("The selected Actor " + selectedObject.name + " has no dialouge", EditorStyles.boldLabel); if (GUILayout.Button ("Create Dialouge")) { selectedObject.AddComponent<DialogueSystem> (); dialogue = selectedObject.GetComponent<DialogueSystem> (); selectedActor.atributes.hasDialouge = true; dialogue.dialogueText.Add (""); } } //EDIT MODE if (Selection.activeGameObject.GetComponent<DialogueSystem> () != null) //has dialouge, enter edit mode { dialogue = selectedObject.GetComponent<DialogueSystem> (); EditorGUILayout.BeginHorizontal (); GUILayout.Label ("Currently editing dialouge for: " + selectedObject.name, EditorStyles.boldLabel); if (GUILayout.Button ("deleate dialouge System")) { selectedActor.dialouge = null; selectedActor.atributes.hasDialouge = false; ClearSave (); DestroyImmediate (selectedObject.GetComponent<DialogueSystem> ()); } if (FirstTimeOfSession) { if (File.Exists ("D:/Users/matias/Documents/UnityProjects/Spo1/project-lesscontra/Editor/Dialogue/" + selectedObject.name + ".txt")) { LoadDialouge (); } FirstTimeOfSession = false; } EditorGUILayout.EndHorizontal (); EditorGUILayout.Space (); scrollPositon = EditorGUILayout.BeginScrollView (scrollPositon); for (int i = 0; i < dialogue.dialogueText.Count; i++) { string current = dialogue.dialogueText [i]; EditorGUILayout.Space (); EditorGUILayout.BeginHorizontal (); GUILayout.Label ("Dialouge window: " + (i + 1)); if (dialogue.dialogueText.Count > 1) { if (GUILayout.Button ("x", GUILayout.Height (20), GUILayout.Width (20))) { dialogue.dialogueText.Remove (current); return; } } EditorGUILayout.EndHorizontal (); EditorGUILayout.Space (); dialogue.dialogueText [i] = EditorGUILayout.TextArea (dialogue.dialogueText [i], GUILayout.Height (50)); } EditorGUILayout.Space (); if (GUILayout.Button ("New Window")) { dialogue.dialogueText.Add (""); } EditorGUILayout.Space (); EditorGUILayout.EndScrollView (); EditorGUILayout.BeginHorizontal (); if (GUILayout.Button ("save Dialogue")) { SaveDialogue (); saved = true; GUI.FocusControl (null); return; } if (File.Exists ("D:/Users/matias/Documents/UnityProjects/Spo1/project-lesscontra/Editor/Dialogue/" + selectedObject.name + ".txt")) { if (GUILayout.Button ("load Dialogue")) { LoadDialouge (); GUI.FocusControl (null); return; } } EditorGUILayout.EndHorizontal (); } } } if (Application.isPlaying) { EditorGUILayout.Space (); GUILayout.Label ("Editing dialogue is disabled in playmode", EditorStyles.boldLabel); } }
public void OnGUI () { selectedObject = Selection.activeGameObject; if (!Application.isPlaying) { saved = false; if (selectedObject == null || selectedObject.GetComponent<NPC_Generic> () == null) //no actor selected { GUILayout.Label ("Please select and Actor in the Hierarchy", EditorStyles.boldLabel); } if (selectedObject != null && selectedObject.GetComponent<NPC_Generic> () != null) //if the selected gameObject is an actor { selectedActor = selectedObject.GetComponent <NPC_Generic> (); if (selectedObject.GetComponent<DialogueSystem> () == null) //has no dialouge, enter create mode { GUILayout.Label ("The selected Actor " + selectedObject.name + " has no dialouge", EditorStyles.boldLabel); if (GUILayout.Button ("Create Dialouge")) { selectedObject.AddComponent<DialogueSystem> (); dialogue = selectedObject.GetComponent<DialogueSystem> (); selectedActor.atributes.hasDialouge = true; } } //EDIT MODE if (Selection.activeGameObject.GetComponent<DialogueSystem> () != null) //has dialouge, enter edit mode { dialogue = selectedObject.GetComponent<DialogueSystem> (); EditorGUILayout.BeginHorizontal (); GUILayout.Label ("Currently editing dialouge for: " + selectedObject.name, EditorStyles.boldLabel); if (GUILayout.Button ("deleate dialouge System")) { windowNum = 0; selectedActor.dialouge = null; selectedActor.atributes.hasDialouge = false; ClearSave (); DestroyImmediate (selectedObject.GetComponent<DialogueSystem> ()); } if (FirstTimeOfSession) { if (File.Exists (path + "/Dialogue/" + selectedObject.name + ".txt")) { LoadDialouge (); } FirstTimeOfSession = false; } EditorGUILayout.EndHorizontal (); EditorGUILayout.Space (); scrollPositon = EditorGUILayout.BeginScrollView (scrollPositon); for (int i = 0; i < dialogue.dialogueWindow.Count; i++) //the draw loop { if (dialogue.dialogueWindow [i].IsQuestion) { startRecord = true; } if (startRecord) { } DialogueWindow current = dialogue.dialogueWindow [i]; //set the current dialogue window current.WindowNum = i; //fix the dialogue window winNUm EditorGUILayout.Space (); EditorGUILayout.BeginHorizontal (); GUILayout.Label ("Dialouge window: " + (i + 1)); if (dialogue.dialogueWindow.Count > 1) { if (GUILayout.Button ("x", GUILayout.Height (20), GUILayout.Width (20))) { windowNum--; dialogue.dialogueWindow.Remove (current); return; } } EditorGUILayout.EndHorizontal (); EditorGUILayout.BeginHorizontal (); if (GUILayout.Toggle (current.IsQuestion, "is this a question")) { current.IsQuestion = true; //index = EditorGUI.Foldout() } else { current.IsQuestion = false; } EditorGUILayout.EndHorizontal (); EditorGUILayout.Space (); dialogue.dialogueWindow [i].DialogueText = EditorGUILayout.TextArea (dialogue.dialogueWindow [i].DialogueText, GUILayout.Height (50)); } EditorGUILayout.Space (); if (GUILayout.Button ("New Window")) { dialogue.dialogueWindow.Add (new DialogueWindow ("", 0)); //create a new dialogue window with an empty string and a defult windownum of 0 (the draw loop takes care of the winNum) } EditorGUILayout.Space (); EditorGUILayout.EndScrollView (); EditorGUILayout.BeginHorizontal (); if (GUILayout.Button ("save Dialogue")) { SaveDialogue (); saved = true; GUI.FocusControl (null); return; } if (File.Exists (Application.dataPath + "/Dialogue/" + selectedObject.name + ".txt")) { if (GUILayout.Button ("load Dialogue")) { LoadDialouge (); GUI.FocusControl (null); return; } } EditorGUILayout.EndHorizontal (); } } } if (Application.isPlaying) { EditorGUILayout.Space (); GUILayout.Label ("Editing dialogue is disabled in playmode", EditorStyles.boldLabel); } }
void Start() { dialogueUI = GameObject.Find("Canvas").transform.Find("DialogueUI").gameObject; speak = transform.Find("Sprite").transform.Find("Speak").GetComponent<TextMesh>(); dialogue = GetComponent<DialogueSystem>(); }