public override int Poll() { int ret = GCloudVoice_Poll(pollBuf, pollBufLen); if (ret != 0) { if (ret == (int)GCloudVoiceErr.GCLOUD_VOICE_POLL_MSG_NO) { //poll no msg, return succ return(0); } else { Debug.Log("msg"); } return(ret); } pollMsg.clear(); NoticeMessage msg = NoticeMessage_ParseFrom(pollBuf, pollBufLen); if (msg == null) { return((int)GCloudVoiceErr.GCLOUD_VOICE_POLL_MSG_PARSE_ERR); } if (msg.what == (int)NoticeMessageType.MSG_ON_JOINROOM_COMPLETE) { if (OnJoinRoomComplete != null) { Debug.Log("c# poll callback OnJoinRoomComplete not null"); OnJoinRoomComplete((IGCloudVoice.GCloudVoiceCompleteCode)msg.intArg1, msg.strArg, msg.intArg2); } } else if (msg.what == (int)NoticeMessageType.MSG_ON_QUITROOM_COMPLETE) { if (OnQuitRoomComplete != null) { OnQuitRoomComplete((IGCloudVoice.GCloudVoiceCompleteCode)msg.intArg1, msg.strArg, msg.intArg2); } } else if (msg.what == (int)NoticeMessageType.MSG_ON_APPLY_AUKEY_COMPLETE) { if (OnApplyMessageKeyComplete != null) { OnApplyMessageKeyComplete((IGCloudVoice.GCloudVoiceCompleteCode)msg.intArg1); } } else if (msg.what == (int)NoticeMessageType.MSG_ON_UPLOADFILE_COMPLETE) { if (OnUploadReccordFileComplete != null) { OnUploadReccordFileComplete((IGCloudVoice.GCloudVoiceCompleteCode)msg.intArg1, msg.strArg, msg.custom != null ? System.Text.Encoding.Default.GetString(msg.custom, 0, msg.datalen) : ""); } } else if (msg.what == (int)NoticeMessageType.MSG_ON_DOWNFILE_COMPLETE) { if (OnDownloadRecordFileComplete != null) { OnDownloadRecordFileComplete((IGCloudVoice.GCloudVoiceCompleteCode)msg.intArg1, msg.strArg, msg.custom != null ? System.Text.Encoding.Default.GetString(msg.custom, 0, msg.datalen) : ""); } } else if (msg.what == (int)NoticeMessageType.MSG_ON_PLAYFILE_COMPLETE) { if (OnPlayRecordFilComplete != null) { OnPlayRecordFilComplete((IGCloudVoice.GCloudVoiceCompleteCode)msg.intArg1, msg.strArg); } } else if (msg.what == (int)NoticeMessageType.MSG_ON_SPEECH_TO_TEXT) { if (OnSpeechToText != null) { OnSpeechToText((IGCloudVoice.GCloudVoiceCompleteCode)msg.intArg1, msg.strArg, msg.custom != null ? System.Text.Encoding.UTF8.GetString(msg.custom, 0, msg.datalen) : ""); } } else if (msg.what == (int)NoticeMessageType.MSG_ON_MEMBER_VOICE) { if (OnMemberVoice != null) { Array.Clear(memberVoice, 0, memberVoice.Length); int memcount = msg.intArg1; for (int i = 0; i < memcount; i++) { memberVoice [2 * i] = System.BitConverter.ToInt32(pollMsg.custom, 2 * i * 4); memberVoice [2 * i + 1] = System.BitConverter.ToInt32(pollMsg.custom, (2 * i + 1) * 4); } OnMemberVoice(memberVoice, memcount); } } else if (msg.what == (int)NoticeMessageType.MSG_ON_ROOM_OFFLINE) { if (OnStatusUpdate != null) { OnStatusUpdate((IGCloudVoice.GCloudVoiceCompleteCode)msg.intArg1, msg.strArg, msg.intArg2); } } return((int)GCloudVoiceErr.GCLOUD_VOICE_SUCC); }
public void Data(Protocol data) { Loom.QueueOnMainThread(() => { Common.Sumbiting = false; Common.EndCalling(); }); //Debug.Log (data.ToString()); if (data == null) { return; } switch (data.Msgid) { case MessageID.LeaveRoomRsp: if (data.LeaveRoomRsp.Ret == 0) { Loom.QueueOnMainThread(() => { ExitGame(); }); } else { Loom.QueueOnMainThread(() => { Common.TipsOn(PrefabTips, Canvas.gameObject, Common.TipsCantLeave); }); } break; case MessageID.AutoBankerRsp: if (data.AutoBankerRsp.Ret == 0) { } break; case MessageID.SitDownRsp: if (data.SitDownRsp.Ret == 0) { Loom.QueueOnMainThread(() => { SetSeatID(Common.Uid, m_TatgetSeatID); UpdateOrderList(); if (m_TatgetSeatID == 0) { if (GetTablePlayersCount() > 1 && Common.CState == Msg.GameState.Ready) { m_Letplay.SetActive(true); } Common.CAutoBanker = data.SitDownRsp.Autobanker; } if (m_StateManage.GetCulState() == STATE.STATE_BETTING) { m_StateManage.m_StateBetting.SitDown(); } }); } else if (data.SitDownRsp.Ret == ErrorID.SitDownCreditPointsOut) { Loom.QueueOnMainThread(() => { Common.TipsOn(PrefabTips, Canvas.gameObject, Common.TipsCreditMax); }); } else { Loom.QueueOnMainThread(() => { Common.TipsOn(PrefabTips, Canvas.gameObject, Common.TipsSeatWasToken); }); } break; case MessageID.StandUpRsp: if (data.StandUpRsp.Ret == 0) { Loom.QueueOnMainThread(() => { m_StateManage.m_StateBetting.CancelBet(); SetSeatID(Common.Uid, -1); UpdateOrderList(); m_Letplay.SetActive(false); }); } else { Loom.QueueOnMainThread(() => { Common.TipsOn(PrefabTips, Canvas.gameObject, Common.TipsCantStandUp); }); } break; case MessageID.StartGameRsp: if (data.StartGameRsp.Ret == ErrorID.StartGameNotEnoughDiamonds) { Loom.QueueOnMainThread(() => { string names = ""; for (int i = 0; i < data.StartGameRsp.NomoneyUids.Count; i++) { PlayerInfo p = GetPlayerIDForUID(data.StartGameRsp.NomoneyUids[i]); if (p != null) { names += p.Name; if ((data.StartGameRsp.NomoneyUids.Count - (i + 1)) >= 2) { names += ","; } else if ((data.StartGameRsp.NomoneyUids.Count - (i + 1)) == 1) { names += " and "; } } } string str = "Insufficient diamond for " + names + " to resume the game"; Common.ErrorDialog(PrefabDialog, Canvas.gameObject, str); }); } break; case MessageID.BetRsp: if (data.BetRsp.Ret == 0) { Loom.QueueOnMainThread(() => { m_StateManage.m_StateBetting.UpdatePlayerBet(); m_StateManage.m_StateBetting.DCanBetCall(); }); } break; case MessageID.CombineRsp: if (data.CombineRsp.Ret == 0) { Loom.QueueOnMainThread(() => { List <List <uint> > cards = new List <List <uint> > (); foreach (Msg.CardGroup cardg in data.CombineRsp.CardGroups) { List <uint> duan = new List <uint> (cardg.Cards); cards.Add(duan); } m_StateManage.m_StateSorting.SynchPoker(cards); }); } break; case MessageID.GetScoreboardRsp: if (data.GetScoreboardRsp.Ret == 0) { Loom.QueueOnMainThread(() => { List <Msg.ScoreboardItem> list = new List <ScoreboardItem>(); foreach (Msg.ScoreboardItem t in data.GetScoreboardRsp.Items) { list.Add(t); } m_GameConsole.ShowPlayerList(list, m_PlayerListMode); }); } break; case MessageID.CloseResultRsp: if (data.CloseResultRsp.Ret == 0) { Loom.QueueOnMainThread(() => { }); } break; case MessageID.GetRoundHistoryRsp: if (data.GetRoundHistoryRsp.Ret == 0) { Loom.QueueOnMainThread(() => { if (data.GetRoundHistoryRsp.Results.Count <= 0) { return; } Dictionary <int, CSeatResult> LSeatResults = new Dictionary <int, CSeatResult>(); for (int i = 0; i < data.GetRoundHistoryRsp.Results.Count; i++) { Msg.PlayerRoundHistory ps = data.GetRoundHistoryRsp.Results[i]; CSeatResult info = new CSeatResult(); info.SeatID = (int)ps.Result.SeatId; info.Name = ps.Name; info.Avatar = ps.Avatar; info.autowin = ps.Result.Autowin; info.foul = ps.Result.Foul; info.Win = ps.Result.Win; info.Ranks = ps.Result.Ranks; for (int o = 0; o < ps.Result.CardGroups.Count; o++) { Msg.CardGroup cg = ps.Result.CardGroups[o]; info.Pres.Add(cg.Cards); } LSeatResults.Add(info.SeatID, info); } m_GameConsole.ShowHandReview(LSeatResults); }); } break; case MessageID.GameStateNotify: Common.CState = data.GameStateNotify.State; switch (data.GameStateNotify.State) { case Msg.GameState.Ready: Loom.QueueOnMainThread(() => { Common.CPlayed_hands = data.GameStateNotify.PlayedHands; m_StateManage.ChangeState(STATE.STATE_SEAT); if (m_SelfSeatID == 0 && GetTablePlayersCount() > 1) { m_Letplay.SetActive(true); } }); break; case Msg.GameState.Bet: Loom.QueueOnMainThread(() => { Common.CSeatResults.Clear(); Common.CPlayed_hands = data.GameStateNotify.PlayedHands; m_Letplay.SetActive(false); Common.ConfigBetTime = (int)data.GameStateNotify.Countdown / 1000; m_StateManage.ChangeState(STATE.STATE_BETTING); m_StateManage.m_StateBetting.AdjustUIChipControl(); }); break; case Msg.GameState.ConfirmBet: Loom.QueueOnMainThread(() => { m_StateManage.m_StateBetting.ShowConfimBet(); }); break; case Msg.GameState.Deal: Loom.QueueOnMainThread(() => { DealCardsEvent(data.GameStateNotify.DealCards); DealSeatEvent(data.GameStateNotify.DealSeats); m_StateManage.ChangeState(STATE.STATE_DEAL); }); break; case Msg.GameState.Combine: Loom.QueueOnMainThread(() => { if (m_SelfSeatID == 0 || GetPlayerInfoForSeatID(m_SelfSeatID).Bet > 0) { m_StateManage.m_StateBetting.RealExit(); Common.ConfigSortTime = (int)data.GameStateNotify.Countdown / 1000; m_StateManage.ChangeState(STATE.STATE_SORTING); } else { m_GameConsole.ShowWaitingAnime(); } }); break; case Msg.GameState.ConfirmCombine: Loom.QueueOnMainThread(() => { m_StateManage.m_StateSorting.AutoSortConfrm(); }); break; case Msg.GameState.Show: Loom.QueueOnMainThread(() => { m_StateManage.m_StateBetting.RealExit(); m_GameConsole.HideWaitAnime(); ResultEvent(data.GameStateNotify.Result); m_StateManage.ChangeState(STATE.STATE_SHOWHAND); }); break; case Msg.GameState.Result: Loom.QueueOnMainThread(() => { //m_StateManage.m_StateSeat.UpdateSeatScore(); Common.ConfigFinishTime = (int)data.GameStateNotify.Countdown / 1000; m_StateManage.ChangeState(STATE.STATE_FINISH); }); break; } break; case MessageID.SitDownNotify: if (data.SitDownNotify.Type == Msg.SitDownType.Sit) { Loom.QueueOnMainThread(() => { foreach (PlayerInfo p in Common.CPlayers) { if (p.Uid == data.SitDownNotify.Uid) { p.Score = data.SitDownNotify.Score; } } SetSeatID(data.SitDownNotify.Uid, (int)data.SitDownNotify.SeatId); foreach (PlayerInfo p1 in Common.CPlayers) { Debug.Log(p1.Uid + "===============" + p1.SeatID); } UpdateOrderList(); if (m_SelfSeatID == 0 && GetTablePlayersCount() > 1 && Common.CState == Msg.GameState.Ready) { m_Letplay.SetActive(true); } }); } break; case MessageID.StandUpNotify: if (data.StandUpNotify.Reason == StandUpReason.NoActionFor3Hands) { Loom.QueueOnMainThread(() => { if (m_SelfSeatID == 0) { m_FirstSetBanker = false; } if (data.StandUpNotify.Uid == Common.Uid) { Common.ErrorDialog(PrefabDialog, Canvas.gameObject, Common.ErrorOutdue); } }); } else if (data.StandUpNotify.Reason == StandUpReason.CreditPointsOut) { Loom.QueueOnMainThread(() => { Common.ErrorDialog(PrefabDialog, Canvas.gameObject, Common.ErrorGameCreditMax); }); } Loom.QueueOnMainThread(() => { m_StateManage.m_StateBetting.UpdateChipsUI(GetSeatIDForPlayerID(data.StandUpNotify.Uid), 0); SetSeatID(data.StandUpNotify.Uid, -1); UpdateOrderList(); if (GetTablePlayersCount() <= 1 && Common.CState == Msg.GameState.Ready) { m_Letplay.SetActive(false); } }); break; case MessageID.JoinRoomNotify: Loom.QueueOnMainThread(() => { PlayerInfo p = new PlayerInfo(); p.Uid = data.JoinRoomNotify.Uid; p.Name = data.JoinRoomNotify.Name; p.FB_avatar = data.JoinRoomNotify.Avatar; p.SeatID = -1; Common.CPlayers.Add(p); foreach (PlayerInfo p1 in Common.CPlayers) { Debug.Log(p1.Uid + "===============" + p1.SeatID); } }); break; case MessageID.KickNotify: Loom.QueueOnMainThread(() => { if (data.KickNotify.Type == Msg.KickType.StopServer) { Common.ErrorDialog(PrefabDialog, Canvas.gameObject, Common.ErrorKickGame, Common.CloseServerDialog); } else { Common.CloseServerDialog(null); } }); break; case MessageID.NoticesNotify: Loom.QueueOnMainThread(() => { foreach (Msg.Notice s in data.NoticesNotify.Notices) { if (s.Type == Msg.NoticeType.HorseLamp) { NoticeMessage nm = new NoticeMessage(); nm.text = s.Content; nm.times = 3; Common.GameNotices.Add(nm); } else { Common.ErrorDialog(PrefabDialog, Canvas.gameObject, s.Content); } } NoticeBar.OnPlay(); }); break; case MessageID.LeaveRoomNotify: Loom.QueueOnMainThread(() => { LeaveRoomEvent(data.LeaveRoomNotify.Uid); if (GetTablePlayersCount() <= 1 && Common.CState == Msg.GameState.Ready) { m_Letplay.SetActive(false); } }); break; case MessageID.BetNotify: Loom.QueueOnMainThread(() => { m_StateManage.m_StateBetting.UpdateChipsUI((int)data.BetNotify.SeatId, (int)data.BetNotify.Chips); }); break; } }
private SendResponse CreateNoticeMessageFromNotifyRequest(NotifyRequest request, string sender, out NoticeMessage noticeMessage) { if (request == null) { throw new ArgumentNullException("request"); } var recipientProvider = request.NotifySource.GetRecipientsProvider(); var recipient = request.Recipient as IDirectRecipient; var addresses = recipient.Addresses; if (addresses == null || !addresses.Any()) { addresses = recipientProvider.GetRecipientAddresses(request.Recipient as IDirectRecipient, sender, request.ObjectID); recipient = new DirectRecipient(request.Recipient.ID, request.Recipient.Name, addresses); } recipient = recipientProvider.FilterRecipientAddresses(recipient); noticeMessage = request.CreateMessage(recipient); addresses = recipient.Addresses; if (addresses == null || !addresses.Any(a => !string.IsNullOrEmpty(a))) { //checking addresses return(new SendResponse(request.NotifyAction, sender, recipient, new NotifyException(string.Format("For recipient {0} by sender {1} no one addresses getted.", recipient, sender)))); } var pattern = request.GetSenderPattern(sender); if (pattern == null) { return(new SendResponse(request.NotifyAction, sender, recipient, new NotifyException(String.Format("For action \"{0}\" by sender \"{1}\" no one patterns getted.", request.NotifyAction, sender)))); } noticeMessage.Pattern = pattern; noticeMessage.ContentType = pattern.ContentType; noticeMessage.AddArgument(request.Arguments.ToArray()); var patternProvider = request.NotifySource.GetPatternProvider(); var formatter = patternProvider.GetFormatter(pattern); try { if (formatter != null) { formatter.FormatMessage(noticeMessage, noticeMessage.Arguments); } sysTagFormatter.FormatMessage( noticeMessage, new[] { new TagValue(Context._SYS_RECIPIENT_ID, request.Recipient.ID), new TagValue(Context._SYS_RECIPIENT_NAME, request.Recipient.Name), new TagValue(Context._SYS_RECIPIENT_ADDRESS, addresses != null && addresses.Length > 0 ? addresses[0] : null) } ); //Do styling here if (!string.IsNullOrEmpty(pattern.Styler)) { //We need to run through styler before templating StyleMessage(noticeMessage); } } catch (Exception exc) { return(new SendResponse(request.NotifyAction, sender, recipient, exc)); } return(null); }
private static string GetImagePath(NoticeMessage message) { var imagePathTag = message.GetArgument("ImagePath"); return(imagePathTag == null ? string.Empty : (string)imagePathTag.Value); }
private static MailWhiteLabelSettings GetMailSettings(NoticeMessage message) { var mailWhiteLabelTag = message.GetArgument("MailWhiteLabelSettings"); return(mailWhiteLabelTag == null ? null : mailWhiteLabelTag.Value as MailWhiteLabelSettings); }
public void ApplyFormating(NoticeMessage message) { var template = NotifyTemplateResource.HtmlMaster; var isPersonalTmpl = false; var output = new StringBuilderTextileFormatter(); var formatter = new TextileFormatter(output); if (!string.IsNullOrEmpty(message.Subject)) { message.Subject = VelocityArguments.Replace(message.Subject, m => m.Result("${arg}")); } if (string.IsNullOrEmpty(message.Body)) { return; } formatter.Format(message.Body); var isPersonal = message.GetArgument("IsPersonal"); if (isPersonal != null && (string)isPersonal.Value == "true") { isPersonalTmpl = true; } var templateTag = message.GetArgument("MasterTemplate"); if (templateTag != null) { var templateTagValue = templateTag.Value as string; if (!string.IsNullOrEmpty(templateTagValue)) { var templateValue = NotifyTemplateResource.ResourceManager.GetString(templateTagValue); if (!string.IsNullOrEmpty(templateValue)) { template = templateValue; } } } string logoImg; if (isPersonalTmpl) { logoImg = "https://static.onlyoffice.com/media/newsletters/images/mail_logo.png"; } else { logoImg = ConfigurationManager.AppSettings["web.logo.mail"]; if (String.IsNullOrEmpty(logoImg)) { var logo = message.GetArgument("LetterLogo"); if (logo != null && (string)logo.Value != "") { logoImg = (string)logo.Value; } else { logoImg = "https://static.onlyoffice.com/media/newsletters/images/mail_logo.png"; } } } var logoText = ConfigurationManager.AppSettings["web.logotext.mail"]; if (String.IsNullOrEmpty(logoText)) { var llt = message.GetArgument("LetterLogoText"); if (llt != null && (string)llt.Value != "") { logoText = (string)llt.Value; } else { logoText = TenantWhiteLabelSettings.DefaultLogoText; } } var mailWhiteLabelTag = message.GetArgument("MailWhiteLabelSettings"); var mailWhiteLabelSettings = mailWhiteLabelTag == null ? null : mailWhiteLabelTag.Value as MailWhiteLabelSettings; message.Body = template.Replace("%CONTENT%", output.GetFormattedText()) .Replace("%LOGO%", logoImg) .Replace("%LOGOTEXT%", logoText) .Replace("%SITEURL%", mailWhiteLabelSettings == null ? MailWhiteLabelSettings.DefaultMailSiteUrl : mailWhiteLabelSettings.SiteUrl); var footer = message.GetArgument("Footer"); var partner = message.GetArgument("Partner"); var footerContent = string.Empty; var footerSocialContent = string.Empty; if (partner != null) { footerContent = partner.Value.ToString(); } if (String.IsNullOrEmpty(footerContent) && footer != null) { switch ((string)footer.Value) { case "common": InitCommonFooter(mailWhiteLabelSettings, out footerContent, out footerSocialContent); break; case "personal": footerSocialContent = NotifyTemplateResource.FooterSocial; break; case "freecloud": footerContent = NotifyTemplateResource.FooterFreeCloud; footerSocialContent = NotifyTemplateResource.FooterSocial; break; case "opensource": footerContent = NotifyTemplateResource.FooterOpensource; footerSocialContent = NotifyTemplateResource.FooterSocial; break; } } message.Body = message.Body .Replace("%FOOTER%", footerContent) .Replace("%FOOTERSOCIAL%", footerSocialContent); var text = ""; if (ConfigurationManager.AppSettings["core.base-domain"] != "localhost") { var noUnsubscribeLink = message.GetArgument("noUnsubscribeLink"); if (noUnsubscribeLink == null || (string)noUnsubscribeLink.Value == "false") { var isHosted = ConfigurationManager.AppSettings["core.payment-partners-hosted"]; if (String.IsNullOrEmpty(isHosted) || isHosted == "false") { var mail = message.Recipient.Addresses.FirstOrDefault(r => r.Contains("@")); var domain = ConfigurationManager.AppSettings["web.teamlab-site"]; var site = string.IsNullOrEmpty(domain) ? "http://www.onlyoffice.com" : domain; var link = site + string.Format("/Unsubscribe.aspx?id={0}", HttpServerUtility.UrlTokenEncode( Security.Cryptography.InstanceCrypto.Encrypt( Encoding.UTF8.GetBytes(mail.ToLowerInvariant())))); text = string.Format(NotifyTemplateResource.TextForFooterWithUnsubscribe, link); } } text += string.Format(NotifyTemplateResource.TextForFooter, DateTime.UtcNow.Year, string.Empty); } message.Body = message.Body.Replace("%TEXTFOOTER%", text); }
private static string GetAnalytics(NoticeMessage message) { var analyticsTag = message.GetArgument("Analytics"); return(analyticsTag == null ? string.Empty : (string)analyticsTag.Value); }
void CheckEvents() { LinkedListNode <BaseObjectMessage> objMessageNode; LinkedListNode <BaseObjectMessage> objMessageNodeNext; BaseObjectMessage baseObjectMessage; PlayerObject playerObject = null; PlayerController playerController = null; objMessageNode = delayedMessages.First; while (objMessageNode != null) { objMessageNodeNext = objMessageNode.Next; if (objMessageNode.Value.timemark <= remoteTimestamp) { switch (objMessageNode.Value.eventCode) { case 2: SpawnObjectMessage spawnObjectMessage = (SpawnObjectMessage)objMessageNode.Value; gameNetwork.RpcSpawnObject(spawnObjectMessage.objectId, spawnObjectMessage.objectType, spawnObjectMessage.newPosition, spawnObjectMessage.newVelocity, spawnObjectMessage.newAcceleration, spawnObjectMessage.newTorsion, spawnObjectMessage.newFloat, spawnObjectMessage.visualId); break; case 3: DestroyObjectMessage destroyObjectMessage = (DestroyObjectMessage)objMessageNode.Value; gameNetwork.RpcDestroyObject(destroyObjectMessage.objectId); break; case 4: MoveObjectMessage moveObjectMessage = (MoveObjectMessage)objMessageNode.Value; gameNetwork.RpcMoveObject(moveObjectMessage.objectId, moveObjectMessage.newPosition, moveObjectMessage.newVelocity, moveObjectMessage.newAcceleration, moveObjectMessage.newTorsion, moveObjectMessage.newFloat, moveObjectMessage.timestamp); break; case 10: NoticeMessage noticeMessage = (NoticeMessage)objMessageNode.Value; //Debug.Log("NOTICE MESSAGE: " + noticeMessage.numericValue + " ; " + noticeMessage.color + " ; " + noticeMessage.floating + " ; " + noticeMessage.offset); string noticeText = ""; if (noticeMessage.color == 0) { noticeText += "+"; } else { noticeText += "-"; } if (noticeMessage.prefixMessage != -1) { noticeText += " " + langNotices[noticeMessage.prefixMessage]; } if (noticeMessage.numericValue != 0) { noticeText += " " + noticeMessage.numericValue; } if (noticeMessage.suffixMessage != -1) { noticeText += " " + langNotices[noticeMessage.suffixMessage]; } gameNetwork.RpcShowNotice(noticeMessage.id, noticeText, noticeMessage.offset, noticeMessage.color, noticeMessage.floating); break; case 11: Debug.Log("@ INVOKE FLASH PASSIVE ABILITY[" + objMessageNode.Value.id + "]"); gameNetwork.RpcFlashPassiveAbility(objMessageNode.Value.id); break; case 13: VisualEffectMessage visualEffectMessage = (VisualEffectMessage)objMessageNode.Value; gameNetwork.RpcVisualEffect(visualEffectMessage.id, visualEffectMessage.invokerId, visualEffectMessage.targetId, visualEffectMessage.targetPosition, visualEffectMessage.direction, visualEffectMessage.duration); break; } delayedMessages.Remove(objMessageNode); } objMessageNode = objMessageNodeNext; } }
void OnEvent(byte eventCode, object content, int senderId) { int i; BaseObjectMessage baseObjectMessage; PlayerObject playerObject = null; PlayerController playerController = null; //Debug.Log("RECEIVE EVENT[" + eventCode + "] from [" + senderId + "]"); switch (eventCode) { case 1: baseObjectMessage = new BaseObjectMessage(); baseObjectMessage.Unpack((byte[])content); remoteTimestamp = baseObjectMessage.timemark; gameNetwork.ClientInit(); gameNetwork.playerId = baseObjectMessage.id; Debug.Log("INITIALIZE PLAYER ID: " + gameNetwork.playerId); /* duplicate for GameNetwork RpcSpawnObject case PLAYER */ playerObject = (PlayerObject)gameNetwork.location.GetObject(gameNetwork.playerId); if (playerObject != null) { camera.transform.position = playerObject.position * 100.0f + Vector3.up * 20.0f; if (gameNetwork.playerId == 1) { camera.transform.eulerAngles = new Vector3(camera.transform.eulerAngles.x, 180.0f, camera.transform.eulerAngles.z); } } playerObject = (PlayerObject)gameNetwork.location.GetObject(gameNetwork.playerId == 1 ? 0 : 1); if (playerObject != null && playerObject.visualObject == null) { playerController = (Instantiate(gameNetwork.bodyPrefabs[0])).GetComponent <PlayerController>(); playerController.gameNetwork = gameNetwork; playerController.obj = playerObject; playerObject.visualObject = playerController; playerController.transform.position = playerObject.position * 100.0f; //playerController.transform.localScale *= 10.0f; if (playerObject.position.z < 0.0f) { playerObject.visualObject.transform.Rotate(0.0f, 180.0f, 0.0f); } } /* */ canvasPlay.enabled = true; InitializeMessage initializeMessage = new InitializeMessage(); for (i = 1; i < AbilityButtons.Length; i++) { if (AbilityButtons[i].image.color == Color.green) { if (initializeMessage.abilityFirstId <= -1) { initializeMessage.abilityFirstId = i; } else { initializeMessage.abilitySecondId = i; } } } gameNetwork.myMissileId = armedMissile.GetCurrentMissile(); initializeMessage.missileId = gameNetwork.myMissileId; for (i = 1; i < VenomButtons.Length; i++) { if (VenomButtons[i].image.color == Color.green) { initializeMessage.venomId = i; } } PhotonNetwork.networkingPeer.OpCustom((byte)1, new Dictionary <byte, object> { { 245, initializeMessage.Pack() } }, true); break; case 2: SpawnObjectMessage spawnObjectMessage = new SpawnObjectMessage(); spawnObjectMessage.Unpack((byte[])content); //Debug.Log(Time.fixedTime + " Spawn." + spawnObjectMessage.objectType + " [" + spawnObjectMessage.id + "]"); spawnObjectMessage.eventCode = eventCode; delayedMessages.AddLast(spawnObjectMessage); //gameNetwork.RpcSpawnObject(spawnObjectMessage.id, spawnObjectMessage.objectType, spawnObjectMessage.newPosition, spawnObjectMessage.newFloat, spawnObjectMessage.visualId); break; case 3: DestroyObjectMessage destroyObjectMessage = new DestroyObjectMessage(); destroyObjectMessage.Unpack((byte[])content); //Debug.Log(Time.fixedTime + " Destroy [" + destroyObjectMessage.id + "]: " + destroyObjectMessage.objectId); destroyObjectMessage.eventCode = eventCode; delayedMessages.AddLast(destroyObjectMessage); //gameNetwork.RpcDestroyObject(destroyObjectMessage.id); break; case 4: MoveObjectMessage moveObjectMessage = new MoveObjectMessage(); moveObjectMessage.Unpack((byte[])content); //Debug.Log(Time.fixedTime + " Move [" + moveObjectMessage.id + "]"); moveObjectMessage.eventCode = eventCode; delayedMessages.AddLast(moveObjectMessage); //gameNetwork.RpcMoveObject(moveObjectMessage.id, moveObjectMessage.newPosition, moveObjectMessage.newFloat, moveObjectMessage.timestamp); break; case 5: UpdatePlayerMessage updatePlayerMessage = new UpdatePlayerMessage(); updatePlayerMessage.Unpack((byte[])content); //Debug.Log("Player[" + updatePlayerMessage.id + "] health: " + updatePlayerMessage.newHealth + " ; stamina: " + updatePlayerMessage.newStamina); gameNetwork.RpcUpdatePlayer(updatePlayerMessage.id, updatePlayerMessage.newHealth, updatePlayerMessage.newStamina, updatePlayerMessage.newStaminaConsumption); break; case 6: gameNetwork.RpcRearmMissile(); break; case 7: baseObjectMessage = new BaseObjectMessage(); baseObjectMessage.Unpack((byte[])content); gameNetwork.RpcFlashPlayer(baseObjectMessage.id); break; case 8: GameOverMessage gameOverMessage = new GameOverMessage(); gameOverMessage.Unpack((byte[])content); gameNetwork.RpcGameOver(gameOverMessage.winner, gameOverMessage.time, gameOverMessage.damage, gameOverMessage.wound); gameNetwork = GameObject.Instantiate(gameNetworkPrefab).GetComponent <GameNetwork>(); gameNetwork.camera = camera; gameNetwork.gameMatchMaker = this; gameNetwork.isServer = false; gameNetwork.isLocal = false; break; case 9: SetAbilityMessage setAbilityMessage = new SetAbilityMessage(); setAbilityMessage.Unpack((byte[])content); gameNetwork.RpcSetAbility(setAbilityMessage.id, setAbilityMessage.value); break; case 10: NoticeMessage noticeMessage = new NoticeMessage(); noticeMessage.Unpack((byte[])content); //Debug.Log("GET NOTICE MESSAGE. timemark: " + noticeMessage.timemark + " ; numericValue: " + noticeMessage.numericValue); noticeMessage.eventCode = eventCode; delayedMessages.AddLast(noticeMessage); break; case 11: baseObjectMessage = new BaseObjectMessage(); baseObjectMessage.Unpack((byte[])content); Debug.Log("RECEIVE FLASH PASSIVE ABILITY. timemark: " + baseObjectMessage.timemark); baseObjectMessage.eventCode = eventCode; delayedMessages.AddLast(baseObjectMessage); break; case 12: baseObjectMessage = new BaseObjectMessage(); baseObjectMessage.Unpack((byte[])content); //Debug.Log("FLASH OBSTRUCTION[" + baseObjectMessage.id + "]. timemark: " + baseObjectMessage.timemark); gameNetwork.RpcFlashObstruction(baseObjectMessage.id); break; case 13: VisualEffectMessage visualEffectMessage = new VisualEffectMessage(); visualEffectMessage.Unpack((byte[])content); Debug.Log("VISUAL EFFECT [" + visualEffectMessage.id + "]. targetId: " + visualEffectMessage.targetId); visualEffectMessage.eventCode = eventCode; delayedMessages.AddLast(visualEffectMessage); break; case 14: PingMessage pingMessage = new PingMessage(); PingMessage newPingMessage; pingMessage.Unpack((byte[])content); if (pingMessage.time == 0.0f) { newPingMessage = new PingMessage(remoteTimestamp, pingMessage.timemark); PhotonNetwork.networkingPeer.OpCustom((byte)4, new Dictionary <byte, object> { { 245, newPingMessage.Pack() } }, true); } else { remoteTimestamp = pingMessage.timemark + pingMessage.time / 2.0f; } break; } }
public void ApplyFormating(NoticeMessage message) { bool isPromoTmpl = false; var output = new StringBuilderTextileFormatter(); var formatter = new TextileFormatter(output); if (!string.IsNullOrEmpty(message.Subject)) { message.Subject = VelocityArguments.Replace(message.Subject, m => m.Result("${arg}")); } if (!string.IsNullOrEmpty(message.Body)) { formatter.Format(message.Body); var isPromo = message.GetArgument("isPromoLetter"); if (isPromo != null && (string)isPromo.Value == "true") { isPromoTmpl = true; } var logoImg = ""; if (isPromoTmpl) { logoImg = "http://cdn.teamlab.com/media/newsletters/images/logo.png"; } else { logoImg = ConfigurationManager.AppSettings["web.logo.mail"]; if (String.IsNullOrEmpty(logoImg)) { var logo = message.GetArgument("LetterLogo"); if (logo != null && (string)logo.Value != "") { logoImg = (string)logo.Value; } else { logoImg = "http://cdn.teamlab.com/media/newsletters/images/header_08.png"; } } } var template = isPromoTmpl ? Resources.TemplateResource.HtmlMasterPromo : Resources.TemplateResource.HtmlMaster; message.Body = template.Replace("%CONTENT%", output.GetFormattedText()).Replace("%LOGO%", logoImg); var footer = message.GetArgument("WithPhoto"); var partner = message.GetArgument("Partner"); var res = String.Empty; if (partner != null) { res = partner.Value.ToString(); } if (String.IsNullOrEmpty(res) && footer != null) { switch ((string)footer.Value) { case "photo": res = Resources.TemplateResource.FooterWithPhoto; break; case "links": res = Resources.TemplateResource.FooterWithLinks; break; case "personal": res = Resources.TemplateResource.FooterPersonal; break; default: res = String.Empty; break; } } message.Body = message.Body.Replace("%FOOTER%", res); var text = ""; var noUnsubscribeLink = message.GetArgument("noUnsubscribeLink"); if (noUnsubscribeLink == null || (string)noUnsubscribeLink.Value == "false") { var isHosted = ConfigurationManager.AppSettings["core.payment-partners-hosted"]; if (String.IsNullOrEmpty(isHosted) || isHosted == "false") { var mail = message.Recipient.Addresses.FirstOrDefault(r => r.Contains("@")); var domain = ConfigurationManager.AppSettings["web.teamlab-site"]; var site = string.IsNullOrEmpty(domain) ? "http://www.onlyoffice.com" : domain; var link = site + string.Format("/Unsubscribe.aspx?id={0}", HttpServerUtility.UrlTokenEncode(Security.Cryptography.InstanceCrypto.Encrypt(Encoding.UTF8.GetBytes(mail.ToLowerInvariant())))); text = string.Format(Resources.TemplateResource.TextForFooterWithUnsubscribe, link); } } text += string.Format(Resources.TemplateResource.TextForFooter, DateTime.UtcNow.Year, string.Empty); message.Body = message.Body.Replace("%TEXTFOOTER%", text); } }
void OnMouseDown() { PlayerPrefs.SetInt("SaveSlot" + SlotNumber, 1); PlayerPrefs.SetInt("Slot" + SlotNumber + "Year", Var.Year); PlayerPrefs.SetInt("Slot" + SlotNumber + "Month", Var.Month); if (Var.Day == "초") { PlayerPrefs.SetInt("Slot" + SlotNumber + "Day", 1); } else if (Var.Day == "중") { PlayerPrefs.SetInt("Slot" + SlotNumber + "Day", 2); } else { PlayerPrefs.SetInt("Slot" + SlotNumber + "Day", 3); } if (Var.MenuActivated == true) { PlayerPrefs.SetInt("Slot" + SlotNumber + "MenuActivated", 1); } else { PlayerPrefs.SetInt("Slot" + SlotNumber + "MenuActivated", 0); } PlayerPrefs.SetInt("Slot" + SlotNumber + "Semester", Var.Semester); PlayerPrefs.SetInt("Slot" + SlotNumber + "PjStan", Var.PjStan); PlayerPrefs.SetFloat("Slot" + SlotNumber + "Money", Var.Money); PlayerPrefs.SetInt("Slot" + SlotNumber + "Fame", Var.Fame); PlayerPrefs.SetInt("Slot" + SlotNumber + "Members", Var.Mems.Count); PlayerPrefs.SetInt("Slot" + SlotNumber + "RoomLV", Var.Mng.RoomObject.Level); PlayerPrefs.SetInt("Slot" + SlotNumber + "WBLV", Var.Mng.Wb.Level); PlayerPrefs.SetInt("Slot" + SlotNumber + "CPULV", Var.Mng.Cpu.Level); PlayerPrefs.SetInt("Slot" + SlotNumber + "SBLV", Var.Mng.Sb.Level); PlayerPrefs.SetInt("Slot" + SlotNumber + "CpsLV", Var.Mng.Cps.Level); PlayerPrefs.SetInt("Slot" + SlotNumber + "BGLV", Var.Mng.Bg.Level); PlayerPrefs.SetInt("Slot" + SlotNumber + "TVLV", Var.Mng.Tv.Level); PlayerPrefs.SetInt("Slot" + SlotNumber + "GameLV", Var.Mng.Gm.Level); PlayerPrefs.SetInt("Slot" + SlotNumber + "BookLV", Var.Mng.Bk.Level); PlayerPrefs.SetInt("Slot" + SlotNumber + "CookLV", Var.Mng.Ck.Level); PlayerPrefs.SetInt("Slot" + SlotNumber + "PiaLV", Var.Mng.Pia.Level); for (int i = 0; i < 7; i++) { PlayerPrefs.SetInt("Slot" + SlotNumber + "AchTimes" + i, Var.AchTimesList[i]); } for (int i = 0; i < 24; i++) { if (Var.AchBoolList[i] == true) { PlayerPrefs.SetInt("Slot" + SlotNumber + "AchBool" + i, 1); } else { PlayerPrefs.SetInt("Slot" + SlotNumber + "AchBool" + i, 0); } } for (int Order = 0; Order < Var.MaleNameList.Count; Order++) { string NameConvert = System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(Var.MaleNameList[Order])); PlayerPrefs.SetString("Slot" + SlotNumber + "MaleName" + Order, NameConvert); } for (int Order = 0; Order < Var.FemaleNameList.Count; Order++) { string NameConvert = System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(Var.FemaleNameList[Order])); PlayerPrefs.SetString("Slot" + SlotNumber + "FemaleName" + Order, NameConvert); } foreach (Character Mem in Var.Mems) { string NameConvert = System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(Mem.Name)); PlayerPrefs.SetString("Slot" + SlotNumber + "Name" + Mem.MemberNumber, NameConvert); PlayerPrefs.SetInt("Slot" + SlotNumber + "Gender" + Mem.MemberNumber, BoolToInt(Mem.Gender)); PlayerPrefs.SetInt("Slot" + SlotNumber + "Plan" + Mem.MemberNumber, Mem.Abilities[0]); PlayerPrefs.SetInt("Slot" + SlotNumber + "Programming" + Mem.MemberNumber, Mem.Abilities[1]); PlayerPrefs.SetInt("Slot" + SlotNumber + "Art" + Mem.MemberNumber, Mem.Abilities[2]); PlayerPrefs.SetInt("Slot" + SlotNumber + "Sound" + Mem.MemberNumber, Mem.Abilities[3]); PlayerPrefs.SetInt("Slot" + SlotNumber + "Loyalty" + Mem.MemberNumber, Mem.Loyalty); PlayerPrefs.SetInt("Slot" + SlotNumber + "Number" + Mem.MemberNumber, Mem.MemberNumber); PlayerPrefs.SetInt("Slot" + SlotNumber + "PrevAct1" + Mem.MemberNumber, ActionToInt(Mem.PrevAct1)); PlayerPrefs.SetInt("Slot" + SlotNumber + "PrevAct2" + Mem.MemberNumber, ActionToInt(Mem.PrevAct2)); PlayerPrefs.SetInt("Slot" + SlotNumber + "Talent" + Mem.MemberNumber, TalentToInt(Mem.Tal)); PlayerPrefs.SetInt("Slot" + SlotNumber + "UnTalent" + Mem.MemberNumber, TalentToInt(Mem.UnTal)); PlayerPrefs.SetInt("Slot" + SlotNumber + "Controllable" + Mem.MemberNumber, BoolToInt(Mem.Controllable)); PlayerPrefs.SetInt("Slot" + SlotNumber + "UnControllableDuration" + Mem.MemberNumber, Mem.UnControllableDuration); PlayerPrefs.SetInt("Slot" + SlotNumber + "DoubleBuff" + Mem.MemberNumber, BoolToInt(Mem.DoubleBuff)); PlayerPrefs.SetInt("Slot" + SlotNumber + "BuffDuration" + Mem.MemberNumber, Mem.BuffDuration); for (int i = 0; i < Var.Mems.Count; i++) { PlayerPrefs.SetInt("Slot" + SlotNumber + "RelationShip" + Mem.MemberNumber + "." + i, Mem.Relationship[i]); } PlayerPrefs.SetInt("Slot" + SlotNumber + "Special" + Mem.MemberNumber, BoolToInt(Mem.Special)); if (Mem.Special == false) { SaveHairInfo(Mem); PlayerPrefs.SetFloat("Slot" + SlotNumber + "HairR" + Mem.MemberNumber, Mem.HairR); PlayerPrefs.SetFloat("Slot" + SlotNumber + "HairG" + Mem.MemberNumber, Mem.HairG); PlayerPrefs.SetFloat("Slot" + SlotNumber + "HairB" + Mem.MemberNumber, Mem.HairB); PlayerPrefs.SetFloat("Slot" + SlotNumber + "ShirtsR" + Mem.MemberNumber, Mem.ShirtsR); PlayerPrefs.SetFloat("Slot" + SlotNumber + "ShirtsG" + Mem.MemberNumber, Mem.ShirtsG); PlayerPrefs.SetFloat("Slot" + SlotNumber + "ShirtsB" + Mem.MemberNumber, Mem.ShirtsB); PlayerPrefs.SetFloat("Slot" + SlotNumber + "PantsR" + Mem.MemberNumber, Mem.PantsR); PlayerPrefs.SetFloat("Slot" + SlotNumber + "PantsG" + Mem.MemberNumber, Mem.PantsG); PlayerPrefs.SetFloat("Slot" + SlotNumber + "PantsB" + Mem.MemberNumber, Mem.PantsB); PlayerPrefs.SetInt("Slot" + SlotNumber + "Violence" + Mem.MemberNumber, Mem.Violence); PlayerPrefs.SetInt("Slot" + SlotNumber + "Emotion" + Mem.MemberNumber, Mem.Emotion); PlayerPrefs.SetInt("Slot" + SlotNumber + "Strategy" + Mem.MemberNumber, Mem.Strategy); PlayerPrefs.SetInt("Slot" + SlotNumber + "Control" + Mem.MemberNumber, Mem.Control); PlayerPrefs.SetInt("Slot" + SlotNumber + "Liberty" + Mem.MemberNumber, Mem.Liberty); PlayerPrefs.SetInt("Slot" + SlotNumber + "Puzzle" + Mem.MemberNumber, Mem.Puzzle); PlayerPrefs.SetInt("Slot" + SlotNumber + "Simplity" + Mem.MemberNumber, Mem.Simplity); PlayerPrefs.SetInt("Slot" + SlotNumber + "Story" + Mem.MemberNumber, Mem.Story); } } PlayerPrefs.SetInt("Slot" + SlotNumber + "DinCnt", Var.DrkCnt); PlayerPrefs.SetInt("Slot" + SlotNumber + "MTCnt", Var.MTCnt); PlayerPrefs.SetInt("Slot" + SlotNumber + "TutorialPass", BoolToInt(Var.TutorialPass)); Debug.Log("Saved."); Notice = Instantiate(SaveNoticePf) as NoticeMessage; Notice.NoticeType = NoticeMessage.NoticeTypes.SaveMessage; Destroy(Parent.gameObject); }
public async Task NoticeMessageHandlerAsync(NoticeMessage noticeMessage) { Console.WriteLine("通知信息未处理"); }