示例#1
0
    //-----------------------------------------------------------------------------------------------------------------
    // Deinitialization.
    //-----------------------------------------------------------------------------------------------------------------
    public static void Done()
    {
        if (m_Instance != null)
        {
            GameObject.Destroy(m_InstanceOwner);

            m_InstanceOwner = null;
            m_Instance      = null;
        }
    }
示例#2
0
    //-----------------------------------------------------------------------------------------------------------------
    // Initialization "of" Twitter application.
    //-----------------------------------------------------------------------------------------------------------------
    public static void Init(string CustomerKey, string CustomerSecret)
    {
        if (m_Instance == null)
        {
            // create global instance...

            m_InstanceOwner = new GameObject("_Twitter_");
            m_Instance      = m_InstanceOwner.AddComponent <TwitterWrapper>();

            DontDestroyOnLoad(m_Instance);
        }
    }
示例#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 ;)
        }
    }
示例#4
0
    //-----------------------------------------------------------------------------------------------------------------
    // Opens given Facebook/Twitter site.
    //-----------------------------------------------------------------------------------------------------------------
    void VisitSite(SiteData site)
    {
        //	Debug.Log( "CAPA" );
        //	Debug.Log( "CAPA : GuiScreenBank : VisitSite( " + site.m_URL + " )" );

        m_LoggedIn     = true;
        m_WaitForLogin = 0.0f;
        m_VisitingSite = site;

        if (site.m_FBSite)         // Facebook
        {
            if ((site.m_Rewarded == false) && (FacebookPlugin.Instance.CurrentUser == null))
            {
                //	Debug.Log( "CAPA : GuiScreenBank : VisitSite : Login to Facebook..." );

                m_LoggedIn     = false;
                m_WaitForLogin = float.MaxValue;

                FacebookPlugin.Instance.Login("user_likes", OnFacebookLoginComplete);
            }
        }
        else         // Twitter
        {
            if ((site.m_Rewarded == false) && (TwitterWrapper.IsLoggedIn() == false))
            {
                //	Debug.Log( "CAPA : GuiScreenBank : VisitSite : Login to Twitter..." );

                m_LoggedIn     = false;
                m_WaitForLogin = float.MaxValue;

                TwitterUtils.LogIn(this.OnLoginResult);
            }
        }

        StartCoroutine(WaitForLogin());
    }
示例#5
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;
    }