private void UpdateRowChestInfo(ChestFutureRngInstance rngInstance, DataGridViewRow row) { const string item1 = "Item 1"; const string item2 = "Item 2"; const int cellOffset = 3; // start filling data in the 4th spot int chestCount = rngInstance.ChestRewards.Count; for (int chestIndex = 0; chestIndex < chestCount; chestIndex++) { ChestReward reward = rngInstance.ChestRewards.ElementAt(chestIndex); if (reward.Reward is RewardType.Gil) { row.Cells[chestIndex + cellOffset].Value = reward.GilAmount; } else if (reward.Reward is RewardType.Item1) { row.Cells[chestIndex + cellOffset].Value = item1; } else { row.Cells[chestIndex + cellOffset].Value = item2; } if (reward.ChestWillSpawn) { DataGridViewCell currentCell = row.Cells[chestIndex + cellOffset]; Font currentStyle = currentCell.InheritedStyle.Font; currentCell.Style.Font = new Font(currentStyle, FontStyle.Bold); } } }
private void UpdateRowStandardInfo(ChestFutureRngInstance rngInstance, DataGridViewRow row) { row.Cells[0].Value = rngInstance.Index; row.Cells[1].Value = rngInstance.CurrentHeal; row.Cells[2].Value = rngInstance.RandToPercent; }
public void TestGetRngInstanceAt() { ChestFutureRng future = new ChestFutureRng(); future.AddNextRngInstance(GetChestFutureRngInstance()); future.AddNextRngInstance(GetChestFutureRngInstance()); ChestFutureRngInstance instance = GetChestFutureRngInstance(); instance.Index = 5; instance.CurrentHeal = 9999; future.AddNextRngInstance(instance); ChestFutureRngInstance copy = future.GetRngInstanceAt(2); Assert.AreEqual(instance.Index, copy.Index); Assert.AreEqual(instance.CurrentHeal, copy.CurrentHeal); }
private void UpdateDataGridView() { int positionsCalculated = _futureRng.GetTotalFutureRngPositions(); for (int i = 0; i < positionsCalculated; i++) { ChestFutureRngInstance rngInstance = _futureRng.GetRngInstanceAt(i); int rowNumber = dataGridView.Rows.Add(); DataGridViewRow row = dataGridView.Rows[rowNumber]; UpdateRowStandardInfo(rngInstance, row); UpdateRowChestInfo(rngInstance, row); if (rngInstance.IsPastRng) { row.DefaultCellStyle.BackColor = Color.LightGreen; } } }