2021-07-25 20:10:06 +02:00
|
|
|
|
2021-08-12 21:26:31 +02:00
|
|
|
local VolforceWindow = require('components.volforceWindow')
|
2022-04-27 02:03:42 +02:00
|
|
|
local Dimensions = require 'common.dimensions';
|
|
|
|
|
|
|
|
do
|
|
|
|
local resx, resy = game.GetResolution();
|
|
|
|
Dimensions.updateResolution(resx / resy);
|
|
|
|
end
|
2021-08-12 21:26:31 +02:00
|
|
|
|
2021-08-31 19:52:02 +02:00
|
|
|
local Banner = require('gameplay.banner')
|
2021-08-31 18:24:48 +02:00
|
|
|
local CritLine = require('gameplay.crit_line')
|
|
|
|
local Console = require('gameplay.console')
|
2021-10-09 22:09:25 +02:00
|
|
|
local UserPanel = require('gameplay.user_panel')
|
2021-10-12 19:56:18 +02:00
|
|
|
local SongPanel = require('gameplay.song_panel')
|
2021-10-09 23:37:33 +02:00
|
|
|
local ScorePanel = require('gameplay.score_panel')
|
2021-08-31 19:52:02 +02:00
|
|
|
local Gauge = require('gameplay.gauge')
|
2021-09-05 11:50:30 +02:00
|
|
|
local Chain = require('gameplay.chain')
|
2021-10-01 21:32:20 +02:00
|
|
|
local LaserAlert = require('gameplay.laser_alert')
|
2021-07-25 20:10:06 +02:00
|
|
|
|
2022-04-27 00:12:14 +02:00
|
|
|
local HitFX = require 'gameplay.hitfx'
|
|
|
|
|
2021-10-28 12:17:20 +02:00
|
|
|
local TrackEnd = require('gameplay.track_end')
|
|
|
|
|
2022-03-04 04:06:19 +01:00
|
|
|
local json = require("common.json")
|
2021-11-27 20:56:39 +01:00
|
|
|
|
2022-04-27 00:12:14 +02:00
|
|
|
local showHitAnims = true;
|
|
|
|
|
2021-11-27 20:56:39 +01:00
|
|
|
local users = nil
|
|
|
|
|
2021-10-09 23:37:33 +02:00
|
|
|
local maxChain = 0;
|
2021-09-05 11:50:30 +02:00
|
|
|
local chain = 0;
|
2021-10-09 23:37:33 +02:00
|
|
|
local score = 0;
|
2021-09-05 11:50:30 +02:00
|
|
|
|
2021-08-31 18:24:48 +02:00
|
|
|
function render(deltaTime)
|
2021-12-02 03:41:12 +01:00
|
|
|
local resx, resy = game.GetResolution();
|
2022-04-27 02:03:42 +02:00
|
|
|
Dimensions.updateResolution(resx / resy);
|
2021-08-31 19:52:02 +02:00
|
|
|
|
2021-11-27 21:49:32 +01:00
|
|
|
Banner.render(deltaTime, users, gameplay.user_id);
|
2021-10-09 22:09:25 +02:00
|
|
|
|
2021-10-28 18:28:49 +02:00
|
|
|
UserPanel.render(deltaTime, score, gameplay.scoreReplays[1]);
|
2021-10-28 17:21:25 +02:00
|
|
|
SongPanel.render(deltaTime,
|
|
|
|
gameplay.bpm,
|
|
|
|
gameplay.hispeed,
|
|
|
|
gameplay.jacketPath,
|
|
|
|
gameplay.difficulty,
|
|
|
|
gameplay.level,
|
2021-10-28 17:40:15 +02:00
|
|
|
gameplay.progress,
|
|
|
|
gameplay.title,
|
|
|
|
gameplay.artist
|
2021-10-28 17:21:25 +02:00
|
|
|
);
|
2021-10-09 23:37:33 +02:00
|
|
|
ScorePanel.render(deltaTime, score, maxChain)
|
2021-10-09 22:09:25 +02:00
|
|
|
|
2021-08-31 19:52:02 +02:00
|
|
|
Gauge.render(
|
|
|
|
deltaTime,
|
|
|
|
gameplay.gauge.type,
|
|
|
|
gameplay.gauge.value,
|
|
|
|
(game.GetSkinSetting('_gaugeARS') == 1)
|
|
|
|
);
|
2021-09-05 15:22:48 +02:00
|
|
|
Chain.render(deltaTime, gameplay.comboState, chain, gameplay.critLine.x, gameplay.critLine.y);
|
2021-10-01 21:32:20 +02:00
|
|
|
|
|
|
|
LaserAlert.render(deltaTime);
|
2021-08-30 18:51:47 +02:00
|
|
|
end
|
|
|
|
|
2021-08-31 18:24:48 +02:00
|
|
|
function render_crit_base(deltaTime)
|
2021-11-21 16:56:23 +01:00
|
|
|
CritLine.renderBase(deltaTime, gameplay.critLine.x, gameplay.critLine.y, -gameplay.critLine.rotation, gameplay.critLine.cursors);
|
2022-04-27 00:12:14 +02:00
|
|
|
HitFX.render(deltaTime, gameplay.critLine.x, gameplay.critLine.y, -gameplay.critLine.rotation, gameplay.critLine.cursors);
|
2021-08-31 18:24:48 +02:00
|
|
|
Console.render(deltaTime, gameplay.critLine.x, gameplay.critLine.y, -gameplay.critLine.rotation);
|
2021-07-25 20:10:06 +02:00
|
|
|
end
|
2021-08-30 18:51:47 +02:00
|
|
|
|
2021-08-31 18:24:48 +02:00
|
|
|
function render_crit_overlay(deltaTime)
|
2021-07-25 20:10:06 +02:00
|
|
|
end
|
2021-07-26 16:22:00 +02:00
|
|
|
|
2021-08-31 18:24:48 +02:00
|
|
|
function render_intro(deltaTime)
|
|
|
|
return true
|
2021-08-30 18:22:21 +02:00
|
|
|
end
|
2021-07-25 20:10:06 +02:00
|
|
|
|
2021-10-28 12:17:20 +02:00
|
|
|
local outroTimer = 0;
|
2021-08-31 18:24:48 +02:00
|
|
|
function render_outro(deltaTime, clearState)
|
2021-10-28 17:21:25 +02:00
|
|
|
if (clearState == 0) then
|
|
|
|
return true, 0; -- Exit right away if user manually exited gameplay
|
|
|
|
end
|
|
|
|
|
2021-12-11 19:18:36 +01:00
|
|
|
TrackEnd.render(deltaTime, clearState);
|
2021-10-28 15:17:54 +02:00
|
|
|
|
2021-10-28 12:17:20 +02:00
|
|
|
outroTimer = outroTimer + deltaTime
|
2021-10-28 15:17:54 +02:00
|
|
|
return outroTimer > 4, 1 - outroTimer
|
2021-08-30 18:51:47 +02:00
|
|
|
end
|
|
|
|
|
2021-08-31 18:24:48 +02:00
|
|
|
function update_score(newScore)
|
2021-10-09 23:37:33 +02:00
|
|
|
score = newScore
|
2022-03-25 23:21:02 +01:00
|
|
|
if (score == 0) then
|
|
|
|
maxChain = 0;
|
|
|
|
end
|
2021-08-30 18:51:47 +02:00
|
|
|
end
|
|
|
|
|
2021-08-31 18:24:48 +02:00
|
|
|
function update_combo(newCombo)
|
2021-09-05 11:50:30 +02:00
|
|
|
chain = newCombo
|
2021-10-28 17:49:02 +02:00
|
|
|
Chain.onNewCombo();
|
2021-10-09 23:37:33 +02:00
|
|
|
if (chain > maxChain) then
|
|
|
|
maxChain = chain;
|
|
|
|
end
|
2021-08-30 18:51:47 +02:00
|
|
|
end
|
|
|
|
|
2021-08-31 18:24:48 +02:00
|
|
|
function near_hit(wasLate)
|
2021-08-30 18:51:47 +02:00
|
|
|
|
2021-08-30 18:22:21 +02:00
|
|
|
end
|
2021-08-30 18:51:47 +02:00
|
|
|
|
2021-08-31 18:24:48 +02:00
|
|
|
function button_hit(button, rating, delta)
|
2022-04-27 00:12:14 +02:00
|
|
|
if (showHitAnims) then
|
|
|
|
HitFX.TriggerAnimation("Crit", button + 1)
|
|
|
|
end
|
2021-08-31 18:24:48 +02:00
|
|
|
end
|
2021-08-30 18:51:47 +02:00
|
|
|
|
2021-08-31 18:24:48 +02:00
|
|
|
function laser_slam_hit(slamLength, startPos, endPost, index)
|
2022-04-27 00:12:14 +02:00
|
|
|
if (showHitAnims) then
|
|
|
|
end
|
2021-08-31 18:24:48 +02:00
|
|
|
end
|
2021-08-30 18:51:47 +02:00
|
|
|
|
2021-08-31 18:24:48 +02:00
|
|
|
function laser_alert(isRight)
|
2021-10-02 00:17:24 +02:00
|
|
|
LaserAlert.show(isRight)
|
2021-07-25 20:10:06 +02:00
|
|
|
end
|
|
|
|
|
2021-08-31 18:24:48 +02:00
|
|
|
function practice_start(mission_type, mission_threshold, mission_description)
|
2021-07-25 20:10:06 +02:00
|
|
|
|
|
|
|
end
|
|
|
|
|
2021-08-31 18:24:48 +02:00
|
|
|
function practice_end_run(playCount, successCount, isSuccessful, scoring)
|
2021-07-25 20:10:06 +02:00
|
|
|
|
|
|
|
end
|
2021-08-12 21:26:31 +02:00
|
|
|
|
2021-08-31 18:24:48 +02:00
|
|
|
function practice_end(playCount, successCount)
|
2021-07-25 20:10:06 +02:00
|
|
|
|
|
|
|
end
|
|
|
|
|
2021-11-27 20:56:39 +01:00
|
|
|
|
|
|
|
function init_tcp()
|
|
|
|
Tcp.SetTopicHandler("game.scoreboard", function(data)
|
|
|
|
users = {}
|
|
|
|
for i, u in ipairs(data.users) do
|
|
|
|
table.insert(users, u)
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Update the users in the scoreboard
|
|
|
|
function score_callback(response)
|
2022-04-27 00:12:14 +02:00
|
|
|
if response.status ~= 200 then
|
|
|
|
error()
|
|
|
|
return
|
2021-11-27 20:56:39 +01:00
|
|
|
end
|
|
|
|
local jsondata = json.decode(response.text)
|
|
|
|
users = {}
|
|
|
|
for i, u in ipairs(jsondata.users) do
|
|
|
|
table.insert(users, u)
|
|
|
|
end
|
|
|
|
end
|