| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- namespace TowerDevil
- {
- public sealed partial class TowerGame
- {
- RectTransform tiles, monsters, fx, shieldPips, guide, actionArea;
- RectTransform hud, boardStage, battleFooter, gateWindow, fieldClip, laneShade;
- RawImage gateArt;
- GateFractures gateFractures;
- BattleEffects battleEffects;
- IronPanel turnDot, turnStrip;
- readonly Dictionary<Piece, RawImage> pieces = new Dictionary<Piece, RawImage>();
- readonly Dictionary<Foe, FoeView> foes = new Dictionary<Foe, FoeView>();
- readonly List<Foe> gone = new List<Foe>();
- readonly Queue<BoardFrame> frames = new Queue<BoardFrame>();
- Text movesLabel, sealLabel, nightLabel, coinLabel, shardLabel, turnLabel, waveLabel, waitLabel, leftLabel;
- RectTransform waveFill;
- bool animating, assaultTint;
- float nextAttack = -1, tickRemainder, forecastTime;
- int lastPlates = -1, lastMaxPlates = -1, lastDay = -1;
- Phase lastPhase;
- Coroutine playback;
- static readonly string[] GuideTitle = { "DRAG TO SWAP", "THREE IN A LINE", "FORGE A STRONGER TOWER",
- "GOLD MAKES CHESTS", "LET THEM COME" };
- static readonly string[] GuideBody = {
- "Drag a piece onto a neighbouring square to spend one move.",
- "Match stone, wood, crystal or ice to forge its tower. Watch where the pieces fall.",
- "Line up three towers of the same kind and tier to upgrade one.",
- "Match three gold piles for a chest. Tap it for moves, or line up three chests to upgrade.",
- "Finish arranging the board, then call the horde. Your towers fire automatically."
- };
- void StartGame()
- {
- profile.played = true;
- profile.Save();
- AttachRun(new Run(profile, System.Environment.TickCount));
- tutorial = profile.tutorialDone ? -1 : 0;
- ShowBattle();
- }
- void AttachRun(Run next)
- {
- if (playback != null)
- {
- StopCoroutine(playback);
- playback = null;
- }
- frames.Clear();
- animating = false;
- tickRemainder = 0;
- if (run != null)
- {
- run.Fired -= OnFire;
- run.Hit -= OnHit;
- run.StruckGate -= OnGateHit;
- run.BoardChanged -= frames.Enqueue;
- }
- run = next;
- run.Fired += OnFire;
- run.Hit += OnHit;
- run.StruckGate += OnGateHit;
- run.BoardChanged += frames.Enqueue;
- }
- #if UNITY_EDITOR
- public void EditorReview()
- {
- // This fixture never writes to the player's local profile.
- profile = new Profile { played = true, tutorialDone = true, auth = "guest" };
- var review = new Run(profile, 404);
- review.SetReviewBoard();
- profile.shards = 0;
- AttachRun(review);
- tutorial = -1;
- ShowBattle();
- }
- #endif
- void ShowBattle()
- {
- battleFooter = null;
- NewPage("Run");
- pieces.Clear();
- foes.Clear();
- motionTime = 0;
- gateHitTime = -1;
- nextMotionSeed = 0;
- lastPlates = -1;
- guide = null;
- boardStage = Box(page, "Battlefield", 0, 0, BoardLayout.Width, BoardLayout.Height);
- gateWindow = Box(boardStage, "Gate overlook", 0, 0, 750, 200);
- gateWindow.gameObject.AddComponent<RectMask2D>();
- gateArt = Image(gateWindow, "Sealed prison gate", "fortress", 55, 0, 640, 291);
- var gateRect = gateArt.rectTransform;
- gateRect.anchorMin = gateRect.anchorMax = gateRect.pivot = new Vector2(.5f, 0);
- gateRect.anchoredPosition = Vector2.zero;
- gateFractures = Box(gateRect, "Gate fractures", 0, 0, 0, 0).gameObject.AddComponent<GateFractures>();
- Stretch(gateFractures.rectTransform);
- gateFractures.raycastTarget = false;
- shieldPips = Box(boardStage, "Seal stones", 230, -88, 290, 38);
- turnStrip = Round(boardStage, "Turn strip", 27, -48, 696, 38, "24171B", "69404B", 19, "130C0F");
- assaultTint = false;
- turnDot = Round(turnStrip.transform, "Phase light", 18, 12, 14, 14, "A4F09D", "366439", 7, "5FC56F");
- turnLabel = Label(turnStrip.transform, "YOUR TURN", 45, 0, 228, 38, 17, Ink);
- waitLabel = Label(turnStrip.transform, "", 260, 0, 418, 38, 16, Hex("FFDA89"), TextAnchor.MiddleRight);
- for (int r = 0; r < Run.Size; r++)
- {
- float size = BoardLayout.Size(r), y = BoardLayout.Top(r);
- float x = (BoardLayout.Width - Run.Size * size) * .5f;
- Round(boardStage, "Rank " + r, x - 8, y - 6, size * Run.Size + 16, size + 14,
- "291920", "38252B", 13, "140C10");
- for (int c = 0; c < Run.Size; c++)
- Round(boardStage, "Cell " + r + "," + c, x + c * size + 1.5f, y, size - 3, size - 3,
- "513241", "82605C", 13, "271520");
- }
- var pieceWindow = Box(boardStage, "Piece viewport", 0, -10, BoardLayout.Width, BoardLayout.Height + 27);
- pieceWindow.gameObject.AddComponent<RectMask2D>();
- tiles = Box(pieceWindow, "Pieces", 0, 10, BoardLayout.Width, BoardLayout.Height);
- laneShade = Panel(boardStage, "Approach shadow", 0, BoardLayout.Height + 8, 750, 130, "11090D",
- "120A0D", 0).rectTransform;
- var shade = laneShade.GetComponent<IronPanel>();
- shade.stroke = 0;
- shade.top = new Color(.04f, .02f, .03f, .14f);
- shade.bottom = new Color(.06f, .025f, .04f, .84f);
- for (int side = 0; side < 2; side++)
- {
- var rock = Image(laneShade, "Runway rubble", "rubble", side == 0 ? -14 : 650, 0, 114, 112);
- rock.rectTransform.anchorMin = rock.rectTransform.anchorMax = new Vector2(0, 0);
- rock.rectTransform.anchoredPosition += Vector2.up * 112;
- rock.color = new Color(.47f, .40f, .42f, .78f);
- if (side == 1)
- rock.uvRect = new Rect(1, 0, -1, 1);
- }
- fieldClip = Box(boardStage, "Visible battlefield", 0, -15, 750, 850);
- fieldClip.gameObject.AddComponent<RectMask2D>();
- monsters = Box(fieldClip, "Horde", 0, 15, 750, 1334);
- fx = Box(boardStage, "Effects", 0, 0, 750, 1334);
- battleEffects = fx.gameObject.AddComponent<BattleEffects>();
- battleEffects.raycastTarget = false;
- var input = Solid(boardStage, "Board input", 0, 0, BoardLayout.Width, BoardLayout.Height, Color.clear, true)
- .gameObject.AddComponent<BoardInput>();
- input.Game = this;
- BuildBattleHud();
- battleFooter = Box(page, "Battle footer", 0, 1184, 750, 150);
- waveLabel = Label(battleFooter, "", 26, 0, 125, 35, 17, Ink);
- Round(battleFooter, "Wave track", 145, 13, 454, 10, "3A292C", "49353A", 5, "2A1C20");
- waveFill = Round(battleFooter, "Wave progress", 145, 13, 1, 10, "FFD473", "CD8D34", 5, "E59B38").rectTransform;
- leftLabel = Label(battleFooter, "", 606, 0, 116, 35, 17, Muted, TextAnchor.MiddleRight);
- actionArea = Box(battleFooter, "Actions", 0, 57, 750, 84);
- SideAction("SHOP", "shop", 24, Merchant);
- SideAction("MENU", "menu", 558, PauseSheet);
- Fit();
- lastDay = run.Day;
- lastPhase = run.Phase;
- forecastTime = 6;
- DrawBoard(run.Board);
- RebuildAction();
- RefreshHud();
- DrawGuide();
- }
- void FitBattle(float safeHeight)
- {
- float extra = Mathf.Max(0, safeHeight - 1334);
- float boardY = 426 - extra * .2f;
- hud.anchoredPosition = new Vector2(0, extra * .5f);
- boardStage.anchoredPosition = new Vector2(0, -boardY);
- battleFooter.anchoredPosition = new Vector2(0, -1184 - extra * .5f);
- float gateTop = 108 - extra * .5f - boardY;
- gateWindow.anchoredPosition = new Vector2(0, -gateTop);
- gateWindow.sizeDelta = new Vector2(750, -96 - gateTop);
- float available = boardY + extra * .5f - 96 - 158;
- float width = Mathf.Clamp((available + 20) * 2.7f, 495, 668);
- gateArt.rectTransform.sizeDelta =
- new Vector2(width, width * gateArt.texture.height / gateArt.texture.width);
- float laneEnd = -battleFooter.anchoredPosition.y - boardY;
- fieldClip.sizeDelta = new Vector2(750, laneEnd + 15);
- laneShade.sizeDelta = new Vector2(750, laneEnd - BoardLayout.Height - 8);
- }
- void BattleShade(float low, float high, float lowerAlpha, float upperAlpha)
- {
- var band = Panel(battleVeil, "Shadow", 0, 0, 0, 0, "12090C", "12090C", 0);
- band.stroke = 0;
- band.bottom = new Color(.046f, .023f, .035f, lowerAlpha);
- band.top = new Color(.046f, .023f, .035f, upperAlpha);
- band.rectTransform.anchorMin = new Vector2(0, low);
- band.rectTransform.anchorMax = new Vector2(1, high);
- band.rectTransform.offsetMin = band.rectTransform.offsetMax = Vector2.zero;
- }
- static IronPanel Round(Transform parent, string name, float x, float y, float w, float h, string face,
- string rim, float radius, string lower = null)
- {
- var plate = Panel(parent, name, x, y, w, h, face, rim, radius, lower);
- plate.rounded = true;
- plate.stroke = 2;
- return plate;
- }
- void BuildBattleHud()
- {
- hud = Box(page, "Warden HUD", 0, 0, 750, 158);
- Round(hud, "Portrait setting", 22, 13, 53, 53, "39251C", "F4B943", 14, "170F0D");
- Image(hud, "Warden portrait", "av_" + profile.avatar, 24, 15, 49, 49);
- var name = Label(hud, profile.name, 88, 13, 325, 53, 22, Ink);
- name.resizeTextForBestFit = true;
- name.resizeTextMinSize = 15;
- name.resizeTextMaxSize = 22;
- coinLabel = WalletPill("Gold", "ui_coin", 435, 108, "70404B", "FFCE65");
- shardLabel = WalletPill("Shards", "ui_gem", 554, 89, "34627C", "79D6FF");
- var pause = Round(hud, "Pause bezel", 664, 18, 49, 45, "22171C", "804452", 14, "120D10");
- for (int i = 0; i < 2; i++)
- Solid(pause.transform, "Pause bar", 18 + i * 9, 15, 5, 15, Ink);
- Hotspot(hud, "Pause battle", 652, 2, 78, 70, PauseSheet);
- movesLabel = StatCard("MOVES", 22, "FF7964", "B82E23", "F8AA91", "A33D2C", Color.white);
- sealLabel = StatCard("SEAL", 261, "FFDA5E", "C48812", "FFE49B", "BE8D29", Hex("442C0C"));
- nightLabel = StatCard("NIGHT", 500, "67C8FC", "1B67AC", "96D5FE", "357CAA", Color.white);
- Hotspot(hud, "Seal details", 261, 78, 228, 78, SealSheet);
- }
- Text WalletPill(string name, string icon, float x, float w, string border, string accent)
- {
- var pill = Round(hud, name, x, 18, w, 44, "21171A", border, 22, "0F0B10");
- var symbol = Image(pill.transform, icon, icon, 15, 11, 21, 21);
- symbol.uvRect = name == "Gold" ? new Rect(.17f, .17f, .66f, .66f) : new Rect(.20f, .18f, .6f, .64f);
- symbol.color = Hex(accent);
- var label = Label(pill.transform, "", 37, 0, w - 46, 44, 22, Hex(accent), TextAnchor.MiddleCenter);
- label.resizeTextForBestFit = true;
- label.resizeTextMinSize = 12;
- label.resizeTextMaxSize = 22;
- return label;
- }
- Text StatCard(string caption, float x, string hi, string lo, string rim, string inset, Color ink)
- {
- Round(hud, caption + " shadow", x, 82, 228, 78, "28171B", "241418", 21, "100B0E");
- var card = Round(hud, caption + " card", x, 77, 228, 78, hi, rim, 21, lo);
- card.stroke = 3;
- var badge = Round(card.transform, "Icon well", 17, 20, 40, 38, inset, inset, 12);
- if (caption == "SEAL")
- {
- Shield(badge.transform, 11, 9, 18, 19, "77501D", "513714");
- }
- else if (caption == "MOVES")
- Label(badge.transform, "⇄", 0, -1, 40, 38, 26, ink, TextAnchor.MiddleCenter);
- else
- {
- for (int i = 0; i < 8; i++)
- {
- var ray = Solid(badge.transform, "Sun ray", 20, 19, 3, 11, ink).rectTransform;
- ray.pivot = new Vector2(.5f, 0);
- ray.localRotation = Quaternion.Euler(0, 0, i * 45);
- }
- Round(badge.transform, "Sun", 13, 12, 14, 14, "FFF0D6", "FFF0D6", 7);
- }
- var value = Label(card.transform, "", 70, 8, 145, 40, 30, ink);
- Label(card.transform, caption, 71, 45, 142, 23, 14, ink);
- return value;
- }
- static void Shield(Transform parent, float x, float y, float width, float height, string top, string bottom)
- {
- var icon = Box(parent, "Seal stone", x, y, width, height).gameObject.AddComponent<SealIcon>();
- icon.raycastTarget = false;
- icon.top = Hex(top);
- icon.bottom = Hex(bottom);
- }
- void SideAction(string label, string glyph, float x, System.Action callback)
- {
- var button = ButtonAt(actionArea, label, x, 0, 168, 82, callback, false, 18);
- StyleBattleButton(button, false);
- var caption = button.GetComponentInChildren<Text>().rectTransform;
- caption.anchoredPosition = new Vector2(53, -2);
- caption.sizeDelta = new Vector2(94, 78);
- Image(button.transform, label + " icon", "ui_" + glyph, 37, 29, 24, 24).color = Ink;
- }
- void StyleBattleButton(Button button, bool primary)
- {
- var plate = (IronPanel)button.targetGraphic;
- plate.rounded = true;
- plate.bevel = 24;
- plate.stroke = 3;
- plate.top = Hex(primary ? "FFDC77" : "482932");
- plate.bottom = Hex(primary ? "E89B22" : "2E1821");
- plate.border = Hex(primary ? "FFECBD" : "845060");
- }
- void RebuildAction()
- {
- var previous = actionArea.Find("Primary");
- if (previous)
- Remove((RectTransform)previous);
- string caption = run.Phase == Phase.Assault ? "HORDE ATTACKING"
- : run.Phase == Phase.Rest ? "DONE"
- : "LET THEM COME";
- var b = ButtonAt(actionArea, caption, 208, 0, 334, 82, BeginAttack, true, 23, run.CanArrange);
- StyleBattleButton(b, true);
- b.name = "Primary";
- var label = b.GetComponentInChildren<Text>().rectTransform;
- label.anchoredPosition = new Vector2(52, -2);
- label.sizeDelta = new Vector2(267, 78);
- Image(b.transform, "Sword", "ui_sword", 30, 25, 32, 32).color = Hex("342315");
- }
- void BeginAttack()
- {
- if (modal != null || animating || tutorial >= 0 || !run.BeginAttack())
- return;
- nextAttack = -1;
- RefreshHud();
- RebuildAction();
- }
- public void TrySwap(int r, int c, int nr, int nc)
- {
- if (!CanUseBoard || !run.Swap(r, c, nr, nc))
- return;
- Sound(tapSound);
- if (tutorial == 0)
- {
- tutorial = 1;
- DrawGuide();
- }
- PlayBoard();
- }
- public void TapCell(int r, int c)
- {
- if (!CanUseBoard || tutorial >= 0 || !Run.Inside(r, c))
- return;
- if (run.OpenChest(r, c))
- {
- Sound(forgeSound);
- PlayBoard();
- }
- else if (run.Board[r, c]?.Tower == true)
- GearSheet(r, c);
- }
- void PlayBoard()
- {
- nextAttack = -1;
- if (!animating && frames.Count > 0)
- playback = StartCoroutine(AnimateBoard());
- else
- RefreshHud();
- }
- void DrawBoard(Piece[,] cells, Dictionary<RectTransform, Vector2> previous = null)
- {
- var used = new HashSet<Piece>();
- for (int r = 0; r < 6; r++)
- for (int c = 0; c < 6; c++)
- {
- Piece p = cells[r, c];
- if (p == null)
- continue;
- used.Add(p);
- if (!pieces.TryGetValue(p, out var image))
- {
- float span = BoardLayout.FrontCell * (p.Tower ? 1.14f + .05f * (p.Tier - 1) :
- p.Kind == Kind.Chest ? 1.02f : 1f);
- image = Image(tiles, p.Art, p.Art, 0, 0, span, span);
- image.rectTransform.pivot = new Vector2(.5f, 0);
- pieces.Add(p, image);
- }
- image.texture = Art(p.Art);
- image.uvRect = new Rect(p.Kind == Kind.Cannon && p.Reversed ? 1 : 0, 0,
- p.Kind == Kind.Cannon && p.Reversed ? -1 : 1, 1);
- var rt = image.rectTransform;
- var center = BoardLayout.Center(r, c);
- var end = center + Vector2.down * (BoardLayout.Size(r) * (p.Tower ? .54f : .58f));
- rt.localScale = Vector3.one * (BoardLayout.Size(r) / BoardLayout.FrontCell);
- rt.SetAsLastSibling();
- if (previous != null && !previous.ContainsKey(rt))
- previous[rt] = end + Vector2.up * BoardLayout.Size(r) * .72f;
- rt.anchoredPosition = end;
- image.color = Color.white;
- }
- var removed = new List<Piece>();
- foreach (var pair in pieces)
- if (!used.Contains(pair.Key))
- {
- Remove(pair.Value.rectTransform);
- removed.Add(pair.Key);
- }
- foreach (var key in removed)
- pieces.Remove(key);
- }
- void UpdateRun()
- {
- if (modal != null) return;
- motionTime += Time.deltaTime;
- battleEffects.Advance(Time.deltaTime);
- ShakeGate();
- if (animating) return;
- if (run.Phase == Phase.Plan && tutorial < 0 && run.Moves == 0)
- {
- if (nextAttack < 0)
- nextAttack = .9f;
- nextAttack -= Time.deltaTime;
- if (nextAttack <= 0)
- BeginAttack();
- }
- if (forecastTime > 0)
- {
- forecastTime -= Time.deltaTime;
- if (forecastTime <= 0)
- RefreshHud();
- }
- if (run.Phase == Phase.Assault)
- {
- tickRemainder += Mathf.Min(Time.deltaTime, .1f);
- while (tickRemainder >= 1f / 30)
- {
- run.Tick(1f / 30);
- tickRemainder -= 1f / 30;
- }
- DrawFoes();
- RefreshHud();
- }
- else if (foes.Count != 0)
- DrawFoes();
- if (run.Phase != Phase.Assault && gateHitTime > 0 && motionTime < gateHitTime + .28f)
- return;
- if (run.Phase == Phase.Over)
- {
- ShowOver();
- return;
- }
- if (run.Phase == Phase.RestChoice)
- {
- RestSheet();
- return;
- }
- if (lastDay != run.Day || lastPhase != run.Phase)
- {
- if (lastDay != run.Day)
- {
- forecastTime = 6;
- Toast(run.Day % 10 == 0 ? "BOSS NIGHT" : "NIGHT " + run.Day);
- DrawBoard(run.Board);
- }
- lastDay = run.Day;
- lastPhase = run.Phase;
- RebuildAction();
- RefreshHud();
- }
- }
- Vector2 Feet(Foe f)
- {
- var at = BoardLayout.Center(f.Row, f.Col);
- if (f.Row >= Foe.RunwayStart)
- {
- float laneDepth = fieldClip.sizeDelta.y - 15 - BoardLayout.Height;
- at.y = -BoardLayout.Height - laneDepth * (f.Row - Foe.RunwayStart) / (Foe.RunwayEnd - Foe.RunwayStart);
- }
- return at;
- }
- void RefreshHud()
- {
- if (route != "Run")
- return;
- movesLabel.text = run.Phase == Phase.Rest ? "∞" : run.Moves.ToString();
- sealLabel.text = run.Plates.ToString();
- nightLabel.text = run.Day.ToString();
- coinLabel.text = run.Available.ToString();
- shardLabel.text = profile.shards.ToString();
- turnLabel.text = run.Phase == Phase.Assault ? "THE HORDE"
- : run.Phase == Phase.Rest ? "REST NIGHT"
- : run.Moves == 0 ? "MOVES SPENT" : "YOUR TURN";
- string fc = forecastTime > 0 ? run.Forecast : "";
- waitLabel.text = fc != "" && run.Phase == Phase.Plan ? fc
- : run.Phase == Phase.Assault ? run.Remaining + " LEFT"
- : run.Phase == Phase.Rest ? "FREE MOVES · NO REFILL"
- : run.Moves + " MOVES · " + run.Remaining + " DEMONS WAIT";
- bool attacking = run.Phase == Phase.Assault;
- if (assaultTint != attacking)
- {
- assaultTint = attacking;
- turnDot.top = Hex(attacking ? "FF7A64" : "A4F09D");
- turnDot.bottom = Hex(attacking ? "E1483E" : "5FC56F");
- turnStrip.top = Hex(attacking ? "541D26" : "24171B");
- turnDot.SetVerticesDirty();
- turnStrip.SetVerticesDirty();
- }
- waveLabel.text = "WAVE " + run.Day;
- leftLabel.text = run.Remaining + " left";
- waveFill.sizeDelta = new Vector2(454 * (1 - (float)run.Remaining / Mathf.Max(1, run.WaveTotal)), 10);
- if (lastPlates != run.Plates || lastMaxPlates != run.MaxPlates)
- {
- foreach (Transform child in shieldPips)
- {
- child.gameObject.SetActive(false);
- Destroy(child.gameObject);
- }
- gateFractures.SetDamage(run.Plates, run.MaxPlates);
- float pitch = Mathf.Min(39, 282f / run.MaxPlates);
- for (int i = 0; i < run.MaxPlates; i++)
- {
- bool intact = i < run.Plates;
- Shield(shieldPips, 145 + (i - run.MaxPlates * .5f) * pitch + 3, 0, pitch - 6, 34,
- intact ? "FFE798" : "605359", intact ? "EF992D" : "392B33");
- }
- lastPlates = run.Plates;
- lastMaxPlates = run.MaxPlates;
- }
- }
- void DrawGuide()
- {
- Remove(guide);
- guide = null;
- if (tutorial < 0)
- return;
- guide = Panel(boardStage, "Guide", 35, -267, 680, 207, "211B1C", "C29157", 10).rectTransform;
- Label(guide, (tutorial + 1) + " / 5 " + GuideTitle[tutorial], 20, 10, 530, 43, 23, Gold);
- Label(guide, GuideBody[tutorial], 20, 53, 640, 69, 23, Ink, TextAnchor.MiddleLeft, false, false);
- ButtonAt(guide, "SKIP", 544, 10, 115, 44, FinishGuide, false, 17);
- if (tutorial == 0)
- Label(guide, "Make a swap on the board.", 20, 135, 630, 45, 19, Muted);
- else
- ButtonAt(guide, tutorial == 4 ? "DEFEND" : "NEXT", 400, 138, 260, 52,
- () =>
- {
- if (++tutorial == 5)
- FinishGuide();
- else
- DrawGuide();
- },
- true, 20);
- }
- void FinishGuide()
- {
- tutorial = -1;
- profile.tutorialDone = true;
- profile.Save();
- DrawGuide();
- }
- }
- }
|