ThreeKingdomsSlingshot/Assets/Tests/PlayMode/ServerLinkTests.cs

1236 lines
73 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections;
using System.Collections.Generic;
using NUnit.Framework;
using TKS.OutGame;
using TKS.OutGame.Net;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
using UnityEngine.TestTools;
using UnityEngine.UI;
namespace TKS.Tests
{
/// <summary>
/// 서버 연결 확인 — 실제 서버에 붙어 「접속 → 1-1 클리어 → 서버에 보상 반영 → 성장 · 편성 반영」을 본다.
/// **서버가 켜져 있어야 한다**(서버 저장소에서 `npx pnpm@10 local:up`) → 평소 테스트 묶음에서는 빠진다(Explicit).
/// 실행 = `unity command --project-path . test run --mode playmode --filter ServerLinkTests --include-explicit --async-tests`.
/// 서버 주소 = 환경 변수 TKS_TEST_SERVER (없으면 표 Resources/Net/server.csv 의 base_url).
/// 기대값은 표에서 읽는다(코드에 수치를 적지 않는다).
/// </summary>
[Explicit("서버가 켜져 있어야 한다 — 서버 저장소에서 npx pnpm@10 local:up")]
[Category("Server")]
public class ServerLinkTests
{
OutGameRoot og;
BattleManager bm;
WorldMapScreen wm;
ServerSync sync;
[TearDown]
public void TearDown()
{
ServerLink.ClearForce(); // 뒤 테스트가 서버 모드로 새지 않게
}
static IEnumerator Until(Func<bool> done, float timeout, string what)
{
float t0 = Time.realtimeSinceStartup;
while (!done())
{
if (Time.realtimeSinceStartup - t0 > timeout) Assert.Fail("시간 초과(" + timeout + "초): " + what);
yield return null;
}
}
IEnumerator Boot()
{
WorldProgress.Reset();
SaveStore.UseMemory(true);
var url = Environment.GetEnvironmentVariable("TKS_TEST_SERVER");
ServerLink.ForceForTest(string.IsNullOrEmpty(url) ? ServerConfig.BaseUrl : url, ServerConfig.GameId);
SceneManager.LoadScene("Battle");
yield return null;
yield return null;
og = OutGameRoot.Instance;
bm = BattleManager.Instance;
wm = WorldMapScreen.Instance;
sync = ServerSync.Instance;
Assert.IsNotNull(og);
Assert.IsNotNull(sync, "서버 모드 세션");
Assert.IsInstanceOf<ServerSession>(og.Session);
yield return Until(() => sync.Ready || sync.LastError != null, 30f, "서버 접속");
Assert.IsTrue(sync.Ready, "서버 접속 실패: " + sync.LastError);
}
/// <summary>서버에 직접 물어본 계정 상태.</summary>
IEnumerator Account(ServerResult res)
{
yield return Until(() => !sync.Busy, 20f, "전송이 끝나기를 기다림");
yield return sync.Client.Send("GET", "/tks/account", null, true, res);
Assert.IsTrue(res.ok, "계정 조회: " + res.error);
}
IEnumerator ClearStage(int node)
{
og.OpenWorldMap();
yield return null;
wm.OpenPopup(node);
wm.ConfirmPopup();
yield return null;
Assert.AreEqual(BattlePhase.PlayerTurn, bm.Phase, "전투 시작");
foreach (var u in bm.AliveUnits(Faction.Enemy)) u.TakeDamage(u.Hp);
bm.CheckBattleEnd();
yield return null;
Assert.AreEqual(BattlePhase.StageClear, bm.Phase);
yield return Until(() => og.Session.LastReward != null, 20f, "전투 종료 → 서버 보상 응답");
}
[UnityTest]
public IEnumerator Clear_1_1_RewardGrowthFormation_LandOnServer()
{
yield return Boot();
var s = og.Session;
var e = s.Db.Economy;
var res = new ServerResult();
string h0 = e.StartHeroes[0];
// 접속: 새 게스트 계정의 초기 지급이 기기에 채워진다(표 값)
Assert.IsTrue(s.IsNewUser, "새 게스트 계정");
Assert.AreEqual(e.StartGold, s.Save.gold, "골드 = start_gold");
Assert.AreEqual(e.StartGem, s.Save.gem, "보옥 = start_gem(유료 0 + 무료)");
Assert.AreEqual(e.StartStamina, s.Save.stamina, "군량 = start_stamina");
Assert.AreEqual(e.StartSkillBooks, s.Save.inv.books.skill, "스킬서 = start_skill_books");
Assert.IsNotNull(s.Save.Hero(h0), "시작 영웅 보유");
// 1-1 첫 클리어 → 보상은 서버 응답 값
int si = wm.StageIndexOf(0, 0);
var stage = bm.Config.stages[si];
int cost = EconomyRules.StageCost(s.Db, s.Save, stage);
var row = s.Db.Rewards.For(stage.chapter);
yield return ClearStage(0);
var r1 = s.LastReward;
Assert.IsTrue(r1.win && r1.first, "첫 클리어");
Assert.AreEqual(3, r1.stars, "1턴 · 전원 생존 = 별 3");
Assert.AreEqual(Mathf.RoundToInt((row.goldBase + stage.stage * e.GoldPerStage) * e.FirstClearGoldMult), r1.gold, "첫 클리어 골드 = 표 계산");
Assert.AreEqual(row.expBase, r1.exp, "첫 클리어 경험 = exp_base");
Assert.IsTrue(og.ResultVisible, "결과 화면");
Assert.AreEqual(e.StartGold + r1.gold, s.Save.gold, "기기 골드");
// 서버에 반영됐는가 — 서버에 직접 묻는다
yield return Account(res);
Assert.AreEqual(stage.chapter + "-" + stage.stage, res.Str("stage.stages[0].key"));
Assert.AreEqual(1, res.Num("stage.stages[0].clears"), "서버: 1-1 클리어 1");
Assert.AreEqual(3, res.Num("stage.stages[0].stars"), "서버: 별 3");
Assert.AreEqual(e.StartStamina - cost, res.Num("account.stamina.amount"), "서버: 군량 차감");
Assert.AreEqual(r1.exp, res.Num("heroes[0].exp"), "서버: 출전 영웅 경험");
Assert.AreEqual(s.Save.gold, ServerGold(res), "서버 골드 = 기기 골드");
// 반복 클리어(보상 × repeat_reward_mult) → 영웅 레벨업이 가능해진다
bm.ContinueAfterResult();
yield return null;
yield return ClearStage(0);
var r2 = s.LastReward;
Assert.IsFalse(r2.first, "반복");
Assert.AreEqual(Mathf.RoundToInt((row.goldBase + stage.stage * e.GoldPerStage) * e.RepeatRewardMult), r2.gold, "반복 골드 = 서버와 기기 반올림이 같다");
bm.ContinueAfterResult();
yield return null;
// 성장: 레벨업(경험이 될 때만 — 표 값에 따라)
var hero = s.Save.Hero(h0);
int lvBefore = hero.lv;
bool canLevel = HeroRules.CanLevelUp(s.Db, s.Save, hero) == null;
if (canLevel) Assert.IsNull(s.LevelUp(h0), "레벨업");
// 편성: 프리셋 1 에 한 명만
Assert.IsNull(s.SavePreset(1, new List<string> { h0 }), "편성 저장");
yield return Account(res);
int hi = -1;
for (int i = 0; i < s.Save.heroes.Count; i++)
if (res.Str("heroes[" + i + "].id") == h0) hi = i;
Assert.GreaterOrEqual(hi, 0, "서버 영웅 목록에 " + h0);
Assert.AreEqual(canLevel ? lvBefore + 1 : lvBefore, res.Num("heroes[" + hi + "].lv"), "서버: 영웅 레벨");
Assert.AreEqual(hero.exp, res.Num("heroes[" + hi + "].exp"), "서버: 남은 경험");
Assert.AreEqual(1, res.Num("formation.presetIdx"), "서버: 출전 프리셋");
Assert.AreEqual(h0, res.Str("formation.presets[1].slots[0]"), "서버: 편성 칸");
Assert.AreEqual("", res.Str("formation.presets[1].slots[1]"));
Assert.AreEqual(2, res.Num("stage.stages[0].clears"), "서버: 1-1 클리어 2");
Assert.AreEqual(s.Save.gold, ServerGold(res), "서버 골드 = 기기 골드(보상 2회 − 레벨업)");
// 조용해지면 서버 상태로 맞춘다 — 맞춘 뒤에도 기기 값이 그대로(서버와 기기 규칙이 같다)
int gold = s.Save.gold, lv = hero.lv, stamina = s.Save.stamina;
yield return Until(() => sync.Reconciles > 0 && !sync.Busy, 20f, "서버 상태로 맞춤");
Assert.AreEqual(0, sync.Rejects, "서버가 거절한 요청 없음: " + sync.LastError);
Assert.AreEqual(gold, s.Save.gold);
Assert.AreEqual(lv, s.Save.Hero(h0).lv);
Assert.AreEqual(stamina, s.Save.stamina);
Assert.AreEqual(1, s.Save.presetIdx);
Assert.AreEqual(2, s.Save.Stage(stage.chapter, stage.stage, false).clears);
}
/// <summary>3단계 — 상자 구매·열기 · 상점 · 개발 · 훈련 · 파견 · 순찰 즉시 수확 · 등용이 서버에 반영된다(결과에 주사위가 든 것은 서버가 정한 값을 받는다).</summary>
[UnityTest]
public IEnumerator Stage3_TradeDomesticTreasureGacha_LandOnServer()
{
yield return Boot();
var s = og.Session;
var db = s.Db;
var e = db.Economy;
var res = new ServerResult();
string h0 = e.StartHeroes[0];
// 상자: 골드로 사서(기기 먼저) 연다(서버가 정한 결과)
var chest = db.Chests.Get(e.StageChest);
int chestPrice = TreasureRules.Price(db, s.Save, chest, "gold");
Assert.Greater(chestPrice, 0, "스테이지 상자를 골드로 판다");
Assert.IsNull(s.BuyChest(chest.id, "gold"), "상자 구매");
ChestResult opened = null;
bool openDone = false;
s.OpenChestAsync(chest.id, x =>
{
opened = x;
openDone = true;
});
yield return Until(() => openDone, 20f, "상자 열기 응답");
Assert.IsNotNull(opened, "상자 열기");
Assert.IsNotNull(opened.treasureId);
Assert.IsNotNull(s.Save.inv.Treasure(opened.treasureId), "받은 보물이 기기 세이브에 있다");
Assert.AreEqual(e.StartGold - chestPrice + opened.gold, s.Save.gold, "골드 = 시작 − 상자 값 + 상자에서 나온 골드");
Assert.AreEqual(0, TreasureRules.ChestCount(s.Save, chest.id));
// 상점: 서버가 깐 진열 → 첫 칸 구매(기기 먼저)
Assert.Greater(s.Save.shop.items.Count, 0, "서버가 깐 상점 진열");
var item = s.Save.shop.items[0];
bool boughtShop = s.Save.gold >= item.price && s.BuyShop(0) == null;
// 개발(선행 조건 없는 노드) · 훈련 · 파견 — 골드가 되는 것만
string devId = null;
foreach (var n in db.Dev.nodes)
if (n.requires.Count == 0 && DevRules.CanUpgrade(db, s.Save, n.id) == null)
{
devId = n.id;
break;
}
if (devId != null) Assert.IsNull(s.DevUpgrade(devId), "개발 레벨업");
var type = s.Def(h0).type;
bool trained = TrainingRules.CanLevel(db, s.Save, type, 0) == null && s.TrainLevel(type, 0) == null;
Assert.IsNull(s.Dispatch(DispatchRules.Patrol, h0), "순찰 파견");
// 순찰 즉시 수확(서버가 계산) — 기기 규칙으로 계산한 값과 같아야 한다(개발 효과 포함)
int expectGold = Mathf.RoundToInt(PatrolRules.GoldPerHour(db, s.Save) * e.PatrolInstantHours);
PatrolYield yield0 = null;
string why = null;
bool harvestDone = false;
s.InstantHarvestAsync((y, w) =>
{
yield0 = y;
why = w;
harvestDone = true;
});
yield return Until(() => harvestDone, 20f, "즉시 수확 응답");
Assert.IsNotNull(yield0, "즉시 수확: " + why);
Assert.AreEqual(expectGold, yield0.gold, "순찰 골드 = 기기 규칙 계산과 같다");
// 등용 10연(첫 10연 무료) — 서버가 뽑는다
GachaConfig.Banner banner = null;
foreach (var b in db.Gacha.banners)
if (!b.IsPickup && GachaRules.IsOpen(b, s.Now))
{
banner = b;
break;
}
Assert.IsNotNull(banner, "열려 있는 상시 배너");
List<GachaPull> pulls = null;
s.DrawAsync(banner, db.Gacha.TenCount, p => pulls = p);
yield return Until(() => pulls != null, 20f, "등용 응답");
Assert.AreEqual(db.Gacha.TenCount, pulls.Count, "10장");
foreach (var p in pulls) Assert.IsTrue(s.Save.Owns(p.heroId), "뽑힌 유닛을 보유: " + p.heroId);
Assert.IsTrue(s.Save.gacha.firstTenUsed, "첫 10연 사용 표시");
// 서버에 직접 묻는다
yield return Account(res);
Assert.AreEqual(0, sync.Rejects, "서버가 거절한 요청 없음: " + sync.LastError);
Assert.AreEqual(s.Save.gold, ServerGold(res), "서버 골드 = 기기 골드");
Assert.AreEqual(opened.treasureId, res.Str("treasures[0].id"), "서버: 보물 보유");
if (boughtShop) Assert.IsTrue(res.Bool("shop.items[0].sold"), "서버: 상점 첫 칸 품절");
if (devId != null) Assert.AreEqual(1, res.Num("dev.nodes." + devId), "서버: 개발 노드 Lv 1");
if (trained) Assert.AreEqual(1, res.Num("training.list[0].lv." + TrainingTable.Stats[0]), "서버: 훈련 Lv 1");
Assert.AreEqual(h0, res.Str("patrol.hero"), "서버: 순찰 파견");
Assert.AreEqual(db.Gacha.TenCount, res.Num("gacha.total"), "서버: 등용 누적 횟수");
// 서버 상태로 맞춘 뒤에도 기기 값이 그대로
int gold = s.Save.gold, heroes = s.Save.heroes.Count;
yield return Until(() => sync.Reconciles > 0 && !sync.Busy, 20f, "서버 상태로 맞춤");
Assert.AreEqual(gold, s.Save.gold);
Assert.AreEqual(heroes, s.Save.heroes.Count);
if (devId != null) Assert.AreEqual(1, DevRules.Level(s.Save, devId));
Assert.AreEqual(h0, s.Save.patrol.hero);
}
/// <summary>연무장 전투를 시작해 적을 모두 쓰러뜨리고, 서버 응답으로 결과가 채워질 때까지 기다린다.</summary>
IEnumerator ClearMode(string kind, string id, int index, BalanceConfig.StageDef stage, int page)
{
Assert.IsNotNull(stage, kind + " 적 편성");
og.Session.LastMode = null;
og.StartMode(kind, id, index, stage, 0, page);
yield return null;
Assert.AreEqual(BattlePhase.PlayerTurn, bm.Phase, kind + " 전투 시작");
foreach (var u in bm.AliveUnits(Faction.Enemy)) u.TakeDamage(u.Hp);
bm.CheckBattleEnd();
yield return null;
Assert.AreEqual(BattlePhase.StageClear, bm.Phase);
yield return Until(() => og.Session.LastMode != null, 20f, kind + " 종료 → 서버 응답");
}
/// <summary>4단계 — 연무장(탑 · 투기장 · 적장 토벌) 결과와 우편 · 쿠폰이 서버를 거친다(전투 결과는 서버 응답을 받아 채운다).</summary>
[UnityTest]
public IEnumerator Stage4_ArenaMail_LandOnServer()
{
yield return Boot();
var s = og.Session;
var db = s.Db;
var e = db.Economy;
var res = new ServerResult();
// 접속: 연무장 상태는 서버가 정한다(입장권 하루치 · 상대 목록 · 이번 주 보스)
Assert.IsTrue(s.Save.arena.server, "연무장 = 서버가 정한 값");
Assert.AreEqual(e.TowerTicketsDaily, s.Save.arena.towerTickets, "탑 입장권 = tower_tickets_daily");
Assert.AreEqual(db.Arena.SampleLineups, s.Save.arena.samples.Count, "투기장 상대 = sample_lineups");
Assert.GreaterOrEqual(Array.IndexOf(e.RaidBosses, s.Save.arena.raidBoss), 0, "이번 주 보스 = 표의 보스 중 하나: " + s.Save.arena.raidBoss);
Assert.IsTrue(s.MailAvailable, "서버 모드 = 우편 사용");
// 탑 1층 — 입장권 1장 · 승리 → 서버가 준 보상
var f1 = db.Tower.Get(1);
Assert.IsNull(s.EnterTower(), "탑 입장");
yield return ClearMode(ArenaRules.Tower, "", 1, ArenaRules.TowerStage(db, bm.Config, 1), 1);
Assert.IsTrue(s.LastMode.win, "탑 승리");
Assert.IsTrue(og.ResultVisible, "결과 화면");
Assert.AreEqual(1, s.Save.arena.towerFloor, "최고 층 1");
Assert.AreEqual(e.TowerTicketsDaily - 1, s.Save.arena.towerTickets, "입장권 −1");
Assert.AreEqual(e.StartGem + f1.rewardGem, s.Save.gem, "보옥 = 시작 + 1층 보상");
Assert.AreEqual(f1.rewardBlueprint, s.Save.inv.blueprint, "도면 = 1층 보상");
bm.ContinueAfterResult();
yield return null;
// 투기장 — 첫 상대와 대전(승리) → 메달 · 시즌 점수 · 순위
Assert.IsNull(ArenaRules.CanArena(db, s.Save, 0, s.Now), "투기장 입장 가능");
yield return ClearMode(ArenaRules.Arena, "", 0, ArenaRules.ArenaStage(db, bm.Config, s.Save.arena.samples[0]), 3);
Assert.IsTrue(s.LastMode.win, "투기장 승리");
Assert.AreEqual(db.Arena.MedalWin, s.Save.arena.medals, "메달 = medal_win");
Assert.AreEqual(db.Arena.MedalWin, s.Save.arena.seasonScore, "시즌 점수 = 메달");
Assert.AreEqual(1, s.Save.arena.wins);
Assert.AreEqual(1, s.Save.dailyC.arena, "오늘 투기장 1회");
Assert.GreaterOrEqual(ArenaRules.Rank(s.Save), 1, "순위");
Assert.GreaterOrEqual(ArenaRules.RankTotal(s.Save), ArenaRules.Rank(s.Save), "순위 ≤ 인원");
bm.ContinueAfterResult();
yield return null;
// 적장 토벌 — 제한 1턴 · 보스에게 준 피해가 서버에 누적 · 토벌 상자
string boss = ArenaRules.RaidBoss(db, s.Save, s.Now);
int chests = TreasureRules.ChestCount(s.Save, e.RaidChest);
s.LastMode = null;
og.StartMode(ArenaRules.Raid, boss, 0, ArenaRules.RaidStage(db, bm.Config, boss), 1, 4);
yield return null;
Unit bu = null;
foreach (var u in bm.AliveUnits(Faction.Enemy))
if (u.IsBoss) bu = u;
Assert.IsNotNull(bu, "토벌 보스");
bu.TakeDamage(100);
int dealt = bu.MaxHp - bu.Hp;
yield return bm.RunEnemyTurn();
Assert.AreEqual(BattlePhase.Defeat, bm.Phase, "제한 턴 = 끝");
yield return Until(() => s.LastMode != null, 20f, "토벌 종료 → 서버 응답");
Assert.AreEqual(dealt, s.Save.arena.raidDamage, "이번 주 누적 피해");
Assert.AreEqual(1, s.Save.dailyC.raid, "오늘 토벌 1회");
Assert.AreEqual(chests + 1, TreasureRules.ChestCount(s.Save, e.RaidChest), "토벌 상자(개발 0 = raid_chest)");
bm.ContinueAfterResult();
yield return null;
// 서버에 직접 묻는다
yield return Account(res);
Assert.AreEqual(0, sync.Rejects, "서버가 거절한 요청 없음: " + sync.LastError);
Assert.AreEqual(1, res.Num("arena.towerFloor"), "서버: 탑 최고 층");
Assert.AreEqual(db.Arena.MedalWin, res.Num("arena.seasonScore"), "서버: 시즌 점수");
Assert.AreEqual(dealt, res.Num("arena.raid.damage"), "서버: 토벌 누적 피해");
Assert.AreEqual(1, res.Num("daily.counts.arena"), "서버: 오늘 투기장 횟수");
Assert.AreEqual(s.Save.gold, ServerGold(res), "서버 골드 = 기기 골드");
// 우편함 — 서버에서 목록을 받는다(받은 우편이 없으면 빈 목록)
List<MailItem> mails = null;
string why = null;
bool done = false;
s.MailListAsync((l, w) =>
{
mails = l;
why = w;
done = true;
});
yield return Until(() => done, 20f, "우편함 응답");
Assert.IsNotNull(mails, "우편함: " + why);
// 쿠폰 — 없는 코드는 사유만 돌려준다(기기와 서버가 어긋난 것이 아니므로 되돌림이 일어나지 않는다)
string msg = null;
bool ok = true;
done = false;
s.CouponAsync("NO-SUCH-CODE", (m, o) =>
{
msg = m;
ok = o;
done = true;
});
yield return Until(() => done, 20f, "쿠폰 응답");
Assert.IsFalse(ok, "없는 쿠폰: " + msg);
Assert.AreEqual(0, sync.Rejects, "쿠폰 거절은 되돌림을 일으키지 않는다");
// 우편함 팝업 — 목록 · 쿠폰 입력 줄이 만들어진다(화면은 Temp/tks_mail_panel.png 로 남긴다 — 배치를 눈으로 확인하는 용도)
og.Show(og.Lobby);
yield return null;
MailPanel.Open(og);
yield return Until(() => !sync.Busy, 20f, "우편함 팝업 목록");
yield return null;
Assert.IsNotNull(GameObject.Find("UseCoupon"), "쿠폰 사용 버튼");
Assert.IsNotNull(GameObject.Find("Coupon"), "쿠폰 입력 칸");
yield return CaptureUtil.Capture(Camera.main, 720, 1280, System.IO.Path.Combine("Temp", "tks_mail_panel.png"));
og.CloseModal();
// 공지사항 — 우편함 아래 「공지사항」 버튼으로 연다 · 서버가 기간 안의 공지를 준다(화면은 Temp/tks_notice_panel.png 로 남긴다)
List<NoticeItem> notices = null;
string noticeWhy = null;
bool noticeDone = false;
s.NoticeListAsync((list, w) =>
{
notices = list;
noticeWhy = w;
noticeDone = true;
});
yield return Until(() => noticeDone, 20f, "공지 목록 응답");
Assert.IsNotNull(notices, "공지 목록: " + noticeWhy);
foreach (var n in notices)
{
Assert.IsNotEmpty(n.title, "공지 제목(게임 언어 칸 · 없으면 한국어)");
Assert.Greater(n.endAt, s.Now, "기간이 끝난 공지는 오지 않는다");
}
NoticePanel.Open(og);
yield return Until(() => !sync.Busy, 20f, "공지사항 팝업 목록");
yield return null;
Assert.AreEqual(notices.Count > 0, GameObject.Find("Notices") != null, "공지가 있으면 목록이 만들어진다");
yield return CaptureUtil.Capture(Camera.main, 720, 1280, System.IO.Path.Combine("Temp", "tks_notice_panel.png"));
og.CloseModal();
// 순위 표 — 서버의 실제 순위다(탑 = 방금 깬 층이 내 점수 · 1위부터 내려온다)
Assert.IsTrue(s.RankAvailable, "서버 모드 = 순위 표 사용");
RankBoard board = null;
string rankWhy = null;
bool rankDone = false;
s.RankBoardAsync(ArenaRules.Tower, (b, w) =>
{
board = b;
rankWhy = w;
rankDone = true;
});
yield return Until(() => rankDone, 20f, "순위 표 응답");
Assert.IsNotNull(board, "순위 표: " + rankWhy);
Assert.Greater(board.myRank, 0, "탑 순위에 내가 있다");
Assert.AreEqual(s.Save.arena.towerFloor, board.myScore, "내 점수 = 깬 층");
Assert.GreaterOrEqual(board.total, board.myRank, "전체 인원 ≥ 내 순위");
Assert.IsTrue(board.top.Count > 0 && board.top[0].rank == 1, "1위부터 내려온다");
for (int i = 1; i < board.top.Count; i++) Assert.GreaterOrEqual(board.top[i - 1].score, board.top[i].score, "점수 높은 순");
// 순위 표 팝업 — 탭 3개 · 줄 목록이 만들어진다(화면은 Temp/tks_rank_panel.png 로 남긴다 — 배치를 눈으로 확인하는 용도)
RankPanel.Open(og, ArenaRules.Tower);
yield return Until(() => !sync.Busy, 20f, "순위 표 팝업 목록");
yield return null;
Assert.IsNotNull(GameObject.Find("RankTab_" + ArenaRules.Arena), "투기장 탭");
Assert.IsNotNull(GameObject.Find("RankTab_" + ArenaRules.Raid), "적장 토벌 탭");
Assert.IsNotNull(GameObject.Find("Ranks"), "순위 줄 목록");
yield return CaptureUtil.Capture(Camera.main, 720, 1280, System.IO.Path.Combine("Temp", "tks_rank_panel.png"));
og.CloseModal();
// 연무장 투기장 쪽에 「순위 표」 버튼이 생긴다(화면은 Temp/tks_rank_button.png 로 남긴다)
og.Show(og.Arena);
og.Arena.SetPage(3);
yield return null;
Assert.IsNotNull(GameObject.Find("Rank"), "순위 표 버튼");
yield return CaptureUtil.Capture(Camera.main, 720, 1280, System.IO.Path.Combine("Temp", "tks_rank_button.png"));
og.Show(og.Lobby);
}
/// <summary>
/// 주간 랭킹 정산 — 서버가 정산 중이면 랭킹 관련 컨텐츠(서버가 알려 준 목록)에 들어갈 수 없고 「랭킹 정보를 정산중입니다.」 를 보여 준다.
/// **서버가 지금 정산 중이어야 뜻이 있다**(운영툴 「서버 설정」에서 정산 시간을 지금으로 맞춘다) — 정산 중이 아니면 건너뛴다.
/// </summary>
[UnityTest]
public IEnumerator Settle_WhenServerSettling_BlocksRankedContent()
{
yield return Boot();
var s = og.Session;
var db = s.Db;
var a = s.Save.arena;
if (!ArenaRules.Settling(s.Save, ArenaRules.Arena, s.Now)) Assert.Ignore("서버가 정산 중이 아니다(정산 시간 = " + a.settleStart + " ~ " + a.settleEnd + ")");
// 규칙: 입장 판정이 안내 문구를 돌려준다
Assert.AreEqual(ArenaRules.SettleNotice, ArenaRules.CanArena(db, s.Save, 0, s.Now), "투기장 입장");
Assert.AreEqual(ArenaRules.Settling(s.Save, ArenaRules.Raid, s.Now) ? ArenaRules.SettleNotice : null, ArenaRules.CanRaid(db, s.Save, s.Now), "적장 토벌 입장");
Assert.IsFalse(ArenaRules.Settling(s.Save, ArenaRules.Dungeon, s.Now), "일일 던전은 순위가 없어 닫히지 않는다");
// 화면: 투기장 쪽으로 들어가려 하면 안내를 띄우고 카드 화면에 머문다 · 던전 쪽은 열린다
og.Show(og.Arena);
yield return null;
og.Arena.SetPage(3);
yield return null;
Assert.AreEqual(0, og.Arena.Page, "투기장 쪽으로 들어가지 못한다");
Assert.IsNotNull(GameObject.Find("Modal"), "안내 창");
yield return CaptureUtil.Capture(Camera.main, 720, 1280, System.IO.Path.Combine("Temp", "tks_settle_notice.png"));
og.CloseModal();
og.Arena.SetPage(2);
yield return null;
Assert.AreEqual(2, og.Arena.Page, "일일 던전 쪽은 열린다");
// 서버도 거절한다 — 기기 판정을 건너뛰고 입장을 보내면 서버가 받아 주지 않는다
int rejects = sync.Rejects;
LogAssert.ignoreFailingMessages = true; // 거절 경고 로그
s.BeginMode(ArenaRules.Arena, "", 0);
yield return Until(() => sync.Rejects > rejects && !sync.Busy, 20f, "서버의 정산 중 거절");
LogAssert.ignoreFailingMessages = false;
StringAssert.Contains("RANK_SETTLING", sync.LastError);
s.Mode = null;
}
/// <summary>기기 값만 달라졌을 때(변조 · 버그) — 서버가 거절하면 서버 상태로 되돌린다.</summary>
[UnityTest]
public IEnumerator Reject_RollsBackToServerState()
{
yield return Boot();
var s = og.Session;
var e = s.Db.Economy;
string h0 = e.StartHeroes[0];
var hero = s.Save.Hero(h0);
int lv0 = hero.lv;
hero.exp = s.Db.Levels.Get(hero.lv).expToNext; // 서버는 모르는 경험
Assert.IsNull(s.LevelUp(h0), "기기에서는 레벨업이 된다");
Assert.AreEqual(lv0 + 1, s.Save.Hero(h0).lv);
LogAssert.ignoreFailingMessages = true; // 거절 경고 로그
yield return Until(() => sync.Rejects > 0 && sync.Reconciles > 0 && !sync.Busy, 20f, "서버 거절 → 되돌림");
LogAssert.ignoreFailingMessages = false;
Assert.AreEqual(lv0, s.Save.Hero(h0).lv, "서버 상태로 되돌림");
Assert.AreEqual(0, s.Save.Hero(h0).exp);
Assert.AreEqual(e.StartGold, s.Save.gold, "골드도 서버 값");
}
/// <summary>나라별 0시 — 새 계정은 접속할 때 실어 보낸 기기 시간대가 계정에 고정된다(일일 초기화 = 그 시간대의 0시).</summary>
[UnityTest]
public IEnumerator Timezone_FixedAtSignup()
{
yield return Boot();
var res = new ServerResult();
yield return Account(res);
Assert.IsTrue(res.Bool("account.tz.set"), "가입할 때 시간대가 계정에 고정된다");
Assert.AreEqual(DeviceOffsetMin(), res.Num("account.tz.offsetMin"), "기기의 UTC 와의 차(분)");
Assert.IsFalse(res.Has("account.tz.effectiveAt"), "가입할 때는 적용 대기가 없다");
Assert.AreEqual(EconomyRules.DayKey(og.Session.Now), res.Str("daily.day").Replace("-", ""), "서버가 계산한 오늘 = 기기의 오늘");
}
/// <summary>나라별 0시 — 시간대가 없는 계정(이 기능 전에 만든 계정)은 접속하면 기기 시간대를 한 번 보내 정한다.</summary>
[UnityTest]
public IEnumerator Timezone_OldAccount_SetOnceOnConnect()
{
ServerLink.SkipSignupTimezone = true; // 가입할 때 보내지 않음 = 시간대가 없는 계정
yield return Boot();
var res = new ServerResult();
yield return Account(res); // 줄 선 「시간대 정하기」가 끝난 뒤의 서버 상태
Assert.IsTrue(res.Bool("account.tz.set"), "접속 뒤 시간대가 정해진다");
Assert.AreEqual(DeviceOffsetMin(), res.Num("account.tz.offsetMin"), "기기의 UTC 와의 차(분)");
Assert.AreEqual(0, sync.Rejects, "거절 없이 받는다: " + sync.LastError);
Assert.AreEqual(EconomyRules.DayKey(og.Session.Now), res.Str("daily.day").Replace("-", ""), "서버가 계산한 오늘 = 기기의 오늘");
}
/// <summary>게임 로그 — 접속할 때 접속 정보(플랫폼 · 앱 버전 …)를 실어 보내고, 진행 단계 보고는 표에 없는 이름이어도 서버가 거절하지 않는다.</summary>
[UnityTest]
public IEnumerator Log_ClientInfoOnConnect_StepReportAccepted()
{
var client = ServerSession.ClientQuery();
StringAssert.Contains("platform=editor", client, "에디터에서는 플랫폼 = editor");
StringAssert.Contains("ver=" + Uri.EscapeDataString(Application.version), client, "앱 버전");
StringAssert.Contains("&country=", client);
StringAssert.Contains("&lang=", client);
StringAssert.Contains("&device=", client);
yield return Boot(); // 접속 주소에 위 값이 실려 간다(서버가 못 쓰는 값이면 접속이 실패한다)
og.Session.ReportStep("tutorial_end"); // 단계 표에 있는 이름
og.Session.ReportStep("not_in_table"); // 표에 없는 이름 — 서버가 남기지 않을 뿐 거절하지 않는다
var res = new ServerResult();
yield return Account(res); // 줄 선 보고가 끝난 뒤의 서버 상태
Assert.AreEqual(0, sync.Rejects, "거절 없이 받는다: " + sync.LastError);
Assert.IsTrue(res.Bool("account.tz.set"), "접속 정보를 함께 보내도 시간대는 그대로 고정된다");
}
// ---------- 로그인 · 계정 (PD 2026-11-17 — 게스트/소셜 로그인 · 로그아웃 · 계정 삭제 · 소셜 연동 · 동시 접속 불가) ----------
/// <summary>로그인 화면을 거쳐 접속한다(테스트의 기본은 화면 없이 게스트 자동 로그인 — 여기서는 화면을 켠다).</summary>
IEnumerator BootWithLogin(string method, string devId)
{
WorldProgress.Reset();
SaveStore.UseMemory(true);
ServerLink.ForceForTest(TestUrl(), ServerConfig.GameId);
ServerLink.LoginUi = true;
SceneManager.LoadScene("Battle");
yield return null;
yield return null;
yield return Login(method, devId);
}
static string TestUrl()
{
var url = Environment.GetEnvironmentVariable("TKS_TEST_SERVER");
return string.IsNullOrEmpty(url) ? ServerConfig.BaseUrl : url;
}
/// <summary>
/// (씬이 열린 뒤) 로그인 화면이 뜨면 고르고 접속이 끝나기를 기다린다. method = null 이면 화면 없이 이어 하기(저장한 로그인)를 기대한다.
/// 서버가 시험용 소셜 계정을 받지 않으면(SOCIAL_PROVIDER=fake 가 아님) 그 테스트는 건너뛴다.
/// </summary>
IEnumerator Login(string method, string devId)
{
yield return Until(() => ServerSync.Instance != null && OutGameRoot.Instance != null && !ServerSync.Instance.Kicked, 10f, "씬 열림");
og = OutGameRoot.Instance;
sync = ServerSync.Instance;
if (method != null)
{
yield return Until(() => LoginPanel.Current != null || sync.Ready || sync.LastError != null, 20f, "로그인 화면");
Assert.IsNotNull(LoginPanel.Current, "로그인 화면이 뜬다(자동으로 들어가지 않는다): " + sync.LastError);
LoginPanel.Current.Choose(method, devId);
yield return null;
}
yield return Until(() => sync.Ready || sync.LastError != null || LoginPanel.Current != null, 30f, "서버 접속");
if (LoginPanel.Current != null && method != null && method != ServerClient.MethodGuest && LoginPanel.Current.Notice.Contains("SOCIAL_INVALID_TOKEN"))
Assert.Ignore("서버가 시험용 소셜 계정을 받지 않는다 — 서버 .env 에 SOCIAL_PROVIDER=fake 를 넣고 다시 켜면 돈다");
Assert.IsNull(LoginPanel.Current, method == null ? "저장한 로그인으로 화면 없이 들어간다" : "로그인 화면이 닫힌다: " + (LoginPanel.Current != null ? LoginPanel.Current.Notice : ""));
Assert.IsTrue(sync.Ready, "서버 접속 실패: " + sync.LastError);
}
/// <summary>타이틀부터 다시 시작한 뒤(로그아웃 · 계정 삭제 · 세션 끊김 · 직접 다시 시작) 새 씬이 열리기를 기다린다.</summary>
IEnumerator Reopened(ServerSync old)
{
yield return Until(() => ServerSync.Instance != null && ServerSync.Instance != old, 15f, "타이틀부터 다시 시작");
yield return null;
}
/// <summary>지금 로그인한 계정의 로그인 정보(서버에 직접 물어본다).</summary>
IEnumerator Who(ServerResult res)
{
yield return Until(() => !sync.Busy, 20f, "전송이 끝나기를 기다림");
yield return sync.Client.Send("GET", "/auth/session", null, true, res);
Assert.IsTrue(res.ok, "로그인 정보 조회: " + res.error);
}
static string NewSocialId(string name)
{
return name + "-" + Guid.NewGuid().ToString("N").Substring(0, 8);
}
/// <summary>처음 실행 = 로그인 화면 → 게스트로 시작 · 다음 실행 = 화면 없이 그 계정으로 이어 한다.</summary>
[UnityTest]
public IEnumerator Login_FirstRunShowsLoginScreen_NextRunResumesSameAccount()
{
yield return BootWithLogin(ServerClient.MethodGuest, null);
var a = new ServerResult();
yield return Who(a);
Assert.AreEqual("guest", a.Str("accountType"));
Assert.AreEqual(ServerClient.MethodGuest, sync.Client.Method);
Assert.AreEqual(ServerClient.MethodGuest, sync.Client.LastMethod, "마지막 로그인 방식을 기기에 남긴다");
var old = sync;
ServerLink.Restart(); // 앱을 다시 켠 것과 같다
yield return Reopened(old);
yield return Login(null, null);
var b = new ServerResult();
yield return Who(b);
Assert.AreEqual(a.Str("userId"), b.Str("userId"), "같은 계정으로 이어 한다");
}
/// <summary>소셜 로그인 → 로그아웃하면 타이틀의 로그인 화면 → 다른 계정으로 로그인 → 다시 처음 계정으로 로그인 — 언제든 로그인한 계정으로 플레이한다.</summary>
[UnityTest]
public IEnumerator Login_SocialLogout_ShowsLoginScreen_SwitchAccountsFreely()
{
string idA = NewSocialId("ua"), idB = NewSocialId("ub");
yield return BootWithLogin(SocialSignIn.Google, idA);
var a = new ServerResult();
yield return Who(a);
Assert.AreEqual("oauth", a.Str("accountType"));
Assert.AreEqual("google", a.Str("provider"), "어느 소셜 계정으로 들어왔는지");
// 옵션 팝업 = 소셜 계정은 「로그아웃」
AccountPanel.Open(og);
yield return Until(() => GameObject.Find("Logout") != null, 10f, "옵션 팝업의 로그아웃 버튼");
Assert.IsNull(GameObject.Find("Delete"), "소셜 계정에는 계정 삭제 대신 로그아웃을 준다");
yield return CaptureUtil.Capture(Camera.main, 720, 1280, System.IO.Path.Combine("Temp", "tks_option_social.png"));
og.CloseModal();
var old = sync;
string fail = null;
sync.Logout(why => fail = why);
yield return Reopened(old);
Assert.IsNull(fail, "로그아웃: " + fail);
yield return Login(SocialSignIn.Google, idB); // 로그인 화면이 다시 뜬다 → 다른 계정으로
var b = new ServerResult();
yield return Who(b);
Assert.AreNotEqual(a.Str("userId"), b.Str("userId"), "다른 소셜 계정 = 다른 게임 계정");
old = sync;
sync.Logout(why => fail = why);
yield return Reopened(old);
yield return Login(SocialSignIn.Google, idA);
var c = new ServerResult();
yield return Who(c);
Assert.AreEqual(a.Str("userId"), c.Str("userId"), "처음 계정으로 다시 로그인하면 그 계정 그대로");
}
/// <summary>동시 접속 불가 — 다른 기기에서 같은 계정으로 로그인하면 이 기기의 세션이 바로 끊기고, 안내 뒤 타이틀의 로그인 화면으로 돌아간다.</summary>
[UnityTest]
public IEnumerator Session_OtherDeviceLogin_EndsThisSessionAtOnce()
{
string id = NewSocialId("uk");
yield return BootWithLogin(SocialSignIn.Google, id);
var me = new ServerResult();
yield return Who(me);
// 다른 기기(따로 만든 접속) — 같은 소셜 계정으로 로그인
var other = new ServerClient(TestUrl(), ServerConfig.TimeoutSec, false, ".other");
var r = new ServerResult();
yield return other.SocialLogin(ServerConfig.GameId, SocialSignIn.Google, "dev:" + id, id, r);
Assert.IsTrue(r.ok, "다른 기기 로그인: " + r.error);
og.Session.ReportStep("tutorial_end"); // 이 기기가 아무 요청이나 보내는 순간
yield return Until(() => sync.Kicked, 15f, "세션이 끊겼다는 안내");
StringAssert.Contains("다른 기기", sync.OverlayMessage);
Assert.IsFalse(sync.Ready);
yield return CaptureUtil.Capture(Camera.main, 720, 1280, System.IO.Path.Combine("Temp", "tks_session_replaced.png"));
var old = sync;
sync.PressRetry(); // 「확인」
yield return Reopened(old);
yield return Until(() => LoginPanel.Current != null, 20f, "타이틀의 로그인 화면");
Assert.IsFalse(ServerSync.Instance.Client.HasSaved, "끊긴 기기에는 이어 할 증표가 남지 않는다");
var mine = new ServerResult();
yield return other.Send("GET", "/auth/session", null, true, mine);
Assert.IsTrue(mine.ok, "나중에 접속한 기기는 그대로 플레이한다");
Assert.AreEqual(me.Str("userId"), mine.Str("userId"));
}
/// <summary>게스트 = 로그아웃 대신 계정 삭제 — 「계정 삭제」를 입력해야 하고, 삭제하면 데이터가 지워지고 로그인 상태가 초기화된다(타이틀의 로그인 화면).</summary>
[UnityTest]
public IEnumerator Guest_DeleteAccount_NeedsTypedPhrase_ResetsLogin()
{
yield return BootWithLogin(ServerClient.MethodGuest, null);
var a = new ServerResult();
yield return Who(a);
// 옵션 팝업 = 게스트는 「계정 삭제」 · 「소셜 계정 연동」 (로그아웃 없음)
AccountPanel.Open(og);
yield return Until(() => GameObject.Find("Delete") != null, 10f, "옵션 팝업의 계정 삭제 버튼");
Assert.IsNull(GameObject.Find("Logout"), "게스트에게는 로그아웃을 주지 않는다");
Assert.IsNotNull(GameObject.Find("LinkGoogle"), "게스트는 소셜 계정에 연동할 수 있다");
yield return CaptureUtil.Capture(Camera.main, 720, 1280, System.IO.Path.Combine("Temp", "tks_option_guest.png"));
AccountPanel.ConfirmDelete(og, sync);
yield return null;
yield return CaptureUtil.Capture(Camera.main, 720, 1280, System.IO.Path.Combine("Temp", "tks_delete_confirm.png"));
Assert.IsFalse(AccountPanel.Typed("삭제"), "확인 문구를 정확히 입력해야 한다");
Assert.IsFalse(AccountPanel.Typed(""));
Assert.IsTrue(AccountPanel.Typed(" 계정 삭제 "));
og.CloseModal();
var old = sync;
var gone = old.Client;
string fail = null;
sync.DeleteAccount(why => fail = why);
yield return Reopened(old);
Assert.IsNull(fail, "계정 삭제: " + fail);
yield return Until(() => LoginPanel.Current != null, 20f, "타이틀의 로그인 화면");
yield return CaptureUtil.Capture(Camera.main, 720, 1280, System.IO.Path.Combine("Temp", "tks_login_panel.png"));
Assert.IsFalse(ServerSync.Instance.Client.HasSaved, "로그인 상태가 초기화된다");
Assert.AreEqual("", ServerSync.Instance.Client.LastMethod, "마지막 로그인 방식도 지운다");
Assert.IsFalse(gone.LoggedIn, "지운 계정의 증표는 기기에 남지 않는다");
yield return Login(ServerClient.MethodGuest, null);
var b = new ServerResult();
yield return Who(b);
Assert.AreNotEqual(a.Str("userId"), b.Str("userId"), "다시 게스트로 시작하면 새 계정");
}
/// <summary>
/// 게스트의 소셜 연동 — 고른 소셜 계정이 이미 다른 게임 계정에 연동돼 있으면 두 계정의 요약을 받아 유저가 고른다.
/// 「지금 계정으로 연동」을 고르면 지금 계정이 그 소셜 계정의 계정이 되고, 기존에 연동돼 있던 계정의 접속은 끊긴다.
/// </summary>
[UnityTest]
public IEnumerator Guest_LinkSocial_AlreadyLinked_UserChoosesAccount()
{
string free = NewSocialId("uf"), taken = NewSocialId("ut");
// 그 소셜 계정으로 이미 게임을 하던 다른 기기
var other = new ServerClient(TestUrl(), ServerConfig.TimeoutSec, false, ".other");
var r = new ServerResult();
yield return other.SocialLogin(ServerConfig.GameId, SocialSignIn.Google, "dev:" + taken, taken, r);
if (!r.ok && r.Message == "SOCIAL_INVALID_TOKEN") Assert.Ignore("서버가 시험용 소셜 계정을 받지 않는다 — 서버 .env 에 SOCIAL_PROVIDER=fake");
Assert.IsTrue(r.ok, "다른 기기 로그인: " + r.error);
var theirs = new ServerResult();
yield return other.Send("GET", "/auth/session", null, true, theirs);
yield return other.Send("GET", "/tks/account", null, true, r);
yield return BootWithLogin(ServerClient.MethodGuest, null);
var me = new ServerResult();
yield return Who(me);
// 이미 연동된 소셜 계정을 고름 → 계정 고르기
ServerResult link = null;
sync.Link(SocialSignIn.Google, taken, null, x => link = x);
yield return Until(() => link != null, 15f, "연동 응답");
Assert.AreEqual(409, link.status, "이미 다른 계정에 연동된 소셜 계정: " + link.error);
Assert.AreEqual("OAUTH_ALREADY_LINKED", link.Message);
Assert.AreEqual(me.Str("userId"), link.Str("current.userId"));
Assert.AreEqual(theirs.Str("userId"), link.Str("existing.userId"));
StringAssert.Contains("닉네임", AccountPanel.SummaryOf(link, "existing"));
StringAssert.Contains("영웅", AccountPanel.SummaryOf(link, "existing"), "기존 계정의 진행도 요약");
AccountPanel.Link(og, sync, SocialSignIn.Google, taken, null); // 화면 = 계정 선택 팝업
yield return Until(() => GameObject.Find("Pick") != null, 15f, "계정 선택 팝업");
yield return CaptureUtil.Capture(Camera.main, 720, 1280, System.IO.Path.Combine("Temp", "tks_account_choose.png"));
og.CloseModal();
var still = new ServerResult();
yield return Who(still);
Assert.AreEqual("guest", still.Str("accountType"), "고르기 전에는 아무 것도 바뀌지 않는다");
// 「지금 계정으로 연동」
link = null;
sync.Link(SocialSignIn.Google, taken, AccountPanel.KeepCurrent, x => link = x);
yield return Until(() => link != null, 15f, "연동 응답");
Assert.IsTrue(link.ok, "지금 계정으로 연동: " + link.error);
Assert.AreEqual("linked", link.Str("result"));
var now = new ServerResult();
yield return Who(now);
Assert.AreEqual(me.Str("userId"), now.Str("userId"), "계정은 그대로");
Assert.AreEqual("oauth", now.Str("accountType"));
Assert.AreEqual("google", now.Str("provider"));
Assert.AreEqual(SocialSignIn.Google, sync.Client.LastMethod);
yield return other.Send("GET", "/tks/account", null, true, r);
Assert.AreEqual(401, r.status, "기존에 연동돼 있던 계정의 접속은 끊긴다");
// 이미 소셜 계정인 계정에는 다른 소셜 계정을 또 붙일 수 없다
link = null;
sync.Link(SocialSignIn.Google, free, null, x => link = x);
yield return Until(() => link != null, 15f, "연동 응답");
Assert.AreEqual("INVALID_GUEST_USER", link.Message, "이미 소셜 계정인 계정");
}
// ---------- 타이틀 씬에서 시작 (실제 실행 순서 = Splash → Title → Battle · 위 테스트들은 게임 씬을 바로 연다) ----------
/// <summary>타이틀 씬을 연다(서버 모드 · 로그인 화면 사용) — 접속 일꾼이 타이틀 씬에서 만들어진다.</summary>
IEnumerator BootAtTitle()
{
WorldProgress.Reset();
SaveStore.UseMemory(true);
ServerLink.ForceForTest(TestUrl(), ServerConfig.GameId);
ServerLink.LoginUi = true;
SceneManager.LoadScene(BootScenes.Title);
yield return AtTitle(null);
}
/// <summary>타이틀 씬이 열리고 새 접속 일꾼이 만들어지기를 기다린다(old = 앞 일꾼 · 처음이면 null).</summary>
IEnumerator AtTitle(ServerSync old)
{
yield return Until(() => SceneManager.GetActiveScene().name == BootScenes.Title && TitleScreen.Current != null
&& ServerSync.Instance != null && ServerSync.Instance != old, 15f, "타이틀 씬");
sync = ServerSync.Instance;
og = null;
Assert.IsTrue(sync.AtTitle, "접속 일꾼이 타이틀 씬에서 만들어진다");
Assert.IsTrue(OutGameRoot.Instance == null, "타이틀 씬 = 타이틀만(로비 없음)");
}
/// <summary>타이틀 위의 로그인 화면에서 고르고 로그인이 끝나기를 기다린다. method = null 이면 화면 없이 이어 하기(저장한 로그인)를 기대한다.</summary>
IEnumerator TitleLogin(string method, string devId)
{
if (method != null)
{
yield return Until(() => LoginPanel.Current != null || sync.Ready || sync.LastError != null, 20f, "타이틀의 로그인 화면");
Assert.IsNotNull(LoginPanel.Current, "타이틀 위에 로그인 화면이 뜬다(자동으로 들어가지 않는다): " + sync.LastError);
LoginPanel.Current.Choose(method, devId);
yield return null;
yield return null;
}
yield return Until(() => sync.Ready || sync.LastError != null || LoginPanel.Current != null, 30f, "로그인");
if (LoginPanel.Current != null && method != null && method != ServerClient.MethodGuest && LoginPanel.Current.Notice.Contains("SOCIAL_INVALID_TOKEN"))
Assert.Ignore("서버가 시험용 소셜 계정을 받지 않는다 — 서버 .env 에 SOCIAL_PROVIDER=fake 를 넣고 다시 켜면 돈다");
Assert.IsNull(LoginPanel.Current, method == null ? "저장한 로그인으로 화면 없이 들어간다" : "로그인 화면이 닫힌다: " + (LoginPanel.Current != null ? LoginPanel.Current.Notice : ""));
Assert.IsTrue(sync.Ready, "로그인 실패: " + sync.LastError);
Assert.AreEqual(BootScenes.Title, SceneManager.GetActiveScene().name, "로그인은 타이틀 씬에서 끝난다");
}
/// <summary>타이틀을 눌러 게임 씬에 들어간다 — 타이틀에서 로그인한 일꾼을 게임 씬의 세션이 이어받아 계정 상태를 받는다.</summary>
IEnumerator EnterGame()
{
var atTitle = sync;
var ts = TitleScreen.Current;
ts.SkipIntro();
yield return Until(() => ts.PressReady, 10f, "로그인 뒤 Press Any Key");
ts.Press();
yield return Until(() => SceneManager.GetActiveScene().name == BootScenes.Game && OutGameRoot.Instance != null && SceneSwitch.Current == null, 15f, "누름 → 게임 씬");
og = OutGameRoot.Instance;
bm = BattleManager.Instance;
wm = WorldMapScreen.Instance;
sync = ServerSync.Instance;
Assert.AreSame(atTitle, sync, "타이틀에서 로그인한 일꾼을 게임 씬의 세션이 이어받는다(다시 로그인하지 않는다)");
Assert.IsFalse(sync.AtTitle);
Assert.IsInstanceOf<ServerSession>(og.Session);
yield return Until(() => sync.Ready || sync.LastError != null, 30f, "계정 수신");
Assert.IsTrue(sync.Ready, "서버 접속 실패: " + sync.LastError);
Assert.IsNull(LoginPanel.Current, "로비 위에는 로그인 화면이 뜨지 않는다");
}
/// <summary>
/// 타이틀 씬에서 시작 — 처음 실행이면 타이틀 위에 로그인 화면이 뜨고, 로그인이 끝나야 「Press Any Key」로 게임 씬에 들어간다.
/// 다음 실행(타이틀부터 다시 시작)은 로그인 화면 없이 마지막에 로그인한 계정으로 이어 한다.
/// </summary>
[UnityTest]
public IEnumerator Title_FirstRun_LoginOnTitle_ThenEntersGame_NextRunResumes()
{
yield return BootAtTitle();
yield return Until(() => LoginPanel.Current != null || sync.Ready || sync.LastError != null, 20f, "타이틀의 로그인 화면");
Assert.IsNotNull(LoginPanel.Current, "처음 실행 = 타이틀 위에 로그인 화면: " + sync.LastError);
// 로그인 전에는 타이틀이 다음으로 넘어가지 않는다(등장 연출을 건너뛰고 눌러도)
var ts = TitleScreen.Current;
ts.SkipIntro();
for (float until = Time.unscaledTime + 2f; Time.unscaledTime < until;) yield return null;
Assert.IsFalse(ts.PressReady, "로그인이 끝나기 전에는 Press Any Key 가 뜨지 않는다");
ts.Press();
Assert.IsFalse(ts.Leaving, "로그인 전 누름 = 게임 씬으로 가지 않는다");
yield return CaptureUtil.Capture(Camera.main, 720, 1280, System.IO.Path.Combine("Temp", "tks_title_login.png"));
// 타이틀 씬에서도 버튼이 눌린다 — 화면 좌표로 쏜 누름이 「게스트로 시작」 버튼에 닿는다(타이틀 씬에는 원래 버튼 누름을 받는 장치가 없다)
Button guest = null;
foreach (var btn in LoginPanel.Current.GetComponentsInChildren<Button>())
if (btn.name == "Guest") guest = btn;
Assert.IsNotNull(guest, "게스트로 시작 버튼");
Assert.IsNotNull(EventSystem.current, "타이틀 씬에 버튼 누름을 받는 장치가 있다");
var rt = (RectTransform)guest.transform;
var hits = new List<RaycastResult>();
EventSystem.current.RaycastAll(new PointerEventData(EventSystem.current) { position = RectTransformUtility.WorldToScreenPoint(Camera.main, rt.TransformPoint(rt.rect.center)) }, hits);
Assert.IsTrue(hits.Count > 0 && hits[0].gameObject.GetComponentInParent<Button>() == guest, "화면 누름이 게스트로 시작 버튼에 닿는다");
yield return TitleLogin(ServerClient.MethodGuest, null);
yield return EnterGame();
var s = og.Session;
Assert.IsTrue(s.IsNewUser, "새 게스트 계정");
Assert.AreEqual(s.Db.Economy.StartGold, s.Save.gold, "계정 상태를 받아 로비에 채운다(골드 = start_gold)");
var a = new ServerResult();
yield return Who(a);
Assert.AreEqual("guest", a.Str("accountType"));
// 다음 실행 — 타이틀 씬에서 로그인 화면 없이 이어 한다
var old = sync;
ServerLink.Restart(); // 앱을 다시 켠 것과 같다
yield return AtTitle(old);
yield return TitleLogin(null, null);
yield return EnterGame();
var b = new ServerResult();
yield return Who(b);
Assert.AreEqual(a.Str("userId"), b.Str("userId"), "같은 계정으로 이어 한다");
}
/// <summary>
/// 타이틀 씬을 거쳐 들어온 뒤 옵션에서 로그아웃하면 게임 씬이 아니라 타이틀 씬으로 돌아가 로그인 화면이 뜨고(마지막 로그인 방식 표시),
/// 다시 로그인하면 그 계정으로 게임 씬에 들어간다.
/// </summary>
[UnityTest]
public IEnumerator Title_Logout_ReturnsToTitleLoginScreen()
{
string id = NewSocialId("ul");
yield return BootAtTitle();
yield return TitleLogin(SocialSignIn.Google, id);
yield return EnterGame();
var a = new ServerResult();
yield return Who(a);
Assert.AreEqual("oauth", a.Str("accountType"));
var old = sync;
string fail = null;
sync.Logout(why => fail = why);
yield return AtTitle(old);
Assert.IsNull(fail, "로그아웃: " + fail);
yield return Until(() => LoginPanel.Current != null || sync.Ready || sync.LastError != null, 20f, "타이틀의 로그인 화면");
Assert.IsNotNull(LoginPanel.Current, "로그아웃 뒤 = 타이틀 위에 로그인 화면: " + sync.LastError);
Assert.IsFalse(sync.Client.HasSaved, "로그아웃하면 이어 할 증표가 남지 않는다");
Assert.AreEqual(SocialSignIn.Google, sync.Client.LastMethod, "마지막에 로그인한 소셜 계정을 기억한다");
yield return CaptureUtil.Capture(Camera.main, 720, 1280, System.IO.Path.Combine("Temp", "tks_title_login_after_logout.png"));
yield return TitleLogin(SocialSignIn.Google, id);
yield return EnterGame();
var b = new ServerResult();
yield return Who(b);
Assert.AreEqual(a.Str("userId"), b.Str("userId"), "다시 로그인하면 그 계정 그대로");
}
// ---------- 접속 판정 화면 (업데이트 필요 · 서버 점검 · 이용 제한 · 계정 탈퇴) ----------
// 서버 전체 설정(점검 시간 · 타겟 버전 · 계정 정지)을 실제로 바꾸면 같은 서버를 쓰는 다른 실행이 막힌다 →
// 그 응답만 끼워 넣어(ServerClient.Intercept) 게임의 안내와 흐름을 본다. 서버가 실제로 그렇게 답하는지는 서버 저장소의 smoke:gate 가 본다.
static ServerClient.FakeResponse Fake(long status, string json)
{
return new ServerClient.FakeResponse { status = status, json = json };
}
/// <summary>게임 씬을 연다(접속이 끝나기를 기다리지 않는다 — 접속 중에 뜨는 안내를 보려고).</summary>
IEnumerator Open()
{
WorldProgress.Reset();
SaveStore.UseMemory(true);
ServerLink.ForceForTest(TestUrl(), ServerConfig.GameId);
SceneManager.LoadScene("Battle");
yield return null;
yield return null;
og = OutGameRoot.Instance;
sync = ServerSync.Instance;
Assert.IsNotNull(sync, "서버 모드 세션");
}
// 끼워 넣는 응답의 점검 시간(서버가 주는 형식 = ISO · UTC)
const string MaintStart = "2026-11-17T09:00:00.000Z";
const string MaintEnd = "2026-11-17T11:00:00.000Z";
static string StatusBody(string status)
{
return "{\"status\":\"" + status + "\",\"maintenanceStartAt\":\"" + MaintStart + "\",\"maintenanceEndAt\":\"" + MaintEnd + "\",\"version\":\"0.1.0\",\"updateRequired\":false}";
}
static string MaintenanceBody()
{
return "{\"statusCode\":503,\"message\":\"SERVER_MAINTENANCE\",\"maintenanceStartAt\":\"" + MaintStart + "\",\"maintenanceEndAt\":\"" + MaintEnd + "\",\"maintenanceMessage\":\"정기 점검\"}";
}
static string SuspendedBody(string endAt)
{
return "{\"statusCode\":401,\"message\":\"ACCOUNT_SUSPENDED\",\"accountStatus\":\"suspended\",\"suspensionReason\":\"점검용\",\"suspendedAt\":\"2026-11-17T03:00:00.000Z\",\"suspensionEndAt\":\"" + endAt + "\"}";
}
/// <summary>버전 체크 — 앱 버전이 서버의 타겟 버전보다 낮으면 「새로운 업데이트를 진행하세요」 안내와 스토어 바로가기(구글 플레이 스토어 · 애플 앱스토어)가 뜨고 더 진행하지 않는다.</summary>
[UnityTest]
public IEnumerator Update_VersionTooLow_ShowsNoticeAndStoreButtons()
{
string asked = null;
ServerClient.Intercept = (m, p) =>
{
if (!p.Contains("/status")) return null;
asked = p;
return Fake(200, "{\"status\":\"NORMAL\",\"version\":\"99.0.0\",\"updateRequired\":true,\"storeUrls\":{\"android\":\"https://play.example/tks\",\"ios\":\"https://apps.example/tks\"}}");
};
yield return Open();
yield return Until(() => sync.Halted || sync.Ready, 20f, "업데이트 안내");
Assert.IsTrue(sync.Halted, "업데이트가 필요하면 더 진행하지 않는다");
Assert.IsFalse(sync.Ready);
StringAssert.Contains("ver=" + Uri.EscapeDataString(Application.version), asked, "접속할 때 앱 버전을 실어 보낸다");
StringAssert.Contains(ServerSync.TextUpdate, sync.OverlayMessage);
Assert.IsNull(LoginPanel.Current, "로그인 화면으로 가지 않는다");
yield return CaptureUtil.Capture(Camera.main, 720, 1280, System.IO.Path.Combine("Temp", "tks_update_required.png"));
sync.PressRetry();
Assert.AreEqual("https://play.example/tks", ServerLink.LastStoreUrl, "첫 버튼 = 구글 플레이 스토어 바로가기");
sync.PressSecond();
Assert.AreEqual("https://apps.example/tks", ServerLink.LastStoreUrl, "둘째 버튼 = 애플 앱스토어 바로가기(에디터는 두 스토어를 모두 보여 준다)");
Assert.IsTrue(sync.Halted && sync.Blocking, "스토어에 다녀와도 안내는 그대로");
Assert.AreEqual(0, ServerLink.Quits);
}
/// <summary>서버 점검 — 점검 중 접속을 허용받지 않은 계정은 「서버 점검 중입니다.」 안내와 점검 시간을 보고, 확인을 누르면 게임이 끝난다.</summary>
[UnityTest]
public IEnumerator Maintenance_NotAllowed_ShowsTimeAndOkQuits()
{
ServerClient.Intercept = (m, p) => p.Contains("/status") ? Fake(200, StatusBody("MAINTENANCE")) : p.StartsWith("/auth/") ? Fake(503, MaintenanceBody()) : null;
yield return Open();
yield return Until(() => sync.Halted || sync.Ready, 20f, "점검 안내");
Assert.IsTrue(sync.Halted, "점검 중에는 들어가지 못한다");
Assert.IsFalse(sync.Ready);
StringAssert.Contains(ServerSync.TextMaintenance, sync.OverlayMessage);
StringAssert.Contains(ServerSync.LocalTime(MaintStart) + " ~ " + ServerSync.LocalTime(MaintEnd), sync.OverlayMessage, "점검 시간(이 기기의 시각으로)");
StringAssert.Contains("정기 점검", sync.OverlayMessage, "운영자가 적은 점검 안내 글");
Assert.AreEqual("확인", sync.OverlayButtonLabel);
yield return CaptureUtil.Capture(Camera.main, 720, 1280, System.IO.Path.Combine("Temp", "tks_maintenance.png"));
Assert.AreEqual(0, ServerLink.Quits);
sync.PressRetry();
Assert.AreEqual(1, ServerLink.Quits, "확인 = 게임 종료");
}
/// <summary>서버 점검 중이어도 서버가 로그인을 받아 주는 계정(화이트리스트)은 그대로 게임에 들어간다.</summary>
[UnityTest]
public IEnumerator Maintenance_AllowedAccount_EntersGame()
{
ServerClient.Intercept = (m, p) => p.Contains("/status") ? Fake(200, StatusBody("MAINTENANCE")) : null;
yield return Open();
yield return Until(() => sync.Ready || sync.Halted || sync.LastError != null, 30f, "접속");
Assert.IsTrue(sync.Ready, "점검 중 접속을 허용받은 계정은 들어간다: " + sync.LastError);
Assert.IsFalse(sync.Halted);
Assert.AreEqual(0, ServerLink.Quits);
}
/// <summary>게임 중에 서버 점검이 시작되면 다음 요청에서 바로 점검 안내가 뜨고, 확인을 누르면 게임이 끝난다.</summary>
[UnityTest]
public IEnumerator Maintenance_StartsWhilePlaying_NoticeThenQuit()
{
yield return Boot();
ServerClient.Intercept = (m, p) => p.StartsWith("/tks/") ? Fake(503, MaintenanceBody()) : null;
og.Session.ReportStep("tutorial_end"); // 이 기기가 아무 요청이나 보내는 순간
yield return Until(() => sync.Halted, 15f, "게임 중 점검 안내");
StringAssert.Contains(ServerSync.TextMaintenance, sync.OverlayMessage);
StringAssert.Contains(ServerSync.LocalTime(MaintEnd), sync.OverlayMessage);
Assert.IsFalse(sync.Ready);
Assert.IsFalse(sync.Kicked, "타이틀로 돌려보내는 안내가 아니다");
sync.PressRetry();
Assert.AreEqual(1, ServerLink.Quits, "확인 = 게임 종료");
}
/// <summary>
/// 블랙리스트 — 게임 중이라도 서버에서 이용이 제한되면 다음 요청에서 바로 「이용이 제한 된 계정입니다.」 안내(제한이 끝나는 시각 포함)가 뜨고, 종료 버튼만 누를 수 있다.
/// </summary>
[UnityTest]
public IEnumerator Blacklist_WhilePlaying_ShowsLimitTimeAndQuitOnly()
{
yield return Boot();
const string until = "2026-11-19T03:00:00.000Z";
ServerClient.Intercept = (m, p) => p.StartsWith("/tks/") ? Fake(401, SuspendedBody(until)) : null;
og.Session.ReportStep("tutorial_end");
yield return Until(() => sync.Halted, 15f, "이용 제한 안내");
StringAssert.Contains(ServerSync.TextSuspended, sync.OverlayMessage);
StringAssert.Contains(ServerSync.LocalTime(until), sync.OverlayMessage, "제한이 끝나는 시각");
Assert.AreEqual("종료", sync.OverlayButtonLabel);
Assert.IsFalse(sync.Kicked, "「다른 기기에서 접속」 안내가 아니다");
Assert.IsNull(LoginPanel.Current, "로그인 화면으로 보내지 않는다");
yield return CaptureUtil.Capture(Camera.main, 720, 1280, System.IO.Path.Combine("Temp", "tks_account_limited.png"));
sync.PressSecond();
Assert.AreEqual(0, ServerLink.Quits, "둘째 버튼은 없다(종료 버튼만)");
sync.PressRetry();
Assert.AreEqual(1, ServerLink.Quits, "종료 = 게임 종료");
}
/// <summary>블랙리스트 — 접속할 때 이용이 제한된 계정이면 로그인 화면이 아니라 제한 안내가 뜬다. 끝나는 시각이 없으면(무기한) 시각을 적지 않는다.</summary>
[UnityTest]
public IEnumerator Blacklist_AtLogin_NoEndTime_ShowsLimitOnly()
{
ServerClient.Intercept = (m, p) => p.StartsWith("/auth/") ? Fake(401, SuspendedBody("")) : null;
yield return Open();
yield return Until(() => sync.Halted || sync.Ready, 20f, "이용 제한 안내");
Assert.IsTrue(sync.Halted);
StringAssert.Contains(ServerSync.TextSuspended, sync.OverlayMessage);
StringAssert.DoesNotContain("제한 해제", sync.OverlayMessage, "제한 시간이 없으면 시각을 적지 않는다");
Assert.AreEqual("종료", sync.OverlayButtonLabel);
sync.PressRetry();
Assert.AreEqual(1, ServerLink.Quits);
}
/// <summary>(탈퇴를 신청해 다시 열린 씬에서) 로그인 화면에서 그 소셜 계정으로 로그인 → 「탈퇴 취소」를 묻는 안내가 뜨기를 기다린다.</summary>
IEnumerator WithdrawPrompt(string devId)
{
yield return Until(() => ServerSync.Instance != null && OutGameRoot.Instance != null, 10f, "씬 열림");
og = OutGameRoot.Instance;
sync = ServerSync.Instance;
yield return Until(() => LoginPanel.Current != null || sync.Ready || sync.LastError != null, 20f, "로그인 화면");
Assert.IsNotNull(LoginPanel.Current, "탈퇴를 신청하면 로그아웃된다(로그인 화면): " + sync.LastError);
LoginPanel.Current.Choose(SocialSignIn.Google, devId);
yield return Until(() => sync.OverlayMessage.Contains(ServerSync.TextWithdrawing) || sync.Ready || sync.LastError != null, 30f, "탈퇴 취소 안내");
StringAssert.Contains(ServerSync.TextWithdrawing, sync.OverlayMessage, "탈퇴를 신청한 계정으로 로그인하면 취소할지 묻는다: " + sync.LastError);
Assert.IsFalse(sync.Ready, "취소 전에는 게임에 들어가지 않는다");
}
/// <summary>
/// 소셜 계정 = 계정 삭제 대신 「계정 탈퇴」 — 복구할 수 없고 유예 일수(서버 값) 뒤 완전 삭제된다는 안내를 보고 신청하면 로그아웃된다.
/// 유예 안에 같은 소셜 계정으로 로그인하면 「탈퇴 취소」로 그 계정 그대로 계속하거나, 「다른 계정으로 로그인」으로 로그인 화면에 돌아간다.
/// </summary>
[UnityTest]
public IEnumerator Social_Withdraw_NoticeThenCancelWithinGrace()
{
string id = NewSocialId("uw");
yield return BootWithLogin(SocialSignIn.Google, id);
var a = new ServerResult();
yield return Who(a);
int days = (int)a.Num("withdrawGraceDays");
if (days <= 0) Assert.Ignore("서버가 계정 탈퇴를 받지 않는다 — 새 서버 빌드가 아니거나 data/server/service_config.csv 에 withdraw_grace_days 가 없다");
// 옵션 팝업 = 소셜 계정은 「로그아웃」 + 「계정 탈퇴」(계정 삭제는 없다)
AccountPanel.Open(og);
yield return Until(() => GameObject.Find("Withdraw") != null, 10f, "옵션 팝업의 계정 탈퇴 버튼");
Assert.IsNotNull(GameObject.Find("Logout"));
Assert.IsNull(GameObject.Find("Delete"), "소셜 계정에는 계정 삭제를 주지 않는다");
string notice = AccountPanel.WithdrawNotice(days);
StringAssert.Contains("복구할 수 없", notice);
StringAssert.Contains(days + "일 뒤", notice, "유예 일수 = 서버 값");
StringAssert.Contains("취소", notice);
yield return CaptureUtil.Capture(Camera.main, 720, 1280, System.IO.Path.Combine("Temp", "tks_option_social_withdraw.png"));
AccountPanel.ConfirmWithdraw(og, sync, days);
yield return null;
yield return CaptureUtil.Capture(Camera.main, 720, 1280, System.IO.Path.Combine("Temp", "tks_withdraw_confirm.png"));
og.CloseModal();
// 탈퇴 신청 → 로그아웃 → 같은 계정으로 로그인하면 취소할지 묻는다 → 「탈퇴 취소」
var old = sync;
string fail = null;
sync.Withdraw(why => fail = why);
yield return Reopened(old);
Assert.IsNull(fail, "계정 탈퇴: " + fail);
yield return WithdrawPrompt(id);
Assert.AreEqual("탈퇴 취소", sync.OverlayButtonLabel);
yield return CaptureUtil.Capture(Camera.main, 720, 1280, System.IO.Path.Combine("Temp", "tks_withdraw_cancel_prompt.png"));
sync.PressRetry();
yield return Until(() => sync.Ready || sync.LastError != null, 30f, "탈퇴 취소 뒤 접속");
Assert.IsTrue(sync.Ready, "탈퇴를 취소하면 그대로 들어간다: " + sync.LastError);
var b = new ServerResult();
yield return Who(b);
Assert.AreEqual(a.Str("userId"), b.Str("userId"), "취소하면 그 계정 그대로");
var acc = new ServerResult();
yield return Account(acc);
// 다시 신청 → 로그인 → 「다른 계정으로 로그인」 = 로그인 화면으로
old = sync;
sync.Withdraw(why => fail = why);
yield return Reopened(old);
yield return WithdrawPrompt(id);
sync.PressSecond();
yield return Until(() => LoginPanel.Current != null, 20f, "다른 계정으로 로그인 = 로그인 화면");
Assert.IsFalse(sync.Client.HasSaved, "탈퇴 중인 계정의 증표는 기기에 남지 않는다");
yield return Login(ServerClient.MethodGuest, null);
var c = new ServerResult();
yield return Who(c);
Assert.AreNotEqual(a.Str("userId"), c.Str("userId"), "다른 계정으로 플레이한다");
}
static long DeviceOffsetMin()
{
return (long)Math.Round(TimeZoneInfo.Local.GetUtcOffset(DateTime.Now).TotalMinutes);
}
/// <summary>서버에 닿지 않으면 화면을 막고 「다시 시도」를 받는다(게임이 서버 없이 진행되지 않는다).</summary>
[UnityTest]
public IEnumerator ServerDown_BlocksWithRetry()
{
WorldProgress.Reset();
SaveStore.UseMemory(true);
ServerLink.ForceForTest(ClosedAddress, ServerConfig.GameId);
LogAssert.ignoreFailingMessages = true; // 접속 실패 경고 로그
SceneManager.LoadScene("Battle");
yield return null;
yield return null;
sync = ServerSync.Instance;
Assert.IsNotNull(sync);
yield return Until(() => sync.LastError != null, 40f, "접속 실패 안내");
LogAssert.ignoreFailingMessages = false;
Assert.IsFalse(sync.Ready);
Assert.IsTrue(sync.Blocking, "화면을 막고 다시 시도 버튼을 띄운다");
}
/// <summary>아무도 듣지 않는 주소(이 PC 의 닫힌 포트) — 접속 실패를 만들기 위한 값.</summary>
const string ClosedAddress = "http://127.0.0.1:9";
/// <summary>서버 응답의 골드(재화 ID 는 서버 기준 정보에서 — 코드에 번호를 적지 않는다).</summary>
int ServerGold(ServerResult account)
{
return ((ServerSession)og.Session).GoldOf(account);
}
}
}