public override void UpdateMachine(SegmentEntity targetEntity) { TourCartStation station = targetEntity as TourCartStation; //Catch for when the window is called on an inappropriate machine if (station == null) { GenericMachinePanelScript.instance.Hide(); UIManager.RemoveUIRules("Machine"); return; } UIUtil.UIdelay = 0; if (networkredraw) { this.manager.RedrawWindow(); } if (this.SetName || string.IsNullOrEmpty(station.StationName)) { this.Counter++; foreach (char c in Input.inputString) { if (c == "\b"[0]) //Backspace { if (this.EntryString.Length != 0) { this.EntryString = this.EntryString.Substring(0, this.EntryString.Length - 1); } } else if (c == "\n"[0] || c == "\r"[0]) //Enter or Return { TourStationWindow.SetStationName(station, this.EntryString); this.SetName = false; this.EntryString = ""; UIManager.mbEditingTextField = false; UIManager.RemoveUIRules("TextEntry"); return; } else { this.EntryString += c; } } this.manager.UpdateLabel("nameentry", this.EntryString + (this.Counter % 20 > 10 ? "_" : ""), Color.cyan); //dirty = true; return; } }
public static NetworkInterfaceResponse HandleNetworkCommand(Player player, NetworkInterfaceCommand nic) { TourCartStation station = nic.target as TourCartStation; string command = nic.command; if (command != null) { if (command == InterfaceStationName) { TourStationWindow.SetStationName(station, nic.payload); } } return(new NetworkInterfaceResponse { entity = station, inventory = player.mInventory }); }