private void HandlePlayer2Input()
 {
     if (cursor2 != null)
     {
         if (--p2_delay <= 0)
         {
             bool pressed = false;
             if (!conf2)
             {
                 cursor2.DoUpdate();
                 if (cursor2.HasMoved())
                 {
                     UpdateBackground(false);
                 }
                 charSprite2.GetComponent <SpriteRenderer>().sprite = chars[cursor2.getX()];
                 charName2.GetComponent <SpriteRenderer>().sprite   = charNames[cursor2.getX()];
                 if (cursor2.launchOrPause())
                 {
                     SpeakCharacterName(cursor2.getX(), 1); SignalSuccess(); conf2 = true; pressed = true;
                 }
             }
             else if (cursor2.back())
             {
                 conf2   = false;
                 pressed = true;
                 SignalFailure();
             }
             if (pressed)
             {
                 p2_delay = 5;
             }
         }
     }
     else if (PD.gameType == PersistData.GT.Versus && PD.controller2 == null)
     {
         PD.controller2 = PD.detectInput_P2();
         if (PD.controller2 != null)
         {
             char2StartText.SetActive(false);
             FullInitP2Select();
             SignalSuccess();
         }
     }
 }
Exemplo n.º 2
0
    private void UpdateControlsInner()
    {
        cursor2Display.SetRightVisibility();
        cursor3.SetVisibility(true);
        cursor.SetVisibility(false);
        bool isP1 = cursor3.getX() == 0;

        if (controlsPos == 4)
        {
            if (controlsScreen.HasReturnedToNormal())
            {
                controlsPos = 3;
            }
        }
        else if (controlsPos == 3)
        {
            if (Input.GetKeyDown(KeyCode.Escape) || controlsScreen.ClickingCancelButton(clicker))
            {
                SignalFailure();
                controlsPos = 1;
                controlsScreen.UndoQuestion(cursor2.getY(), isP1);
            }
            else
            {
                int key = controlsScreen.DetectKeyInput();
                int cy  = cursor2.getY();
                if (key >= 0 && (KeyCode)key != KeyCode.Mouse0)
                {
                    controlsScreen.ChangeKey(cursor2.getY(), key, isP1);
                    if (cy == 0)
                    {
                        controlsPos = 1;
                    }
                    else
                    {
                        cursor2.setY(cy - 1);
                        cursor2Display.UpdatePosition(cy - 1);
                        controlsScreen.SetToQuestion(cy - 1, isP1);
                    }
                    return;
                }
                string axis = controlsScreen.DetectAxisInput();
                if (!string.IsNullOrEmpty(axis))
                {
                    controlsScreen.ChangeAxis(cursor2.getY(), axis, isP1);
                    if (cy == 0)
                    {
                        controlsPos = 1;
                    }
                    else
                    {
                        cursor2.setY(cy - 1);
                        cursor2Display.UpdatePosition(cy - 1);
                        controlsScreen.SetToQuestion(cy - 1, isP1);
                        controlsPos = 4;
                    }
                    return;
                }
            }
        }
        else if (controlsPos == 2)
        {
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                SignalFailure();
                controlsPos = 1;
                controlsScreen.UndoQuestion(cursor2.getY(), isP1);
            }
            else
            {
                int key = controlsScreen.DetectKeyInput();
                if (key >= 0 && (KeyCode)key != KeyCode.Mouse0)
                {
                    controlsScreen.ChangeKey(cursor2.getY(), key, isP1);
                    controlsPos = 1;
                    cursor2.FreezyPop(PD.KEY_DELAY * 2);
                    return;
                }
                string axis = controlsScreen.DetectAxisInput();
                if (!string.IsNullOrEmpty(axis))
                {
                    controlsScreen.ChangeAxis(cursor2.getY(), axis, isP1);
                    controlsPos = 1;
                    cursor2.FreezyPop(PD.KEY_DELAY * 2);
                    return;
                }
            }
        }
        else if (controlsPos == 1)
        {
            cursor2.DoUpdate();
            int cy = cursor2.getY();
            cursor2Display.UpdatePosition(cy);
            if (cursor2.launchOrPause())
            {
                SelectControlChange();
            }
            else if (cursor2.back())
            {
                controlsPos = 0;
                SignalFailure();
            }
        }
    }
Exemplo n.º 3
0
    private void LobbyUpdate()
    {
        MoveTextUp();
        if (lobbyCursor.launchOrPause())
        {
            int idx = offsetY + (8 - lobbyCursor.getY());
            if (idx >= lobbyDisplay.Count)
            {
                idx = lobbyDisplay.Count - 1;
            }
            if (idx == 1)
            {
                FindFriendLobbies();
            }
            else if (idx == 0)
            {
                initializedStatus = -3;
            }
            else
            {
                CSteamID lobby = lobbyDisplay[idx].Value;
                SetText("joining");
                SteamAPICall_t try_joinLobby = SteamMatchmaking.JoinLobby(lobby);
            }
            return;
        }
        else if (lobbyCursor.back())
        {
            initializedStatus = -3;
            return;
        }

        string res       = "";
        int    actOffset = offsetY;

        if (offsetY > 0)
        {
            res = "...\r\n";
            actOffset++;
        }
        int  max    = lobbyDisplay.Count;
        bool addEnd = false;

        if ((actOffset + 8) < max)
        {
            max    = actOffset + 7;
            addEnd = true;
        }
        for (int i = actOffset; i < max; i++)
        {
            res += lobbyDisplay[i].Key + "\r\n";
        }
        if (addEnd)
        {
            res += "...";
        }
        ForceText(res);
        lobbyCursor.SetVisibility(true);
        lobbyCursor.DoUpdate();
        int maxY = Mathf.Max(9 - lobbyDisplay.Count, 0);
        int curY = lobbyCursor.getY();

        if (curY < maxY)
        {
            lobbyCursor.setY(maxY);
        }
        else if (curY == 0 && addEnd)
        {
            offsetY++;
            lobbyCursor.setY(1);
        }
        else if (curY == 8 && offsetY > 0)
        {
            offsetY--;
            lobbyCursor.setY(7);
        }
    }