Exemplo n.º 1
0
    public int ChooseSlot()
    {
        int selectedSlotKey = SdlHardware.DetectKey();

        if (selectedSlotKey == SdlHardware.KEY_1)
        {
            selectedSlot = 1;
            showSlot     = "1";
        }
        if (selectedSlotKey == SdlHardware.KEY_2)
        {
            selectedSlot = 2;
            showSlot     = "2";
        }
        if (selectedSlotKey == SdlHardware.KEY_3)
        {
            selectedSlot = 3;
            showSlot     = "3";
        }
        if (selectedSlot != 0)
        {
            playerToSave.SetName(name);
            SLOTS[selectedSlot - 1].name     = name;
            SLOTS[selectedSlot - 1].fileName = "slot1" + name + ".txt";
            SaveSlotsInfo();
        }

        return(selectedSlot);
    }
Exemplo n.º 2
0
    public void ChooseNewKey()
    {
        if (!Controls.CheckKeysInUse())
        {
            DrawMenu();
            DrawBottomMessage("Invalid key. Choose again");
            keyToChange       = -1;
            currentKeyChoosen = false;
        }
        else
        {
            do
            {
                DrawMenu();
                DrawBottomMessage("Press the new key");
                pressedKey = SdlHardware.DetectKey();
            }while (pressedKey < 0);

            if (pressedKey < 0)
            {
                DrawMenu();
                DrawBottomMessage("Invalid Key");
            }
            else
            {
                DrawMenu();
                DrawBottomMessage("Key changed");
                Controls.SwapKeys(keyToChange, pressedKey);
                newKeyChoosen = true;
            }
            SdlHardware.Pause(30);
        }
    }
Exemplo n.º 3
0
    public void ChooseName()
    {
        //DateTime pressTic, drawTic;
        //TimeSpan diff;
        //pressTic = DateTime.Now;
        //drawTic = DateTime.Now;
        //diff = drawTic - pressTic;
        int key = SdlHardware.DetectKey();

        if (key != SdlHardware.KEY_SPC && key != SdlHardware.KEY_ESC &&
            key != SdlHardware.KEY_UP && key != SdlHardware.KEY_DOWN &&
            key != SdlHardware.KEY_LEFT && key != SdlHardware.KEY_RIGHT &&
            key != SdlHardware.KEY_RETURN /*&& ((int) diff.TotalMilliseconds > 500)*/)
        {
            name += SdlHardware.KeyToString(key);
        }
        else if (key == SdlHardware.KEY_SPC && name.Length > 0)
        {
            name = name.Remove(name.Length - 1);
        }
        else if (key == SdlHardware.KEY_RETURN)
        {
            nameChosen = true;
        }
        SdlHardware.Pause(105);
    }
Exemplo n.º 4
0
 public void ChooseKeyToChange()
 {
     do
     {
         DrawMenu();
         DrawBottomMessage("Press the key you want to change");
         keyToChange = SdlHardware.DetectKey();
         if (keyToChange > 0 && keyToChange != SdlHardware.KEY_ESC &&
             keyToChange != SdlHardware.KEY_RETURN)
         {
             currentKeyChoosen = true;
         }
     }while (!currentKeyChoosen && !SdlHardware.KeyPressed(SdlHardware.KEY_ESC));
 }