static void ShareBlueprintRequest(ref ShareBlueprintMsg msg, MyNetworkClient sender) { if (Sync.IsServer && msg.SendToId != Sync.MyId) { Sync.Layer.SendMessage(ref msg, msg.SendToId); } else { var itemId = msg.WorkshopId; var name = msg.Name; var info = new MyBlueprintItemInfo(MyBlueprintTypeEnum.SHARED, id: itemId); var item = new MyGuiControlListbox.Item(new StringBuilder(name.ToString()), userData: info, icon: MyGuiConstants.TEXTURE_BLUEPRINTS_ARROW.Normal); item.ColorMask = new Vector4(0.7f); if (!m_recievedBlueprints.Any(item2 => (item2.UserData as MyBlueprintItemInfo).PublishedItemId == (item.UserData as MyBlueprintItemInfo).PublishedItemId)) { m_recievedBlueprints.Add(item); m_blueprintList.Add(item); if (sender != null) { var notification = new MyHudNotificationDebug(sender.DisplayName + " just shared a blueprint with you.", 2500); MyHud.Notifications.Add(notification); } } } }
void OnSendToPlayer() { var msg = new ShareBlueprintMsg(); msg.WorkshopId = (ulong)m_publishedItemId; msg.Name = m_blueprintName; var playerId = (ulong)m_sendToCombo.GetSelectedKey(); Sync.Layer.SendMessage(ref msg, playerId); }