You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
-moved script to modules
This commit is contained in:
14
tools/script_plugins/time/plugin.cfg
Normal file
14
tools/script_plugins/time/plugin.cfg
Normal file
@@ -0,0 +1,14 @@
|
||||
[plugin]
|
||||
|
||||
name="The Time"
|
||||
description="This plugin displays the current local time, with great accuracy, by harvesting the power of quartz crystals inside your computer.\nIt may also serve as simple example on how to write a non-installable editor plugin, or just remind you that it's time to go back home."
|
||||
author="Juan Linietsky"
|
||||
version="1.0"
|
||||
installs=false
|
||||
script="time.gd"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
32
tools/script_plugins/time/time.gd
Normal file
32
tools/script_plugins/time/time.gd
Normal file
@@ -0,0 +1,32 @@
|
||||
tool # Always declare as Tool, if it's meant to run in the editor.
|
||||
extends EditorPlugin
|
||||
|
||||
var timer = null
|
||||
var label = null
|
||||
|
||||
func _timeout():
|
||||
if (label):
|
||||
var time = OS.get_time()
|
||||
label.set_text(str(time.hour).pad_zeros(2)+":"+str(time.minute).pad_zeros(2)+":"+str(time.second).pad_zeros(2))
|
||||
|
||||
func get_name():
|
||||
return "The Time"
|
||||
|
||||
|
||||
func _init():
|
||||
print("PLUGIN INIT")
|
||||
timer = Timer.new()
|
||||
add_child(timer)
|
||||
timer.set_wait_time(0.5)
|
||||
timer.set_one_shot(false)
|
||||
timer.connect("timeout",self,"_timeout")
|
||||
|
||||
func _enter_scene():
|
||||
label = Label.new()
|
||||
add_custom_control(CONTAINER_TOOLBAR,label)
|
||||
timer.start()
|
||||
|
||||
func _exit_scene():
|
||||
timer.stop()
|
||||
label.free()
|
||||
label=null
|
||||
Reference in New Issue
Block a user