Ejemplo n.º 1
0
        public override IEnumerator Start()
        {
            Caching.ClearCache();
            Global.Initialize();
            MVersion           versions = new MVersion();
            SUser              sUser    = Global.SUser;
            List <IEnumerator> list     = new List <IEnumerator>();

            list.Add(sUser.Download(TileAsset.Url, versions.tile, (AssetBundle assetbundle) => {
                TileAsset.assetbundle = assetbundle;
                TileCacher.Instance.Reset(TileAsset.Data.tiles);
                TileAsset.Clear();
            }));
            list.Add(sUser.Download(ImageAssetBundleManager.mapUrl, versions.map, (AssetBundle assetbundle) => {
                ImageAssetBundleManager.map = assetbundle;
            }, false));

            /*list.Add(sUser.Download(ConstantAsset.Url, versions.constant, (AssetBundle assetbundle) => {
             *  ConstantAsset.assetbundle = assetbundle;
             *  Global.Constant = ConstantAsset.Data.constant;
             * }));*/
            Debug.Log("Start");
            for (int i = 0; i < list.Count; i++)
            {
                Debug.Log(i + "/" + list.Count);
                yield return(this.StartCoroutine(list[i]));
            }
            Debug.Log("Start Over");
            loadComplete = true;
        }
Ejemplo n.º 2
0
        public static IEnumerator LoadAssetbundle(MVersion versions)
        {
            SUser sUser             = Global.SUser;
            List <IEnumerator> list = new List <IEnumerator>();

            list.Add(sUser.Download(ImageAssetBundleManager.horseUrl, versions.horse_img, (AssetBundle assetbundle) => {
                AvatarSpriteAsset.assetbundle = assetbundle;
                ImageAssetBundleManager.horse = AvatarSpriteAsset.Data.meshs;
            }));
            list.Add(sUser.Download(ImageAssetBundleManager.headUrl, versions.head_img, (AssetBundle assetbundle) => {
                AvatarSpriteAsset.assetbundle = assetbundle;
                ImageAssetBundleManager.head  = AvatarSpriteAsset.Data.meshs;
            }));
            list.Add(sUser.Download(ImageAssetBundleManager.clothesUrl, versions.clothes_img, (AssetBundle assetbundle) => {
                AvatarSpriteAsset.assetbundle   = assetbundle;
                ImageAssetBundleManager.clothes = AvatarSpriteAsset.Data.meshs;
            }));
            list.Add(sUser.Download(ImageAssetBundleManager.weaponUrl, versions.weapon_img, (AssetBundle assetbundle) => {
                AvatarSpriteAsset.assetbundle  = assetbundle;
                ImageAssetBundleManager.weapon = AvatarSpriteAsset.Data.meshs;
            }));
            list.Add(sUser.Download(ImageAssetBundleManager.equipmentIconUrl, versions.equipmenticon_icon, (AssetBundle assetbundle) => {
                ImageAssetBundleManager.equipmentIcon = assetbundle;
            }, false));
            list.Add(sUser.Download(CharacterAsset.Url, versions.character, (AssetBundle assetbundle) => {
                CharacterAsset.assetbundle = assetbundle;
                CharacterCacher.Instance.Reset(CharacterAsset.Data.characters);
                CharacterAsset.Clear();
            }));
            list.Add(sUser.Download(BattlefieldAsset.Url, versions.battlefield, (AssetBundle assetbundle) => {
                BattlefieldAsset.assetbundle = assetbundle;
                BattlefieldCacher.Instance.Reset(BattlefieldAsset.Data.battlefields);
                BattlefieldAsset.Clear();
            }));
            list.Add(sUser.Download(SkillAsset.Url, versions.skill, (AssetBundle assetbundle) => {
                SkillAsset.assetbundle = assetbundle;
                SkillCacher.Instance.Reset(SkillAsset.Data.skills);
                SkillAsset.Clear();
            }));
            list.Add(sUser.Download(NpcAsset.Url, versions.npc, (AssetBundle assetbundle) => {
                NpcAsset.assetbundle = assetbundle;
                NpcCacher.Instance.Reset(NpcAsset.Data.npcs);
                NpcAsset.Clear();
            }));
            list.Add(sUser.Download(TileAsset.Url, versions.tile, (AssetBundle assetbundle) => {
                TileAsset.assetbundle = assetbundle;
                TileCacher.Instance.Reset(TileAsset.Data.tiles);
                TileAsset.Clear();
            }));
            list.Add(sUser.Download(HorseAsset.Url, versions.horse, (AssetBundle assetbundle) => {
                HorseAsset.assetbundle = assetbundle;
                EquipmentCacher.Instance.ResetHorse(HorseAsset.Data.equipments);
                HorseAsset.Clear();
            }));
            list.Add(sUser.Download(WeaponAsset.Url, versions.weapon, (AssetBundle assetbundle) => {
                WeaponAsset.assetbundle = assetbundle;
                EquipmentCacher.Instance.ResetWeapon(WeaponAsset.Data.equipments);
                WeaponAsset.Clear();
            }));
            list.Add(sUser.Download(ClothesAsset.Url, versions.clothes, (AssetBundle assetbundle) => {
                ClothesAsset.assetbundle = assetbundle;
                EquipmentCacher.Instance.ResetClothes(ClothesAsset.Data.equipments);
                ClothesAsset.Clear();
            }));
            list.Add(sUser.Download(ConstantAsset.Url, versions.constant, (AssetBundle assetbundle) => {
                ConstantAsset.assetbundle = assetbundle;
                Global.Constant           = ConstantAsset.Data.constant;
            }));
            float step = 100f / list.Count;

            for (int i = 0; i < list.Count; i++)
            {
                //CLoadingDialog.SetNextProgress((i + 1) * step);
                yield return(AppManager.CurrentScene.StartCoroutine(list[i]));
            }
            yield return(0);
        }
Ejemplo n.º 3
0
        public IEnumerator Init(MVersion versions)
        {
            CScene             scene = SceneManager.CurrentScene;
            SUser              sUser = Global.SUser;
            List <IEnumerator> list  = new List <IEnumerator>();

            list.Add(sUser.Download(PromptMessageAsset.Url, versions.prompt_message, (AssetBundle assetbundle) => {
                Debug.Log("CLogo assetbundle=" + assetbundle);
                PromptMessageAsset.assetbundle = assetbundle;
            }));
            list.Add(sUser.Download(LanguageAsset.WORD_URL, versions.word, (AssetBundle assetbundle) => {
                LanguageAsset.assetbundle = assetbundle;
                Language.Reset(LanguageAsset.Data.words);
                LanguageAsset.Clear();
            }));
            list.Add(sUser.Download(ImageAssetBundleManager.horseUrl, versions.horse_img, (AssetBundle assetbundle) => {
                AvatarSpriteAsset.assetbundle = assetbundle;
                ImageAssetBundleManager.horse = AvatarSpriteAsset.Data.meshs;
            }));
            list.Add(sUser.Download(ImageAssetBundleManager.headUrl, versions.head_img, (AssetBundle assetbundle) => {
                AvatarSpriteAsset.assetbundle = assetbundle;
                ImageAssetBundleManager.head  = AvatarSpriteAsset.Data.meshs;
            }));
            list.Add(sUser.Download(ImageAssetBundleManager.clothesUrl, versions.clothes_img, (AssetBundle assetbundle) => {
                AvatarSpriteAsset.assetbundle   = assetbundle;
                ImageAssetBundleManager.clothes = AvatarSpriteAsset.Data.meshs;
            }));
            list.Add(sUser.Download(ImageAssetBundleManager.weaponUrl, versions.weapon_img, (AssetBundle assetbundle) => {
                AvatarSpriteAsset.assetbundle  = assetbundle;
                ImageAssetBundleManager.weapon = AvatarSpriteAsset.Data.meshs;
            }));
            list.Add(sUser.Download(WorldAsset.Url, versions.world, (AssetBundle assetbundle) => {
                WorldAsset.assetbundle = assetbundle;
                Global.worlds          = WorldAsset.Data.worlds;
            }));
            list.Add(sUser.Download(ConstantAsset.Url, versions.constant, (AssetBundle assetbundle) => {
                ConstantAsset.assetbundle = assetbundle;
                Global.Constant           = ConstantAsset.Data.constant;
            }));
            list.Add(sUser.Download(NpcAsset.Url, versions.npc, (AssetBundle assetbundle) => {
                NpcAsset.assetbundle = assetbundle;
                NpcCacher.Instance.Reset(NpcAsset.Data.npcs);
                NpcAsset.Clear();
            }));
            list.Add(sUser.Download(NpcEquipmentAsset.Url, versions.npc_equipment, (AssetBundle assetbundle) => {
                NpcEquipmentAsset.assetbundle = assetbundle;
                NpcEquipmentCacher.Instance.Reset(NpcEquipmentAsset.Data.npc_equipments);
                NpcEquipmentAsset.Clear();
            }));
            list.Add(sUser.Download(CharacterStarAsset.Url, versions.characterstar, (AssetBundle assetbundle) => {
                CharacterStarAsset.assetbundle = assetbundle;
                CharacterStarCacher.Instance.Reset(CharacterStarAsset.Data.characterStars);
                CharacterStarAsset.Clear();
            }));

            /*list.Add(sUser.Download(AreaAsset.Url, versions.area, (AssetBundle assetbundle)=>{
             *  AreaAsset.assetbundle = assetbundle;
             *  AreaCacher.Instance.Reset(AreaAsset.Data.areas);
             *  AreaAsset.Clear();
             * }));*/
            list.Add(sUser.Download(ItemAsset.Url, versions.item, (AssetBundle assetbundle) => {
                ItemAsset.assetbundle = assetbundle;
                ItemCacher.Instance.Reset(ItemAsset.Data.items);
                ItemAsset.Clear();
            }));

            /*list.Add(sUser.Download(MissionAsset.Url, versions.mission, (AssetBundle assetbundle)=>{
             *  MissionAsset.assetbundle = assetbundle;
             *  MissionCacher.Instance.Reset(MissionAsset.Data.missions);
             *  MissionAsset.Clear();
             * }));*/
            list.Add(sUser.Download(SkillAsset.Url, versions.skill, (AssetBundle assetbundle) => {
                SkillAsset.assetbundle = assetbundle;
                SkillCacher.Instance.Reset(SkillAsset.Data.skills);
                SkillAsset.Clear();
            }));
            list.Add(sUser.Download(StrategyAsset.Url, versions.strategy, (AssetBundle assetbundle) => {
                StrategyAsset.assetbundle = assetbundle;
                StrategyCacher.Instance.Reset(StrategyAsset.Data.strategys);
                StrategyAsset.Clear();
            }));
            list.Add(sUser.Download(ExpAsset.Url, versions.exp, (AssetBundle assetbundle) => {
                ExpAsset.assetbundle = assetbundle;
                ExpCacher.Instance.Reset(ExpAsset.Data.exps);
                ExpAsset.Clear();
            }));
            list.Add(sUser.Download(BattlefieldAsset.Url, versions.battlefield, (AssetBundle assetbundle) => {
                BattlefieldAsset.assetbundle = assetbundle;
                BattlefieldCacher.Instance.Reset(BattlefieldAsset.Data.battlefields);
                BattlefieldAsset.Clear();
            }));
            list.Add(sUser.Download(BuildingAsset.Url, versions.building, (AssetBundle assetbundle) => {
                BuildingAsset.assetbundle = assetbundle;
                BuildingCacher.Instance.Reset(BuildingAsset.Data.buildings);
                BuildingAsset.Clear();
            }));
            list.Add(sUser.Download(BaseMapAsset.Url, versions.top_map, (AssetBundle assetbundle) => {
                BaseMapAsset.assetbundle = assetbundle;
                BaseMapCacher.Instance.Reset(BaseMapAsset.Data.baseMaps);
                BaseMapAsset.Clear();
            }));
            list.Add(sUser.Download(CharacterAsset.Url, versions.character, (AssetBundle assetbundle) => {
                CharacterAsset.assetbundle = assetbundle;
                CharacterCacher.Instance.Reset(CharacterAsset.Data.characters);
                CharacterAsset.Clear();
            }));
            list.Add(sUser.Download(TileAsset.Url, versions.tile, (AssetBundle assetbundle) => {
                TileAsset.assetbundle = assetbundle;
                TileCacher.Instance.Reset(TileAsset.Data.tiles);
                TileAsset.Clear();
            }));
            list.Add(sUser.Download(LoginBonusAsset.Url, versions.loginbonus, (AssetBundle assetbundle) => {
                LoginBonusAsset.assetbundle = assetbundle;
                LoginBonusCacher.Instance.Reset(LoginBonusAsset.Data.loginbonuses);
                LoginBonusAsset.Clear();
            }));
            list.Add(sUser.Download(ImageAssetBundleManager.mapUrl, versions.map, (AssetBundle assetbundle) => {
                ImageAssetBundleManager.map = assetbundle;
            }, false));
            list.Add(sUser.Download(ImageAssetBundleManager.equipmentIconUrl, versions.equipmenticon_icon, (AssetBundle assetbundle) => {
                ImageAssetBundleManager.equipmentIcon = assetbundle;
            }, false));
            list.Add(sUser.Download(ImageAssetBundleManager.itemIconUrl, versions.item_icon, (AssetBundle assetbundle) => {
                ImageAssetBundleManager.itemIcon = assetbundle;
            }, false));
            list.Add(sUser.Download(ImageAssetBundleManager.skillIconUrl, versions.skill_icon, (AssetBundle assetbundle) => {
                ImageAssetBundleManager.skillIcon = assetbundle;
            }, false));
            list.Add(sUser.Download(HorseAsset.Url, versions.horse, (AssetBundle assetbundle) => {
                HorseAsset.assetbundle = assetbundle;
                EquipmentCacher.Instance.ResetHorse(HorseAsset.Data.equipments);
                HorseAsset.Clear();
            }));
            list.Add(sUser.Download(WeaponAsset.Url, versions.weapon, (AssetBundle assetbundle) => {
                WeaponAsset.assetbundle = assetbundle;
                EquipmentCacher.Instance.ResetWeapon(WeaponAsset.Data.equipments);
                WeaponAsset.Clear();
            }));
            list.Add(sUser.Download(ClothesAsset.Url, versions.clothes, (AssetBundle assetbundle) => {
                ClothesAsset.assetbundle = assetbundle;
                EquipmentCacher.Instance.ResetClothes(ClothesAsset.Data.equipments);
                ClothesAsset.Clear();
            }));
            list.Add(sUser.Download(StoryProgressAsset.Url, versions.character, (AssetBundle assetbundle) => {
                StoryProgressAsset.assetbundle = assetbundle;
                foreach (string key in StoryProgressAsset.Data.keys)
                {
                    App.Util.LSharp.LSharpVarlable.SetVarlable(key, "0");
                }
                StoryProgressAsset.Clear();
            }));
            if (App.Util.Global.SUser.self != null)
            {
                list.Add(sUser.RequestGet());
            }
            float step = 100f / list.Count;

            for (int i = 0; i < list.Count; i++)
            {
                CLoadingDialog.SetNextProgress((i + 1) * step);
                yield return(scene.StartCoroutine(list[i]));
            }
            yield return(0);
        }
Ejemplo n.º 4
0
        public bool TutorialStart()
        {
            if (!Global.SUser.self.IsTutorial)
            {
                return(false);
            }
            SUser sUser    = Global.SUser;
            int   tutorial = sUser.self.GetValue("tutorial");

            StartCoroutine(sUser.Download(TutorialAsset.TutorialUrl(tutorial), Global.versions.tutorial, (AssetBundle assetbundle) => {
                TutorialAsset.assetbundle = assetbundle;
                App.Util.LSharp.LSharpScript.Instance.Analysis(TutorialAsset.Data.tutorial);

                /*
                 * if(tutorial <= 0){
                 *  App.Util.LSharp.LSharpScript.Instance.Analysis(TutorialAsset.Data.tutorial);
                 * }else{c
                 *
                 *  List<string> script = new List<string>();
                 *  script.Add("Talk.set(4100,0,@player_name,恭喜你打了胜仗啊!,false);");
                 *  script.Add("Talk.setplayer(@player_id,0,差点儿被你害死了,还好友军比较厉害!,true);");
                 *  script.Add("Talk.set(4100,0,你也要继续变强啊,才能完成玄女娘娘交给你的任务!,false);");
                 *  script.Add("Talk.setplayer(@player_id,0,你说的容易,我的法力都被封起来了,一个凡人怎么有那么大的本事啊!,true);");
                 *  script.Add("Talk.set(4100,0,你也不用太担心,被你放走的妖魔星中,也不全是坏人!,false);");
                 *  script.Add("Talk.setplayer(@player_id,0,妖魔中还有好人?,true);");
                 *  script.Add("Talk.set(4100,0,被放走的魔星中,有三十六天罡星和七十二地煞星,这一百单八星虽然也被叫做魔星,但是都心存善念,而且讲义气!,false);");
                 *  script.Add("Talk.setplayer(@player_id,0,哦!?这么说,我可以先找他们帮忙,一起对付另外的妖星魔星?,true);");
                 *  script.Add("Talk.set(4100,0,真聪明!现在再跟你介绍一个比较重要的功能,打开任务菜单看一下!,false);");
                 *  script.Add("Tutorial.clickmask(SceneTop.UICamera.Canvas.LeftMenu.MissionButton,0,0,96,96);");
                 *  script.Add("Tutorial.call(SceneTop,OpenMission);");
                 *  script.Add("Tutorial.wait(MissionDialog(Clone).Panel.Scroll View.Viewport.Content.MissionChild(Clone));");
                 *  script.Add("Talk.set(4100,0,当你完成了一些任务之后,就可以获取一些奖励,你刚刚完成了【援助王进】的任务,先领取奖励吧!,false);");
                 *  script.Add("Tutorial.clickmask(MissionDialog(Clone).Panel.Scroll View.Viewport.Content.MissionChild(Clone).GetButton,0,0,120,40);");
                 *  script.Add("Tutorial.call(MissionDialog(Clone).Panel.Scroll View.Viewport.Content.MissionChild(Clone),ClickComplete);");
                 *  script.Add("Tutorial.wait(ContentsConfirmDialog(Clone));");
                 *  script.Add("Var.setprogress(tutorial,2);");
                 *  script.Add("Talk.set(4100,0,每个任务都有相应的说明,你也可以把这些任务当作是游戏进程的提醒,每天通过任务就可以获得很多奖励哦!,false);");
                 *  script.Add("Talk.set(4100,0,任务功能就介绍到这里了,现在关闭任务窗口!,false);");
                 *  script.Add("Tutorial.clickmask(ContentsConfirmDialog(Clone).Panel.Close,0,0,96,96);");
                 *  script.Add("Tutorial.call(ContentsConfirmDialog(Clone),Close);");
                 *  script.Add("Wait.time(0.1);");
                 *  script.Add("Tutorial.call(MissionDialog(Clone),Close);");
                 *  script.Add("Wait.time(0.4);");
                 *  script.Add("Tutorial.call(SceneTop,TutorialStart);");
                 *
                 *
                 *  script.Add("Tutorial.wait(GachaDialog(Clone).Panel.Scroll View.Viewport.Content.Gacha_tutorial);");
                 *  script.Add("Tutorial.clickmask(GachaDialog(Clone).Panel.Scroll View.Viewport.Content.Gacha_tutorial.ButtonSingle,0,0,160,70);");
                 *  script.Add("Tutorial.call(GachaDialog(Clone).Panel.Scroll View.Viewport.Content.Gacha_tutorial.ButtonSingle,OnClickGacha);");
                 *  script.Add("Tutorial.wait(GachaResultDialog(Clone));");
                 *  script.Add("Wait.time(0.4);");
                 *  script.Add("Talk.set(4100,0,太棒了!召唤除了紫将啊!记得以后要召唤更多的伙伴啊!,false);");
                 *  script.Add("Tutorial.call(GachaResultDialog(Clone),BackgroundClick);");
                 *  script.Add("Wait.time(0.3);");
                 *  script.Add("Tutorial.call(GachaResultDialog(Clone),Close);");
                 *  script.Add("Tutorial.call(GachaDialog(Clone),Close);");
                 *  script.Add("Wait.time(0.3);");
                 *  script.Add("Talk.set(4100,0,好了,我暂时就帮你到这里了,你以后要自己努力了!,false);");
                 *  script.Add("Talk.setplayer(@player_id,0,等等......?,true);");
                 *  script.Add("Talk.setplayer(@player_id,0,走的好快啊...看来以后得靠自己了。,true);");
                 *  script.Add("Talk.setplayer(@player_id,0,总之,要先去寻找天罡星和地煞星这些人的下落了。,true);");
                 *  script.Add("Talk.setplayer(@player_id,0,上次一起帮忙打强盗的那个叫史大郎的英雄好像很厉害,会不会是我要找的人呢,我先去找他聊一聊吧。,true);");
                 *  script.Add("Tutorial.close();");
                 *  //script.Add("Var.setprogress(tutorial,2);");
                 *
                 *
                 *  App.Util.LSharp.LSharpScript.Instance.Analysis(script);
                 * }*/
            }));
            return(true);
        }