示例#1
0
    public SpilAndroid(string objectName, string appID, string authToken, SpilSettings configs)
    {
        Dictionary<string, string> parameters = new Dictionary<string, string> ();
        parameters.Add ("SG_ENVIRONMENT_KEY", configs.SG_ENVIRONMENT_KEY.ToString ());
        parameters.Add ("SG_STORE_ID", configs.SG_STORE_ID.ToString ());

        AndroidJavaClass jc = new AndroidJavaClass ("com.unity3d.player.UnityPlayer");
        AndroidJavaObject activity = jc.GetStatic<AndroidJavaObject> ("currentActivity");

        using (AndroidJavaObject obj_HashMap = DictionaryToHashMap(parameters)){
            using (var pluginClass = new AndroidJavaClass( "com.spilgames.framework.core.Spil" ))

                instance = pluginClass.CallStatic<AndroidJavaObject> ("spilWithAppID",activity, appID, authToken, obj_HashMap);
                instance.Call ("setUnityObjectName", objectName);
        }
    }
示例#2
0
    // Use this for initialization
    void Start()
    {
        Debug.Log("starting initialization");
        instance = SpilUnity.Instance;

        SpilSettings configs = new SpilSettings();
        configs.SG_ENVIRONMENT_KEY = Enviroment.SG_ENVIRONMENT_DEV_VALUE;
        configs.SG_APP_SETTINGS_POLL_TIME_KEY = 10.0f;
        configs.SG_ENVIRONMENT_SETTINGS_URL_GET = "http://localhost/defaultsettings.json";
        configs.SG_TRACKING_ID_KEY="<tracking-app-ids>";

        #if UNITY_IPHONE
        configs.SG_STORE_ID = Store.SG_STORE_IOS;
        #endif
        #if UNITY_ANDROID
        configs.SG_STORE_ID = Store.SG_STORE_GOOGLE_PLAY;
        #endif

        instance.Initialize("<spil-app-id>", "<spil-auth-token>", configs);

        //start app settings
        instance.SetAppSettingsListener(this);

        //start ads
        instance.SetAdsListener(this);

        //start A/B test
        instance.SetABTestListener(this);

        //start InGameAds
        instance.SetInGameAdListener(this);
    }