mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 14:35:12 +00:00
Implemented syntax highlighting for scripts.
This commit is contained in:
1 parent
978358e827
commit
5f3ed66234
11 files changed
+715
-1008
No files matched your search
@@ -20,7 +20,7 @@ import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class GuiScript extends GuiNPCInterface implements IGuiData, GuiYesNoCallback, ICustomScrollListener, IJTextAreaListener {
|
||||
public class GuiScript extends GuiNPCInterface implements IGuiData, GuiYesNoCallback, ICustomScrollListener, IJTextAreaListener, ITextChangeListener {
|
||||
public boolean showScript = false;
|
||||
private int activeTab = 0;
|
||||
public DataScript script;
|
||||
@@ -80,7 +80,10 @@ public class GuiScript extends GuiNPCInterface implements IGuiData, GuiYesNoCall
|
||||
|
||||
ScriptContainer container = script.getNPCScript(activeTab);
|
||||
|
||||
addTextField(new GuiNpcTextArea(2, this, guiLeft + 74, guiTop + 4, 239, 208, container == null?"":container.script));
|
||||
GuiScriptTextArea ta = new GuiScriptTextArea(this,2, guiLeft + 74, guiTop + 4, 239, 208, container == null?"":container.script);
|
||||
ta.enableCodeHighlighting();
|
||||
ta.setListener(this);
|
||||
this.addTextField(ta);
|
||||
|
||||
addButton(new GuiNpcButton(102, guiLeft + 315, guiTop + 4, 50, 20, "gui.clear"));
|
||||
addButton(new GuiNpcButton(101, guiLeft + 366, guiTop + 4, 50, 20, "gui.paste"));
|
||||
@@ -268,6 +271,12 @@ public class GuiScript extends GuiNPCInterface implements IGuiData, GuiYesNoCall
|
||||
}
|
||||
}
|
||||
|
||||
public void textUpdate(String text) {
|
||||
ScriptContainer container = script.getNPCScript(activeTab);
|
||||
if(container != null)
|
||||
container.script = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveText(String text) {
|
||||
ScriptContainer container = script.getNPCScript(activeTab);
|
||||
|
||||
Reference in new issue
Block a user