PlayGamesClientFactory.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // <copyright file="PlayGamesClientFactory.cs" company="Google Inc.">
  2. // Copyright (C) 2014 Google Inc.
  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
  17. namespace GooglePlayGames
  18. {
  19. using UnityEngine;
  20. using GooglePlayGames.BasicApi;
  21. using GooglePlayGames.OurUtils;
  22. internal class PlayGamesClientFactory
  23. {
  24. internal static IPlayGamesClient GetPlatformPlayGamesClient(
  25. PlayGamesClientConfiguration config)
  26. {
  27. if (Application.isEditor)
  28. {
  29. GooglePlayGames.OurUtils.Logger.d("Creating IPlayGamesClient in editor, using DummyClient.");
  30. return new GooglePlayGames.BasicApi.DummyClient();
  31. }
  32. #if UNITY_ANDROID
  33. GooglePlayGames.OurUtils.Logger.d("Creating Android IPlayGamesClient Client");
  34. return new GooglePlayGames.Android.AndroidClient(config);
  35. #else
  36. GooglePlayGames.OurUtils.Logger.d("Cannot create IPlayGamesClient for unknown platform, returning DummyClient");
  37. return new GooglePlayGames.BasicApi.DummyClient();
  38. #endif
  39. }
  40. }
  41. }
  42. #endif