Esempio n. 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
        }
    }
Esempio n. 2
0
    //--------------------------------------------------------------------------------------------------
    //--------------------------------------------------------------------------------------------------

    // return false if email client has not been opened
    // email client is not configured
    public static bool ShowSupportEmailComposerForIOSOrAndroid()
    {
        // informations
        string userName       = CloudUser.instance.userName_TODO != null ? CloudUser.instance.userName_TODO : "";
        string appVersion     = BuildInfo.Version.ToString();
        string deviceName     = SystemInfo.deviceModel;
        string osWithVersion  = SystemInfo.operatingSystem;
        string systemLanguage = Application.systemLanguage.ToString();

        string address = SUPPORT_EMAIL;
        string subject = TextDatabase.instance[0104110];

        string[] bodyLines =
        {
            "\n",
            "========================",
            "Username: "******"App Version: " + appVersion,
            "Device: " + deviceName,
            "OS: " + osWithVersion,
            "System language: " + systemLanguage,
            "=========================",
            "\n"
        };

        string body = string.Join("\n", bodyLines);

        // try to open an email client
        bool opened = EtceteraWrapper.ShowEmailComposer(address, subject, body);

        return(opened);
    }
Esempio n. 3
0
 public static void AskForReview()
 {
     if (canAskForReview == true)
     {
         EtceteraWrapper.AskForReview("DEAD ZONE",
                                      TextDatabase.instance[00100023],
                                      TextDatabase.instance[00100024],
                                      TextDatabase.instance[00100025],
                                      TextDatabase.instance[00100026],
                                      2,
                                      5);
     }
 }
Esempio n. 4
0
    //-----------------------------------------------------------------------------------------------------------------
    // Waits for login-attempt and then displays given site (so application will be paused / will loose focus).
    //-----------------------------------------------------------------------------------------------------------------
    IEnumerator WaitForLogin()
    {
        //	Debug.Log( "CAPA : GuiScreenBank : WaitForLogin : Begin" );

        float timeStep  = 0.25f;
        bool  extraWait = m_WaitForLogin > 0.0f;

        while ((m_WaitForLogin -= timeStep) > 0.0f)
        {
            yield return(new WaitForSeconds(timeStep));
        }

        if (extraWait)         // HACK: after twitter-login-dialog the web-view didn't show on iOS but the game "remained" paused (was paused again)
        {
            yield return(new WaitForSeconds(0.5f));
        }

        EtceteraWrapper.ShowWeb(m_VisitingSite.m_URL);

        //	Debug.Log( "CAPA : GuiScreenBank : WaitForLogin : End" );
    }
Esempio n. 5
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 ;)
        }
    }
Esempio n. 6
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;
    }