the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
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 // Social post image params.
72 XSOCIAL_IMAGEPOSTPARAMS m_PostImageParams;
73
74 // Social post link params.
75 XSOCIAL_LINKPOSTPARAMS m_PostLinkParams;
76
77 // Image details for posting an image to social network.
78 unsigned char* m_pMainImageBuffer;
79 DWORD m_dwMainImageBufferSize;
80
81 void DestroyMainPostImage();
82 void DestroyPreviewPostImage();
83
84 // WESTY : Not sure if we even need to get social access key!
85/*
86 bool GetSocialNetworkAccessKey( ESocialNetwork eSocialNetwork, DWORD dwUserIndex, bool bUsingKinect, DWORD dwUserTrackingIndex, bool bShowNetworkSignin );
87*/
88
89public:
90 // Retrieve singleton instance.
91 static CSocialManager* Instance();
92
93 // To be called once during game init.
94 void Initialise();
95
96 // Tick the social manager. Only does anything in async mode, polls for results of async actions.
97 void Tick();
98
99 // May need to be called if something changes (i.e. player signs in to live ).
100 bool RefreshPostingCapability();
101
102 // Returns true if any social newtork posting is allowed by us, false if not (if false, game must not display any social network UI).
103 bool IsTitleAllowedToPostAnything();
104
105 // Returns true if we are allowed to post images to social networks.
106 bool IsTitleAllowedToPostImages();
107
108 // Returns true if we are allowed to post links to social networks.
109 bool IsTitleAllowedToPostLinks();
110
111 // Returns false if any of the live signed in users have disabled XPRIVILEGE_SOCIAL_NETWORK_SHARING
112 bool AreAllUsersAllowedToPostImages();
113
114 // Post a test link to social network.
115 bool PostLinkToSocialNetwork( ESocialNetwork eSocialNetwork, DWORD dwUserIndex, bool bUsingKinect );
116
117 // Post a test image to social network.
118 bool PostImageToSocialNetwork( ESocialNetwork eSocialNetwork, DWORD dwUserIndex, bool bUsingKinect );
119
120 void SetSocialPostText(LPCWSTR Title, LPCWSTR Caption, LPCWSTR Desc);
121
122 // WESTY : Not sure if we even need to get social access key!
123/*
124 // We do not currently know what this is used for. We may not even need it?
125 bool ObtainSocialNetworkAccessKey( ESocialNetwork eSocialNetwork, DWORD dwUserIndex, bool bUsingKinect );
126 */
127
128private:
129 WCHAR m_wchTitleA[MAX_SOCIALPOST_CAPTION+1];
130 WCHAR m_wchCaptionA[MAX_SOCIALPOST_CAPTION+1];
131 WCHAR m_wchDescA[MAX_SOCIALPOST_DESC+1];
132
133};
134
135#endif //_SOCIAL_MANAGER_H