コード例 #1
0
    // Use this for initialization
    void Start()
    {
        swrveComponent = (SwrveComponent)FindObjectOfType(typeof(SwrveComponent));

        swrveComponent.SDK.GetMessageCenterCampaigns(SwrveOrientation.Portrait).ForEach(campaign => {
            GameObject newButton         = Instantiate(MessageCenterMessagePrefab) as GameObject;
            MessageCenterMessage message = newButton.GetComponent <MessageCenterMessage> ();
            message.setCampaign(campaign);

            message.transform.SetParent(ContentPanel, false);
        });
    }
コード例 #2
0
ファイル: DemoGUI.cs プロジェクト: ByronMayne/swrve-unity-sdk
    void Start()
    {
        swrveComponent = (SwrveComponent)FindObjectOfType(typeof(SwrveComponent));

        // In-app messaging setup
        swrveComponent.SDK.GlobalMessageListener      = new CustomMessageListener(this);
        swrveComponent.SDK.GlobalCustomButtonListener = new CustomButtonListener();

#if UNITY_5
        Debug.LogWarning("Consider using the UnitySwrveDemo5xx");
#endif
    }
コード例 #3
0
 private void Awake()
 {
     if (SwrveManager.instance == null)
     {
         SwrveManager.instance = this;
         UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
         SwrveComponent swrveComponent = base.gameObject.AddComponent <SwrveComponent>();
         swrveComponent.InitialiseOnStart = false;
     }
     else if (SwrveManager.instance != this)
     {
         UnityEngine.Object.Destroy(base.gameObject);
     }
 }
コード例 #4
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
         Object.DontDestroyOnLoad(base.gameObject);
         SwrveComponent swrveComponent = base.gameObject.AddComponent <SwrveComponent>();
         customSwrveConfig = new SwrveConfig();
     }
     else if (instance != this)
     {
         Object.Destroy(base.gameObject);
     }
 }
コード例 #5
0
    // Use this for initialization
    void Start()
    {
        swrveComponent = (SwrveComponent)FindObjectOfType(typeof(SwrveComponent));

        // In-app messaging setup
        swrveComponent.SDK.GlobalMessageListener      = new CustomMessageListener(this);
        swrveComponent.SDK.GlobalCustomButtonListener = new CustomButtonListener();

    #if UNITY_EDITOR
        swrveComponent.SDK.ConversationEditorCallback = OnConversation;
    #endif

        new Dictionary <string, UnityAction> {
            { "Main Menu", ToMainMenu },
            { "Message Center", ToMessageCenter }
        }.ToList().ForEach(kvp => SetButton(kvp, footerPanel));
    }
コード例 #6
0
    void Start()
    {
        swrveComponent = (SwrveComponent)FindObjectOfType(typeof(SwrveComponent));

        new Dictionary <string, UnityAction> {
            { "Named Event", SendEvent },
            { "User update", SendUserAttributes },
            { "Purchase Item", PurchaseItem },
            { "IAP: Item", InAppItemPurchase },
            { "IAP: Virtual Currency", InAppCurrencyPurchase },
            { "Apple IAP", RealIap },
            { "Currency Given", CurrencyGiven },
            { "AB Test Resources", UserResources },
            { "Send To Swrve", SendToSwrve },
            { "Trigger Message", TriggerMessage },
            { "Save To Disk", SaveToDisk }
        }.ToList().ForEach(kvp => {
            HomeMenuComponent.SetButton(kvp, panel);
        });
    }
コード例 #7
0
    private IEnumerator initSwrve()
    {
        DateTime        dateTime = new DateTime(2018, 12, 21, 0, 0, 0);
        ICPSwrveService instance;

        if (EnableAnalyticsLogging && dateTime.Date > DateTime.Now.Date && !Service.Get <GameSettings>().OfflineMode)
        {
            SwrveLog.OnLog += delegate(SwrveLog.LogLevel level, object message, string tag)
            {
                switch (level)
                {
                case SwrveLog.LogLevel.Verbose:
                    break;

                case SwrveLog.LogLevel.Info:
                    break;

                case SwrveLog.LogLevel.Warning:
                    break;

                case SwrveLog.LogLevel.Error:
                    Log.LogNetworkError("Swrve", message.ToString());
                    break;
                }
            };
            GameObject     gameObject     = Service.Get <GameObject>();
            SwrveComponent swrveComponent = gameObject.AddComponent <SwrveComponent>();
            Configurator   configurator   = Service.Get <Configurator>();
            IDictionary <string, object> dictionaryForSystem = configurator.GetDictionaryForSystem("SwrveConfig");
            string key = "PROD";
            IDictionary <string, object> dictionary = (IDictionary <string, object>)dictionaryForSystem[key];
            string key2 = "windows";
            IDictionary <string, object> dictionary2 = (IDictionary <string, object>)dictionary[key2];
            SwrveConfig swrveConfig = new SwrveConfig();
            swrveConfig.AppVersion = ClientInfo.Instance.BuildVersion;
            swrveConfig.AutomaticSessionManagement        = true;
            swrveConfig.AutoDownloadCampaignsAndResources = true;
            swrveConfig.NewSessionInterval              = 1;
            swrveConfig.UseHttpsForEventsServer         = true;
            swrveConfig.UseHttpsForContentServer        = true;
            swrveConfig.MessagingEnabled                = false;
            swrveConfig.ConversationsEnabled            = false;
            swrveComponent.SDK.PushNotificationListener = new CPSwrvePushNotificationListener();
            swrveComponent.Init((int)dictionary2["AppId"], (string)dictionary2["APIKey"], swrveConfig);
            Dictionary <string, string> deviceInfo = swrveComponent.SDK.GetDeviceInfo();
            string text   = deviceInfo["swrve.device_name"];
            string value  = deviceInfo["swrve.os"];
            string value2 = deviceInfo["swrve.device_dpi"];
            string value3 = deviceInfo["swrve.device_width"];
            string value4 = deviceInfo["swrve.device_height"];
            Dictionary <string, string> dictionary3 = new Dictionary <string, string>();
            dictionary3.Add("device_name", text);
            dictionary3.Add("os", value);
            dictionary3.Add("device_dpi", value2);
            dictionary3.Add("device_width", value3);
            dictionary3.Add("device_height", value4);
            if (!string.IsNullOrEmpty(swrveComponent.SDK.UserId))
            {
                dictionary3.Add("swrve_user_id", swrveComponent.SDK.UserId);
            }
            dictionary3.Add("jailbroken.is_jailbroken", SwrveManagerUtils.GetIsJailBroken());
            dictionary3.Add("lat.is_lat", SwrveManagerUtils.GetIsLat().ToString());
            string key3 = string.Empty;
            if (Application.platform == RuntimePlatform.Android)
            {
                key3 = "gida";
            }
            else if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                key3 = "idfa";
            }
            string value5 = SwrveManagerUtils.AESEncrypt(text, SwrveManagerUtils.GetAdvertiserID());
            dictionary3.Add(key3, value5);
            string rSAEncryptedKey = SwrveManagerUtils.GetRSAEncryptedKey();
            dictionary3.Add("esk", rSAEncryptedKey);
            swrveComponent.SDK.UserUpdate(dictionary3);
            instance = new CPSwrveService(swrveComponent);
        }
        else
        {
            instance = new NullCPSwrveService();
        }
        Service.Set(instance);
        yield break;
    }
コード例 #8
0
 public CPSwrveService(SwrveComponent swrveComponent)
 {
     resourceManager = swrveComponent.SDK.ResourceManager;
     sdk             = swrveComponent.SDK;
 }
コード例 #9
0
 // Use this for initialization
 void Start()
 {
     swrveComponent = (SwrveComponent)FindObjectOfType(typeof(SwrveComponent));
 }