Exemple #1
0
 private void OnDestroy()
 {
     if (m_UILoader != null)
     {
         m_UILoader.ReleaseAllRes();
         m_UILoader.Recycle2Cache();
         m_UILoader = null;
     }
 }
 protected override void OnClose()
 {
     mMainAnimationGo.DestroySelf();
     mMainAnimationGo = null;
     mResLoader.Recycle2Cache();
     mResLoader     = null;
     mMainAnimation = null;
     PlayerPrefsUtil.SetFirstIn(false);
 }
Exemple #3
0
        public void SetAudio(GameObject root, string name, string abName = null, bool syncLoad = false, bool loop = false, float volume = 1.0f)
        {
            if (string.IsNullOrEmpty(name))
            {
                return;
            }

            //ensure the last delay action is stopped
            if (delayCoroutine != null)
            {
                AudioManager.Instance.StopCoroutine(delayCoroutine);
                delayCoroutine = null;
            }

            if (mSource == null)
            {
                mSource = root.AddComponent <AudioSource>();
            }
            mSource.loop   = loop;
            mSource.volume = volume;

            if (string.Equals(mAudioName, name, StringComparison.OrdinalIgnoreCase) &&
                string.Equals(mABName, abName, StringComparison.OrdinalIgnoreCase))
            {
                if (mAudioClip != null)
                {
                    PlayAudioClip();
                }
                return;
            }

            //防止卸载后立马加载的情况
            var preLoader = mLoader;

            mLoader = null;
            CleanResources();

            mLoader = ResLoader.Allocate();

            mAudioName = name;
            mABName    = abName;

            if (syncLoad)
            {
                OnResLoadFinish(true, mLoader.LoadSync <AudioClip>(name, abName));
            }
            else
            {
                mLoader.LoadAsync <AudioClip>(name, abName, OnResLoadFinish);
            }

            if (preLoader != null)
            {
                preLoader.Recycle2Cache();
                preLoader = null;
            }
        }
Exemple #4
0
        // Use this for initialization
        void Start()
        {
            ResKit.Init();

            mResLoader = ResLoader.Allocate();


            Async();
        }
    /// <summary>
    /// Add Common Bag Without Close Btn And Background
    /// </summary>
    /// <param name="parent">bag transform parent</param>
    /// <param name="bagType">Bag Controller Component Often Inherit From EquipBaseBagController(You Need To Overrid Two Action Functions)</param>
    /// <returns></returns>
    public static GameObject AddHeroCommonBag(GameObject parent, System.Type bagType)
    {
        string     baseBagePrefabPath = "HeroCommon/CommonBag";
        GameObject BaseBagPrefab      = (GameObject)ResLoader.Load(UIPrefabDummy.GetUIPrefabPath(baseBagePrefabPath), typeof(GameObject));
        GameObject bag = NGUITools.AddChildNotLoseScale(parent, BaseBagPrefab);

        bag.AddComponent(bagType);
        return(bag);
    }
Exemple #6
0
 void LoadPrefab(string assetName)
 {
     if (!string.IsNullOrEmpty(assetName))
     {
         // var abName = assetBundleName;
         m_LoadId = 0;
         ResLoader.InstantiateAsync(assetName, OnCompleted, OnEnd, null, this.GetComponent <Transform>());
     }
 }
Exemple #7
0
        [UnityTest] //涉及到异步操作时使用
        public IEnumerator LoadAsyncTest()
        {
            var resLoader = new ResLoader();

            resLoader.LoadAsync <Texture2D>("resources://BigTexture",
                                            bigTexture => { Assert.AreEqual("BigTexture", bigTexture.name); });

            yield return(null);
        }
 protected override void OnClose()
 {
     LoadingManager.GetInstance().DismissLoading();
     if (mResLoader.IsNotNull())
     {
         mResLoader.Recycle2Cache();
         mResLoader = null;
     }
     StopAllCoroutines();
 }
Exemple #9
0
    public static AudioClip LoadClip(string path)
    {
        AudioClip clip = ResLoader.Load(path) as AudioClip;

        if (clip == null)
        {
            LKDebug.LogError("can't load audio at path: " + path);
        }
        return(clip);
    }
        string GetMusicPath()
        {
            var path = ResLoader.GetPath(MediaConfiguration.Instance.TicketSuccessMusicFile, ResourceLocation.Program);

            if (!File.Exists(path))
            {
                path = ResLoader.GetPath(@"audio\music\终于等到你.mp3", ResourceLocation.Program);
            }
            return(path);
        }
Exemple #11
0
 protected override void OnClose()
 {
     mResLoader.Recycle2Cache();
     mResLoader = null;
     ImgCloud1.DOKill();
     ImgCloud2.DOKill();
     ImgCloud3.DOKill();
     ImgHyrogen.DOKill();
     BtnConfirm.DOKill();
 }
        private static void DoResManagerInitPre()
        {
            ResLoader.BeforeLoadFirstScene();
            GarbageCollector.GarbageCollectorEvents[0] += CollectGarbageLite;
            GarbageCollector.GarbageCollectorEvents[1] += UnloadUnusedResAsync;
            GarbageCollector.GarbageCollectorEvents[2] += UnloadUnusedResAndBundle;
#if !UNITY_EDITOR
            Application.lowMemory += StartGarbageCollectNorm;
#endif
        }
Exemple #13
0
    public static int AddChildByResourcesPathNoBehaviour(IntPtr l)
    {
        GameObject parent = lua_.ToUserDataObject(1) as GameObject;
        string     path   = lua_.ToString(2);
        GameObject prefab = (GameObject)ResLoader.Load(path, typeof(GameObject));
        GameObject obj    = NGUITools.AddChildNotLoseAnything(parent, prefab);

        lua_.NewClassUserData(obj);
        return(1);
    }
    void Start()
    {
        player = GameObject.Find("Player");

        pickupText = Instantiate(ResLoader.Load("Prefabs/HoverText"))
                     .GetComponentInChildren <TextMesh>();
        pickupText.text = interactMsg;

        origPos = transform.position;
    }
        string GetMusicPath()
        {
            var path = ResLoader.GetPath(Configuration.QueryConfiguration.Current.MusicPath, ResourceLocation.Program);

            if (!File.Exists(path))
            {
                path = ResLoader.GetPath(@"audio\music\大风车 -  CCTV版.mp3", ResourceLocation.Program);
            }
            return(path);
        }
    void Awake()
    {
        //mCurInput = EditorPrefs.GetString(LASTINPUTKEY);
        GameObject atlasGameObject = (GameObject)ResLoader.Load("UI/Atlas/Bit32/BaseUI", typeof(GameObject));

        oldAtlas = atlasGameObject.GetComponent <UIAtlas>();

        atlasGameObject = (GameObject)ResLoader.Load("UI/Atlas/Bit32/base", typeof(GameObject));
        newAtlas        = atlasGameObject.GetComponent <UIAtlas>();
    }
        public static string GetLocalized(this string resourceKey)
        {
            if (resourceKey == null)
            {
                return(string.Empty);
            }
            var localizedString = ResLoader.GetString(resourceKey);

            return(string.IsNullOrEmpty(localizedString) ? resourceKey : localizedString);
        }
Exemple #18
0
    void Awake()
    {
        if (!shader)
        {
            shader = ResLoader.LoadAsset("Shader/FadeEffect") as Shader;
        }

        mMaterial = new Material(shader);
        mMaterial.SetColor("_Color", fadeColor);
    }
Exemple #19
0
    // Use this for initialization
    void Start()
    {
        var resLoader = ResLoader.Allocate();

        resLoader.Add2Load("BattleScene");

        resLoader.LoadAsync(() =>
        {
            UnityEngine.SceneManagement.SceneManager.LoadScene("BattleScene");
        });
    }
Exemple #20
0
    public static int AddEffect(IntPtr l)
    {
        GameObject parent   = lua_.ToUserDataObject(1) as GameObject;
        string     path     = lua_.ToString(2);
        Vector3    position = (Vector3)lua_.ToUserDataObject(3);
        GameObject prefab   = (GameObject)ResLoader.Load(path, typeof(GameObject));
        GameObject obj      = NGUITools.AddChildWithPosition(parent, prefab, position);

        lua_.NewClassUserData(obj);
        return(1);
    }
Exemple #21
0
    private void Awake()
    {
        resLoader = ResLoader.Allocate();
        timer     = Interval;
        InitHumenRoot();

        if (SpeedConfs?.Length > 0)
        {
            StartCoroutine(ConfigSpeed());
        }
    }
Exemple #22
0
    public void SetMainTextureByPath(string texturePath)
    {
        if (texturePath == null)
        {
            MainTexture = null;
            return;
        }
        Texture2D tex = ResLoader.Load(texturePath, typeof(Texture2D)) as Texture2D;

        MainTexture = tex;
    }
Exemple #23
0
 protected override void OnClose()
 {
     mResLoader.Recycle2Cache();
     mResLoader = null;
     videoList.Clear();
     audioList.Clear();
     picBookList.Clear();
     videoList   = null;
     audioList   = null;
     picBookList = null;
 }
Exemple #24
0
    /// <summary>
    /// 加载场景包括资源
    /// </summary>
    /// <returns></returns>

    public override void OnSingletonInit()
    {
        ResLoader resLoader = ResLoader.Allocate();

        var inDoorSceneCtrl = gameObject.GetComponent <InDoorSceneCtrl>();

        inDoorSceneCtrl.ResLoader = resLoader;
        inDoorSceneCtrl.Init();

        Debug.Log(name + ":" + "OnSingletonInit");
    }
Exemple #25
0
    public Material LoadResizeTexture(UITexture texture, string shaderName, string path, bool transparent, TextureResizeType type)
    {
        Shader   s  = ResLoader.LoadAsset(shaderName) as Shader;
        Material mt = BaseLoadTexture(s, path, transparent);

        texture.material = mt;

        ResizeUITexture(mt, texture, type);

        return(mt);
    }
Exemple #26
0
    void Start()
    {
        director = GetComponent <PlayableDirector>();
        if (director == null)
        {
            Debug.LogError("find no director: " + this.name);
        }

        loader = ResLoader.Allocate();
        LaunchDirector("Resources/TimeLines/Meet");
    }
Exemple #27
0
    protected virtual void Init()
    {
        camera = gameObject.AddComponent <Camera>();
        ResLoader resLoader = new ResLoader();

        GameObject targetPre = resLoader.LoadSync <GameObject>("Target");

        target = GameObject.Instantiate(targetPre);

        target.SetActive(false);
    }
    protected virtual void Start()
    {
        player = GameObject.Find("Player");
        // cam = Camera.main;

        pickupText = Instantiate(ResLoader.Load("Prefabs/HoverText"))
                     .GetComponentInChildren <TextMesh>();
        pickupText.text = "[E]";

        audSrc = gameObject.AddComponent <AudioSource>();
    }
Exemple #29
0
    private void CreateGammaMat()
    {
        Shader gammaShader = ResLoader.LoadAsset("Shader/Gamma") as Shader;

        if (gammaShader == null)
        {
            enabled = false;
        }
        GammaCorrectMaterial           = new Material(gammaShader);
        GammaCorrectMaterial.hideFlags = HideFlags.DontSave;
    }
Exemple #30
0
        protected override void Init()
        {
            S = this;

            GameStateMgr.S.AddObserver(this);

            m_WorldData = new WorldData(this);
            m_WorldView = gameObject.AddComponent <WorldView>();

            m_WorldLoader = ResLoader.Allocate("WorldLoader");
        }
 public void Start()
 {
     //setting = preRes;
     version = setting.version;
     original = setting;
     Screen.sleepTimeout = SleepTimeout.NeverSleep;
     preRes.InitSettings();
     if (android)
         loadingText = "Attention! This is beta version, if you got this game from store please report to [email protected]";
     StartCoroutine(StartLoadPackages());
     LogEvent("StartLoading");
 }