public void UpdateReelWindow(ReelGroup reelGroup, List <int> randomNumbers) { Window = new List <List <Symbol> >(); SymbolPositions = new Dictionary <Symbol, List <SymbolPosition> >(); // For each reel... for (int reelIndex = 0; reelIndex < reelGroup.Reels.Count; ++reelIndex) { Window.Add(new List <Symbol>()); int reelHeight = reelGroup.Reels[reelIndex].Height; ReelStrip reelStrip = reelGroup.Reels[reelIndex].ReelStrip; // For each symbol on the reel... int randomNumber = randomNumbers[reelIndex]; for (int offset = 0; offset < reelHeight; ++offset) { int stripIndex = (randomNumber + offset) % reelStrip.Symbols.Count; // Add the symbol to the reel window. Symbol symbol = new Symbol(reelStrip.Symbols[stripIndex]); Window[reelIndex].Add(new Symbol(symbol)); // Add the symbol position in the dictionary. if (SymbolPositions.ContainsKey(symbol) == false) { SymbolPositions.Add(symbol, new List <SymbolPosition>()); } SymbolPositions[symbol].Add(new SymbolPosition { ReelIndex = reelIndex, ReelOffset = offset }); } } }
public ReelWindow(ReelGroup reelGroup, List <int> randomNumbers) { UpdateReelWindow(reelGroup, randomNumbers); }