public string IniReadValue(string Section, string Key) { StringBuilder retVal = new StringBuilder(500); INI_RW.GetPrivateProfileString(Section, Key, "", retVal, 500, this.inipath); return(retVal.ToString()); }
private void Form_Main_FormClosing(object sender, FormClosingEventArgs e) { if (this.LoadingThread != null && this.LoadingThread.IsAlive) { this.LoadingThread.Abort(); } this.GlobalData.PData.SaveData(); this.GlobalData.Dispose(); if (!this.useDirectInput) { this.GlobalData.DeviceMain.Dispose(); } if (this.GameStatesDictionary != null) { foreach (IGameState gameState in this.GameStatesDictionary.Values) { gameState.Dispose(); } } try { INI_RW iniRw = new INI_RW(".\\Setting.INI"); if (iniRw.ExistINIFile()) { iniRw.IniWriteValue("Volume", "BGMVolume", this.GlobalData.BGMVolume.ToString()); iniRw.IniWriteValue("Volume", "SEVolume", this.GlobalData.SEVolume.ToString()); } } catch { } }
public override void Shoot() { if (this.Time == 1) { this.StageData.SoundPlay("se_enep01.wav"); for (int index = 0; index < 16; ++index) { ParticleSmaller particleSmaller = new ParticleSmaller(this.StageData, "光点", this.Position, (float)(2.0 + (double)this.Ran.Next(30) / 10.0), (double)this.Ran.Next(360) / 180.0 * Math.PI); particleSmaller.Scale = (float)this.Ran.Next(10, 20) / 10f; particleSmaller.ColorValue = Color.FromArgb((int)byte.MaxValue, this.Ran.Next(20, 240), this.Ran.Next(200, (int)byte.MaxValue)); } this.StageData.VibrateStart(50); } else if (this.Time == 100) { this.StageData.SoundPlay("se_enep01.wav"); for (int index = 0; index < 60; ++index) { ParticleSmaller particleSmaller = new ParticleSmaller(this.StageData, "光点", this.Position, (float)(1.0 + (double)this.Ran.Next(50) / 10.0), (double)this.Ran.Next(360) / 180.0 * Math.PI); particleSmaller.Scale = (float)this.Ran.Next(10, 20) / 10f; particleSmaller.ColorValue = Color.FromArgb((int)byte.MaxValue, this.Ran.Next(20, 240), this.Ran.Next(220, (int)byte.MaxValue)); } this.StageData.VibrateStart(50); this.MyBulletList.Clear(); this.Boss = (BaseBossTouhou)null; } else { if (this.Time != 250) { return; } EndStage endStage = new EndStage(this.StageData, "在世界的某个角落", true); TransitionOut transitionOut = new TransitionOut(this.StageData); try { INI_RW iniRw = new INI_RW(".\\Setting.INI"); if (iniRw.ExistINIFile()) { iniRw.IniWriteValue("Mode", "Clear", "yes"); } } catch { } } }
public void IniWriteValue(string Section, string Key, string Value) { INI_RW.WritePrivateProfileString(Section, Key, Value, this.inipath); }
public Game_Main() { this.Form_Main = new RenderForm_Main(); this.Form_Main.FormClosing += new FormClosingEventHandler(this.Form_Main_FormClosing); this.Form_Main.Deactivate += new EventHandler(this.Form_Main_Deactivate); this.Form_Main.Activated += new EventHandler(this.Form_Main_Activated); MouseCtrl.DrawCursor(!this.fullWindow); Dpi.GetDpi(); try { INI_RW iniRw = new INI_RW(".\\Setting.INI"); if (iniRw.ExistINIFile()) { this.fullWindow = iniRw.IniReadValue("DirectX", "FullWindow") == "1"; this.antiAlias = iniRw.IniReadValue("DirectX", "AntiAlias") == "1"; this.verticalSync = iniRw.IniReadValue("DirectX", "VerticalSync") == "1"; this.useDirectInput = iniRw.IniReadValue("DirectInput", "UseDirectInput") == "1"; this.GlobalData.Clear = iniRw.IniReadValue("Mode", "Clear") == "yes"; this.singleThreaded = iniRw.IniReadValue("Mode", "SingleThreaded") == "1"; this.fixedFPS = iniRw.IniReadValue("Mode", "FixedFPS") == "1"; this.delayTolerance = (int)Convert.ToInt16(iniRw.IniReadValue("Mode", "DelayTolerance")); this.windowSize = (int)Convert.ToInt16(iniRw.IniReadValue("Mode", "WindowSize")); this.presentInterval = (int)Convert.ToInt16(iniRw.IniReadValue("Mode", "PresentInterval")); this.mapkey.Left = iniRw.IniReadValue("Key", "Left"); this.mapkey.Right = iniRw.IniReadValue("Key", "Right"); this.mapkey.Up = iniRw.IniReadValue("Key", "Up"); this.mapkey.Down = iniRw.IniReadValue("Key", "Down"); this.mapkey.Slow = iniRw.IniReadValue("Key", "Slow"); this.mapkey.Shoot = iniRw.IniReadValue("Key", "Shoot"); this.mapkey.Bomb = iniRw.IniReadValue("Key", "Bomb"); MapJoyStick.Skip = (int)Convert.ToInt16(iniRw.IniReadValue("JoyStick", "Skip")); MapJoyStick.Pause = (int)Convert.ToInt16(iniRw.IniReadValue("JoyStick", "Pause")); MapJoyStick.Slow = (int)Convert.ToInt16(iniRw.IniReadValue("JoyStick", "Slow")); MapJoyStick.Shoot = (int)Convert.ToInt16(iniRw.IniReadValue("JoyStick", "Shoot")); MapJoyStick.Bomb = (int)Convert.ToInt16(iniRw.IniReadValue("JoyStick", "Bomb")); MapJoyStick.C = (int)Convert.ToInt16(iniRw.IniReadValue("JoyStick", "C")); this.bgmVolume = (int)Convert.ToInt16(iniRw.IniReadValue("Volume", "BGMVolume")); this.seVolume = (int)Convert.ToInt16(iniRw.IniReadValue("Volume", "SEVolume")); this.fontType = iniRw.IniReadValue("Game", "FontType"); } } catch { int num = (int)MessageBox.Show("读取配置文件失败", "Setting Load Error"); } if (this.windowSize == 1) { this.Form_Main.ClientSize = new Size(800, 600); } else if (this.windowSize == 2) { this.Form_Main.ClientSize = new Size(1024, 768); } if (!this.Direct3DInit()) { Application.ExitThread(); } else { this.initSuccess = true; if (this.useDirectInput) { this.KCapture = new KeyboardCapture(this.Form_Main.Handle); this.JCapture = new JoystickCapture(this.Form_Main.Handle); } else { this.Form_Main.KeyDown += new KeyEventHandler(this.Form_Main_KeyDown); this.Form_Main.KeyUp += new KeyEventHandler(this.Form_Main_KeyUp); } this.PresentState = (IGameState) new GameState_SplashScreen(this.GlobalData); this.PresentState.Init(); this.PresentState.BGM_ON(); this.GlobalData.LoadResources1(); this.LoadingThread = new Thread(new ThreadStart(this.AddState)); this.LoadingThread.Start(); } // SourseForm sourseForm = new SourseForm(); // sourseForm.Show(); }