1
0
mirror of synced 2024-11-24 07:30:21 +01:00

踊り子とMobを強化 (#526)

* 踊り子とMobを強化

* バグ修正
This commit is contained in:
Takkkom 2023-11-16 19:04:57 +09:00 committed by GitHub
parent 78c90419e5
commit d85f3432f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 400 additions and 28 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@ -0,0 +1,96 @@
--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 debug_counter = 0
local mob_x = 0
local mob_y = 0
local mob_height = 0
local mob_counter = 0
local mob_in_counter = 0
local mob_out_counter = 0
local mob_state = 0
function mobIn()
mob_state = 1
mob_in_counter = 0
end
function mobOut()
mob_state = 2
mob_out_counter = 0
end
function init()
func:AddGraph("Mob.png")
mob_height = func:GetTextureHeight("Mob.png")
end
function update()
--debug_counter = debug_counter + (deltaTime)
--if debug_counter > 2 then
-- if mob_state == 0 then
-- mobIn()
-- else
-- mobOut()
-- end
-- debug_counter = 0
--end
mob_counter = mob_counter + (bpm[0] * deltaTime / 60.0)
if mob_counter > 1 then
mob_counter = 0
end
mob_y = 1080 + ((1.0 - math.sin(mob_counter * math.pi)) * 105)
if mob_state == 3 and gauge[0] == 100 then
mobOut()
end
if mob_state == 0 then
if gauge[0] == 100 then
mobIn()
end
elseif mob_state == 1 then
mob_in_counter = mob_in_counter + (5 * deltaTime)
if mob_in_counter > 1 then
mob_state = 3
end
mob_y = mob_y + (540 * (1.0 - math.sin(mob_in_counter * math.pi / 2)))
elseif mob_state == 2 then
mob_out_counter = mob_out_counter + (5 * deltaTime)
if mob_out_counter > 1 then
mob_state = 0
end
mob_y = mob_y + (540 * (1 - math.cos(mob_out_counter * math.pi)))
elseif mob_state == 3 then
end
end
function draw()
if mob_state == 0 then
else
func:DrawGraph(mob_x, mob_y - mob_height, "Mob.png")
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@ -0,0 +1,96 @@
--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 debug_counter = 0
local mob_x = 0
local mob_y = 0
local mob_height = 0
local mob_counter = 0
local mob_in_counter = 0
local mob_out_counter = 0
local mob_state = 0
function mobIn()
mob_state = 1
mob_in_counter = 0
end
function mobOut()
mob_state = 2
mob_out_counter = 0
end
function init()
func:AddGraph("Mob.png")
mob_height = func:GetTextureHeight("Mob.png")
end
function update()
--debug_counter = debug_counter + (deltaTime)
--if debug_counter > 2 then
-- if mob_state == 0 then
-- mobIn()
-- else
-- mobOut()
-- end
-- debug_counter = 0
--end
mob_counter = mob_counter + (bpm[0] * deltaTime / 60.0)
if mob_counter > 1 then
mob_counter = 0
end
mob_y = 720 + ((1.0 - math.sin(mob_counter * math.pi)) * 70)
if mob_state == 3 and gauge[0] == 100 then
mobOut()
end
if mob_state == 0 then
if gauge[0] == 100 then
mobIn()
end
elseif mob_state == 1 then
mob_in_counter = mob_in_counter + (5 * deltaTime)
if mob_in_counter > 1 then
mob_state = 3
end
mob_y = mob_y + (360 * (1.0 - math.sin(mob_in_counter * math.pi / 2)))
elseif mob_state == 2 then
mob_out_counter = mob_out_counter + (5 * deltaTime)
if mob_out_counter > 1 then
mob_state = 0
end
mob_y = mob_y + (360 * (1 - math.cos(mob_out_counter * math.pi)))
elseif mob_state == 3 then
end
end
function draw()
if mob_state == 0 then
else
func:DrawGraph(mob_x, mob_y - mob_height, "Mob.png")
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 609 B

View File

@ -5321,6 +5321,11 @@ namespace TJAPlayer3
this.actPanel.t歌詞テクスチャを削除する();
for (int i = 0; i < 5; i++)
{
if (bIsAlreadyCleared[i])
{
TJAPlayer3.stage演奏ドラム画面.actBackground.ClearOut(i);
}
this.t演奏位置の変更(0, i);
this.actPlayInfo.NowMeasure[i] = 0;
JPOSCROLLX[i] = 0;

View File

@ -28,7 +28,15 @@ namespace TJAPlayer3
var preset = HScenePreset.GetBGPreset();
Random random = new Random();
Dancer_In = new CTexture[5][];
Dancer_Out = new CTexture[5][];
Dancer = new CTexture[5][];
DancerStates = new int[5];
nNowDancerInCounter = new float[5];
nNowDancerOutCounter = new float[5];
var dancerOrigindir = CSkin.Path($"{TextureLoader.BASE}{TextureLoader.GAME}{TextureLoader.DANCER}");
if (System.IO.Directory.Exists($@"{dancerOrigindir}"))
@ -43,10 +51,43 @@ namespace TJAPlayer3
LoadDancerConifg(path);
Dancer_In = new CTexture[nDancerCount][];
Dancer_Out = new CTexture[nDancerCount][];
Dancer = new CTexture[nDancerCount][];
DancerStates = new int[nDancerCount];
nNowDancerInCounter = new float[nDancerCount];
nNowDancerOutCounter = new float[nDancerCount];
nDancerInPtn = TJAPlayer3.t連番画像の枚数を数える($@"{path}{Path.DirectorySeparatorChar}1_In{Path.DirectorySeparatorChar}");
if (nDancerInPtn != 0)
{
for (int i = 0; i < nDancerCount; i++)
{
Dancer_In[i] = new CTexture[nDancerInPtn];
for (int p = 0; p < nDancerInPtn; p++)
{
Dancer_In[i][p] = TJAPlayer3.tテクスチャの生成($@"{path}{Path.DirectorySeparatorChar}{(i + 1)}_In{Path.DirectorySeparatorChar}{p}.png");
}
}
}
nDancerOutPtn = TJAPlayer3.t連番画像の枚数を数える($@"{path}{Path.DirectorySeparatorChar}1_Out{Path.DirectorySeparatorChar}");
if (nDancerOutPtn != 0)
{
for (int i = 0; i < nDancerCount; i++)
{
Dancer_Out[i] = new CTexture[nDancerOutPtn];
for (int p = 0; p < nDancerOutPtn; p++)
{
Dancer_Out[i][p] = TJAPlayer3.tテクスチャの生成($@"{path}{Path.DirectorySeparatorChar}{(i + 1)}_Out{Path.DirectorySeparatorChar}{p}.png");
}
}
}
nDancerPtn = TJAPlayer3.t連番画像の枚数を数える($@"{path}{Path.DirectorySeparatorChar}1{Path.DirectorySeparatorChar}");
if (nDancerPtn != 0)
{
for (int i = 0; i < 5; i++)
for (int i = 0; i < nDancerCount; i++)
{
Dancer[i] = new CTexture[nDancerPtn];
for (int p = 0; p < nDancerPtn; p++)
@ -58,6 +99,12 @@ namespace TJAPlayer3
}
}
arMotionArray_In = CConversion.StringToIntArray(Game_Dancer_In_Motion);
if(this.arMotionArray_In == null) arMotionArray_In = CConversion.StringToIntArray("0,0");
arMotionArray_Out = CConversion.StringToIntArray(Game_Dancer_Out_Motion);
if(this.arMotionArray_Out == null) arMotionArray_Out = CConversion.StringToIntArray("0,0");
this.ar踊り子モーション番号 = CConversion.StringToIntArray(TJAPlayer3.Skin.Game_Dancer_Motion);
if(this.ar踊り子モーション番号 == null) ar踊り子モーション番号 = CConversion.StringToIntArray("0,0");
@ -74,8 +121,10 @@ namespace TJAPlayer3
//this.ct踊り子モーション = null;
for (int i = 0; i < 5; i++)
for (int i = 0; i < nDancerCount; i++)
{
TJAPlayer3.t安全にDisposeする(ref Dancer_In[i]);
TJAPlayer3.t安全にDisposeする(ref Dancer_Out[i]);
TJAPlayer3.t安全にDisposeする(ref Dancer[i]);
}
@ -103,22 +152,91 @@ namespace TJAPlayer3
{
if (TJAPlayer3.ConfigIni.ShowDancer && (this.ar踊り子モーション番号.Length - 1) != 0)
{
if (!TJAPlayer3.stage演奏ドラム画面.bPAUSE) nNowDancerCounter += (Math.Abs((float)TJAPlayer3.stage演奏ドラム画面.actPlayInfo.dbBPM[0] / 60.0f) * (float)TJAPlayer3.FPS.DeltaTime) * (this.ar踊り子モーション番号.Length - 1) / nDancerBeat;
nNowDancerFrame = (int)nNowDancerCounter;
nNowDancerFrame = Math.Min(nNowDancerFrame, (this.ar踊り子モーション番号.Length - 1));
bool endAnime = nNowDancerFrame >= (this.ar踊り子モーション番号.Length - 1) - 1;
if (endAnime)
if (!TJAPlayer3.stage演奏ドラム画面.bPAUSE) nNowDancerCounter += Math.Abs((float)TJAPlayer3.stage演奏ドラム画面.actPlayInfo.dbBPM[0] / 60.0f) * (float)TJAPlayer3.FPS.DeltaTime / nDancerBeat;
if (nNowDancerCounter >= 1)
{
nNowDancerCounter = 0;
nNowDancerFrame = 0;
}
for (int i = 0; i < 5; i++)
nNowDancerFrame = (int)(nNowDancerCounter * (this.ar踊り子モーション番号.Length - 1));
for (int i = 0; i < nDancerCount; i++)
{
if (this.Dancer[i] != null && this.Dancer[i][this.ar踊り子モーション番号[nNowDancerFrame]] != null)
if ((int)TJAPlayer3.stage演奏ドラム画面.actGauge.db現在のゲージ値[0] >= TJAPlayer3.Skin.Game_Dancer_Gauge[i])
{
if ((int)TJAPlayer3.stage演奏ドラム画面.actGauge.db現在のゲージ値[0] >= TJAPlayer3.Skin.Game_Dancer_Gauge[i])
if (DancerStates[i] == 0)
{
DancerStates[i] = 1;
nNowDancerInCounter[i] = 0;
}
}
else
{
if (DancerStates[i] == 3)
{
DancerStates[i] = 2;
nNowDancerOutCounter[i] = 0;
}
}
switch(DancerStates[i])
{
case 0:
break;
case 1:
{
if (nDancerInInterval == 0)
{
DancerStates[i] = 3;
}
else
{
if (!TJAPlayer3.stage演奏ドラム画面.bPAUSE) nNowDancerInCounter[i] += Math.Abs((float)TJAPlayer3.stage演奏ドラム画面.actPlayInfo.dbBPM[0] / nDancerInInterval) * (float)TJAPlayer3.FPS.DeltaTime;
if (nNowDancerInCounter[i] >= 1)
{
nNowDancerInCounter[i] = 1;
DancerStates[i] = 3;
}
int frame = (int)(nNowDancerInCounter[i] * (this.arMotionArray_In.Length - 1));
if (this.Dancer_In[i] != null && this.Dancer_In[i].Length > 0 && this.Dancer_In[i][this.arMotionArray_In[frame]] != null)
{
this.Dancer_In[i][this.arMotionArray_In[frame]].t2D中心基準描画(TJAPlayer3.Skin.Game_Dancer_X[i], TJAPlayer3.Skin.Game_Dancer_Y[i]);
}
}
}
break;
case 2:
{
if (nDancerOutInterval == 0)
{
DancerStates[i] = 0;
}
else
{
if (!TJAPlayer3.stage演奏ドラム画面.bPAUSE) nNowDancerOutCounter[i] += Math.Abs((float)TJAPlayer3.stage演奏ドラム画面.actPlayInfo.dbBPM[0] / nDancerOutInterval) * (float)TJAPlayer3.FPS.DeltaTime;
if (nNowDancerOutCounter[i] >= 1)
{
nNowDancerOutCounter[i] = 1;
DancerStates[i] = 0;
}
int frame = (int)(nNowDancerOutCounter[i] * (this.arMotionArray_Out.Length - 1));
if (this.Dancer_Out[i] != null && this.Dancer_Out[i].Length > 0 && this.Dancer_Out[i][this.arMotionArray_Out[frame]] != null)
{
this.Dancer_Out[i][this.arMotionArray_Out[frame]].t2D中心基準描画(TJAPlayer3.Skin.Game_Dancer_X[i], TJAPlayer3.Skin.Game_Dancer_Y[i]);
}
}
}
break;
case 3:
if (this.Dancer[i] != null && this.Dancer[i].Length > 0 && this.Dancer[i][this.ar踊り子モーション番号[nNowDancerFrame]] != null)
{
this.Dancer[i][this.ar踊り子モーション番号[nNowDancerFrame]].t2D中心基準描画(TJAPlayer3.Skin.Game_Dancer_X[i], TJAPlayer3.Skin.Game_Dancer_Y[i]);
}
break;
}
}
}
@ -129,13 +247,27 @@ namespace TJAPlayer3
#region[ private ]
//-----------------
private int nDancerCount;
private float[] nNowDancerInCounter;
private float[] nNowDancerOutCounter;
private float nNowDancerCounter;
private int nNowDancerFrame;
private int nDancerInPtn;
private int nDancerOutPtn;
private int nDancerPtn;
private float nDancerBeat;
private float nDancerInInterval;
private float nDancerOutInterval;
private int[] arMotionArray_In;
private int[] arMotionArray_Out;
private int[] ar踊り子モーション番号;
//public CCounter ct踊り子モーション;
private CTexture[][] Dancer_In;
private CTexture[][] Dancer_Out;
private CTexture[][] Dancer;
private int[] DancerStates;
private string Game_Dancer_In_Motion;
private string Game_Dancer_Out_Motion;
private void LoadDancerConifg(string dancerPath)
{
@ -147,6 +279,9 @@ namespace TJAPlayer3
TJAPlayer3.Skin.Game_Dancer_X = new int[] { 640, 430, 856, 215, 1070 };
TJAPlayer3.Skin.Game_Dancer_Y = new int[] { 500, 500, 500, 500, 500 };
nDancerCount = 5;
nDancerInInterval = 0;
nDancerOutInterval = 0;
foreach (string s in strSingleLine)
{
@ -164,10 +299,16 @@ namespace TJAPlayer3
strCommand = strArray[0].Trim();
strParam = strArray[1].Trim();
if (strCommand == "Game_Dancer_X")
if (strCommand == "Game_Dancer_Count")
{
nDancerCount = int.Parse(strParam);
TJAPlayer3.Skin.Game_Dancer_X = new int[nDancerCount];
TJAPlayer3.Skin.Game_Dancer_Y = new int[nDancerCount];
}
else if (strCommand == "Game_Dancer_X")
{
string[] strSplit = strParam.Split(',');
for (int i = 0; i < 5; i++)
for (int i = 0; i < nDancerCount; i++)
{
TJAPlayer3.Skin.Game_Dancer_X[i] = int.Parse(strSplit[i]);
}
@ -175,7 +316,7 @@ namespace TJAPlayer3
else if (strCommand == "Game_Dancer_Y")
{
string[] strSplit = strParam.Split(',');
for (int i = 0; i < 5; i++)
for (int i = 0; i < nDancerCount; i++)
{
TJAPlayer3.Skin.Game_Dancer_Y[i] = int.Parse(strSplit[i]);
}
@ -184,15 +325,30 @@ namespace TJAPlayer3
{
TJAPlayer3.Skin.Game_Dancer_Motion = strParam;
}
// Game_Dancer_PtnはTextrueLoader.csで反映されます。
else if (strCommand == "Game_Dancer_In_Motion")
{
Game_Dancer_In_Motion = strParam;
}
else if (strCommand == "Game_Dancer_Out_Motion")
{
Game_Dancer_Out_Motion = strParam;
}
else if (strCommand == "Game_Dancer_Beat")
{
nDancerBeat = int.Parse(strParam);
}
else if (strCommand == "Game_Dancer_In_Interval")
{
nDancerInInterval = int.Parse(strParam);
}
else if (strCommand == "Game_Dancer_Out_Interval")
{
nDancerOutInterval = int.Parse(strParam);
}
else if (strCommand == "Game_Dancer_Gauge")
{
string[] strSplit = strParam.Split(',');
for (int i = 0; i < 5; i++)
for (int i = 0; i < nDancerCount; i++)
{
TJAPlayer3.Skin.Game_Dancer_Gauge[i] = int.Parse(strSplit[i]);
}

View File

@ -26,26 +26,25 @@ namespace TJAPlayer3
{
Random random = new Random();
var upDirs = System.IO.Directory.GetFiles(mobDir);
var upDirs = System.IO.Directory.GetDirectories(mobDir);
if (upDirs.Length > 0)
{
var _presetPath = (preset != null && preset.MobSet != null) ? $@"{mobDir}" + preset.MobSet[random.Next(0, preset.MobSet.Length)] + ".png" : "";
var path = (preset != null && System.IO.File.Exists(_presetPath))
var _presetPath = (preset != null && preset.MobSet != null) ? $@"{mobDir}" + preset.MobSet[random.Next(0, preset.MobSet.Length)] : "";
var path = (preset != null && System.IO.Directory.Exists(_presetPath))
? _presetPath
: upDirs[random.Next(0, upDirs.Length)];
Mob = TJAPlayer3.tテクスチャの生成(path);
MobScript = new ScriptBG($@"{path}{Path.DirectorySeparatorChar}Script.lua");
MobScript.Init();
}
}
nMobBeat = TJAPlayer3.Skin.Game_Mob_Beat;
base.Activate();
}
public override void DeActivate()
{
TJAPlayer3.tテクスチャの解放(ref Mob);
MobScript?.Dispose();
base.DeActivate();
}
@ -66,6 +65,10 @@ namespace TJAPlayer3
{
if (TJAPlayer3.stage選曲.n確定された曲の難易度[0] != (int)Difficulty.Tower && TJAPlayer3.stage選曲.n確定された曲の難易度[0] != (int)Difficulty.Dan)
{
if (!TJAPlayer3.stage演奏ドラム画面.bPAUSE) MobScript?.Update();
MobScript?.Draw();
/*
if (HGaugeMethods.UNSAFE_IsRainbow(0))
{
@ -83,16 +86,14 @@ namespace TJAPlayer3
Mob.t2D描画(0, (TJAPlayer3.Skin.Resolution[1] - (Mob.szテクスチャサイズ.Height - moveHeight)) + -((float)Math.Sin(nNowMobCounter * (Math.PI / 180)) * moveHeight));
}
*/
}
}
return base.Draw();
}
#region[ private ]
//-----------------
public CTexture Mob;
private float nNowMobCounter;
private float nMobBeat;
private ScriptBG MobScript;
//-----------------
#endregion
}

View File

@ -116,6 +116,24 @@ namespace TJAPlayer3
}
}
}
public double GetTextureWidth(string fileName)
{
if (Textures[fileName] != null)
{
return Textures[fileName].szテクスチャサイズ.Width;
}
return -1;
}
public double GetTextureHeight(string fileName)
{
if (Textures[fileName] != null)
{
return Textures[fileName].szテクスチャサイズ.Height;
}
return -1;
}
}
class ScriptBG : IDisposable
{