1
0
mirror of synced 2024-11-23 23:21:06 +01:00
This commit is contained in:
0auBSQ 2024-10-17 04:38:13 +09:00
parent 52e2627871
commit 1baaa856ec
7 changed files with 776 additions and 767 deletions

View File

@ -20,7 +20,6 @@
* THE SOFTWARE.
*/
using FDK;
using ImGuiNET;
using Silk.NET.Core;
using Silk.NET.GLFW;
using Silk.NET.Input;
@ -438,6 +437,7 @@ namespace SampleFramework {
ViewPortOffset.X = (size.X - ViewPortSize.X) / 2;
ViewPortOffset.Y = (size.Y - ViewPortSize.Y) / 2;
Gl.Viewport(ViewPortOffset.X, ViewPortOffset.Y, (uint)ViewPortSize.X, (uint)ViewPortSize.Y);
}

View File

@ -1,17 +1,18 @@
#TITLE:OpenTaiko Headquarters
#TITLERU:Штаб-квартира OpenTaiko
#TITLEZH:OpenTaiko总部
#GENRE:OpenTaiko Headquarters
#BOXEXPLANATION1:Greetings, from the OPTK-HQ channel,
#BOXEXPLANATION2:broadcasting to you now!
#BOXEXPLANATION3:Let's see what today brings us...
#BOXEXPLANATIONRU1:Здравствуйте, в канале OPTK-HQ,
#BOXEXPLANATIONRU2:ведёт прямой эфир для вас!
#BOXEXPLANATIONRU3:Смотрите что сегодня нам принесёт...
#BOXEXPLANATIONZH1:OPTK-HQ频道
#BOXEXPLANATIONZH2:
#BOXEXPLANATIONZH3:
#BOXTYPE:9
#BGTYPE:6
#BOXCOLOR:#999999
#BACKCOLOR:#444444
#TITLE:OpenTaiko Headquarters
#TITLERU:Штаб-квартира OpenTaiko
#TITLEZH:OpenTaiko总部
#GENRE:OpenTaiko Headquarters
#BOXEXPLANATION1:Greetings, from the OPTK-HQ channel,
#BOXEXPLANATION2:broadcasting to you now!
#BOXEXPLANATION3:Let's see what today brings us...
#BOXEXPLANATIONRU1:Здравствуйте, в канале OPTK-HQ,
#BOXEXPLANATIONRU2:ведёт прямой эфир для вас!
#BOXEXPLANATIONRU3:Смотрите что сегодня нам принесёт...
#BOXEXPLANATIONZH1:OPTK-HQ频道
#BOXEXPLANATIONZH2:
#BOXEXPLANATIONZH3:
#BOXTYPE:9
#BGTYPE:6
#BOXCOLOR:#999999
#BACKCOLOR:#444444
#SCENEPRESET:Headquarters1

View File

@ -1,88 +1,96 @@
{
"Regular": {
"": {
"UP": [ "0","1" ],
"DOWN": [ "0","1","2" ],
"DANCER": [ "0" ],
"FOOTER": [ "0" ],
"MOB": [ "0" ],
"RUNNER": [ "0" ]
},
"Dango": {
"UP": [ "0" ],
"DOWN": [ "0" ],
"DANCER": [ "0" ],
"FOOTER": [ "0" ],
"MOB": [ "0" ],
"RUNNER": [ "0" ]
},
"Clouds": {
"UP": [ "1" ],
"DOWN": [ "1" ],
"DANCER": [ "0" ],
"FOOTER": [ "0" ],
"MOB": [ "0" ],
"RUNNER": [ "0" ]
},
"Forest": {
"UP": [ "1" ],
"DOWN": [ "2" ],
"DANCER": [ "0" ],
"FOOTER": [ "0" ],
"MOB": [ "0" ],
"RUNNER": [ "0" ]
},
"Dashy": {
"UP": [ "8" ],
"DOWN": [ "8" ],
"DANCER": [ "Dashy" ],
"FOOTER": [ "8" ],
"MOB": [ "0" ],
"RUNNER": [ "0" ]
},
"Outfox": {
"UP": [ "Outfox" ],
"DOWN": [ "Outfox" ],
"DANCER": [ "0" ],
"FOOTER": [ "Outfox" ],
"MOB": [ "0" ],
"RUNNER": [ "0" ]
}
},
"Dan": {
"Summer": {
"UP": [ "Summer" ]
},
"Fall": {
"UP": [ "Fall" ]
},
"Winter": {
"UP": [ "Winter" ]
},
"Spring": {
"UP": [ "Spring" ]
}
},
"Tower": {
"": {
"DOWN": [ "Day", "Sunset", "Mountain" ],
"FOOTER": [ "0" ]
},
"Day": {
"DOWN": [ "Day" ],
"FOOTER": [ "0" ]
},
"Sunset": {
"DOWN": [ "Sunset" ],
"FOOTER": [ "0" ]
},
"Mountain": {
"DOWN": [ "Mountain" ],
"FOOTER": [ "0" ]
},
"Event": {
"DOWN": [ "Event" ],
"FOOTER": [ "0" ]
}
}
{
"Regular": {
"": {
"UP": [ "0","1" ],
"DOWN": [ "0","1","2" ],
"DANCER": [ "0" ],
"FOOTER": [ "0" ],
"MOB": [ ],
"RUNNER": [ ]
},
"Dango": {
"UP": [ "0" ],
"DOWN": [ "0" ],
"DANCER": [ "0" ],
"FOOTER": [ "0" ],
"MOB": [ ],
"RUNNER": [ ]
},
"Clouds": {
"UP": [ "1" ],
"DOWN": [ "1" ],
"DANCER": [ "0" ],
"FOOTER": [ "0" ],
"MOB": [ ],
"RUNNER": [ ]
},
"Forest": {
"UP": [ "1" ],
"DOWN": [ "2" ],
"DANCER": [ "0" ],
"FOOTER": [ "0" ],
"MOB": [ ],
"RUNNER": [ ]
},
"Dashy": {
"UP": [ "8" ],
"DOWN": [ "8" ],
"DANCER": [ "Dashy" ],
"FOOTER": [ "8" ],
"MOB": [ ],
"RUNNER": [ ]
},
"Outfox": {
"UP": [ "Outfox" ],
"DOWN": [ "Outfox" ],
"DANCER": [ "0" ],
"FOOTER": [ "Outfox" ],
"MOB": [ ],
"RUNNER": [ ]
},
"Headquarters1": {
"UP": [ "0","1" ],
"DOWN": [ "0","1","2" ],
"DANCER": [ "0" ],
"FOOTER": [ "0" ],
"MOB": [ "0" ],
"RUNNER": [ ]
}
},
"Dan": {
"Summer": {
"UP": [ "Summer" ]
},
"Fall": {
"UP": [ "Fall" ]
},
"Winter": {
"UP": [ "Winter" ]
},
"Spring": {
"UP": [ "Spring" ]
}
},
"Tower": {
"": {
"DOWN": [ "Day", "Sunset", "Mountain" ],
"FOOTER": [ "0" ]
},
"Day": {
"DOWN": [ "Day" ],
"FOOTER": [ "0" ]
},
"Sunset": {
"DOWN": [ "Sunset" ],
"FOOTER": [ "0" ]
},
"Mountain": {
"DOWN": [ "Mountain" ],
"FOOTER": [ "0" ]
},
"Event": {
"DOWN": [ "Event" ],
"FOOTER": [ "0" ]
}
}
}

View File

@ -1,295 +1,295 @@
using System.Diagnostics;
using FDK;
namespace OpenTaiko {
internal class CActImplDancer : CActivity {
/// <summary>
/// 踊り子
/// </summary>
public CActImplDancer() {
base.IsDeActivated = true;
}
public override void Activate() {
//this.ct踊り子モーション = new CCounter();
if (OpenTaiko.stageSongSelect.nChoosenSongDifficulty[0] == (int)Difficulty.Tower || OpenTaiko.stageSongSelect.nChoosenSongDifficulty[0] == (int)Difficulty.Dan)
return;
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}")) {
var dirs = System.IO.Directory.GetDirectories($@"{dancerOrigindir}");
if (dirs.Length > 0) {
var _presetPath = (preset != null && preset.DancerSet != null) ? $@"{dancerOrigindir}" + preset.DancerSet[random.Next(0, preset.DancerSet.Length)] : "";
var path = (preset != null && System.IO.Directory.Exists(_presetPath))
? _presetPath
: dirs[random.Next(0, dirs.Length)];
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 = OpenTaiko.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] = OpenTaiko.tテクスチャの生成($@"{path}{Path.DirectorySeparatorChar}{(i + 1)}_In{Path.DirectorySeparatorChar}{p}.png");
}
}
}
nDancerOutPtn = OpenTaiko.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] = OpenTaiko.tテクスチャの生成($@"{path}{Path.DirectorySeparatorChar}{(i + 1)}_Out{Path.DirectorySeparatorChar}{p}.png");
}
}
}
nDancerPtn = OpenTaiko.t連番画像の枚数を数える($@"{path}{Path.DirectorySeparatorChar}1{Path.DirectorySeparatorChar}");
if (nDancerPtn != 0) {
for (int i = 0; i < nDancerCount; i++) {
Dancer[i] = new CTexture[nDancerPtn];
for (int p = 0; p < nDancerPtn; p++) {
Dancer[i][p] = OpenTaiko.tテクスチャの生成($@"{path}{Path.DirectorySeparatorChar}{(i + 1)}{Path.DirectorySeparatorChar}{p}.png");
}
}
}
}
}
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(OpenTaiko.Skin.Game_Dancer_Motion);
if (this.ar踊り子モーション番号 == null) ar踊り子モーション番号 = CConversion.StringToIntArray("0,0");
nNowDancerCounter = 0;
nNowDancerFrame = 0;
base.Activate();
}
public override void DeActivate() {
if (OpenTaiko.stageSongSelect.nChoosenSongDifficulty[0] == (int)Difficulty.Tower || OpenTaiko.stageSongSelect.nChoosenSongDifficulty[0] == (int)Difficulty.Dan)
return;
//this.ct踊り子モーション = null;
for (int i = 0; i < nDancerCount; i++) {
OpenTaiko.t安全にDisposeする(ref Dancer_In[i]);
OpenTaiko.t安全にDisposeする(ref Dancer_Out[i]);
OpenTaiko.t安全にDisposeする(ref Dancer[i]);
}
base.DeActivate();
}
public override void CreateManagedResource() {
base.CreateManagedResource();
}
public override void ReleaseManagedResource() {
base.ReleaseManagedResource();
}
public override int Draw() {
if (this.IsFirstDraw) {
this.IsFirstDraw = true;
}
if (OpenTaiko.stageSongSelect.nChoosenSongDifficulty[0] != (int)Difficulty.Tower && OpenTaiko.stageSongSelect.nChoosenSongDifficulty[0] != (int)Difficulty.Dan) {
if (OpenTaiko.ConfigIni.ShowDancer && (this.ar踊り子モーション番号.Length - 1) != 0) {
if (!OpenTaiko.stage演奏ドラム画面.bPAUSE) nNowDancerCounter += Math.Abs((float)OpenTaiko.stage演奏ドラム画面.actPlayInfo.dbBPM[0] / 60.0f) * (float)OpenTaiko.FPS.DeltaTime / nDancerBeat;
if (nNowDancerCounter >= 1) {
nNowDancerCounter = 0;
}
nNowDancerFrame = (int)(nNowDancerCounter * (this.ar踊り子モーション番号.Length - 1));
for (int i = 0; i < nDancerCount; i++) {
if ((int)OpenTaiko.stage演奏ドラム画面.actGauge.db現在のゲージ値[0] >= OpenTaiko.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 (!OpenTaiko.stage演奏ドラム画面.bPAUSE) nNowDancerInCounter[i] += Math.Abs((float)OpenTaiko.stage演奏ドラム画面.actPlayInfo.dbBPM[0] / nDancerInInterval) * (float)OpenTaiko.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中心基準描画(OpenTaiko.Skin.Game_Dancer_X[i], OpenTaiko.Skin.Game_Dancer_Y[i]);
}
}
}
break;
case 2: {
if (nDancerOutInterval == 0) {
DancerStates[i] = 0;
} else {
if (!OpenTaiko.stage演奏ドラム画面.bPAUSE) nNowDancerOutCounter[i] += Math.Abs((float)OpenTaiko.stage演奏ドラム画面.actPlayInfo.dbBPM[0] / nDancerOutInterval) * (float)OpenTaiko.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中心基準描画(OpenTaiko.Skin.Game_Dancer_X[i], OpenTaiko.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中心基準描画(OpenTaiko.Skin.Game_Dancer_X[i], OpenTaiko.Skin.Game_Dancer_Y[i]);
}
break;
}
}
}
}
return base.Draw();
}
#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) {
var _str = "";
OpenTaiko.Skin.LoadSkinConfigFromFile(dancerPath + @$"{Path.DirectorySeparatorChar}DancerConfig.txt", ref _str);
string[] delimiter = { "\n" };
string[] strSingleLine = _str.Split(delimiter, StringSplitOptions.RemoveEmptyEntries);
OpenTaiko.Skin.Game_Dancer_X = new int[] { 640, 430, 856, 215, 1070 };
OpenTaiko.Skin.Game_Dancer_Y = new int[] { 500, 500, 500, 500, 500 };
nDancerCount = 5;
nDancerInInterval = 0;
nDancerOutInterval = 0;
foreach (string s in strSingleLine) {
string str = s.Replace('\t', ' ').TrimStart(new char[] { '\t', ' ' });
if ((str.Length != 0) && (str[0] != ';')) {
try {
string strCommand;
string strParam;
string[] strArray = str.Split(new char[] { '=' });
if (strArray.Length == 2) {
strCommand = strArray[0].Trim();
strParam = strArray[1].Trim();
if (strCommand == "Game_Dancer_Count") {
nDancerCount = int.Parse(strParam);
OpenTaiko.Skin.Game_Dancer_X = new int[nDancerCount];
OpenTaiko.Skin.Game_Dancer_Y = new int[nDancerCount];
} else if (strCommand == "Game_Dancer_X") {
string[] strSplit = strParam.Split(',');
for (int i = 0; i < nDancerCount; i++) {
OpenTaiko.Skin.Game_Dancer_X[i] = int.Parse(strSplit[i]);
}
} else if (strCommand == "Game_Dancer_Y") {
string[] strSplit = strParam.Split(',');
for (int i = 0; i < nDancerCount; i++) {
OpenTaiko.Skin.Game_Dancer_Y[i] = int.Parse(strSplit[i]);
}
} else if (strCommand == "Game_Dancer_Motion") {
OpenTaiko.Skin.Game_Dancer_Motion = strParam;
} 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 < nDancerCount; i++) {
OpenTaiko.Skin.Game_Dancer_Gauge[i] = int.Parse(strSplit[i]);
}
}
}
continue;
} catch (Exception exception) {
Trace.TraceError(exception.ToString());
Trace.TraceError("例外が発生しましたが処理を継続します。 (6a32cc37-1527-412e-968a-512c1f0135cd)");
continue;
}
}
}
}
//-----------------
#endregion
}
}
using System.Diagnostics;
using FDK;
namespace OpenTaiko {
internal class CActImplDancer : CActivity {
/// <summary>
/// 踊り子
/// </summary>
public CActImplDancer() {
base.IsDeActivated = true;
}
public override void Activate() {
//this.ct踊り子モーション = new CCounter();
if (OpenTaiko.stageSongSelect.nChoosenSongDifficulty[0] == (int)Difficulty.Tower || OpenTaiko.stageSongSelect.nChoosenSongDifficulty[0] == (int)Difficulty.Dan)
return;
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}")) {
var dirs = System.IO.Directory.GetDirectories($@"{dancerOrigindir}");
if (dirs.Length > 0 && preset.DancerSet.Length > 0) {
var _presetPath = (preset != null && preset.DancerSet != null) ? $@"{dancerOrigindir}" + preset.DancerSet[random.Next(0, preset.DancerSet.Length)] : "";
var path = (preset != null && System.IO.Directory.Exists(_presetPath))
? _presetPath
: dirs[random.Next(0, dirs.Length)];
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 = OpenTaiko.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] = OpenTaiko.tテクスチャの生成($@"{path}{Path.DirectorySeparatorChar}{(i + 1)}_In{Path.DirectorySeparatorChar}{p}.png");
}
}
}
nDancerOutPtn = OpenTaiko.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] = OpenTaiko.tテクスチャの生成($@"{path}{Path.DirectorySeparatorChar}{(i + 1)}_Out{Path.DirectorySeparatorChar}{p}.png");
}
}
}
nDancerPtn = OpenTaiko.t連番画像の枚数を数える($@"{path}{Path.DirectorySeparatorChar}1{Path.DirectorySeparatorChar}");
if (nDancerPtn != 0) {
for (int i = 0; i < nDancerCount; i++) {
Dancer[i] = new CTexture[nDancerPtn];
for (int p = 0; p < nDancerPtn; p++) {
Dancer[i][p] = OpenTaiko.tテクスチャの生成($@"{path}{Path.DirectorySeparatorChar}{(i + 1)}{Path.DirectorySeparatorChar}{p}.png");
}
}
}
}
}
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(OpenTaiko.Skin.Game_Dancer_Motion);
if (this.ar踊り子モーション番号 == null) ar踊り子モーション番号 = CConversion.StringToIntArray("0,0");
nNowDancerCounter = 0;
nNowDancerFrame = 0;
base.Activate();
}
public override void DeActivate() {
if (OpenTaiko.stageSongSelect.nChoosenSongDifficulty[0] == (int)Difficulty.Tower || OpenTaiko.stageSongSelect.nChoosenSongDifficulty[0] == (int)Difficulty.Dan)
return;
//this.ct踊り子モーション = null;
for (int i = 0; i < nDancerCount; i++) {
OpenTaiko.t安全にDisposeする(ref Dancer_In[i]);
OpenTaiko.t安全にDisposeする(ref Dancer_Out[i]);
OpenTaiko.t安全にDisposeする(ref Dancer[i]);
}
base.DeActivate();
}
public override void CreateManagedResource() {
base.CreateManagedResource();
}
public override void ReleaseManagedResource() {
base.ReleaseManagedResource();
}
public override int Draw() {
if (this.IsFirstDraw) {
this.IsFirstDraw = true;
}
if (OpenTaiko.stageSongSelect.nChoosenSongDifficulty[0] != (int)Difficulty.Tower && OpenTaiko.stageSongSelect.nChoosenSongDifficulty[0] != (int)Difficulty.Dan) {
if (OpenTaiko.ConfigIni.ShowDancer && (this.ar踊り子モーション番号.Length - 1) != 0) {
if (!OpenTaiko.stage演奏ドラム画面.bPAUSE) nNowDancerCounter += Math.Abs((float)OpenTaiko.stage演奏ドラム画面.actPlayInfo.dbBPM[0] / 60.0f) * (float)OpenTaiko.FPS.DeltaTime / nDancerBeat;
if (nNowDancerCounter >= 1) {
nNowDancerCounter = 0;
}
nNowDancerFrame = (int)(nNowDancerCounter * (this.ar踊り子モーション番号.Length - 1));
for (int i = 0; i < nDancerCount; i++) {
if ((int)OpenTaiko.stage演奏ドラム画面.actGauge.db現在のゲージ値[0] >= OpenTaiko.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 (!OpenTaiko.stage演奏ドラム画面.bPAUSE) nNowDancerInCounter[i] += Math.Abs((float)OpenTaiko.stage演奏ドラム画面.actPlayInfo.dbBPM[0] / nDancerInInterval) * (float)OpenTaiko.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中心基準描画(OpenTaiko.Skin.Game_Dancer_X[i], OpenTaiko.Skin.Game_Dancer_Y[i]);
}
}
}
break;
case 2: {
if (nDancerOutInterval == 0) {
DancerStates[i] = 0;
} else {
if (!OpenTaiko.stage演奏ドラム画面.bPAUSE) nNowDancerOutCounter[i] += Math.Abs((float)OpenTaiko.stage演奏ドラム画面.actPlayInfo.dbBPM[0] / nDancerOutInterval) * (float)OpenTaiko.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中心基準描画(OpenTaiko.Skin.Game_Dancer_X[i], OpenTaiko.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中心基準描画(OpenTaiko.Skin.Game_Dancer_X[i], OpenTaiko.Skin.Game_Dancer_Y[i]);
}
break;
}
}
}
}
return base.Draw();
}
#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) {
var _str = "";
OpenTaiko.Skin.LoadSkinConfigFromFile(dancerPath + @$"{Path.DirectorySeparatorChar}DancerConfig.txt", ref _str);
string[] delimiter = { "\n" };
string[] strSingleLine = _str.Split(delimiter, StringSplitOptions.RemoveEmptyEntries);
OpenTaiko.Skin.Game_Dancer_X = new int[] { 640, 430, 856, 215, 1070 };
OpenTaiko.Skin.Game_Dancer_Y = new int[] { 500, 500, 500, 500, 500 };
nDancerCount = 5;
nDancerInInterval = 0;
nDancerOutInterval = 0;
foreach (string s in strSingleLine) {
string str = s.Replace('\t', ' ').TrimStart(new char[] { '\t', ' ' });
if ((str.Length != 0) && (str[0] != ';')) {
try {
string strCommand;
string strParam;
string[] strArray = str.Split(new char[] { '=' });
if (strArray.Length == 2) {
strCommand = strArray[0].Trim();
strParam = strArray[1].Trim();
if (strCommand == "Game_Dancer_Count") {
nDancerCount = int.Parse(strParam);
OpenTaiko.Skin.Game_Dancer_X = new int[nDancerCount];
OpenTaiko.Skin.Game_Dancer_Y = new int[nDancerCount];
} else if (strCommand == "Game_Dancer_X") {
string[] strSplit = strParam.Split(',');
for (int i = 0; i < nDancerCount; i++) {
OpenTaiko.Skin.Game_Dancer_X[i] = int.Parse(strSplit[i]);
}
} else if (strCommand == "Game_Dancer_Y") {
string[] strSplit = strParam.Split(',');
for (int i = 0; i < nDancerCount; i++) {
OpenTaiko.Skin.Game_Dancer_Y[i] = int.Parse(strSplit[i]);
}
} else if (strCommand == "Game_Dancer_Motion") {
OpenTaiko.Skin.Game_Dancer_Motion = strParam;
} 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 < nDancerCount; i++) {
OpenTaiko.Skin.Game_Dancer_Gauge[i] = int.Parse(strSplit[i]);
}
}
}
continue;
} catch (Exception exception) {
Trace.TraceError(exception.ToString());
Trace.TraceError("例外が発生しましたが処理を継続します。 (6a32cc37-1527-412e-968a-512c1f0135cd)");
continue;
}
}
}
}
//-----------------
#endregion
}
}

View File

@ -1,60 +1,60 @@
using FDK;
namespace OpenTaiko {
internal class CActImplFooter : CActivity {
/// <summary>
/// フッター
/// </summary>
public CActImplFooter() {
base.IsDeActivated = true;
}
public override void Activate() {
var footerDir = CSkin.Path($"{TextureLoader.BASE}{TextureLoader.GAME}{TextureLoader.FOOTER}");
var preset = HScenePreset.GetBGPreset();
if (System.IO.Directory.Exists(footerDir)) {
Random random = new Random();
var upDirs = System.IO.Directory.GetFiles(footerDir);
if (upDirs.Length > 0) {
var _presetPath = (preset != null && preset.FooterSet != null) ? $@"{footerDir}" + preset.FooterSet[random.Next(0, preset.FooterSet.Length)] + ".png" : "";
var path = (preset != null && System.IO.File.Exists(_presetPath))
? _presetPath
: upDirs[random.Next(0, upDirs.Length)];
Mob_Footer = OpenTaiko.tテクスチャの生成(path);
}
}
base.Activate();
}
public override void DeActivate() {
OpenTaiko.tDisposeSafely(ref Mob_Footer);
base.DeActivate();
}
public override void CreateManagedResource() {
base.CreateManagedResource();
}
public override void ReleaseManagedResource() {
base.ReleaseManagedResource();
}
public override int Draw() {
if (this.Mob_Footer != null) {
this.Mob_Footer.t2D描画(0, OpenTaiko.Skin.Resolution[1] - this.Mob_Footer.szTextureSize.Height);
}
return base.Draw();
}
#region[ private ]
//-----------------
public CTexture Mob_Footer;
//-----------------
#endregion
}
}
using FDK;
namespace OpenTaiko {
internal class CActImplFooter : CActivity {
/// <summary>
/// フッター
/// </summary>
public CActImplFooter() {
base.IsDeActivated = true;
}
public override void Activate() {
var footerDir = CSkin.Path($"{TextureLoader.BASE}{TextureLoader.GAME}{TextureLoader.FOOTER}");
var preset = HScenePreset.GetBGPreset();
if (System.IO.Directory.Exists(footerDir)) {
Random random = new Random();
var upDirs = System.IO.Directory.GetFiles(footerDir);
if (upDirs.Length > 0 && preset.FooterSet.Length > 0) {
var _presetPath = (preset != null && preset.FooterSet != null) ? $@"{footerDir}" + preset.FooterSet[random.Next(0, preset.FooterSet.Length)] + ".png" : "";
var path = (preset != null && System.IO.File.Exists(_presetPath))
? _presetPath
: upDirs[random.Next(0, upDirs.Length)];
Mob_Footer = OpenTaiko.tテクスチャの生成(path);
}
}
base.Activate();
}
public override void DeActivate() {
OpenTaiko.tDisposeSafely(ref Mob_Footer);
base.DeActivate();
}
public override void CreateManagedResource() {
base.CreateManagedResource();
}
public override void ReleaseManagedResource() {
base.ReleaseManagedResource();
}
public override int Draw() {
if (this.Mob_Footer != null) {
this.Mob_Footer.t2D描画(0, OpenTaiko.Skin.Resolution[1] - this.Mob_Footer.szTextureSize.Height);
}
return base.Draw();
}
#region[ private ]
//-----------------
public CTexture Mob_Footer;
//-----------------
#endregion
}
}

View File

@ -1,83 +1,83 @@
using FDK;
namespace OpenTaiko {
internal class CActImplMob : CActivity {
/// <summary>
/// 踊り子
/// </summary>
public CActImplMob() {
base.IsDeActivated = true;
}
public override void Activate() {
var mobDir = CSkin.Path($"{TextureLoader.BASE}{TextureLoader.GAME}{TextureLoader.MOB}");
var preset = HScenePreset.GetBGPreset();
if (System.IO.Directory.Exists(mobDir)) {
Random random = new Random();
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)] : "";
var path = (preset != null && System.IO.Directory.Exists(_presetPath))
? _presetPath
: upDirs[random.Next(0, upDirs.Length)];
MobScript = new ScriptBG($@"{path}{Path.DirectorySeparatorChar}Script.lua");
MobScript.Init();
}
}
base.Activate();
}
public override void DeActivate() {
MobScript?.Dispose();
base.DeActivate();
}
public override void CreateManagedResource() {
base.CreateManagedResource();
}
public override void ReleaseManagedResource() {
base.ReleaseManagedResource();
}
public override int Draw() {
if (!OpenTaiko.stage演奏ドラム画面.bDoublePlay) {
if (OpenTaiko.stageSongSelect.nChoosenSongDifficulty[0] != (int)Difficulty.Tower && OpenTaiko.stageSongSelect.nChoosenSongDifficulty[0] != (int)Difficulty.Dan) {
if (!OpenTaiko.stage演奏ドラム画面.bPAUSE) MobScript?.Update();
MobScript?.Draw();
/*
if (HGaugeMethods.UNSAFE_IsRainbow(0))
{
if (!TJAPlayer3.stage演奏ドラム画面.bPAUSE) nNowMobCounter += (Math.Abs((float)TJAPlayer3.stage演奏ドラム画面.actPlayInfo.dbBPM[0] / 60.0f) * (float)TJAPlayer3.FPS.DeltaTime) * 180 / nMobBeat;
bool endAnime = nNowMobCounter >= 180;
if (endAnime)
{
nNowMobCounter = 0;
}
int moveHeight = (int)(70 * (TJAPlayer3.Skin.Resolution[1] / 720.0));
if (Mob != null)
Mob.t2D描画(0, (TJAPlayer3.Skin.Resolution[1] - (Mob.szテクスチャサイズ.Height - moveHeight)) + -((float)Math.Sin(nNowMobCounter * (Math.PI / 180)) * moveHeight));
}
*/
}
}
return base.Draw();
}
#region[ private ]
//-----------------
private ScriptBG MobScript;
//-----------------
#endregion
}
}
using FDK;
namespace OpenTaiko {
internal class CActImplMob : CActivity {
/// <summary>
/// 踊り子
/// </summary>
public CActImplMob() {
base.IsDeActivated = true;
}
public override void Activate() {
var mobDir = CSkin.Path($"{TextureLoader.BASE}{TextureLoader.GAME}{TextureLoader.MOB}");
var preset = HScenePreset.GetBGPreset();
if (System.IO.Directory.Exists(mobDir)) {
Random random = new Random();
var upDirs = System.IO.Directory.GetDirectories(mobDir);
if (upDirs.Length > 0 && preset.MobSet.Length > 0) {
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)];
MobScript = new ScriptBG($@"{path}{Path.DirectorySeparatorChar}Script.lua");
MobScript.Init();
}
}
base.Activate();
}
public override void DeActivate() {
MobScript?.Dispose();
base.DeActivate();
}
public override void CreateManagedResource() {
base.CreateManagedResource();
}
public override void ReleaseManagedResource() {
base.ReleaseManagedResource();
}
public override int Draw() {
if (!OpenTaiko.stage演奏ドラム画面.bDoublePlay) {
if (OpenTaiko.stageSongSelect.nChoosenSongDifficulty[0] != (int)Difficulty.Tower && OpenTaiko.stageSongSelect.nChoosenSongDifficulty[0] != (int)Difficulty.Dan) {
if (!OpenTaiko.stage演奏ドラム画面.bPAUSE) MobScript?.Update();
MobScript?.Draw();
/*
if (HGaugeMethods.UNSAFE_IsRainbow(0))
{
if (!TJAPlayer3.stage演奏ドラム画面.bPAUSE) nNowMobCounter += (Math.Abs((float)TJAPlayer3.stage演奏ドラム画面.actPlayInfo.dbBPM[0] / 60.0f) * (float)TJAPlayer3.FPS.DeltaTime) * 180 / nMobBeat;
bool endAnime = nNowMobCounter >= 180;
if (endAnime)
{
nNowMobCounter = 0;
}
int moveHeight = (int)(70 * (TJAPlayer3.Skin.Resolution[1] / 720.0));
if (Mob != null)
Mob.t2D描画(0, (TJAPlayer3.Skin.Resolution[1] - (Mob.szテクスチャサイズ.Height - moveHeight)) + -((float)Math.Sin(nNowMobCounter * (Math.PI / 180)) * moveHeight));
}
*/
}
}
return base.Draw();
}
#region[ private ]
//-----------------
private ScriptBG MobScript;
//-----------------
#endregion
}
}

View File

@ -1,224 +1,224 @@
using System.Diagnostics;
using System.Drawing;
using System.Runtime.InteropServices;
using FDK;
namespace OpenTaiko {
internal class CActImplRunner : CActivity {
/// <summary>
/// ランナー
/// </summary>
public CActImplRunner() {
base.IsDeActivated = true;
}
public void Start(int Player, bool IsMiss, CDTX.CChip pChip) {
if (Runner != null && !OpenTaiko.ConfigIni.SimpleMode) {
while (stRunners[Index].b使用中) {
Index += 1;
if (Index >= 128) {
Index = 0;
break; // 2018.6.15 IMARER 無限ループが発生するので修正
}
}
if (pChip.nチャンネル番号 < 0x15 || (pChip.nチャンネル番号 >= 0x1A)) {
if (!stRunners[Index].b使用中) {
stRunners[Index].b使用中 = true;
stRunners[Index].nPlayer = Player;
if (IsMiss == true) {
stRunners[Index].nType = 0;
} else {
stRunners[Index].nType = random.Next(1, Type + 1);
}
stRunners[Index].ct進行 = new CCounter(0, OpenTaiko.Skin.Resolution[0], Timer, OpenTaiko.Timer);
stRunners[Index].nOldValue = 0;
stRunners[Index].nNowPtn = 0;
stRunners[Index].fX = 0;
}
}
}
}
public override void Activate() {
if (OpenTaiko.ConfigIni.SimpleMode) {
base.Activate();
return;
}
for (int i = 0; i < 128; i++) {
stRunners[i] = new STRunner();
stRunners[i].b使用中 = false;
stRunners[i].ct進行 = new CCounter();
}
var preset = HScenePreset.GetBGPreset();
Random random = new Random();
var dancerOrigindir = CSkin.Path($"{TextureLoader.BASE}{TextureLoader.GAME}{TextureLoader.RUNNER}");
if (System.IO.Directory.Exists($@"{dancerOrigindir}")) {
var dirs = System.IO.Directory.GetDirectories($@"{dancerOrigindir}");
if (dirs.Length > 0) {
var _presetPath = (preset != null && preset.RunnerSet != null) ? $@"{dancerOrigindir}" + preset.RunnerSet[random.Next(0, preset.RunnerSet.Length)] : "";
var path = (preset != null && System.IO.Directory.Exists(_presetPath))
? _presetPath
: dirs[random.Next(0, dirs.Length)];
LoadRunnerConifg(path);
Runner = OpenTaiko.tテクスチャの生成($@"{path}{Path.DirectorySeparatorChar}Runner.png");
}
}
// フィールド上で代入してたためこちらへ移動。
base.Activate();
}
public override void DeActivate() {
if (OpenTaiko.ConfigIni.SimpleMode) {
base.DeActivate();
return;
}
for (int i = 0; i < 128; i++) {
stRunners[i].ct進行 = null;
}
OpenTaiko.tDisposeSafely(ref Runner);
base.DeActivate();
}
public override void CreateManagedResource() {
base.CreateManagedResource();
}
public override void ReleaseManagedResource() {
base.ReleaseManagedResource();
}
public override int Draw() {
if (OpenTaiko.ConfigIni.SimpleMode) {
return base.Draw();
}
for (int i = 0; i < 128; i++) {
if (stRunners[i].b使用中) {
stRunners[i].nOldValue = stRunners[i].ct進行.CurrentValue;
stRunners[i].ct進行.Tick();
if (stRunners[i].ct進行.IsEnded || stRunners[i].fX > OpenTaiko.Skin.Resolution[0]) {
stRunners[i].ct進行.Stop();
stRunners[i].b使用中 = false;
}
for (int n = stRunners[i].nOldValue; n < stRunners[i].ct進行.CurrentValue; n++) {
stRunners[i].fX += (float)OpenTaiko.stage演奏ドラム画面.actPlayInfo.dbBPM[stRunners[i].nPlayer] / 18;
int Width = OpenTaiko.Skin.Resolution[0] / Ptn;
stRunners[i].nNowPtn = (int)stRunners[i].fX / Width;
}
if (Runner != null) {
if (stRunners[i].nPlayer == 0) {
Runner.t2D描画((int)(StartPoint_X[0] + stRunners[i].fX), StartPoint_Y[0], new Rectangle(stRunners[i].nNowPtn * Size[0], stRunners[i].nType * Size[1], Size[0], Size[1]));
} else {
Runner.t2D描画((int)(StartPoint_X[1] + stRunners[i].fX), StartPoint_Y[1], new Rectangle(stRunners[i].nNowPtn * Size[0], stRunners[i].nType * Size[1], Size[0], Size[1]));
}
}
}
}
return base.Draw();
}
#region[ private ]
//-----------------
[StructLayout(LayoutKind.Sequential)]
private struct STRunner {
public bool b使用中;
public int nPlayer;
public int nType;
public int nOldValue;
public int nNowPtn;
public float fX;
public CCounter ct進行;
}
private STRunner[] stRunners = new STRunner[128];
Random random = new Random();
int Index = 0;
private CTexture Runner;
private void LoadRunnerConifg(string dancerPath) {
var _str = "";
OpenTaiko.Skin.LoadSkinConfigFromFile(dancerPath + @"\RunnerConfig.txt", ref _str);
string[] delimiter = { "\n" };
string[] strSingleLine = _str.Split(delimiter, StringSplitOptions.RemoveEmptyEntries);
Size = new int[2] { 60, 125 };
Ptn = 48;
Type = 4;
StartPoint_X = new int[2] { 175, 175 };
StartPoint_Y = new int[2] { 40, 560 };
Timer = 16;
foreach (string s in strSingleLine) {
string str = s.Replace('\t', ' ').TrimStart(new char[] { '\t', ' ' });
if ((str.Length != 0) && (str[0] != ';')) {
try {
string strCommand;
string strParam;
string[] strArray = str.Split(new char[] { '=' });
if (strArray.Length == 2) {
strCommand = strArray[0].Trim();
strParam = strArray[1].Trim();
if (strCommand == "Game_Runner_Size") {
string[] strSplit = strParam.Split(',');
for (int i = 0; i < 2; i++) {
Size[i] = int.Parse(strSplit[i]);
}
} else if (strCommand == "Game_Runner_Ptn") {
Ptn = int.Parse(strParam);
} else if (strCommand == "Game_Runner_Type") {
Type = int.Parse(strParam);
} else if (strCommand == "Game_Runner_Timer") {
Timer = int.Parse(strParam);
} else if (strCommand == "Game_Runner_StartPoint_X") {
string[] strSplit = strParam.Split(',');
for (int i = 0; i < 2; i++) {
StartPoint_X[i] = int.Parse(strSplit[i]);
}
} else if (strCommand == "Game_Runner_StartPoint_Y") {
string[] strSplit = strParam.Split(',');
for (int i = 0; i < 2; i++) {
StartPoint_Y[i] = int.Parse(strSplit[i]);
}
}
}
continue;
} catch (Exception exception) {
Trace.TraceError(exception.ToString());
Trace.TraceError("例外が発生しましたが処理を継続します。 (6a32cc37-1527-412e-968a-512c1f0135cd)");
continue;
}
}
}
}
// ランナー画像のサイズ。 X, Y
private int[] Size;
// ランナーのコマ数
private int Ptn;
// ランナーのキャラクターのバリエーション(ミス時を含まない)。
private int Type;
private int Timer;
// スタート地点のX座標 1P, 2P
private int[] StartPoint_X;
// スタート地点のY座標 1P, 2P
private int[] StartPoint_Y;
//-----------------
#endregion
}
}
using System.Diagnostics;
using System.Drawing;
using System.Runtime.InteropServices;
using FDK;
namespace OpenTaiko {
internal class CActImplRunner : CActivity {
/// <summary>
/// ランナー
/// </summary>
public CActImplRunner() {
base.IsDeActivated = true;
}
public void Start(int Player, bool IsMiss, CDTX.CChip pChip) {
if (Runner != null && !OpenTaiko.ConfigIni.SimpleMode) {
while (stRunners[Index].b使用中) {
Index += 1;
if (Index >= 128) {
Index = 0;
break; // 2018.6.15 IMARER 無限ループが発生するので修正
}
}
if (pChip.nチャンネル番号 < 0x15 || (pChip.nチャンネル番号 >= 0x1A)) {
if (!stRunners[Index].b使用中) {
stRunners[Index].b使用中 = true;
stRunners[Index].nPlayer = Player;
if (IsMiss == true) {
stRunners[Index].nType = 0;
} else {
stRunners[Index].nType = random.Next(1, Type + 1);
}
stRunners[Index].ct進行 = new CCounter(0, OpenTaiko.Skin.Resolution[0], Timer, OpenTaiko.Timer);
stRunners[Index].nOldValue = 0;
stRunners[Index].nNowPtn = 0;
stRunners[Index].fX = 0;
}
}
}
}
public override void Activate() {
if (OpenTaiko.ConfigIni.SimpleMode) {
base.Activate();
return;
}
for (int i = 0; i < 128; i++) {
stRunners[i] = new STRunner();
stRunners[i].b使用中 = false;
stRunners[i].ct進行 = new CCounter();
}
var preset = HScenePreset.GetBGPreset();
Random random = new Random();
var dancerOrigindir = CSkin.Path($"{TextureLoader.BASE}{TextureLoader.GAME}{TextureLoader.RUNNER}");
if (System.IO.Directory.Exists($@"{dancerOrigindir}")) {
var dirs = System.IO.Directory.GetDirectories($@"{dancerOrigindir}");
if (dirs.Length > 0 && preset.RunnerSet.Length > 0) {
var _presetPath = (preset != null && preset.RunnerSet != null) ? $@"{dancerOrigindir}" + preset.RunnerSet[random.Next(0, preset.RunnerSet.Length)] : "";
var path = (preset != null && System.IO.Directory.Exists(_presetPath))
? _presetPath
: dirs[random.Next(0, dirs.Length)];
LoadRunnerConifg(path);
Runner = OpenTaiko.tテクスチャの生成($@"{path}{Path.DirectorySeparatorChar}Runner.png");
}
}
// フィールド上で代入してたためこちらへ移動。
base.Activate();
}
public override void DeActivate() {
if (OpenTaiko.ConfigIni.SimpleMode) {
base.DeActivate();
return;
}
for (int i = 0; i < 128; i++) {
stRunners[i].ct進行 = null;
}
OpenTaiko.tDisposeSafely(ref Runner);
base.DeActivate();
}
public override void CreateManagedResource() {
base.CreateManagedResource();
}
public override void ReleaseManagedResource() {
base.ReleaseManagedResource();
}
public override int Draw() {
if (OpenTaiko.ConfigIni.SimpleMode) {
return base.Draw();
}
for (int i = 0; i < 128; i++) {
if (stRunners[i].b使用中) {
stRunners[i].nOldValue = stRunners[i].ct進行.CurrentValue;
stRunners[i].ct進行.Tick();
if (stRunners[i].ct進行.IsEnded || stRunners[i].fX > OpenTaiko.Skin.Resolution[0]) {
stRunners[i].ct進行.Stop();
stRunners[i].b使用中 = false;
}
for (int n = stRunners[i].nOldValue; n < stRunners[i].ct進行.CurrentValue; n++) {
stRunners[i].fX += (float)OpenTaiko.stage演奏ドラム画面.actPlayInfo.dbBPM[stRunners[i].nPlayer] / 18;
int Width = OpenTaiko.Skin.Resolution[0] / Ptn;
stRunners[i].nNowPtn = (int)stRunners[i].fX / Width;
}
if (Runner != null) {
if (stRunners[i].nPlayer == 0) {
Runner.t2D描画((int)(StartPoint_X[0] + stRunners[i].fX), StartPoint_Y[0], new Rectangle(stRunners[i].nNowPtn * Size[0], stRunners[i].nType * Size[1], Size[0], Size[1]));
} else {
Runner.t2D描画((int)(StartPoint_X[1] + stRunners[i].fX), StartPoint_Y[1], new Rectangle(stRunners[i].nNowPtn * Size[0], stRunners[i].nType * Size[1], Size[0], Size[1]));
}
}
}
}
return base.Draw();
}
#region[ private ]
//-----------------
[StructLayout(LayoutKind.Sequential)]
private struct STRunner {
public bool b使用中;
public int nPlayer;
public int nType;
public int nOldValue;
public int nNowPtn;
public float fX;
public CCounter ct進行;
}
private STRunner[] stRunners = new STRunner[128];
Random random = new Random();
int Index = 0;
private CTexture Runner;
private void LoadRunnerConifg(string dancerPath) {
var _str = "";
OpenTaiko.Skin.LoadSkinConfigFromFile(dancerPath + @"\RunnerConfig.txt", ref _str);
string[] delimiter = { "\n" };
string[] strSingleLine = _str.Split(delimiter, StringSplitOptions.RemoveEmptyEntries);
Size = new int[2] { 60, 125 };
Ptn = 48;
Type = 4;
StartPoint_X = new int[2] { 175, 175 };
StartPoint_Y = new int[2] { 40, 560 };
Timer = 16;
foreach (string s in strSingleLine) {
string str = s.Replace('\t', ' ').TrimStart(new char[] { '\t', ' ' });
if ((str.Length != 0) && (str[0] != ';')) {
try {
string strCommand;
string strParam;
string[] strArray = str.Split(new char[] { '=' });
if (strArray.Length == 2) {
strCommand = strArray[0].Trim();
strParam = strArray[1].Trim();
if (strCommand == "Game_Runner_Size") {
string[] strSplit = strParam.Split(',');
for (int i = 0; i < 2; i++) {
Size[i] = int.Parse(strSplit[i]);
}
} else if (strCommand == "Game_Runner_Ptn") {
Ptn = int.Parse(strParam);
} else if (strCommand == "Game_Runner_Type") {
Type = int.Parse(strParam);
} else if (strCommand == "Game_Runner_Timer") {
Timer = int.Parse(strParam);
} else if (strCommand == "Game_Runner_StartPoint_X") {
string[] strSplit = strParam.Split(',');
for (int i = 0; i < 2; i++) {
StartPoint_X[i] = int.Parse(strSplit[i]);
}
} else if (strCommand == "Game_Runner_StartPoint_Y") {
string[] strSplit = strParam.Split(',');
for (int i = 0; i < 2; i++) {
StartPoint_Y[i] = int.Parse(strSplit[i]);
}
}
}
continue;
} catch (Exception exception) {
Trace.TraceError(exception.ToString());
Trace.TraceError("例外が発生しましたが処理を継続します。 (6a32cc37-1527-412e-968a-512c1f0135cd)");
continue;
}
}
}
}
// ランナー画像のサイズ。 X, Y
private int[] Size;
// ランナーのコマ数
private int Ptn;
// ランナーのキャラクターのバリエーション(ミス時を含まない)。
private int Type;
private int Timer;
// スタート地点のX座標 1P, 2P
private int[] StartPoint_X;
// スタート地点のY座標 1P, 2P
private int[] StartPoint_Y;
//-----------------
#endregion
}
}