removed some dumb c# coding
This commit is contained in:
@@ -39,14 +39,14 @@ public partial class console : PopupPanel
|
|||||||
if (Input.IsActionJustPressed("console"))
|
if (Input.IsActionJustPressed("console"))
|
||||||
ToggleVisible();
|
ToggleVisible();
|
||||||
}
|
}
|
||||||
private void ToggleVisible()
|
void ToggleVisible()
|
||||||
{
|
{
|
||||||
Visible = !Visible;
|
Visible = !Visible;
|
||||||
player.allowMovement = !Visible;
|
player.allowMovement = !Visible;
|
||||||
line.GrabFocus();
|
line.GrabFocus();
|
||||||
}
|
}
|
||||||
private void OnPopupHide() { if (dialog_bubble.isTalking == false) player.allowMovement = true; }
|
void OnPopupHide() { if (dialog_bubble.isTalking == false) player.allowMovement = true; }
|
||||||
private void OnLineEditTextSubmitted(string command)
|
void OnLineEditTextSubmitted(string command)
|
||||||
{
|
{
|
||||||
line.Clear();
|
line.Clear();
|
||||||
//repeat user input to console
|
//repeat user input to console
|
||||||
@@ -80,7 +80,7 @@ public partial class console : PopupPanel
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void help()
|
void help()
|
||||||
{
|
{
|
||||||
Print("==================================== Help ====================================");
|
Print("==================================== Help ====================================");
|
||||||
for (int i = 0; i < commandDict.Count; i++)
|
for (int i = 0; i < commandDict.Count; i++)
|
||||||
@@ -89,7 +89,7 @@ public partial class console : PopupPanel
|
|||||||
+ Json.ParseString(commandDict.Values.ToString()).AsStringArray()[i]);
|
+ Json.ParseString(commandDict.Values.ToString()).AsStringArray()[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void help(string key) //Optional parameters aren't optional in Call()/Callv() so i use overloads instead
|
void help(string key) //Optional parameters aren't optional in Call()/Callv() so i use overloads instead
|
||||||
{
|
{
|
||||||
key = key.ToLower();
|
key = key.ToLower();
|
||||||
if (key.Length != 0 && commandDict.ContainsKey(key))
|
if (key.Length != 0 && commandDict.ContainsKey(key))
|
||||||
@@ -103,13 +103,13 @@ public partial class console : PopupPanel
|
|||||||
help("help");
|
help("help");
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
private void consoleclear() => textblock.Clear();
|
void consoleclear() => textblock.Clear();
|
||||||
private void speed(float multiplier)
|
void speed(float multiplier)
|
||||||
{
|
{
|
||||||
player.speed = Mathf.Clamp(multiplier, 0.01f, 15f);
|
player.speed = Mathf.Clamp(multiplier, 0.01f, 15f);
|
||||||
Print("Set player speed to " + Mathf.Clamp(multiplier, 0.01f, 15f));
|
Print("Set player speed to " + Mathf.Clamp(multiplier, 0.01f, 15f));
|
||||||
}
|
}
|
||||||
private void noclip()
|
void noclip()
|
||||||
{
|
{
|
||||||
try { Print(player.CollisionToggle()); }
|
try { Print(player.CollisionToggle()); }
|
||||||
catch
|
catch
|
||||||
@@ -118,7 +118,7 @@ public partial class console : PopupPanel
|
|||||||
help("noclip");
|
help("noclip");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void stickycamera()
|
void stickycamera()
|
||||||
{
|
{
|
||||||
try { Print(player.CheatCam()); }
|
try { Print(player.CheatCam()); }
|
||||||
catch
|
catch
|
||||||
@@ -127,22 +127,22 @@ public partial class console : PopupPanel
|
|||||||
help("stickycamera");
|
help("stickycamera");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void playername(string name)
|
void playername(string name)
|
||||||
{
|
{
|
||||||
player_variables.PlayerName = name;
|
player_variables.PlayerName = name;
|
||||||
Print("Your new name is now: " + player_variables.PlayerName);
|
Print("Your new name is now: " + player_variables.PlayerName);
|
||||||
}
|
}
|
||||||
private void closedialogue()
|
void closedialogue()
|
||||||
{
|
{
|
||||||
dialog_bubble.forceClose = true;
|
dialog_bubble.forceClose = true;
|
||||||
Print("Dialogue got closed!");
|
Print("Dialogue got closed!");
|
||||||
}
|
}
|
||||||
private void reload()
|
void reload()
|
||||||
{
|
{
|
||||||
GetTree().ReloadCurrentScene();
|
GetTree().ReloadCurrentScene();
|
||||||
Print("Level got reloaded!");
|
Print("Level got reloaded!");
|
||||||
}
|
}
|
||||||
private void visiblecollision()
|
void visiblecollision()
|
||||||
{
|
{
|
||||||
GetTree().DebugCollisionsHint = !GetTree().DebugCollisionsHint;
|
GetTree().DebugCollisionsHint = !GetTree().DebugCollisionsHint;
|
||||||
Print("Visible collision shapes and hitmarker now set to: " + GetTree().DebugCollisionsHint + "Use 'reload' to see changes!");
|
Print("Visible collision shapes and hitmarker now set to: " + GetTree().DebugCollisionsHint + "Use 'reload' to see changes!");
|
||||||
|
@@ -52,7 +52,7 @@ public partial class dialog_bubble : CanvasLayer
|
|||||||
Visible = true;
|
Visible = true;
|
||||||
isTalking = true;
|
isTalking = true;
|
||||||
}
|
}
|
||||||
public void GatherDialog(string key)
|
void GatherDialog(string key)
|
||||||
{
|
{
|
||||||
dlgPointer = 0;
|
dlgPointer = 0;
|
||||||
if (parsedDlg.AsGodotDictionary()[key].VariantType == Variant.Type.Array)
|
if (parsedDlg.AsGodotDictionary()[key].VariantType == Variant.Type.Array)
|
||||||
@@ -61,7 +61,7 @@ public partial class dialog_bubble : CanvasLayer
|
|||||||
dlgLines = dlgLines.AsGodotArray()[GD.RandRange(0, dlgLines.AsGodotArray().Count - 1)];
|
dlgLines = dlgLines.AsGodotArray()[GD.RandRange(0, dlgLines.AsGodotArray().Count - 1)];
|
||||||
//TODO:copy a clean default array and remove already used indexes and copy from clean array when its empty
|
//TODO:copy a clean default array and remove already used indexes and copy from clean array when its empty
|
||||||
}
|
}
|
||||||
public void OnVisibilityChanged()
|
void OnVisibilityChanged()
|
||||||
{
|
{
|
||||||
if (Visible)
|
if (Visible)
|
||||||
ProcessMode = ProcessModeEnum.Inherit;
|
ProcessMode = ProcessModeEnum.Inherit;
|
||||||
@@ -82,7 +82,7 @@ public partial class dialog_bubble : CanvasLayer
|
|||||||
DialogControlls();
|
DialogControlls();
|
||||||
AnswerBoxControlls();
|
AnswerBoxControlls();
|
||||||
}
|
}
|
||||||
public void DialogControlls()
|
void DialogControlls()
|
||||||
{
|
{
|
||||||
if (Input.IsActionJustPressed("ui_cancel")) richText.VisibleCharacters = richText.Text.Length;
|
if (Input.IsActionJustPressed("ui_cancel")) richText.VisibleCharacters = richText.Text.Length;
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ public partial class dialog_bubble : CanvasLayer
|
|||||||
}
|
}
|
||||||
Visible = !(dlgPointer > dlgLines.AsGodotArray().Count || forceClose);
|
Visible = !(dlgPointer > dlgLines.AsGodotArray().Count || forceClose);
|
||||||
}
|
}
|
||||||
public void UpdateDialog()
|
void UpdateDialog()
|
||||||
{
|
{
|
||||||
richText.Text = dlgLines.AsGodotArray()[dlgPointer].ToString();
|
richText.Text = dlgLines.AsGodotArray()[dlgPointer].ToString();
|
||||||
richText.VisibleCharacters = 0;
|
richText.VisibleCharacters = 0;
|
||||||
@@ -123,7 +123,7 @@ public partial class dialog_bubble : CanvasLayer
|
|||||||
}
|
}
|
||||||
else typewriterTimer.Stop();
|
else typewriterTimer.Stop();
|
||||||
}
|
}
|
||||||
public void MakeAnswerBox(string[] dialogOptions)
|
void MakeAnswerBox(string[] dialogOptions)
|
||||||
{
|
{
|
||||||
var parent = GetNode("box/panel_container/margin_container");
|
var parent = GetNode("box/panel_container/margin_container");
|
||||||
if (parent.GetChildCount() == 1) parent.GetChild(0).Free();
|
if (parent.GetChildCount() == 1) parent.GetChild(0).Free();
|
||||||
@@ -138,7 +138,7 @@ public partial class dialog_bubble : CanvasLayer
|
|||||||
GetNode<PanelContainer>("box/panel_container").Visible = true;
|
GetNode<PanelContainer>("box/panel_container").Visible = true;
|
||||||
parent.GetChild<Button>(0).GrabFocus();
|
parent.GetChild<Button>(0).GrabFocus();
|
||||||
}
|
}
|
||||||
public void AnswerBoxControlls()
|
void AnswerBoxControlls()
|
||||||
{
|
{
|
||||||
if (GetNode<PanelContainer>("box/panel_container").Visible == true
|
if (GetNode<PanelContainer>("box/panel_container").Visible == true
|
||||||
&& GetNode("box/panel_container/margin_container").GetChild(0).GetChild<Button>(0).ButtonGroup.GetPressedButton() != null)
|
&& GetNode("box/panel_container/margin_container").GetChild(0).GetChild<Button>(0).ButtonGroup.GetPressedButton() != null)
|
||||||
@@ -155,7 +155,7 @@ public partial class dialog_bubble : CanvasLayer
|
|||||||
dlgPointer++;
|
dlgPointer++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void InDialogEvents(int eventID)
|
void InDialogEvents(int eventID)
|
||||||
{
|
{
|
||||||
switch (eventID)
|
switch (eventID)
|
||||||
{
|
{
|
||||||
|
@@ -67,11 +67,7 @@ public partial class player : CharacterBody2D
|
|||||||
animatedSprite.SpeedScale = Math.Abs(movement.Y * speed * 1.3f);
|
animatedSprite.SpeedScale = Math.Abs(movement.Y * speed * 1.3f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public int BeginDialogue(int i)
|
void OnAnimationChanged()
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
public void OnAnimationChanged()
|
|
||||||
{
|
{
|
||||||
if (animatedSprite.Animation == "move_side")
|
if (animatedSprite.Animation == "move_side")
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user