Merge branch 'master' of github.com:FajsiEx/exceed

This commit is contained in:
Hersi 2021-11-20 22:56:36 +01:00
commit d13fa08842
8 changed files with 39 additions and 2 deletions

BIN
audio/sort_wheel/enter.wav Normal file

Binary file not shown.

BIN
audio/sort_wheel/leave.wav Normal file

Binary file not shown.

13
scripts/common/common.lua Normal file
View File

@ -0,0 +1,13 @@
local stopMusic = function ()
local musicPlaying = game.GetSkinSetting('_musicPlaying');
if musicPlaying and musicPlaying ~= '' then
game.StopSample(musicPlaying);
game.SetSkinSetting("_musicPlaying", "")
end
end
return {
stopMusic = stopMusic
}

View File

@ -1,5 +1,7 @@
json = require "json" json = require "json"
local common = require('common.common');
local resX,resY = game.GetResolution() local resX,resY = game.GetResolution()
local mposx = 0; local mposx = 0;
@ -742,6 +744,7 @@ render = function(deltaTime)
mposx,mposy = game.GetMousePos(); mposx,mposy = game.GetMousePos();
portrait = resY > resX portrait = resY > resX
common.stopMusic();
doffset = doffset * 0.9 doffset = doffset * 0.9
ioffset = ioffset * 0.9 ioffset = ioffset * 0.9

View File

@ -169,9 +169,8 @@ local handleSfx = function()
if not bgSfxPlayed then if not bgSfxPlayed then
game.PlaySample("result", true) game.PlaySample("result", true)
bgSfxPlayed = true bgSfxPlayed = true
game.SetSkinSetting('_musicPlaying', 'result');
end end
if game.GetButton(game.BUTTON_STA) then game.StopSample("result") end
if game.GetButton(game.BUTTON_BCK) then game.StopSample("result") end
end end
function drawTimingBar(y, value, max, type) function drawTimingBar(y, value, max, type)

View File

@ -1,6 +1,7 @@
require('common') require('common')
local Easing = require('common.easings') local Easing = require('common.easings')
local Background = require('components.background'); local Background = require('components.background');
local common = require('common.common')
local VolforceCalc = require('components.volforceCalc'); local VolforceCalc = require('components.volforceCalc');
@ -749,6 +750,8 @@ render = function (deltaTime)
tickTransitions(deltaTime); tickTransitions(deltaTime);
gfx.Scale(scale, scale); gfx.Scale(scale, scale);
common.stopMusic();
if not difficultyNumbers then if not difficultyNumbers then
difficultyNumbers = load_number_image('diff_num') difficultyNumbers = load_number_image('diff_num')
end end

View File

@ -1,6 +1,10 @@
require('common') require('common')
local Easing = require('common.easings'); local Easing = require('common.easings');
-- AUDIO
game.LoadSkinSample('sort_wheel/enter.wav');
game.LoadSkinSample('sort_wheel/leave.wav');
-- IMAGES -- IMAGES
local panelBgImage = gfx.CreateSkinImage('song_select/sort_wheel/bg.png', 0) local panelBgImage = gfx.CreateSkinImage('song_select/sort_wheel/bg.png', 0)
local activeItemBgImage = gfx.CreateSkinImage( local activeItemBgImage = gfx.CreateSkinImage(
@ -42,6 +46,8 @@ local transitionEnterReverse = false;
local transitionEnterScale = 0; local transitionEnterScale = 0;
local transitionEnterOffsetX = 0; local transitionEnterOffsetX = 0;
local previousActiveState = false;
function resetLayoutInformation() function resetLayoutInformation()
resx, resy = game.GetResolution() resx, resy = game.GetResolution()
scale = resx / desw scale = resx / desw
@ -185,6 +191,16 @@ function render(deltaTime, shown)
resetLayoutInformation() resetLayoutInformation()
gfx.Scale(scale, scale) gfx.Scale(scale, scale)
if (shown ~= previousActiveState) then
if (shown) then
game.PlaySample('sort_wheel/enter.wav');
else
game.PlaySample('sort_wheel/leave.wav');
end
previousActiveState = shown;
end
if not shown then if not shown then
transitionEnterReverse = true transitionEnterReverse = true
if (transitionEnterScale > 0) then drawSortWheel(deltaTime) end if (transitionEnterScale > 0) then drawSortWheel(deltaTime) end

View File

@ -32,6 +32,7 @@ function render(deltaTime)
game.PlaySample('transition_screen/transition_enter.wav'); game.PlaySample('transition_screen/transition_enter.wav');
wasEnterSfxPlayed = true; wasEnterSfxPlayed = true;
end end
gfx.BeginPath();
gfx.ImageRect(0, 0, resx, resy, transitionEnterAnimation, 1, 0); gfx.ImageRect(0, 0, resx, resy, transitionEnterAnimation, 1, 0);
gfx.GlobalAlpha(1); gfx.GlobalAlpha(1);
@ -48,6 +49,7 @@ function render_out(deltaTime)
local leaveAnimeTickRes = gfx.TickAnimation(transitionLeaveAnimation, deltaTime); local leaveAnimeTickRes = gfx.TickAnimation(transitionLeaveAnimation, deltaTime);
if leaveAnimeTickRes == 0 then if leaveAnimeTickRes == 0 then
gfx.BeginPath();
gfx.ImageRect(0, 0, resx, resy, transitionEnterAnimation, 1, 0); gfx.ImageRect(0, 0, resx, resy, transitionEnterAnimation, 1, 0);
else else
if not wasLeaveSfxPlayed then if not wasLeaveSfxPlayed then
@ -55,6 +57,7 @@ function render_out(deltaTime)
wasLeaveSfxPlayed = true; wasLeaveSfxPlayed = true;
end end
gfx.BeginPath();
gfx.ImageRect(0, 0, resx, resy, transitionLeaveAnimation, 1, 0); gfx.ImageRect(0, 0, resx, resy, transitionLeaveAnimation, 1, 0);
outTimer = outTimer + (1/60) / 0.5 outTimer = outTimer + (1/60) / 0.5
end end