Example #1
0
 // this will trigger when a player disconnects,
 public void PlayerDisconnected(JoviosPlayer p)
 {
     if (players.Contains(p))
     {
         players.Remove(p);
     }
     networking.PlayerDisconnected(p);
     if (p != null)
     {
         if (deviceIDToPlayerNumber.ContainsKey(p.GetUserID().GetIDNumber()))
         {
             deviceIDToPlayerNumber.Remove(p.GetUserID().GetIDNumber());
             for (int i = 0; i < deviceIDToPlayerNumber.Count; i++)
             {
                 deviceIDToPlayerNumber[GetPlayer(i).GetUserID().GetIDNumber()] = i;
                 players[i].NewPlayerInfo(i, players[i].GetPlayerName(), players[i].GetColor("primary"), players[i].GetColor("secondary"));
             }
             for (int i = 0; i < p.PlayerObjectCount(); i++)
             {
                 Destroy(p.GetPlayerObject(i));
             }
             foreach (IJoviosPlayerListener listener in playerListeners)
             {
                 if (listener.PlayerDisconnected(p))
                 {
                     break;
                 }
             }
         }
     }
 }
Example #2
0
    bool IJoviosPlayerListener.PlayerConnected(JoviosPlayer p)
    {
        JoviosControllerStyle controllerStyle = new JoviosControllerStyle();
        GameObject            newStatusObject = (GameObject)GameObject.Instantiate(statusObject, Vector3.zero, Quaternion.identity);

        statusObject.GetComponent <PlayerStatus>().Setup(players[p.GetUserID().GetIDNumber()]);
        jovios.SetControls(p.GetUserID(), controllerStyle);
        return(false);
    }
Example #3
0
 public void PlayerDisconnected(JoviosPlayer p)
 {
     if (p != null)
     {
         if (packetJSON.ContainsKey(p.GetUserID().GetIDNumber()))
         {
             packetJSON.Remove(p.GetUserID().GetIDNumber());
         }
         if (networkingStates.ContainsKey(p.GetUserID().GetIDNumber()))
         {
             networkingStates.Remove(p.GetUserID().GetIDNumber());
         }
         parser.OnLeave(p.GetUserID().GetIDNumber().ToString());
     }
 }