1

Closed

PartyTime.

description

private float lastInviteTime = 0.0f;

 public bool inviteButton;
public List<string> Party;

if (inviteButton && selectedTarget != NetworkViewID.unassigned)
        {
            if (Time.time > lastInviteTime + 1.0f)
            {
                if (!Party.Contains(selectedTarget.ToString()))
                {
                    //networkView.RPC("InvitePlayer", RPCMode.Server, selectedTarget, networkView.viewID);
                    networkView.RPC("InvitePlayer", RPCMode.All, selectedTarget, networkView.viewID);
                    lastInviteTime = Time.time;
                }
                else
                {
                    print(selectedTarget + "already in party");
                }
            }
        }

public void AddPartyMember(NetworkViewID playerID)
{
    print(playerID + "Added to party.");
    Party.Add(playerID.ToString());

}

[RPC]
void InvitePlayer(NetworkViewID playerID, NetworkViewID selectedTargetID)
{
    print(playerID + " invited player " + selectedTargetID + " to join the party");
    //networkView.RPC("JoinPartyRequest", vID.owner, pID);
    networkView.RPC("JoinPartyRequest", RPCMode.All, playerID, selectedTargetID);
}
[RPC]
void InviteAccepted(NetworkViewID playerID, NetworkViewID partyLeaderID)
{
    print(playerID + " has accepted invite from player " + partyLeaderID + " to join the party");
    targetController.AddPartyMember(playerID);
}
====================================================
[RPC]
void JoinPartyRequest(NetworkViewID partyLeaderID, NetworkViewID playerID) //void JoinPartyRequest(NetworkViewID partyLeaderID)
{
    print(partyLeaderID + " has invited you to join the party");
    //networkView.RPC("InviteAccepted", partyLeaderID.owner, pID);
    networkView.RPC("InviteAccepted", RPCMode.All, playerID, partyLeaderID);
}

file attachments

Closed Jun 5, 2012 at 2:18 AM by gigaflare
OLD

comments

gigaflare wrote Dec 1, 2010 at 6:03 AM

Attached img