%= form_with(model: game, class: "space-y-6") do |form| %>
<% if game.errors.any? %>
<%= pluralize(game.errors.count, "error") %> prohibited this game from being saved:
<% game.errors.each do |error| %>
<%= error.full_message %>
<% end %>
<% end %>
<%= form.label :title, "ゲームタイトル", class: "block text-sm font-medium text-gray-700" %>
<%= form.text_field :title, class: "shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md", placeholder: "例: 定例ディプロマシー会 #1" %>
<% unless game.persisted? %>
<% if current_user&.admin? %>
<%= form.label :game_mode, "ゲームモード", class: "block text-sm font-medium text-gray-700" %>
<%= form.select :game_mode,
options_for_select([
['ソロモード (単独プレイ)', 'admin_mode'],
['マルチプレイヤーモード (複数プレイ)', 'player_mode']
], game.is_solo_mode ? 'admin_mode' : 'player_mode'),
{},
{ id: 'game-mode-select', class: 'shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md' } %>
<% end %>
<%= form.label :participants_count, "参加人数", class: "block text-sm font-medium text-gray-700" %>
<%= form.number_field :participants_count, min: 1, max: 7, step: 1, class: "shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md" %>
1人から7人まで設定可能です。
<%= form.label :password, "パスワード (任意)", class: "block text-sm font-medium text-gray-700" %>
<%= form.password_field :password, class: "shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md" %>
知人同士でプレイする場合など、アクセス制限をかけたい場合に設定してください。
<% end %>
<%= form.label :auto_order_mode, "自動処理モード", class: "block text-sm font-medium text-gray-700" %>
<%= form.select :auto_order_mode,
options_for_select([
['HOLD (待機)', 'hold'],
['ランダム動作', 'random']
], game.auto_order_mode || 'hold'),
{},
{ class: 'shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md' } %>
注文未入力の国や、プレイヤー不在の国の動作を設定します。
<%= form.label :turn_schedule, "ターン進行方式", class: "block text-sm font-medium text-gray-700" %>
<% current_schedule = game.turn_schedule.presence %>
<% preset_value = case current_schedule
when nil then "manual"
when "0" then "daily_0"
else "custom"
end %>
>手動(管理者が処理)
>毎日1回(0時)
>カスタム...
<%= form.hidden_field :turn_schedule, id: "turn_schedule_value", value: current_schedule %>
自動の場合、締切時刻を過ぎると未入力国はAutoOrderで処理され、ターンが自動進行します。
<%= form.label :memo, "メモ", class: "block text-sm font-medium text-gray-700" %>
<%= form.textarea :memo, rows: 3, class: "shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md" %>
ゲームに関するメモや注意事項があれば記載してください。
ハウスルール
<%= form.label :year_limit, "年数制限", class: "block text-sm font-medium text-gray-700" %>
<%= form.number_field :year_limit, min: 1901, max: 1999, step: 1, class: "shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md", placeholder: "空欄 = 無制限" %>
指定した年を超えるとゲームが自動終了します(例: 1910)。空欄で無制限。
<%= form.label :victory_sc_count, "目標SC数", class: "block text-sm font-medium text-gray-700" %>
<%= form.number_field :victory_sc_count, min: 1, max: 34, step: 1, value: game.victory_sc_count || 18, class: "shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md" %>
ソロ勝利に必要なSC数(デフォルト: 18)。
<%= form.label :scoring_system, "スコアリング方式", class: "block text-sm font-medium text-gray-700" %>
<%= form.select :scoring_system,
options_for_select([
['なし', 'none'],
['SC数(獲得SC数がスコア)', 'sc_count'],
['SC比率(全SC中の割合%)', 'sc_ratio'],
['DSS(生存国で均等分割)', 'dss'],
['SoS(二乗和比率)', 'sos']
], game.scoring_system || 'none'),
{},
{ class: 'shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md' } %>
ゲーム終了時のスコア計算方式を選択します。
<%= form.submit "保存する", class: "ml-3 inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500" %>
<% end %>