96 lines
5.4 KiB
C#
96 lines
5.4 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace TKS.OutGame
|
|
{
|
|
/// <summary>
|
|
/// 연의 전기 화면(컨텐츠 모드 기획 10판 ② · 2026-11-18) — **더미 UI**(개발 요청서 §G · 목록형 임시 화면 · 나중 = 집현전 배경 bg_scn_hall + 두루마리 + scn_spots.csv):
|
|
/// 편 목록(편 · 해금 · 연의/열전 진행 ●○) → 편을 누르면 전투 정보 팝업(승리 조건 · 도전 조건 2 · 고정 편성 · 기믹) → 연의 · 열전 입장.
|
|
/// </summary>
|
|
public partial class ArenaScreen
|
|
{
|
|
public const int ScenarioPage = 5;
|
|
|
|
void ScenarioEntryButton()
|
|
{
|
|
UiKit.Btn("Scenario", root, "연의 전기 — 명전 16편", 40, UiKit.Purple, UiKit.White, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -1490f), new Vector2(1032f, 110f), () => SetPage(ScenarioPage));
|
|
}
|
|
|
|
void BuildScenario()
|
|
{
|
|
ContentTables.Reload();
|
|
var d = S.Save;
|
|
Title("연의 전기");
|
|
UiKit.Label(root, "고정 편성 · 고정 능력치(모든 유저 같은 스펙) · 입장 군량 " + ContentTables.Int("scenario", "stamina_cost") + " · 지면 환급", 26, UiKit.InkSoft, TextAnchor.MiddleCenter, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -112f), new Vector2(1032f, 44f), false);
|
|
var list = ScenarioModeRules.Battles();
|
|
float w = 508f, h = 160f;
|
|
for (int i = 0; i < list.Count; i++)
|
|
{
|
|
var b = list[i];
|
|
string id = b.S("s_id");
|
|
float x = 24f + (i % 2) * (w + 16f), y = 166f + (i / 2) * (h + 10f);
|
|
bool open = b.I("n_no") > 0 && ScenarioModeRules.Unlocked(d, b);
|
|
var cell = UiKit.Btn("Ep_" + id, root, "", 26, open ? UiKit.Paper : UiKit.Slot, UiKit.Ink, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(x, -y), new Vector2(w, h), () => ScenarioInfo(id));
|
|
var e = d.scenario.Get(id, false);
|
|
string stars = e == null ? "○○○ / ○○○" : Dots(e.normal) + " / " + Dots(e.hard);
|
|
UiKit.Label(cell.transform, b.I("n_no") + ". " + b.S("s_title_ko") + " <size=22>" + b.I("n_year") + " · " + b.S("s_part") + "</size>", 30, UiKit.Ink, TextAnchor.UpperLeft, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(14f, -10f), new Vector2(w - 28f, 50f), false);
|
|
UiKit.Label(cell.transform, (open ? "주역 " + b.S("l_fixed_hero_ko").Replace(";", " · ") : (b.I("n_no") == 0 ? "서장 = 1장 학습 판" : b.S("s_unlock_ko") + " 뒤 열림")) + "\n연의 · 열전 " + stars, 22, UiKit.InkSoft, TextAnchor.UpperLeft, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(14f, -62f), new Vector2(w - 28f, 90f), false);
|
|
}
|
|
}
|
|
|
|
static string Dots(bool[] a)
|
|
{
|
|
var s = "";
|
|
foreach (var x in a) s += x ? "●" : "○";
|
|
return s;
|
|
}
|
|
|
|
void ScenarioInfo(string id)
|
|
{
|
|
var b = ContentTables.Find("scenario_battles", "s_id", id);
|
|
if (b == null) return;
|
|
var d = S.Save;
|
|
string body = "<b>승리</b> " + b.S("s_win_cond_ko") + "\n<b>도전 1</b> " + b.S("s_challenge1_ko") + "\n<b>도전 2</b> " + b.S("s_challenge2_ko") +
|
|
"\n<b>출전</b> " + b.S("l_fixed_hero_ko").Replace(";", " · ") + (b.S("l_companion_ko").Length > 0 ? " + " + b.S("l_companion_ko").Replace(";", " · ") : "") +
|
|
"\n<b>전장</b> " + b.S("s_gimmick_ko");
|
|
var bt = new List<OutGameRoot.ModalButton>();
|
|
var wn = ScenarioModeRules.Can(S.Db, d, id, false, S.Now);
|
|
bt.Add(new OutGameRoot.ModalButton(wn == null ? "연의 출전" : "연의 — " + wn, wn == null ? UiKit.Red : UiKit.Disabled, () => ScenarioGo(id, false)));
|
|
var wh = ScenarioModeRules.Can(S.Db, d, id, true, S.Now);
|
|
bt.Add(new OutGameRoot.ModalButton(wh == null ? "열전 출전" : "열전 — " + wh, wh == null ? UiKit.Purple : UiKit.Disabled, () => ScenarioGo(id, true)));
|
|
bt.Add(new OutGameRoot.ModalButton("닫기", UiKit.Dark, null));
|
|
Root.Modal(b.S("s_title_ko"), body, bt.ToArray());
|
|
}
|
|
|
|
void ScenarioGo(string id, bool hard)
|
|
{
|
|
var cfg = Root.Battle.Config;
|
|
var stage = new BalanceConfig.StageDef { title = id, subtitle = "연의 전기", kind = StageKind.Normal, aiAccuracy = 1f, aiAggroRange = 999f };
|
|
var b = ContentTables.Find("scenario_battles", "s_id", id);
|
|
int ch, st;
|
|
var refSt = b != null && ArenaRules.ParseStageKey(b.S("s_unlock_stage"), out ch, out st) ? ContentEnemyRef.RefStage(cfg, ch) : null;
|
|
if (refSt != null)
|
|
{
|
|
stage.aiAccuracy = refSt.aiAccuracy;
|
|
stage.aiAggroRange = refSt.aiAggroRange;
|
|
stage.bgTheme = refSt.bgTheme;
|
|
}
|
|
var rules = new ScenarioRules { BattleId = id, Hard = hard, Config = cfg };
|
|
var why = rules.Prepare(stage);
|
|
if (why != null)
|
|
{
|
|
Root.Toast(why);
|
|
return;
|
|
}
|
|
var w = S.ScenarioEnter(id, hard);
|
|
if (w != null)
|
|
{
|
|
Root.Toast(w);
|
|
return;
|
|
}
|
|
Root.StartMode(ScenarioModeRules.Kind, id, hard ? 1 : 0, stage, rules.TurnLimitValue, ScenarioPage, rules);
|
|
}
|
|
}
|
|
}
|