Exemplo n.º 1
0
Arquivo: ED.cs Projeto: THSJF/sjf
        private void SavePracticeData(PracticeData data)
        {
            FileStream fileStream = new FileStream("Content\\Data\\5.xna", FileMode.Create);

            new BinaryFormatter().Serialize((Stream)fileStream, (object)data);
            fileStream.Close();
            Cry.Encry("Content\\Data\\5.xna", 2);
        }
Exemplo n.º 2
0
        private void Save()
        {
            Program.game.PlaySound("extend");
            this.rpys[this.page * 15 + this.selection].SetName(this.nametemp);
            this.data.rpy = this.rpys[this.page * 15 + this.selection];
            string     str        = "Replay\\thmhj_" + (this.page * 15 + this.selection).ToString().PadLeft(2, '0') + ".rpy";
            FileStream fileStream = File.Open(str, FileMode.Create);

            new BinaryFormatter().Serialize((Stream)fileStream, (object)this.data);
            fileStream.Close();
            Cry.Encry(str, 3);
            this.step     = false;
            this.start    = false;
            Main.nametemp = this.nametemp;
            this.nametemp = "";
        }
Exemplo n.º 3
0
        public BGM(Texture2D t, int id)
        {
            this.tex          = new Sprite(t);
            this.tex.position = new Vector2(91f, 479f);
            this.tex.rect     = id < 15 ? new Rectangle(0, (id - 2) * 26, 326, 26) : new Rectangle(0, (id - 3) * 26, 326, 26);
            Music.BGM         = Music.SB.GetCue(id.ToString());
            StreamReader streamReader = new StreamReader(Cry.Decry("Content/Music/00.xna", 2));

            streamReader.ReadLine();
            int num = int.Parse(streamReader.ReadLine());

            streamReader.Close();
            if (num < id - 1)
            {
                StreamWriter streamWriter = new StreamWriter("Content/Music/00.xna", false);
                streamWriter.WriteLine("Fantasy Danmaku Festival");
                streamWriter.WriteLine((id - 1).ToString());
                streamWriter.Close();
                Cry.Encry("Content/Music/00.xna", 2);
            }
            Program.game.game.Drawevents += new Game.DrawDelegate(this.Draw);
            BGM.bgm = this;
        }
Exemplo n.º 4
0
Arquivo: Main.cs Projeto: THSJF/sjf
 protected override void Initialize()
 {
     try {
         Main.fpstimer = new System.Threading.Timer(new TimerCallback(this.FpsRecord), (object)null, 0, 1000);
         if (!File.Exists("Content/Music/00.xna"))
         {
             StreamWriter streamWriter = new StreamWriter("Content/Music/00.xna", false);
             streamWriter.WriteLine("Fantasy Danmaku Festival");
             streamWriter.WriteLine("0");
             streamWriter.Close();
             Cry.Encry("Content/Music/00.xna", 2);
         }
         if (!File.Exists("Content/Data/4.xna"))
         {
             PlayData   playData   = new PlayData();
             FileStream fileStream = new FileStream("Content/Data/4.xna", FileMode.Create);
             new BinaryFormatter().Serialize((Stream)fileStream, (object)playData);
             fileStream.Close();
             Cry.Encry("Content/Data/4.xna", 2);
         }
         if (!File.Exists("Content/Data/5.xna"))
         {
             PracticeData practiceData = new PracticeData();
             FileStream   fileStream   = new FileStream("Content/Data/5.xna", FileMode.Create);
             new BinaryFormatter().Serialize((Stream)fileStream, (object)practiceData);
             fileStream.Close();
             Cry.Encry("Content/Data/5.xna", 2);
         }
         if (!File.Exists("Content/Data/8.xna"))
         {
             SpecialData specialData = new SpecialData();
             FileStream  fileStream  = new FileStream("Content/Data/8.xna", FileMode.Create);
             new BinaryFormatter().Serialize((Stream)fileStream, (object)specialData);
             fileStream.Close();
             Cry.Encry("Content/Data/8.xna", 2);
         }
         if (!File.Exists("Content/Music/10.xna"))
         {
             new StreamWriter("Content/Data/10.xna", false).Close();
             Cry.Encry("Content/Data/10.xna", 2);
         }
         Main.rand    = new Random();
         Main.font    = new SpriteFontX(new Font("宋体", 12f, FontStyle.Regular, GraphicsUnit.Pixel), (IGraphicsDeviceService)this.graphics, TextRenderingHint.ClearTypeGridFit);
         Main.dfont   = new SpriteFontX(new Font("微软雅黑", 16f, FontStyle.Bold, GraphicsUnit.Pixel), (IGraphicsDeviceService)this.graphics, TextRenderingHint.AntiAlias);
         Main.scfont  = new SpriteFontX(new Font("宋体", 16f, FontStyle.Bold, GraphicsUnit.Pixel), (IGraphicsDeviceService)this.graphics, TextRenderingHint.AntiAlias);
         Main.scdfont = new SpriteFontX(new Font("宋体", 10f, FontStyle.Bold, GraphicsUnit.Pixel), (IGraphicsDeviceService)this.graphics, TextRenderingHint.SingleBitPerPixelGridFit);
         PadState.InitPad(Main.ini);
         Main.WindowSizeType = int.Parse(Main.ini.ReadValue("Graphics", "WindowSize"));
         Main.Fullorwindow   = int.Parse(Main.ini.ReadValue("Mode", "Full/Window"));
         Main.BackGround     = int.Parse(Main.ini.ReadValue("Graphics", "BackGround")) == 1;
         Main.VSync          = int.Parse(Main.ini.ReadValue("Graphics", "VSync")) == 1;
         this.graphics.SynchronizeWithVerticalRetrace = Main.VSync;
         this.IsFixedTimeStep = false;
         Main.ResizeWindow(this, Main.WindowSizeType);
         if (Main.Fullorwindow == 1)
         {
             this.graphics.ToggleFullScreen();
         }
         Sound.Init();
         Music.Init();
         Main.stage = "ENTRANCE";
         base.Initialize();
     } catch (Exception ex) {
         StreamWriter streamWriter = new StreamWriter("Error.txt");
         DateTime     now          = DateTime.Now;
         streamWriter.Write("[" + now.Hour.ToString("00") + ":" + now.Minute.ToString("00") + ":" + now.Second.ToString("00") + "]\n" + ex.ToString());
         streamWriter.Close();
         Main.Message(ex.ToString());
     }
 }
Exemplo n.º 5
0
Arquivo: ED.cs Projeto: THSJF/sjf
 public void Update()
 {
     if (!this.ifcontinued || this.edtype == 4)
     {
         if (this.time == 120)
         {
             Music.BGM = Music.SB.GetCue("14");
             Music.BGM.Play();
             StreamReader streamReader = new StreamReader(Cry.Decry("Content/Music/00.xna", 2));
             streamReader.ReadLine();
             int num = int.Parse(streamReader.ReadLine());
             streamReader.Close();
             if (num < 13)
             {
                 StreamWriter streamWriter = new StreamWriter("Content/Music/00.xna", false);
                 streamWriter.WriteLine("Fantasy Danmaku Festival");
                 streamWriter.WriteLine(13.ToString());
                 streamWriter.Close();
                 Cry.Encry("Content/Music/00.xna", 2);
             }
             this.praticle1.Start();
         }
         else if (this.time > 180 && this.time <= 380)
         {
             this.textcolor[0] += 0.005f;
         }
         else if (this.time > 600 && this.time <= 800)
         {
             this.textcolor[1] += 0.005f;
         }
         else if (this.time > 1020 && this.time <= 1220)
         {
             this.textcolor[2] += 0.005f;
         }
         else if (this.time > 1440 && this.time <= 1640)
         {
             this.textcolor[3] += 0.005f;
         }
         else if (this.time > 1740 && this.time <= 1800)
         {
             this.whitecolor += 0.01666667f;
         }
         else if (this.time > 1820 && this.time <= 1840)
         {
             this.background[0].color.a += 0.05f;
             this.background[0].scale   += new Vector2((float)((0.800000011920929 - (double)this.background[0].scale.X) / 15.0), (float)((0.800000011920929 - (double)this.background[0].scale.Y) / 15.0));
             this.logo.color.a          += 0.05f;
             this.logo.scale            += new Vector2((float)((0.699999988079071 - (double)this.logo.scale.X) / 20.0), (float)((0.699999988079071 - (double)this.logo.scale.Y) / 20.0));
         }
         else if (this.time > 1840 && this.time <= 2200)
         {
             this.background[0].scale -= new Vector2(0.00065f, 0.00065f);
             this.logo.scale          -= new Vector2(0.0003f, 0.0003f);
             if (this.time > 2020 && this.time <= 2040)
             {
                 this.end.color.a += 0.05f;
             }
             if (this.time == 2200)
             {
                 this.praticle1.Stop();
             }
         }
         else if (this.time > 2200 && this.time <= 2250)
         {
             this.background[0].position.X += (float)((0.0 - (double)this.background[0].position.X) / 40.0);
             this.logo.color.a             -= 0.05f;
             if ((double)this.logo.color.a <= 0.0)
             {
                 this.logo.color.a = 0.0f;
             }
             this.end.color.a      -= 0.02f;
             this.black.position.X += (float)((182.0 - (double)this.black.position.X) / 15.0);
             this.black.color.a     = 1f;
         }
         else if (this.time > 2260 && this.time <= 2670)
         {
             if (this.time == 2300)
             {
                 this.praticle1 = (SimplePraticleActor)null;
             }
             this.background[0].position.X += 0.1f;
             this.staff[0].color.a         += 0.01f;
             if ((double)this.staff[0].color.a >= 1.0)
             {
                 this.staff[0].color.a = 1f;
             }
         }
         else if (this.time > 2670 && this.time <= 3080)
         {
             this.background[0].position.X += 0.1f;
             this.background[1].position    = this.background[0].position;
             this.background[1].scale       = this.background[0].scale;
             this.background[1].color.a    += 0.005f;
             if ((double)this.background[1].color.a >= 1.0)
             {
                 this.background[1].color.a = 1f;
             }
             this.staff[0].color.a -= 0.02f;
             if ((double)this.staff[0].color.a <= 0.0)
             {
                 this.staff[0].color.a = 0.0f;
             }
             this.staff[1].color.a += 0.01f;
             if ((double)this.staff[1].color.a >= 1.0)
             {
                 this.staff[1].color.a = 1f;
             }
         }
         else if (this.time > 3080 && this.time <= 3490)
         {
             this.background[0].position.X += 0.1f;
             this.background[1].position    = this.background[0].position;
             this.staff[1].color.a         -= 0.02f;
             if ((double)this.staff[1].color.a <= 0.0)
             {
                 this.staff[1].color.a = 0.0f;
             }
             this.staff[2].color.a += 0.01f;
             if ((double)this.staff[2].color.a >= 1.0)
             {
                 this.staff[2].color.a = 1f;
             }
         }
         else if (this.time > 3490 && this.time <= 3900)
         {
             this.background[0].position.X += 0.1f;
             this.background[1].position    = this.background[0].position;
             this.background[2].position    = this.background[0].position;
             this.background[2].scale       = this.background[0].scale;
             this.background[2].color.a    += 0.005f;
             if ((double)this.background[2].color.a >= 1.0)
             {
                 this.background[2].color.a = 1f;
             }
             this.staff[2].color.a -= 0.02f;
             if ((double)this.staff[2].color.a <= 0.0)
             {
                 this.staff[2].color.a = 0.0f;
             }
             this.staff[3].color.a += 0.01f;
             if ((double)this.staff[3].color.a >= 1.0)
             {
                 this.staff[3].color.a = 1f;
             }
         }
         else if (this.time > 3900 && this.time <= 4310)
         {
             this.background[0].position.X += 0.1f;
             this.background[2].position    = this.background[0].position;
             this.staff[3].color.a         -= 0.02f;
             if ((double)this.staff[3].color.a <= 0.0)
             {
                 this.staff[3].color.a = 0.0f;
             }
             this.staff[4].color.a += 0.01f;
             if ((double)this.staff[4].color.a >= 1.0)
             {
                 this.staff[4].color.a = 1f;
             }
         }
         else if (this.time > 4310 && this.time <= 4750)
         {
             this.background[0].position.X += 0.1f;
             this.background[2].position    = this.background[0].position;
             this.background[3].position    = this.background[0].position;
             this.background[3].scale       = this.background[0].scale;
             this.background[3].color.a    += 0.005f;
             if ((double)this.background[3].color.a >= 1.0)
             {
                 this.background[3].color.a = 1f;
             }
             this.staff[4].color.a -= 0.02f;
             if ((double)this.staff[4].color.a <= 0.0)
             {
                 this.staff[4].color.a = 0.0f;
             }
             this.staff[5].color.a += 0.01f;
             if ((double)this.staff[5].color.a >= 1.0)
             {
                 this.staff[5].color.a = 1f;
             }
         }
         else if (this.time > 4750 && this.time <= 4800)
         {
             this.staff[5].color.a -= 0.05f;
             if ((double)this.staff[5].color.a <= 0.0)
             {
                 this.staff[5].color.a = 0.0f;
             }
             for (int index = 0; index < 4; ++index)
             {
                 this.background[index].color.a -= 0.02f;
             }
             this.black.position.X += (float)((-200.0 - (double)this.black.position.X) / 15.0);
         }
         else if (this.time > 4800 && this.time <= 5220)
         {
             this.background2[0].color.a += 0.02f;
             if ((double)this.background2[0].color.a >= 1.0)
             {
                 this.background2[0].color.a = 1f;
             }
             this.background2[0].position.X += 0.1f;
             this.background2[0].position.Y  = 230f;
             this.background2[0].scale       = new Vector2(0.8f, 0.8f);
             this.staff2[0].color.a         += 0.01f;
             if ((double)this.staff2[0].color.a >= 1.0)
             {
                 this.staff2[0].color.a = 1f;
             }
         }
         else if (this.time > 5220 && this.time <= 5640)
         {
             this.background2[0].position.X += 0.1f;
             this.staff2[0].color.a         -= 0.02f;
             if ((double)this.staff2[0].color.a <= 0.0)
             {
                 this.staff2[0].color.a = 0.0f;
             }
             this.staff2[1].color.a += 0.01f;
             if ((double)this.staff2[1].color.a >= 1.0)
             {
                 this.staff2[1].color.a = 1f;
             }
         }
         else if (this.time > 5640 && this.time <= 6060)
         {
             this.background2[0].position.X += 0.1f;
             this.staff2[1].color.a         -= 0.02f;
             if ((double)this.staff2[1].color.a <= 0.0)
             {
                 this.staff2[1].color.a = 0.0f;
             }
             this.staff2[2].color.a += 0.01f;
             if ((double)this.staff2[2].color.a >= 1.0)
             {
                 this.staff2[2].color.a = 1f;
             }
         }
         else if (this.time > 6060 && this.time <= 6480)
         {
             this.background2[0].position.X += 0.1f;
             this.staff2[2].color.a         -= 0.02f;
             if ((double)this.staff2[2].color.a <= 0.0)
             {
                 this.staff2[2].color.a = 0.0f;
             }
             this.staff2[3].color.a += 0.01f;
             if ((double)this.staff2[3].color.a >= 1.0)
             {
                 this.staff2[3].color.a = 1f;
             }
         }
         if (this.time > 6450 && this.time <= 6500)
         {
             this.whitecolor2 += 0.02f;
         }
         else if (this.time == 6501)
         {
             for (int index = 0; index < 4; ++index)
             {
                 this.textcolor[index] = 0.0f;
             }
             this.background2[0].color.a = 0.0f;
             this.staff2[3].color.a      = 0.0f;
             this.black.color.a          = 0.0f;
             this.whitecolor2            = 0.0f;
             this.background2[1].scale   = new Vector2(1.3f, 1.3f);
         }
         else if (this.time > 6500 && this.time <= 6520)
         {
             this.background2[1].scale   += new Vector2((float)((0.699999988079071 - (double)this.background2[1].scale.X) / 15.0), (float)((0.699999988079071 - (double)this.background2[1].scale.Y) / 15.0));
             this.background2[1].color.a += 0.05f;
         }
         else if (this.time > 6520 && this.time <= 6920)
         {
             this.background2[1].scale -= new Vector2(0.0006f, 0.0006f);
             if (this.time > 6720)
             {
                 this.thanks.color.a += 0.05f;
                 if ((double)this.thanks.color.a >= 1.0)
                 {
                     this.thanks.color.a = 1f;
                 }
             }
         }
         else if (this.time > 6920 && this.time <= 6970)
         {
             this.background2[1].scale -= new Vector2(0.0006f, 0.0006f);
             this.whitecolor           -= 0.05f;
             if ((double)this.whitecolor <= 0.0)
             {
                 this.whitecolor = 0.0f;
             }
             this.background2[1].color.a -= 0.05f;
             if ((double)this.background2[1].color.a <= 0.0)
             {
                 this.background2[1].color.a = 0.0f;
             }
             this.thanks.color.a -= 0.1f;
             if ((double)this.thanks.color.a <= 0.0)
             {
                 this.thanks.color.a = 0.0f;
             }
             this.next.color.a += 0.02f;
         }
         else if (this.time >= 7120 && this.time <= 7140)
         {
             this.next.color.a -= 0.05f;
         }
         else if (this.time == 7141 && this.edtype != 4)
         {
             if (this.edtype == 1)
             {
                 ++this.record.Playdata.players[(int)(Main.Character - 1)].cleartime;
                 PracticeData data = this.LoadPracticeData();
                 data.clear[(int)(Main.Character - 1)] = true;
                 this.SavePracticeData(data);
                 Program.game.achivmanager.Check(AchievementType.Normal, 3, new Hashtable()
                 {
                     [(object)"practice"] = (object)data
                 });
                 Program.game.achivmanager.Check(AchievementType.Normal, 4, new Hashtable()
                 {
                     [(object)"playdata"] = (object)this.record.Playdata
                 });
                 Program.game.achivmanager.Check(AchievementType.Normal, 5, new Hashtable()
                 {
                     [(object)"practice"] = (object)data
                 });
             }
         }
         else if (this.time > 7141 && this.edtype != 4 && !this.record.Ok)
         {
             this.record.Update();
             if (this.record.Ok)
             {
                 this.SavePlayData(this.record.Playdata);
             }
         }
         else if (this.time > 7141 && this.edtype != 4 && !this.replay.Ok)
         {
             this.replay.Update();
         }
         else if (this.time > 7141)
         {
             BGM.Disposes();
             Program.game.StopSound("Result bank");
             Main.stage    = "ENTRANCE";
             this.Finished = true;
         }
         if (this.edtype == 4 && (Main.keyboardstat.IsKeyDown(Keys.Escape) & Main.keyboardstat != Main.prekeyboard || PadState.IsKeyPressed(JOYKEYS.Special, Main.prepadstat) || PadState.IsKeyPressed(JOYKEYS.Pause, Main.prepadstat)))
         {
             BGM.Disposes();
             Program.game.StopSound("Result bank");
             Main.stage    = "ENTRANCE";
             this.Finished = true;
         }
         if (this.praticle1 != null)
         {
             this.praticle1.Update();
         }
     }
     else
     {
         this.ContinueUpdate();
     }
     ++this.time;
 }