Exemplo n.º 1
0
        public static void HandleFellowship(Session session, NetworkObject networkObject)
        {
            FellowshipAction action         = (FellowshipAction)NetworkObjectField.ReadIntField(networkObject.GetField(0));
            FellowshipObject fellowshipInfo = new FellowshipObject();

            fellowshipInfo.FromNetworkObject(networkObject.GetField(1).ReadObject());

            switch (action)
            {
            case FellowshipAction.Join:
            {
                Fellowship fellowship = FellowshipManager.GetFellowship(fellowshipInfo);
                fellowship.AddMember(session);
                break;
            }

            case FellowshipAction.Leave:
            {
                Fellowship fellowship = FellowshipManager.GetFellowship(fellowshipInfo);
                fellowship?.RemoveMember(session);
                break;
            }
            }
        }