"/" にファイルをアップロード

各ポジション選定の条件の作り替え、希少プレースタイルのオンオフ機能追加
This commit is contained in:
2025-12-16 11:54:03 +09:00
parent e4a0f60f3c
commit a34ea86cbc
3 changed files with 531 additions and 122 deletions

View File

@@ -1,101 +1,505 @@
// フォーメーションごとの座標配置と役割キーposは最終役割を示唆するが、実際の役割は生成ロジックで上書きされます // フォーメーションごとの座標配置(イーフトっぽい並び
final Map<String, List<List<Map<String, double>>>> formationLayouts = { final Map<String, List<List<Map<String, double>>>> formationLayouts = {
// 4-1-2-3 (例): 上からFW, 攻撃MF行, 守備MF行, DF行, GK行 // =========================
// 4-1-2-3
// =========================
// 上から FW3列 / 攻撃MF2 / 守備MF1 / DF4 / GK
'4-1-2-3': [ '4-1-2-3': [
// FW (3) // FW (3)
[ [
{'x': 0.25, 'y': 0.08}, // LW {'x': 0.20, 'y': 0.08}, // LWG
{'x': 0.5, 'y': 0.06}, // CF {'x': 0.50, 'y': 0.06}, // CF
{'x': 0.75, 'y': 0.08}, // RW {'x': 0.80, 'y': 0.08}, // RWG
], ],
// 攻撃的MF2 // 攻撃的MF2
[ [
{'x': 0.4, 'y': 0.25}, {'x': 0.40, 'y': 0.22},
{'x': 0.6, 'y': 0.25}, {'x': 0.60, 'y': 0.22},
], ],
// 守備的MF1 // 守備的MF1
[ [
{'x': 0.5, 'y': 0.4}, {'x': 0.50, 'y': 0.35},
], ],
// DF (4) // DF (4)
[ [
{'x': 0.15, 'y': 0.58}, {'x': 0.15, 'y': 0.55},
{'x': 0.35, 'y': 0.55}, {'x': 0.35, 'y': 0.53},
{'x': 0.65, 'y': 0.55}, {'x': 0.65, 'y': 0.53},
{'x': 0.85, 'y': 0.58}, {'x': 0.85, 'y': 0.55},
], ],
// GK // GK
[ [
{'x': 0.5, 'y': 0.86}, {'x': 0.50, 'y': 0.86},
], ],
], ],
// 4-3-3 // =========================
// 4-3-3
// =========================
'4-3-3': [ '4-3-3': [
// FW (3)
[ [
{'x': 0.2, 'y': 0.08}, {'x': 0.20, 'y': 0.08},
{'x': 0.5, 'y': 0.06}, {'x': 0.50, 'y': 0.06},
{'x': 0.8, 'y': 0.08}, {'x': 0.80, 'y': 0.08},
], ],
// MF (3)
[ [
{'x': 0.3, 'y': 0.26}, {'x': 0.30, 'y': 0.24},
{'x': 0.5, 'y': 0.24}, {'x': 0.50, 'y': 0.26},
{'x': 0.7, 'y': 0.26}, {'x': 0.70, 'y': 0.24},
], ],
// DF (4)
[ [
{'x': 0.2, 'y': 0.52}, {'x': 0.15, 'y': 0.55},
{'x': 0.4, 'y': 0.5}, {'x': 0.35, 'y': 0.53},
{'x': 0.6, 'y': 0.5}, {'x': 0.65, 'y': 0.53},
{'x': 0.8, 'y': 0.52}, {'x': 0.85, 'y': 0.55},
], ],
// GK
[ [
{'x': 0.5, 'y': 0.86}, {'x': 0.50, 'y': 0.86},
], ],
], ],
// =========================
// 4-4-2 // 4-4-2
// =========================
'4-4-2': [ '4-4-2': [
// FW (2)
[ [
{'x': 0.35, 'y': 0.08}, {'x': 0.35, 'y': 0.08},
{'x': 0.65, 'y': 0.08}, {'x': 0.65, 'y': 0.08},
], ],
// MF (4)
[ [
{'x': 0.2, 'y': 0.26}, {'x': 0.20, 'y': 0.24},
{'x': 0.4, 'y': 0.26}, {'x': 0.40, 'y': 0.24},
{'x': 0.6, 'y': 0.26}, {'x': 0.60, 'y': 0.24},
{'x': 0.8, 'y': 0.26}, {'x': 0.80, 'y': 0.24},
], ],
// DF (4)
[ [
{'x': 0.15, 'y': 0.52}, {'x': 0.15, 'y': 0.55},
{'x': 0.35, 'y': 0.5}, {'x': 0.35, 'y': 0.53},
{'x': 0.65, 'y': 0.5}, {'x': 0.65, 'y': 0.53},
{'x': 0.85, 'y': 0.52}, {'x': 0.85, 'y': 0.55},
], ],
// GK
[ [
{'x': 0.5, 'y': 0.86}, {'x': 0.50, 'y': 0.86},
], ],
], ],
// 5-3-2 // =========================
'5-3-2': [ // 4-3-2-1クリスマスツリー気味
// =========================
'4-3-2-1': [
// FW (1)
[ [
{'x': 0.4, 'y': 0.08}, {'x': 0.50, 'y': 0.06},
{'x': 0.6, 'y': 0.08},
], ],
// 2列目 (2)
[ [
{'x': 0.3, 'y': 0.26}, {'x': 0.35, 'y': 0.18},
{'x': 0.5, 'y': 0.24}, {'x': 0.65, 'y': 0.18},
{'x': 0.7, 'y': 0.26},
], ],
// 3列目 (3)
[ [
{'x': 0.12, 'y': 0.52}, {'x': 0.25, 'y': 0.30},
{'x': 0.32, 'y': 0.5}, {'x': 0.50, 'y': 0.32},
{'x': 0.5, 'y': 0.48}, {'x': 0.75, 'y': 0.30},
{'x': 0.68, 'y': 0.5},
{'x': 0.88, 'y': 0.52},
], ],
// DF (4)
[ [
{'x': 0.5, 'y': 0.86}, {'x': 0.15, 'y': 0.55},
{'x': 0.35, 'y': 0.53},
{'x': 0.65, 'y': 0.53},
{'x': 0.85, 'y': 0.55},
],
// GK
[
{'x': 0.50, 'y': 0.86},
], ],
], ],
};
// =========================
// 4-3-1-2
// =========================
'4-3-1-2': [
// FW (2)
[
{'x': 0.35, 'y': 0.08},
{'x': 0.65, 'y': 0.08},
],
// 2列目 (1)
[
{'x': 0.50, 'y': 0.20},
],
// 3列目 (3)
[
{'x': 0.25, 'y': 0.32},
{'x': 0.50, 'y': 0.34},
{'x': 0.75, 'y': 0.32},
],
// DF (4)
[
{'x': 0.15, 'y': 0.55},
{'x': 0.35, 'y': 0.53},
{'x': 0.65, 'y': 0.53},
{'x': 0.85, 'y': 0.55},
],
// GK
[
{'x': 0.50, 'y': 0.86},
],
],
// =========================
// 4-2-3-1
// =========================
'4-2-3-1': [
// FW (1)
[
{'x': 0.50, 'y': 0.06},
],
// 2列目 (3) 攻撃的MF
[
{'x': 0.25, 'y': 0.20},
{'x': 0.50, 'y': 0.22},
{'x': 0.75, 'y': 0.20},
],
// 3列目 (2) 守備的MF
[
{'x': 0.40, 'y': 0.34},
{'x': 0.60, 'y': 0.34},
],
// DF (4)
[
{'x': 0.15, 'y': 0.55},
{'x': 0.35, 'y': 0.53},
{'x': 0.65, 'y': 0.53},
{'x': 0.85, 'y': 0.55},
],
// GK
[
{'x': 0.50, 'y': 0.86},
],
],
// =========================
// 4-2-1-3
// =========================
'4-2-1-3': [
// FW (3)
[
{'x': 0.20, 'y': 0.08},
{'x': 0.50, 'y': 0.06},
{'x': 0.80, 'y': 0.08},
],
// 2列目 (1)
[
{'x': 0.50, 'y': 0.22},
],
// 3列目 (2)
[
{'x': 0.40, 'y': 0.34},
{'x': 0.60, 'y': 0.34},
],
// DF (4)
[
{'x': 0.15, 'y': 0.55},
{'x': 0.35, 'y': 0.53},
{'x': 0.65, 'y': 0.53},
{'x': 0.85, 'y': 0.55},
],
// GK
[
{'x': 0.50, 'y': 0.86},
],
],
// =========================
// 4-2-2-22ST + 2OH + 2DM
// =========================
'4-2-2-2': [
// FW (2)
[
{'x': 0.35, 'y': 0.08},
{'x': 0.65, 'y': 0.08},
],
// 2列目 (2) OH
[
{'x': 0.30, 'y': 0.20},
{'x': 0.70, 'y': 0.20},
],
// 3列目 (2) DM
[
{'x': 0.40, 'y': 0.34},
{'x': 0.60, 'y': 0.34},
],
// DF (4)
[
{'x': 0.15, 'y': 0.55},
{'x': 0.35, 'y': 0.53},
{'x': 0.65, 'y': 0.53},
{'x': 0.85, 'y': 0.55},
],
// GK
[
{'x': 0.50, 'y': 0.86},
],
],
// =========================
// 3-4-3
// =========================
'3-4-3': [
// FW (3)
[
{'x': 0.20, 'y': 0.08},
{'x': 0.50, 'y': 0.06},
{'x': 0.80, 'y': 0.08},
],
// MF (4)
[
{'x': 0.20, 'y': 0.24},
{'x': 0.40, 'y': 0.24},
{'x': 0.60, 'y': 0.24},
{'x': 0.80, 'y': 0.24},
],
// DF (3)
[
{'x': 0.30, 'y': 0.55},
{'x': 0.50, 'y': 0.53},
{'x': 0.70, 'y': 0.55},
],
// GK
[
{'x': 0.50, 'y': 0.86},
],
],
// =========================
// 3-2-4-1
// =========================
'3-2-4-1': [
// FW (1)
[
{'x': 0.50, 'y': 0.06},
],
// 2列目 (4)
[
{'x': 0.20, 'y': 0.18},
{'x': 0.40, 'y': 0.20},
{'x': 0.60, 'y': 0.20},
{'x': 0.80, 'y': 0.18},
],
// 3列目 (2)
[
{'x': 0.40, 'y': 0.34},
{'x': 0.60, 'y': 0.34},
],
// DF (3)
[
{'x': 0.30, 'y': 0.55},
{'x': 0.50, 'y': 0.53},
{'x': 0.70, 'y': 0.55},
],
// GK
[
{'x': 0.50, 'y': 0.86},
],
],
// =========================
// 3-2-3-2
// =========================
'3-2-3-2': [
// FW (2)
[
{'x': 0.35, 'y': 0.08},
{'x': 0.65, 'y': 0.08},
],
// 2列目 (3)
[
{'x': 0.25, 'y': 0.20},
{'x': 0.50, 'y': 0.22},
{'x': 0.75, 'y': 0.20},
],
// 3列目 (2)
[
{'x': 0.40, 'y': 0.34},
{'x': 0.60, 'y': 0.34},
],
// DF (3)
[
{'x': 0.30, 'y': 0.55},
{'x': 0.50, 'y': 0.53},
{'x': 0.70, 'y': 0.55},
],
// GK
[
{'x': 0.50, 'y': 0.86},
],
],
// =========================
// 3-1-4-2
// =========================
'3-1-4-2': [
// FW (2)
[
{'x': 0.35, 'y': 0.08},
{'x': 0.65, 'y': 0.08},
],
// 2列目 (4)
[
{'x': 0.20, 'y': 0.22},
{'x': 0.40, 'y': 0.24},
{'x': 0.60, 'y': 0.24},
{'x': 0.80, 'y': 0.22},
],
// 3列目 (1)
[
{'x': 0.50, 'y': 0.36},
],
// DF (3)
[
{'x': 0.30, 'y': 0.55},
{'x': 0.50, 'y': 0.53},
{'x': 0.70, 'y': 0.55},
],
// GK
[
{'x': 0.50, 'y': 0.86},
],
],
// =========================
// 5-3-2
// =========================
'5-3-2': [
// FW (2)
[
{'x': 0.40, 'y': 0.08},
{'x': 0.60, 'y': 0.08},
],
// MF (3)
[
{'x': 0.30, 'y': 0.24},
{'x': 0.50, 'y': 0.26},
{'x': 0.70, 'y': 0.24},
],
// DF (5)
[
{'x': 0.12, 'y': 0.52},
{'x': 0.32, 'y': 0.50},
{'x': 0.50, 'y': 0.48},
{'x': 0.68, 'y': 0.50},
{'x': 0.88, 'y': 0.52},
],
// GK
[
{'x': 0.50, 'y': 0.86},
],
],
// =========================
// 5-2-2-1
// =========================
'5-2-2-1': [
// FW (1)
[
{'x': 0.50, 'y': 0.06},
],
// 2列目 (2)
[
{'x': 0.35, 'y': 0.20},
{'x': 0.65, 'y': 0.20},
],
// 3列目 (2)
[
{'x': 0.40, 'y': 0.34},
{'x': 0.60, 'y': 0.34},
],
// DF (5)
[
{'x': 0.12, 'y': 0.52},
{'x': 0.32, 'y': 0.50},
{'x': 0.50, 'y': 0.48},
{'x': 0.68, 'y': 0.50},
{'x': 0.88, 'y': 0.52},
],
// GK
[
{'x': 0.50, 'y': 0.86},
],
],
// =========================
// 5-2-1-2
// =========================
'5-2-1-2': [
// FW (2)
[
{'x': 0.35, 'y': 0.08},
{'x': 0.65, 'y': 0.08},
],
// 2列目 (1)
[
{'x': 0.50, 'y': 0.20},
],
// 3列目 (2)
[
{'x': 0.40, 'y': 0.34},
{'x': 0.60, 'y': 0.34},
],
// DF (5)
[
{'x': 0.12, 'y': 0.52},
{'x': 0.32, 'y': 0.50},
{'x': 0.50, 'y': 0.48},
{'x': 0.68, 'y': 0.50},
{'x': 0.88, 'y': 0.52},
],
// GK
[
{'x': 0.50, 'y': 0.86},
],
],
// =========================
// 5-2-3
// =========================
'5-2-3': [
// FW (3)
[
{'x': 0.20, 'y': 0.08},
{'x': 0.50, 'y': 0.06},
{'x': 0.80, 'y': 0.08},
],
// 2列目 (2)
[
{'x': 0.40, 'y': 0.24},
{'x': 0.60, 'y': 0.24},
],
// DF (5)
[
{'x': 0.12, 'y': 0.52},
{'x': 0.32, 'y': 0.50},
{'x': 0.50, 'y': 0.48},
{'x': 0.68, 'y': 0.50},
{'x': 0.88, 'y': 0.52},
],
// GK
[
{'x': 0.50, 'y': 0.86},
],
],
};
// formation_generator と home_screen からはこの関数だけ使えばOK
List<List<Map<String, double>>> getFormationLayout(String formation) {
return formationLayouts[formation]!;
}

View File

@@ -57,101 +57,105 @@ class _HomeScreenState extends State<HomeScreen> {
return Colors.grey; return Colors.grey;
} }
// カード:表示はプレースタイルのみ Widget _buildPlayerCard(String pos, String style) {
Widget _buildPlayerCard(String pos, String style) { final color = _getColor(pos);
final color = _getColor(pos);
return Container( return Container(
width: 80, width: 80,
height: 60, height: 60,
decoration: BoxDecoration( decoration: BoxDecoration(
color: color.withOpacity(0.9), color: color.withOpacity(0.9),
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.white, width: 1), border: Border.all(color: Colors.white, width: 1),
), ),
padding: const EdgeInsets.all(4), padding: const EdgeInsets.all(4),
child: Center( child: Column(
child: Text( mainAxisAlignment: MainAxisAlignment.center,
style, children: [
textAlign: TextAlign.center, Text(
maxLines: 3, pos, // ★ポジション表示復活
overflow: TextOverflow.ellipsis,
style: const TextStyle( style: const TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 11, fontSize: 11,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
), const SizedBox(height: 2),
); Text(
} style, // プレースタイル
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: const TextStyle(
color: Colors.white,
fontSize: 10,
),
),
],
),
);
}
// ピッチにカードを並べる // ピッチにカードを並べる
Widget _buildPitch(String formation, List<Map<String, String>> roles) { Widget _buildPitch(String formation, List<Map<String, String>> roles) {
final layout = formationLayouts[formation]; // ★ 直接 formationLayouts を見ず、getFormationLayout を使う
if (layout == null) { final layout = getFormationLayout(formation);
return Center(
child: Text(
'レイアウトが定義されていません: $formation',
style: const TextStyle(color: Colors.white),
),
);
}
return LayoutBuilder( return LayoutBuilder(
builder: (context, constraints) { builder: (context, constraints) {
final width = constraints.maxWidth; final width = constraints.maxWidth;
final height = constraints.maxHeight; final height = constraints.maxHeight;
const cardW = 80.0; const cardW = 80.0;
const cardH = 60.0; const cardH = 60.0;
final List<Widget> children = []; final List<Widget> children = [];
// 背景(ピッチ) // 背景
children.add(Container( children.add(Container(
width: width, width: width,
height: height, height: height,
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
colors: [Colors.green.shade800, Colors.green.shade700], colors: [Colors.green.shade800, Colors.green.shade700],
begin: Alignment.topCenter, begin: Alignment.topCenter,
end: Alignment.bottomCenter, end: Alignment.bottomCenter,
),
), ),
)); ),
));
int index = 0; int index = 0;
for (int row = 0; row < layout.length; row++) { for (int row = 0; row < layout.length; row++) {
for (int col = 0; col < layout[row].length; col++) { for (int col = 0; col < layout[row].length; col++) {
if (index >= roles.length) break; if (index >= roles.length) break;
final posData = roles[index]; final posData = roles[index];
index++; index++;
final xNorm = layout[row][col]['x'] ?? 0.5; final xNorm = layout[row][col]['x'] ?? 0.5;
final yNorm = layout[row][col]['y'] ?? 0.5; final yNorm = layout[row][col]['y'] ?? 0.5;
final left = width * xNorm - cardW / 2; final left = width * xNorm - cardW / 2;
final top = height * yNorm - cardH / 2; final top = height * yNorm - cardH / 2;
children.add( children.add(
Positioned( Positioned(
left: left, left: left,
top: top, top: top,
child: _buildPlayerCard( child: _buildPlayerCard(
posData['pos'] ?? '', posData['pos'] ?? '',
posData['style'] ?? '', posData['style'] ?? '',
),
), ),
); ),
} );
} }
}
return Stack(children: children);
},
);
}
return Stack(children: children);
},
);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -172,7 +176,7 @@ class _HomeScreenState extends State<HomeScreen> {
// 低確率モードスイッチ // 低確率モードスイッチ
SwitchListTile( SwitchListTile(
title: const Text( title: const Text(
'低確率スタイルモード(デコイラン等の出現率を下げる)', '希少なプレースタイルを確率UP(デコイラン等)',
style: TextStyle(color: Colors.white), style: TextStyle(color: Colors.white),
), ),
value: _lowProbabilityMode, value: _lowProbabilityMode,

View File

@@ -135,6 +135,7 @@ const lowProbabilityStyles = [
'ターゲットマン', 'ターゲットマン',
'インナーラップサイドバック', 'インナーラップサイドバック',
'オーバーラップ', 'オーバーラップ',
'インサイドレシーバー'
]; ];