Пример #1
0
    /// <summary>
    /// Adds a custom event to the submit queue (see GA_Queue)
    /// </summary>
    /// <param name="eventName">
    /// Identifies the event so this should be as descriptive as possible. PickedUpAmmo might be a good event name. EventTwo is a bad event name! <see cref="System.String"/>
    /// </param>
    /// <param name="eventValue">
    /// A value relevant to the event. F.x. if the player picks up some shotgun ammo the eventName could be "PickedUpAmmo" and this value could be "Shotgun". This can be null <see cref="System.Nullable<System.Single>"/>
    /// </param>
    /// <param name="x">
    /// The x coordinate of the event occurence. This can be null <see cref="System.Nullable<System.Single>"/>
    /// </param>
    /// <param name="y">
    /// The y coordinate of the event occurence. This can be null <see cref="System.Nullable<System.Single>"/>
    /// </param>
    private void CreateNewEvent(string eventName, float?eventValue)
    {
        Hashtable parameters = new Hashtable()
        {
            { GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.EventID], eventName },
            { GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Level], GA.SettingsGA.CustomArea.Equals(string.Empty)?Application.loadedLevelName:GA.SettingsGA.CustomArea }
        };

        if (eventValue.HasValue)
        {
            parameters.Add(GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Value], eventValue.ToString());
        }

        GA_Queue.AddItem(parameters, GA_Submit.CategoryType.GA_Event, false);

        GA_AdSupport.ShowAdStatic(GA_AdSupport.GAEventType.Custom, GA_AdSupport.GAEventCat.Design, eventName);

                #if UNITY_EDITOR
        if (GA.SettingsGA.DebugAddEvent)
        {
            string options = "";
            if (eventValue.HasValue)
            {
                options = ", value: " + eventValue;
            }

            GA.Log("GA Design Event added: " + eventName + options, true);
        }
                #endif
    }
Пример #2
0
    /// <summary>
    /// Used for player purchases
    /// </summary>
    /// <param name="businessID">
    /// The business identifier. F.x. "Rocket Launcher Upgrade" <see cref="System.String"/>
    /// </param>
    /// <param name="currency">
    /// Abbreviation of the currency used for the transaction. F.x. USD (U.S. Dollars) <see cref="System.String"/>
    /// </param>
    /// <param name="amount">
    /// The value of the transaction in the lowest currency unit. F.x. if currency is USD then amount should be in cent <see cref="System.Int32"/>
    /// </param>
    private void CreateNewEvent(string eventName, string currency, int amount, float?x, float?y, float?z)
    {
        Hashtable parameters = new Hashtable()
        {
            { GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.EventID], eventName },
            { GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Currency], currency },
            { GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Amount], amount.ToString() },
            { GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Level], GA.SettingsGA.CustomArea.Equals(string.Empty)?Application.loadedLevelName:GA.SettingsGA.CustomArea }
        };

        if (x.HasValue)
        {
            parameters.Add(GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.X], (x * GA.SettingsGA.HeatmapGridSize.x).ToString());
        }

        if (y.HasValue)
        {
            parameters.Add(GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Y], (y * GA.SettingsGA.HeatmapGridSize.y).ToString());
        }

        if (z.HasValue)
        {
            parameters.Add(GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Z], (z * GA.SettingsGA.HeatmapGridSize.z).ToString());
        }

        GA_Queue.AddItem(parameters, GA_Submit.CategoryType.GA_Purchase, false);

        GA_AdSupport.ShowAdStatic(GA_AdSupport.GAEventType.Custom, GA_AdSupport.GAEventCat.Business, eventName);

                #if UNITY_EDITOR
        if (GA.SettingsGA.DebugAddEvent)
        {
            string options = "";

            if (x.HasValue && y.HasValue && z.HasValue)
            {
                options = ", x: " + x + ", y: " + y + ", z: " + z;
            }

            GA.Log("GA Business Event added: " + eventName + ", currency: " + currency + ", amount: " + amount + options, true);
        }
                #endif
    }
Пример #3
0
    /// <summary>
    /// Used for player purchases
    /// </summary>
    /// <param name="businessID">
    /// The business identifier. F.x. "Rocket Launcher Upgrade" <see cref="System.String"/>
    /// </param>
    /// <param name="currency">
    /// Abbreviation of the currency used for the transaction. F.x. USD (U.S. Dollars) <see cref="System.String"/>
    /// </param>
    /// <param name="amount">
    /// The value of the transaction in the lowest currency unit. F.x. if currency is USD then amount should be in cent <see cref="System.Int32"/>
    /// </param>
    private void CreateNewEvent(string eventName, string currency, int amount)
    {
        Hashtable parameters = new Hashtable()
        {
            { GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.EventID], eventName },
            { GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Currency], currency },
            { GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Amount], amount.ToString() },
            { GA_ServerFieldTypes.Fields[GA_ServerFieldTypes.FieldType.Level], GA.SettingsGA.CustomArea.Equals(string.Empty)?Application.loadedLevelName:GA.SettingsGA.CustomArea }
        };

        GA_Queue.AddItem(parameters, GA_Submit.CategoryType.GA_Purchase, false);

        GA_AdSupport.ShowAdStatic(GA_AdSupport.GAEventType.Custom, GA_AdSupport.GAEventCat.Business, eventName);

                #if UNITY_EDITOR
        if (GA.SettingsGA.DebugAddEvent)
        {
            GA.Log("GA Business Event added: " + eventName + ", currency: " + currency + ", amount: " + amount, true);
        }
                #endif
    }