template-GameInfo.txt 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // <copyright file="GameInfo.cs" company="Google Inc.">
  2. // Copyright (C) 2015 Google Inc. All Rights Reserved.
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. // </copyright>
  16. #if (UNITY_ANDROID || (UNITY_IPHONE && !NO_GPGS))
  17. namespace GooglePlayGames {
  18. ///
  19. /// This file is automatically generated DO NOT EDIT!
  20. ///
  21. /// These are the constants defined in the Play Games Console for Game Services
  22. /// Resources.
  23. ///
  24. /// <summary>
  25. /// File containing information about the game. This is automatically updated by running the
  26. /// platform-appropriate setup commands in the Unity editor (which does a simple search / replace
  27. /// on the IDs in the form "__ID__"). We can check whether any particular field has been updated
  28. /// by checking whether it still retains its initial value - we prevent the constants from being
  29. /// replaced in the aforementioned search/replace by stripping off the leading and trailing "__".
  30. /// </summary>
  31. public static class GameInfo {
  32. private const string UnescapedApplicationId = "APP_ID";
  33. private const string UnescapedIosClientId = "IOS_CLIENTID";
  34. private const string UnescapedWebClientId = "WEB_CLIENTID";
  35. private const string UnescapedNearbyServiceId = "NEARBY_SERVICE_ID";
  36. public const string ApplicationId = "__APP_ID__"; // Filled in automatically
  37. public const string IosClientId = "__IOS_CLIENTID__"; // Filled in automatically
  38. public const string WebClientId = "__WEB_CLIENTID__"; // Filled in automatically
  39. public const string NearbyConnectionServiceId = "__NEARBY_SERVICE_ID__";
  40. public static bool ApplicationIdInitialized() {
  41. return !string.IsNullOrEmpty(ApplicationId) && !ApplicationId.Equals(ToEscapedToken(UnescapedApplicationId));
  42. }
  43. public static bool IosClientIdInitialized() {
  44. return !string.IsNullOrEmpty(IosClientId) && !IosClientId.Equals(ToEscapedToken(UnescapedIosClientId));
  45. }
  46. public static bool WebClientIdInitialized() {
  47. return !string.IsNullOrEmpty(WebClientId) && !WebClientId.Equals(ToEscapedToken(UnescapedWebClientId));
  48. }
  49. public static bool NearbyConnectionsInitialized() {
  50. return !string.IsNullOrEmpty(NearbyConnectionServiceId) &&
  51. !NearbyConnectionServiceId.Equals(ToEscapedToken(UnescapedNearbyServiceId));
  52. }
  53. /// <summary>
  54. /// Returns an escaped token (i.e. one flanked with "__") for the passed token
  55. /// </summary>
  56. /// <returns>The escaped token.</returns>
  57. /// <param name="token">The Token</param>
  58. private static string ToEscapedToken(string token) {
  59. return string.Format("__{0}__", token);
  60. }
  61. }
  62. }
  63. #endif