Initial Android commit
This commit is contained in:
commit
1e2b80c13d
8521 changed files with 231475 additions and 0 deletions
63
scripts/CustomTooltipInGameForFullView.gd
Normal file
63
scripts/CustomTooltipInGameForFullView.gd
Normal file
|
@ -0,0 +1,63 @@
|
|||
extends Control
|
||||
|
||||
onready var tween = $Tween;
|
||||
|
||||
const time:float = 0.2;
|
||||
var state:int = 0;
|
||||
var controls:Array = [];
|
||||
|
||||
var mem = preload("res://CustomTooltipInGame.tscn")
|
||||
var tooltip = null;
|
||||
var tooltipHidden = null;
|
||||
|
||||
var hidden:bool = false;
|
||||
|
||||
func _make_custom_tooltip(for_text)->Control:
|
||||
if hidden:
|
||||
if is_instance_valid(tooltipHidden):
|
||||
return tooltipHidden;
|
||||
|
||||
tooltipHidden = mem.instance();
|
||||
tooltipHidden.get_node("Node2D").get_node("Label").text = "";
|
||||
tooltipHidden.get_node("Node2D").position.x = - 1000;
|
||||
return tooltipHidden;
|
||||
|
||||
if is_instance_valid(tooltip):
|
||||
return tooltip;
|
||||
|
||||
tooltip = mem.instance()
|
||||
tooltip.get_node("Node2D").get_node("Label").text = for_text
|
||||
return tooltip;
|
||||
|
||||
func HoverOn(_controls:Array):
|
||||
if is_instance_valid(tooltip):
|
||||
tooltip.visible = false;
|
||||
hidden = true;
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
|
||||
controls = _controls;
|
||||
StartTween(1);
|
||||
|
||||
func HoverOff(_controls:Array):
|
||||
if is_instance_valid(tooltip):
|
||||
tooltip.visible = true;
|
||||
hidden = false;
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
controls = _controls;
|
||||
StartTween(2);
|
||||
|
||||
func StartTween(value):
|
||||
if (state == 1 and value == 2) or (state == 2 and value == 1):
|
||||
tween.remove_all();
|
||||
|
||||
state = value;
|
||||
|
||||
var modulateValue = Color(1, 1, 1, 1);
|
||||
if state == 1:
|
||||
modulateValue = Color(1, 1, 1, 0);
|
||||
|
||||
for i in controls:
|
||||
tween.interpolate_property(i, "modulate", i.modulate, modulateValue, time, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT, 0)
|
||||
tween.start()
|
||||
|
||||
func _on_Tween_tween_all_completed():
|
||||
state = 0;
|
Loading…
Add table
Add a link
Reference in a new issue