public SCResult generateReport(IntPtr report) { SCResult result = SCResult.SCResult_NO_ERROR; for (int i = 0; i < keyList.Count; i++) { result = keyList[i].ToReport(report); if (result != SCResult.SCResult_NO_ERROR) { return(result); } } return(result); }
public static void competitionSetReportIntentionCallback( IntPtr theInterface, //const SCInterfacePtr GHTTPResult httpResult, SCResult result, IntPtr userData ) { respReceived = true; if (result == SCResult.SCResult_NO_ERROR) { Console.WriteLine("SUCCESS: Set Report Intention"); } else { Console.WriteLine("FAILURE: {0}", result); } }
public static void competitionSubmitReportCallback( IntPtr theInterface, //const SCInterfacePtr GHTTPResult httpResult, SCResult result, IntPtr userData ) { Console.Write("\nIn {0} : ", System.Reflection.MethodBase.GetCurrentMethod().Name); respReceived = true; if (result == SCResult.SCResult_NO_ERROR) { Console.WriteLine("SUCCESS: Submit Report "); } else { Console.WriteLine("FAILURE: {0}", result); } }
public static void competitionCreateSessionCallback ( IntPtr theInterface, //const SCInterfacePtr GHTTPResult httpResult, SCResult result, IntPtr userData ) { respReceived = true; if (result == SCResult.SCResult_NO_ERROR) { string sessionId = Marshal.PtrToStringAnsi(gamespyAtlas.scGetSessionId(theInterface)); string connectionId = Marshal.PtrToStringAnsi(gamespyAtlas.scGetConnectionId(theInterface)); Console.WriteLine("SUCCESS: CreateSession"); Console.WriteLine("Session Id {0}", sessionId); Console.WriteLine("Connection Id {0}", connectionId); } else { Console.WriteLine("FAILURE: {0}", result); } }
// Application methods public static bool Initialize() { System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); byte[] accessKey = encoding.GetBytes(_AccessKey); byte[] secretKey = encoding.GetBytes(_SecretKey); // Now initialize the common core gamespyCommon.gsCoreInitialize(); gamespyAuth.wsSetGameCredentials(accessKey, _GameId, secretKey); gamespyAuth.WSLoginCallback myLoginCallback = new gamespyAuth.WSLoginCallback(loginCallback); respReceived = false; gamespyAuth.wsLoginProfile(_GameId, _PartnerId, _NameSpace, _NickName, _Email, _Password, _CdKey, myLoginCallback, IntPtr.Zero); while (respReceived == false) { gamespyCommon.gsCoreThink(0); Thread.Sleep(new TimeSpan(100000)); } if (authenticated) { //Now Initialize Atlas SCResult atlasResult = gamespyAtlas.scInitialize(_GameId, ref atlasInterface); if (atlasResult != SCResult.SCResult_NO_ERROR) { Console.WriteLine("Atlas initialization failed {0} ", atlasResult); return(false); } return(true); } else { return(false); } }
public void Run() { AtlasAppProgram atlasapp = new AtlasAppProgram(); string gamename = _GameName; SCResult result = SCResult.SCResult_NO_ERROR; Console.WriteLine("\n------------ Atlas C# Sample --------------------------"); if (atlasapp.CheckServices(gamename) != GSIACResult.GSIACAvailable) { Console.WriteLine("{0}: Online services are unavailable now.\n", gamename); return; } #if GSI_COMMON_DEBUG gamespyCommonDebug.gsOpenDebugFile("Debug_Atlas.log"); gamespyCommonDebug.gsSetDebugLevel(GSIDebugCategory.GSIDebugCat_All, GSIDebugType.GSIDebugType_All, GSIDebugLevel.Hardcore); #endif if (Initialize()) { Console.WriteLine("{0}: Initialized.\n", gamename); } else { Console.WriteLine("{0}: Failed initialize.\n", gamename); Terminate(); Console.WriteLine("------------ Atlas C# Sample Terminated------------------------\n"); Console.WriteLine("Press AnyKey Continue...."); Console.ReadLine(); return; } // scCreateSession example gamespyAtlas.SCCreateSessionCallback createSessionCallback = new gamespyAtlas.SCCreateSessionCallback(competitionCreateSessionCallback); Console.WriteLine("\nAtlas : Create Session\n"); result = gamespyAtlas.scCreateSession(atlasInterface, ref gameCertificate, ref gamePrivateData, createSessionCallback, 0, IntPtr.Zero); if (result != SCResult.SCResult_NO_ERROR) { Console.WriteLine("Error in Create Session : {0}\n", result); return; } WaitForResponse(atlasInterface); Console.WriteLine("Create Session completed. \n"); gamespyAtlas.SCSetReportIntentionCallback setReportIntentionCallback = new gamespyAtlas.SCSetReportIntentionCallback(competitionSetReportIntentionCallback); respReceived = false; Console.WriteLine("Set Report Intention\n"); result = gamespyAtlas.scSetReportIntention(atlasInterface, null, true, ref gameCertificate, ref gamePrivateData, setReportIntentionCallback, 0, IntPtr.Zero); if (result != SCResult.SCResult_NO_ERROR) { Console.WriteLine("Error in Set Report Intention : {0}\n", result); return; } while (respReceived == false) { gamespyAtlas.scThink(atlasInterface); if (respReceived == false) { Thread.Sleep(new TimeSpan(100000)); } } Console.WriteLine("Set Report Intention completed. \n"); Console.WriteLine("Create Report"); result = gamespyAtlas.scCreateReport(atlasInterface, _AtlasRuleSetVersion, 1, 0, ref atlasReport); if (result != SCResult.SCResult_NO_ERROR) { Console.WriteLine("Error in Create Report : {0}\n", result); return; } else { Console.WriteLine("Atlas Report Created succesfully!\n"); } Console.WriteLine("Create Report completed. \n"); // Begin the game's (global data) section of the report result = gamespyAtlas.scReportBeginGlobalData(atlasReport); if (result != SCResult.SCResult_NO_ERROR) { Console.WriteLine("Error in Report Begin Global Data : {0}\n", result); return; } else { Console.WriteLine("Atlas Report Begin Global Data completed succesfully!\n"); } // add the game-level key values AtlasKeyList gameKeys = new AtlasKeyList(); initGameKeys(gameKeys); result = gameKeys.generateReport(atlasReport); if (result != SCResult.SCResult_NO_ERROR) { Console.WriteLine("Error in Generate Report : {0}\n", result); return; } else { Console.WriteLine("Atlas Generate Report completed Succesfully!\n"); } result = gamespyAtlas.scReportBeginPlayerData(atlasReport); if (result != SCResult.SCResult_NO_ERROR) { Console.WriteLine("Error in Report Begin Player Data : {0}\n", result); return; } else { Console.WriteLine("Atlas Report Begin Player Data completed succesfully!\n"); } // This is the start of a new player result = gamespyAtlas.scReportBeginNewPlayer(atlasReport); if (result != SCResult.SCResult_NO_ERROR) { Console.WriteLine("Error in Report Begin New Player Data : {0}\n", result); return; } else { Console.WriteLine("Atlas Report Begin New Player Data completed succesfully!\n"); } System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); byte[] connectionId = encoding.GetBytes(Marshal.PtrToStringAnsi(gamespyAtlas.scGetConnectionId(atlasInterface))); result = gamespyAtlas.scReportSetPlayerData ( atlasReport, 0, connectionId, 0, SCGameResult.SCGameResult_WIN, gameCertificate.mProfileId, ref gameCertificate, null ); if (result != SCResult.SCResult_NO_ERROR) { Console.WriteLine("Error in Set Player Data : {0}\n", result); return; } else { Console.WriteLine("Atlas Set Player Data completed succesfully!\n"); } AtlasKeyList playerKeys = new AtlasKeyList(); initPlayerKeys(playerKeys); result = playerKeys.generateReport(atlasReport); if (result != SCResult.SCResult_NO_ERROR) { Console.WriteLine("Error in Generate Report : {0}\n", result); return; } else { Console.WriteLine("Atlas Generate Report completed succesfully!\n"); } result = gamespyAtlas.scReportBeginTeamData(atlasReport); if (result != SCResult.SCResult_NO_ERROR) { Console.WriteLine("Error in Begin Team Data : {0}\n", result); return; } else { Console.WriteLine("Atlas Begin Team Data completed succesfully!\n"); } result = gamespyAtlas.scReportEnd(atlasReport, true, SCGameStatus.SCGameStatus_COMPLETE); if (result != SCResult.SCResult_NO_ERROR) { Console.WriteLine("Error in Report End : {0}\n", result); return; } else { Console.WriteLine("Atlas Report End completed succesfully!\n"); } gamespyAtlas.SCSubmitReportCallback submitReportcallback = new gamespyAtlas.SCSubmitReportCallback(competitionSubmitReportCallback); Console.WriteLine("\nAtlas : Set Report Intention\n"); Console.WriteLine("Submitting a report for the ATLAS session...\n"); result = gamespyAtlas.scSubmitReport(atlasInterface, atlasReport, true, ref gameCertificate, ref gamePrivateData, submitReportcallback, 0, IntPtr.Zero); WaitForResponse(atlasInterface); Terminate(); Console.WriteLine("\n------------ Atlas C# Sample Completed------------------------\n"); Console.WriteLine("Press Enter Continue...."); Console.ReadLine(); }