Example #1
0
    public static void EarnFreeGold(ShopItemId goldId)
    {
        //Debug.Log("Earn Free gold " + goldId);
        if (!ShopDataBridge.Instance.IsFreeGold(goldId))
        {
            return;
        }

        E_FundID fundId = (E_FundID)(goldId.Id);

        if (fundId == E_FundID.TapJoyWeb)
        {
#if UNITY_IPHONE
            MFNativeUtils.OpenURLExternal(TAPJOY_DEADZONE_URL);             //Tapjoy has to be opened in external browser on iOS due to Apple's restrictions
#elif UNITY_ANDROID
            EtceteraWrapper.ShowWeb(TAPJOY_DEADZONE_URL);
#endif
        }
        else if (fundId == E_FundID.TapJoyInApp)
        {
            TapJoy.ShowOffers();
        }
        else if (fundId == E_FundID.FreeOffer)
        {
            // Used to be SponsorPay Plugin - now unused
        }
        else if (fundId == E_FundID.FreeWeb)
        {
#if (UNITY_ANDROID || UNITY_IPHONE)
            //SponsorPay plugin has been removed in r16601
//			string sponsorPayStr = string.Format("http://iframe.sponsorpay.com/mbrowser?appid={0}&device_id={1}&uid={2}&pub0=", Game.SponsorPayCredentials.AppId, SysUtils.GetUniqueDeviceID(), CloudUser.instance.userName);
//			EtceteraWrapper.ShowWeb(sponsorPayStr);
#endif
        }
    }
Example #2
0
    void OnUserAuthenticationChanged(bool state)
    {
        if (state == true)
        {
            Settings = UserSettings.Load(CloudUser.instance.primaryKey);
            GuiOptions.Load();

            PlayerPersistantInfo ppi = PPIManager.Instance.GetLocalPPI();
            ppi.PrimaryKey     = CloudUser.instance.primaryKey;
            ppi.PrimaryKeyHash = CloudServices.CalcHash64(ppi.PrimaryKey);

            if (ppi.Experience == 0 && PlayerPrefs.HasKey("firstrun") == false)
            {
                ppi.IsFirstRun = true;
                PlayerPrefs.SetInt("firstrun", 0);
            }

            TapJoy.ConnectUser(ppi.PrimaryKey);
        }
        else
        {
            SaveSettings();
            TapJoy.DisconnectUser();
        }
    }
Example #3
0
    void OnDestroy()
    {
        if (_Instance == this)
        {
            // shutdown plugins
            EtceteraWrapper.Done();

            TapJoy.Done();
            TwitterWrapper.Done();

#if UNITY_ANDROID && !UNITY_EDITOR
            MogaGamepad.Done();
            MogaGamepad.OnConnectionChange -= OnMogaConnectionChange;
            MogaGamepad.OnBatteryLowChange  = null;
#endif

            GamepadInputManager.DestroyInstance();

            CloudUser.authenticationChanged -= OnUserAuthenticationChanged;
            OnUserAuthenticationChanged(false);

            //FacebookPlugin.Instance.OnApplicationFocus -= OnApplicationPause;  kua ja to nemuzu delat ;)
        }
    }
Example #4
0
    void Awake()
    {
        BuildInfo.DrawVersionInfo = false;

        // 1366x720=983520
        // 1024x720=737280
        // 900x640=614400
        //Screen.SetResolution (1024, 540, true);

        //new Texture().SetAnisotropicFilteringLimits(1,1);//2,2);

        //
        // warmup post-fx shaders
        //

        /*
         * if (iPhoneSettings.generation == iPhoneGeneration.iPodTouch3Gen || iPhoneSettings.generation == iPhoneGeneration.iPodTouch4Gen || iPhoneSettings.generation == iPhoneGeneration.iPhone3GS || iPhoneSettings.generation == iPhoneGeneration.iPad1Gen)
         * QualitySettings.masterTextureLimit = 1;
         *
         * if (iPhoneSettings.generation == iPhoneGeneration.iPad2Gen)
         * QualitySettings.antiAliasing = 4;
         */

        //CamExplosionFXMgr.PreloadResources();

        GraphicsDetailsUtl.DisableShaderKeyword("UNITY_IPHONE");

#if UNITY_IPHONE
        GraphicsDetailsUtl.EnableShaderKeyword("UNITY_IPHONE");
#endif

#if UNITY_ANDROID && !UNITY_EDITOR
        try
        {
            MogaGamepad.Init();
            MogaGamepad.OnConnectionChange += OnMogaConnectionChange;
            MogaGamepad.OnBatteryLowChange  = OnMogaBatteryLowChange;

            if (m_IsFocused)
            {
                //Debug.Log("Moga: Application focused");
                MogaGamepad.OnFocus(m_IsFocused);
            }
        }
        catch (System.Exception) {}
#endif

        QualitySettings.masterTextureLimit = 0;

        if (_Instance)
        {
            if (_Instance.Client == null)
            {
                _Instance.Client = Client;
            }
            Destroy(this.gameObject);
            return;
        }
        else
        {
            _Instance = this;
            uLink.NetworkView nw = GetComponent <uLink.NetworkView>();
            if (nw != null)
            {
                // This workaround fixes the warning about alredy registered manual ID
                // Now the NetworkView is registered only once (using given ManualViewIDWorkaround).
                nw.SetManualViewID(ManualViewIDWorkaround);
            }
        }

        CloudUser.authenticationChanged += OnUserAuthenticationChanged;

        GamepadInputManager.CreateInstance();

        DontDestroyOnLoad(this);
        this.transform.parent = null;

        InputManager.Initialize();

        if (AppType == E_AppType.DedicatedServer)
        {
            Application.targetFrameRate = 60;
        }
        else
        {
            Application.targetFrameRate = 30;
        }

        // test server optimization
        // not really great optimization I would say... (our servers were definitelly more laggy)
        // Changing back to 60FPS on the server
        //Application.targetFrameRate = 30;

        uLink.BitStreamCodec.Add <PlayerPersistantInfo>(PlayerPersistantInfo.Deserialize, PlayerPersistantInfo.Serialize);
        uLink.BitStreamCodec.Add <PPIInventoryList>(PPIInventoryList.Deserialize, PPIInventoryList.Serialize);
        uLink.BitStreamCodec.Add <PPIEquipList>(PPIEquipList.Deserialize, PPIEquipList.Serialize);
        uLink.BitStreamCodec.Add <PPIRoundScore>(PPIRoundScore.Deserialize, PPIRoundScore.Serialize);
        uLink.BitStreamCodec.Add <PPIUpgradeList>(PPIUpgradeList.Deserialize, PPIUpgradeList.Serialize);
        uLink.BitStreamCodec.Add <PPIOutfits>(PPIOutfits.Deserialize, PPIOutfits.Serialize);
        uLink.BitStreamCodec.Add <RoundFinalResult>(RoundFinalResult.Deserialize, RoundFinalResult.Serialize);
        uLink.BitStreamCodec.AddAndMakeArray <RoundFinalResult.PlayerResult>(RoundFinalResult.PlayerResult.Deserialize,
                                                                             RoundFinalResult.PlayerResult.Serialize);

#if UNITY_IPHONE || UNITY_ANDROID
        Screen.autorotateToPortrait           = false;
        Screen.autorotateToPortraitUpsideDown = false;
#endif

        Screen.sleepTimeout = 120;

        //
        // experimental networking stuff
        //

        if (AppType == E_AppType.Game && Application.isEditor == false)
        {
            // initialize plugins
            EtceteraWrapper.Init();

            if (TwitterConfiguration.IsAvailable)
            {
                TwitterWrapper.Init(TwitterConfiguration.CustomerKey, TwitterConfiguration.CustomerSecret);
            }

            if (ChartBoostConfiguration.IsAvailable)
            {
                ChartBoost.init(ChartBoostConfiguration.AppId, ChartBoostConfiguration.AppSignature);
            }

            if (TapJoyConfiguration.IsAvailable)
            {
                TapJoy.Init(TapJoyConfiguration.AppId, TapJoyConfiguration.SecurityKey);
            }
        }

        // Synchronize item settings managers with cloud
        SettingsCloudSync.GetInstance().UpdateSettingsManagersFromCloud();

        LastTouchControlTime = 0;
    }
Example #5
0
    // Use this for initialization
    void Start()
    {
        if (FindObjectOfType(typeof(TapJoy))!=this){
            Destroy(this);
        }
        DontDestroyOnLoad(this.gameObject);
        // Set the Handler class. This needs to be a unity GameObject
        TapjoyPlugin.SetCallbackHandler("TapJoy");											// Set this to the name of your linked GameObject
        TapjoyPlugin.EnableLogging(true);
        // Connect to the Tapjoy servers.
        if (Application.platform == RuntimePlatform.Android)
        {
            TapjoyPlugin.RequestTapjoyConnect(	"08a377a6-e2a3-4a53-8b0a-cd6adf9da299", 				// YOUR APP ID GOES HERE
                                              "zvlNk6wgO2eOIcwdSzUW");								// YOUR SECRET KEY GOES HERE
        }

        // Get the user virtual currency
        TapjoyPlugin.GetTapPoints();

        // Get a banner ad
        TapjoyPlugin.GetDisplayAd();
        TapjoyPlugin.ShowOffers();
        TapjoyPlugin.ShowDisplayAd();
        TapjoyPlugin.SetDisplayAdSize(TapjoyDisplayAdSize.SIZE_320X50);
        TapjoyPlugin.MoveDisplayAd(0,Screen.height-50);
        instance=this;
    }