public override string SetDescroption(string fileName) { if (!File.Exists(fileName)) { return("------- -------- ----- ------- ------- --- ----"); } try { ReplayInfo replayInfo = Replay.ReadTitle(fileName); if (replayInfo.Version != "ver 1.00") { return("------- -------- ----- ------- ------- --- ----"); } string str = (string)null; if (replayInfo != null) { str = str + (replayInfo.PlayerName == null ? " " : replayInfo.PlayerName.PadRight(8)) + (replayInfo.Date == null ? " " : replayInfo.Date.PadRight(9)) + (replayInfo.Time == null ? " " : replayInfo.Time.PadRight(6)) + (replayInfo.MyPlaneName == null ? " " : replayInfo.MyPlaneName.PadRight(8)) + replayInfo.Rank.ToString().PadRight(8) + (replayInfo.LastStage == null ? " " : replayInfo.LastStage.PadRight(4)) + (replayInfo.SlowRate == null ? " " : replayInfo.SlowRate.PadRight(4)); } return(str); } catch { return("------- -------- ----- ------- ------- --- ----"); } }
public virtual void ProcessKeys2() { if (KClass.Key_Z && LastZ == 0) { MenuItemList[MenuSelectIndex].Click(); OnChangeMenu = TimeMain + 1; } if (!KClass.Key_X && !KClass.Key_ESC || LastX != 0) { return; } StageData.SoundPlay("se_cancel00.wav"); if (StageData.Rep.CanRead) { ReplayInfo repInfo = StageData.GlobalData.LastState.StageData.RepInfo; repInfo.PlayerName = "autosave"; StageData.Rep.SaveRpy(".\\Replay\\AutoSave.rpy", repInfo); } StageData.StateSwitchData = new StateSwitchDataPackage() { NextState = "MainMenu", NeedInit = true, SDPswitch = new StageDataPackage(StageData.GlobalData) }; StageData.Rep.CloseRpy(); }
public static ReplayInfo ReadTitle(string fileName) { string[] strArray1 = File.ReadAllLines(fileName, Encoding.Default); try { int num = 0; do { }while(strArray1[++num] != "ReplayInformation" && num < strArray1.Length - 1); ReplayInfo replayInfo = new ReplayInfo() { Version = strArray1[num + 1], PlayerName = strArray1[num + 2], Date = strArray1[num + 3], Time = strArray1[num + 4], MyPlaneName = strArray1[num + 5], WeaponType = strArray1[num + 6], Rank = (DifficultLevel)Convert.ToInt32(strArray1[num + 7]), StartStage = strArray1[num + 8], LastStage = strArray1[num + 9], SlowRate = strArray1[num + 10] }; for (int index = num + 11; index < strArray1.Length; ++index) { char[] chArray = new char[1] { '\t' }; string[] strArray2 = strArray1[index].Split(chArray); MyPlaneInfo myPlaneInfo = new MyPlaneInfo() { Life = Convert.ToInt32(strArray2[0]), Spell = Convert.ToInt32(strArray2[1]), Power = Convert.ToInt32(strArray2[2]), Score = Convert.ToInt64(strArray2[3]), Graze = Convert.ToInt32(strArray2[4]), PosX = (float)Convert.ToDouble(strArray2[5]), PosY = (float)Convert.ToDouble(strArray2[6]), LifeChip = Convert.ToInt32(strArray2[7]), SpellChip = Convert.ToInt32(strArray2[8]), LifeUpCount = Convert.ToInt32(strArray2[9]), StarPoint = Convert.ToInt32(strArray2[10]), HighItemScore = Convert.ToInt32(strArray2[11]), Rate = (float)Convert.ToDouble(strArray2[12]), LastColor = (EnchantmentType)Convert.ToInt32(strArray2[13]), DataPosition = Convert.ToInt64(strArray2[14]) }; replayInfo.MyPlaneData.Add(myPlaneInfo); } return(replayInfo); } catch { return(new ReplayInfo()); } }
public virtual string SetDescroption(string fileName) { string str1 = "------- -------- ------ -- --- "; if (!File.Exists(fileName)) { return(str1); } try { ReplayInfo replayInfo = Replay.ReadTitle(fileName); if (replayInfo.Version != "ver 1.00") { return(str1); } string str2 = (string)null; if (replayInfo != null) { string str3 = str2 + (replayInfo.PlayerName == null ? " " : replayInfo.PlayerName.PadRight(8)) + (replayInfo.Date == null ? " " : replayInfo.Date.PadRight(9)) + (replayInfo.MyPlaneName == null ? " " : replayInfo.MyPlaneName.PadRight(7)); switch (replayInfo.Rank) { case DifficultLevel.Easy: str3 += "E "; break; case DifficultLevel.Normal: str3 += "N "; break; case DifficultLevel.Hard: str3 += "H "; break; case DifficultLevel.Lunatic: str3 += "L "; break; case DifficultLevel.Ultra: str3 += "U "; break; case DifficultLevel.Extra: str3 += "EX "; break; } str2 = str3 + (replayInfo.LastStage == null ? " " : replayInfo.LastStage.PadRight(4)); } return(str2); } catch { return(str1); } }
public void SaveRpy(string fileName, ReplayInfo repInfo) { if (this.ReplayData.CanRead) { this.ReplayData.WriteByte((byte)240); this.ReplayData.WriteByte((byte)15); string tmp = (string)null; tmp += "\r\n"; tmp += "ReplayInformation"; tmp += "\r\n"; tmp += "ver 1.00"; tmp += "\r\n"; tmp += repInfo.PlayerName; tmp += "\r\n"; string str1 = tmp; DateTime dateTime = DateTime.Now; dateTime = dateTime.Date; string str2 = dateTime.ToString("yy'/'MM'/'dd"); tmp = str1 + str2; tmp += "\r\n"; string str3 = tmp; dateTime = DateTime.Now; string shortTimeString = dateTime.ToShortTimeString(); tmp = str3 + shortTimeString; tmp += "\r\n"; tmp += repInfo.MyPlaneName; tmp += "\r\n"; tmp += repInfo.WeaponType.ToString(); tmp += "\r\n"; tmp += ((int)repInfo.Rank).ToString(); tmp += "\r\n"; tmp += repInfo.StartStage; tmp += "\r\n"; tmp += repInfo.LastStage; tmp += "\r\n"; tmp += repInfo.SlowRate; repInfo.MyPlaneData.ForEach((Action <MyPlaneInfo>)(x => { tmp += "\r\n"; tmp = tmp + x.Life.ToString() + (object)'\t' + x.Spell.ToString() + (object)'\t' + x.Power.ToString() + (object)'\t' + x.Score.ToString() + (object)'\t' + x.Graze.ToString() + (object)'\t' + x.PosX.ToString() + (object)'\t' + x.PosY.ToString() + (object)'\t' + x.LifeChip.ToString() + (object)'\t' + x.SpellChip.ToString() + (object)'\t' + x.LifeUpCount.ToString() + (object)'\t' + x.StarPoint.ToString() + (object)'\t' + x.HighItemScore.ToString() + (object)'\t' + x.Rate.ToString() + (object)'\t' + ((int)x.LastColor).ToString() + (object)'\t' + x.DataPosition.ToString(); })); StreamWriter streamWriter = new StreamWriter((Stream)this.ReplayData); streamWriter.Write(tmp); streamWriter.Close(); this.ReplayData.Close(); } if (!(fileName != ".\\Replay\\AutoSave.rpy")) { return; } File.Copy(".\\Replay\\AutoSave.rpy", fileName, true); }
public override void ProcessZ() { if (this.MenuSelectIndex == this.MenuItemList.Count - 1) { ReplayInfo repInfo = this.StageData.GlobalData.LastState.StageData.RepInfo; repInfo.PlayerName = (string)null; for (int index = 0; index < 7; ++index) { repInfo.PlayerName += this.PlayerName[index]; } this.StageData.Rep.SaveRpy(".\\Replay\\thSSS_" + this.RepMenuItem.Name + ".rpy", repInfo); this.RepMenuItem.Description = ((DescriptionMenuItem)this.MenuTilte).Description; this.OnRemoveMenu = this.TimeMain + 20; this.TransparentVelocity = -15f; foreach (BaseMenuItem menuItem in this.MenuItemList) { BaseMenuItem baseMenuItem = menuItem; PointF originalPosition = this.MenuItemList[0].OriginalPosition; double x = (double)originalPosition.X; originalPosition = this.MenuItemList[0].OriginalPosition; double y = (double)originalPosition.Y; PointF pointF = new PointF((float)x, (float)y); baseMenuItem.DestPoint = pointF; menuItem.OnRemove = true; } this.StageData.SoundPlay("se_extend.wav"); } else if (this.MenuSelectIndex == this.MenuItemList.Count - 2) { if (this.NameIndex > 0) { --this.NameIndex; this.PlayerName[this.NameIndex] = (string)null; } this.StageData.SoundPlay("se_cancel00.wav"); } else { this.PlayerName[this.NameIndex] = this.MenuItemList[this.MenuSelectIndex].Name; this.StageData.SoundPlay("se_ok00.wav"); if (this.NameIndex < 7) { ++this.NameIndex; } } this.ShowPlayerName(); }
public void Init() { this.BoundRect = new Rectangle(0, 0, 640, 480); this.BulletList = new List <BaseBullet_Touhou>(); this.EnemyPlaneList = new List <BaseEnemyPlane>(); this.MyBulletList = new List <BaseObject>(); this.SpellList = new List <BaseObject>(); this.EffectList = new List <BaseEffect>(); this.ItemList = new List <BaseItem>(); this.InterfaceList = new List <BaseObject>(); this.SoundPlayList = new List <XAudio2_Player>(); this.Background = new BackgroundManager(); this.Background2 = new BackgroundManager(); this.Background3D = new BackgroundManager3D(this); this.Particle3D = new ParticleManager3D(this); this.MenuGroupList = new List <BaseMenuGroup>(); this.TimeMain = 0; this.RepInfo = new ReplayInfo(); }
public MenuGroup_ReplayStageSelect(StageDataPackage StageData, PointF OriginalPosition, DescriptionMenuItem RepMenuItem) : base(StageData) { RepIndex = RepMenuItem.Name; MenuSelectIndex = 0; MenuItemList = new List <BaseMenuItem>(); for (int index = 0; index < 6; ++index) { MenuItemList.Add(new DescriptionMenuItem(StageData, string.Format("Stage{0:00}", (object)(index + 1))) { Description = "----------" }); } MenuItemList.Add(new DescriptionMenuItem(StageData, "StageEx") { Description = "----------" }); float x = OriginalPosition.X + 12f; float y = OriginalPosition.Y + 12f; foreach (BaseMenuItem menuItem in MenuItemList) { menuItem.Position = new PointF(x, OriginalPosition.Y + 10f); menuItem.DestPoint = new PointF(x, y); y += 17f; } string str = ".\\Replay\\thSSS_" + RepIndex + ".rpy"; if (File.Exists(str)) { ReplayInfo replayInfo = Replay.ReadTitle(str); if (replayInfo.StartStage == "StEx") { ((DescriptionMenuItem)MenuItemList[6]).Description = replayInfo.MyPlaneData[1].Score.ToString().PadLeft(10); } else { int num = !replayInfo.StartStage.Contains("St") ? Convert.ToInt32(replayInfo.StartStage.Replace("Bs", "")) : Convert.ToInt32(replayInfo.StartStage.Replace("St", "")); for (int index = 0; index < replayInfo.MyPlaneData.Count - 1; ++index) { if (num - 1 + index < 6) { ((DescriptionMenuItem)MenuItemList[num - 1 + index]).Description = replayInfo.MyPlaneData[index + 1].Score.ToString().PadLeft(10); } } } } MenuItemList[MenuSelectIndex].Selected = true; DescriptionMenuItem descriptionMenuItem = new DescriptionMenuItem(StageData, RepIndex) { Description = RepMenuItem.Description, OriginalPosition = RepMenuItem.OriginalPosition, Selected = true }; MenuTilte = descriptionMenuItem; MenuTitlePos1 = new PointF(RepMenuItem.OriginalPosition.X, 16f); MenuTitlePos2 = RepMenuItem.OriginalPosition; TxtureObject = TextureObjectDictionary["MenuBackground"]; OriginalPosition = new PointF((BoundRect.Width / 2), (BoundRect.Height / 2)); AngleDegree = 90.0; ColorValue = Color.SkyBlue; }
public override void ProcessZ() { if (!(((DescriptionMenuItem)MenuItemList[MenuSelectIndex]).Description != "----------")) { return; } StageData.SoundPlay("se_ok00.wav"); string fileName = ".\\Replay\\thSSS_" + RepIndex + ".rpy"; StageData.Rep.LoadRpy(fileName); ReplayInfo replayInfo = Replay.ReadTitle(fileName); StageData.RepInfo = replayInfo; int num; string str; if (MenuSelectIndex < 6) { if (replayInfo.StartStage.Contains("St")) { num = MenuSelectIndex + 1; str = "St" + num.ToString(); } else { num = MenuSelectIndex + 1; str = "Bs" + num.ToString(); } } else { str = "StEx"; } StageData.StateSwitchData = new StateSwitchDataPackage() { NextState = str, NeedInit = true, SDPswitch = new StageDataPackage(StageData.GlobalData) { OnReplay = true, Difficulty = replayInfo.Rank } }; int index = !(str == "StEx") ? (!replayInfo.StartStage.Contains("St") ? MenuSelectIndex - Convert.ToInt32(replayInfo.StartStage.Replace("Bs", "")) + 1 : MenuSelectIndex - Convert.ToInt32(replayInfo.StartStage.Replace("St", "")) + 1) : 0; Point point = new Point(192, 398); if (index >= 0) { point = new Point((int)replayInfo.MyPlaneData[index].PosX, (int)replayInfo.MyPlaneData[index].PosY); } BaseMyPlane baseMyPlane; switch (replayInfo.MyPlaneName) { case "Reimu": baseMyPlane = new MyPlane_Reimu(StageData.StateSwitchData.SDPswitch, point); break; case "Sanae": baseMyPlane = new MyPlane_Sanae(StageData.StateSwitchData.SDPswitch, point); break; case "Marisa": baseMyPlane = new MyPlane_Marisa(StageData.StateSwitchData.SDPswitch, point); break; case "Koishi": baseMyPlane = new MyPlane_Koishi(StageData.StateSwitchData.SDPswitch, point); break; default: baseMyPlane = new BaseMyPlane(StageData.StateSwitchData.SDPswitch, point); break; } if (index >= 0) { baseMyPlane.Life = replayInfo.MyPlaneData[index].Life; baseMyPlane.Spell = replayInfo.MyPlaneData[index].Spell; baseMyPlane.Power = replayInfo.MyPlaneData[index].Power; baseMyPlane.Score = replayInfo.MyPlaneData[index].Score; baseMyPlane.OriginalPosition = new PointF(replayInfo.MyPlaneData[index].PosX, replayInfo.MyPlaneData[index].PosY); baseMyPlane.Graze = replayInfo.MyPlaneData[index].Graze; baseMyPlane.LifeUpCount = replayInfo.MyPlaneData[index].LifeUpCount; baseMyPlane.LifeChip = replayInfo.MyPlaneData[index].LifeChip; baseMyPlane.SpellChip = replayInfo.MyPlaneData[index].SpellChip; baseMyPlane.StarPoint = replayInfo.MyPlaneData[index].StarPoint; baseMyPlane.HighItemScore = replayInfo.MyPlaneData[index].HighItemScore; baseMyPlane.Rate = replayInfo.MyPlaneData[index].Rate; baseMyPlane.LastColor = replayInfo.MyPlaneData[index].LastColor; StageData.Rep.DataPosition = replayInfo.MyPlaneData[index].DataPosition; } StageData.StateSwitchData.SDPswitch.MyPlane = baseMyPlane; StageData.StateSwitchData.SDPswitch.RepInfo = replayInfo; }
public override void ProcessZ() { switch (this.MenuItemList[this.MenuSelectIndex].Name) { case "Menu_继续游戏": this.StageData.StateSwitchData = new StateSwitchDataPackage() { NextState = this.StageData.GlobalData.LastState.StageName, NeedInit = false }; ((BaseGameState)this.StageData.GlobalData.LastState).TimeSycn(); break; case "Menu_再试一次": if (this.StageData.GlobalData.LastState == null) { break; } ++this.StageData.GlobalData.LastState.StageData.ContinueTimes; this.StageData.GlobalData.LastState.StageData.MyPlane.RetryClear(); this.StageData.StateSwitchData = new StateSwitchDataPackage() { NextState = this.StageData.GlobalData.LastState.StageName, NeedInit = false }; this.StageData.Rep.Dispose(); this.StageData.Rep.CreatRpy(); break; case "Menu_保存录像": this.StageData.MenuGroupList.Add((BaseMenuGroup) new MenuGroup_ReplaySaver(this.StageData, new PointF(36f, 16f))); break; case "Menu_从头开始": if (this.StageData.GlobalData.LastState == null) { break; } bool onReplay = this.StageData.GlobalData.LastState.StageData.OnReplay; bool onPractice = this.StageData.GlobalData.LastState.StageData.OnPractice; ReplayInfo repInfo = this.StageData.GlobalData.LastState.StageData.RepInfo; this.StageData.StateSwitchData = new StateSwitchDataPackage() { NextState = this.StageData.GlobalData.LastState.StageData.RepInfo.StartStage, NeedInit = true, SDPswitch = new StageDataPackage(this.StageData.GlobalData) { Difficulty = repInfo.Rank, OnReplay = onReplay } }; int index = 0; Point point = new Point(192, 398); if (index >= 0) { point = new Point((int)repInfo.MyPlaneData[index].PosX, (int)repInfo.MyPlaneData[index].PosY); } BaseMyPlane baseMyPlane; switch (repInfo.MyPlaneName) { case "Aya": switch (repInfo.WeaponType) { case "A": baseMyPlane = (BaseMyPlane) new MyPlane_Aya(this.StageData.StateSwitchData.SDPswitch, point); break; case "B": baseMyPlane = (BaseMyPlane) new MyPlane_AyaB(this.StageData.StateSwitchData.SDPswitch, point); break; default: baseMyPlane = (BaseMyPlane) new MyPlane_Aya(this.StageData.StateSwitchData.SDPswitch, point); break; } break; case "Plane": switch (repInfo.WeaponType) { case "A": baseMyPlane = (BaseMyPlane) new AutoPlane(this.StageData.StateSwitchData.SDPswitch, point); break; case "B": baseMyPlane = (BaseMyPlane) new MyPlane_PlaneB(this.StageData.StateSwitchData.SDPswitch, point); break; default: baseMyPlane = new BaseMyPlane(this.StageData.StateSwitchData.SDPswitch, point); break; } break; case "Reimu": baseMyPlane = (BaseMyPlane) new MyPlane_Reimu(this.StageData.StateSwitchData.SDPswitch, point); break; case "Sanae": baseMyPlane = (BaseMyPlane) new MyPlane_Sanae(this.StageData.StateSwitchData.SDPswitch, point); break; case "Marisa": baseMyPlane = (BaseMyPlane) new MyPlane_Marisa(this.StageData.StateSwitchData.SDPswitch, point); break; case "Koishi": baseMyPlane = (BaseMyPlane) new MyPlane_Koishi(this.StageData.StateSwitchData.SDPswitch, point); break; default: baseMyPlane = (BaseMyPlane) new MyPlane_Aya(this.StageData.StateSwitchData.SDPswitch, point); break; } if (index >= 0) { // baseMyPlane.LifeUpCount=SourseForm.lifeUpCount; // baseMyPlane.Life=SourseForm.life; // baseMyPlane.LifeChip=SourseForm.lifeChip; // baseMyPlane.Spell=SourseForm.spell; // baseMyPlane.SpellChip=SourseForm.spellChip; // baseMyPlane.Power=SourseForm.power; // baseMyPlane.HighItemScore=SourseForm.highItemScore; // baseMyPlane.StarPoint=SourseForm.starPoint; // baseMyPlane.LastColor=SourseForm.starColor; // baseMyPlane.Score=SourseForm.score; baseMyPlane.Life = repInfo.MyPlaneData[index].Life; baseMyPlane.Spell = repInfo.MyPlaneData[index].Spell; baseMyPlane.Power = repInfo.MyPlaneData[index].Power; baseMyPlane.Score = repInfo.MyPlaneData[index].Score; baseMyPlane.OriginalPosition = new PointF(repInfo.MyPlaneData[index].PosX, repInfo.MyPlaneData[index].PosY); this.StageData.Rep.DataPosition = repInfo.MyPlaneData[index].DataPosition; } this.StageData.StateSwitchData.SDPswitch.MyPlane = baseMyPlane; this.StageData.StateSwitchData.SDPswitch.OnPractice = onPractice; if (!onReplay) { this.StageData.Rep.Dispose(); this.StageData.Rep.CreatRpy(); } else { this.StageData.Rep.DataPosition = 0L; } if (!onReplay) { this.StageData.StateSwitchData.SDPswitch.SetReplayInfo(this.StageData.StateSwitchData.NextState); } else { this.StageData.StateSwitchData.SDPswitch.RepInfo = repInfo; } break; case "Menu_返回主菜单": this.StageData.StateSwitchData = new StateSwitchDataPackage() { NextState = "MainMenu", NeedInit = true, SDPswitch = new StageDataPackage(this.StageData.GlobalData) }; this.StageData.Rep.CloseRpy(); break; } }
public MenuGroup_ReplayNamer( StageDataPackage StageData, PointF OriginalPosition, DescriptionMenuItem RepMenuItem) : base(StageData) { this.RepMenuItem = RepMenuItem; this.MenuItemList = new List <BaseMenuItem>(); StageDataPackage stageData = StageData.GlobalData.LastState.StageData; string[,] strArray = new string[7, 13] { { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M" }, { "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" }, { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m" }, { "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" }, { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "-", "=" }, { ".", ",", "!", "?", "@", ":", ";", "[", "]", "(", ")", "_", "/" }, { "{", "}", "|", "~", "^", "#", "$", "%", "&", "*", " ", "BS", "OK" } }; for (int index1 = 0; index1 < 7; ++index1) { for (int index2 = 0; index2 < 13; ++index2) { BaseMenuItem baseMenuItem = (BaseMenuItem) new DescriptionMenuItem(StageData, strArray[index1, index2]); baseMenuItem.OriginalPosition = new PointF((float)(stageData.BoundRect.Left + stageData.BoundRect.Width / 2 - 138), 300f); baseMenuItem.DestPoint = new PointF((float)(stageData.BoundRect.Left + stageData.BoundRect.Width / 2 - 138 + index2 * 22), (float)(270 + index1 * 22)); this.MenuItemList.Add(baseMenuItem); } } this.MenuSelectIndex = this.MenuItemList.Count - 1; ReplayInfo repInfo = StageData.GlobalData.LastState.StageData.RepInfo; this.RepDescription += DateTime.Now.Date.ToString("yy'/'MM'/'dd").PadRight(9); this.RepDescription += repInfo.MyPlaneName.PadRight(7); switch (repInfo.Rank) { case DifficultLevel.Easy: this.RepDescription += "E "; break; case DifficultLevel.Normal: this.RepDescription += "N "; break; case DifficultLevel.Hard: this.RepDescription += "H "; break; case DifficultLevel.Lunatic: this.RepDescription += "L "; break; case DifficultLevel.Ultra: this.RepDescription += "U "; break; case DifficultLevel.Extra: this.RepDescription += "EX "; break; } this.RepDescription += repInfo.LastStage == null ? " " : repInfo.LastStage.PadRight(4); this.MenuItemList[this.MenuSelectIndex].Selected = true; DescriptionMenuItem descriptionMenuItem = new DescriptionMenuItem(StageData, RepMenuItem.Name); descriptionMenuItem.Description = " " + this.RepDescription; descriptionMenuItem.OriginalPosition = RepMenuItem.OriginalPosition; descriptionMenuItem.Selected = true; this.MenuTilte = (BaseMenuItem)descriptionMenuItem; this.MenuTitlePos1 = new PointF(OriginalPosition.X, OriginalPosition.Y); this.MenuTitlePos2 = RepMenuItem.OriginalPosition; for (char[] charArray = stageData.PData.PlayerName.ToCharArray(); this.NameIndex < charArray.Length; ++this.NameIndex) { this.PlayerName[this.NameIndex] = charArray[this.NameIndex].ToString(); } this.ShowPlayerName(); }