diff --git a/game.project b/game.project index b0ff767..a601fee 100644 --- a/game.project +++ b/game.project @@ -18,7 +18,7 @@ high_dpi = 1 shared_state = 1 [html5] -scale_mode = fit +scale_mode = downscale_fit htmlfile = /builtins/manifests/web/engine_template.html splash_image = /assets/kubeinvaderslogo.png show_made_with_defold = 0 diff --git a/js-web/KubeInvaders/archive/archive_files.json b/js-web/KubeInvaders/archive/archive_files.json index 5e1cc27..2f8658e 100644 --- a/js-web/KubeInvaders/archive/archive_files.json +++ b/js-web/KubeInvaders/archive/archive_files.json @@ -1 +1 @@ -{"content":[{"name":"game.projectc","size":3188,"pieces":[{"name":"game.projectc0","offset":0}]},{"name":"game.arci","size":7408,"pieces":[{"name":"game.arci0","offset":0}]},{"name":"game.arcd","size":379711,"pieces":[{"name":"game.arcd0","offset":0}]},{"name":"game.dmanifest","size":13430,"pieces":[{"name":"game.dmanifest0","offset":0}]},{"name":"game.public.der","size":162,"pieces":[{"name":"game.public.der0","offset":0}]}]} \ No newline at end of file +{"content":[{"name":"game.projectc","size":3198,"pieces":[{"name":"game.projectc0","offset":0}]},{"name":"game.arci","size":7408,"pieces":[{"name":"game.arci0","offset":0}]},{"name":"game.arcd","size":379707,"pieces":[{"name":"game.arcd0","offset":0}]},{"name":"game.dmanifest","size":13430,"pieces":[{"name":"game.dmanifest0","offset":0}]},{"name":"game.public.der","size":162,"pieces":[{"name":"game.public.der0","offset":0}]}]} \ No newline at end of file diff --git a/js-web/KubeInvaders/archive/game.arcd0 b/js-web/KubeInvaders/archive/game.arcd0 index 73b0530..6d71590 100644 Binary files a/js-web/KubeInvaders/archive/game.arcd0 and b/js-web/KubeInvaders/archive/game.arcd0 differ diff --git a/js-web/KubeInvaders/archive/game.arci0 b/js-web/KubeInvaders/archive/game.arci0 index d45fa1b..bb91332 100644 Binary files a/js-web/KubeInvaders/archive/game.arci0 and b/js-web/KubeInvaders/archive/game.arci0 differ diff --git a/js-web/KubeInvaders/archive/game.dmanifest0 b/js-web/KubeInvaders/archive/game.dmanifest0 index 3577619..576b8bc 100644 Binary files a/js-web/KubeInvaders/archive/game.dmanifest0 and b/js-web/KubeInvaders/archive/game.dmanifest0 differ diff --git a/js-web/KubeInvaders/archive/game.projectc0 b/js-web/KubeInvaders/archive/game.projectc0 index e65b205..34aabeb 100644 --- a/js-web/KubeInvaders/archive/game.projectc0 +++ b/js-web/KubeInvaders/archive/game.projectc0 @@ -146,7 +146,7 @@ cssfile = /builtins/manifests/web/light_theme.css archive_location_prefix = archive show_fullscreen_button = 1 show_made_with_defold = 0 -scale_mode = fit +scale_mode = downscale_fit splash_image = /assets/kubeinvaderslogo.png [particle_fx] diff --git a/js-web/KubeInvaders/archive/game.public.der0 b/js-web/KubeInvaders/archive/game.public.der0 index b0a4532..8d2be95 100644 Binary files a/js-web/KubeInvaders/archive/game.public.der0 and b/js-web/KubeInvaders/archive/game.public.der0 differ diff --git a/js-web/KubeInvaders/index.html b/js-web/KubeInvaders/index.html index 5549f94..74f6beb 100644 --- a/js-web/KubeInvaders/index.html +++ b/js-web/KubeInvaders/index.html @@ -189,23 +189,29 @@ var targetRatio = width / height; var actualRatio = innerWidth / innerHeight; - - - //Fit - if (actualRatio > targetRatio) { - width = innerHeight * targetRatio; - height = innerHeight; - app_container.style.marginLeft = ((innerWidth - width) / 2) + "px"; - app_container.style.marginTop = "0px"; + //Downscale fit + if (innerWidth < width || innerHeight < height) { + if (actualRatio > targetRatio) { + width = innerHeight * targetRatio; + height = innerHeight; + app_container.style.marginLeft = ((innerWidth - width) / 2) + "px"; + app_container.style.marginTop = "0px"; + } + else { + width = innerWidth; + height = innerWidth / targetRatio; + app_container.style.marginLeft = "0px"; + app_container.style.marginTop = ((innerHeight - height) / 2) + "px"; + } } else { - width = innerWidth; - height = innerWidth / targetRatio; - app_container.style.marginLeft = "0px"; + app_container.style.marginLeft = ((innerWidth - width) / 2) + "px"; app_container.style.marginTop = ((innerHeight - height) / 2) + "px"; } + + app_container.style.width = width + "px"; app_container.style.height = height + buttonHeight + "px"; game_canvas.width = width; diff --git a/main/mymodules/node.lua b/main/mymodules/node.lua index 74155e1..5aef93a 100644 --- a/main/mymodules/node.lua +++ b/main/mymodules/node.lua @@ -26,7 +26,7 @@ function M.get_nodes() worker_diff_time = current_time - latest_kubernetes_nodes_request_show - if worker_diff_time > 0.05 then + if worker_diff_time > 0.1 then kubernetes_nodes_size = table.getn(kubernetes_nodes) if kubernetes_nodes_size == 0 and not kubernetes_nodes_request_show then print("Show kubernetes nodes...") diff --git a/nginx/metrics.lua-script b/nginx/metrics.lua-script index 02f9f5e..3e574d9 100644 --- a/nginx/metrics.lua-script +++ b/nginx/metrics.lua-script @@ -1,10 +1,10 @@ local redis = require "resty.redis" -local red = redis:new() -local okredis, errredis = red:connect(os.getenv("REDIS_HOST"), 6379) local arg = ngx.req.get_uri_args() local incr = 0 if okredis then if ngx.var.request_method == "DELETE" then + local red = redis:new() + local okredis, errredis = red:connect(os.getenv("REDIS_HOST"), 6379) ngx.log(ngx.ERR, "Connection to Redis is ok") -- Count the total of deleted pods @@ -32,6 +32,8 @@ if okredis then elseif ngx.var.request_method == "GET" and string.match(ngx.var.request_uri, "^.*/chaos[-]node.*$") then + local red = redis:new() + local okredis, errredis = red:connect(os.getenv("REDIS_HOST"), 6379) ngx.log(ngx.ERR, "Chaos node action has been detected") -- Count the total of chaos jobs launched against nodes