Skip to content

Commit

Permalink
add realtime parties support
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Gehorsam committed May 11, 2021
1 parent 9c9716e commit c69fd1c
Show file tree
Hide file tree
Showing 40 changed files with 1,752 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ To run a specific test, pass the fully qualified name of the method to `dotnet t
dotnet test --filter "Nakama.Tests.Api.GroupTest.ShouldPromoteAndDemoteUsers"
```

### License
If you'd like to attach a Visual Studio debugger to a test, set `VSTEST_HOST_DEBUG` to `true` in your shell environment and run `dotnet test`. Attach the debugger to the process identified by the console.

### Licenses

This project is licensed under the [Apache-2 License](https://github.com/heroiclabs/nakama-dotnet/blob/master/LICENSE).

Expand Down
54 changes: 54 additions & 0 deletions src/Nakama/IParty.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* Copyright 2021 The Nakama Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace Nakama
{
/// <summary>
/// Incoming information about a party.
/// </summary>
public interface IParty
{
/// <summary>
/// Unique party identifier.
/// </summary>
string PartyId { get; }

/// <summary>
/// Open flag.
/// </summary>
bool Open { get; }

/// <summary>
/// Maximum number of party members.
/// </summary>
int MaxSize { get; }

/// <summary>
/// Self.
/// </summary>
IUserPresence Self { get; }

/// <summary>
/// Leader
/// </summary>
IUserPresence Leader { get; }

/// <summary>
/// All current party members.
/// </summary>
IUserPresence[] Presences { get; }
}
}
32 changes: 32 additions & 0 deletions src/Nakama/IPartyAccept.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Copyright 2021 The Nakama Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace Nakama
{
// Accept a request to join.
public interface IPartyAccept
{
/// <summary>
/// Party ID to accept a join request for.
/// </summary>
string PartyId { get; set; }

/// <summary>
/// The presence to accept as a party member.
/// </summary>
IUserPresence Presence { get; }
}
}
29 changes: 29 additions & 0 deletions src/Nakama/IPartyClose.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Copyright 2021 The Nakama Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace Nakama
{
/// <summary>
/// End a party, kicking all party members and closing it.
/// </summary>
public interface IPartyClose
{
/// <summary>
/// Party ID to close.
/// </summary>
string PartyId { get; }
}
}
35 changes: 35 additions & 0 deletions src/Nakama/IPartyCreate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@


/**
* Copyright 2021 The Nakama Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace Nakama
{
/// <summary>
/// Create a party.
/// </summary>
public interface IPartyCreate
{
/// <summary>
/// Whether or not the party will require join requests to be approved by the party leader.
/// </summary>
bool Open { get; }

/// <summary>
/// Maximum number of party members.
/// </summary>
int MaxSize { get; }
}
}
43 changes: 43 additions & 0 deletions src/Nakama/IPartyData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* Copyright 2021 The Nakama Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace Nakama
{
/// <summary>
/// Incoming party data delivered from the server.
/// </summary>
public interface IPartyData
{
/// <summary>
/// The party ID.
/// </summary>
string PartyId { get; }

/// <summary>
/// A reference to the user presence that sent this data, if any.
/// </summary>
IUserPresence Presence { get; }

/// <summary>
/// Op code value.
/// </summary>
int OpCode { get; }

/// <summary>
/// Data payload, if any.
/// </summary>
byte[] Data { get; }
}
}
38 changes: 38 additions & 0 deletions src/Nakama/IPartyDataSend.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* Copyright 2021 The Nakama Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace Nakama
{
/// <summary>
// Send data to a party.
/// </summary>
public interface IPartyDataSend
{
/// <summary>
/// Party ID to send to.
/// </summary>
string PartyId { get; }

/// <summary>
/// Op code value.
/// </summary>
int OpCode { get; }

/// <summary>
/// Data payload, if any.
/// </summary>
byte[] Data { get; }
}
}
29 changes: 29 additions & 0 deletions src/Nakama/IPartyJoin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Copyright 2021 The Nakama Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace Nakama
{
/// <summary>
/// Join a party, or request to join if the party is not open.
/// </summary>
public interface IPartyJoin
{
/// <summary>
/// Party ID to join.
/// </summary>
string PartyId { get; }
}
}
34 changes: 34 additions & 0 deletions src/Nakama/IPartyJoinRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Copyright 2021 The Nakama Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace Nakama
{
/// <summary>
/// Incoming notification for one or more new presences attempting to join the party.
/// </summary>
public interface IPartyJoinRequest
{
/// <summary>
/// Party ID to get a list of join requests for.
/// </summary>
string PartyId { get; }

/// <summary>
/// Presences attempting to join.
/// </summary>
IUserPresence[] Presences { get; }
}
}
29 changes: 29 additions & 0 deletions src/Nakama/IPartyJoinRequestList.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Copyright 2021 The Nakama Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace Nakama
{
/// <summary>
/// Request a list of pending join requests for a party.
/// </summary>
public interface IPartyJoinRequestList
{
/// <summary>
/// Party ID to get a list of join requests for.
/// </summary>
string PartyId { get; }
}
}
33 changes: 33 additions & 0 deletions src/Nakama/IPartyLeader.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Copyright 2021 The Nakama Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace Nakama
{
/// <summary>
/// Announcement of a new party leader.
/// </summary>
public interface IPartyLeader
{
/// <summary>
/// Party ID to announce the new leader for.
/// </summary>
string PartyId { get; }

/// <summary>
/// The presence of the new party leader.
/// </summary>
IUserPresence Presence { get; }
}
}
Loading

0 comments on commit c69fd1c

Please sign in to comment.