From 73e59c8de1887480725f904b27d98145bc4e4d87 Mon Sep 17 00:00:00 2001 From: Federico Cecchetto Date: Wed, 9 Feb 2022 22:35:23 +0100 Subject: [PATCH] Remove this --- src/client/resource.hpp | 1 - src/client/resource.rc | 2 - src/client/resources/animation.lua | 92 ------------------------------ 3 files changed, 95 deletions(-) delete mode 100644 src/client/resources/animation.lua diff --git a/src/client/resource.hpp b/src/client/resource.hpp index 2005d4f1..a2a1233e 100644 --- a/src/client/resource.hpp +++ b/src/client/resource.hpp @@ -21,6 +21,5 @@ #define ICON_IMAGE 313 -#define LUA_ANIMATION_SCRIPT 314 #define LUA_JSON_SCRIPT 315 #define LUI_UPDATER_MENU 316 diff --git a/src/client/resource.rc b/src/client/resource.rc index 65467a1d..6f31a48e 100644 --- a/src/client/resource.rc +++ b/src/client/resource.rc @@ -97,9 +97,7 @@ ID_ICON ICON "resources/icon.ico" MENU_MAIN RCDATA "resources/main.html" -LUA_ANIMATION_SCRIPT RCDATA "resources/animation.lua" LUA_JSON_SCRIPT RCDATA "resources/json.lua" - LUI_UPDATER_MENU RCDATA "resources/updater.lua" #ifdef _DEBUG diff --git a/src/client/resources/animation.lua b/src/client/resources/animation.lua deleted file mode 100644 index 0294c264..00000000 --- a/src/client/resources/animation.lua +++ /dev/null @@ -1,92 +0,0 @@ -function element:animate(name, state, animationtime) - local start = { - x = self.x, - y = self.y, - w = self.w, - h = self.h, - color = self.color, - backcolor = self.backcolor, - bordercolor = self.bordercolor, - borderwidth = self.borderwidth, - fontsize = self.fontsize - } - - local _end = {} - for k, v in pairs(start) do - _end[k] = state[k] or v - end - - local diffs = {} - for k, v in pairs(_end) do - if (type(v) == "table") then - local value = {} - local different = false - - for _k, _v in pairs(v) do - value[_k] = _v - start[k][_k] - if (value[_k] ~= 0) then - different = true - end - end - - if (different) then - diffs[k] = value - end - else - local value = v - start[k] - if (value ~= 0) then - diffs[k] = v - start[k] - end - end - end - - local timeout = nil - local interval = nil - local starttime = game:time() - - interval = game:onframe(function() - local time = game:time() - local percentage = (time - starttime) / animationtime - - if (percentage >= 1) then - for k, v in pairs(diffs) do - self[k] = _end[k] - end - else - for k, v in pairs(diffs) do - if (type(v) == "table") then - local value = {} - - for _k, _v in pairs(v) do - value[_k] = start[k][_k] + _v * percentage - end - - self[k] = value - else - self[k] = start[k] + v * percentage - end - end - end - end) - - timeout = game:ontimeout(function() - interval:clear() - for k, v in pairs(diffs) do - self[k] = _end[k] - end - end, animationtime) - - self:onnotifyonce("cancel_animation", function(_name) - if (name == _name) then - timeout:clear() - interval:clear() - end - end) -end - -function element:cancelanimations(name, callback) - self:notify("cancel_animation", name) - if (type(callback) == "function") then - game:ontimeout(callback, 0) - end -end \ No newline at end of file