| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- namespace TowerDevil
- {
- public sealed partial class TowerGame
- {
- RectTransform sheetBody;
- float bodyY;
- bool watchingAd;
- const int BodyW = 616;
- static string[] nodeInfo = { "One extra move each night", "One additional starting tower", "+8% tower damage",
- "More precise Boss lane forecasts" };
- void ShowLoading()
- {
- NewPage("Loading");
- Backdrop("bg_boss");
- Label(page, "TOWER DEVIL", 25, 510, 700, 100, 65, Ink, TextAnchor.MiddleCenter, true);
- Label(page, "THE HORDE GATHERS…", 25, 632, 700, 55, 22, Gold, TextAnchor.MiddleCenter);
- }
- void ShowStart()
- {
- NewPage("Start");
- Backdrop("bg_start");
- Label(page, "TOWER\nDEVIL", 50, 553, 650, 207, 86, Ink, TextAnchor.MiddleCenter, true);
- Label(page, "MATCH · MERGE · DEFEND", 35, 771, 680, 50, 25, Gold, TextAnchor.MiddleCenter);
- Label(page, "A CAGED LORD. HIS HORDE COMES TO FREE HIM.", 25, 827, 700, 42, 17, Muted,
- TextAnchor.MiddleCenter);
- ButtonAt(page, "Continue with Apple", 72, 1015, 606, 84, () => Login("apple"), true, 29);
- ButtonAt(page, "Play as Guest", 72, 1115, 606, 78, () => Login("guest"));
- Label(page, "Local demo account · Progress saved on this device", 38, 1210, 674, 46, 17, Muted,
- TextAnchor.MiddleCenter, false, false);
- ButtonAt(page, "TERMS", 161, 1264, 190, 46, () => Legal(false), false, 15);
- ButtonAt(page, "PRIVACY", 399, 1264, 190, 46, () => Legal(true), false, 15);
- }
- void Login(string auth)
- {
- profile.auth = auth;
- profile.Save();
- if (profile.played)
- ShowLobby();
- else
- StartGame();
- }
- void ShowLobby()
- {
- NewPage("Lobby");
- Backdrop("bg_lobby");
- Panel(page, "Profile crest", 25, 33, 73, 73, "282021", "9A754A", 8);
- Image(page, "Avatar", "av_" + profile.avatar, 30, 38, 63, 63);
- Label(page, profile.name, 115, 35, 326, 41, 29, Ink, TextAnchor.MiddleLeft, true);
- Label(page, "KEEP WARDEN", 116, 77, 250, 25, 16, Gold);
- Hotspot(page, "Open profile", 24, 32, 405, 80, ProfileSheet);
- ButtonAt(page, "● " + profile.coins + " +", 475, 40, 166, 63, CoinStore, false, 21);
- ButtonAt(page, "☰", 650, 40, 75, 63, Settings, false, 24);
- var keep = Panel(page, "Your keep", 35, 574, 680, 268, "221B1D", "936F4C", 10, "171518");
- Label(keep.transform, "YOUR KEEP", 24, 12, 610, 43, 23, Gold);
- string[] labels = { "SEAL", "MARCH", "TEMPER", "VANGUARD" };
- string[] vals = { (5 + 2 * (profile.gateLevel - 1)) + " stones",
- (5 + profile.workshop[0]) + " moves per night",
- "+" + (8 * profile.workshop[2]) + "% damage", profile.workshop[1] + " starting towers" };
- for (int i = 0; i < 4; i++)
- {
- Label(keep.transform, labels[i], 25, 60 + i * 47, 240, 38, 17, Muted);
- Label(keep.transform, vals[i], 250, 60 + i * 47, 402, 38, 22, Ink, TextAnchor.MiddleRight);
- }
- ButtonAt(page, "DEFEND THE GATE", 35, 867, 680, 100, StartGame, true, 33);
- ButtonAt(page, "♦ " + profile.shards + " SOUL SHARDS WORKSHOP ›", 35, 982, 680, 66, Workshop, false,
- 21);
- Label(page,
- "BEST NIGHT " + profile.bestNight + " SCORE " + profile.score + " KILLS " +
- profile.kills,
- 30, 1074, 690, 56, 20, Gold, TextAnchor.MiddleCenter);
- string[] buttons = { "CHESTS", "PROFILE", "RANK", "HELP" };
- Action[] callbacks = { Vault, ProfileSheet, () => Rank(false), Help };
- for (int i = 0; i < 4; i++)
- ButtonAt(page, buttons[i], 32 + i * 174, 1186, 164, 86, callbacks[i], false, 20);
- }
- void ShowOver()
- {
- NewPage("Over");
- Backdrop("bg_boss");
- Label(page, "GATE BROKEN", 30, 115, 690, 109, 62, Ink, TextAnchor.MiddleCenter, true);
- Label(page, "THE LORD BELOW IS FREE", 30, 230, 690, 40, 22, Gold, TextAnchor.MiddleCenter);
- Label(page, run.Score.ToString("N0"), 30, 300, 690, 115, 76, Gold, TextAnchor.MiddleCenter, true);
- var ledger = Panel(page, "Run results", 55, 455, 640, 320, "271F20", "836345");
- string[] stats = { "Night reached", "Demons slain", "Towers forged", "Coins earned", "Soul shards" };
- int[] values = { run.Day, run.Kills, run.Forged, run.Earned, run.EarnedShards };
- for (int i = 0; i < stats.Length; i++)
- {
- Label(ledger.transform, stats[i], 26, 15 + 58 * i, 398, 50, 22, Muted);
- Label(ledger.transform, values[i].ToString(), 392, 15 + 58 * i, 220, 50, 26, Ink,
- TextAnchor.MiddleRight);
- }
- ButtonAt(page, run.UsedCoinRevive ? "COIN REVIVE USED" : "REVIVE · 300 COINS", 55, 808, 640, 77,
- () => Revive(false), true, 24, !run.UsedCoinRevive && run.Available >= 300);
- ButtonAt(page, run.UsedAdRevive ? "AD REVIVE USED" : "REVIVE · WATCH AD", 55, 902, 640, 72,
- () => Ad(() => Revive(true)), false, 23, !run.UsedAdRevive);
- ButtonAt(page, "TRY AGAIN", 55, 1061, 640, 78, StartGame, true, 26);
- ButtonAt(page, "BACK TO LOBBY", 55, 1158, 640, 68, ShowLobby, false, 22);
- }
- void Revive(bool ad)
- {
- if (run.Revive(ad))
- ShowBattle();
- }
- void CloseSheet()
- {
- Remove(modal);
- modal = null;
- sheetBody = null;
- }
- void FitModalVeil()
- {
- var veil = (RectTransform)modal.GetChild(0);
- Vector2 topLeft = modal.InverseTransformPoint(screen.TransformPoint(new Vector2(screen.rect.xMin, screen.rect.yMax)));
- Vector2 bottomRight = modal.InverseTransformPoint(screen.TransformPoint(new Vector2(screen.rect.xMax, screen.rect.yMin)));
- veil.anchoredPosition = topLeft;
- veil.sizeDelta = new Vector2(bottomRight.x - topLeft.x, topLeft.y - bottomRight.y);
- }
- void Sheet(string title, Action contents, string footer = "CLOSE", Action footAction = null,
- bool closable = true)
- {
- CloseSheet();
- modal = Box(frame, "Modal", 0, 0, 750, 1334);
- Solid(modal, "Veil", 0, 0, 750, 1334, new Color(.03f, .02f, .025f, .78f), true);
- FitModalVeil();
- var window = Panel(modal, title, 45, 271, 660, 790, "302427", "AC8358", 12, "1A181B").rectTransform;
- Label(window, title, 23, 15, 555, 69, 31, Ink, TextAnchor.MiddleLeft, true);
- if (closable)
- ButtonAt(window, "×", 574, 18, 61, 58, CloseSheet, false, 29);
- Solid(window, "Rule", 22, 92, 616, 1, Hex("826344"));
- var vp = Box(window, "Scroll area", 22, 108, BodyW, 558);
- var scroll = vp.gameObject.AddComponent<ScrollRect>();
- scroll.horizontal = false;
- scroll.movementType = ScrollRect.MovementType.Clamped;
- scroll.scrollSensitivity = 34;
- vp.gameObject.AddComponent<RectMask2D>();
- var surface = vp.gameObject.AddComponent<Image>();
- surface.color = Color.clear;
- surface.raycastTarget = true;
- sheetBody = Box(vp, "Contents", 0, 0, BodyW, 558);
- scroll.viewport = vp;
- scroll.content = sheetBody;
- bodyY = 2;
- contents();
- sheetBody.sizeDelta = new Vector2(BodyW, Mathf.Max(558, bodyY + 8));
- ButtonAt(window, footer, 23, 692, 614, 72, footAction ?? CloseSheet, true, 23);
- }
- void Note(string value, float height = 78)
- {
- Label(sheetBody, value, 9, bodyY, BodyW - 18, height, 22, Muted, TextAnchor.MiddleLeft, false, false);
- bodyY += height + 8;
- }
- void Stat(string k, string v)
- {
- Label(sheetBody, k, 9, bodyY, 336, 54, 21, Muted);
- Label(sheetBody, v, 325, bodyY, 281, 54, 22, Ink, TextAnchor.MiddleRight);
- Solid(sheetBody, "Divider", 8, bodyY + 53, BodyW - 16, 1, Hex("493B3A"));
- bodyY += 57;
- }
- void Choice(string label, Action action, bool enabled = true)
- {
- ButtonAt(sheetBody, label, 6, bodyY, BodyW - 12, 63, action, false, 21, enabled);
- bodyY += 73;
- }
- void Product(string art, string title, string detail, string buy, Action action, bool enabled = true)
- {
- Image(sheetBody, title, art, 6, bodyY + 2, 70, 70);
- Label(sheetBody, title, 95, bodyY + 1, 265, 34, 22, Ink);
- Label(sheetBody, detail, 95, bodyY + 35, 267, 36, 18, Muted, TextAnchor.MiddleLeft, false, false);
- ButtonAt(sheetBody, buy, 363, bodyY + 8, 242, 54, action, false, 18, enabled);
- bodyY += 85;
- }
- void PauseSheet()
- {
- if (animating || run.Phase == Phase.RestChoice)
- return;
- Sheet("PAUSED",
- () =>
- {
- Stat("Night", run.Day.ToString());
- Stat("Score", run.Score.ToString());
- Stat("Seal", run.Plates + " / " + run.MaxPlates);
- Stat("Moves left", run.Phase == Phase.Rest ? "Unlimited" : run.Moves.ToString());
- int count = 0;
- foreach (var p in run.Board)
- if (p?.Tower == true)
- count++;
- Stat("Gear on board", count.ToString());
- Choice("HOW TO PLAY", Help);
- Choice("END RUN", () => Sheet("END THIS RUN?",
- () => Note("Return to your keep and bank this run’s earnings."),
- "END RUN & BANK",
- () =>
- {
- run.Quit();
- ShowLobby();
- }));
- },
- "RESUME");
- }
- void RestSheet()
- {
- Sheet("BOSS SLAIN",
- () =>
- {
- Note("The shadow has fallen. Take a rest night to rearrange your defence and repair the seal.",
- 107);
- Stat("Moves", "Unlimited");
- Stat("New material", "None");
- Stat("After DONE", "Horde attacks");
- Choice("KEEP FIGHTING", () =>
- {
- run.ChooseRest(false);
- ShowBattle();
- });
- },
- "TAKE REST NIGHT",
- () =>
- {
- run.ChooseRest(true);
- ShowBattle();
- },
- false);
- }
- void SealSheet()
- {
- if (animating)
- return;
- bool rest = run.Phase == Phase.Rest;
- int cost = 500 + 250 * (profile.gateLevel - 1);
- Sheet("GATE SEAL", () =>
- {
- Stat("Integrity", run.Plates + " / " + run.MaxPlates);
- Stat("Permanent level", profile.gateLevel + " / 8");
- Stat("Coins", run.Available.ToString());
- Note(rest ? "Restore two stones or permanently raise the seal limit."
- : "Repairs and permanent upgrades open on a rest night.");
- Choice("MEND +2 · 200 COINS",
- () =>
- {
- run.Repair(false);
- RefreshHud();
- SealSheet();
- },
- rest && run.Plates < run.MaxPlates && run.Available >= 200);
- Choice("MEND +2 · WATCH AD",
- () => Ad(() =>
- {
- run.Repair(true);
- RefreshHud();
- SealSheet();
- }),
- rest && !run.UsedRepairAd && run.Plates < run.MaxPlates);
- Choice("UPGRADE · " + cost + " COINS",
- () =>
- {
- run.UpgradeGate();
- RefreshHud();
- SealSheet();
- },
- rest && profile.gateLevel < 8 && run.Available >= cost);
- });
- }
- void GearSheet(int r, int c)
- {
- var p = run.Board[r, c];
- int index = (int)p.Kind - (int)Kind.Cannon;
- string[] tips = { "Fires along one side of this row. All targets on that side are hit.",
- "Fires up or down this lane, including the approach to the board.",
- "Targets the nearest demon in the surrounding 3 × 3 area.",
- "Slows every demon on its square by half for one second." };
- Sheet(p.Kind.ToString().ToUpperInvariant(),
- () =>
- {
- var icon = Image(sheetBody, p.Art, p.Art, 232, 5, 150, 140);
- if (pieces.TryGetValue(p, out var figure)) icon.uvRect = figure.uvRect;
- bodyY = 155;
- Note(tips[index]);
- Stat("Tier", p.Tier + " / 3");
- Stat("Damage", Rules.Damage[index, p.Tier - 1].ToString());
- Stat("Cooldown", Rules.Cooldown[index].ToString("0.00") + " s");
- Choice("DEMOLISH · +25 COINS", () =>
- {
- CloseSheet();
- run.Demolish(r, c);
- PlayBoard();
- });
- },
- "KEEP");
- }
- void Merchant()
- {
- if (animating || tutorial >= 0 || run.Phase == Phase.RestChoice)
- return;
- Sheet("MERCHANT", () =>
- {
- Stat("Available coins", run.Available.ToString());
- for (int i = 0; i < 3; i++)
- {
- int tier = i + 1;
- int price = Rules.ChestPrice[i];
- Product("chest" + tier, Rules.ChestNames[i], "+" + Rules.ChestMoves[i] + " moves",
- price + " COINS",
- () =>
- {
- if (run.BuyChest(tier))
- {
- CloseSheet();
- PlayBoard();
- Toast("CHEST PURCHASED");
- }
- },
- run.CanArrange && run.Available >= price);
- }
- Choice(run.UsedTowerAd ? "TOWER CLAIMED" : "RANDOM TOWER · WATCH AD",
- () => Ad(() =>
- {
- if (run.AdTower())
- PlayBoard();
- else
- Toast("NO SPACE FOR A TOWER");
- }),
- run.CanArrange && !run.UsedTowerAd);
- });
- }
- void Vault()
- {
- Sheet("CHEST VAULT", () =>
- {
- Stat("Coins", profile.coins.ToString());
- Note("Purchased chests arrive on the top row when a material slot is available.");
- for (int i = 0; i < 4; i++)
- {
- int tier = i + 1, price = Rules.ChestPrice[i];
- Product("chest" + tier, Rules.ChestNames[i],
- "+" + Rules.ChestMoves[i] + " moves · Held " + profile.stock[i],
- price + " COINS",
- () =>
- {
- if (profile.BuyStoredChest(tier))
- {
- ShowLobby();
- Vault();
- }
- },
- profile.coins >= price);
- }
- });
- }
- static long Now => DateTimeOffset.UtcNow.ToUnixTimeSeconds();
- static long WaitForAd(long last) => Math.Max(0, last + 21600 - Now);
- static string AdLabel(string reward,
- long wait) => wait == 0
- ? reward
- : "AVAILABLE IN " + TimeSpan.FromSeconds(wait).ToString(@"hh\:mm");
- void CoinStore()
- {
- Sheet("COIN STORE", () =>
- {
- Stat("Balance", profile.coins.ToString());
- long wait = WaitForAd(profile.lastCoinAd);
- Choice(AdLabel("WATCH AD · +120 COINS", wait),
- () => Ad(() =>
- {
- if (WaitForAd(profile.lastCoinAd) == 0)
- {
- profile.lastCoinAd = Now;
- profile.coins += 120;
- profile.Record(120, "Rewarded ad");
- profile.Save();
- }
- ShowLobby();
- CoinStore();
- }),
- wait == 0);
- Note("Coin packs are a preview in this edition.", 60);
- foreach (string entry in profile.ledger)
- Note(entry, 45);
- });
- }
- void Workshop()
- {
- Sheet("WORKSHOP", () =>
- {
- Stat("Soul shards", profile.shards.ToString());
- long wait = WaitForAd(profile.lastShardAd);
- Choice(AdLabel("WATCH AD · +1–3 SHARDS", wait),
- () => Ad(() =>
- {
- if (WaitForAd(profile.lastShardAd) == 0)
- {
- profile.lastShardAd = Now;
- profile.shards += UnityEngine.Random.Range(1, 4);
- profile.Save();
- }
- ShowLobby();
- Workshop();
- }),
- wait == 0);
- for (int i = 0; i < 4; i++)
- {
- int node = i, lvl = profile.workshop[i];
- var costs = Rules.UpgradeCosts[i];
- Stat(Rules.WorkshopNames[i], "Lv " + lvl + " / " + costs.Length);
- Note(nodeInfo[i], 43);
- Choice(lvl < costs.Length ? "UPGRADE · " + costs[lvl] + " SHARDS" : "MAX LEVEL",
- () =>
- {
- if (profile.BuyUpgrade(node))
- {
- ShowLobby();
- Workshop();
- }
- },
- lvl < costs.Length && profile.shards >= costs[lvl]);
- }
- });
- }
- void Rank(bool byScore)
- {
- Sheet("LEADERBOARD",
- () =>
- {
- Choice(byScore ? "SHOW BY NIGHT" : "SHOW BY SCORE", () => Rank(!byScore));
- string[] names = { "GrimWarden", "AshVex", "MolochJr", "SableHorn", "Pyre",
- "Nyx", "BoneTail", "Emberly", "DuskWing", "Ruin" };
- int[] values = byScore
- ? new[] { 31240, 26880, 24110, 20930, 17420, 14880, 12060, 9840, 7620, 4980 }
- : new[] { 48, 43, 39, 34, 29, 25, 21, 17, 14, 9 };
- int mine = byScore ? profile.score : profile.bestNight;
- var rows = new List<KeyValuePair<string, int>>();
- for (int i = 0; i < names.Length; i++)
- rows.Add(new KeyValuePair<string, int>(names[i], values[i]));
- rows.Add(new KeyValuePair<string, int>(profile.name + " (you)", mine));
- rows.Sort((a, b) => b.Value.CompareTo(a.Value));
- for (int i = 0; i < rows.Count; i++)
- Stat((i + 1) + ". " + rows[i].Key, (byScore ? "" : "Night ") + rows[i].Value);
- });
- }
- void ProfileSheet()
- {
- Sheet("WARDEN PROFILE", () =>
- {
- var edit =
- Panel(sheetBody, "Name field", 7, bodyY, 405, 62, "191719", "7C624E");
- edit.raycastTarget = true;
- var input = edit.gameObject.AddComponent<InputField>();
- input.targetGraphic = edit;
- input.textComponent = Label(edit.transform, "", 12, 2, 378, 56, 24, Ink);
- input.characterLimit = 14;
- input.text = profile.name;
- ButtonAt(sheetBody, "SAVE NAME", 423, bodyY, 182, 62,
- () =>
- {
- string n = input.text.Trim();
- if (n.Length > 0)
- {
- profile.name = n;
- profile.Save();
- ShowLobby();
- ProfileSheet();
- }
- },
- false, 17);
- bodyY += 82;
- for (int i = 0; i < 8; i++)
- {
- int idx = i;
- float x = (i % 4) * 148 + 15, y = bodyY + (i / 4) * 89;
- Panel(sheetBody, "Portrait", x, y, 78, 78, "201C20",
- profile.avatar == i ? "E6B36F" : "655446");
- Image(sheetBody, "Portrait " + i, "av_" + i, x + 4, y + 4, 70, 70);
- Hotspot(sheetBody, "Choose " + i, x, y, 78, 78,
- () =>
- {
- profile.avatar = idx;
- profile.Save();
- ShowLobby();
- ProfileSheet();
- });
- }
- bodyY += 191;
- Stat("Account", profile.auth == "apple" ? "Apple (local)" : "Guest");
- Stat("Best night", profile.bestNight.ToString());
- Stat("Total score", profile.score.ToString());
- Stat("Kills / forged", profile.kills + " / " + profile.forged);
- Stat("Coins", profile.coins.ToString());
- if (profile.auth != "apple")
- Choice("LINK APPLE · LOCAL DEMO", () =>
- {
- profile.auth = "apple";
- profile.Save();
- ProfileSheet();
- });
- });
- }
- void Settings()
- {
- Sheet("SETTINGS",
- () =>
- {
- Choice("SOUND EFFECTS " + (profile.sound ? "ON" : "OFF"), () =>
- {
- profile.sound = !profile.sound;
- profile.Save();
- Settings();
- });
- Choice("MUSIC " + (profile.music ? "ON" : "OFF"), () =>
- {
- profile.music = !profile.music;
- SyncMusic();
- profile.Save();
- Settings();
- });
- Choice("HAPTICS " + (profile.haptics ? "ON" : "OFF"), () =>
- {
- profile.haptics = !profile.haptics;
- profile.Save();
- Settings();
- });
- Stat("Language", "English");
- Stat("Version", Application.version);
- Choice("TERMS OF SERVICE", () => Legal(false));
- Choice("PRIVACY POLICY", () => Legal(true));
- Choice("SIGN OUT", () =>
- {
- profile.auth = "";
- profile.Save();
- ShowStart();
- });
- Choice("DELETE LOCAL ACCOUNT",
- () => Sheet(
- "DELETE LOCAL PROGRESS?",
- () => Note("This removes the account, purchases, upgrades and records on this device.",
- 120),
- "DELETE PROGRESS",
- () =>
- {
- var save = profile.OnSave;
- profile = new Profile();
- profile.OnSave = save;
- profile.Save();
- SyncMusic();
- ShowStart();
- }));
- });
- }
- void Legal(bool privacy) => Sheet(
- privacy ? "PRIVACY" : "TERMS",
- () => Note(
- privacy
- ? "This edition stores your guest or simulated Apple profile, preferences and game progress locally on this device. You can delete them in Settings."
- : "This local game prototype uses simulated accounts and rewarded videos. Coin pack previews do not process payments.",
- 180));
- void Help()
- {
- Sheet("HOW TO PLAY",
- () =>
- {
- for (int i = 0; i < GuideTitle.Length; i++)
- {
- Label(sheetBody, GuideTitle[i], 8, bodyY, 605, 44, 21, Gold);
- bodyY += 47;
- Note(GuideBody[i], 82);
- }
- Note("A normal demon breaks one seal stone. A Boss reaching the gate breaks the entire seal.",
- 82);
- });
- }
- void Ad(Action reward)
- {
- if (watchingAd)
- return;
- CloseSheet();
- watchingAd = true;
- modal = Box(frame, "Rewarded ad", 0, 0, 750, 1334);
- Solid(modal, "Ad backdrop", 0, 0, 750, 1334, Hex("111014"), true);
- Label(modal, "REWARDED VIDEO", 25, 487, 700, 83, 40, Gold, TextAnchor.MiddleCenter, true);
- Label(modal, "Local preview", 25, 577, 700, 55, 23, Muted, TextAnchor.MiddleCenter);
- var seconds = Label(modal, "3", 25, 651, 700, 99, 54, Ink, TextAnchor.MiddleCenter);
- StartCoroutine(Countdown(seconds, reward));
- }
- IEnumerator Countdown(Text label, Action reward)
- {
- for (int n = 3; n > 0; n--)
- {
- label.text = n.ToString();
- yield return new WaitForSecondsRealtime(.72f);
- }
- watchingAd = false;
- CloseSheet();
- reward();
- }
- }
- }
|