//request from client bool IMakaoGameHostService.DeletePlayerFromRoom(LeaveTheRoomRequest request) { (bool playerDeleted, bool playerWasHost) = MakaoEngineHostDataPlaceholders.DeletePlayerFromRoom(request); if (request.ClosedWindowType == LeavingTheRoomWindowType.MainWindow) { if (playerDeleted && playerWasHost) { InfoSenderClass Sender = new InfoSenderClass(); Sender.DeleteTheRoom(ClientInfoType.ClosedByHost); } else if (playerDeleted) { InfoSenderClass Sender = new InfoSenderClass(); Sender.StartSendingInfoABoutChangeInCurrentPlayerList(); } } else { InfoSenderClass Sender = new InfoSenderClass(); Sender.DeleteTheRoom(ClientInfoType.PlayerLeftGame); } return(playerDeleted); }
//save image of player 0 - ony an avatar (to WS) bool IMakaoGameHostService.UploadAvatarImagePlayer(MemoryStream input) { try { //deserialize request SaveAvatarRequest request = (SaveAvatarRequest)AvatarSerializerDeserializer.DeserializeFromStream(input); request.AvatarStream.Position = 0; //check if player exists if (CheckIfPlayerExists(request.PlayerNumber)) { //save image in temporary storage place Image img = System.Drawing.Image.FromStream(request.AvatarStream); img.Save(MakaoEngineHostDataPlaceholders.AvatarsLocation + GetProperAvatarName(request.PlayerNumber), ImageFormat.Png); InfoSenderClass Sender = new InfoSenderClass(); Sender.StartSendingInfoABoutChangeInCurrentPlayerList(); return(true); } else { return(false); } } catch (Exception ex) { //log if it turned to be impossible var logger = NLog.LogManager.GetCurrentClassLogger(); logger.Error("Saving image in the Makao Game Host faulted: " + ex.Message); return(false); } }