void assignCombobox_ItemSelected(MyCubeGrid grid, MyPlayer.PlayerId playerId) { ulong steamId = playerId.SteamId; var identity = MySession.Static.Players.TryGetPlayerIdentity(playerId); if (identity == null) { Debug.Fail("Transfering grid to nonexistent player."); return; } if (grid.IsTransferBlocksBuiltByIDPossible(MySession.Static.LocalPlayerId, identity.IdentityId)) { var messageBox = MyGuiSandbox.CreateMessageBox( styleEnum: Graphics.GUI.MyMessageBoxStyleEnum.Info, buttonType: MyMessageBoxButtonsType.YES_NO, messageText: new StringBuilder().AppendFormat(MyTexts.GetString(MyCommonTexts.MessageBoxTextConfirmTransferGrid), new object[] { grid.DisplayName, identity.DisplayName }), messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionPleaseConfirm), canHideOthers: false, callback: (result) => { if (result == MyGuiScreenMessageBox.ResultEnum.YES) { if (MySession.Static.Players.GetOnlinePlayers().Contains(MySession.Static.Players.GetPlayerById(playerId))) { MyMultiplayer.RaiseEvent(grid, x => x.SendTransferRequestMessage, MySession.Static.LocalPlayerId, identity.IdentityId, steamId); } else { ShowPlayerNotOnlineMessage(identity); } } }); MyGuiSandbox.AddScreen(messageBox); } else { var messageBox = MyGuiSandbox.CreateMessageBox( buttonType: MyMessageBoxButtonsType.OK, messageText: new StringBuilder().AppendFormat(MyCommonTexts.MessageBoxTextNotEnoughFreeBlocksForTransfer, identity.DisplayName), messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError), canHideOthers: false ); MyGuiSandbox.AddScreen(messageBox); } }