Exemplo n.º 1
0
        public void PreloadGameObject(string _path, Action _callBack)
        {
            if (dic.ContainsKey(_path))
            {
                SuperDebug.LogError("PreloadGameObject error path:" + _path);

                return;
            }

            GameObjectFactoryUnit unit = new GameObjectFactoryUnit(_path);

            dic.Add(_path, unit);

            unit.PreloadGameObject(_callBack);
        }
Exemplo n.º 2
0
        public GameObject GetGameObject(string _path, Action <GameObject> _callBack, bool _addUseNum)
        {
            GameObjectFactoryUnit unit;

            if (!dic.ContainsKey(_path))
            {
                unit = new GameObjectFactoryUnit(_path);

                dic.Add(_path, unit);
            }
            else
            {
                unit = dic [_path];
            }

            return(unit.GetGameObject(_path, _callBack, _addUseNum));
        }
Exemplo n.º 3
0
        public GameObject[] GetGameObjects(string[] _paths, Action <GameObject[]> _callBack, bool _addUseNum)
        {
            int loadNum = 1;

            GameObject[] gameObjects = new GameObject[_paths.Length];

            for (int i = 0; i < _paths.Length; i++)
            {
                string path = _paths[i];

                GameObjectFactoryUnit unit;

                if (!dic.ContainsKey(path))
                {
                    unit = new GameObjectFactoryUnit(path);

                    dic.Add(path, unit);
                }
                else
                {
                    unit = dic [path];
                }

                loadNum++;

                int tmpIndex = i;

                Action <GameObject> callBack = delegate(GameObject _go) {
                    gameObjects[tmpIndex] = _go;

                    GetOneOfGameObjects(ref loadNum, gameObjects, _callBack);
                };

                unit.GetGameObject(path, callBack, _addUseNum);
            }

            GetOneOfGameObjects(ref loadNum, gameObjects, _callBack);

            return(gameObjects);
        }
Exemplo n.º 4
0
        public GameObject GetGameObject(string _bodyPath, Action <GameObject> _callBack, string[] _partsPaths, string[] _jointNames, float[] _partsScales)
        {
            GameObjectFactoryUnit unit;

            string path = _bodyPath;

            foreach (string part in _partsPaths)
            {
                path = string.Concat(path, part);
            }

            if (!dic.ContainsKey(path))
            {
                unit = new GameObjectFactoryUnit(path);

                dic.Add(path, unit);
            }
            else
            {
                unit = dic [path];
            }

            return(unit.GetGameObject(_bodyPath, _callBack, _partsPaths, _jointNames, _partsScales));
        }