public void ForcePlayer2(int id)
 {
     PD.controller2 = new InputMethod();
     FullInitP2Select();
     charSprite2.GetComponent <SpriteRenderer>().sprite = chars[id];
     charName2.GetComponent <SpriteRenderer>().sprite   = charNames[id];
     SpeakCharacterName(id, 1);
     PD.p2Char = (PersistData.C)id;
     cursor2.SetVisibility(false);
 }
    private void SetupBackgrounds()
    {
        bg1 = GetGameObject(new Vector3(-2.25f, 0.5f), "Background 1", Resources.Load <Sprite> (SpritePaths.DefaultBG), false, "BG0");
        bg1.transform.localScale /= 2.5f;
        originalRect              = bg1.GetComponent <SpriteRenderer>().sprite.rect;
        UpdateBackground(true);
        bg2 = GetGameObject(new Vector3(2.25f, 0.5f), "Background 2", Resources.Load <Sprite> (SpritePaths.DefaultBG), false, "BG0");
        bg2.transform.localScale /= 2.5f;
        UpdateBackground(false);
        GetGameObject(Vector3.zero, "Background Cover", Resources.Load <Sprite>(SpritePaths.BGBlackFadeCharSel), false, "BG1");

        onlineBackground = GetGameObject(new Vector3(2f, 0f), "Lobby Cover", Resources.Load <Sprite>(SpritePaths.BGBlackFadeCharSel), false, "BG1");

        lobbyCursor = GetMenuCursor(1, 9, SpritePaths.RightArrows, 2f, 0.253f, 0f, 0.195f, 0, 8, 1, 0);
        lobbyCursor.HalfSize();
        lobbyCursor.SetVisibility(false);

        onlineBackground.SetActive(PD.gameType == PersistData.GT.Online);
    }
Exemple #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);
        }
    }