1
0
mirror of synced 2025-01-18 09:04:47 +01:00

Luaで背景をカスタマイズ可能に (#238)

* Luaで背景をカスタマイズ可能に

* 不具合の修正

* dllファイルなどの移動
This commit is contained in:
Takkkom 2022-06-07 07:45:20 +09:00 committed by GitHub
parent 8cc66cb54f
commit f4adbf41b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 737 additions and 45 deletions

View File

@ -13,6 +13,11 @@ namespace FDK
get;
private set;
}
public double DeltaTime
{
get;
private set;
}
public bool bFPSの値が変化した
{
get;
@ -25,6 +30,7 @@ namespace FDK
public CFPS()
{
this.n現在のFPS = 0;
this.DeltaTime = 0;
this.timer = new CTimer( CTimer.E種別.MultiMedia );
this.ms = this.timer.n現在時刻;
this.FPS = 0;
@ -40,7 +46,9 @@ namespace FDK
this.bFPSの値が変化した = false;
const long INTERVAL = 1000;
while( ( this.timer.n現在時刻 - this.ms ) >= INTERVAL )
this.DeltaTime = (this.timer.n現在時刻 - this.PrevFrameTime) / 1000.0;
PrevFrameTime = this.timer.n現在時刻;
while ( ( this.timer.n現在時刻 - this.ms ) >= INTERVAL )
{
this.n現在のFPS = this.FPS;
this.FPS = 0;
@ -56,7 +64,8 @@ namespace FDK
#region [ private ]
//-----------------
private CTimer timer;
private long ms;
private long ms;
private long PrevFrameTime;
private int FPS;
//-----------------
#endregion

View File

@ -1544,6 +1544,7 @@ namespace TJAPlayer3
if ((int)actGauge.db現在のゲージ値[nPlayer] < 80 && this.bIsAlreadyCleared[nPlayer] == true)
{
this.bIsAlreadyCleared[nPlayer] = false;
TJAPlayer3.stage演奏ドラム画面.actBackground.ClearOut(nPlayer);
//CDTXMania.stage演奏ドラム画面.actBackground.ClearIn(nPlayer);
}
cInvisibleChip.ShowChipTemporally( pChip.e楽器パート );

View File

@ -72,7 +72,7 @@ namespace TJAPlayer3
public void tFadeIn(int player)
{
this.ct上背景クリアインタイマー[player] = new CCounter(0, 100, 2, TJAPlayer3.Timer);
//this.ct上背景クリアインタイマー[player] = new CCounter(0, 100, 2, TJAPlayer3.Timer);
this.eFadeMode = EFIFOモード.;
}
@ -84,10 +84,18 @@ namespace TJAPlayer3
public void ClearIn(int player)
{
this.ct上背景クリアインタイマー[player] = new CCounter(0, 100, 2, TJAPlayer3.Timer);
/*this.ct上背景クリアインタイマー[player] = new CCounter(0, 100, 2, TJAPlayer3.Timer);
this.ct上背景クリアインタイマー[player].n現在の値 = 0;
this.ct上背景FIFOタイマー = new CCounter(0, 100, 2, TJAPlayer3.Timer);
this.ct上背景FIFOタイマー.n現在の値 = 0;
this.ct上背景FIFOタイマー.n現在の値 = 0;*/
UpScript?.ClearIn(player);
DownScript?.ClearIn(player);
}
public void ClearOut(int player)
{
UpScript?.ClearOut(player);
DownScript?.ClearOut(player);
}
public override void On活性化()
@ -116,7 +124,10 @@ namespace TJAPlayer3
var upDirs = System.IO.Directory.GetDirectories($@"{bgOrigindir}\Up");
var upPath = upDirs[random.Next(0, upDirs.Length)];
Background_Up_1st = new CTexture[3];
UpScript = new ScriptBG($@"{upPath}\Script.lua");
UpScript.Init();
/*Background_Up_1st = new CTexture[3];
Background_Up_1st[0] = TJAPlayer3.tテクスチャの生成($@"{upPath}\1P_Up_1st.png");
Background_Up_1st[1] = TJAPlayer3.tテクスチャの生成($@"{upPath}\2P_Up_1st.png");
Background_Up_1st[2] = TJAPlayer3.tテクスチャの生成($@"{upPath}\Clear_Up_1st.png");
@ -134,7 +145,7 @@ namespace TJAPlayer3
for (int i = 0; i < Background_Up_Dan.Length; i++)
Background_Up_Dan[i] = TJAPlayer3.tテクスチャの生成($@"{upPath}\{i}.png");
for (int i = 0; i < Background_Up_Tower.Length; i++)
Background_Up_Tower[i] = TJAPlayer3.tテクスチャの生成($@"{upPath}\{i}.png");
Background_Up_Tower[i] = TJAPlayer3.tテクスチャの生成($@"{upPath}\{i}.png");*/
IsUpNotFound = false;
}
@ -148,11 +159,14 @@ namespace TJAPlayer3
var downDirs = System.IO.Directory.GetDirectories($@"{bgOrigindir}\Down");
var downPath = downDirs[random.Next(0, downDirs.Length)];
Background = TJAPlayer3.tテクスチャの生成($@"{bgOrigindir}Background.png");
DownScript = new ScriptBG($@"{downPath}\Script.lua");
DownScript.Init();
/*Background = TJAPlayer3.tテクスチャの生成($@"{bgOrigindir}Background.png");
Background_Down = TJAPlayer3.tテクスチャの生成($@"{downPath}\Down.png");
Background_Down_Clear = TJAPlayer3.tテクスチャの生成($@"{downPath}\Down_Clear.png");
Background_Down_Scroll = TJAPlayer3.tテクスチャの生成($@"{downPath}\Down_Scroll.png");
Background_Down_Scroll = TJAPlayer3.tテクスチャの生成($@"{downPath}\Down_Scroll.png");*/
IsDownNotFound = false;
}
@ -184,7 +198,9 @@ namespace TJAPlayer3
if (this.b活性化してない)
return;
TJAPlayer3.t安全にDisposeする(ref Background);
TJAPlayer3.t安全にDisposeする(ref UpScript);
TJAPlayer3.t安全にDisposeする(ref DownScript);
/*TJAPlayer3.t安全にDisposeする(ref Background);
TJAPlayer3.t安全にDisposeする(ref Background_Up_1st);
TJAPlayer3.t安全にDisposeする(ref Background_Up_2nd);
@ -197,19 +213,19 @@ namespace TJAPlayer3
for (int i = 0; i < Background_Up_Dan.Length; i++)
TJAPlayer3.t安全にDisposeする(ref Background_Up_Dan[i]);
for (int i = 0; i < Background_Up_Tower.Length; i++)
TJAPlayer3.t安全にDisposeする(ref Background_Up_Tower[i]);
TJAPlayer3.t安全にDisposeする(ref Background_Up_Tower[i]);*/
TJAPlayer3.t安全にDisposeする(ref pfTowerText);
TJAPlayer3.t安全にDisposeする(ref this.ct上背景FIFOタイマー);
/*TJAPlayer3.t安全にDisposeする(ref this.ct上背景FIFOタイマー);
for (int i = 0; i < 2; i++)
{
ct上背景スクロール用タイマー1st[i] = null;
ct上背景スクロール用タイマー2nd[i] = null;
ct上背景スクロール用タイマー3rd[i] = null;
}
TJAPlayer3.t安全にDisposeする(ref this.ct下背景スクロール用タイマー1);
TJAPlayer3.t安全にDisposeする(ref this.ct下背景スクロール用タイマー1);*/
base.On非活性化();
}
@ -217,15 +233,16 @@ namespace TJAPlayer3
{
if (!base.b活性化してない)
{
this.ct上背景スクロール用タイマー1st = new CCounter[2];
/*this.ct上背景スクロール用タイマー1st = new CCounter[2];
this.ct上背景スクロール用タイマー2nd = new CCounter[2];
this.ct上背景スクロール用タイマー3rd = new CCounter[2];
this.ct上背景クリアインタイマー = new CCounter[2];
ct上背景スクロール用タイマー1stDan = new CCounter[4];
ct上背景スクロール用タイマー1stTower = new CCounter[4];
ct上背景スクロール用タイマー1stTower = new CCounter[4];*/
if (!IsUpNotFound)
{
/*
if (TJAPlayer3.stage選曲.n確定された曲の難易度[0] == (int)Difficulty.Dan)
{
this.ct上背景スクロール用タイマー1stDan[0] = new CCounter(0, this.Background_Up_Dan[1].szテクスチャサイズ.Width, 8.453f * 2, TJAPlayer3.Timer);
@ -254,15 +271,15 @@ namespace TJAPlayer3
this.ct上背景クリアインタイマー[i] = new CCounter();
}
}
}
}*/
}
if (!IsDownNotFound)
{
if (this.Background_Down_Scroll != null)
/*if (this.Background_Down_Scroll != null)
this.ct下背景スクロール用タイマー1 = new CCounter(1, this.Background_Down_Scroll.szテクスチャサイズ.Width, 4, TJAPlayer3.Timer);
this.ct上背景FIFOタイマー = new CCounter();
this.ct上背景FIFOタイマー = new CCounter();*/
}
this.ctSlideAnimation = new CCounter();
@ -285,11 +302,11 @@ namespace TJAPlayer3
return 0;
this.ct上背景FIFOタイマー?.t進行();
//this.ct上背景FIFOタイマー?.t進行();
#region [Scroll counters]
for (int i = 0; i < 2; i++)
/*for (int i = 0; i < 2; i++)
{
if (this.ct上背景クリアインタイマー[i] != null)
this.ct上背景クリアインタイマー[i].t進行();
@ -314,20 +331,20 @@ namespace TJAPlayer3
if (this.ct上背景スクロール用タイマー1stDan[i] != null)
this.ct上背景スクロール用タイマー1stDan[i].t進行Loop();
}
for (int i = 0; i < 4; i++)
{
if (this.ct上背景スクロール用タイマー1stTower[i] != null)
this.ct上背景スクロール用タイマー1stTower[i].t進行Loop();
}
if (this.ct下背景スクロール用タイマー1 != null)
this.ct下背景スクロール用タイマー1.t進行Loop();
if (this.ct上背景スクロール用タイマー2stDan != null)
this.ct上背景スクロール用タイマー2stDan.t進行Loop();
for (int i = 0; i < 4; i++)
{
if (this.ct上背景スクロール用タイマー1stTower[i] != null)
this.ct上背景スクロール用タイマー1stTower[i].t進行Loop();
}
if (this.ct上背景スクロール用タイマー2stTower != null)
this.ct上背景スクロール用タイマー2stTower.t進行Loop();
*/
#endregion
#region [Tower specific variables declaration]
@ -342,6 +359,8 @@ namespace TJAPlayer3
if (!IsUpNotFound)
{
UpScript.Update();
UpScript.Draw();
if (TJAPlayer3.stage選曲.n確定された曲の難易度[0] == (int)Difficulty.Tower)
{
#region [Tower animations variables]
@ -357,6 +376,7 @@ namespace TJAPlayer3
#region [Tower HAIKEI]
/*
this.Background_Up_Tower[0]?.t2D描画(TJAPlayer3.app.Device, 0, 0);
if (this.Background_Up_Tower[7] != null)
@ -399,7 +419,7 @@ namespace TJAPlayer3
if (this.Background_Up_Tower[5] != null)
for (int i = 0; i < 1280 / this.Background_Up_Tower[5].szテクスチャサイズ.Width + 2; i++)
this.Background_Up_Tower[5].t2D描画(TJAPlayer3.app.Device, (i * this.Background_Up_Tower[5].szテクスチャサイズ.Width) - ct上背景スクロール用タイマー1stTower[3].n現在の値, 0);
*/
#endregion
@ -497,7 +517,7 @@ namespace TJAPlayer3
// Multiple background handling will be here
#region [ Regular background ]
for (int j = 0; j < TJAPlayer3.ConfigIni.nPlayerCount; j++)
/*for (int j = 0; j < TJAPlayer3.ConfigIni.nPlayerCount; j++)
{
int i = j;
if (TJAPlayer3.P1IsBlue())
@ -648,7 +668,7 @@ namespace TJAPlayer3
#endregion
}
}
}*/
#endregion
@ -660,7 +680,7 @@ namespace TJAPlayer3
// Not 拝啓 but 背景 w, apparently Kanji typos are pretty common, "Dear DanI" lol
#region [ ]
this.Background_Up_Dan[0].t2D描画(TJAPlayer3.app.Device, 0, 0);
/*this.Background_Up_Dan[0].t2D描画(TJAPlayer3.app.Device, 0, 0);
for (int i = 0; i < 1280 / this.Background_Up_Dan[1].szテクスチャサイズ.Width + 2; i++)
this.Background_Up_Dan[1].t2D描画(TJAPlayer3.app.Device, (i * this.Background_Up_Dan[1].szテクスチャサイズ.Width) - ct上背景スクロール用タイマー1stDan[0].n現在の値, 0);
@ -676,7 +696,7 @@ namespace TJAPlayer3
for (int i = 0; i < 1280 / this.Background_Up_Dan[5].szテクスチャサイズ.Width + 2; i++)
this.Background_Up_Dan[5].t2D描画(TJAPlayer3.app.Device, (i * this.Background_Up_Dan[5].szテクスチャサイズ.Width) - ct上背景スクロール用タイマー1stDan[3].n現在の値, 0);
*/
#endregion
}
}
@ -824,8 +844,10 @@ namespace TJAPlayer3
{
if (!IsDownNotFound)
{
DownScript.Update();
DownScript.Draw();
#region [Ensou lower background]
/*
if (this.Background_Down != null)
{
this.Background_Down.t2D描画(TJAPlayer3.app.Device, 0, 360);
@ -854,7 +876,7 @@ namespace TJAPlayer3
}
}
*/
#endregion
}
}
@ -869,7 +891,7 @@ namespace TJAPlayer3
//-----------------
#region
private CTexture Background,
/*private CTexture Background,
Background_Down,
Background_Down_Clear,
Background_Down_Scroll;
@ -877,10 +899,10 @@ namespace TJAPlayer3
Background_Up_2nd,
Background_Up_3rd,
Background_Up_Dan = new CTexture[6],
Background_Up_Tower = new CTexture[8];
Background_Up_Tower = new CTexture[8];*/
#endregion
private CCounter[] ct上背景スクロール用タイマー1st; //上背景のX方向スクロール用
/*private CCounter[] ct上背景スクロール用タイマー1st; //上背景のX方向スクロール用
private CCounter[] ct上背景スクロール用タイマー2nd; //上背景のY方向スクロール用
private CCounter[] ct上背景スクロール用タイマー3rd; //上背景のY方向スクロール用
private CCounter ct下背景スクロール用タイマー1; //下背景パーツ1のX方向スクロール用
@ -888,13 +910,19 @@ namespace TJAPlayer3
private CCounter[] ct上背景クリアインタイマー;
private CCounter[] ct上背景スクロール用タイマー1stDan; //上背景のX方向スクロール用
private CCounter ct上背景スクロール用タイマー2stDan; //上背景のY方向スクロール用
private CCounter[] ct上背景スクロール用タイマー1stTower; //上背景のX方向スクロール用
private CCounter ct上背景スクロール用タイマー2stTower; //上背景のX方向スクロール用
*/
//private CTexture tx上背景メイン;
//private CTexture tx上背景クリアメイン;
//private CTexture tx下背景メイン;
//private CTexture tx下背景クリアメイン;
//private CTexture tx下背景クリアサブ1;
private ScriptBG UpScript;
private ScriptBG DownScript;
private TitleTextureKey ttkTouTatsuKaiSuu;
private TitleTextureKey ttkKai;
private CPrivateFastFont pfTowerText;

View File

@ -0,0 +1,201 @@
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NLua;
using FDK;
namespace TJAPlayer3
{
class ScriptBGFunc
{
private Dictionary<string, CTexture> Textures;
private string DirPath;
public ScriptBGFunc(Dictionary<string, CTexture> texs, string dirPath)
{
Textures = texs;
DirPath = dirPath;
}
public void DrawText(double x, double y, string text)
{
TJAPlayer3.act文字コンソール.tPrint((int)x, (int)y, C文字コンソール.Eフォント種別., text);
}
public void DrawNum(double x, double y, double text)
{
TJAPlayer3.act文字コンソール.tPrint((int)x, (int)y, C文字コンソール.Eフォント種別., text.ToString());
}
public void AddGraph(string fileName)
{
Textures.Add(fileName, TJAPlayer3.tテクスチャの生成($@"{DirPath}\{fileName}"));
}
public void DrawGraph(double x, double y, string fileName)
{
Textures[fileName]?.t2D描画(TJAPlayer3.app.Device, (int)x, (int)y);
}
public void DrawGraphCenter(double x, double y, string fileName)
{
Textures[fileName]?.t2D拡大率考慮中央基準描画(TJAPlayer3.app.Device, (int)x, (int)y);
}
public void SetOpacity(double opacity, string fileName)
{
if (Textures[fileName] != null)
Textures[fileName].Opacity = (int)opacity;
}
public void SetScale(double xscale, double yscale, string fileName)
{
if (Textures[fileName] != null)
{
Textures[fileName].vc拡大縮小倍率.X = (float)xscale;
Textures[fileName].vc拡大縮小倍率.Y = (float)yscale;
}
}
public void SetColor(double r, double g, double b, string fileName)
{
if (Textures[fileName] != null)
{
Textures[fileName].color4 = new SharpDX.Color4((float)r, (float)g, (float)b, 1f);
}
}
}
class ScriptBG : IDisposable
{
public Dictionary<string, CTexture> Textures;
private Lua LuaScript;
private LuaFunction LuaUpdateValues;
private LuaFunction LuaClearIn;
private LuaFunction LuaClearOut;
private LuaFunction LuaInit;
private LuaFunction LuaUpdate;
private LuaFunction LuaDraw;
public ScriptBG(string filePath)
{
Textures = new Dictionary<string, CTexture>();
if (!File.Exists(filePath)) return;
LuaScript = new Lua();
LuaScript.State.Encoding = Encoding.UTF8;
LuaScript["func"] = new ScriptBGFunc(Textures, Path.GetDirectoryName(filePath));
LuaScript.DoFile(filePath);
LuaUpdateValues = LuaScript.GetFunction("updateValues");
LuaClearIn = LuaScript.GetFunction("clearIn");
LuaClearOut = LuaScript.GetFunction("clearOut");
LuaInit = LuaScript.GetFunction("init");
LuaUpdate = LuaScript.GetFunction("update");
LuaDraw = LuaScript.GetFunction("draw");
}
public void Dispose()
{
var texs = Textures.ToArray();
for (int i = 0; i < texs.Length; i++)
{
TJAPlayer3.t安全にDisposeする(ref texs[i]);
}
Textures.Clear();
LuaScript?.Dispose();
}
public void ClearIn(int player)
{
if (LuaScript == null) return;
try
{
LuaClearIn.Call(player);
}
catch (Exception ex)
{
LuaScript.Dispose();
LuaScript = null;
}
}
public void ClearOut(int player)
{
if (LuaScript == null) return;
try
{
LuaClearOut.Call(player);
}
catch (Exception ex)
{
LuaScript.Dispose();
LuaScript = null;
}
}
public void Init()
{
if (LuaScript == null) return;
try
{
LuaScript["playerCount"] = TJAPlayer3.ConfigIni.nPlayerCount;
LuaScript["p1IsBlue"] = TJAPlayer3.P1IsBlue();
//LuaScript["isClear"] = new bool[4] { false, false, false, false };
//LuaScript["towerNightOpacity"] = 0;
//LuaScript["towerNightOpacity"] = (double)(255 * currentFloorPositionMax140);
LuaUpdateValues.Call(TJAPlayer3.FPS.DeltaTime, TJAPlayer3.FPS.n現在のFPS, TJAPlayer3.stage演奏ドラム画面.bIsAlreadyCleared, 0);
LuaInit.Call();
}
catch (Exception ex)
{
LuaScript.Dispose();
LuaScript = null;
}
}
public void Update()
{
if (LuaScript == null) return;
try
{
float currentFloorPositionMax140 = 0;
if (TJAPlayer3.stage選曲.r確定された曲.arスコア[5] != null)
{
int maxFloor = TJAPlayer3.stage選曲.r確定された曲.arスコア[5]..nTotalFloor;
int nightTime = Math.Max(140, maxFloor / 2);
currentFloorPositionMax140 = Math.Min(TJAPlayer3.stage演奏ドラム画面.actPlayInfo.NowMeasure[0] / (float)nightTime, 1f);
}
LuaUpdateValues.Call(TJAPlayer3.FPS.DeltaTime, TJAPlayer3.FPS.n現在のFPS, TJAPlayer3.stage演奏ドラム画面.bIsAlreadyCleared, (double)currentFloorPositionMax140);
/*LuaScript.SetObjectToPath("fps", TJAPlayer3.FPS.n現在のFPS);
LuaScript.SetObjectToPath("deltaTime", TJAPlayer3.FPS.DeltaTime);
LuaScript.SetObjectToPath("isClear", TJAPlayer3.stage演奏ドラム画面.bIsAlreadyCleared);
LuaScript.SetObjectToPath("towerNightOpacity", (double)(255 * currentFloorPositionMax140));*/
if (!TJAPlayer3.stage演奏ドラム画面.bPAUSE) LuaUpdate.Call();
}
catch (Exception ex)
{
LuaScript.Dispose();
LuaScript = null;
}
}
public void Draw()
{
if (LuaScript == null) return;
try
{
LuaDraw.Call();
}
catch (Exception ex)
{
LuaScript.Dispose();
LuaScript = null;
}
}
}
}

View File

@ -148,6 +148,7 @@
<Compile Include="I18N\CLang_zh.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Stages\01.StartUp\CPuchichara.cs" />
<Compile Include="Stages\07.Game\Taiko\ScriptBG.cs" />
<Compile Include="Stages\07.Game\Taiko\NotesManager.cs" />
<Compile Include="Stages\XX.Templates\CStageTemplate.cs" />
<EmbeddedResource Include="Properties\Discord.resx">
@ -377,6 +378,9 @@
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.1</Version>
</PackageReference>
<PackageReference Include="NLua">
<Version>1.6.0</Version>
</PackageReference>
<PackageReference Include="ReadJEnc">
<Version>1.3.1.2</Version>
</PackageReference>
@ -437,6 +441,18 @@ move /y "$(TargetDir)DirectShowLib-2005.dll" "$(SolutionDir)Test\dll\"
move /y "$(TargetDir)SlimDX.dll" "$(SolutionDir)Test\dll\"
move /y "$(TargetDir)KeraLua.dll" "$(SolutionDir)Test\dll\"
move /y "$(TargetDir)liblua54.dylib" "$(SolutionDir)Test\dll\"
move /y "$(TargetDir)lua54.dll" "$(SolutionDir)Test\dll\"
move /y "$(TargetDir)NLua.dll" "$(SolutionDir)Test\dll\"
move /y "$(TargetDir)CSharpTest.Net.Collections.*" "$(SolutionDir)Test\dll\"
move /y "$(TargetDir)System.*" "$(SolutionDir)Test\dll\"

6
Test/Licenses/Lua.txt Normal file
View File

@ -0,0 +1,6 @@
Copyright © 19942021 Lua.org, PUC-Rio.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

19
Test/Licenses/NLua.txt Normal file
View File

@ -0,0 +1,19 @@
Copyright (c) 2021 Vinicius Jarina (viniciusjarina@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,77 @@
local fps = 0
local deltaTime = 0
local isClear = { false, false }
local towerNightNum = 0
function updateValues(_deltaTime, _fps, _isClear, _towerNightNum)
deltaTime = _deltaTime
fps = _fps
isClear = _isClear
towerNightNum = _towerNightNum
deltaTime = _deltaTime
end
local bgWidth_1 = 1323
local bgWidth_2 = 1280
local bgWidth_3 = 1280
local bgWidth_4 = 641
local bgWidth_5 = 639
local bgScrollX_1 = 0
local bgScrollX_2 = 0
local bgScrollX_3 = 0
local bgScrollX_4 = 0
local bgScrollX_5 = 0
function clearIn(player)
end
function clearOut(player)
end
function init()
func:AddGraph("0.png");
func:AddGraph("1.png");
func:AddGraph("2.png");
func:AddGraph("3.png");
func:AddGraph("4.png");
func:AddGraph("5.png");
end
function update()
bgScrollX_1 = bgScrollX_1 + (59.1 * deltaTime);
if bgScrollX_1 > bgWidth_1 then
bgScrollX_1 = 0;
end
bgScrollX_2 = bgScrollX_2 + (45.9 * deltaTime);
if bgScrollX_2 > bgWidth_2 then
bgScrollX_2 = 0;
end
bgScrollX_3 = bgScrollX_3 + (43.8 * deltaTime);
if bgScrollX_3 > bgWidth_3 then
bgScrollX_3 = 0;
end
bgScrollX_4 = bgScrollX_4 + (100 * deltaTime);
if bgScrollX_4 > bgWidth_4 + 200 then
bgScrollX_4 = 0;
end
bgScrollX_5 = bgScrollX_5 + (45.9 * deltaTime);
if bgScrollX_5 > bgWidth_5 then
bgScrollX_5 = 0;
end
end
function draw()
func:DrawGraph(0, 0, "0.png");
for i = 0, 4 do
func:DrawGraph((i * bgWidth_1) - bgScrollX_1, 0, "1.png");
func:DrawGraph((i * bgWidth_2) - bgScrollX_2, 0, "2.png");
func:DrawGraph((i * bgWidth_3) - bgScrollX_3, 0, "3.png");
func:DrawGraph((i * bgWidth_4) - bgScrollX_4, -200 + bgScrollX_4, "4.png");
func:DrawGraph((i * bgWidth_5) - bgScrollX_5, 0, "5.png");
end
end

View File

@ -0,0 +1,63 @@
local fps = 0
local deltaTime = 0
local isClear = { false, false }
local towerNightNum = 0
function updateValues(_deltaTime, _fps, _isClear, _towerNightNum)
deltaTime = _deltaTime
fps = _fps
isClear = _isClear
towerNightNum = _towerNightNum
deltaTime = _deltaTime
end
local loopWidth = 1255
local bgClearFade = 0
local bgScrollX = 0
function clearIn(player)
end
function clearOut(player)
end
function init()
func:AddGraph("Down.png");
func:AddGraph("Down_Clear.png");
func:AddGraph("Down_Scroll.png");
end
function update()
if isClear[0] then
bgClearFade = bgClearFade + (2000 * deltaTime);
else
bgClearFade = bgClearFade - (2000 * deltaTime);
end
bgScrollX = bgScrollX + (250 * deltaTime);
if bgClearFade > 255 then
bgClearFade = 255;
end
if bgClearFade < 0 then
bgClearFade = 0;
end
if bgScrollX > loopWidth then
bgScrollX = 0;
end
end
function draw()
func:SetOpacity(bgClearFade, "Down_Clear.png");
func:SetOpacity(bgClearFade, "Down_Scroll.png");
func:DrawGraph(0, 360, "Down.png");
func:DrawGraph(0, 360, "Down_Clear.png");
for i = 0, 2 do
func:DrawGraph(0 + (loopWidth * i) - bgScrollX, 360, "Down_Scroll.png");
end
end

View File

@ -0,0 +1,141 @@
local fps = 0
local deltaTime = 0
local isClear = { false, false }
local towerNightNum = 0
function updateValues(_deltaTime, _fps, _isClear, _towerNightNum)
deltaTime = _deltaTime
fps = _fps
isClear = _isClear
towerNightNum = towerNightNum
deltaTime = _deltaTime
end
local loopWidth = 328
local loopHeight = 154
local bgScrollX = 0
local bgScrollX_3rd = 0
local bgScrollY = 0
local bgScrollY_3rd = 0
local bg3rdAnime = 0
local bgClearFade = { 0, 0 }
function drawUp1st(x, y, player)
for i2 = -2, 1 do
if player == 0 and p1IsBlue == false then
func:DrawGraph(x, y + (loopHeight * i2) + bgScrollY, "1P_Up_1st.png");
func:DrawGraph(x, y + (loopHeight * i2) + bgScrollY, "Clear_Up_1st.png");
else
func:DrawGraph(x, y + (loopHeight * i2) + bgScrollY, "2P_Up_1st.png");
func:DrawGraph(x, y + (loopHeight * i2) + bgScrollY, "Clear_Up_1st.png");
end
end
end
function drawUp2nd(x, y, player)
for i2 = -1, 2 do
if player == 0 and p1IsBlue == false then
func:DrawGraph(x, y + (loopHeight * i2) - bgScrollY, "1P_Up_2nd.png");
func:DrawGraph(x, y + (loopHeight * i2) - bgScrollY, "Clear_Up_2nd.png");
else
func:DrawGraph(x, y + (loopHeight * i2) - bgScrollY, "2P_Up_2nd.png");
func:DrawGraph(x, y + (loopHeight * i2) - bgScrollY, "Clear_Up_2nd.png");
end
end
end
function drawUp3rd(x, y, player)
if player == 0 and p1IsBlue == false then
func:DrawGraph(x - bgScrollX_3rd, y - bgScrollY_3rd, "1P_Up_3rd.png");
func:DrawGraph(x - bgScrollX_3rd, y - bgScrollY_3rd, "Clear_Up_3rd.png");
else
func:DrawGraph(x - bgScrollX_3rd, y - bgScrollY_3rd, "2P_Up_3rd.png");
func:DrawGraph(x - bgScrollX_3rd, y - bgScrollY_3rd, "Clear_Up_3rd.png");
end
end
function clearIn(player)
end
function clearOut(player)
end
function init()
func:AddGraph("1P_Up_1st.png");
func:AddGraph("2P_Up_1st.png");
func:AddGraph("1P_Up_2nd.png");
func:AddGraph("2P_Up_2nd.png");
func:AddGraph("1P_Up_3rd.png");
func:AddGraph("2P_Up_3rd.png");
func:AddGraph("Clear_Up_1st.png");
func:AddGraph("Clear_Up_2nd.png");
func:AddGraph("Clear_Up_3rd.png");
end
function update()
bgScrollX = bgScrollX - (59 * deltaTime);
bgScrollY = bgScrollY + (14 * deltaTime);
bg3rdAnime = bg3rdAnime + (300 * deltaTime);
for player = 0, playerCount - 1 do
if isClear[player] then
bgClearFade[player + 1] = bgClearFade[player + 1] + (2000 * deltaTime);
else
bgClearFade[player + 1] = bgClearFade[player + 1] - (2000 * deltaTime);
end
if bgClearFade[player + 1] > 255 then
bgClearFade[player + 1] = 255;
end
if bgClearFade[player + 1] < 0 then
bgClearFade[player + 1] = 0;
end
end
if bgScrollX < -loopWidth then
bgScrollX = 0;
end
if bgScrollY > loopHeight then
bgScrollY = 0;
end
if bg3rdAnime > 600 then
bg3rdAnime = 0;
end
if bg3rdAnime < 270 then
--speed
bgScrollX_3rd = bg3rdAnime * 0.9258;
bgScrollY_3rd = math.sin(bg3rdAnime * (math.pi / 270.0)) * 40.0;
else
bgScrollX_3rd = 250 + (bg3rdAnime - 270) * 0.24;
if bg3rdAnime < 490 then
bgScrollY_3rd = -math.sin((bg3rdAnime - 270) * (math.pi / 170.0)) * 15.0;
else
bgScrollY_3rd = -(math.sin(220 * (math.pi / 170.0)) * 15.0) + (((bg3rdAnime - 490) / 110) * (math.sin(220 * (math.pi / 170)) * 15.0));
end
end
end
function draw()
for player = 0, playerCount - 1 do
func:SetOpacity(bgClearFade[player + 1], "Clear_Up_1st.png");
func:SetOpacity(bgClearFade[player + 1], "Clear_Up_2nd.png");
func:SetOpacity(bgClearFade[player + 1], "Clear_Up_3rd.png");
y = 0;
if player == 1 then
y = 536;
end
for i = 0, 5 do
drawUp1st(bgScrollX + (loopWidth * i), y, player);
drawUp2nd(bgScrollX + (loopWidth * i), y, player);
end
for i = 0, 5 do
drawUp3rd(bgScrollX + (loopWidth * i), y, player);
end
end
end

View File

@ -0,0 +1,36 @@
--func:DrawText(x, y, text);
--func:DrawNum(x, y, num);
--func:AddGraph("filename");
--func:DrawGraph(x, y, filename);
--func:SetOpacity(opacity, "filename");
--func:SetScale(xscale, yscale, "filename");
--func:SetColor(r, g, b, "filename");
local fps = 0
local deltaTime = 0
local isClear = { false, false }
local towerNightNum = 0
function updateValues(_deltaTime, _fps, _isClear, _towerNightNum)
deltaTime = _deltaTime
fps = _fps
isClear = _isClear
towerNightNum = _towerNightNum
deltaTime = _deltaTime
end
function clearIn(player)
end
function clearOut(player)
end
function init()
end
function update()
end
function draw()
end

View File

@ -0,0 +1,95 @@
local fps = 0
local deltaTime = 0
local isClear = { false, false }
local towerNightNum = 0
function updateValues(_deltaTime, _fps, _isClear, _towerNightNum)
deltaTime = _deltaTime
fps = _fps
isClear = _isClear
towerNightNum = _towerNightNum
deltaTime = _deltaTime
end
local bgWidth_1 = 1323
local bgWidth_2 = 1280
local bgWidth_3 = 1280
local bgWidth_4 = 641
local bgWidth_5 = 639
local bgScrollX_1 = 0
local bgScrollX_2 = 0
local bgScrollX_3 = 0
local bgScrollX_4 = 0
local bgScrollX_5 = 0
function clearIn(player)
end
function clearOut(player)
end
function init()
func:AddGraph("0.png");
func:AddGraph("1.png");
func:AddGraph("2.png");
func:AddGraph("3.png");
func:AddGraph("4.png");
func:AddGraph("5.png");
func:AddGraph("6.png");
func:AddGraph("7.png");
end
function update()
bgScrollX_1 = bgScrollX_1 + (59.1 * deltaTime);
if bgScrollX_1 > bgWidth_1 then
bgScrollX_1 = 0;
end
bgScrollX_2 = bgScrollX_2 + (45.9 * deltaTime);
if bgScrollX_2 > bgWidth_2 then
bgScrollX_2 = 0;
end
bgScrollX_3 = bgScrollX_3 + (43.8 * deltaTime);
if bgScrollX_3 > bgWidth_3 then
bgScrollX_3 = 0;
end
bgScrollX_4 = bgScrollX_4 + (100 * deltaTime);
if bgScrollX_4 > bgWidth_4 + 200 then
bgScrollX_4 = 0;
end
bgScrollX_5 = bgScrollX_5 + (45.9 * deltaTime);
if bgScrollX_5 > bgWidth_5 then
bgScrollX_5 = 0;
end
end
function draw()
func:DrawGraph(0, 0, "0.png");
func:SetOpacity((towerNightNum * 255.0), "7.png");
func:DrawGraph(0, 0, "7.png");
colorTmp = 0.5 + (1 - towerNightNum) * 0.5;
func:SetColor(colorTmp, colorTmp, colorTmp, "1.png");
func:SetColor(colorTmp, colorTmp, colorTmp, "2.png");
func:SetColor(colorTmp, colorTmp, colorTmp, "3.png");
func:SetOpacity(colorTmp * 255.0, "1.png");
func:SetOpacity(colorTmp * 255.0, "2.png");
func:SetOpacity(colorTmp * 255.0, "3.png");
for i = 0, 4 do
func:DrawGraph((i * bgWidth_1) - bgScrollX_1, 0, "1.png");
func:DrawGraph((i * bgWidth_2) - bgScrollX_2, 0, "2.png");
func:DrawGraph((i * bgWidth_3) - bgScrollX_3, 0, "3.png");
end
func:DrawGraph(0, 0, "6.png");
for i = 0, 4 do
func:DrawGraph((i * bgWidth_4) - bgScrollX_4, -200 + bgScrollX_4, "4.png");
func:DrawGraph((i * bgWidth_5) - bgScrollX_5, 0, "5.png");
end
end