Beispiel #1
0
        public void Load(string level, IState <string> state)
        {
            baseState = state;

            Dictionary <string, string> bundles = new Dictionary <string, string>();

            switch (level)
            {
            case AppConst.RootLevel:
                foreach (FileInfo file in new DirectoryInfo(AppConst.AssetPath[level]).GetFiles("*.u3d"))
                {
                    bundles.Add(file.Name.Replace(".u3d", ""), file.FullName);
                }
                break;

            case AppConst.GeneralLevel:
                break;
            }

            foreach (var kv in bundles)
            {
                waitForLoadBundleState.ChangeState(kv.Value);
                RunTimeTools.instence.StartCoroutine(CoroutineLoadBundle(kv.Key, kv.Value));
            }
            waitForLoadBundleState.AddAlready();
        }
Beispiel #2
0
        public void ChangeState(T token)
        {
            if (isFirst)
            {
                if (nextState == null)
                {
                    if (MainChange != null)
                    {
                        MainChange.Invoke();
                    }
                }
                if (EachChange != null)
                {
                    EachChange.Invoke(token);
                }
            }

            if (nextState == null)
            {
                nextState = new WaitState <T>(token, false);
            }
            else
            {
                nextState.ChangeState(token);
            }
        }
Beispiel #3
0
        public void Load(string level, IState <string> state)
        {
            baseState = state;

            Dictionary <string, string> xmls = new Dictionary <string, string>();

            switch (level)
            {
            case AppConst.RootLevel:
                foreach (FileInfo file in new DirectoryInfo(AppConst.AssetPath[level]).GetFiles("*.xml"))
                {
                    xmls.Add(file.Name.Replace(".xml", ""), file.FullName);
                }
                break;

            case AppConst.GeneralLevel:
                foreach (var kv in Basic.Instence.GetData(GetAllValue, AppConst.RootLevel, "AppData", "Load", "Data") as Dictionary <string, string> )
                {
                    xmls.Add(kv.Key, AppConst.AssetPath[AppConst.GeneralLevel] + kv.Value);
                }
                break;
            }

            foreach (var kv in xmls)
            {
                waitForLoadXmlState.ChangeState(kv.Value);
                RunTimeTools.instence.StartCoroutine(CoroutineLoadXml(kv.Key, kv.Value));
            }

            waitForLoadXmlState.AddAlready();
        }
Beispiel #4
0
        public void Load(string level, IState <string> state)
        {
            baseState = state;

            foreach (var kv in GetTextureList(level))
            {
                waitForLoadResourceState.ChangeState(kv.Value);
                RunTimeTools.instence.StartCoroutine(CoroutineLoadTexture(kv.Key, kv.Value));
            }

            foreach (var kv in GetAudioClipList(level))
            {
                waitForLoadResourceState.ChangeState(kv.Value);
                RunTimeTools.instence.StartCoroutine(CoroutineLoadAudio(kv.Key, kv.Value));
            }

            waitForLoadResourceState.AddAlready();
        }