Ejemplo n.º 1
0
 void OnGUI()
 {
     width  = Screen.width / 12;
     height = Screen.height / 12;
     print(my.state);
     if (my.state == State.WIN)
     {
         GUI.Button(new Rect(castw(2f), casth(6f), width, height), "YOU WIN!");
         if (GUI.Button(new Rect(castw(2f), casth(2f), width, height), "Restart"))
         {
             action.restart();
         }
     }
     else if (my.state == State.LOSE)
     {
         GUI.Button(new Rect(castw(2f), casth(6f), width, height), "Lose!");
         if (GUI.Button(new Rect(castw(2f), casth(2f), width, height), "Restart"))
         {
             action.restart();
         }
     }
     else
     {
         if (GUI.RepeatButton(new Rect(10, 10, 120, 20), my.getBaseCode().gameName))
         {
             GUI.TextArea(new Rect(10, 40, Screen.width - 20, Screen.height / 2), my.getBaseCode().gameRule);
         }
         else if (my.state == State.BSTART || my.state == State.BEND)
         {
             if (GUI.Button(new Rect(castw(2f), casth(6f), width, height), "Go"))
             {
                 action.moveBoat();
             }
             if (GUI.Button(new Rect(castw(10.5f), casth(4f), width, height), "Devil On"))
             {
                 action.devilSOnB();
             }
             if (GUI.Button(new Rect(castw(4.3f), casth(4f), width, height), "Priest On"))
             {
                 action.priestSOnB();
             }
             if (GUI.Button(new Rect(castw(1.1f), casth(4f), width, height), "Devil On"))
             {
                 action.devilEOnB();
             }
             if (GUI.Button(new Rect(castw(1.3f), casth(4f), width, height), "Priest On"))
             {
                 action.priestEOnB();
             }
             if (GUI.Button(new Rect(castw(2.5f), casth(1.3f), width, height), "Off"))
             {
                 action.offBoatL();
             }
             if (GUI.Button(new Rect(castw(1.7f), casth(1.3f), width, height), "Off"))
             {
                 action.offBoatR();
             }
         }
     }
 }
Ejemplo n.º 2
0
 void OnGUI()
 {
     width  = Screen.width / 12;
     height = Screen.height / 12;
     print(Inst.state);
     if (Inst.state == State.WIN)
     {
         if (GUI.Button(new Rect(castX(2f), castY(6f), width, height), "Win!"))
         {
             action.restart();
         }
     }
     else if (Inst.state == State.LOSE)
     {
         if (GUI.Button(new Rect(castX(2f), castY(6f), width, height), "Lose!"))
         {
             action.restart();
         }
     }
     else
     {
         if (GUI.RepeatButton(new Rect(10, 10, 120, 20), Inst.getBaseCode().gameName))
         {
             GUI.TextArea(new Rect(10, 40, Screen.width / 2, Screen.height / 4), Inst.getBaseCode().gameRule);
         }
         else if (Inst.state == State.BSTART || Inst.state == State.BEND)
         {
             if (GUI.Button(new Rect(castX(2f), castY(8f), width, height), "Move"))
             {
                 action.moveBoat();
             }
             if (GUI.Button(new Rect(castX(1.3f), castY(4f), width * 2, height), "DevilofStart"))
             {
                 action.devilStartOnBoat();
             }
             if (GUI.Button(new Rect(castX(1.3f), castY(6.34f), width * 2, height), "PriestofStart"))
             {
                 action.priestStartOnBoat();
             }
             if (GUI.Button(new Rect(castX(10.5f), castY(4f), width * 2, height), "DevilofEnd"))
             {
                 action.devilEndOnBoat();
             }
             if (GUI.Button(new Rect(castX(10.5f), castY(6.34f), width * 2, height), "PriestofEnd"))
             {
                 action.priestEndOnBoat();
             }
             if (GUI.Button(new Rect(castX(2.75f), castY(8f), width * 3 / 2, height), "LeftOff"))
             {
                 action.offBoatLeft();
             }
             if (GUI.Button(new Rect(castX(1.7f), castY(8f), width * 3 / 2, height), "RightOff"))
             {
                 action.offBoatRight();
             }
         }
     }
 }
Ejemplo n.º 3
0
    void OnGUI()
    {
        width  = Screen.width / 12;
        height = Screen.height / 12;

        string message = state.isMessage();

        if (message != "")
        {
            if (GUI.Button(new Rect(castw(2f), casth(6f), width, height), message))
            {
                action.restart();
            }
        }
        else
        {
            if (GUI.RepeatButton(new Rect(10, 10, 120, 20), scene.getBaseCode().gameName))
            {
                GUI.TextArea(new Rect(10, 40, Screen.width - 20, Screen.height / 2), scene.getBaseCode().gameRule);
            }
            else if (!state.isMoving())
            {
                if (GUI.Button(new Rect(castw(2.05f), casth(8f), width, height), "Move"))
                {
                    action.moveBoat();
                }
                if (GUI.Button(new Rect(castw(1.3f), casth(4f), width, height), "On"))
                {
                    action.devilStartOnBoat();
                }
                if (GUI.Button(new Rect(castw(1.3f), casth(6.34f), width, height), "On"))
                {
                    action.priestStartOnBoat();
                }
                if (GUI.Button(new Rect(castw(10.5f), casth(4f), width, height), "On"))
                {
                    action.devilEndOnBoat();
                }
                if (GUI.Button(new Rect(castw(10.5f), casth(6.34f), width, height), "On"))
                {
                    action.priestEndOnBoat();
                }
                if (GUI.Button(new Rect(castw(2.5f), casth(8f), width, height), "Off"))
                {
                    action.offBoatLeft();
                }
                if (GUI.Button(new Rect(castw(1.73f), casth(8f), width, height), "Off"))
                {
                    action.offBoatRight();
                }
            }
        }
    }
Ejemplo n.º 4
0
    void OnGUI()
    {
        GUI.skin.button.fontSize = GUI.skin.textArea.fontSize = 14;
        width  = Screen.width / 12;
        height = Screen.height / 12;

        if (state.getMessage() != "")
        {
            if (GUI.Button(new Rect(castw(2f), casth(6f), width, height), state.getMessage()))
            {
                action.restart();
            }
        }
        else
        {
            if (GUI.RepeatButton(new Rect(10, 10, 100, 40), "Help"))
            {
                GUI.TextArea(new Rect(10, 60, 750, 100), scene.getBaseCode().gameRule);
            }
            else if (!state.isMoving())
            {
                if (GUI.Button(new Rect(castw(2f), casth(6f), width, height), "Go"))
                {
                    action.moveBoat();
                }
                if (GUI.Button(new Rect(castw(10.5f), casth(4f), width, height), "恶魔On"))
                {
                    action.devilSOnB();
                }
                if (GUI.Button(new Rect(castw(4.29f), casth(4f), width, height), "牧师On"))
                {
                    action.priestSOnB();
                }
                if (GUI.Button(new Rect(castw(1.06f), casth(4f), width, height), "恶魔On"))
                {
                    action.devilEOnB();
                }
                if (GUI.Button(new Rect(castw(1.26f), casth(4f), width, height), "牧师On"))
                {
                    action.priestEOnB();
                }
                if (GUI.Button(new Rect(castw(2.5f), casth(1.3f), width, height), "左侧Off"))
                {
                    action.offBoatL();
                }
                if (GUI.Button(new Rect(castw(1.6f), casth(1.3f), width, height), "右侧Off"))
                {
                    action.offBoatR();
                }
            }
        }
    }