예제 #1
0
 public void SetBuildingTemplate(BuildingAsset asset)
 {
     m_BuildingToPlace = asset;
     m_TextName.text   = asset.m_ShortName;
     m_TextCost.text   = $"<sprite name=Infernite> {asset.m_BuildCost}";
     m_Icon.sprite     = asset.m_Icon;
 }
예제 #2
0
        private GameObject GetAsset(BuildingAsset[] prefabs, string id)
        {
            if (prefabs.Length == 0)
            {
                return(null);
            }

            //BuildingAsset asset = GetRandom(prefabs, id);
            int           index = uRandom.Range(0, prefabs.Length);
            BuildingAsset asset = prefabs[index];

            string assetPath = AssetDatabase.GetAssetPath(asset.prefab);

            UnityEngine.Object prefab = AssetDatabase.LoadAssetAtPath <GameObject>(assetPath);
            Debug.Log(assetPath);

            //  Instantiate the prefab
            //GameObject go = Instantiate(asset.prefab, grpContainers.ContainsKey(id) ? grpContainers[id].transform : buildingRoot.transform);
            GameObject go = Instantiate(prefab, grpContainers.ContainsKey(id) ? grpContainers[id].transform : buildingRoot.transform) as GameObject;

            //var go = UnityEditor.PrefabUtility.InstantiatePrefab(asset.prefab);
            //  Add it to the list of assets.
            assets.Add(id, go);

            go.transform.localPosition = Vector3.zero;
            go.transform.localRotation = Quaternion.identity;

            if (id == signID)
            {
                go.transform.rotation = Quaternion.Euler(0, -90, 0);
            }

            return(go);
        }
예제 #3
0
    //=============  ClickedOnBuild()  ===================//
    public void ClickedOnBuild(BuildingAsset buildingAsset)
    {
        //---------------------  buildAsset, BuildObj  ---------------------------//
        currentBuildAsset = buildingAsset;
        currentBuildObj   = Object.Instantiate(buildingAsset.BuildingObj, Vector3.zero, Quaternion.identity, buildings);

        //---------------------  Proto Material  ---------------------------//
        currentBuildObj.GetComponent <Renderer>().material = currentBuildAsset.Mat_Proto;
        for (int i = 0; i < currentBuildObj.transform.childCount; i++)
        {
            currentBuildObj.transform.GetChild(i).GetComponent <Renderer>().material = currentBuildAsset.Mat_Proto;
        }

        //---------------------  Audio  ---------------------------//
        scrollAudio.scrollAudioSrc.clip = scrollAudio.ding_confirm;
        scrollAudio.scrollAudioSrc.Play();

        buildAudioSrc             = currentBuildObj.AddComponent <AudioSource>();
        buildAudioSrc.clip        = scrollAudio.ding_selected;
        buildAudioSrc.playOnAwake = false;
        buildAudioSrc.Play();

        //---------------------  BuildPhase  ---------------------------//
        buildPhase = BuildPhase.moving;

        //---------------------  EnableDisableScroll  ---------------------------//
        EnableDisableScroll(false);
    }
    public void SetVendorItems()
    {
        for (int i = 0; i < _buildings.Count; i++)
        {
            BuildingAsset baseBuildingAsset = _buildings[i];
            Level         baseBuidling      = baseBuildingAsset.levels[0];

            if ((this.transform == null) || (vendorItemPrefab == null))
            {
                return;
            }

            GameObject instance = (GameObject)Instantiate(vendorItemPrefab.gameObject);
            instance.transform.SetParent(scrollList.transform, false);

            VendorItem vendorItem = instance.GetComponent <VendorItem>();
            if (vendorItem == null)
            {
                return;
            }

            vendorItem.SetVendorItemData(baseBuidling.levelSprite, baseBuildingAsset.buildingName, baseBuidling.levelCost);
            vendorItem.btnBuy.onClick.AddListener(() => BuyBuilding(baseBuildingAsset, baseBuidling));
        }
    }
    private void AddBuildingTemplate(RectTransform parent, BuildingAsset asset)
    {
        var gobj   = Instantiate(m_BuildingUITemplate, parent);
        var button = gobj.GetComponent <BuildingButtonController>();

        button.SetBuildingTemplate(asset);
    }
예제 #6
0
    public void PlaceBuilding(BuildingAsset building, Vector3 position)
    {
        position = new Vector3(position.x, position.y, 0);
        GameObject newBuilding  = Instantiate(baseBuidlingPrefab, position, Quaternion.identity);
        Building   buildingComp = newBuilding.GetComponent <Building>();

        buildingComp.SetAsset(building);
        SoundManager.Instance.PlaySound(building.buildingPlacedSFX, transform.position);
        buildingComp.StartConstruction(building.levels[0]);
    }
예제 #7
0
    private void PlaceBuildingIfSelected(Vector3 position)
    {
        BuildingAsset selectedBuilding = GameManager.Instance.selectedBuilding;

        if (selectedBuilding != null)
        {
            Builder.Instance.PlaceBuilding(selectedBuilding, position);
            GameManager.Instance.selectedBuilding = null;
            UIManager.Instance.HideHoverBuilding();
        }
    }
예제 #8
0
        // get 1 image for List View
        public BuildingAsset GetById(int buildingId)
        {
            BuildingAsset existingAsset  = null;
            var           buildingAssets = _buildingAssetRepo.GetAllById(buildingId);

            if (buildingAssets != null && buildingAssets.Count > 0)
            {
                existingAsset = buildingAssets.FirstOrDefault();
            }

            return(existingAsset);
        }
예제 #9
0
    public void CancelBuildingPlacement()
    {
        // Delete building visual
        if (m_SpectralBuilding != null)
        {
            Destroy(m_SpectralBuilding);
        }

        // Reset bookkeeping
        m_SpectralBuilding          = null;
        m_SpectralBuildingTransform = null;
        m_PlacementBuilding         = null;
    }
예제 #10
0
        public void SetDefaultAsset(IAsset asset)
        {
            if (asset == null)
            {
                asset = new BuildingAsset();
            }

            if (Assets == null)
            {
                Assets = new List <IAsset>();
            }

            Assets.Add(asset);
        }
예제 #11
0
    public void SetBuilding(Transform container, BuildingAsset asset)
    {
        if (m_ModelInstance != null)
        {
            Object.Destroy(m_ModelInstance);
        }

        var worldpos = Map.MapToWorld(m_MapPos);

        m_ModelInstance = Object.Instantiate(asset.m_Prefab, worldpos, Quaternion.identity, container);

        m_BuildingAsset           = asset;
        m_BuildingInstance        = m_ModelInstance.GetComponent <Building>();
        m_BuildingInstance.m_Cell = this;
    }
예제 #12
0
 private void BuyBuilding(BuildingAsset building, Level level)
 {
     if (GameManager.Instance.crystalAmount >= level.levelCost)
     {
         SoundManager.Instance.PlaySound(purchaseSFX, transform.position);
         GameManager.Instance.selectedBuilding = building;
         GameManager.Instance.DecreaseCrystals(level.levelCost);
         UIManager.Instance.ShowHoverBuilding(gameObject.transform.position, level.levelSprite);
         Close(.2f);
     }
     else
     {
         SoundManager.Instance.PlaySound(cantPurchaseSFX, transform.position);
     }
 }
예제 #13
0
    private void EndGame()
    {
        gameHasEnded = true;

        if (GetHighScore() < crystalAmount)
        {
            SetHighScore(crystalAmount);
        }

        selectedBuilding = null;
        ClearHoverBuilding();
        SoundManager.Instance.StopAllLoopingSounds();
        UIManager.Instance.ToggleGameOverlayUI(false);
        UIManager.Instance.ToggleEndUI(true);
        VendorUIManager.Instance.Close(0f);
    }
예제 #14
0
    public void BeginBuildingPlacement(BuildingAsset asset)
    {
        // Delete any previous spectral buildings
        CancelBuildingPlacement();

        // Create a new one
        m_PlacementBuilding         = asset;
        m_SpectralBuilding          = Instantiate(asset.m_PrefabGhost, Map.MapToWorld(m_MapPosition), Quaternion.identity);
        m_SpectralBuildingTransform = m_SpectralBuilding.GetComponent <Transform>();

        // Apply transparent shader to all renderers in the building
        var renderers = m_SpectralBuilding.GetComponentsInChildren <MeshRenderer>();

        foreach (var r in renderers)
        {
            r.sharedMaterial = m_SpectralBuildingMaterial;
        }
    }
예제 #15
0
    //=============  Update()  ===========================//
    private void Update()
    {
        if (buildPhase == BuildPhase.none)
        {
            if (Input.GetMouseButtonDown(0))
            {
                RaycastHit hit;
                Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                if (Physics.Raycast(ray, out hit, float.MaxValue, layerMaskSoldiers))
                {
                    currentUnit = hit.collider.GetComponent <Unit>();
                    Object.Instantiate(unitControl.selectionCircle, currentUnit.transform.position, currentUnit.transform.rotation, currentUnit.transform);

                    currentUnit.Select();
                }
                else
                {
                    audioGUI.audioSrc.clip = audioGUI.clip_nullClick; audioGUI.audioSrc.Play();
                }
            }

            if (Input.GetMouseButtonDown(1) && currentUnit != null && currentUnit.currentState == Unit.UnitState.notAttacking)
            {
                RaycastHit hit;
                Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                if (Physics.Raycast(ray, out hit, float.MaxValue, layerMaskGroundAndSoldiers))
                {
                    if (hit.collider.GetComponent <Unit>())
                    {
                        audioGUI.audioSrc.clip = audioGUI.clip_attackClick; audioGUI.audioSrc.Play();
                        currentUnit.AssignEnemy(hit.collider.GetComponent <Unit>());
                    }
                    else
                    {
                        currentUnit.AssignObjective(hit.point);
                    }
                }
            }
        }
        else
        if (currentBuildObj != null)
        {
            if (Input.GetMouseButtonDown(1) && !overlap)
            //-------------------------  Finish placement  ---------------------------------------------------------------------//
            {
                //Apply material
                currentBuildObj.GetComponent <Renderer>().material = currentBuildAsset.Mat_Final;
                for (int i = 0; i < currentBuildObj.transform.childCount; i++)
                {
                    currentBuildObj.transform.GetChild(i).GetComponent <Renderer>().material = currentBuildAsset.Mat_Final;
                }

                //Place final wall node
                if (buildPhase == BuildPhase.walling)
                {
                    Object.Instantiate(currentBuildAsset.BuildingObj, currentNode.position + (currentBuildObj.transform.position - currentNode.position) * 2, Quaternion.identity, buildings);
                    currentNode = null;
                }

                //reset currentBuildObj, currentBuildAsset, & buildphase
                currentBuildObj   = null;
                currentBuildAsset = null;
                buildPhase        = BuildPhase.none;

                //Audio
                buildAudioSrc.clip = scrollAudio.ding_confirm;
                buildAudioSrc.Play();
            }
            else
            {
                RaycastHit hit;
                Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                if (Physics.Raycast(ray, out hit, 100.0f, layerMaskGround))
                {
                    //Collision detection
                    Collider[] colliders = Physics.OverlapBox(hit.point, currentBuildObj.GetComponent <BoxCollider>().size / 2, currentBuildObj.transform.rotation, layerMaskNotGround, QueryTriggerInteraction.Collide);
                    if (colliders.Length > 1)
                    {
                        overlap = true;
                    }
                    else
                    {
                        overlap = false;
                    }

                    if (overlap)
                    {
                        currentBuildAsset.Mat_Proto.color = new Color(1, 0, 0, currentBuildAsset.Mat_Proto.color.a);
                    }
                    else
                    {
                        currentBuildAsset.Mat_Proto.color = new Color(1, 1, 1, currentBuildAsset.Mat_Proto.color.a);
                    }

                    //-------------------------  Moving & rotating  -----------------------------------------------------------//
                    if (buildPhase != BuildPhase.walling)
                    {
                        if (!Input.GetMouseButton(0))           //---------------  Moving  -----------------------------------------//
                        {
                            currentBuildObj.transform.position = hit.point;
                        }
                        else
                        {
                            if (currentBuildAsset.wall.wallObj == null) //-----------------  Rotating  ------------------------//
                            {
                                currentBuildObj.transform.LookAt(hit.point);
                            }
                            else                                        //-----------------  Walling  ------------------------//
                            {
                                buildPhase = BuildPhase.walling;

                                currentBuildObj.GetComponent <Renderer>().material = currentBuildAsset.Mat_Final;
                                for (int i = 0; i < currentBuildObj.transform.childCount; i++)
                                {
                                    currentBuildObj.transform.GetChild(i).GetComponent <Renderer>().material = currentBuildAsset.Mat_Final;
                                }

                                currentNode     = currentBuildObj.transform;
                                currentBuildObj = Object.Instantiate(currentBuildAsset.wall.wallObj, buildings);
                                currentBuildObj.GetComponent <Renderer>().material = currentBuildAsset.Mat_Proto;
                            }
                        }
                    }
                    else  //-----------------  Walling  ------------------------//
                    if (Vector3.Distance(hit.point, currentNode.position) > currentBuildAsset.wall.wallLength)
                    {
                        currentBuildObj.transform.position = currentNode.position + Vector3.Normalize(hit.point - currentNode.position) * (currentBuildAsset.wall.wallLength / 2);
                        currentBuildObj.transform.LookAt(hit.point);
                        currentBuildObj.transform.rotation = Quaternion.Euler(0, currentBuildObj.transform.eulerAngles.y - 90, 0);

                        if (Input.GetMouseButtonDown(0) && !overlap)
                        {
                            buildAudioSrc.clip = scrollAudio.ding_confirm;
                            buildAudioSrc.Play();

                            currentNode = Object.Instantiate(currentBuildAsset.BuildingObj, currentNode.position + Vector3.Normalize(hit.point - currentNode.position) * (currentBuildAsset.wall.wallLength), Quaternion.identity, buildings).transform;

                            currentBuildObj.GetComponent <Renderer>().material = currentBuildAsset.Mat_Final;
                            for (int i = 0; i < currentBuildObj.transform.childCount; i++)
                            {
                                currentBuildObj.transform.GetChild(i).GetComponent <Renderer>().material = currentBuildAsset.Mat_Final;
                            }

                            //Instantiate new object
                            currentBuildObj = Object.Instantiate(currentBuildAsset.wall.wallObj, buildings);

                            currentBuildObj.transform.position = currentNode.position + Vector3.Normalize(hit.point - currentNode.position) * (currentBuildAsset.wall.wallLength / 2);
                            currentBuildObj.transform.LookAt(hit.point);
                            currentBuildObj.transform.rotation = Quaternion.Euler(0, currentBuildObj.transform.eulerAngles.y - 90, 0);

                            currentBuildObj.GetComponent <Renderer>().material = currentBuildAsset.Mat_Proto;
                        }
                    }
                }
            }
        }
    }
예제 #16
0
 public static bool CanBuildingSpreadEnergy(BuildingAsset asset)
 {
     return(asset is BuildingAssetCable || asset is BuildingAssetPowerGenerator);
 }
예제 #17
0
    private static void RefreshEnergyNetworkOfCell(Map map, GridCell origin)
    {
        // Only run this logic for consumers
        if (!(origin?.m_BuildingAsset is BuildingAssetPowerConsumer consumer))
        {
            return;
        }

        // Skip consumers that are inoperable due to corruption
        if (!origin.m_BuildingInstance.IsOperable())
        {
            return;
        }

        // Flood fill outward to find all nearby generators
        var generators = new List <BuildingPowerGenerator>();
        var visited    = new HashSet <Vector2Int>();
        var cables     = new Stack <Vector2Int>(16);

        cables.Push(origin.m_MapPos);
        while (cables.Count > 0)
        {
            // Get the next tile to visit
            Vector2Int visit = cables.Pop();
            visited.Add(visit);

            // Get state of this tile
            GridCell      cell  = map.GetCellAt(visit);
            BuildingAsset asset = cell.m_BuildingAsset;

            // Find generators
            if (asset is BuildingAssetPowerGenerator)
            {
                generators.Add((BuildingPowerGenerator)cell.m_BuildingInstance);
            }

            // Visit neighbors only if this is a cable or this is the origin site
            if (CanBuildingSpreadEnergy(asset) || visit == origin.m_MapPos)
            {
                TryVisit(map, visit + Vector2Int.up, cables, visited);
                TryVisit(map, visit + Vector2Int.down, cables, visited);
                TryVisit(map, visit + Vector2Int.left, cables, visited);
                TryVisit(map, visit + Vector2Int.right, cables, visited);
            }
        }

        // Now determine which generators to draw power from.
        int total_available = generators.Sum(generator => generator.m_PowerAvailable);

        if (total_available < consumer.m_EnergyConsumption)
        {
            // Not enough power is available, power remains off
            //Debug.Log($"Consumer {origin.m_MapPos} ({origin.m_BuildingAsset.name}) is UNPOWERED");
            return;
        }

        // Remove energy from generators so other consumers cannot claim it
        int total_draw = consumer.m_EnergyConsumption;

        foreach (var generator in generators)
        {
            int local_draw = Mathf.Min(total_draw, generator.m_PowerAvailable);
            generator.m_PowerAvailable -= local_draw;
            total_draw -= local_draw;
            //Debug.Log($"Drawing {local_draw} from generator at {generator.m_Cell.m_MapPos}, {generator.m_PowerAvailable} remaining");
        }

        // This building is now considered powered
        ((BuildingPowerConsumer)origin.m_BuildingInstance).m_IsPowered = true;
        //Debug.Log($"Consumer {origin.m_MapPos} ({origin.m_BuildingAsset.name}) is powered");
    }
예제 #18
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);
        }
 public TotalAsset(BuildingAsset buildingAsset)
 {
     Path          = "TotalAsset";
     BuildingAsset = buildingAsset;
 }
예제 #20
0
 public void SetAsset(BuildingAsset asset)
 {
     _asset             = asset;
     _currentLevelAsset = _asset.levels[_currentLevel];
 }