private void DisplayCart(CartStats cart, int p, ref int ycursor, int cartlabel, int cartxicon) { int itemID = ItemEntries.MineCartT1; if (cart.CartType == FreightCartMob.eMinecartType.FreightCartMK1) { itemID = ModManager.mModMappings.ItemsByKey["steveman0.FreightCartMK1"].ItemId; } else if (cart.CartType == FreightCartMob.eMinecartType.FreightCart_T1 || cart.CartType == FreightCartMob.eMinecartType.OreFreighter_T1) { itemID = ItemEntries.MineCartT1; } else if (cart.CartType == FreightCartMob.eMinecartType.FreightCart_T2 || cart.CartType == FreightCartMob.eMinecartType.OreFreighter_T2) { itemID = ItemEntries.MineCartT2; } else if (cart.CartType == FreightCartMob.eMinecartType.FreightCart_T3 || cart.CartType == FreightCartMob.eMinecartType.OreFreighter_T3) { itemID = ItemEntries.MineCartT3; } else if (cart.CartType == FreightCartMob.eMinecartType.FreightCart_T4 || cart.CartType == FreightCartMob.eMinecartType.OreFreighter_T4) { itemID = ItemEntries.MineCartT4; } else if (cart.CartType == 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.UsedStorage.ToString() + "/" + cart.MaxStorage.ToString(), Color.white, cartlabel, ycursor); ycursor += 60; }
public void Read(NetIncomingMessage message) { // Track Networks this.NetworkCount = message.ReadInt32(); this.NetworkStats = new List <TrackNetworkStats>(this.NetworkCount); for (int n = 0; n < NetworkCount; n++) { TrackNetworkStats stats = new TrackNetworkStats(); stats.Read(message); this.NetworkStats.Add(stats); } // Stations this.StationCount = message.ReadInt32(); if (this.StationCount > 0) { this.Stations = new List <StationStats>(this.StationCount); for (int n = 0; n < StationCount; n++) { StationStats stats = new StationStats(); stats.Read(message); this.Stations.Add(stats); } } ReadRegistries(message, true); ReadRegistries(message, false); // Carts this.CartCount = message.ReadInt32(); if (this.CartCount > 0) { this.Carts = new List <CartStats>(this.CartCount); for (int n = 0; n < CartCount; n++) { CartStats stats = new CartStats(); stats.Read(message); this.Carts.Add(stats); } } // Displayed Cart int count = message.ReadInt32(); CartInventory = new List <ItemBase>(count); for (int n = 0; n < count; n++) { ItemBase item; item = ItemReader(message); if (item != null) { CartInventory.Add(item); } } }
private void DisplayCartInventory(CartStats cart, ref int ycursor, int invxicon, int invlabel) { List <ItemBase> inv = NetworkSync.TrackNetworks.CartInventory; if (inv == null || inv.Count == 0) { this.manager.AddBigLabel("invlabelempty", "No goods from this station", Color.white, invxicon + 15, ycursor); ycursor += 60; } else { int invcount = inv.Count; for (int q = 0; q < invcount; q++) { ItemBase item = inv[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; } } }
private void SpawnTrackNetworks(FreightSystemMonitor monitor) { 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; if (NetworkSync.TrackNetworks == null) { SystemMonitorWindow.RequestTrackNetworks(this.TrackNetworkDisplay, this.StationDisplay, this.CartDisplay, WorldScript.mLocalPlayer, monitor); } //int networkcount = FreightCartManager.instance.GlobalTrackNetworks.Count; if (NetworkSync.TrackNetworks != null && NetworkSync.TrackNetworks.NetworkCount > 0) { for (int n = 0; n < NetworkSync.TrackNetworks.NetworkCount; n++) { TrackNetworkStats network = NetworkSync.TrackNetworks.NetworkStats[n]; if (network == null) { continue; } this.DisplayTrackNetworks(network, n, ref ycursor, trackiconx, trackxoffset, tracklabel); if (this.TrackNetworkDisplay == n) { List <StationStats> stations = NetworkSync.TrackNetworks.Stations; for (int m = 0; m < NetworkSync.TrackNetworks.StationCount; m++) { StationStats station = NetworkSync.TrackNetworks.Stations[m]; this.DisplayStation(station, m, ref ycursor, stationxicon, stationlabel); if (this.StationDisplay == m) { // How do I network this? ... //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()); //} this.DisplayDefSur(ref ycursor, stationlabel); for (int p = 0; p < NetworkSync.TrackNetworks.CartCount; p++) { CartStats cart = NetworkSync.TrackNetworks.Carts[p]; this.DisplayCart(cart, p, ref ycursor, cartlabel, cartxicon); if (p == CartDisplay) { this.DisplayCartInventory(cart, ref ycursor, invxicon, invlabel); } } } } //Insert Tour cart staion listing here } } } else if (WorldScript.mbIsServer || (NetworkSync.TrackNetworks != null && NetworkSync.TrackNetworks.NetworkCount == 0)) { this.manager.AddBigLabel("notracknetworks", "No track networks found...", Color.red, 225, 150); } else { this.manager.AddBigLabel("notracknetworks", "Waiting for server...", Color.red, 225, 150); } }