Beispiel #1
0
    private void XmlParserConfig(XElement tempElement, int waveNum)
    {
        if (Initialize)
        {
            foreach (XElement Cfg in tempElement.Elements("GameConfig"))
            {
                PlayZone.N = int.Parse(Cfg.Attribute("MapSizeN").Value);
                PlayZone.M = int.Parse(Cfg.Attribute("MapSizeM").Value);
                PlayZone.Instance().InitializeGameZone();
            }
            Initialize = false;
        }
        if (waveNum == 0)
        {
            foreach (XElement Cfg in tempElement.Elements("PlayerConfigForWave" + waveNum))
            {
                float  SizeX         = float.Parse(Cfg.Attribute("SizeX").Value);
                float  SizeY         = float.Parse(Cfg.Attribute("SizeY").Value);
                float  Speed         = float.Parse(Cfg.Attribute("Speed").Value);
                string MathExample   = Cfg.Attribute("Example").Value;
                int    ExampleAnswer = int.Parse(Cfg.Attribute("ExampleAnswer").Value);
                //string Example = Cfg.Attribute("Example").Value;

                URLPlayerConfig.SizeX            = SizeX;
                URLPlayerConfig.SizeY            = SizeY;
                URLPlayerConfig.Speed            = Speed;
                URLPlayerConfig.MathExample.text = MathExample;
                URLPlayerConfig.NeedNum          = ExampleAnswer;
                URLPlayerConfig.reSizePlayer();
            }
        }
        else
        {
            foreach (XElement Cfg in tempElement.Elements("PlayerConfigForWave" + waveNum))
            {
                float  Speed         = float.Parse(Cfg.Attribute("Speed").Value);
                string MathExample   = Cfg.Attribute("Example").Value;
                int    ExampleAnswer = int.Parse(Cfg.Attribute("ExampleAnswer").Value);
                //string Example = Cfg.Attribute("Example").Value;


                URLPlayerConfig.Speed            = Speed;
                URLPlayerConfig.MathExample.text = MathExample;
                URLPlayerConfig.NeedNum          = ExampleAnswer;

                print(MathExample);
            }
        }

        foreach (XElement Cfg in tempElement.Elements("BlockConfigForWave" + waveNum))
        {
            int   MaxFigure = int.Parse(Cfg.Attribute("MaxEnemy").Value);
            float SizeX     = float.Parse(Cfg.Attribute("SizeX").Value);
            float SizeY     = float.Parse(Cfg.Attribute("SizeY").Value);
            float Speed     = float.Parse(Cfg.Attribute("Speed").Value);
            int   Example   = int.Parse(Cfg.Attribute("ExampleAnswer").Value);

            URLFigureConfig.SizeX = SizeX;
            URLFigureConfig.SizeY = SizeY;
            URLFigureConfig.Speed = Speed;
            StartCoroutine(CreateNewFigure(MaxFigure, SizeX, SizeY, Speed, Example));
        }
    }