diff --git a/DungeonShooting_Godot/editor/ActivityObject.svg b/DungeonShooting_Godot/editor/ActivityObject.svg new file mode 100644 index 0000000..f791a9b --- /dev/null +++ b/DungeonShooting_Godot/editor/ActivityObject.svg @@ -0,0 +1 @@ +<svg width="16px" height="16px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-labelledby="basketballIconTitle" stroke="#A5B7F3" stroke-width="3" stroke-linecap="square" stroke-linejoin="miter" color="#A5B7F3"> <title id="basketballIconTitle">Basketball</title> <g stroke-linecap="butt"> <path d="M3.00476 7.71673C6.03818 6.81589 9.99791 7.74841 13.2448 10.4315C16.5425 13.1566 18.2053 16.9442 17.8244 20.1241"/> <path d="M10.102 21.7996C9.33937 19.3589 10.0106 15.6137 12.0776 12.0335C14.1385 8.46402 17.0351 6.01413 19.5251 5.44463"/> <path d="M11.4419 2C11.2615 3.94419 10.5157 6.2298 9.22541 8.46468C7.29158 11.8142 4.64753 14.1615 2.40135 14.7854"/> </g> <circle cx="12" cy="12" r="10"/> </svg> \ No newline at end of file diff --git a/DungeonShooting_Godot/editor/ActivityObject.svg.import b/DungeonShooting_Godot/editor/ActivityObject.svg.import new file mode 100644 index 0000000..fe344ce --- /dev/null +++ b/DungeonShooting_Godot/editor/ActivityObject.svg.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/ActivityObject.svg-87e10b6946e37956d41aa89215315eeb.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://editor/ActivityObject.svg" +dest_files=[ "res://.import/ActivityObject.svg-87e10b6946e37956d41aa89215315eeb.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/DungeonShooting_Godot/editor/example.ds b/DungeonShooting_Godot/editor/example.ds new file mode 100644 index 0000000..f6c8aa5 --- /dev/null +++ b/DungeonShooting_Godot/editor/example.ds @@ -0,0 +1,111 @@ +//该样例演示如何声明一个类对象 + +//导入简化的命名空间后的类, global 命名空间下的成员不需要导入 +import Behavior = example.framework.Behavior; +//同样也可以直接导入简化名称的命名空间 +import myName = example.framework; +//导入整个命名空间 +import system; + +//除导入语句外, 脚本第一句必须是这个, 定义该文件所属的命名空间, 但是可以忽略, 默认为 global 命名空间 +namespace example.defineClass; +/* +这一句也必须写在文件的开头, 在声明 namespace 之后, +在命名空间 example.defineClass 下声明一个叫 MyClass 的类, 继承自 Behavior 类 +当一个文件内写过 class xxx 后, 就表名该文件是一个类, 逻辑代码和声明代码必须写在声明 class后面 +*/ +class MyClass extends Behavior; + +//在类中声明一个 a 变量, a 如果不赋值的话就默认为 null +var a; +var b = 1.5; +var c = null; +private var d = true; //私有属性 +readonly var e = false; //只读属性 + +//在类中声明一个叫 length 的 get 属性, get 属性必须有返回值 +get length() { + return b; +} +//在类中声明一个叫 length 的 set 属性, set 属性设置的数据变量叫 param +//param 关键字只能出现在 set 属性中, 并且只读 +set length(val) { + b = val; +} + +//在类中声明一个 say 的函数, 并且支持传入一个参数 +func say(str) { + var message = "say: " + str; + print(message); +} +//在类中声明一个 say 的函数重载, 该重载为 0 个参数 +//注意, 因为脚本数据类型为弱类型, 无法通过数据类型判断重载, 所以函数重载是根据参数长度来进行重载 +func say() { + say("hello"); +} + +//在类中声明构造函数, 其他地方调用 MyClass(); 时就会调用该类的构造函数, 无参构造可省略 +//参数重载和函数的规范一致, MyClass() 构造函数可以被视为一个特殊函数, 其他非构造函数不能调用 MyClass() 函数 +func MyClass() { + +} +//构造继承, 构造函数继承该类的无参构造函数 +func MyClass(message) extends MyClass() { + print("创建了MyClass, message: " + message); +} + +//语法展示 +private func grammarExample() { + //调用父类函数 + super.say(); + //判断实例是否是该类型 + if (i is Map) { + print("是字典"); + } else { + print("不是字典"); + } + //for循环100次 + for (var i = 0; i < 100; i++) { + continue; + } + //while循环 + while (true) { + break; + } + //repeat循环, 执行100次 + repeat(100) { + + } + //函数表达式 + var f1 = (a1) => { + + } + //执行函数 + f1(1); + //将成员函数存入变量 + var f2 = func(say, 1); + //数组 + var array = [1, 2, "str"]; + //匿名对象, 无法扩展和删除属性, 只能对已有的属性进行赋值 + var obj = { + x: 1, + y: -2.2, + list: ["str", true], + }; + //字典, 允许扩展和删除属性, 性能比匿名对象低 + var map = @{ + a: "", + b: 1, + c: false + }; +} + +//静态部分注意, 如果声明了一个叫 a 的非静态成员, 那么就不能声明一个叫 a 的静态变量 + +//在类中声明一个静态的 sa 变量, 并附上初始值 1 +static var sa = 2; + +//静态函数, 参数重载和普通函数的规范一致 +static func staticSay() { + +} \ No newline at end of file diff --git a/DungeonShooting_Godot/editor/ide_cn_font_6.tres b/DungeonShooting_Godot/editor/ide_cn_font_6.tres index 88e27db..60ada92 100644 --- a/DungeonShooting_Godot/editor/ide_cn_font_6.tres +++ b/DungeonShooting_Godot/editor/ide_cn_font_6.tres @@ -3,7 +3,7 @@ [ext_resource path="res://SourceHanSerifCN-SemiBold.otf" type="DynamicFontData" id=1] [resource] -size = 15 +size = 12 use_mipmaps = true use_filter = true extra_spacing_char = 1 diff --git a/DungeonShooting_Godot/editor/prefabs/CodePanel.tscn b/DungeonShooting_Godot/editor/prefabs/CodePanel.tscn index 450e71d..423ae3a 100644 --- a/DungeonShooting_Godot/editor/prefabs/CodePanel.tscn +++ b/DungeonShooting_Godot/editor/prefabs/CodePanel.tscn @@ -13,9 +13,7 @@ [node name="ScalePanel" type="Control" parent="."] anchor_right = 1.0 anchor_bottom = 1.0 -margin_right = 720.0 -margin_bottom = 405.0 -rect_scale = Vector2( 0.4, 0.4 ) +rect_scale = Vector2( 0.45, 0.45 ) [node name="TextEdit" type="TextEdit" parent="ScalePanel"] anchor_right = 1.0 @@ -23,7 +21,6 @@ custom_colors/member_variable_color = Color( 0.862745, 0.862745, 0.862745, 1 ) custom_colors/function_color = Color( 0.862745, 0.862745, 0.666667, 1 ) custom_colors/safe_line_number_color = Color( 1, 0.164706, 0.141176, 1 ) -custom_colors/caret_color = Color( 0, 0, 0, 0 ) custom_colors/background_color = Color( 0.117647, 0.117647, 0.117647, 1 ) custom_colors/number_color = Color( 0.709804, 0.807843, 0.658824, 1 ) custom_colors/current_line_color = Color( 0.0588235, 0.0588235, 0.0588235, 1 ) @@ -32,12 +29,11 @@ highlight_current_line = true syntax_highlighting = true show_line_numbers = true -draw_tabs = true bookmark_gutter = true -fold_gutter = true context_menu_enabled = false deselect_on_focus_loss_enabled = false minimap_draw = true +caret_blink = true script = ExtResource( 1 ) [node name="TextEditPainter" type="Node2D" parent="ScalePanel/TextEdit"] diff --git a/DungeonShooting_Godot/editor/prefabs/HintPanel.tscn b/DungeonShooting_Godot/editor/prefabs/HintPanel.tscn new file mode 100644 index 0000000..9782366 --- /dev/null +++ b/DungeonShooting_Godot/editor/prefabs/HintPanel.tscn @@ -0,0 +1,188 @@ +[gd_scene load_steps=7 format=2] + +[ext_resource path="res://editor/ActivityObject.svg" type="Texture" id=1] +[ext_resource path="res://editor/src/HintPanel.cs" type="Script" id=2] +[ext_resource path="res://editor/src/HintItem.cs" type="Script" id=3] + +[sub_resource type="StyleBoxFlat" id=3] +bg_color = Color( 1, 1, 1, 0.0784314 ) + +[sub_resource type="StyleBoxFlat" id=2] +bg_color = Color( 0.207843, 0.309804, 0.521569, 1 ) + +[sub_resource type="StyleBoxFlat" id=1] +bg_color = Color( 0, 0, 0, 0 ) + +[node name="HintPanel" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 2 ) + +[node name="Popup" type="PopupPanel" parent="."] +visible = true +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_right = -202.0 +margin_bottom = -106.0 + +[node name="ScrollContainer" type="ScrollContainer" parent="Popup"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 4.0 +margin_top = 4.0 +margin_right = -4.0 +margin_bottom = -4.0 +scroll_horizontal_enabled = false + +[node name="VBoxContainer" type="VBoxContainer" parent="Popup/ScrollContainer"] +margin_right = 270.0 +margin_bottom = 84.0 +size_flags_horizontal = 3 +custom_constants/separation = 0 + +[node name="Button" type="Button" parent="Popup/ScrollContainer/VBoxContainer"] +margin_right = 270.0 +margin_bottom = 12.0 +rect_min_size = Vector2( 0, 12 ) +custom_colors/font_color_focus = Color( 0.752941, 0.752941, 0.776471, 1 ) +custom_colors/font_color = Color( 0.752941, 0.752941, 0.776471, 1 ) +custom_colors/font_color_hover = Color( 0.752941, 0.752941, 0.776471, 1 ) +custom_colors/font_color_pressed = Color( 0.0901961, 0.352941, 0.976471, 1 ) +custom_styles/hover = SubResource( 3 ) +custom_styles/pressed = SubResource( 2 ) +custom_styles/focus = SubResource( 2 ) +custom_styles/disabled = SubResource( 1 ) +custom_styles/normal = SubResource( 1 ) +text = "123456789" +icon = ExtResource( 1 ) +align = 0 +expand_icon = true +script = ExtResource( 3 ) + +[node name="Button2" type="Button" parent="Popup/ScrollContainer/VBoxContainer"] +margin_top = 12.0 +margin_right = 270.0 +margin_bottom = 24.0 +rect_min_size = Vector2( 0, 12 ) +custom_colors/font_color_focus = Color( 0.752941, 0.752941, 0.776471, 1 ) +custom_colors/font_color = Color( 0.752941, 0.752941, 0.776471, 1 ) +custom_colors/font_color_hover = Color( 0.752941, 0.752941, 0.776471, 1 ) +custom_colors/font_color_pressed = Color( 0.0901961, 0.352941, 0.976471, 1 ) +custom_styles/hover = SubResource( 3 ) +custom_styles/pressed = SubResource( 2 ) +custom_styles/focus = SubResource( 2 ) +custom_styles/disabled = SubResource( 1 ) +custom_styles/normal = SubResource( 1 ) +text = "123456789" +icon = ExtResource( 1 ) +align = 0 +expand_icon = true +script = ExtResource( 3 ) + +[node name="Button3" type="Button" parent="Popup/ScrollContainer/VBoxContainer"] +margin_top = 24.0 +margin_right = 270.0 +margin_bottom = 36.0 +rect_min_size = Vector2( 0, 12 ) +custom_colors/font_color_focus = Color( 0.752941, 0.752941, 0.776471, 1 ) +custom_colors/font_color = Color( 0.752941, 0.752941, 0.776471, 1 ) +custom_colors/font_color_hover = Color( 0.752941, 0.752941, 0.776471, 1 ) +custom_colors/font_color_pressed = Color( 0.0901961, 0.352941, 0.976471, 1 ) +custom_styles/hover = SubResource( 3 ) +custom_styles/pressed = SubResource( 2 ) +custom_styles/focus = SubResource( 2 ) +custom_styles/disabled = SubResource( 1 ) +custom_styles/normal = SubResource( 1 ) +text = "123456789" +icon = ExtResource( 1 ) +align = 0 +expand_icon = true +script = ExtResource( 3 ) + +[node name="Button4" type="Button" parent="Popup/ScrollContainer/VBoxContainer"] +margin_top = 36.0 +margin_right = 270.0 +margin_bottom = 48.0 +rect_min_size = Vector2( 0, 12 ) +custom_colors/font_color_focus = Color( 0.752941, 0.752941, 0.776471, 1 ) +custom_colors/font_color = Color( 0.752941, 0.752941, 0.776471, 1 ) +custom_colors/font_color_hover = Color( 0.752941, 0.752941, 0.776471, 1 ) +custom_colors/font_color_pressed = Color( 0.0901961, 0.352941, 0.976471, 1 ) +custom_styles/hover = SubResource( 3 ) +custom_styles/pressed = SubResource( 2 ) +custom_styles/focus = SubResource( 2 ) +custom_styles/disabled = SubResource( 1 ) +custom_styles/normal = SubResource( 1 ) +text = "123456789" +icon = ExtResource( 1 ) +align = 0 +expand_icon = true +script = ExtResource( 3 ) + +[node name="Button5" type="Button" parent="Popup/ScrollContainer/VBoxContainer"] +margin_top = 48.0 +margin_right = 270.0 +margin_bottom = 60.0 +rect_min_size = Vector2( 0, 12 ) +custom_colors/font_color_focus = Color( 0.752941, 0.752941, 0.776471, 1 ) +custom_colors/font_color = Color( 0.752941, 0.752941, 0.776471, 1 ) +custom_colors/font_color_hover = Color( 0.752941, 0.752941, 0.776471, 1 ) +custom_colors/font_color_pressed = Color( 0.0901961, 0.352941, 0.976471, 1 ) +custom_styles/hover = SubResource( 3 ) +custom_styles/pressed = SubResource( 2 ) +custom_styles/focus = SubResource( 2 ) +custom_styles/disabled = SubResource( 1 ) +custom_styles/normal = SubResource( 1 ) +text = "123456789" +icon = ExtResource( 1 ) +align = 0 +expand_icon = true +script = ExtResource( 3 ) + +[node name="Button6" type="Button" parent="Popup/ScrollContainer/VBoxContainer"] +margin_top = 60.0 +margin_right = 270.0 +margin_bottom = 72.0 +rect_min_size = Vector2( 0, 12 ) +custom_colors/font_color_focus = Color( 0.752941, 0.752941, 0.776471, 1 ) +custom_colors/font_color = Color( 0.752941, 0.752941, 0.776471, 1 ) +custom_colors/font_color_hover = Color( 0.752941, 0.752941, 0.776471, 1 ) +custom_colors/font_color_pressed = Color( 0.0901961, 0.352941, 0.976471, 1 ) +custom_styles/hover = SubResource( 3 ) +custom_styles/pressed = SubResource( 2 ) +custom_styles/focus = SubResource( 2 ) +custom_styles/disabled = SubResource( 1 ) +custom_styles/normal = SubResource( 1 ) +text = "123456789" +icon = ExtResource( 1 ) +align = 0 +expand_icon = true +script = ExtResource( 3 ) + +[node name="Button7" type="Button" parent="Popup/ScrollContainer/VBoxContainer"] +margin_top = 72.0 +margin_right = 270.0 +margin_bottom = 84.0 +rect_min_size = Vector2( 0, 12 ) +custom_colors/font_color_focus = Color( 0.752941, 0.752941, 0.776471, 1 ) +custom_colors/font_color = Color( 0.752941, 0.752941, 0.776471, 1 ) +custom_colors/font_color_hover = Color( 0.752941, 0.752941, 0.776471, 1 ) +custom_colors/font_color_pressed = Color( 0.0901961, 0.352941, 0.976471, 1 ) +custom_styles/hover = SubResource( 3 ) +custom_styles/pressed = SubResource( 2 ) +custom_styles/focus = SubResource( 2 ) +custom_styles/disabled = SubResource( 1 ) +custom_styles/normal = SubResource( 1 ) +text = "123456789" +icon = ExtResource( 1 ) +align = 0 +expand_icon = true +script = ExtResource( 3 ) + +[connection signal="pressed" from="Popup/ScrollContainer/VBoxContainer/Button" to="Popup/ScrollContainer/VBoxContainer/Button" method="_on_click"] +[connection signal="pressed" from="Popup/ScrollContainer/VBoxContainer/Button2" to="Popup/ScrollContainer/VBoxContainer/Button2" method="_on_click"] +[connection signal="pressed" from="Popup/ScrollContainer/VBoxContainer/Button3" to="Popup/ScrollContainer/VBoxContainer/Button3" method="_on_click"] +[connection signal="pressed" from="Popup/ScrollContainer/VBoxContainer/Button4" to="Popup/ScrollContainer/VBoxContainer/Button4" method="_on_click"] +[connection signal="pressed" from="Popup/ScrollContainer/VBoxContainer/Button5" to="Popup/ScrollContainer/VBoxContainer/Button5" method="_on_click"] +[connection signal="pressed" from="Popup/ScrollContainer/VBoxContainer/Button6" to="Popup/ScrollContainer/VBoxContainer/Button6" method="_on_click"] +[connection signal="pressed" from="Popup/ScrollContainer/VBoxContainer/Button7" to="Popup/ScrollContainer/VBoxContainer/Button7" method="_on_click"] diff --git a/DungeonShooting_Godot/editor/src/CodePanel.cs b/DungeonShooting_Godot/editor/src/CodePanel.cs index 447b167..3775d1f 100644 --- a/DungeonShooting_Godot/editor/src/CodePanel.cs +++ b/DungeonShooting_Godot/editor/src/CodePanel.cs @@ -25,6 +25,8 @@ _editPainter.SetIdePanel(this); _editPainter.SetTextEdit(_codeTextEditor); + + _on_ScalePanel_resized(); } public override void _Process(float delta) diff --git a/DungeonShooting_Godot/editor/src/CodeTextEditor.cs b/DungeonShooting_Godot/editor/src/CodeTextEditor.cs index 328549d..11954c9 100644 --- a/DungeonShooting_Godot/editor/src/CodeTextEditor.cs +++ b/DungeonShooting_Godot/editor/src/CodeTextEditor.cs @@ -1,4 +1,5 @@ using Godot; +using File = System.IO.File; namespace Editor { @@ -57,8 +58,11 @@ "typeof" }; - private readonly string[] auto_compelete_right = { "'", "{", "\"", "(", "[" }; - private readonly string[] auto_compelete_left = { "'", "}", "\"", ")", "]" }; + + private int prevTextLength = 0; + + private readonly string[] autoCompeleteRight = { "{", "\"", "(", "[" }; + private readonly string[] autoCompeleteLeft = { "}", "\"", ")", "]" }; /// <summary> /// 字体大小 @@ -79,120 +83,9 @@ AddColorRegion("//", "", AnnotationColor, true); AddColorRegion("/*", "*/", AnnotationColor); AddColorRegion("\"", "\"", StringColor); - Text = @" -//该样例演示如何声明一个类对象 - -//导入简化的命名空间后的类, global 命名空间下的成员不需要导入 -import Behavior = example.framework.Behavior; -//同样也可以直接导入简化名称的命名空间 -import myName = example.framework; -//导入整个命名空间 -import system; - -//除导入语句外, 脚本第一句必须是这个, 定义该文件所属的命名空间, 但是可以忽略, 默认为 global 命名空间 -namespace example.defineClass; -/* -这一句也必须写在文件的开头, 在声明 namespace 之后, -在命名空间 example.defineClass 下声明一个叫 MyClass 的类, 继承自 Behavior 类 -当一个文件内写过 class xxx 后, 就表名该文件是一个类, 逻辑代码和声明代码必须写在声明 class后面 -*/ -class MyClass extends Behavior; - -//在类中声明一个 a 变量, a 如果不赋值的话就默认为 null -var a; -var b = 1.5; -var c = null; -private var d = true; //私有属性 -readonly var e = false; //只读属性 - -//在类中声明一个叫 length 的 get 属性, get 属性必须有返回值 -get length() { - return b; -} -//在类中声明一个叫 length 的 set 属性, set 属性设置的数据变量叫 param -//param 关键字只能出现在 set 属性中, 并且只读 -set length(val) { - b = val; -} - -//在类中声明一个 say 的函数, 并且支持传入一个参数 -func say(str) { - var message = ""say: "" + str; - print(message); -} -//在类中声明一个 say 的函数重载, 该重载为 0 个参数 -//注意, 因为脚本数据类型为弱类型, 无法通过数据类型判断重载, 所以函数重载是根据参数长度来进行重载 -func say() { - say(""hello""); -} - -//在类中声明构造函数, 其他地方调用 MyClass(); 时就会调用该类的构造函数, 无参构造可省略 -//参数重载和函数的规范一致, MyClass() 构造函数可以被视为一个特殊函数, 其他非构造函数不能调用 MyClass() 函数 -func MyClass() { - -} -//构造继承, 构造函数继承该类的无参构造函数 -func MyClass(message) extends MyClass() { - print(""创建了MyClass, message: "" + message); -} - -//语法展示 -private func grammarExample() { - //调用父类函数 - super.say(); - //判断实例是否是该类型 - if (i is Map) { - print(""是字典""); - } else { - print(""不是字典""); - } - //for循环100次 - for (var i = 0; i < 100; i++) { - continue; - } - //while循环 - while (true) { - break; - } - //repeat循环, 执行100次 - repeat(100) { - - } - //函数表达式 - var f1 = (a1) => { - - } - //执行函数 - f1(1); - //将成员函数存入变量 - var f2 = func(say, 1); - //数组 - var array = [1, 2, ""str""]; - //匿名对象, 无法扩展和删除属性, 只能对已有的属性进行赋值 - var obj = { - x: 1, - y: -2.2, - list: [""str"", true], - }; - //字典, 允许扩展和删除属性, 性能比匿名对象低 - var map = @{ - a: """", - b: 1, - c: false - }; -} - -//静态部分注意, 如果声明了一个叫 a 的非静态成员, 那么就不能声明一个叫 a 的静态变量 - -//在类中声明一个静态的 sa 变量, 并附上初始值 1 -static var sa = 2; - -//静态函数, 参数重载和普通函数的规范一致 -static func staticSay() { - -} - -"; + + Text = File.ReadAllText("editor/example.ds"); + ClearUndoHistory(); } public override void _Process(float delta) @@ -206,17 +99,31 @@ private void _on_TextEdit_text_changed() { - // Select(CursorGetLine(), CursorGetColumn() - 1, CursorGetLine(), CursorGetColumn()); - // var key = GetSelectionText(); - // Select(CursorGetLine(), CursorGetColumn(), CursorGetLine(), CursorGetColumn()); - // for (int i = 0; i < 5; i++) - // { - // if (key == auto_compelete_right[i]) - // { - // InsertTextAtCursor(auto_compelete_left[i]); - // CursorSetColumn(CursorGetColumn() - 1); - // } - // } + var newLength = Text.Length; + if (newLength != prevTextLength) + { + //括号补全 + + if (newLength > prevTextLength) + { + var line = CursorGetLine(); + var column = CursorGetColumn(); + Select(line, column - 1, line, column); + var key = GetSelectionText(); + Select(line, column, line, column); + + for (int i = 0; i < autoCompeleteRight.Length; i++) + { + if (key == autoCompeleteRight[i]) + { + InsertTextAtCursor(autoCompeleteLeft[i]); + CursorSetColumn(CursorGetColumn() - 1); + } + } + } + } + + prevTextLength = newLength; } } } \ No newline at end of file diff --git a/DungeonShooting_Godot/editor/src/HintItem.cs b/DungeonShooting_Godot/editor/src/HintItem.cs new file mode 100644 index 0000000..3ac95c6 --- /dev/null +++ b/DungeonShooting_Godot/editor/src/HintItem.cs @@ -0,0 +1,13 @@ +using Godot; + +public class HintItem : Button +{ + + + + //点击时调用 + private void _on_click() + { + GD.Print("点击按钮"); + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/editor/src/HintPanel.cs b/DungeonShooting_Godot/editor/src/HintPanel.cs new file mode 100644 index 0000000..b9c8661 --- /dev/null +++ b/DungeonShooting_Godot/editor/src/HintPanel.cs @@ -0,0 +1,10 @@ +using Godot; + +public class HintPanel : Control +{ + public override void _Ready() + { + var pop = GetNode<Popup>("Popup"); + pop.Popup_(); + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/editor/src/TextEditPainter.cs b/DungeonShooting_Godot/editor/src/TextEditPainter.cs index 8797dd7..06c13a3 100644 --- a/DungeonShooting_Godot/editor/src/TextEditPainter.cs +++ b/DungeonShooting_Godot/editor/src/TextEditPainter.cs @@ -68,34 +68,11 @@ public override void _Draw() { if (_textEdit == null) return; - - var lineHeight = _textEdit.GetLineHeight(); - - //绘制光标 - var line = _textEdit.CursorGetLine(); - var column = _textEdit.CursorGetColumn(); - var str = _textEdit.GetLine(line); - if (str != null && str.Length == column) - { - var cursorPos = _textEdit.GetPosAtLineColumn(line, column - 1); - if (cursorPos.x > -1 && cursorPos.y > -1) - { - DrawRect(new Rect2(cursorPos.x + 10, cursorPos.y - lineHeight, 1.4f, lineHeight), Colors.White); - } - } - else - { - var cursorPos = _textEdit.GetPosAtLineColumn(line, column); - if (cursorPos.x > -1 && cursorPos.y > -1) - { - DrawRect(new Rect2(cursorPos.x, cursorPos.y - lineHeight, 1.4f, lineHeight), Colors.White); - } - } - //绘制报错的行 if (_errorLines.Count > 0) { + var lineHeight = _textEdit.GetLineHeight(); var width = _textEdit.RectSize.x - _textEdit.MinimapWidth; for (int i = 0; i < _errorLines.Count; i++) {