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

各ポジション選定の条件の作り替え、希少プレースタイルのオンオフ機能追加
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 = {
// 4-1-2-3 (例): 上からFW, 攻撃MF行, 守備MF行, DF行, GK行
// =========================
// 4-1-2-3
// =========================
// 上から FW3列 / 攻撃MF2 / 守備MF1 / DF4 / GK
'4-1-2-3': [
// FW (3)
[
{'x': 0.25, 'y': 0.08}, // LW
{'x': 0.5, 'y': 0.06}, // CF
{'x': 0.75, 'y': 0.08}, // RW
{'x': 0.20, 'y': 0.08}, // LWG
{'x': 0.50, 'y': 0.06}, // CF
{'x': 0.80, 'y': 0.08}, // RWG
],
// 攻撃的MF2
[
{'x': 0.4, 'y': 0.25},
{'x': 0.6, 'y': 0.25},
{'x': 0.40, 'y': 0.22},
{'x': 0.60, 'y': 0.22},
],
// 守備的MF1
[
{'x': 0.5, 'y': 0.4},
{'x': 0.50, 'y': 0.35},
],
// DF (4)
[
{'x': 0.15, 'y': 0.58},
{'x': 0.35, 'y': 0.55},
{'x': 0.65, 'y': 0.55},
{'x': 0.85, 'y': 0.58},
{'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.5, 'y': 0.86},
{'x': 0.50, 'y': 0.86},
],
],
// 4-3-3
// =========================
// 4-3-3
// =========================
'4-3-3': [
// FW (3)
[
{'x': 0.2, 'y': 0.08},
{'x': 0.5, 'y': 0.06},
{'x': 0.8, 'y': 0.08},
{'x': 0.20, 'y': 0.08},
{'x': 0.50, 'y': 0.06},
{'x': 0.80, 'y': 0.08},
],
// MF (3)
[
{'x': 0.3, 'y': 0.26},
{'x': 0.5, 'y': 0.24},
{'x': 0.7, 'y': 0.26},
{'x': 0.30, 'y': 0.24},
{'x': 0.50, 'y': 0.26},
{'x': 0.70, 'y': 0.24},
],
// DF (4)
[
{'x': 0.2, 'y': 0.52},
{'x': 0.4, 'y': 0.5},
{'x': 0.6, 'y': 0.5},
{'x': 0.8, 'y': 0.52},
{'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.5, 'y': 0.86},
{'x': 0.50, 'y': 0.86},
],
],
// =========================
// 4-4-2
// =========================
'4-4-2': [
// FW (2)
[
{'x': 0.35, 'y': 0.08},
{'x': 0.65, 'y': 0.08},
],
// MF (4)
[
{'x': 0.2, 'y': 0.26},
{'x': 0.4, 'y': 0.26},
{'x': 0.6, 'y': 0.26},
{'x': 0.8, 'y': 0.26},
{'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 (4)
[
{'x': 0.15, 'y': 0.52},
{'x': 0.35, 'y': 0.5},
{'x': 0.65, 'y': 0.5},
{'x': 0.85, 'y': 0.52},
{'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.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.6, 'y': 0.08},
{'x': 0.50, 'y': 0.06},
],
// 2列目 (2)
[
{'x': 0.3, 'y': 0.26},
{'x': 0.5, 'y': 0.24},
{'x': 0.7, 'y': 0.26},
{'x': 0.35, 'y': 0.18},
{'x': 0.65, 'y': 0.18},
],
// 3列目 (3)
[
{'x': 0.12, 'y': 0.52},
{'x': 0.32, 'y': 0.5},
{'x': 0.5, 'y': 0.48},
{'x': 0.68, 'y': 0.5},
{'x': 0.88, 'y': 0.52},
{'x': 0.25, 'y': 0.30},
{'x': 0.50, 'y': 0.32},
{'x': 0.75, 'y': 0.30},
],
// 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;
}
// カード:表示はプレースタイルのみ
Widget _buildPlayerCard(String pos, String style) {
final color = _getColor(pos);
Widget _buildPlayerCard(String pos, String style) {
final color = _getColor(pos);
return Container(
width: 80,
height: 60,
decoration: BoxDecoration(
color: color.withOpacity(0.9),
borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.white, width: 1),
),
padding: const EdgeInsets.all(4),
child: Center(
child: Text(
style,
textAlign: TextAlign.center,
maxLines: 3,
overflow: TextOverflow.ellipsis,
return Container(
width: 80,
height: 60,
decoration: BoxDecoration(
color: color.withOpacity(0.9),
borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.white, width: 1),
),
padding: const EdgeInsets.all(4),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
pos, // ★ポジション表示復活
style: const TextStyle(
color: Colors.white,
fontSize: 11,
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) {
final layout = formationLayouts[formation];
if (layout == null) {
return Center(
child: Text(
'レイアウトが定義されていません: $formation',
style: const TextStyle(color: Colors.white),
),
);
}
Widget _buildPitch(String formation, List<Map<String, String>> roles) {
// ★ 直接 formationLayouts を見ず、getFormationLayout を使う
final layout = getFormationLayout(formation);
return LayoutBuilder(
builder: (context, constraints) {
final width = constraints.maxWidth;
final height = constraints.maxHeight;
const cardW = 80.0;
const cardH = 60.0;
return LayoutBuilder(
builder: (context, constraints) {
final width = constraints.maxWidth;
final height = constraints.maxHeight;
const cardW = 80.0;
const cardH = 60.0;
final List<Widget> children = [];
final List<Widget> children = [];
// 背景(ピッチ)
children.add(Container(
width: width,
height: height,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.green.shade800, Colors.green.shade700],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
// 背景
children.add(Container(
width: width,
height: height,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.green.shade800, Colors.green.shade700],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
));
),
));
int index = 0;
int index = 0;
for (int row = 0; row < layout.length; row++) {
for (int col = 0; col < layout[row].length; col++) {
if (index >= roles.length) break;
for (int row = 0; row < layout.length; row++) {
for (int col = 0; col < layout[row].length; col++) {
if (index >= roles.length) break;
final posData = roles[index];
index++;
final posData = roles[index];
index++;
final xNorm = layout[row][col]['x'] ?? 0.5;
final yNorm = layout[row][col]['y'] ?? 0.5;
final xNorm = layout[row][col]['x'] ?? 0.5;
final yNorm = layout[row][col]['y'] ?? 0.5;
final left = width * xNorm - cardW / 2;
final top = height * yNorm - cardH / 2;
final left = width * xNorm - cardW / 2;
final top = height * yNorm - cardH / 2;
children.add(
Positioned(
left: left,
top: top,
child: _buildPlayerCard(
posData['pos'] ?? '',
posData['style'] ?? '',
),
children.add(
Positioned(
left: left,
top: top,
child: _buildPlayerCard(
posData['pos'] ?? '',
posData['style'] ?? '',
),
);
}
),
);
}
}
return Stack(children: children);
},
);
}
return Stack(children: children);
},
);
}
@override
Widget build(BuildContext context) {
@@ -172,7 +176,7 @@ class _HomeScreenState extends State<HomeScreen> {
// 低確率モードスイッチ
SwitchListTile(
title: const Text(
'低確率スタイルモード(デコイラン等の出現率を下げる)',
'希少なプレースタイルを確率UP(デコイラン等)',
style: TextStyle(color: Colors.white),
),
value: _lowProbabilityMode,

View File

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