///<summary> ///Returns the values of the given variable in the dictionary. ///<summary> public float GetValue(GameEnum variable) { float returnVal; game_dict.TryGetValue(variable, out returnVal); return(returnVal); }
private Game( GameEnum gameKind, bool hasPhysicalSpecialSplit, bool canChangeStaticPokemon, bool hasMoveTutors, bool hasTimeBasedEncounters, bool supportsFoarStartingMoves, int generation, int abilitiesPerPokemon, int[] requiredFieldTMs, int[] fieldMoves, int[] earlyRequiredHmMoves) { GameKind = gameKind; HasPhysicalSpecialSplit = hasPhysicalSpecialSplit; CanChangeStaticPokemon = canChangeStaticPokemon; HasMoveTutors = hasMoveTutors; HasTimeBasedEncounters = hasTimeBasedEncounters; SupportsFoarStartingMoves = supportsFoarStartingMoves; Generation = generation; AbilitiesPerPokemon = abilitiesPerPokemon; RequiredFieldTMs = requiredFieldTMs; FieldMoves = fieldMoves; EarlyRequiredHmMoves = earlyRequiredHmMoves; }
///<summary> ///Sets the whole dictionary to the values in a given settings ///<summary> public void SetDict(SettingsObject settings) { GameEnum flag = GameEnum.Temperature; while (flag != GameEnum.Null) { float value; switch (flag) { case GameEnum.Temperature: value = settings.temperature; break; case GameEnum.Brightness: value = settings.brightness; break; case GameEnum.Volume: value = settings.volume; break; default: throw new System.Exception("Calvin: Enum has not yet been integrated into dictionary."); } game_dict[flag] = value; flag++; } }
private void GameWorkFlow() { GameStatusTimer--; if (GameStatusTimer > 0) { return; } GameStatusTimer = 0; switch (GameStatus) { case GameEnum.Stop: break; case GameEnum.Prepare: Player.Visible = true; GameStatus = GameEnum.Play; break; case GameEnum.Play: if (Enemies.EnemiesAlive() == 0) { GameStatus = GameEnum.Next; GameStatusTimer = Constants.PlayerNextTime; } break; case GameEnum.Next: var initScore = Score + (Lives * Constants.RemainingLifeBonus); Initialise(initScore, Lives); break; case GameEnum.Dying: if (Lives > 0) { Player = new Models.Player(Constants.GameAreaWidth / 2, Constants.InitialPlayerYpos); GameStatus = GameEnum.Prepare; GameStatusTimer = Constants.PlayerPrepareTime; } else { GameStatus = GameEnum.Dead; LastKeyPress = default; } break; case GameEnum.Dead: if (LastKeyPress != default) { Initialise(); } break; default: break; } }
private void GameLogic() { // Game loop. if (GameStatus == GameEnum.Pause) { if (LastKeyPress == ConsoleKey.P && CheckKeyDown(KeysEnum.KeyPause)) { LastKeyPress = default; GameStatus = SavedGameStatus; } return; } if (GameStatus != GameEnum.Dead && GameStatus != GameEnum.Next) { if (LastKeyPress == ConsoleKey.P && CheckKeyDown(KeysEnum.KeyPause)) { LastKeyPress = default; SavedGameStatus = GameStatus; GameStatus = GameEnum.Pause; return; } MovePlayer(); MovePlayerBullet(); PlayerFireBullet(); //Enemies.ClearRender(); var enemyAnimationTimer = MoveEnemies(); MoveEnemyBullet(); MoveMotherShip(); Animate(); EnemyFireBullet(); BulletHitEnemies(); BulletHitMother(); BulletHitPlayer(); BulletHitBunker(); EnemiesHitBunkers(); EnemiesHitPlayer(); PlayerBackgroundSound(GameCounter, enemyAnimationTimer); GameCounter++; Var3 = enemyAnimationTimer.ToString(); } GameWorkFlow(); //Var1 = Enemies.bulletTimer; //Var2 = EnemyBullet.Visible ? 1 : 0; //Var1 = GameStatus.ToString(); Var1 = "Mother.AnimationTimer: " + Mother.AnimationTimer.ToString(); //Var2 = GameStatusTimer.ToString(); Var2 = "Mother.MotherTimer: " + Mother.MotherTimer.ToString(); //Var2="Bunker Xindex: "+ //Var3 = "Bunker.Width: " + Bunker.Width.ToString(); //Var4 = "Bunker.Xpos - ((Bunker.Width * Constants.BrickSize) / 2): " + (Bunker.Xpos - ((Bunker.Width * Constants.BrickSize) / 2)).ToString(); }
public void refreshLines(Hashtable file) { try { this.listView1.Items.Clear(); foreach (object key in file.Keys) { try { GameEnum value = (GameEnum)file[key]; String info = value.Key; String type = value.Value.ToString(); String reson = value.Rem; ListViewItem item = new ListViewItem(new string[] { info, type, reson }); item.Tag = value; listView1.Items.Add(item); } catch (Exception err) { } } listView1.Columns[0].Text = "(" + file.Count + ")条枚举"; } catch (Exception err) { MessageBox.Show(err.Message + "\n" + err.StackTrace + "\n"); } }
// sum selected private void toolStripButton2_Click_1(object sender, EventArgs e) { Boolean isHex = false; long sum = 0; foreach (ListViewItem item in listView1.Items) { try { if (item.SubItems[1].Text.Contains("x")) { isHex = true; } if (item.Checked) { GameEnum gameenum = (GameEnum)item.Tag; sum = sum | gameenum.Value; } } catch (Exception err) { } } if (isHex) { TextBoxSum.Text = sum.ToString("X8"); } else { TextBoxSum.Text = sum.ToString(); } }
// select or value private void toolStripButton3_Click_1(object sender, EventArgs e) { long sum = 0; try { if (TextBoxOR.Text.Contains("0x")) { sum = long.Parse(TextBoxOR.Text.Substring(2), System.Globalization.NumberStyles.AllowHexSpecifier); } else { sum = long.Parse(TextBoxOR.Text); } foreach (ListViewItem item in listView1.Items) { try { GameEnum gameenum = (GameEnum)item.Tag; item.Checked = (gameenum.Value & sum) != 0; } catch (Exception err) { } } } catch (Exception err) { MessageBox.Show(err.Message + "\n"); } }
public void Animate(GameEnum gameStatus) { if (gameStatus == GameEnum.Prepare) { Visible = !Visible; } }
public GameConfig(GameEnum gameEnum, string name, string inifile, string[] extraDirs) { _gameEnum = gameEnum; _name = name; _inifile = inifile; _extraDirs = extraDirs; }
public static string GetTips(GameEnum gre) { if (gameEnumDes.ContainsKey(gre)) { return(gameEnumDes[gre]); } return(null); }
///<summary> /// Returns true if the current settings are exactly the same as a given SettingsObject. ///<summary> public bool isSettingsSame(SettingsObject settings) { GameEnum flag = GameEnum.Temperature; while (flag != GameEnum.Null) { float value; switch (flag) { case GameEnum.Temperature: value = settings.temperature; break; case GameEnum.Brightness: value = settings.brightness; break; case GameEnum.Volume: value = settings.volume; break; case GameEnum.RedX: value = settings.redX; break; case GameEnum.RedY: value = settings.redY; break; case GameEnum.BlueX: value = settings.blueX; break; case GameEnum.BlueY: value = settings.blueY; break; case GameEnum.YellowX: value = settings.yellowX; break; case GameEnum.YellowY: value = settings.yellowY; break; default: throw new System.Exception("Calvin: Enum has not yet been integrated into dictionary."); } if (!isSimilar(value, GetValue(flag))) { return(false); } flag++; } return(true); }
public void InitDict() { GameEnum flag = GameEnum.Temperature; while (flag != GameEnum.Null) { game_dict.Add(flag, 0.5f); flag++; } }
public GameDefinition(GameEnum gameEnum, String friendlyName, String processName, String gameStartCommandProperty, String gameStartCommandOptionsProperty, String gameStartEnabledProperty) { this.gameEnum = gameEnum; this.friendlyName = friendlyName; this.processName = processName; this.gameStartCommandProperty = gameStartCommandProperty; this.gameStartCommandOptionsProperty = gameStartCommandOptionsProperty; this.gameStartEnabledProperty = gameStartEnabledProperty; }
public void RemoveNode(GameEnum game, Node node) { var reg = GetCorrectRegistry(game); Node match = reg.Nodes.Where(x => x.Scene == node.Scene && x.Zone == x.Zone && x.Number == node.Number).FirstOrDefault(); reg.Nodes.Remove(match); }
public GameDefinition(GameEnum gameEnum, String friendlyName, String processName, String spotterName, String gameStartCommandProperty, String gameStartCommandOptionsProperty, String gameStartEnabledProperty) { this.gameEnum = gameEnum; this.friendlyName = friendlyName; this.processName = processName; this.spotterName = spotterName; this.gameStartCommandProperty = gameStartCommandProperty; this.gameStartCommandOptionsProperty = gameStartCommandOptionsProperty; this.gameStartEnabledProperty = gameStartEnabledProperty; }
public void ResetDict() { GameEnum flag = GameEnum.Temperature; while (flag != GameEnum.Null) { SetValue(flag, 0); flag++; } Debug.Log("Exit Reset"); }
public static void WinnerDecider(GameEnum computer, GameEnum user) { if (computer == GameEnum.Rock) { if (user == GameEnum.Rock) { Console.WriteLine("Draw!!!"); } else if (user == GameEnum.Paper) { Console.WriteLine("You won!!!"); _gameScore.YouWin++; } else { Console.WriteLine("You lose!!!"); _gameScore.ComputerWin++; } } else if (computer == GameEnum.Paper) { if (user == GameEnum.Paper) { Console.WriteLine("Draw!!!"); } else if (user == GameEnum.Scissors) { Console.WriteLine("You won!!!"); _gameScore.YouWin++; } else { Console.WriteLine("You lose!!!"); _gameScore.ComputerWin++; } } else if (computer == GameEnum.Scissors) { if (user == GameEnum.Scissors) { Console.WriteLine("Draw!!!"); } else if (user == GameEnum.Rock) { Console.WriteLine("You won!!!"); _gameScore.YouWin++; } else { Console.WriteLine("You lose!!!"); _gameScore.ComputerWin++; } } }
private void 十六进制ToolStripMenuItem_Click(object sender, EventArgs e) { foreach (ListViewItem item in listView1.Items) { try { GameEnum gameenum = (GameEnum)item.Tag; item.SubItems[1].Text = "0x" + gameenum.Value.ToString("X8"); } catch (Exception err) { } } }
public static void Game() { Clear(); Random r = new Random(); Console.WriteLine("Computer thinking..."); GameEnum computerChoose = GameEnum.Rock; for (int i = 0; i < 10000; i++) { computerChoose = (GameEnum)r.Next(0, 2); } Console.WriteLine("Computer set..."); // Thread.Sleep(1500); bool input = true; GameEnum userChoose = GameEnum.Rock; while (input) { Console.Write("Your choose (0 Rock, 1 Paper, 2 Scissors) : "); var temp = Console.ReadLine(); if (!string.IsNullOrWhiteSpace(temp)) { if (int.TryParse(temp, out var i)) { if (i == 0 || i == 1 || i == 2) { userChoose = (GameEnum)i; input = false; } else { ErrorInput(); } } else { ErrorInput(); } } else { ErrorInput(); } } WinnerDecider(computerChoose, userChoose); }
public KeyResource GetKeyResource(GameEnum gameEnum, string keyfilePath) { byte[] content = _fileProvider.GetByteContentOfFile(keyfilePath); _fileExtensionMap = MapExtensions(gameEnum); KeyResource keyResource = _keyResourceBuilder.BuildKeyResource(content); foreach (var resourceEntryResource in keyResource.ResourceEntries) { SetResourceEntryFileInformation(resourceEntryResource); } return keyResource; }
public PortraitIndexManager(IMemoryManager memoryManager, IROM rom, bool edited) { currentGame = GameEnumHelpers.GetGame(rom.GameCode); var defaultInfo = defaultInfos[currentGame]; portraitDataPointerPointer = memoryManager.Reserve(defaultInfo.tablePointerOffset, 4); int tableRawPtr = BitConverter.ToInt32(rom.ReadData(portraitDataPointerPointer), 0); int tableEntryCount; if (edited) { string data = rom.GetCustomData(portraitProperty); if (data != null) { tableEntryCount = Convert.ToInt32(data); } else { //Let's just hope for the best... tableEntryCount = defaultInfo.indexAmount; rom.AddCustomData(portraitProperty, tableEntryCount.ToString()); } } else { tableEntryCount = defaultInfo.indexAmount; rom.AddCustomData(portraitProperty, tableEntryCount.ToString()); } portraitDataPointer = memoryManager.Reserve( Pointer.GetOffset(tableRawPtr + defaultInfo.IndexSize), tableEntryCount); entries = new List<GeneralizedPointerTableEntry>(tableEntryCount); LoadDataFromROM(memoryManager, rom, defaultInfo.fe6format, tableEntryCount); }
private void FindGameType() { _gameEnum = GameEnum.Unknown; if (File.Exists(Path.Combine(_rootPath, "baldur.exe")) && File.Exists(Path.Combine(_rootPath, "Config.exe"))) { _gameEnum = GameEnum.BaldursGate; } else if (File.Exists(Path.Combine(_rootPath, "baldur.exe")) && File.Exists(Path.Combine(_rootPath, "BGConfig.exe"))) { _gameEnum = GameEnum.BaldursGate2; } else if (File.Exists(Path.Combine(_rootPath, "baldur.exe")) && File.Exists(Path.Combine(_rootPath, "movies/TSRLOGO.wbm"))) { _gameEnum = GameEnum.BaldursGateTob; } else if (File.Exists(Path.Combine(_rootPath, "torment.exe"))) { _gameEnum = GameEnum.PlanescapeTorment; } else if (File.Exists(Path.Combine(_rootPath, "idmain.exe"))) { _gameEnum = GameEnum.IceWindDale; } else if (File.Exists(Path.Combine(_rootPath, "iwd2.exe"))) { _gameEnum = GameEnum.IceWindDale2; } else if (File.Exists(Path.Combine(_rootPath, "nwn.exe")) || File.Exists(Path.Combine(_rootPath, "Neverwinter Nights.app/Contents/MacOS/Neverwinter Nights"))) { _gameEnum = GameEnum.NewerwinterNights; } else if (File.Exists(Path.Combine(_rootPath, "swkotor.exe"))) { _gameEnum = GameEnum.Kotor; } else if (File.Exists(Path.Combine(_rootPath, "swkotor2.exe"))) { _gameEnum = GameEnum.Kotor2; } else if (File.Exists(Path.Combine(_rootPath, "bg1tutu.exe"))) { _gameEnum = GameEnum.BaldursGateTutu; } else if (File.Exists(Path.Combine(_rootPath, "baldur.exe")) && File.Exists(Path.Combine(_rootPath, "chitin.ini"))) { _gameEnum = GameEnum.BaldursGateDemo; } else if (File.Exists(Path.Combine(_rootPath, "Baldur.exe")) && File.Exists(Path.Combine(_rootPath, "data/OH1000.Bif"))) { _gameEnum = GameEnum.BaldursGateExtented; } }
private void ReCheckGameType() { if (_gameEnum == GameEnum.IceWindDale && ResourceExists("HOWDRAG.MVE")) { // Detect Trials of the Luremaster _gameEnum = ResourceExists("AR9715.ARE") ? GameEnum.IceWindDaleTrailsOfRuleMaster : GameEnum.IceWindDaleHeartofWinter; } if (_gameEnum == GameEnum.BaldursGate2 && ResourceExists("SARADUSH.MVE")) { _gameEnum = GameEnum.BaldursGateTob; } if (_gameEnum == GameEnum.BaldursGate && ResourceExists("DURLAG.MVE")) { _gameEnum = GameEnum.BaldursGateTotsc; } }
private void LoadDataFromROM(IMemoryManager memoryManager, IROM rom) { int portraitPtrOffset; int defaultIndexAmount; bool FE6Format; switch (game = GameEnumHelpers.GetGame(rom.GameCode)) { case GameEnum.FE6Trans: case GameEnum.FE6: portraitPtrOffset = 0x007FD8; defaultIndexAmount = 0xE6; FE6Format = true; break; case GameEnum.FE7U: portraitPtrOffset = 0x006B30; defaultIndexAmount = 0xE4; FE6Format = false; break; case GameEnum.FE8U: portraitPtrOffset = 0x005524; defaultIndexAmount = 0xAC; FE6Format = false; break; //Unknown case GameEnum.FE7J: case GameEnum.FE8J: case GameEnum.FE7E: case GameEnum.FE8E: default: throw new Exception("Game not supported."); } portraitDataPointerPointer = memoryManager.Reserve(portraitPtrOffset, 4); int tableRawPtr = BitConverter.ToInt32(rom.ReadData(portraitDataPointerPointer), 0); int indexSize = Marshal.SizeOf(FE6Format ? typeof(FE6RawFormat) : typeof(FE78RawFormat)); portraitDataPointer = memoryManager.Reserve( Pointer.GetOffset(tableRawPtr + indexSize), defaultIndexAmount * indexSize); byte[] portraitData = rom.ReadData(portraitDataPointer); portraitEntries.Clear(); unsafe { if (FE6Format) { FE6RawFormat[] rawData = new FE6RawFormat[defaultIndexAmount]; fixed (FE6RawFormat* ptr = rawData) { IntPtr ptr2 = (IntPtr)ptr; Marshal.Copy(portraitData, 0, ptr2, portraitData.Length); } for (int i = 0; i < rawData.Length; i++) { portraitEntries.Add(new GeneralizedPointerTableEntry( rom, memoryManager, rawData[i])); } } else { FE78RawFormat[] rawData = new FE78RawFormat[defaultIndexAmount]; fixed (FE78RawFormat* ptr = rawData) { IntPtr ptr2 = (IntPtr)ptr; Marshal.Copy(portraitData, 0, ptr2, portraitData.Length); } for (int i = 0; i < rawData.Length; i++) { portraitEntries.Add(new GeneralizedPointerTableEntry( rom, memoryManager, rawData[i])); } } } CurrentIndex = 0; form.MaxIndex = portraitEntries.Count - 1; }
private FileExtensionMap MapExtensions(GameEnum gameEnum) { var extensionMap = new FileExtensionMap(); if (gameEnum == GameEnum.NewerwinterNights) { extensionMap.Add(0x001, "BMP"); extensionMap.Add(0x003, "TGA"); extensionMap.Add(0x004, "WAV"); extensionMap.Add(0x006, "PLT"); extensionMap.Add(0x007, "INI"); extensionMap.Add(0x00A, "TXT"); extensionMap.Add(0x7D2, "MDL"); // Aurora model - not supported extensionMap.Add(0x7D9, "NSS"); extensionMap.Add(0x7DA, "NCS"); extensionMap.Add(0x7DC, "ARE"); extensionMap.Add(0x7DD, "SET"); extensionMap.Add(0x7DE, "IFO"); extensionMap.Add(0x7DF, "BIC"); extensionMap.Add(0x7E0, "WOK"); extensionMap.Add(0x7E1, "2DA"); extensionMap.Add(0x7E6, "TXI"); extensionMap.Add(0x7E7, "GIT"); extensionMap.Add(0x7E9, "UTI"); extensionMap.Add(0x7EB, "UTC"); extensionMap.Add(0x7ED, "DLG"); extensionMap.Add(0x7EE, "ITP"); extensionMap.Add(0x7F0, "UTT"); extensionMap.Add(0x7F1, "DDS"); // Compressed texture file - not supported extensionMap.Add(0x7F3, "UTS"); extensionMap.Add(0x7F4, "LTR"); // Letter-combo probability info for name generation - not supported extensionMap.Add(0x7F5, "GFF"); extensionMap.Add(0x7F6, "FAC"); extensionMap.Add(0x7F8, "UTE"); extensionMap.Add(0x7FA, "UTD"); extensionMap.Add(0x7FC, "UTP"); extensionMap.Add(0x7FD, "DFT"); extensionMap.Add(0x7FE, "GIC"); extensionMap.Add(0x7FF, "GUI"); extensionMap.Add(0x803, "UTM"); extensionMap.Add(0x804, "DWK"); extensionMap.Add(0x805, "PWK"); extensionMap.Add(0x808, "JRL"); extensionMap.Add(0x80A, "UTW"); extensionMap.Add(0x80C, "SSF"); extensionMap.Add(0x810, "NDB"); extensionMap.Add(0x811, "PTM"); extensionMap.Add(0x812, "PTT"); } else if (gameEnum == GameEnum.Kotor || gameEnum == GameEnum.Kotor2) { extensionMap.Add(0x000, "INV"); extensionMap.Add(0x003, "TGA"); extensionMap.Add(0x004, "WAV"); extensionMap.Add(0x7D2, "MDL"); // Aurora model - not supported extensionMap.Add(0x7D9, "NSS"); extensionMap.Add(0x7DA, "NCS"); extensionMap.Add(0x7DC, "ARE"); extensionMap.Add(0x7DE, "IFO"); extensionMap.Add(0x7DF, "BIC"); extensionMap.Add(0x7E0, "BWM"); // ????? extensionMap.Add(0x7E1, "2DA"); extensionMap.Add(0x7E6, "TXI"); extensionMap.Add(0x7E7, "GIT"); extensionMap.Add(0x7E8, "BTI"); extensionMap.Add(0x7E9, "UTI"); extensionMap.Add(0x7EA, "BTC"); extensionMap.Add(0x7EB, "UTC"); extensionMap.Add(0x7ED, "DLG"); extensionMap.Add(0x7EE, "ITP"); extensionMap.Add(0x7F0, "UTT"); extensionMap.Add(0x7F3, "UTS"); extensionMap.Add(0x7F4, "LTR"); // Letter-combo probability info for name generation - not supported extensionMap.Add(0x7F6, "FAC"); extensionMap.Add(0x7F8, "UTE"); extensionMap.Add(0x7FA, "UTD"); extensionMap.Add(0x7FC, "UTP"); extensionMap.Add(0x7FF, "GUI"); extensionMap.Add(0x803, "UTM"); extensionMap.Add(0x804, "BWM"); // ?????? extensionMap.Add(0x805, "BWM"); // ?????? extensionMap.Add(0x808, "JRL"); extensionMap.Add(0x809, "MOD"); // MOD 1.0 - name might be incorrect extensionMap.Add(0x80A, "UTW"); extensionMap.Add(0x80C, "SSF"); extensionMap.Add(0xBBB, "PTH"); extensionMap.Add(0xBBC, "LIP"); // ??? binary format } else { extensionMap.Add(0x001, "BMP"); extensionMap.Add(0x002, "MVE"); extensionMap.Add(0x004, "WAV"); extensionMap.Add(0x005, "WFX"); extensionMap.Add(0x006, "PLT"); extensionMap.Add(0x3e8, "BAM"); extensionMap.Add(0x3e9, "WED"); extensionMap.Add(0x3ea, "CHU"); extensionMap.Add(0x3eb, "TIS"); extensionMap.Add(0x3ec, "MOS"); extensionMap.Add(0x3ed, "ITM"); extensionMap.Add(0x3ee, "SPL"); extensionMap.Add(0x3ef, "BCS"); extensionMap.Add(0x3f0, "IDS"); extensionMap.Add(0x3f1, "CRE"); extensionMap.Add(0x3f2, "ARE"); extensionMap.Add(0x3f3, "DLG"); extensionMap.Add(0x3f4, "2DA"); extensionMap.Add(0x3f5, "GAM"); extensionMap.Add(0x3f6, "STO"); extensionMap.Add(0x3f7, "WMP"); extensionMap.Add(0x3f8, "EFF"); extensionMap.Add(0x3f9, "BS"); extensionMap.Add(0x3fa, "CHR"); extensionMap.Add(0x3fb, "VVC"); extensionMap.Add(0x3fc, "VEF"); // ???????? extensionMap.Add(0x3fd, "PRO"); extensionMap.Add(0x3fe, "BIO"); extensionMap.Add(0x404, "PVR"); extensionMap.Add(0x44c, "BAH"); // ??????? extensionMap.Add(0x802, "INI"); extensionMap.Add(0x803, "SRC"); } return extensionMap; }
public bool SupportGame(GameEnum game) { throw new NotImplementedException(); }
static bool HasDefaultInfo(GameEnum game) { return defaultInfos.ContainsKey(game); }
public bool SupportGame(GameEnum game) { return (GameEnum.FE6 == game) || (GameEnum.FE7U == game) || (GameEnum.FE8U == game); }