public static List <NumberGUI> GetNumber(int number, ref List <NumberGUI> listNumbers) { listNumbers.Clear(); string stringNumber = number.ToString(); for (int i = 0; i < stringNumber.Length; i++) { NumberGUI num = numbersDict[int.Parse(stringNumber[i].ToString())].Dequeue(); listNumbers.Add(num); } return(listNumbers); }
static NumberSpriteManager() { numbersDict = new Dictionary <int, Queue <NumberGUI> >(); //creates COPY_OF_NUMBERS copy for every number between 0 and 9 for (int i = 0; i <= 9; i++) { Queue <NumberGUI> queue = new Queue <NumberGUI>(); for (int j = 0; j < COPY_OF_NUMBERS; j++) { NumberGUI num = new NumberGUI(new GUIObject(Vector2.Zero, "num_" + i), i); queue.Enqueue(num); } numbersDict.Add(i, queue); } }