public IDictionary <int, float> DrawColorPalette(BetterPaintMod mymod, SpriteBatch sb) { IDictionary <string, PaintDisplayInfo> infoSet = PaintDisplayInfo.GetPaintSelection(Main.LocalPlayer); var angles = new Dictionary <int, float>(infoSet.Count); double angleStep = 360d / (double)infoSet.Count; double angle = 0d; double radpi = Math.PI / 180d; foreach (var info in infoSet.Values) { int x = (Main.screenWidth / 2) + (int)(128d * Math.Cos(angle * radpi)); int y = (Main.screenHeight / 2) + (int)(128d * Math.Sin(angle * radpi)); int stack; float percent; Color color; info.GetDrawInfo(mymod, x, y, out color, out percent, out stack); this.DrawColorIcon(sb, info.PaintItem.type, color, percent, stack, x, y, angle, angleStep, (info.FirstInventoryIndex == this.CurrentPaintItemInventoryIndex)); angles[info.FirstInventoryIndex] = (float)angle; angle += angleStep; } return(angles); }
public static IDictionary <string, PaintDisplayInfo> GetPaintSelection(Player player) { var mymod = BetterPaintMod.Instance; IList <int> paintIdxs = new List <int>(); Item[] inv = player.inventory; for (int i = 0; i < inv.Length; i++) { Item item = inv[i]; if (item == null || item.IsAir) { continue; } if (PaintBlasterHelpers.IsPaint(item)) { paintIdxs.Add(i); } } var paintInfo = new Dictionary <string, PaintDisplayInfo>(paintIdxs.Count); foreach (int idx in paintIdxs) { Item item = Main.LocalPlayer.inventory[idx]; if (PaintBlasterHelpers.GetPaintAmount(item) <= 0) { continue; } string key = PaintBlasterHelpers.GetPaintColor(item).ToString() + "_" + PaintBlasterHelpers.GetPaintType(item); if (!paintInfo.ContainsKey(key)) { paintInfo[key] = new PaintDisplayInfo(idx, item); } else { paintInfo[key].Copies++; } } return(paintInfo); }