Ejemplo n.º 1
0
    public void LoadDialogTreeDatas()
    {
        List <DialogTree> templist = FileManager.Instance.LoadDialogTreeData(); //extract out the readied list of dialog tree from file manager

        for (int i = 0; i < templist.Count; ++i)                                //do some preparation work before inserting into the real database
        {
            //link up each of the dialog option's next dialog node pointer in each dialog node.
            foreach (my_DialogNode a_dialognode in templist[i].dialogs)
            {
                foreach (my_DialogOption a_dialogoption in a_dialognode.options)
                {
                    if (a_dialogoption.nextDialogId < 0)
                    {
                        a_dialogoption.nextDialog = null;
                    }

                    my_DialogNode thenextdialognode = templist[i].GetDialog(a_dialogoption.nextDialogId);
                    //Debug.Log("Suspect: " + a_dialogoption.nextDialogId);
                    a_dialogoption.nextDialog = thenextdialognode;
                }
            }

            dialogDatabase.Add(templist[i]);
        }
    }
Ejemplo n.º 2
0
 public my_DialogOption(string text, int returnstatus, my_DialogNode nextDialog, my_DialogNode parentDialog)
 {
     this.text         = text;
     this.returnStatus = returnstatus;
     this.nextDialog   = nextDialog;
     this.parentDialog = parentDialog;
 }
Ejemplo n.º 3
0
 public my_DialogOption(my_DialogOption another)
 {
     this.text         = another.text;
     this.returnStatus = another.returnStatus;
     this.nextDialog   = another.nextDialog;
     this.nextDialogId = another.nextDialogId;
     this.parentDialog = another.parentDialog;
 }
Ejemplo n.º 4
0
 public my_DialogNode(my_DialogNode another)
 {
     this.text      = another.text;
     this.actorName = another.actorName;
     this.options   = another.options;
     //this.parentDialog = another.parentDialog;
     //this.nextDialog = another.nextDialog;
     this.nodeId = another.nodeId;
 }
Ejemplo n.º 5
0
 public bool StartNewDialogSessionUsingBookmark(string gameLevelName, string bookmark_node_name)
 {
     CurrentDialogNode = dialogDatabase.GetBookmarkDialogNode(gameLevelName, bookmark_node_name);
     if (CurrentDialogNode != null)
     {
         display = true;
         return(true);
     }
     return(false);
 }
Ejemplo n.º 6
0
 public bool StartNewDialogSession(my_DialogNode a_dialogNode)
 {
     CurrentDialogNode = a_dialogNode;
     if (CurrentDialogNode != null)
     {
         display = true;
         return(true);
     }
     return(false);
 }
Ejemplo n.º 7
0
 public bool StartNewDialogSession(int dialogTreeId, int dialogNodeId)
 {
     CurrentDialogNode = dialogDatabase.GetDialogNode(dialogTreeId, dialogNodeId);
     if (CurrentDialogNode != null)
     {
         display = true;
         return(true);
     }
     return(false);
 }
Ejemplo n.º 8
0
 public bool StartNewDialogSession(string gameLevelName, int dialogNodeId)
 {
     CurrentDialogNode = dialogDatabase.GetDialogNode(gameLevelName, dialogNodeId);
     if (CurrentDialogNode != null)
     {
         display = true;
         return(true);
     }
     return(false);
 }
Ejemplo n.º 9
0
 public bool StartNewDialogSessionUsingBookmark(int dialogTreeId, int bookmark_node_id)
 {
     CurrentDialogNode = dialogDatabase.GetBookmarkDialogNode(dialogTreeId, bookmark_node_id);
     if (CurrentDialogNode != null)
     {
         display = true;
         return(true);
     }
     return(false);
 }
Ejemplo n.º 10
0
 public my_DialogBookmark(int id, string bookmarkname, my_DialogNode nodeToBookmark)
 {
     this.id                   = id;
     this.bookmarkName         = bookmarkname;
     this.bookmarkedDialogNode = nodeToBookmark;
 }
Ejemplo n.º 11
0
 public my_DialogBookmark(int id, my_DialogNode nodeToBookmark)
 {
     this.id = id;
     this.bookmarkedDialogNode = nodeToBookmark;
 }
Ejemplo n.º 12
0
    void OnGUI()
    {
        if (ScreenManager.Instance.CheckAspectChanged() == true)
        {
            UpdateDisplayRect();
        }
        if (CurrentDialogNode == null)
        {
            display = false;
            return;
        }

        if (display == true)
        {
            if (CurrentDialogNode.nodeId < 0)
            {
                Player.GetComponent <CastSlot>().display = true;
                //cursorScript.toggle = false;
                return;
            }

            Player.GetComponent <CastSlot>().display = false;
            //cursorScript.toggle = true;

            GUI.skin = skin;

            currentevent = Event.current;

            GUI.Box(dialogBox, CurrentDialogNode.text, skin.GetStyle("dialog"));
            GUI.Box(personBox, CurrentDialogNode.actorName, skin.GetStyle("name"));

            if (CurrentDialogNode.options.Count > 1)          //meaning there are other link than a single process link
            {
                //multi option section
                //render the options
                for (int i = 0; i < CurrentDialogNode.options.Count; ++i)
                {
                    if (CurrentDialogNode.options.Count > optionRects.Count)                   //pad out the difference,else will cause argument out of range
                    {
                        int difference = CurrentDialogNode.options.Count - optionRects.Count;
                        for (int d = 0; d < difference; ++d)
                        {
                            optionRects.Add(new Rect(0, 0, 0, 0));
                        }
                    }

                    optionHeight = dialogBox.height * 0.2f;
                    optionWidth  = dialogBox.width / CurrentDialogNode.options.Count;

                    optionRects[i] = new Rect((i) * optionWidth, dialogBox.yMax - optionHeight, optionWidth, optionHeight);
                    GUI.Box(optionRects[i], CurrentDialogNode.options[i].text, skin.GetStyle("option"));

                    if (optionRects[i].Contains(currentevent.mousePosition))                       //if mouse pointer is within option box
                    {
                        if (currentevent.button == 0 && currentevent.type == EventType.mouseUp)    //left click and button up
                        {
                            CurrentDialogNode = CurrentDialogNode.options[i].nextDialog;
                            //CurrentDialogNodeIndex = CurrentDialogNode.nodeId;
                            break;
                        }
                    }
                }
            }
            else
            {
                //single link section
                if (dialogBox.Contains(currentevent.mousePosition))                         //if mouse pointer is within option box
                {
                    if (currentevent.button == 0 && currentevent.type == EventType.mouseUp) //left click and button up
                    {
                        CurrentDialogNode = CurrentDialogNode.options[0].nextDialog;
                        if (CurrentDialogNode == null)
                        {
                            display = false;
                            Player.GetComponent <CastSlot>().display = true;
                            //cursorScript.toggle = false;
                            return;
                        }
                    }
                }
                optionHeight   = dialogBox.height * 0.2f;
                optionWidth    = dialogBox.width;
                optionRects[0] = new Rect(0, dialogBox.yMax - optionHeight, optionWidth, optionHeight);
                GUI.Box(optionRects[0], CurrentDialogNode.options[0].text, skin.GetStyle("option"));
            }
        }
    }