예제 #1
0
        public static (GameObject bg, GameObject interact_bg) CreateBackgrounds(GameObject canvas)
        {
            GameObject bg = CanvasUtil.CreateImagePanel
                            (
                canvas,
                CanvasUtil.NullSprite(new byte[] { 0, 0, 0, 64 }),
                new CanvasUtil.RectData
                (
                    new Vector2(600, 600),
                    // Anchor bottom left to the top-right minus the size
                    new Vector2(1920 - 600, 1080 - 600),
                    Vector2.zero,
                    Vector2.zero,
                    Vector2.zero
                )
                            );

            bg.GetComponent <Image>().preserveAspect = false;

            GameObject interact_bg = CanvasUtil.CreateImagePanel
                                     (
                canvas,
                CanvasUtil.NullSprite(new byte[] { 0, 0, 0, 96 }),
                new CanvasUtil.RectData
                (
                    new Vector2(600, 600),
                    // Same anchor as before, but minus the (y) size again so it's beneath the previous box.
                    new Vector2(1920 - 600, 1080 - 600 - 20),
                    Vector2.zero,
                    Vector2.zero,
                    Vector2.zero
                )
                                     );

            return(bg, interact_bg);
        }