コード例 #1
0
ファイル: LevelButtonEditor.cs プロジェクト: dqtoy/Three
    void DrawWall()
    {
        help = "White wall - wall which is absent";
        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));
                    }
                }
            }
        }
    }
コード例 #2
0
ファイル: LevelButtonEditor.cs プロジェクト: dqtoy/Three
    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;
    }
コード例 #3
0
ファイル: LevelButtonEditor.cs プロジェクト: dqtoy/Three
    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.black;
        }
        GUI.color = color;

        if (t == "V")
        {
            btn = GUI.Button(new Rect(r.xMin + (x + 1) * (30 + slotOffect) - 5 - slotOffect / 2,
                                      r.yMin + y * (30 + slotOffect) - 10 + 15, 10, 20), "", slotStyle);
        }
        if (t == "H")
        {
            btn = GUI.Button(new Rect(r.xMin + x * (30 + slotOffect) - 10 + 15,
                                      r.yMin + (y + 1) * (30 + slotOffect) - 5 - slotOffect / 2, 20, 10), "", slotStyle);
        }
        GUI.color = defaultColor;
        return(btn);
    }
コード例 #4
0
    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;
    }
コード例 #5
0
 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;
 }