the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at master 137 lines 3.9 kB view raw
1// 2// Class to handle and manage integration with social networks. 3// 4J Studios Ltd, 2011. 4// Andy West 5// 6 7#ifndef _SOCIAL_MANAGER_H 8#define _SOCIAL_MANAGER_H 9 10#include <xsocialpost.h> 11 12#define MAX_SOCIALPOST_CAPTION 60 13#define MAX_SOCIALPOST_DESC 100 14 15// XDK only provides for facebook so far. Others may follow!? 16enum ESocialNetwork 17{ 18 eFacebook = 0, 19 eNumSocialNetworks 20}; 21 22 23// Class follows singleton design pattern. 24class CSocialManager 25{ 26private: 27 // Default constructor, copy constructor and assignment operator are all private. 28 CSocialManager(); 29 CSocialManager( const CSocialManager& ); 30 CSocialManager& operator= ( const CSocialManager& ); 31 32 // Static private instance. 33 static CSocialManager* m_pInstance; 34 35 // Bitset of title posting capability flags ( XSOCIAL_CAPABILITY_POSTIMAGE, XSOCIAL_CAPABILITY_POSTLINK ). 36 DWORD m_dwSocialPostingCapability; 37 38 // Index of user who made current active request. 39 DWORD m_dwCurrRequestUser; 40 41 // WESTY : Not sure if we even need to get social access key! 42/* 43 // Size of the social network access key text buffer. 44 DWORD m_dwAccessKeyTextSize; 45 46 // Pointer to the social network access key text buffer. 47 LPWSTR m_pAccessKeyText; 48 */ 49 50 // The various states of the manager. 51 enum EState 52 { 53 eStateUnitialised = 0, 54 eStateReady, 55 eStateGetPostingCapability, 56 eStatePostingImage, 57 eStatePostingLink, 58 }; 59 60 61 // Current state that manager is in. 62 EState m_eCurrState; 63 64 // For xsocial asyncronous operations. 65 XOVERLAPPED m_Overlapped; 66 DWORD m_dwOverlappedResultCode; 67 68 // Social post preview image struct. 69 XSOCIAL_PREVIEWIMAGE m_PostPreviewImage; 70 71#ifdef _XBOX 72 // Social post image params. 73 XSOCIAL_IMAGEPOSTPARAMS m_PostImageParams; 74 75 // Social post link params. 76 XSOCIAL_LINKPOSTPARAMS m_PostLinkParams; 77#endif 78 79 // Image details for posting an image to social network. 80 unsigned char* m_pMainImageBuffer; 81 DWORD m_dwMainImageBufferSize; 82 83 void DestroyMainPostImage(); 84 void DestroyPreviewPostImage(); 85 86 // WESTY : Not sure if we even need to get social access key! 87/* 88 bool GetSocialNetworkAccessKey( ESocialNetwork eSocialNetwork, DWORD dwUserIndex, bool bUsingKinect, DWORD dwUserTrackingIndex, bool bShowNetworkSignin ); 89*/ 90 91public: 92 // Retrieve singleton instance. 93 static CSocialManager* Instance(); 94 95 // To be called once during game init. 96 void Initialise(); 97 98 // Tick the social manager. Only does anything in async mode, polls for results of async actions. 99 void Tick(); 100 101 // May need to be called if something changes (i.e. player signs in to live ). 102 bool RefreshPostingCapability(); 103 104 // Returns true if any social newtork posting is allowed by us, false if not (if false, game must not display any social network UI). 105 bool IsTitleAllowedToPostAnything(); 106 107 // Returns true if we are allowed to post images to social networks. 108 bool IsTitleAllowedToPostImages(); 109 110 // Returns true if we are allowed to post links to social networks. 111 bool IsTitleAllowedToPostLinks(); 112 113 // Returns false if any of the live signed in users have disabled XPRIVILEGE_SOCIAL_NETWORK_SHARING 114 bool AreAllUsersAllowedToPostImages(); 115 116 // Post a test link to social network. 117 bool PostLinkToSocialNetwork( ESocialNetwork eSocialNetwork, DWORD dwUserIndex, bool bUsingKinect ); 118 119 // Post a test image to social network. 120 bool PostImageToSocialNetwork( ESocialNetwork eSocialNetwork, DWORD dwUserIndex, bool bUsingKinect ); 121 122 void SetSocialPostText(LPCWSTR Title, LPCWSTR Caption, LPCWSTR Desc); 123 124 // WESTY : Not sure if we even need to get social access key! 125/* 126 // We do not currently know what this is used for. We may not even need it? 127 bool ObtainSocialNetworkAccessKey( ESocialNetwork eSocialNetwork, DWORD dwUserIndex, bool bUsingKinect ); 128 */ 129 130private: 131 WCHAR m_wchTitleA[MAX_SOCIALPOST_CAPTION+1]; 132 WCHAR m_wchCaptionA[MAX_SOCIALPOST_CAPTION+1]; 133 WCHAR m_wchDescA[MAX_SOCIALPOST_DESC+1]; 134 135}; 136 137#endif //_SOCIAL_MANAGER_H