the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1//// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
2//// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
3//// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
4//// PARTICULAR PURPOSE.
5////
6//// Copyright (c) Microsoft Corporation. All rights reserved
7#pragma once
8
9#include <ppltasks.h>
10class DQRNetworkManager;
11
12class PartyController
13{
14public:
15 PartyController(DQRNetworkManager *pDQRNet);
16
17 void SetPartyView( Windows::Xbox::Multiplayer::PartyView^ partyView );
18 Windows::Xbox::Multiplayer::PartyView^ GetPartyView();
19
20 void RefreshPartyView();
21 bool AddLocalUsersToParty(int userMask, Windows::Xbox::System::User^ primaryUser);
22 void RemoveLocalUsersFromParty(Windows::Xbox::System::User^ primaryUser);
23 void RemoveLocalUsersFromParty(Windows::Xbox::System::User^ primaryUser, int playerMask, Microsoft::Xbox::Services::Multiplayer::MultiplayerSessionReference^ sessionReference);
24 void RemoveLocalUserFromParty(Windows::Xbox::System::User^ userToRemove);
25 void RegisterEventHandlers();
26 void UnregisterEventHandlers();
27 void UnregisterGamePlayersEventHandler();
28 void RegisterGamePlayersChangedEventHandler();
29 bool CanJoinParty();
30 bool CanInvitePartyToMyGame( Microsoft::Xbox::Services::Multiplayer::MultiplayerSession^ multiplayerSession );
31 bool IsPartyInAnotherTitle();
32 bool IsGameSessionReadyEventTriggered();
33 bool DoesPartySessionExist();
34 Microsoft::Xbox::Services::Multiplayer::MultiplayerSessionReference ^ GetGamePartySessionReference();
35 void ClearGameSessionReadyEventTriggered();
36 int GetActiveAndReservedMemberPartySize();
37 bool DoesPartyAndSessionPlayersMatch(
38 Microsoft::Xbox::Services::Multiplayer::MultiplayerSession^ session
39 );
40 void CheckPartySessionFull(Windows::Xbox::System::User^ primaryUser);
41 void SetJoinability(bool isJoinable);
42 void DisassociateSessionFromParty( Microsoft::Xbox::Services::Multiplayer::MultiplayerSessionReference^ sessionReference);
43
44private:
45 Concurrency::critical_section m_lock;
46 bool m_isGameSessionReadyEventTriggered;
47 bool m_isGamePlayerEventRegistered;
48 DQRNetworkManager *m_pDQRNet;
49
50 static void DebugPrintPartyView( Windows::Xbox::Multiplayer::PartyView^ partyView );
51
52 void OnPartyStateChanged( Windows::Xbox::Multiplayer::PartyStateChangedEventArgs^ eventArgs );
53 void OnPartyRosterChanged( Windows::Xbox::Multiplayer::PartyRosterChangedEventArgs^ eventArgs );
54 void OnGamePlayersChanged( Windows::Xbox::Multiplayer::GamePlayersChangedEventArgs^ eventArgs );
55 void OnGameSessionReady( Windows::Xbox::Multiplayer::GameSessionReadyEventArgs^ eventArgs );
56 Windows::Xbox::Multiplayer::PartyView^ m_partyView;
57 Microsoft::Xbox::Services::Multiplayer::MultiplayerSessionReference^ m_partyGameReadyRef;
58 void AddAvailableGamePlayers(
59 Windows::Foundation::Collections::IVectorView<Windows::Xbox::Multiplayer::GamePlayer^>^ availablePlayers,
60 int& remainingSlots,
61 Microsoft::Xbox::Services::Multiplayer::MultiplayerSession^ currentSession
62 );
63
64 Windows::Foundation::DateTime GetCurrentTime();
65 double GetTimeBetweenInSeconds(Windows::Foundation::DateTime dt1, Windows::Foundation::DateTime dt2);
66
67 // Party/Session events.
68 Windows::Foundation::EventRegistrationToken m_partyRosterChangedToken;
69 Windows::Foundation::EventRegistrationToken m_partyStateChangedToken;
70 Windows::Foundation::EventRegistrationToken m_partyGamePlayersChangedToken;
71 Windows::Foundation::EventRegistrationToken m_partyGameSessionReadyToken;
72};
73
74