Example #1
0
        public void Start()
        {
            _soundmanager.Play("rj");
            _particles      = new Particle.FlyingFlowersParticles(_textureManager);
            _breakParticles = new Particle.BreakPointsParticles(_textureManager);
            background      = new BackGround(_textureManager, 0, _particles); //着色等级为0级(顶层着色)
            background.BindParticle(_breakParticles);                         //绑定粒子

            background.Start();
            foretable.Start();
            gameview.Start();
            GamePlayer.Start();

            Hp       = Datas.Hp_Start;
            Datas.Hp = Hp;
            Booms    = Datas.booms;

            Datas.CurrentEnemys  = Enemys;                     //将全局的CurrentEnemys指向此场景上(便于)
            Datas.CurrentItemAdd = Items_toAdd;                //将全局道具列表切换到此状态
            Datas.CurrentPlayer  = GamePlayer;                 //当前玩家

            GameTime = 0;                                      //初始化游戏时间

            //重播模式
            if (Datas.ReFre)
            {
                #region
                Datas.ReadData();
                commands.Clear();
                foreach (string str in Datas.Commands)
                {
                    char[] arr = str.ToCharArray();
                    int    st = 0, ct = 0;
                    for (int i = 0; i < arr.Length; i++)
                    {
                        if (arr[i] == '$')
                        {
                            st = i;
                        }
                        if (arr[i] == '#')
                        {
                            ct = i;
                        }
                    }
                    string name  = str.Substring(st + 1, ct - st - 1);
                    string value = str.Substring(ct + 1);
                    double time  = Convert.ToDouble(value);
                    switch (name)
                    {
                    case "Seed":
                        int seed = (int)time;
                        Datas.GameRandom = new GRandom(seed);
                        break;

                    case "LeftDown":
                        TCset tcset = new TCset();
                        tcset.Name         = "LeftDown";
                        tcset.caculateTime = time;
                        commands.Add(tcset);
                        break;

                    case "LeftUp":
                        tcset              = new TCset();
                        tcset.Name         = "LeftUp";
                        tcset.caculateTime = time;
                        commands.Add(tcset);
                        break;

                    case "RightDown":
                        tcset              = new TCset();
                        tcset.Name         = "RightDown";
                        tcset.caculateTime = time;
                        commands.Add(tcset);
                        break;

                    case "RightUp":
                        tcset              = new TCset();
                        tcset.Name         = "RightUp";
                        tcset.caculateTime = time;
                        commands.Add(tcset);
                        break;

                    case "UpUp":
                        tcset              = new TCset();
                        tcset.Name         = "UpUp";
                        tcset.caculateTime = time;
                        commands.Add(tcset);
                        break;

                    case "UpDown":
                        tcset              = new TCset();
                        tcset.Name         = "UpDown";
                        tcset.caculateTime = time;
                        commands.Add(tcset);
                        break;

                    case "DownDown":
                        tcset              = new TCset();
                        tcset.Name         = "DownDown";
                        tcset.caculateTime = time;
                        commands.Add(tcset);
                        break;

                    case "DownUp":
                        tcset              = new TCset();
                        tcset.Name         = "DownUp";
                        tcset.caculateTime = time;
                        commands.Add(tcset);
                        break;

                    case "ShiftUp":
                        tcset              = new TCset();
                        tcset.Name         = "ShiftUp";
                        tcset.caculateTime = time;
                        commands.Add(tcset);
                        break;

                    case "ShiftDown":
                        tcset              = new TCset();
                        tcset.Name         = "ShiftDown";
                        tcset.caculateTime = time;
                        commands.Add(tcset);
                        break;

                    case "ZDown":
                        tcset              = new TCset();
                        tcset.Name         = "ZDown";
                        tcset.caculateTime = time;
                        commands.Add(tcset);
                        break;

                    case "ZUp":
                        tcset              = new TCset();
                        tcset.Name         = "ZUp";
                        tcset.caculateTime = time;
                        commands.Add(tcset);
                        break;
                    }
                    #endregion
                }
            }
            //非重播模式
            else
            {
                Datas.GameRandom = new GRandom();
                Datas.Commands   = new List <string>();
                Datas.Commands.Add("$Seed#" + Datas.GameRandom.Seed.ToString());
            }

            GameTime = 0;
            Stage1_SystemCommands.Clear();
            AddCommands();                //添加按键命令

            background.SpeedY = 0.01f;    //初始速度

            gameview.BeginStart();        //开始执行
            //gameview.ShowBGM("BGM:Silent Story(發熱巫女~ず)", 0.4f);      //显示BGM, 字体倍率为0.5f
            _soundmanager.SetVolumChannel("Graze", 0.2f);
        }