1
0
mirror of synced 2025-01-30 19:43:47 +01:00

いろいろ改善15 (#516)

* PopupMenuのエッジを修正

* プリセット可能なランダム背景に対応

* PresetのHelperを追加
This commit is contained in:
Takkkom 2023-10-28 18:09:06 +09:00 committed by GitHub
parent bc891dfc6a
commit e4f6338a63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 141 additions and 109 deletions

View File

@ -9126,7 +9126,6 @@ namespace TJAPlayer3
#endregion
#region Mob
public int Game_Mob_Ptn = 1;
public int Game_Mob_Beat,
Game_Mob_Ptn_Beat = 1;
#endregion

View File

@ -16,16 +16,28 @@ namespace TJAPlayer3
UpperBackground = null;
LowerBackground = null;
DancerSet = null;
FooterSet = null;
MobSet = null;
RunnerSet = null;
}
[JsonProperty("UP")]
public string UpperBackground;
public string[] UpperBackground;
[JsonProperty("DOWN")]
public string LowerBackground;
public string[] LowerBackground;
[JsonProperty("DANCER")]
public string DancerSet;
public string[] DancerSet;
[JsonProperty("FOOTER")]
public string[] FooterSet;
[JsonProperty("MOB")]
public string[] MobSet;
[JsonProperty("RUNNER")]
public string[] RunnerSet;
}
public class SkinPreset
{
@ -33,6 +45,8 @@ namespace TJAPlayer3
{
Regular = new Dictionary<string, SkinScene>();
Dan = new Dictionary<string, SkinScene>();
Tower = new Dictionary<string, SkinScene>();
AI = new Dictionary<string, SkinScene>();
}
@ -42,6 +56,12 @@ namespace TJAPlayer3
[JsonProperty("Dan")]
public Dictionary<string, SkinScene> Dan;
[JsonProperty("Tower")]
public Dictionary<string, SkinScene> Tower;
[JsonProperty("AI")]
public Dictionary<string, SkinScene> AI;
}
}
}

View File

@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using FDK;
namespace TJAPlayer3
{
class HScenePreset
{
public static DBSkinPreset.SkinScene GetBGPreset()
{
string presetSection = "";
if (TJAPlayer3.stage選曲.n確定された曲の難易度[0] == (int)Difficulty.Tower)
{
presetSection = "Tower";
}
else if (TJAPlayer3.stage選曲.n確定された曲の難易度[0] == (int)Difficulty.Dan)
{
presetSection = "Dan";
}
else if (TJAPlayer3.ConfigIni.bAIBattleMode)
{
presetSection = "AI";
}
else
{
presetSection = "Regular";
}
object _ps = null;
switch (presetSection)
{
case "Regular":
_ps = TJAPlayer3.Skin.Game_SkinScenes.Regular;
break;
case "Dan":
_ps = TJAPlayer3.Skin.Game_SkinScenes.Dan;
break;
case "Tower":
_ps = TJAPlayer3.Skin.Game_SkinScenes.Tower;
break;
case "AI":
_ps = TJAPlayer3.Skin.Game_SkinScenes.AI;
break;
default:
break;
};
var preset = (_ps != null
&& TJAPlayer3.stage選曲.r確定された曲.strScenePreset != null
&& ((Dictionary<string, DBSkinPreset.SkinScene>)_ps).ContainsKey(TJAPlayer3.stage選曲.r確定された曲.strScenePreset))
? ((Dictionary<string,DBSkinPreset.SkinScene>)_ps)[TJAPlayer3.stage選曲.r確定された曲.strScenePreset]
: null;
if (_ps != null
&& TJAPlayer3.DTX.scenePreset != null
&& ((Dictionary<string, DBSkinPreset.SkinScene>)_ps).ContainsKey(TJAPlayer3.DTX.scenePreset)) // If currently selected song has valid SCENEPRESET metadata within TJA
{
preset = ((Dictionary<string, DBSkinPreset.SkinScene>)_ps)[TJAPlayer3.DTX.scenePreset];
}
return preset;
}
}
}

View File

@ -481,13 +481,6 @@ namespace TJAPlayer3
#region Mob
TJAPlayer3.Skin.Game_Mob_Ptn = TJAPlayer3.t連番画像の枚数を数える(CSkin.Path(BASE + GAME + MOB));
Mob = new CTexture[TJAPlayer3.Skin.Game_Mob_Ptn];
for (int i = 0; i < TJAPlayer3.Skin.Game_Mob_Ptn; i++)
{
Mob[i] = TxC(GAME + MOB + i.ToString() + ".png");
}
#endregion
#region Taiko
@ -2495,7 +2488,6 @@ namespace TJAPlayer3
#region
public CTexture[] Mob;
#endregion
#region
public CTexture[] Taiko_Base,

View File

@ -417,8 +417,8 @@ namespace TJAPlayer3
}
//font.t文字列描画( (int)(340 * Scale.X), (int)(80 + i * 32), s, bValueBold, 1.0f * Scale.Y);
using (var bmpStr = bValueBold ?
prvFont.DrawText(s, Color.White, Color.Black, null, Color.Yellow, Color.OrangeRed, 0) :
prvFont.DrawText(s, Color.White, Color.Black, null, 0))
prvFont.DrawText(s, Color.White, Color.Black, null, Color.Yellow, Color.OrangeRed, 30) :
prvFont.DrawText(s, Color.White, Color.Black, null, 30))
{
using (var ctStr = TJAPlayer3.tテクスチャの生成(bmpStr, false))
{

View File

@ -24,10 +24,6 @@ namespace TJAPlayer3
}*/
NullCheckAndRender(ref TJAPlayer3.Tx.Effects_GoGoSplash);
for (int i = 0; i < TJAPlayer3.Skin.Game_Mob_Ptn; i++)
{
NullCheckAndRender(ref TJAPlayer3.Tx.Mob[i]);
}
//NullCheckAndRender(ref TJAPlayer3.Tx.PuchiChara);

View File

@ -22,48 +22,10 @@ namespace TJAPlayer3
{
//this.ct踊り子モーション = new CCounter();
string presetSection = "";
if (TJAPlayer3.stage選曲.n確定された曲の難易度[0] == (int)Difficulty.Tower)
{
}
else if (TJAPlayer3.stage選曲.n確定された曲の難易度[0] == (int)Difficulty.Dan)
{
presetSection = "Dan";
}
else if (TJAPlayer3.ConfigIni.bAIBattleMode)
{
}
else
{
presetSection = "Regular";
}
if (TJAPlayer3.stage選曲.n確定された曲の難易度[0] == (int)Difficulty.Tower || TJAPlayer3.stage選曲.n確定された曲の難易度[0] == (int)Difficulty.Dan)
return;
object _ps = null;
switch (presetSection)
{
case "Regular":
_ps = TJAPlayer3.Skin.Game_SkinScenes.Regular;
break;
case "Dan":
_ps = TJAPlayer3.Skin.Game_SkinScenes.Dan;
break;
default:
break;
};
var preset = (_ps != null
&& TJAPlayer3.stage選曲.r確定された曲.strScenePreset != null
&& ((Dictionary<string, DBSkinPreset.SkinScene>)_ps).ContainsKey(TJAPlayer3.stage選曲.r確定された曲.strScenePreset))
? ((Dictionary<string,DBSkinPreset.SkinScene>)_ps)[TJAPlayer3.stage選曲.r確定された曲.strScenePreset]
: null;
if (_ps != null
&& TJAPlayer3.DTX.scenePreset != null
&& ((Dictionary<string, DBSkinPreset.SkinScene>)_ps).ContainsKey(TJAPlayer3.DTX.scenePreset)) // If currently selected song has valid SCENEPRESET metadata within TJA
{
preset = ((Dictionary<string, DBSkinPreset.SkinScene>)_ps)[TJAPlayer3.DTX.scenePreset];
}
var preset = HScenePreset.GetBGPreset();
Random random = new Random();
Dancer = new CTexture[5][];
@ -74,7 +36,7 @@ namespace TJAPlayer3
var dirs = System.IO.Directory.GetDirectories($@"{dancerOrigindir}");
if (dirs.Length > 0)
{
var _presetPath = (preset != null) ? $@"{dancerOrigindir}" + preset.DancerSet : "";
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)];
@ -107,6 +69,9 @@ namespace TJAPlayer3
public override void DeActivate()
{
if (TJAPlayer3.stage選曲.n確定された曲の難易度[0] == (int)Difficulty.Tower || TJAPlayer3.stage選曲.n確定された曲の難易度[0] == (int)Difficulty.Dan)
return;
//this.ct踊り子モーション = null;
for (int i = 0; i < 5; i++)

View File

@ -20,6 +20,7 @@ namespace TJAPlayer3
public override void Activate()
{
var footerDir = CSkin.Path($"{TextureLoader.BASE}{TextureLoader.GAME}{TextureLoader.FOOTER}");
var preset = HScenePreset.GetBGPreset();
if (System.IO.Directory.Exists(footerDir))
{
@ -28,9 +29,12 @@ namespace TJAPlayer3
var upDirs = System.IO.Directory.GetFiles(footerDir);
if (upDirs.Length > 0)
{
var upPath = upDirs[random.Next(0, upDirs.Length)];
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 = TJAPlayer3.tテクスチャの生成(upPath);
Mob_Footer = TJAPlayer3.tテクスチャの生成(path);
}
}

View File

@ -19,7 +19,25 @@ namespace TJAPlayer3
public override void Activate()
{
RandomMob = TJAPlayer3.Random.Next(TJAPlayer3.Skin.Game_Mob_Ptn);
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.GetFiles(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))
? _presetPath
: upDirs[random.Next(0, upDirs.Length)];
Mob = TJAPlayer3.tテクスチャの生成(path);
}
}
nMobBeat = TJAPlayer3.Skin.Game_Mob_Beat;
base.Activate();
@ -44,17 +62,8 @@ namespace TJAPlayer3
{
if(!TJAPlayer3.stage演奏ドラム画面.bDoublePlay)
{
if (TJAPlayer3.Skin.Game_Mob_Ptn != 0 && TJAPlayer3.stage選曲.n確定された曲の難易度[0] != (int)Difficulty.Tower && TJAPlayer3.stage選曲.n確定された曲の難易度[0] != (int)Difficulty.Dan)
if (TJAPlayer3.stage選曲.n確定された曲の難易度[0] != (int)Difficulty.Tower && TJAPlayer3.stage選曲.n確定された曲の難易度[0] != (int)Difficulty.Dan)
{
/*
TJAPlayer3.act文字コンソール.tPrint(0, 0, C文字コンソール.Eフォント種別., ctMob.n現在の値.ToString());
TJAPlayer3.act文字コンソール.tPrint(0, 20, C文字コンソール.Eフォント種別., ctMobPtn.n現在の値.ToString());
TJAPlayer3.act文字コンソール.tPrint(0, 30, C文字コンソール.Eフォント種別., ((int)ctMobPtn.n現在の値).ToString());
TJAPlayer3.act文字コンソール.tPrint(0, 40, C文字コンソール.Eフォント種別., TJAPlayer3.stage演奏ドラム画面.actGauge.db現在のゲージ値[0].ToString());
TJAPlayer3.act文字コンソール.tPrint(0, 10, C文字コンソール.Eフォント種別., Math.Sin((float)this.ctMob.n現在の値 * (Math.PI / 180)).ToString());
*/
if (HGaugeMethods.UNSAFE_IsRainbow(0))
{
@ -66,9 +75,10 @@ namespace TJAPlayer3
nNowMobCounter = 0;
}
int moveHeight = (int)(70 * (TJAPlayer3.Skin.Resolution[1] / 720.0));
if (TJAPlayer3.Tx.Mob[RandomMob] != null)
TJAPlayer3.Tx.Mob[RandomMob].t2D描画(0, (TJAPlayer3.Skin.Resolution[1] - (TJAPlayer3.Tx.Mob[RandomMob].szテクスチャサイズ.Height - 70)) + -((float)Math.Sin(nNowMobCounter * (Math.PI / 180)) * 70));
if (Mob != null)
Mob.t2D描画(0, (TJAPlayer3.Skin.Resolution[1] - (Mob.szテクスチャサイズ.Height - moveHeight)) + -((float)Math.Sin(nNowMobCounter * (Math.PI / 180)) * moveHeight));
}
@ -78,9 +88,9 @@ namespace TJAPlayer3
}
#region[ private ]
//-----------------
public CTexture Mob;
private float nNowMobCounter;
private float nMobBeat;
private int RandomMob;
//-----------------
#endregion
}

View File

@ -64,6 +64,8 @@ namespace TJAPlayer3
stRunners[i].ct進行 = new CCounter();
}
var preset = HScenePreset.GetBGPreset();
Random random = new Random();
var dancerOrigindir = CSkin.Path($"{TextureLoader.BASE}{TextureLoader.GAME}{TextureLoader.RUNNER}");
@ -72,7 +74,10 @@ namespace TJAPlayer3
var dirs = System.IO.Directory.GetDirectories($@"{dancerOrigindir}");
if (dirs.Length > 0)
{
var path = dirs[random.Next(0, dirs.Length)];
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 = TJAPlayer3.tテクスチャの生成($@"{path}{Path.DirectorySeparatorChar}Runner.png");

View File

@ -105,7 +105,7 @@ namespace TJAPlayer3
return;
var bgOrigindir = CSkin.Path($"{TextureLoader.BASE}{TextureLoader.GAME}{TextureLoader.BACKGROUND}");
string presetSection = "";
var preset = HScenePreset.GetBGPreset();
if (TJAPlayer3.stage選曲.n確定された曲の難易度[0] == (int)Difficulty.Tower)
{
bgOrigindir += "Tower";
@ -113,7 +113,6 @@ namespace TJAPlayer3
else if (TJAPlayer3.stage選曲.n確定された曲の難易度[0] == (int)Difficulty.Dan)
{
bgOrigindir += "Dan";
presetSection = "Dan";
}
else if (TJAPlayer3.ConfigIni.bAIBattleMode)
{
@ -122,34 +121,6 @@ namespace TJAPlayer3
else
{
bgOrigindir += "Normal";
presetSection = "Regular";
}
object _ps = null;
switch (presetSection)
{
case "Regular":
_ps = TJAPlayer3.Skin.Game_SkinScenes.Regular;
break;
case "Dan":
_ps = TJAPlayer3.Skin.Game_SkinScenes.Dan;
break;
default:
break;
};
var preset = (_ps != null
&& TJAPlayer3.stage選曲.r確定された曲.strScenePreset != null
&& ((Dictionary<string, DBSkinPreset.SkinScene>)_ps).ContainsKey(TJAPlayer3.stage選曲.r確定された曲.strScenePreset))
? ((Dictionary<string,DBSkinPreset.SkinScene>)_ps)[TJAPlayer3.stage選曲.r確定された曲.strScenePreset]
: null;
if (_ps != null
&& TJAPlayer3.DTX.scenePreset != null
&& ((Dictionary<string, DBSkinPreset.SkinScene>)_ps).ContainsKey(TJAPlayer3.DTX.scenePreset)) // If currently selected song has valid SCENEPRESET metadata within TJA
{
preset = ((Dictionary<string, DBSkinPreset.SkinScene>)_ps)[TJAPlayer3.DTX.scenePreset];
}
Random random = new Random();
@ -159,7 +130,7 @@ namespace TJAPlayer3
var upDirs = System.IO.Directory.GetDirectories($@"{bgOrigindir}{Path.DirectorySeparatorChar}Up");
// If there is a preset upper background and this preset exists on the skin use it, else random upper background
var _presetPath = (preset != null) ? $@"{bgOrigindir}{Path.DirectorySeparatorChar}Up{Path.DirectorySeparatorChar}" + preset.UpperBackground : "";
var _presetPath = (preset != null && preset.UpperBackground != null) ? $@"{bgOrigindir}{Path.DirectorySeparatorChar}Up{Path.DirectorySeparatorChar}" + preset.UpperBackground[random.Next(0, preset.UpperBackground.Length)] : "";
var upPath = (preset != null && System.IO.Directory.Exists(_presetPath))
? _presetPath
: upDirs[random.Next(0, upDirs.Length)];
@ -179,7 +150,7 @@ namespace TJAPlayer3
var downDirs = System.IO.Directory.GetDirectories($@"{bgOrigindir}{Path.DirectorySeparatorChar}Down");
// If there is a preset lower background and this preset exists on the skin use it, else random upper background
var _presetPath = (preset != null) ? $@"{bgOrigindir}{Path.DirectorySeparatorChar}Down{Path.DirectorySeparatorChar}" + preset.LowerBackground : "";
var _presetPath = (preset != null && preset.LowerBackground != null) ? $@"{bgOrigindir}{Path.DirectorySeparatorChar}Down{Path.DirectorySeparatorChar}" + preset.LowerBackground[random.Next(0, preset.LowerBackground.Length)] : "";
var downPath = (preset != null && System.IO.Directory.Exists(_presetPath))
? _presetPath
: downDirs[random.Next(0, downDirs.Length)];