Exemplo n.º 1
0
    public void Disconnect(string returnScene)
    {
        GameSparksRTUnity session = m_gameSparksManager.RTSession;

        if (session != null)
        {
            session.Disconnect();
        }
        m_switchScene.Switch(returnScene);
    }
Exemplo n.º 2
0
 /// <summary>Ends the RT session of the user that called this function</summary>
 /// <param name="leaveMatch">Flag indicating if the user should leave the match as well (quit match making)</param>
 public void EndRTSession(bool leaveMatch = false)
 {
     //If readied up - unready up
     LobbyManager.m_ReadyButton.GetComponent <Button>().interactable = true;
     //Check if in an RT session or not
     if (gameObject.GetComponent <GameSparksRTUnity>() != null)
     {
         m_GameSparksRTUnity.Disconnect();
         Destroy(gameObject.GetComponent <GameSparksRTUnity>()); //Remove RT script
     }
     if (leaveMatch)
     {
         string myId = string.Empty;
         foreach (var me in m_PlayerIds)
         {
             if (me.Value)
             {
                 myId = me.Key;
             }
         }
         new LogEventRequest().SetEventKey("leaveMatch").
         SetEventAttribute("MyMatchID", m_MyMatchId).Send((_leaveResponse) =>
         {
             if (_leaveResponse.HasErrors)
             {
                 Debug.Log(_leaveResponse.Errors.JSON);
             }
             else
             {
                 m_PlayerIds.Clear();
                 m_PlayerIds.Add(myId, true);
                 if (myId == string.Empty)
                 {
                     Debug.LogError("My player id is empty. Something bad happened");
                 }
             }
         });
     }
 }
Exemplo n.º 3
0
    public void setListenersOnSceneChange(Scene old, Scene news)
    {
        if (RTClass != null)
        {
            RTClass.Disconnect();
            players.Clear();
            removePlayerFromMatch();
            pausePackets.Clear();
        }

        if (news.name == "FightingRoom")
        {
            startBattleMatch(currentCreatorId);
        }
        else if (news.name == "Chamber")
        {
            menuNameText      = GameObject.Find("PlayerNameText").GetComponent <Text>();
            menuRankText      = GameObject.Find("RankText").GetComponent <Text>();
            menuPointsText    = GameObject.Find("PointsText").GetComponent <Text>();
            menuClassText     = GameObject.Find("ClassText").GetComponent <Text>();
            menuNameText.text = " ";
            GameObject.Find("Inventory").SetActive(false);
            return;
        }
        else if (news.name == "Hallway")
        {
            joinMatch("LOB");
        }
        else if (news.name == "Armory")
        {
            joinMatch("ARM");
        }
        else if (news.name == "Lobby")
        {
            joinMatch("OPCENT");
        }
        else if (news.name == "TechLab")
        {
            joinMatch("TECH");
        }

        var elev = GameObject.Find("Elevator");

        if (elev != null)
        {
            if (previousScene != "Chamber")
            {
                print("found");
                var elevAnim = elev.GetComponent <Animator>();
                elevAnim.Play("Elevator_Close");
            }
        }
        else
        {
            print("not found");
        }


        menuNameText      = GameObject.Find("PlayerNameText").GetComponent <Text>();
        menuRankText      = GameObject.Find("RankText").GetComponent <Text>();
        menuPointsText    = GameObject.Find("PointsText").GetComponent <Text>();
        menuClassText     = GameObject.Find("ClassText").GetComponent <Text>();
        menuNameText.text = " ";
        GameObject.Find("Inventory").SetActive(false);


        if (chatmanager == null)
        {
            chatmanager = GameObject.Find("ChatInput").GetComponent <ChatManager>();
        }
        chatmanager.username   = username;
        chatmanager.playerAuth = this;
        matchUpdatedListener();
        startChatListener();
    }
Exemplo n.º 4
0
 public void RTSessionDisconnect()
 {
     _RT.Disconnect();
 }