void displayDialog(string searchName)
 {
     if (searchName == "")
     {
         return;
     }
     currentDialog = getDialog(searchName);
     showDialog    = true;
 }
 // Update is called once per frame
 void Update()
 {
     shipControls = gameManager.prefabManager.currentPrefab.GetComponent <ShipControls>();
     tankControls = gameManager.prefabManager.currentPrefab.GetComponent <SimpleTankController>();
     //if (currentDialog == null) showDialog = false;
     if (Input.GetKeyDown(KeyCode.Space) && showDialog)
     {
         // nextDialog = currentDialog.nextDialog;
         previousDialog = currentDialog;
         if (currentDialog.keepParentSize)
         {
             parentRect = new Rect(currentDialog.position.x, currentDialog.position.y, currentDialog.size.x, currentDialog.size.y);
         }
         currentDialog = nextDialog;
         if (nextDialog == null || currentDialog == null)
         {
             showDialog = false;
         }
     }
 }
 void VendorDialog(QI_ItemData[] venderItems, QI_ItemData[] playerItems)
 {
     DCDialog vendorDialog = new DCDialog();
 }
 void setCurrentDialog(DCDialog dialog)
 {
     currentDialog = dialog;
 }
 void setCurrentDialog(string searchName)
 {
     currentDialog = getDialog(searchName);
 }
 void addDialog(DCDialog dialog)
 {
     dialogs.Add(dialog);
 }
    void DialogWindow(int windowID)
    {
        if (shipControls != null)
        {
            shipControls.playerControl = false;
        }
        if (tankControls != null)
        {
            tankControls.playerControl = false;
        }

        if (currentDialog.canGoBack)
        {
            if (GUILayout.Button("< Back"))
            {
                currentDialog = previousDialog;
            }
        }
        //GUILayout.BeginArea(new Rect(dialogPosition.x, dialogPosition.y, dialogSize.x, dialogSize.y));
        GUILayout.Label(previousDialogText);

        GUILayout.BeginHorizontal();
        GUILayout.Label(currentDialog.image, GUILayout.Height(64), GUILayout.Width(64));
        GUILayout.Label(currentDialog.dialogName);
        GUILayout.EndHorizontal();
        GUILayout.Label(currentDialog.dialogText);

        if (currentDialog.dialogType == DialogType.TakeItem)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label(currentDialog.item.Name);
            if (!inventoryManager.hasItem(currentDialog.item.Name))
            {
                if (GUILayout.Button("Take Item"))
                {
                    inventoryManager.Pickup(currentDialog.item.Name);
                }
            }
            else
            {
                GUILayout.Label("Has item already");
            }
            GUILayout.EndHorizontal();
        }
        if (currentDialog.dialogType == DialogType.GiveItem)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label(currentDialog.item.Name);
            if (GUILayout.Button("Give Item"))
            {
            }
            GUILayout.EndHorizontal();
        }

        if (currentDialog.dialogType == DialogType.AddObjective)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label(currentDialog.objective.Description);
            //Debug.Log(currentDialog.objective.name);
            if (!objectivesList.isObjectiveEnabled(currentDialog.objective.name))
            {
                if (GUILayout.Button("Accept Objective"))
                {
                    objectivesList.enableObjective(currentDialog.objective.name);
                }
            }
            else
            {
                GUILayout.Label("Objective already activated");
            }
            GUILayout.EndHorizontal();
        }
        if (currentDialog.responses.Count > 0)
        {
            foreach (DCDialog dialog in currentDialog.responses)
            {
                if (GUILayout.Button(dialog.dialogText))
                {
                    if (currentDialog.keepParentSize)
                    {
                        parentRect = new Rect(currentDialog.position.x, currentDialog.position.y, currentDialog.size.x, currentDialog.size.y);
                    }
                    previousDialogText = string.Format("You: {0}", dialog.dialogText);
                    previousDialog     = currentDialog;
                    currentDialog      = dialog.nextDialog;
                }
            }
        }
        else
        {
            if (GUILayout.Button("Continue"))
            {
                if (currentDialog.nextDialog != null)
                {
                    previousDialog = currentDialog;
                    currentDialog  = currentDialog.nextDialog;
                }
                else
                {
                    if (shipControls != null)
                    {
                        shipControls.playerControl = true;
                    }
                    if (tankControls != null)
                    {
                        tankControls.playerControl = true;
                    }
                    showDialog = false;
                }
            }
        }
        //GUILayout.EndArea();
    }