예제 #1
0
        public string AddPlatformAndQualityToUrl(string url, string platform = "IOS", string quality = "High")
        {
            char delim = '/';

            //url = platform + delim + quality + delim + url;
            return(AFAssetManager.GetPathTargetPlatformWithResolution(url));
        }
예제 #2
0
    public AFStatesController buildHeroAnimation()
    {
        AFStatesController m_heroStates;

        UnityEngine.Debug.Log(AFAssetManager.GetPathTargetPlatformWithResolution() + "/" + "hero_sprites");
        AFTextureAtlas heroAtlas = AFAssetManager.Instance.Load <AFTextureAtlas>(AFAssetManager.GetPathTargetPlatformWithResolution() + "/" + "hero_sprites");

        m_heroStates = AFObject.Create <AFStatesController>("Hero Controller");

        AFMovieClip animation = AFObject.Create <AFMovieClip>("small_walk");

        animation.Init(heroAtlas.GetSprites("small_walk"));
        animation.gameObject.AddComponent <BoxCollider2D>();
        m_heroStates.Add("small_walk", animation, false);

        animation = AFObject.Create <AFMovieClip>("small_stop");
        animation.Init(heroAtlas.GetSprites("small_stop"));
        animation.gameObject.AddComponent <BoxCollider2D>();
        m_heroStates.Add("small_stop", animation, true);

        m_heroStates.gameObject.AddComponent <Rigidbody2D>();

        m_heroStates.transform.localScale = new UnityEngine.Vector3(3, 3, 3);

        return(m_heroStates);
    }
        void Start()
        {
            Sprite sp    = AFAssetManager.Instance.Load <Sprite>(AFAssetManager.GetPathTargetPlatformWithResolution() + "/" + path);
            Image  L_img = gameObject.GetComponent <Image>();

            if (L_img != null)
            {
                L_img.sprite = sp;
            }
        }
예제 #4
0
    // Use this for initialization
    void Start()
    {
#if UNITY_EDITOR
        AFAssetManager.SimulatedDPI     = AFAssetManager.DPI_IPAD_3;
        AFAssetManager.SimulatePlatform = AFAssetManager.EPlataform.IOS;
        AFDebug.Log(AFAssetManager.GetPathTargetPlatformWithResolution());
#endif //UNITY_EDITOR

        Sprite sp    = AFAssetManager.Instance.Load <Sprite>(AFAssetManager.GetPathTargetPlatformWithResolution() + "/" + "Scenes/Login/Background");
        Image  L_img = gameObject.GetComponent <Image>();
        L_img.sprite = sp;
    }
예제 #5
0
        private void CreateParticles()
        {
            string path = AFAssetManager.GetPathTargetPlatformWithResolution("CFXM_GroundHit");

            m_particleEmiter = Resources.Load <GameObject>(path);

            path = AFAssetManager.GetPathTargetPlatformWithResolution("CFXM3_Flying_EmberCFXM_Hit_B");
            GameObject goEmiter = Instantiate(Resources.Load <GameObject>(path)) as GameObject;

            goEmiter.transform.position = new Vector3(0, 1.8f, 0);
            goEmiter.GetComponent <ParticleSystem>().renderer.sortingLayerName = "Foreground";
            goEmiter.GetComponent <ParticleSystem>().renderer.sortingOrder     = 999;
        }
예제 #6
0
//     public void OnLoginHandler(Sfs2X.Core.BaseEvent ev)
//     {
//         //PlayerPrefs.SetInt(PlayerInfo.PLAYERPREFS_IS_PLAYER_SUBSCRIBER, 1);
//         //PlayerInfo.IsSubscriber = true;
//     }
//
//     public void OnLoginErrorHandler(Sfs2X.Core.BaseEvent ev)
//     {
//        // PlayerPrefs.SetInt(PlayerInfo.PLAYERPREFS_IS_PLAYER_SUBSCRIBER, 0);
//        // PlayerInfo.IsSubscriber = false;
//     }

    public void SetButtonView(Image image, string path)
    {
        AFDebug.Log(AFAssetManager.GetPathTargetPlatformWithResolution() + path);

        Sprite sp = AFAssetManager.Instance.Load <Sprite>(AFAssetManager.GetPathTargetPlatformWithResolution() + path);

        if (sp != null)
        {
            image.sprite = sp;
        }
        else
        {
            AFDebug.LogError("Problem to load asset");
        }
    }
예제 #7
0
        public override void BuildState()
        {
#if UNITY_EDITOR
            AFAssetManager.SimulatedDPI     = AFAssetManager.DPI_IPHONE_4_5;
            AFAssetManager.SimulatePlatform = AFAssetManager.EPlataform.IOS;
#endif
            _cameraGameObject      = new GameObject();
            _cameraGameObject.name = "StateCam";
            m_camera = _cameraGameObject.AddComponent <MyCamera>().GetCamera();

            string path = AFAssetManager.GetPathTargetPlatform() + "Prefabs/StartSceneCanvas";

            AFDebug.Log(AFAssetManager.GetPathTargetPlatform() + "Prefabs/StartScene");

            GameObject startSceneToIntantiate = AFAssetManager.Instance.Load <GameObject>(path);

            if (!AFObject.IsNull(startSceneToIntantiate))
            {
                m_interface = AFAssetManager.Instance.Instantiate <GameObject>(path);

                if (!AFObject.IsNull(m_interface))
                {
                    Canvas L_canvas = m_interface.GetComponent <Canvas>();

                    if (!AFObject.IsNull(L_canvas))
                    {
                        L_canvas.renderMode  = RenderMode.ScreenSpaceCamera;
                        L_canvas.worldCamera = m_camera;
                    }
                    else
                    {
                        AFDebug.LogError("Canvas not found!");
                    }

                    _background  = GameObject.Find("Background");
                    _startButton = GameObject.Find("StartButton");

                    path = AFAssetManager.GetPathTargetPlatformWithResolution("Scenes/StartScene/Background");
                    AFDebug.Log(path);
                    Sprite L_sprite = AFAssetManager.Instance.Load <Sprite>(path);
                    _background.GetComponent <Image>().sprite = L_sprite;


                    path     = AFAssetManager.GetPathTargetPlatformWithResolution("Scenes/StartScene/StartButton");
                    L_sprite = AFAssetManager.Instance.Load <Sprite>(path);
                    AFDebug.Log(path);
                    _startButton.GetComponent <Image>().sprite = L_sprite;

                    _startButton.GetComponent <UnityEngine.UI.Button>().onClick.AddListener(() => { OnClick(); });
                }
                else
                {
                    AFDebug.LogError("Nao foi possivel encontrar a interface do login");
                }
            }
            else
            {
                AFDebug.LogError("Nao foi possivel encontrar a interface do login para clonar");
            }


            Add(m_interface);

            base.BuildState();
        }