Replace XML codeblock spaces with tabs
This commit is contained in:
@ -41,16 +41,16 @@
|
||||
[codeblocks]
|
||||
[gdscript]
|
||||
func _can_drop_data(position, data):
|
||||
# Check position if it is relevant to you
|
||||
# Otherwise, just check data
|
||||
return typeof(data) == TYPE_DICTIONARY and data.has("expected")
|
||||
# Check position if it is relevant to you
|
||||
# Otherwise, just check data
|
||||
return typeof(data) == TYPE_DICTIONARY and data.has("expected")
|
||||
[/gdscript]
|
||||
[csharp]
|
||||
public override bool _CanDropData(Vector2 atPosition, Variant data)
|
||||
{
|
||||
// Check position if it is relevant to you
|
||||
// Otherwise, just check data
|
||||
return data.VariantType == Variant.Type.Dictionary && data.AsGodotDictionary().ContainsKey("expected");
|
||||
// Check position if it is relevant to you
|
||||
// Otherwise, just check data
|
||||
return data.VariantType == Variant.Type.Dictionary && data.AsGodotDictionary().ContainsKey("expected");
|
||||
}
|
||||
[/csharp]
|
||||
[/codeblocks]
|
||||
@ -66,20 +66,20 @@
|
||||
[codeblocks]
|
||||
[gdscript]
|
||||
func _can_drop_data(position, data):
|
||||
return typeof(data) == TYPE_DICTIONARY and data.has("color")
|
||||
return typeof(data) == TYPE_DICTIONARY and data.has("color")
|
||||
|
||||
func _drop_data(position, data):
|
||||
var color = data["color"]
|
||||
var color = data["color"]
|
||||
[/gdscript]
|
||||
[csharp]
|
||||
public override bool _CanDropData(Vector2 atPosition, Variant data)
|
||||
{
|
||||
return data.VariantType == Variant.Type.Dictionary && data.AsGodotDictionary().ContainsKey("color");
|
||||
return data.VariantType == Variant.Type.Dictionary && data.AsGodotDictionary().ContainsKey("color");
|
||||
}
|
||||
|
||||
public override void _DropData(Vector2 atPosition, Variant data)
|
||||
{
|
||||
Color color = data.AsGodotDictionary()["color"].AsColor();
|
||||
Color color = data.AsGodotDictionary()["color"].AsColor();
|
||||
}
|
||||
[/csharp]
|
||||
[/codeblocks]
|
||||
@ -95,16 +95,16 @@
|
||||
[codeblocks]
|
||||
[gdscript]
|
||||
func _get_drag_data(position):
|
||||
var mydata = make_data() # This is your custom method generating the drag data.
|
||||
set_drag_preview(make_preview(mydata)) # This is your custom method generating the preview of the drag data.
|
||||
return mydata
|
||||
var mydata = make_data() # This is your custom method generating the drag data.
|
||||
set_drag_preview(make_preview(mydata)) # This is your custom method generating the preview of the drag data.
|
||||
return mydata
|
||||
[/gdscript]
|
||||
[csharp]
|
||||
public override Variant _GetDragData(Vector2 atPosition)
|
||||
{
|
||||
var myData = MakeData(); // This is your custom method generating the drag data.
|
||||
SetDragPreview(MakePreview(myData)); // This is your custom method generating the preview of the drag data.
|
||||
return myData;
|
||||
var myData = MakeData(); // This is your custom method generating the drag data.
|
||||
SetDragPreview(MakePreview(myData)); // This is your custom method generating the preview of the drag data.
|
||||
return myData;
|
||||
}
|
||||
[/csharp]
|
||||
[/codeblocks]
|
||||
@ -135,20 +135,20 @@
|
||||
[codeblocks]
|
||||
[gdscript]
|
||||
func _gui_input(event):
|
||||
if event is InputEventMouseButton:
|
||||
if event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
|
||||
print("I've been clicked D:")
|
||||
if event is InputEventMouseButton:
|
||||
if event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
|
||||
print("I've been clicked D:")
|
||||
[/gdscript]
|
||||
[csharp]
|
||||
public override void _GuiInput(InputEvent @event)
|
||||
{
|
||||
if (@event is InputEventMouseButton mb)
|
||||
{
|
||||
if (mb.ButtonIndex == MouseButton.Left && mb.Pressed)
|
||||
{
|
||||
GD.Print("I've been clicked D:");
|
||||
}
|
||||
}
|
||||
if (@event is InputEventMouseButton mb)
|
||||
{
|
||||
if (mb.ButtonIndex == MouseButton.Left && mb.Pressed)
|
||||
{
|
||||
GD.Print("I've been clicked D:");
|
||||
}
|
||||
}
|
||||
}
|
||||
[/csharp]
|
||||
[/codeblocks]
|
||||
@ -184,16 +184,16 @@
|
||||
[codeblocks]
|
||||
[gdscript]
|
||||
func _make_custom_tooltip(for_text):
|
||||
var label = Label.new()
|
||||
label.text = for_text
|
||||
return label
|
||||
var label = Label.new()
|
||||
label.text = for_text
|
||||
return label
|
||||
[/gdscript]
|
||||
[csharp]
|
||||
public override Control _MakeCustomTooltip(string forText)
|
||||
{
|
||||
var label = new Label();
|
||||
label.Text = forText;
|
||||
return label;
|
||||
var label = new Label();
|
||||
label.Text = forText;
|
||||
return label;
|
||||
}
|
||||
[/csharp]
|
||||
[/codeblocks]
|
||||
@ -201,16 +201,16 @@
|
||||
[codeblocks]
|
||||
[gdscript]
|
||||
func _make_custom_tooltip(for_text):
|
||||
var tooltip = preload("res://some_tooltip_scene.tscn").instantiate()
|
||||
tooltip.get_node("Label").text = for_text
|
||||
return tooltip
|
||||
var tooltip = preload("res://some_tooltip_scene.tscn").instantiate()
|
||||
tooltip.get_node("Label").text = for_text
|
||||
return tooltip
|
||||
[/gdscript]
|
||||
[csharp]
|
||||
public override Control _MakeCustomTooltip(string forText)
|
||||
{
|
||||
Node tooltip = ResourceLoader.Load<PackedScene>("res://some_tooltip_scene.tscn").Instantiate();
|
||||
tooltip.GetNode<Label>("Label").Text = forText;
|
||||
return tooltip;
|
||||
Node tooltip = ResourceLoader.Load<PackedScene>("res://some_tooltip_scene.tscn").Instantiate();
|
||||
tooltip.GetNode<Label>("Label").Text = forText;
|
||||
return tooltip;
|
||||
}
|
||||
[/csharp]
|
||||
[/codeblocks]
|
||||
@ -499,18 +499,18 @@
|
||||
[codeblocks]
|
||||
[gdscript]
|
||||
func _ready():
|
||||
# Get the font color defined for the current Control's class, if it exists.
|
||||
modulate = get_theme_color("font_color")
|
||||
# Get the font color defined for the Button class.
|
||||
modulate = get_theme_color("font_color", "Button")
|
||||
# Get the font color defined for the current Control's class, if it exists.
|
||||
modulate = get_theme_color("font_color")
|
||||
# Get the font color defined for the Button class.
|
||||
modulate = get_theme_color("font_color", "Button")
|
||||
[/gdscript]
|
||||
[csharp]
|
||||
public override void _Ready()
|
||||
{
|
||||
// Get the font color defined for the current Control's class, if it exists.
|
||||
Modulate = GetThemeColor("font_color");
|
||||
// Get the font color defined for the Button class.
|
||||
Modulate = GetThemeColor("font_color", "Button");
|
||||
// Get the font color defined for the current Control's class, if it exists.
|
||||
Modulate = GetThemeColor("font_color");
|
||||
// Get the font color defined for the Button class.
|
||||
Modulate = GetThemeColor("font_color", "Button");
|
||||
}
|
||||
[/csharp]
|
||||
[/codeblocks]
|
||||
@ -598,12 +598,12 @@
|
||||
[codeblocks]
|
||||
[gdscript]
|
||||
func _process(delta):
|
||||
grab_click_focus() # When clicking another Control node, this node will be clicked instead.
|
||||
grab_click_focus() # When clicking another Control node, this node will be clicked instead.
|
||||
[/gdscript]
|
||||
[csharp]
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
GrabClickFocus(); // When clicking another Control node, this node will be clicked instead.
|
||||
GrabClickFocus(); // When clicking another Control node, this node will be clicked instead.
|
||||
}
|
||||
[/csharp]
|
||||
[/codeblocks]
|
||||
@ -861,12 +861,12 @@
|
||||
@export var color = Color(1, 0, 0, 1)
|
||||
|
||||
func _get_drag_data(position):
|
||||
# Use a control that is not in the tree
|
||||
var cpb = ColorPickerButton.new()
|
||||
cpb.color = color
|
||||
cpb.size = Vector2(50, 50)
|
||||
set_drag_preview(cpb)
|
||||
return color
|
||||
# Use a control that is not in the tree
|
||||
var cpb = ColorPickerButton.new()
|
||||
cpb.color = color
|
||||
cpb.size = Vector2(50, 50)
|
||||
set_drag_preview(cpb)
|
||||
return color
|
||||
[/gdscript]
|
||||
[csharp]
|
||||
[Export]
|
||||
@ -874,12 +874,12 @@
|
||||
|
||||
public override Variant _GetDragData(Vector2 atPosition)
|
||||
{
|
||||
// Use a control that is not in the tree
|
||||
var cpb = new ColorPickerButton();
|
||||
cpb.Color = _color;
|
||||
cpb.Size = new Vector2(50, 50);
|
||||
SetDragPreview(cpb);
|
||||
return _color;
|
||||
// Use a control that is not in the tree
|
||||
var cpb = new ColorPickerButton();
|
||||
cpb.Color = _color;
|
||||
cpb.Size = new Vector2(50, 50);
|
||||
SetDragPreview(cpb);
|
||||
return _color;
|
||||
}
|
||||
[/csharp]
|
||||
[/codeblocks]
|
||||
@ -1164,8 +1164,8 @@
|
||||
[b]Note:[/b] If you want to check whether the mouse truly left the area, ignoring any top nodes, you can use code like this:
|
||||
[codeblock]
|
||||
func _on_mouse_exited():
|
||||
if not Rect2(Vector2(), size).has_point(get_local_mouse_position()):
|
||||
# Not hovering over area.
|
||||
if not Rect2(Vector2(), size).has_point(get_local_mouse_position()):
|
||||
# Not hovering over area.
|
||||
[/codeblock]
|
||||
</description>
|
||||
</signal>
|
||||
@ -1255,10 +1255,10 @@
|
||||
[b]Note:[/b] This notification is received alongside [constant Node.NOTIFICATION_ENTER_TREE], so if you are instantiating a scene, the child nodes will not be initialized yet. You can use it to setup theming for this node, child nodes created from script, or if you want to access child nodes added in the editor, make sure the node is ready using [method Node.is_node_ready].
|
||||
[codeblock]
|
||||
func _notification(what):
|
||||
if what == NOTIFICATION_THEME_CHANGED:
|
||||
if not is_node_ready():
|
||||
await ready # Wait until ready signal.
|
||||
$Label.add_theme_color_override("font_color", Color.YELLOW)
|
||||
if what == NOTIFICATION_THEME_CHANGED:
|
||||
if not is_node_ready():
|
||||
await ready # Wait until ready signal.
|
||||
$Label.add_theme_color_override("font_color", Color.YELLOW)
|
||||
[/codeblock]
|
||||
</constant>
|
||||
<constant name="NOTIFICATION_SCROLL_BEGIN" value="47">
|
||||
|
||||
Reference in New Issue
Block a user