fixed buggy dialogue on visible console
This commit is contained in:
@@ -6,7 +6,7 @@ public partial class console : PopupPanel
|
|||||||
private static RichTextLabel textblock;
|
private static RichTextLabel textblock;
|
||||||
private LineEdit line;
|
private LineEdit line;
|
||||||
private Dictionary commandDict;
|
private Dictionary commandDict;
|
||||||
private string error = "Not found! :(\n";
|
private string error = "Not found! :(";
|
||||||
|
|
||||||
//functions with capital letters can't be used inside the console
|
//functions with capital letters can't be used inside the console
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
@@ -21,13 +21,13 @@ public partial class console : PopupPanel
|
|||||||
if (Input.IsActionJustPressed("console"))
|
if (Input.IsActionJustPressed("console"))
|
||||||
{
|
{
|
||||||
Visible = !Visible;
|
Visible = !Visible;
|
||||||
line.GrabFocus();
|
|
||||||
player.allowMovement = !Visible;
|
player.allowMovement = !Visible;
|
||||||
|
line.GrabFocus();
|
||||||
}
|
}
|
||||||
/*if (OS.ReadStringFromStdIn() != "") //not tested yet
|
/*if (OS.ReadStringFromStdIn() != "") //not tested yet
|
||||||
OnLineEditTextSubmitted(OS.ReadStringFromStdIn());*/
|
OnLineEditTextSubmitted(OS.ReadStringFromStdIn());*/
|
||||||
}
|
}
|
||||||
private void OnPopupHide() => player.allowMovement = true;
|
private void OnPopupHide() { if (dialog_bubble.isTalking == false) player.allowMovement = true; }
|
||||||
private void OnLineEditTextSubmitted(string command)
|
private void OnLineEditTextSubmitted(string command)
|
||||||
{
|
{
|
||||||
line.Clear();
|
line.Clear();
|
||||||
|
@@ -11,6 +11,7 @@ public partial class dialog_bubble : CanvasLayer
|
|||||||
public string title;
|
public string title;
|
||||||
public Area2D triggerArea;
|
public Area2D triggerArea;
|
||||||
public static bool forceClose;
|
public static bool forceClose;
|
||||||
|
public static bool isTalking;
|
||||||
/*TODO:
|
/*TODO:
|
||||||
- Dont repeat the same randomized dialogue after you get asked do you need something "else"
|
- Dont repeat the same randomized dialogue after you get asked do you need something "else"
|
||||||
- add tree support (example: "story" key)
|
- add tree support (example: "story" key)
|
||||||
@@ -48,6 +49,7 @@ public partial class dialog_bubble : CanvasLayer
|
|||||||
GatherDialog("message");
|
GatherDialog("message");
|
||||||
|
|
||||||
Visible = true;
|
Visible = true;
|
||||||
|
isTalking = true;
|
||||||
}
|
}
|
||||||
public void GatherDialog(string key)
|
public void GatherDialog(string key)
|
||||||
{
|
{
|
||||||
@@ -162,6 +164,7 @@ public partial class dialog_bubble : CanvasLayer
|
|||||||
GetNode<Label>("box/name_label").Text = "???";
|
GetNode<Label>("box/name_label").Text = "???";
|
||||||
richText.Text = "";
|
richText.Text = "";
|
||||||
if (GetParent().Name == "player") player.allowMovement = true;
|
if (GetParent().Name == "player") player.allowMovement = true;
|
||||||
|
isTalking = false;
|
||||||
forceClose = false;
|
forceClose = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user