コード例 #1
0
ファイル: LevelEditor.cs プロジェクト: nick-yangzj/MyMatch1
        static bool DrawWallButton(int x, int y, string t, Rect r, LevelProfile lp)
        {
            bool btn = false;

            if (t == "H")
            {
                btn = lp.GetWallH(x, y);
            }
            if (t == "V")
            {
                btn = lp.GetWallV(x, y);
            }

            defaultColor = GUI.color;
            Color color = defaultColor;

            if (btn)
            {
                color *= Color.red;
            }
            GUI.color = color;

            if (t == "V")
            {
                btn = GUI.Button(new Rect(r.xMin + (x + 1) * (cellSize + slotOffect) - 4 - slotOffect / 2,
                                          r.yMin + y * (cellSize + slotOffect) - 10 + 20, 8, 20), "", slotStyle);
            }
            if (t == "H")
            {
                btn = GUI.Button(new Rect(r.xMin + x * (cellSize + slotOffect) - 10 + 20,
                                          r.yMin + (y + 1) * (cellSize + slotOffect) - 4 - slotOffect / 2, 20, 8), "", slotStyle);
            }
            GUI.color = defaultColor;
            return(btn);
        }
コード例 #2
0
ファイル: LevelEditor.cs プロジェクト: nick-yangzj/MyMatch1
        void DrawWall()
        {
            int x;
            int y;

            DrawSlotPreview(rect, profile);
            for (x = 0; x < profile.Width - 1; x++)
            {
                for (y = 0; y < profile.Height; y++)
                {
                    if (profile.GetSlot(x, y) && profile.GetSlot(x + 1, y))
                    {
                        if (DrawWallButton(x, y, "V", rect, profile))
                        {
                            profile.SetWallV(x, y, !profile.GetWallV(x, y));
                        }
                    }
                }
            }
            for (x = 0; x < profile.Width; x++)
            {
                for (y = 0; y < profile.Height - 1; y++)
                {
                    if (profile.GetSlot(x, y) && profile.GetSlot(x, y + 1))
                    {
                        if (DrawWallButton(x, y, "H", rect, profile))
                        {
                            profile.SetWallH(x, y, !profile.GetWallH(x, y));
                        }
                    }
                }
            }
        }
コード例 #3
0
ファイル: LevelEditor.cs プロジェクト: nick-yangzj/MyMatch1
        public static void DrawWallPreview(Rect r, LevelProfile lp)
        {
            int x;
            int y;

            GUI.enabled = false;
            for (x = 0; x < lp.Width - 1; x++)
            {
                for (y = 0; y < lp.Height; y++)
                {
                    if (lp.GetWallV(x, y) && lp.GetSlot(x, y) && lp.GetSlot(x + 1, y))
                    {
                        DrawWallButton(x, y, "V", r, lp);
                    }
                }
            }
            for (x = 0; x < lp.Width; x++)
            {
                for (y = 0; y < lp.Height - 1; y++)
                {
                    if (lp.GetWallH(x, y) && lp.GetSlot(x, y) && lp.GetSlot(x, y + 1))
                    {
                        DrawWallButton(x, y, "H", r, lp);
                    }
                }
            }
            GUI.enabled = true;
        }