diff --git a/binaries/data/mods/official/gui/test/animation.js b/binaries/data/mods/official/gui/test/animation.js new file mode 100755 index 0000000000..eee8ce7d14 --- /dev/null +++ b/binaries/data/mods/official/gui/test/animation.js @@ -0,0 +1,29 @@ + +/* Global functions for GUI animation (sliding in/out, fading etc.) */ + +function GUISlideIn(GUIObject, SlideSpeed) +{ + + // Just me testing some stuff :) + + var SlideObject = getGUIObjectByName(GUIObject); + var SizeVar = SlideObject.size; + //var Sizes = SizeVar.split(" "); + + //var x_s = Sizes[0]; + //var y_s = Sizes[1]; + //var x_e = Sizes[2]; + //var y_e = Sizes[3]; + //var height = x_e - x_s; + + //var Time = new Date(); + //var StartTime = Time.getTime(); + + var i = 0; + while(i <= 2) { + i++; + SlideObject.size = new GUISize(x_s, 0 + i, x_e, 0 + i + height); + } + +} + diff --git a/binaries/data/mods/official/gui/test/basefunctions.js b/binaries/data/mods/official/gui/test/basefunctions.js new file mode 100755 index 0000000000..36f3d05fc3 --- /dev/null +++ b/binaries/data/mods/official/gui/test/basefunctions.js @@ -0,0 +1,78 @@ +function GUIObjectHide(objectName) { + + // Hide our GUI object + GUIObject = getGUIObjectByName(objectName); + GUIObject.hidden = true; + +} + +function GUIObjectUnhide(objectName) { + + // Unhide our GUI object + GUIObject = getGUIObjectByName(objectName); + GUIObject.hidden = false; + +} + +function GUIObjectToggle(objectName) { + + // Get our GUI object + GUIObject = getGUIObjectByName(objectName); + + // Toggle it + GUIObject.hidden = !GUIObject.hidden; + +} + +function GUIUpdateObjectInfo() { + + // Get GUI Objects needed + ObjectNameText = getGUIObjectByName("selection_name_test"); + ObjectPositionText = getGUIObjectByName("selection_pos_test"); + ObjectSpeedText = getGUIObjectByName("selection_speed_test"); + + // Check number of selected entities + if (selection.length > 1) { + + var MultipleEntitiesSelected = true; + ObjectNameText.caption = "Selected " + selection.length + " entities."; + ObjectNameText.hidden = false; + ObjectPositionText.hidden = true; + ObjectSpeedText.hidden = true; + + } else { + + if (!selection[0]) { + + // Reset object name + ObjectNameText.caption = ""; + ObjectNameText.hidden = true; + + // Reset position + ObjectPositionText.caption = ""; + ObjectPositionText.hidden = true; + + // Reset Speed + ObjectSpeedText.caption = ""; + ObjectSpeedText.hidden = true; + + } else { + + // Update object name + ObjectNameText.caption = selection[0].name; + ObjectNameText.hidden = false; + + // Update position + var strString = "" + selection[0].position; + ObjectPositionText.caption = "Position: " + strString.substring(20,strString.length-3); + //ObjectPositionText.caption = strString; + ObjectPositionText.hidden = false; + + // Update speed + ObjectSpeedText.caption = "Speed: " + selection[0].speed; + ObjectSpeedText.hidden = false; + } + + } + +} diff --git a/binaries/data/mods/official/gui/test/hello.xml b/binaries/data/mods/official/gui/test/hello.xml index 9654ba7bde..4beaf8cb4c 100755 --- a/binaries/data/mods/official/gui/test/hello.xml +++ b/binaries/data/mods/official/gui/test/hello.xml @@ -4,15 +4,20 @@ - -