static void Main(string[] args) { bool topMenu = true; MachineInventory mi = new MachineInventory(); Sales transaction = new Sales(); mi.VendingMenus(); // Console.WriteLine("Welcome to the vendor thing"); Console.ReadLine(); }
private void SpawnTrackNetworks() { this.manager.SetTitle("Track Systems"); this.manager.AddButton("allnetworks", "Global Inventory", buttonx2, 0); this.manager.AddButton("selnetwork", "Select Network", buttonx3, 0); this.manager.AddButton("tracknetworks", "Network Status", buttonx4, 0); this.manager.AddButton("viewinventory", "View Inventory", buttonx5, 0); int ycursor = 65; int trackiconx = globalxoffset + 175; int trackxoffset = trackiconx + 65; int tracklabel = trackxoffset + 250; int stationxicon = trackiconx + 50; int stationlabel = stationxicon + 65; int cartxicon = stationxicon + 50; int cartlabel = cartxicon + 65; int invxicon = cartxicon + 50; int invlabel = invxicon + 65; int networkcount = FreightCartManager.instance.GlobalTrackNetworks.Count; if (networkcount == 0) { this.manager.AddBigLabel("notracknetworks", "No track networks found...", Color.red, 225, 150); } else { string trackicon = "Track Straight"; string stationicon = "Minecart Load"; for (int n = 0; n < networkcount; n++) { FreightTrackNetwork network = FreightCartManager.instance.GlobalTrackNetworks[n]; if (network == null) { continue; } int junctioncount = network.TrackJunctions.Count; int networkID = network.NetworkID; int assignedcarts; int availcarts; network.GetNetworkStats(out assignedcarts, out availcarts); this.manager.AddIcon("trackicon" + n, trackicon, Color.white, trackiconx, ycursor); this.manager.AddBigLabel("trackjunctions" + n, "ID: " + network.NetworkID.ToString() + " " + junctioncount.ToString() + " Junctions Carts: ", Color.white, trackxoffset, ycursor); this.manager.AddBigLabel("trackcarts" + n, availcarts.ToString() + " / " + assignedcarts.ToString(), availcarts > assignedcarts ? Color.green : availcarts == assignedcarts ? Color.white : Color.red, tracklabel, ycursor); ycursor += 60; if (this.TrackNetworkDisplay == n) { List <FreightCartStation> stations = network.GetNetworkStations(); stations = stations.OrderBy(x => x.StationName).ToList(); int stationcount = stations.Count; Debug.LogWarning("FSM Station Count: " + stationcount.ToString()); for (int m = 0; m < stationcount; m++) { FreightCartStation station = stations[m]; int stationavail = station.AvailableCarts; int stationassigned = station.AssignedCarts; this.manager.AddIcon("stationicon" + m, stationicon, Color.white, stationxicon, ycursor); this.manager.AddBigLabel("stationnetwork" + m, (!string.IsNullOrEmpty(station.StationName) ? station.StationName : "UNNAMED") + " - " + station.NetworkID, station.StationFull <= 0 ? Color.white : Color.red, stationlabel, ycursor); this.manager.AddBigLabel("stationcarts" + m, "Carts: " + stationavail.ToString() + " / " + stationassigned.ToString(), stationavail > stationassigned ? Color.green : stationavail == stationassigned ? Color.white : Color.red, stationlabel + 350, ycursor); ycursor += 60; if (this.StationDisplay == m) { this.manager.AddButton("addcart", "Add Cart", stationlabel + 475, ycursor - 60); this.manager.AddButton("removecart", "Remove Cart", stationlabel + 475, ycursor - 10); this.CurrentStation = station; List <FreightRegistry> LocalDeficits = new List <FreightRegistry>(); List <FreightRegistry> LocalSurplus = new List <FreightRegistry>(); if (station.massStorageCrate != null) { LocalDeficits = FreightCartManager.instance.GetLocalDeficit(station.NetworkID, station.massStorageCrate); LocalSurplus = FreightCartManager.instance.GetLocalSurplus(station.NetworkID, station.massStorageCrate); } else if (station.HopperInterface != null) { LocalDeficits = this.FreightListingConversion(station.HopperInterface.FreightRequests.OrderByDescending(x => x.Quantity).Take(3).ToList()); LocalSurplus = this.FreightListingConversion(station.HopperInterface.FreightOfferings.OrderByDescending(x => x.Quantity).Take(3).ToList()); } else if (station.AttachedInterface != null) { LocalDeficits = this.FreightListingConversion(station.AttachedInterface.FreightRequests.OrderByDescending(x => x.Quantity).Take(3).ToList()); LocalSurplus = this.FreightListingConversion(station.AttachedInterface.FreightOfferings.OrderByDescending(x => x.Quantity).Take(3).ToList()); } ycursor -= 20; string str = ""; int shifter = 1; int ind2 = 0; if (LocalDeficits.Count <= 0) { this.manager.AddLabel(GenericMachineManager.LabelType.OneLineFullWidth, "localdef", "This storage is fully stocked!", Color.white, false, stationlabel, ycursor); } else { this.manager.AddLabel(GenericMachineManager.LabelType.OneLineFullWidth, "localdef", "Top requests for this storage:", Color.white, false, stationlabel, ycursor); } ycursor += 20; for (int index = 0; index < LocalDeficits.Count; index++) { if (LocalDeficits[index].Deficit != 0) { str = (index + 1).ToString() + ") " + LocalDeficits[index].Deficit.ToString("N0") + "x " + ItemManager.GetItemName(LocalDeficits[index].FreightItem) + "\n"; this.manager.AddLabel(GenericMachineManager.LabelType.OneLineFullWidth, "localdef" + index, str, Color.white, false, stationlabel, ycursor); ycursor += 20; } shifter++; } ycursor -= 20 * shifter; if (LocalSurplus.Count <= 0) { this.manager.AddLabel(GenericMachineManager.LabelType.OneLineFullWidth, "localsur", "This storage has nothing to offer!", Color.white, false, stationlabel + 250, ycursor); } else { this.manager.AddLabel(GenericMachineManager.LabelType.OneLineFullWidth, "localsur", "Top offerings for this storage:", Color.white, false, stationlabel + 250, ycursor); } ycursor += 20; for (int index = 0; index < LocalSurplus.Count; index++) { if (LocalSurplus[index].Surplus != 0) { str = (index + 1).ToString() + ") " + LocalSurplus[index].Surplus.ToString("N0") + "x " + ItemManager.GetItemName(LocalSurplus[index].FreightItem) + "\n"; this.manager.AddLabel(GenericMachineManager.LabelType.OneLineFullWidth, "localsur" + index, str, Color.white, false, stationlabel + 250, ycursor); ycursor += 20; } ind2 = index; } if (ind2 > (shifter - 2)) { ycursor += 20; } else { ycursor += (shifter - 1 - ind2) * 20 + 20; } int cartcount = station.CartList.Count; for (int p = 0; p < cartcount; p++) { FreightCartMob cart = station.CartList[p]; int itemID = ItemEntries.MineCartT1; if (cart.meType == FreightCartMob.eMinecartType.FreightCartMK1) { itemID = ModManager.mModMappings.ItemsByKey["steveman0.FreightCartMK1"].ItemId; } else if (cart.meType == FreightCartMob.eMinecartType.FreightCart_T1 || cart.meType == FreightCartMob.eMinecartType.OreFreighter_T1) { itemID = ItemEntries.MineCartT1; } else if (cart.meType == FreightCartMob.eMinecartType.FreightCart_T2 || cart.meType == FreightCartMob.eMinecartType.OreFreighter_T2) { itemID = ItemEntries.MineCartT2; } else if (cart.meType == FreightCartMob.eMinecartType.FreightCart_T3 || cart.meType == FreightCartMob.eMinecartType.OreFreighter_T3) { itemID = ItemEntries.MineCartT3; } else if (cart.meType == FreightCartMob.eMinecartType.FreightCart_T4 || cart.meType == FreightCartMob.eMinecartType.OreFreighter_T4) { itemID = ItemEntries.MineCartT4; } else if (cart.meType == FreightCartMob.eMinecartType.FreightCartTour) { itemID = ItemEntries.TourCart; } string carticon = ItemManager.GetItemIcon(itemID); this.manager.AddIcon("carticon" + p, carticon, Color.white, cartxicon, ycursor); this.manager.AddBigLabel("cartlabel" + p, "Inventory: " + cart.mnUsedStorage.ToString() + "/" + cart.mnMaxStorage.ToString(), Color.white, cartlabel, ycursor); ycursor += 60; if (p == CartDisplay) { MachineInventory inv = null; if (!string.IsNullOrEmpty(station.NetworkID) && cart.LocalInventory.ContainsKey(station.NetworkID)) { inv = cart.LocalInventory[station.NetworkID]; } if (inv == null || inv.ItemCount() == 0) { this.manager.AddBigLabel("invlabelempty", "No goods from this station", Color.white, invxicon + 15, ycursor); ycursor += 60; } else { int invcount = inv.Inventory.Count; for (int q = 0; q < invcount; q++) { ItemBase item = inv.Inventory[q]; string invicon = ItemManager.GetItemIcon(item); this.manager.AddIcon("invicon" + q, invicon, Color.white, invxicon, ycursor); this.manager.AddBigLabel("invlabel" + q, item.ToString(), Color.white, invlabel, ycursor); ycursor += 60; } } } } } } //Insert Tour cart staion listing here } } } }