public void OnClick() { //Show the conveyor belt build menu if (entry.Name.Equals("Conveyor Belt")) { UIManager.BuildMenu.ShowConveyorBeltMenu(entry, buildingMaterial); return; } RequestBuildMessage.Send(entry, buildingMaterial); UIManager.BuildMenu.CloseBuildMenu(); }
/// <summary> /// Request constructing the given entry /// </summary> /// <param name="entry">entry to build</param> /// <param name="hasMenu">has construction menu component of the object being used to /// construct.</param> /// <returns></returns> public static RequestBuildMessage Send(BuildList.Entry entry, BuildingMaterial hasMenu) { int entryIndex = hasMenu.BuildList.Entries.ToList().IndexOf(entry); if (entryIndex == -1) { return(null); // entryIndex was previously a byte, which made this check impossible. } RequestBuildMessage msg = new RequestBuildMessage { EntryIndex = (byte)entryIndex }; msg.Send(); return(msg); }
/// <summary> /// Request constructing the given entry /// </summary> /// <param name="entry">entry to build</param> /// <param name="hasMenu">has construction menu component of the object being used to /// construct.</param> /// <returns></returns> public static RequestBuildMessage Send(BuildList.Entry entry, BuildingMaterial hasMenu) { byte entryIndex = (byte)hasMenu.BuildList.Entries.ToList().IndexOf(entry); if (entryIndex == -1) { return(null); } RequestBuildMessage msg = new RequestBuildMessage { EntryIndex = entryIndex }; msg.Send(); return(msg); }
public void OnClick() { RequestBuildMessage.Send(entry, buildingMaterial); UIManager.BuildMenu.CloseBuildMenu(); }