Ejemplo n.º 1
0
        public void Parse()
        {
            m_index = int.Parse(m_mainElement.Attribute("index")) - 1;

            foreach (SecurityElement rootChild in m_mainElement.Children)
            {
                if (rootChild.Tag.Equals("cube"))
                {
                    int count  = int.Parse(rootChild.Attribute("count"));
                    int _index = 0;
                    m_cubes = new CubeParse[count];
                    foreach (SecurityElement child in rootChild.Children)
                    {
                        var cube = new CubeParse(child);
                        cube.Parse();
                        m_cubes[_index] = cube;
                        _index++;
                    }
                }
                else if (rootChild.Tag.Equals("ornament"))
                {
                    int count  = int.Parse(rootChild.Attribute("count"));
                    int _index = 0;
                    m_ornaments = new CubeParse[count];
                    foreach (SecurityElement child in rootChild.Children)
                    {
                        var cube = new CubeParse(child);
                        cube.Parse();
                        m_ornaments[_index] = cube;
                        _index++;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 创建CubeComponent
        /// </summary>
        /// <param name="cubeParse"></param>
        /// <param name="root"></param>
        private CubeComponent CreateCubeComponent(CubeParse cubeParse, Transform root)
        {
            GameObject cube = new GameObject();

            cube.name             = cubeParse.position.ToString();
            cube.transform.parent = root;
            var cubeComponent = cube.AddComponent <CubeComponent>();

            cubeComponent.Init(cubeParse);
            return(cubeComponent);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 初始化
 /// </summary>
 public void Init(CubeParse parse)
 {
     m_cubeParse = parse;
 }