Beispiel #1
0
        void Awake()
        {
            Transform poolContainerOfBagCanvas = TransformManager.FindOrCreateTransform(CommonData.poolContainerName + "/PoolContainerOfBagCanvas");

            //创建缓存池
            bagItemsPool = InstancePool.GetOrCreateInstancePool("BagItemsPool", poolContainerOfBagCanvas.name);
        }
Beispiel #2
0
        private void LoadAllEffects()
        {
            if (mAllEffects.Count > 0)
            {
                return;
            }

            GameObject[] effectCache = MyResourceManager.Instance.LoadAssets <GameObject> (CommonData.allEffectsBundleName);

            Transform effectsContainer = TransformManager.FindOrCreateTransform("AllEffects");

            effectsContainer.position = new Vector3(1000, 0, 0);

            if (effectCache == null)
            {
                return;
            }

            for (int i = 0; i < effectCache.Length; i++)
            {
                GameObject effect = GameObject.Instantiate(effectCache [i]);
                effect.name = effectCache [i].name;
                effect.transform.SetParent(effectsContainer, false);
                mAllEffects.Add(effect.GetComponent <EffectAnim>());
            }
        }
Beispiel #3
0
        private void LoadAllSkills()
        {
            if (mAllSkills.Count > 0)
            {
                return;
            }

            GameObject[] skillCache = MyResourceManager.Instance.LoadAssets <GameObject> (CommonData.allSkillsBundleName);

            Transform skillsContainer = TransformManager.FindOrCreateTransform("AllSkills");

            if (skillCache == null)
            {
                return;
            }

            for (int i = 0; i < skillCache.Length; i++)
            {
                GameObject skill = GameObject.Instantiate(skillCache [i]);
                skill.name = skillCache [i].name;
                skill.transform.SetParent(skillsContainer);
                mAllSkills.Add(skill.GetComponent <Skill>());
            }

            SortSkillsById(mAllSkills);
        }
Beispiel #4
0
        public static InstancePool GetOrCreateInstancePool(string poolName, string parentName)
        {
            Transform trans = TransformManager.FindOrCreateTransform(parentName + "/" + poolName);

            InstancePool instancePool = trans.GetComponent <InstancePool> ();

            if (instancePool == null)
            {
                instancePool = trans.gameObject.AddComponent <InstancePool> ();
            }
            return(instancePool);
        }
        public GameObject LoadMonster(string monsterName)
        {
            GameObject[] assets = MyResourceManager.Instance.LoadAssets <GameObject> (CommonData.allMonstersBundleName, monsterName);

            Transform monstersContainer = TransformManager.FindOrCreateTransform("MonstersContainer");

            GameObject monster = GameObject.Instantiate(assets [0]);

            monster.name = assets [0].name;

            monster.transform.SetParent(monstersContainer);

            return(monster);
        }