Exemplo n.º 1
0
        private static void Initialize()
        {
            if (!Application.isPlaying)
            {
                return;                 // no need to setup anything else if we are in the editor and not playing
            }
            if (SettingsGA.InfoLogBuild)
            {
                GA_Setup.SetInfoLog(true);
            }

            if (SettingsGA.VerboseLogBuild)
            {
                GA_Setup.SetVerboseLog(true);
            }

            int platformIndex = GetPlatformIndex();

            GA_Wrapper.SetUnitySdkVersion("unity " + Settings.VERSION);
            GA_Wrapper.SetUnityEngineVersion("unity " + GetUnityVersion());

            if (platformIndex >= 0)
            {
                GA_Wrapper.SetBuild(SettingsGA.Build[platformIndex]);
            }

            if (SettingsGA.CustomDimensions01.Count > 0)
            {
                GA_Setup.SetAvailableCustomDimensions01(SettingsGA.CustomDimensions01);
            }

            if (SettingsGA.CustomDimensions02.Count > 0)
            {
                GA_Setup.SetAvailableCustomDimensions02(SettingsGA.CustomDimensions02);
            }

            if (SettingsGA.CustomDimensions03.Count > 0)
            {
                GA_Setup.SetAvailableCustomDimensions03(SettingsGA.CustomDimensions03);
            }

            if (SettingsGA.ResourceItemTypes.Count > 0)
            {
                GA_Setup.SetAvailableResourceItemTypes(SettingsGA.ResourceItemTypes);
            }

            if (SettingsGA.ResourceCurrencies.Count > 0)
            {
                GA_Setup.SetAvailableResourceCurrencies(SettingsGA.ResourceCurrencies);
            }

            if (SettingsGA.UseManualSessionHandling)
            {
                SetEnabledManualSessionHandling(true);
            }

            if (platformIndex >= 0)
            {
                if (!SettingsGA.UseCustomId)
                {
                    GA_Wrapper.Initialize(SettingsGA.GetGameKey(platformIndex), SettingsGA.GetSecretKey(platformIndex));
                }
                else
                {
                    Debug.Log("Custom id is enabled. Initialize is delayed until custom id has been set.");
                }
            }
            else
            {
                Debug.LogWarning("Unsupported platform (or missing platform in settings): " + Application.platform);
            }
        }