Exemplo n.º 1
0
 public static Sprite getLightsOutButtonSprite()
 {
     if (lightOutButtonSprite)
     {
         return(lightOutButtonSprite);
     }
     lightOutButtonSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.LightsOutButton.png", 115f);
     return(lightOutButtonSprite);
 }
Exemplo n.º 2
0
 public static Sprite getTricksterVentButtonSprite()
 {
     if (tricksterVentButtonSprite)
     {
         return(tricksterVentButtonSprite);
     }
     tricksterVentButtonSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.TricksterVentButton.png", 115f);
     return(tricksterVentButtonSprite);
 }
Exemplo n.º 3
0
 public static Sprite getButtonSprite()
 {
     if (buttonSprite)
     {
         return(buttonSprite);
     }
     buttonSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.VampireButton.png", 115f);
     return(buttonSprite);
 }
Exemplo n.º 4
0
 public static Sprite getSidekickButtonSprite()
 {
     if (buttonSprite)
     {
         return(buttonSprite);
     }
     buttonSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.SidekickButton.png", 100f);
     return(buttonSprite);
 }
Exemplo n.º 5
0
 public static Sprite getZoomOutSprite()
 {
     if (zoomOutSprite)
     {
         return(zoomOutSprite);
     }
     zoomOutSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.GMZoomOut.png", 115f / 2f);
     return(zoomOutSprite);
 }
Exemplo n.º 6
0
 public static Sprite getFootprintSprite()
 {
     if (sprite)
     {
         return(sprite);
     }
     sprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.Footprint.png", 600f);
     return(sprite);
 }
Exemplo n.º 7
0
 public static Sprite getSprite()
 {
     if (sprite)
     {
         return(sprite);
     }
     sprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.Arrow.png", 200f);
     return(sprite);
 }
Exemplo n.º 8
0
 public static Sprite getBombEffectSprite()
 {
     if (bombeffectSprite)
     {
         return(bombeffectSprite);
     }
     bombeffectSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.BombEffect.png", 300f);
     return(bombeffectSprite);
 }
Exemplo n.º 9
0
 public static Sprite getCloseVentButtonSprite()
 {
     if (closeVentButtonSprite)
     {
         return(closeVentButtonSprite);
     }
     closeVentButtonSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.CloseVentButton.png", 115f);
     return(closeVentButtonSprite);
 }
Exemplo n.º 10
0
        public static Sprite getImage(string key, float pixelsPerUnit)
        {
            key = getString(key);
            key = key.Replace("/", ".");
            key = key.Replace("\\", ".");
            key = "TheOtherRoles.Resources." + key;

            return(Helpers.loadSpriteFromResources(key, pixelsPerUnit));
        }
Exemplo n.º 11
0
 public static Sprite getStaticVentSealedSprite()
 {
     if (staticVentSealedSprite)
     {
         return(staticVentSealedSprite);
     }
     staticVentSealedSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.StaticVentSealed.png", 160f); // Change sprite and pixelPerUnit
     return(staticVentSealedSprite);
 }
Exemplo n.º 12
0
 public static Sprite getSenriganIcon()
 {
     if (senriganIcon)
     {
         return(senriganIcon);
     }
     senriganIcon = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.Senrigan.png", 115f);
     return(senriganIcon);
 }
Exemplo n.º 13
0
 public static Sprite getGarlicButtonSprite()
 {
     if (garlicButtonSprite)
     {
         return(garlicButtonSprite);
     }
     garlicButtonSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.GarlicButton.png", 115f);
     return(garlicButtonSprite);
 }
Exemplo n.º 14
0
 public static Sprite getCurseKillButtonSprite()
 {
     if (curseKillButtonSprite)
     {
         return(curseKillButtonSprite);
     }
     curseKillButtonSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.CurseKillButton.png", 115f);
     return(curseKillButtonSprite);
 }
Exemplo n.º 15
0
 public static Sprite getBackgroundSprite()
 {
     if (backgroundSprite)
     {
         return(backgroundSprite);
     }
     backgroundSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.GarlicBackground.png", 60f);
     return(backgroundSprite);
 }
Exemplo n.º 16
0
 public static Sprite getAdminTableIconSprite()
 {
     if (adminTableIcon)
     {
         return(adminTableIcon);
     }
     adminTableIcon = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.AdminTableIcon.png", 350f);
     return(adminTableIcon);
 }
Exemplo n.º 17
0
 public static Sprite getPlaceBoxButtonSprite()
 {
     if (placeBoxButtonSprite)
     {
         return(placeBoxButtonSprite);
     }
     placeBoxButtonSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.PlaceJackInTheBoxButton.png", 115f);
     return(placeBoxButtonSprite);
 }
Exemplo n.º 18
0
 public static Sprite getMorphSprite()
 {
     if (morphSprite)
     {
         return(morphSprite);
     }
     morphSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.MorphButton.png", 115f);
     return(morphSprite);
 }
Exemplo n.º 19
0
 public static Sprite getSampleSprite()
 {
     if (sampleSprite)
     {
         return(sampleSprite);
     }
     sampleSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.SampleButton.png", 115f);
     return(sampleSprite);
 }
Exemplo n.º 20
0
 public static Sprite getSoulSprite()
 {
     if (soulSprite)
     {
         return(soulSprite);
     }
     soulSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.Soul.png", 500f);
     return(soulSprite);
 }
Exemplo n.º 21
0
 public static Sprite getCheckSprite()
 {
     if (spriteCheck)
     {
         return(spriteCheck);
     }
     spriteCheck = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.SwapperCheck.png", 150f);
     return(spriteCheck);
 }
Exemplo n.º 22
0
 public static List <Sprite> getBoxAnimationSprites()
 {
     if (boxAnimationSprites != null)
     {
         return(boxAnimationSprites);
     }
     boxAnimationSprites = new List <Sprite>();
     for (int i = 1; i < 19; i++)
     {
         boxAnimationSprites.Add(Helpers.loadSpriteFromResources($"TheOtherRoles.Resources.TricksterAnimation.trickster_box_00{i:00}.png", 175f));
     }
     return(boxAnimationSprites);
 }
Exemplo n.º 23
0
 public static Sprite getBoxAnimationSprite(int index)
 {
     if (boxAnimationSprites == null || boxAnimationSprites.Length == 0)
     {
         return(null);
     }
     index = Mathf.Clamp(index, 0, boxAnimationSprites.Length - 1);
     if (boxAnimationSprites[index] == null)
     {
         boxAnimationSprites[index] = (Helpers.loadSpriteFromResources($"TheOtherRoles.Resources.TricksterAnimation.trickster_box_00{(index + 1):00}.png", 175f));
     }
     return(boxAnimationSprites[index]);
 }
Exemplo n.º 24
0
            static void Postfix(PingTracker __instance)
            {
                var amongUsLogo = GameObject.Find("bannerLogo_AmongUs");

                if (amongUsLogo != null)
                {
                    amongUsLogo.transform.localScale *= 0.6f;
                    amongUsLogo.transform.position   += Vector3.up * 0.25f;
                }

                var torLogo = new GameObject("bannerLogo_TOR");

                torLogo.transform.position = Vector3.up;
                var renderer = torLogo.AddComponent <SpriteRenderer>();

                renderer.sprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.Banner.png", 300f);
            }
Exemplo n.º 25
0
        public static bool initializeOverlays()
        {
            HudManager hudManager = DestroyableSingleton <HudManager> .Instance;

            if (hudManager == null)
            {
                return(false);
            }

            if (helpButton == null)
            {
                helpButton = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.HelpButton.png", 115f);
            }

            if (colorBG == null)
            {
                colorBG = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.White.png", 100f);
            }

            if (meetingUnderlay == null)
            {
                meetingUnderlay = UnityEngine.Object.Instantiate(hudManager.FullScreen, hudManager.transform);
                meetingUnderlay.transform.localPosition = new Vector3(0f, 0f, 20f);
                meetingUnderlay.gameObject.SetActive(true);
                meetingUnderlay.enabled = false;
            }

            if (infoUnderlay == null)
            {
                infoUnderlay = UnityEngine.Object.Instantiate(meetingUnderlay, hudManager.transform);
                infoUnderlay.transform.localPosition = new Vector3(0f, 0f, -900f);
                infoUnderlay.gameObject.SetActive(true);
                infoUnderlay.enabled = false;
            }

            if (infoOverlayRules == null)
            {
                infoOverlayRules          = UnityEngine.Object.Instantiate(hudManager.TaskText, hudManager.transform);
                infoOverlayRules.fontSize = infoOverlayRules.fontSizeMin = infoOverlayRules.fontSizeMax = 1.15f;
                infoOverlayRules.autoSizeTextContainer   = false;
                infoOverlayRules.enableWordWrapping      = false;
                infoOverlayRules.alignment               = TMPro.TextAlignmentOptions.TopLeft;
                infoOverlayRules.transform.position      = Vector3.zero;
                infoOverlayRules.transform.localPosition = new Vector3(-2.5f, 1.15f, -910f);
                infoOverlayRules.transform.localScale    = Vector3.one;
                infoOverlayRules.color   = Palette.White;
                infoOverlayRules.enabled = false;
            }

            if (infoOverlayRoles == null)
            {
                infoOverlayRoles = UnityEngine.Object.Instantiate(infoOverlayRules, hudManager.transform);
                infoOverlayRoles.maxVisibleLines         = 28;
                infoOverlayRoles.fontSize                = infoOverlayRoles.fontSizeMin = infoOverlayRoles.fontSizeMax = 1.15f;
                infoOverlayRoles.outlineWidth           += 0.02f;
                infoOverlayRoles.autoSizeTextContainer   = false;
                infoOverlayRoles.enableWordWrapping      = false;
                infoOverlayRoles.alignment               = TMPro.TextAlignmentOptions.TopLeft;
                infoOverlayRoles.transform.position      = Vector3.zero;
                infoOverlayRoles.transform.localPosition = infoOverlayRules.transform.localPosition + new Vector3(2.5f, 0.0f, 0.0f);
                infoOverlayRoles.transform.localScale    = Vector3.one;
                infoOverlayRoles.color   = Palette.White;
                infoOverlayRoles.enabled = false;
            }

            if (roleUnderlay == null)
            {
                roleUnderlay = UnityEngine.Object.Instantiate(meetingUnderlay, hudManager.transform);
                roleUnderlay.transform.localPosition = new Vector3(0f, 0f, -900f);
                roleUnderlay.gameObject.SetActive(true);
                roleUnderlay.enabled = false;
            }

            if (roleOverlayList == null)
            {
                roleOverlayList = new TMPro.TextMeshPro[3];
            }

            for (var i = 0; i < roleOverlayList.Length; i++)
            {
                if (roleOverlayList[i] == null)
                {
                    if (i == 0)
                    {
                        roleOverlayList[i] = UnityEngine.Object.Instantiate(hudManager.TaskText, hudManager.transform);

                        initializeRoleOverlay(roleOverlayList[i]);

                        roleOverlayList[i].transform.localPosition = new Vector3(-3.5f, 1.2f, -910f);
                    }
                    else
                    {
                        roleOverlayList[i] = UnityEngine.Object.Instantiate(roleOverlayList[i - 1], hudManager.transform);

                        initializeRoleOverlay(roleOverlayList[i]);

                        roleOverlayList[i].transform.localPosition = roleOverlayList[i - 1].transform.localPosition + new Vector3(3.1f, 0.0f, 0.0f);
                    }
                }
            }

            if (roleDatas == null)
            {
                roleDatas = new List <string>();

                StringBuilder entry   = new StringBuilder();
                List <string> entries = new List <string>();

                // First add the presets and the role counts
                entries.Add(GameOptionsDataPatch.optionToString(CustomOptionHolder.presetSelection));

                var optionName = CustomOptionHolder.cs(new Color(204f / 255f, 204f / 255f, 0, 1f), ModTranslation.getString("crewmateRoles"));
                var min        = CustomOptionHolder.crewmateRolesCountMin.getSelection();
                var max        = CustomOptionHolder.crewmateRolesCountMax.getSelection();
                if (min > max)
                {
                    min = max;
                }
                var optionValue = (min == max) ? $"{max}" : $"{min} - {max}";
                entry.AppendLine($"{optionName}: {optionValue}");

                optionName = CustomOptionHolder.cs(new Color(204f / 255f, 204f / 255f, 0, 1f), ModTranslation.getString("neutralRoles"));
                min        = CustomOptionHolder.neutralRolesCountMin.getSelection();
                max        = CustomOptionHolder.neutralRolesCountMax.getSelection();
                if (min > max)
                {
                    min = max;
                }
                optionValue = (min == max) ? $"{max}" : $"{min} - {max}";
                entry.AppendLine($"{optionName}: {optionValue}");

                optionName = CustomOptionHolder.cs(new Color(204f / 255f, 204f / 255f, 0, 1f), ModTranslation.getString("impostorRoles"));
                min        = CustomOptionHolder.impostorRolesCountMin.getSelection();
                max        = CustomOptionHolder.impostorRolesCountMax.getSelection();
                if (min > max)
                {
                    min = max;
                }
                optionValue = (min == max) ? $"{max}" : $"{min} - {max}";
                entry.AppendLine($"{optionName}: {optionValue}");

                entries.Add(entry.ToString().Trim('\r', '\n'));

                int maxLines = 28;

                foreach (CustomOption option in CustomOption.options)
                {
                    if ((option == CustomOptionHolder.presetSelection) ||
                        (option == CustomOptionHolder.crewmateRolesCountMin) ||
                        (option == CustomOptionHolder.crewmateRolesCountMax) ||
                        (option == CustomOptionHolder.neutralRolesCountMin) ||
                        (option == CustomOptionHolder.neutralRolesCountMax) ||
                        (option == CustomOptionHolder.impostorRolesCountMin) ||
                        (option == CustomOptionHolder.impostorRolesCountMax))
                    {
                        continue;
                    }

                    if (option.parent == null)
                    {
                        if (!option.enabled)
                        {
                            continue;
                        }

                        entry = new StringBuilder();
                        if (!option.isHidden)
                        {
                            entry.AppendLine(GameOptionsDataPatch.optionToString(option));
                        }

                        addChildren(option, ref entry, !option.isHidden);

                        // 1つのオプションが最大行を越えていた場合、最大行までで分割する
                        int lines = entry.ToString().Trim('\r', '\n').Count(c => c == '\n') + 1;
                        while (lines > maxLines)
                        {
                            var line       = 0;
                            var newEntry   = new StringBuilder();
                            var entryLines = entry.ToString().Trim('\r', '\n').Split(new[] { "\r\n", "\n", "\r" }, StringSplitOptions.None);
                            foreach (var entryLine in entryLines)
                            {
                                newEntry.AppendLine(entryLine);
                                entry.Remove(0, entryLine.Length + Environment.NewLine.Length);
                                line++;
                                if (maxLines <= line)
                                {
                                    break;
                                }
                            }
                            entries.Add(newEntry.ToString().Trim('\r', '\n'));
                            lines -= maxLines;
                        }

                        entries.Add(entry.ToString().Trim('\r', '\n'));
                    }
                }

                int    lineCount = 0;
                string page      = "";
                foreach (var e in entries)
                {
                    int lines = e.Count(c => c == '\n') + 1;

                    if (lineCount + lines > maxLines)
                    {
                        roleDatas.Add(page);
                        page      = "";
                        lineCount = 0;
                    }

                    page       = page + e + "\n\n";
                    lineCount += lines + 1;
                }

                page = page.Trim('\r', '\n');
                if (page != "")
                {
                    roleDatas.Add(page);
                }

                maxRolePage = ((roleDatas.Count - 1) / 3) + 1;
            }

            return(true);
        }