示例#1
0
        public void Awake()
        {
            gameEnd     = false;
            stopped     = true;
            textToggle  = true;
            _remastered = DebugManager.remastered;
            lastCostume = null;

            var ar = AspectRatio.GetAspectRatio(Screen.width, Screen.height);

            if (ar.x == 16f && ar.y == 9f)
            {
                wideAspect = true;
            }
            Logger.LogDebug($"Wide Aspect: {wideAspect}");

            DontDestroyOnLoad(gameObject);
            if (OverlayCanvas == null)
            {
                CanvasUtil.CreateFonts();
                OverlayCanvas      = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920, 1080));
                OverlayCanvas.name = "IGTDisplay";
                DontDestroyOnLoad(OverlayCanvas);

                _background = CanvasUtil.CreateImagePanel(OverlayCanvas, new Color32(0x28, 0x28, 0x28, 0x00),
                                                          wideAspect ? topRightLegacy : topRightHD);
                _textPanel = CanvasUtil.CreateTMProPanel(_background, string.Empty, 24,
                                                         TextAnchor.UpperLeft,
                                                         new CanvasUtil.RectData(new Vector2(-5, -5), new Vector2(0, 0), new Vector2(0, 0), new Vector2(1, 1)));

                tmProObjRef           = _textPanel.GetComponent <TextMeshProUGUI>();
                tmProObjRef.alignment = TextAlignmentOptions.TopRight;
            }
        }
示例#2
0
        public void Awake()
        {
            DontDestroyOnLoad(gameObject);
            if (OverlayCanvas == null)
            {
                CanvasUtil.CreateFonts();
                OverlayCanvas      = CanvasUtil.CreateCanvas(RenderMode.ScreenSpaceOverlay, new Vector2(1920, 1080));
                OverlayCanvas.name = "DebugMenu";
                DontDestroyOnLoad(OverlayCanvas);

                GameObject _background = CanvasUtil.CreateImagePanel(OverlayCanvas, new Color32(0x28, 0x28, 0x28, 0x00), topRight);
                _textPanel = CanvasUtil.CreateTMProPanel(_background, string.Empty, 20,
                                                         TextAnchor.UpperLeft,
                                                         new CanvasUtil.RectData(new Vector2(-5, -5), new Vector2(0, 0), new Vector2(0, 0), new Vector2(1, 1)));
                textComp = _textPanel.GetComponent <TextMeshProUGUI>();
            }

            foreach (string fn in Assembly.GetExecutingAssembly().GetManifestResourceNames())
            {
                if (fn.Contains("glass") || fn.Contains("talkVol"))
                {
                    using (Stream imageStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(fn))
                    {
                        byte[] imageBuffer = new byte[imageStream.Length];
                        imageStream.Read(imageBuffer, 0, imageBuffer.Length);
                        imageStream.Flush();
                        var assetName = fn.Contains("glass") ? "glass" : "talkVol";
                        modTextures[assetName] = new Texture2D(1, 1);
                        modTextures[assetName].LoadImage(imageBuffer);
                        Logger.Log($"Loaded Texture: {assetName}");
                    }
                }
            }
            warpCam      = gameObject.AddComponent <Camera>();
            warpCam.rect = new Rect(0.75f, 0f, .25f, .25f);
            warpCam.transform.position = Vector3.zero;
            warpCam.enabled            = false;
        }