/// <summary> /// Plays a sound. /// </summary> /// <param name="id">The ChannelId identifing the SoundManger playing the sound and the channel number.</param> /// <param name="buffer">A SecondaryBuffer containing the sound to be playing.</param> /// <param name="frequencymultiplier">The multiplier applied the sound to change its pitch. 1.0f for no change.</param> /// <param name="looping">Whether the sound should loop automatically until stopped.</param> /// <param name="volume">The volume level of the sound.</param> public void Play(ChannelId id, SecondaryBuffer buffer, Single frequencymultiplier, Boolean looping, Int32 volume) { if (buffer == null) throw new ArgumentNullException("buffer"); if (volume > (Int32)Volume.Max || volume < (Int32)Volume.Min) throw new ArgumentOutOfRangeException("volume"); Stop(); m_usingid = id; m_buffer = buffer; BufferPlayFlags flags = (looping == true) ? BufferPlayFlags.Looping : BufferPlayFlags.Default; m_buffer.Frequency = (Int32)(m_buffer.Frequency * frequencymultiplier); m_buffer.SetCurrentPosition(0); m_buffer.Pan = (Int32)Pan.Center; m_buffer.Volume = volume; m_playflags = flags; try { m_buffer.Play(0, flags); } catch { } }
/// <summary> /// Initializes a new instance of the <see cref="BayeuxClientChannel"/> class /// with the specified <see cref="ChannelId"/>. /// </summary> public BayeuxClientChannel(BayeuxClient session, ChannelId channelId) : base(channelId) { if (null == session) throw new ArgumentNullException("session"); _bayeuxClient = session; }
/// <summary> /// Creates a new instance of this class. /// </summary> public Channel() { m_buffer = null; m_panning = 0; m_paused = false; m_playflags = BufferPlayFlags.Default; m_usingid = new ChannelId(); }
public Task ExecuteAsync( PostId newPostId, ChannelId channelId, ValidComment content, DateTime?sheduledPostDate, QueueId queueId, ValidPreviewText previewText, FileId previewImageId, IReadOnlyList <FileId> fileIds, int previewWordCount, int wordCount, int imageCount, int fileCount, int videoCount, DateTime now) { newPostId.AssertNotNull("newPostId"); content.AssertNotNull("content"); channelId.AssertNotNull("channelId"); var post = new Post( newPostId.Value, channelId.Value, null, queueId == null ? (Guid?)null : queueId.Value, null, previewImageId == null ? (Guid?)null : previewImageId.Value, null, previewText == null ? null : previewText.Value, content.Value, previewWordCount, wordCount, imageCount, fileCount, videoCount, default(DateTime), // Live date assigned by sub-statements. now); var postFiles = fileIds.EmptyIfNull().Select(v => new PostFile(newPostId.Value, v.Value)).ToList(); if (queueId != null) { return(this.subStatements.QueuePostAsync(post, postFiles)); } return(this.subStatements.SchedulePostAsync(post, postFiles, sheduledPostDate, now)); }
private static IEnumerable <BacklogPost> GetBacklogPosts() { // 1 in 3 chance of coincidental ordering being correct, yielding a false positive when implementation fails to order explicitly. const int Days = 3; const int ChannelCount = 3; const int CollectionsPerChannel = 3; const int Posts = 6; var result = new List <BacklogPost>(); for (var day = 0; day < Days; day++) { var liveDate = new SqlDateTime(Now.AddDays(1 + day)).Value; for (var channelIndex = 0; channelIndex < ChannelCount; channelIndex++) { var channelId = new ChannelId(Guid.NewGuid()); for (var queueInded = 0; queueInded < CollectionsPerChannel; queueInded++) { var queueId = queueInded == 0 ? null : new QueueId(Guid.NewGuid()); for (var i = 0; i < Posts; i++) { result.Add( new BacklogPost( new PostId(Guid.NewGuid()), channelId, i % 2 == 0 ? queueId : null, i % 2 == 0 ? PreviewText : null, i % 3 == 2 ? new FileId(Guid.NewGuid()) : null, i % 2 == 0 ? PreviewText.Value.Length : 0, i % 2 == 0 ? PreviewText.Value.Length : 0, i % 3 == 2 ? 1 : 0, i % 3 == 1 ? 1 : 0, i, liveDate, i % 3 == 2 ? FileName : null, i % 3 == 2 ? FileExtension : null, i % 3 == 2 ? FileSize : (long?)null, i % 3 == 2 ? FileWidth : (int?)null, i % 3 == 2 ? FileHeight : (int?)null, liveDate)); } } } } return(result); }
public async Task ExecuteAsync(UserId userId, ChannelId channelId) { userId.AssertNotNull("userId"); channelId.AssertNotNull("channelId"); using (var transaction = TransactionScopeBuilder.CreateAsync()) { using (var connection = this.connectionFactory.CreateConnection()) { await connection.ExecuteAsync(DeleteStatement, new { ChannelId = channelId.Value, UserId = userId.Value }); } await this.requestSnapshot.ExecuteAsync(userId, SnapshotType.SubscriberChannels); transaction.Complete(); } }
public async Task MarkRead() { if (!Messages.Any()) { return; } var ts = (Messages[0].Ts + 1).ToString(); if (ChannelId.StartsWith("D")) { await _slackClient.MarkImChannel(ChannelId, ts); } else { await _slackClient.MarkChannel(ChannelId, ts); } }
public override void Decode(BinaryReader br) { SrcChannelId = new ChannelId(br.ReadBytes(4)); while (br.BaseStream.Position < br.BaseStream.Length) { var protocolType = (ProtocolTypes)br.ReadByte(); var protocolObject = ProtocolTypesHelper.GetObject(protocolType); protocolObject.Decode(br); _options.Add(protocolObject); if (protocolType == ProtocolTypes.EndOption) { break; } } }
public async ValueTask <string> GetChannelNameWithCacheAsync(ChannelId channelId) { var strChannelId = channelId.ToString(); var cached = _channelNameCacheRepository.FindById(strChannelId); if (cached == null) { var info = await GetChannelInfo(channelId); cached = new ChannelEntity() { ChannelId = strChannelId, ScreenName = info.ScreenName }; _channelNameCacheRepository.UpdateItem(cached); } return(cached.ScreenName); }
public async Task <IEnumerable <PermissionOverrideDto> > HandleAsync(GetChannelMemberPermissionOverridesQuery query) { var channels = await _context.Channels.ToListAsync(); return(await _context.Channels .AsNoTracking() .Where(x => x.GroupId == GroupId.From(query.GroupId)) .Where(x => x.Id == ChannelId.From(query.ChannelId)) .SelectMany(x => x.MemberPermissionOverrides) .Where(x => x.UserIdOfMember == UserId.From(query.MemberUserId)) .Select( x => new PermissionOverrideDto { Permission = x.Permission.Name, Type = x.Type == OverrideType.Allow ? OverrideTypeDto.Allow : OverrideTypeDto.Deny } ).ToListAsync()); }
private void OnClientLeftView(object sender, IEnumerable<ClientLeftView> e) { bool changed = false; bool newChannel = false; foreach (var leftView in e) { if (leftView.ClientId == Id) { Channel = leftView.TargetChannelId; _ids.Clear(); changed = true; newChannel = true; } else if (leftView.SourceChannelId == Channel) { OnUserLeaveChannel(leftView.ClientId); changed = true; } } if (changed) InvokeOnChannelChanged(newChannel); }
public override int GetHashCode() { int hash = 1; if (HostName.Length != 0) hash ^= HostName.GetHashCode(); if (HostIp.Length != 0) hash ^= HostIp.GetHashCode(); if (ProcessId != 0) hash ^= ProcessId.GetHashCode(); if (NodeName.Length != 0) hash ^= NodeName.GetHashCode(); if (NodeId != 0UL) hash ^= NodeId.GetHashCode(); if (ChannelName.Length != 0) hash ^= ChannelName.GetHashCode(); if (ChannelId != 0UL) hash ^= ChannelId.GetHashCode(); if (MessageType.Length != 0) hash ^= MessageType.GetHashCode(); if (ProtoDesc.Length != 0) hash ^= ProtoDesc.GetHashCode(); if (Id != 0UL) hash ^= Id.GetHashCode(); if (qosProfile_ != null) hash ^= QosProfile.GetHashCode(); if (socketAddr_ != null) hash ^= SocketAddr.GetHashCode(); if (ServiceName.Length != 0) hash ^= ServiceName.GetHashCode(); if (ServiceId != 0UL) hash ^= ServiceId.GetHashCode(); return hash; }
void UpdateParticipantRoster(IParticipant participant, ChannelId channel, bool isAddParticipant) { if (isAddParticipant) { GameObject newRosterObject = GameObject.Instantiate(rosterItemPrefab, this.gameObject.transform); RosterItem newRosterItem = newRosterObject.GetComponent <RosterItem>(); List <RosterItem> thisChannelList; if (rosterObjects.ContainsKey(channel)) { //Add this object to an existing roster rosterObjects.TryGetValue(channel, out thisChannelList); newRosterItem.SetupRosterItem(participant); thisChannelList.Add(newRosterItem); rosterObjects[channel] = thisChannelList; } else { //Create a new roster to add this object to thisChannelList = new List <RosterItem>(); thisChannelList.Add(newRosterItem); newRosterItem.SetupRosterItem(participant); rosterObjects.Add(channel, thisChannelList); } CleanRoster(channel); } else { if (rosterObjects.ContainsKey(channel)) { RosterItem removedItem = rosterObjects[channel].FirstOrDefault(p => p.Participant.Account.Name == participant.Account.Name); if (removedItem != null) { rosterObjects[channel].Remove(removedItem); Destroy(removedItem.gameObject); CleanRoster(channel); } else { Debug.LogError("Trying to remove a participant that has no roster item."); } } } }
private void VoiceManager_OnParticipantAddedEvent(string username, ChannelId channel, IParticipant participant) { Debug.Log("OnParticipantAdded voiceLogin"); if (channel.Name == _voiceManager.channelName && participant.IsSelf) { // lobby 채널에 join 했고 host가 아니면 호스트에게 초대를 요청해야함 _voiceNetworkManager.SendLobbyUpdate(NetworkManagerHUDWBTB.MatchStatus.Seeking); } player = GameObject.FindGameObjectsWithTag("PlayerList"); _player = new NetworkRoomPlayerWBTB[player.Length]; int i = 0; foreach (var p in player) { _player[i] = p.GetComponent <NetworkRoomPlayerWBTB>(); i++; } }
public async Task <NewBlogResult> PostBlog(NewBlogData blogData) { blogData.AssertBodyProvided("blogData"); var blog = blogData.Parse(); var requester = await this.requesterContext.GetRequesterAsync(); var newBlogId = new BlogId(this.guidCreator.CreateSqlSequential()); var firstChannelId = new ChannelId(this.guidCreator.CreateSqlSequential()); await this.createBlog.HandleAsync(new CreateBlogCommand( requester, newBlogId, firstChannelId, blog.Name, blog.BasePrice)); return(new NewBlogResult(newBlogId, firstChannelId)); }
/// <summary> /// Returns true if ConversationReference instances are equal /// </summary> /// <param name="other">Instance of ConversationReference to be compared</param> /// <returns>Boolean</returns> public bool Equals(ConversationReference other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( ActivityId == other.ActivityId || ActivityId != null && ActivityId.Equals(other.ActivityId) ) && ( User == other.User || User != null && User.Equals(other.User) ) && ( Bot == other.Bot || Bot != null && Bot.Equals(other.Bot) ) && ( Conversation == other.Conversation || Conversation != null && Conversation.Equals(other.Conversation) ) && ( ChannelId == other.ChannelId || ChannelId != null && ChannelId.Equals(other.ChannelId) ) && ( ServiceUrl == other.ServiceUrl || ServiceUrl != null && ServiceUrl.Equals(other.ServiceUrl) )); }
/// <summary> /// Initializes an instance of <see cref="Video"/>. /// </summary> public PlaylistVideo( VideoId id, string title, string author, ChannelId channelId, string description, TimeSpan duration, long viewCount, ThumbnailSet thumbnails) { Id = id; Title = title; Author = author; ChannelId = channelId; Description = description; Duration = duration; ViewCount = viewCount; Thumbnails = thumbnails; }
/// <summary> /// Returns a client side channel scoped by this session. /// </summary> /// <param name="channelId">Specific or wild channel name.</param> /// <param name="create">Whether to create the client session channel if it does not exist.</param> public virtual IClientSessionChannel GetChannel(string channelId, bool create = true) { if (String.IsNullOrEmpty(channelId)) { throw new ArgumentNullException("channelId"); } AbstractSessionChannel channel = null; if ((!_channels.TryGetValue(channelId, out channel) || channel == null) && create) { ChannelId id = this.NewChannelId(channelId); channel = this.NewChannel(id); lock (_channels) _channels[channelId] = channel; } return(channel); }
public async Task HandleAsync(ContextAddedToCapabilityDomainEvent domainEvent) { var capabilities = await _capabilityRepository.GetById(domainEvent.Payload.CapabilityId); var message = CreateMessage(domainEvent, _externalEventMetaDataStore.XCorrelationId); var hardCodedDedChannelId = new ChannelId("GFYE9B99Q"); await _slackFacade.SendNotificationToChannel(hardCodedDedChannelId.ToString(), message); // Send message to Capability Slack channels foreach (var capability in capabilities) { await _slackFacade.SendNotificationToChannel( capability.SlackChannelId.ToString(), $"We're working on setting up your environment. Currently the following resources are being provisioned and are awaiting status updates" + $"\n" + $"{CreateTaskTable(false, false, false)}"); } }
public override void Process(TagHelperContext context, TagHelperOutput output) { output.TagName = "img"; output.TagMode = TagMode.SelfClosing; string imagePath = $"/images/TvChannel_Logos/{ChannelId.ToString()}.gif"; if (_fileProvider.GetFileInfo("/wwwroot" + imagePath).Exists) { output.Attributes.SetAttribute("src", imagePath); } else { output.Attributes.SetAttribute("src", "/images/TvChannel_Logos/nologo.gif"); } output.Attributes.SetAttribute("alt", ChannelName); }
public void JoinChannel(string channelName, bool IsAudio, bool IsText, bool switchTransmission, ChannelType channelType) { ChannelId channelId = new ChannelId(vivox.issuer, channelName, vivox.domain, channelType); vivox.channelSession = vivox.loginSession.GetChannelSession(channelId); Bind_Channel_Callback_Listeners(true, vivox.channelSession); Bind_User_Callbacks(true, vivox.channelSession); Bind_Group_Message_Callbacks(true, vivox.channelSession); if (IsAudio) { vivox.channelSession.PropertyChanged += On_Audio_State_Changed; } if (IsText) { vivox.channelSession.PropertyChanged += On_Text_State_Changed; } vivox.channelSession.BeginConnect(IsAudio, IsText, switchTransmission, vivox.channelSession.GetConnectToken(vivox.tokenKey, vivox.timeSpan), ar => { try { vivox.channelSession.EndConnect(ar); } catch (Exception e) { Bind_Channel_Callback_Listeners(false, vivox.channelSession); Bind_User_Callbacks(false, vivox.channelSession); Bind_Group_Message_Callbacks(false, vivox.channelSession); if (IsAudio) { vivox.channelSession.PropertyChanged -= On_Audio_State_Changed; } if (IsText) { vivox.channelSession.PropertyChanged -= On_Text_State_Changed; } Debug.Log(e.Message); } }); }
private static void parseIncomingData(byte[] data, IPEndPoint peerAddress) { using (MemoryStream ms = new MemoryStream(data)) using (BinaryReader br = new BinaryReader(ms)) { var destChannelId = new ChannelId(br.ReadBytes(4)); while (ms.Length > ms.Position) { var msgType = (MessageTypes)br.ReadByte(); Console.WriteLine("Incoming {0} from: {1}", msgType, peerAddress); switch (msgType) { case MessageTypes.HANDSHAKE: handleIncomingHandshake(br, peerAddress); break; case MessageTypes.HAVE: handleIncomingHave(br, peerAddress, destChannelId); break; /*case MessageTypes.DATA: * handleIncomingData(br, peerAddress); * break; * case MessageTypes.PEX_RES4: * new PexRes4().Decode(br); * break; * case MessageTypes.INTEGRITY: * new Integrity().Decode(br); * break; * case MessageTypes.SIGNED_INTEGRITY: * new SignedIntegrity().Decode(br); * break;*/ default: Console.WriteLine("Unhandled msg type: {0} !!!", msgType); break; } } } }
public async Task <IHttpActionResult> PutChannelAsync(string channelId, [FromBody] UpdatedChannelData channelData) { channelId.AssertUrlParameterProvided("channelId"); channelData.AssertBodyProvided("channelData"); var channel = channelData.Parse(); var requester = await this.requesterContext.GetRequesterAsync(); var channelIdObject = new ChannelId(channelId.DecodeGuid()); await this.updateChannel.HandleAsync( new UpdateChannelCommand( requester, channelIdObject, channel.Name, channel.Price, channel.IsVisibleToNonSubscribers)); return(this.Ok()); }
public void Logout() { if (_state == LoginState.LoggedIn || _state == LoginState.LoggingIn) { var request = new vx_req_account_logout_t(); request.account_handle = _accountHandle; VxClient.Instance.BeginIssueRequest(request, null); _presenceSubscriptions.Clear(); _allowedSubscriptions.Clear(); _blockedSubscriptions.Clear(); _channelSessions.Clear(); _directedMessages.Clear(); _failedDirectedMessages.Clear(); _incomingSubscriptionRequests.Clear(); _transmittingSession = null; VxClient.Instance.EventMessageReceived -= Instance_EventMessageReceived; // Specifically do not change the property in a way that raises an event _state = LoginState.LoggedOut; } }
public async Task PutChannelSubscription(string channelId, [FromBody] ChannelSubscriptionDataWithoutChannelId subscriptionData) { channelId.AssertUrlParameterProvided("channelId"); subscriptionData.AssertBodyProvided("subscriptionData"); var requester = await this.requesterContext.GetRequesterAsync(); var channelIdObject = new ChannelId(channelId.DecodeGuid()); var parsedSubscriptionData = subscriptionData.Parse(); var acceptedPrice = parsedSubscriptionData.AcceptedPrice; var now = this.timestampCreator.Now(); await this.subscribeToChannel.HandleAsync(new SubscribeToChannelCommand( requester, channelIdObject, acceptedPrice, now)); }
public BlobLocation GetBlobLocation(ChannelId channelId, FileId fileId, string filePurpose) { fileId.AssertNotNull("fileId"); filePurpose.AssertNotNull("filePurpose"); var purpose = FilePurposes.TryGetFilePurpose(filePurpose); if (purpose == null) { throw new BadRequestException("Unknown file purpose."); } if (purpose.IsPublic) { return(new BlobLocation(Constants.PublicFileBlobContainerName, fileId.Value.EncodeGuid())); } channelId.AssertNotNull("channelId"); return(new BlobLocation(this.GetBlobContainerName(channelId), fileId.Value.EncodeGuid())); }
private async Task TestCommandHandler(FileId fileId, ChannelId channelId, UserId requester, string filePath, string purpose, string blobContainerName, string expectedFileName, string expectedExtension, string expectedPurpose) { if (channelId != null) { this.channelSecurity.Setup(v => v.AssertWriteAllowedAsync(UserId, ChannelId)) .Returns(Task.FromResult(0)); } this.blobNameCreator.Setup(v => v.GetBlobLocation(channelId, fileId, purpose)) .Returns(new BlobLocation(blobContainerName, string.Empty)); this.addNewFileDbStatement.Setup(v => v.ExecuteAsync(fileId, requester, channelId, expectedFileName, expectedExtension, expectedPurpose, It.IsAny <DateTime>())) .Returns(Task.FromResult(0)) .Verifiable(); await this.target.HandleAsync(new InitiateFileUploadCommand(Requester, channelId, fileId, filePath, purpose)); this.blobService.Verify(); this.addNewFileDbStatement.Verify(); }
public void JoinChannel(string channelName, bool IsAudio, bool IsText, bool switchTransmission, ChannelType channelType) { ChannelId channelId = new ChannelId(issuer, channelName, domain, channelType); channelSession = loginSession.GetChannelSession(channelId); Bind_Channel_Callback_Listeners(true, channelSession); channelSession.BeginConnect(IsAudio, IsText, switchTransmission, channelSession.GetConnectToken(tokenKey, timeSpan), ar => { try { channelSession.EndConnect(ar); } catch (Exception e) { Bind_Channel_Callback_Listeners(false, channelSession); Debug.Log(e.Message); } }); }
public async Task <ChannelId> PostChannelAsync(NewChannelData newChannelData) { newChannelData.AssertBodyProvided("newChannel"); var newChannel = newChannelData.Parse(); var requester = await this.requesterContext.GetRequesterAsync(); var newChannelId = new ChannelId(this.guidCreator.CreateSqlSequential()); await this.createChannel.HandleAsync( new CreateChannelCommand( requester, newChannelId, newChannel.BlogId, newChannel.Name, newChannel.Price, newChannel.IsVisibleToNonSubscribers)); return(newChannelId); }
public async Task <Message> SendAsync(SendableMessage data) { // Cache the string values var id = Id.ToString(); var channel = ChannelId.ToString(); // Retrieve the previous message var previous = await Client.Cache.EditableMessages.GetAsync(id, channel); Message response; // If a previous message exists... if (previous != null) { // Then we check whether or not it's editable (has no attachments), and we're not sending attachments if (Attachments.Length == 0 && data.File == null) { // We update the message and return. response = From(Client, await Client.Rest.Channels[channel] .Messages[previous.OwnMessageId.ToString()] .PatchAsync <Spectacles.NET.Types.Message>(data)); response.GuildId = GuildId; return(response); } // Otherwise we delete the previous message and do a fallback. await Client.Rest.Channels[channel].Messages[previous.OwnMessageId.ToString()].DeleteAsync(); } // Send a message to Discord, receive a Message back. response = From(Client, await Client.Rest.Channels[channel].Messages.PostAsync <Spectacles.NET.Types.Message>(data)); response.GuildId = GuildId; // Store the message into Redis for later processing. await Client.Cache.EditableMessages.SetAsync( new EditableMessage(Client, Id, response.Id), channel); // Return the response. return(response); }
public async Task ItShouldStopProcessingWhenCancelled() { var channelIds = Enumerable.Repeat(0, 5).Select(v => ChannelId.Random()).ToList(); this.getAllChannelIds.Setup(v => v.ExecuteAsync()).ReturnsAsync(channelIds); var blobClient = new Mock <ICloudBlobClient>(MockBehavior.Strict); this.cloudStorageAccount.Setup(v => v.CreateCloudBlobClient()) .Returns(blobClient.Object); var segment1 = new Mock <IContainerResultSegment>(MockBehavior.Strict); var continuationToken = new BlobContinuationToken(); segment1.Setup(v => v.ContinuationToken).Returns(continuationToken); var container1 = new Mock <ICloudBlobContainer>(MockBehavior.Strict); var container2 = new Mock <ICloudBlobContainer>(MockBehavior.Strict); var container3 = new Mock <ICloudBlobContainer>(MockBehavior.Strict); segment1.Setup(v => v.Results).Returns( new List <ICloudBlobContainer> { container1.Object, container2.Object, container3.Object, }); var cts = new CancellationTokenSource(); // Fails delete condition. container1.Setup(v => v.Name).Returns("NotAGuid").Callback(cts.Cancel); blobClient.Setup(v => v.ListContainersSegmentedAsync(null)).ReturnsAsync(segment1.Object); this.keepAliveHandler.Setup(v => v.KeepAliveAsync()).Returns(Task.FromResult(0)); await this.target.ExecuteAsync(new Mock <ILogger>().Object, this.keepAliveHandler.Object, EndTimeExclusive, cts.Token); this.keepAliveHandler.Verify(v => v.KeepAliveAsync(), Times.Exactly(1)); }
private void ChannelOrderInsert(ChannelId id, ChannelId newOrder, ChannelId parent) { // [ C:7 | O:_ ] // [ <── (New: C:5 | O:7) // [ C:_ | O:7 ] (Upd: O -> 5) // or // [ C:_ | O:_ ] // ├ [ <── (New: C:5 | O:0) // └ [ C:_ | O:0 ] (Upd: O -> 5) // Multiple channel with Order:0 might exist, // we need to find one with the same parent as the inserted channel var chan = Channels.Values.FirstOrDefault(x => x.Order == newOrder && x.Parent == parent); if (chan != null) { chan.Order = id; } }
private async Task <List <IIdentityEquatable> > CreateEntitiesAsync(TestDatabaseContext testDatabase) { var random = new Random(); using (var connection = testDatabase.CreateConnection()) { var expectedDeletions = new List <IIdentityEquatable>(); await this.AddUser(connection, random, UserId.Random(), IncludedDate, false); expectedDeletions.AddRange(await this.AddUser(connection, random, TestUserId1, IncludedDate, true)); var channelId = new ChannelId(expectedDeletions.OfType <Channel>().First().Id); expectedDeletions.AddRange(await this.AddUser(connection, random, TestUserId2, IncludedDate, true, TestUserId1, channelId)); var nonDeletedUserEntities = await this.AddUser(connection, random, TestUserId3, EndDate, true, TestUserId1, channelId); expectedDeletions.AddRange(nonDeletedUserEntities.OfType <ChannelSubscription>()); // Files shouldn't be deleted. return(expectedDeletions.Where(v => !(v is File)).ToList()); } }
void OnPrivateChannelIconUp() { LoggerHelper.Debug("PrivateChannel"); MogoUIManager.Instance.SwitchPrivateChannelUI(); m_iCurrentChannel = ChannelId.PERSONAL; }
/// <summary> /// Retrieves a speficied Channel for playing a sound. /// </summary> /// <param name="id">Identifier for the requested Channel.</param> /// <returns>The Channel current playing with the supplied identifier. If no Channel is found, than any available Channel is returned. If there are no available channels, then null.</returns> public Channel GetChannel(ChannelId id) { if (id == new ChannelId()) throw new ArgumentException("id"); if (id.Number == -1) { foreach (Channel channel in m_channels) { if (channel.IsPlaying == false) return channel; } } else { foreach (Channel channel in m_channels) { if (channel.UsingId == id) return channel; } foreach (Channel channel in m_channels) { if (channel.IsPlaying == false) return channel; } } return null; }
void OnPrivateTalkButtonUp() { CommunityUIViewManager.Instance.EmptyChatUIInput(); LoggerHelper.Debug("PrivateTalk"); CommunityUIViewManager.Instance.ShowAddFriendTip(false); CommunityUIViewManager.Instance.AddChatUIInputText("@" + m_dictIDToName[m_strSenderId] + " : "); m_iPrivateTalkHead = 1 + m_dictIDToName[m_strSenderId].Length + 3; MogoUIManager.Instance.SwitchPrivateChannelUI(); m_iCurrentChannel = ChannelId.PERSONAL; m_strFriendId = m_strSenderId; }
void OnWorldChannelIconUp() { LoggerHelper.Debug("WorldChannel"); MogoUIManager.Instance.SwitchWorldChannelUI(); m_iCurrentChannel = ChannelId.WORLD; }
/// <summary> /// Initializes a new instance of the <see cref="AbstractSessionChannel"/> class /// with the specified <see cref="ChannelId"/>. /// </summary> /// <param name="id">Holder of a channel id broken into path segments.</param> protected AbstractSessionChannel(ChannelId id) { if (null == id) throw new ArgumentNullException("id"); _id = id; }
public Servo this[ChannelId channelId] { get { return this[(int)channelId]; } }
/// <summary> /// 设置频道图标 /// </summary> /// <param name="channel"></param> /// <param name="spChannel"></param> void SetChatUIDialogLabelChannel(ChannelId channel, UISprite spChannel) { if (spChannel == null) return; switch (channel) { case ChannelId.WORLD: spChannel.spriteName = "lt_sj"; break; case ChannelId.UNION: spChannel.spriteName = "lt_gh"; break; case ChannelId.PERSONAL: spChannel.spriteName = "lt_sl"; break; case ChannelId.SYSTEM: spChannel.spriteName = "lt_xt"; break; } }
public double? this[ChannelId channelId] { get { return this[(int)channelId]; } set { this[(int)channelId] = value; } }
/// <summary> /// 添加一条聊天信息 /// </summary> /// <param name="text">聊天信息显示的内容</param> /// <param name="channel">聊天信息放至的频道</param> /// <param name="userId">发送玩家的ID</param> /// <param name="channelIcon">聊天信息发送的频道,用于显示频道图标</param> /// <param name="LvAndNameString">聊天信息的人名,用于计算下划线的长度</param> /// <param name="underLineColor">人名下划线颜色</param> /// <param name="lineOffsetX">人名下划线偏移,自己向别的玩家的私聊信息需处理</param> public void AddChatUIDialogText(string text, ChannelId channel, ulong userId, ChannelId channelIcon, string LvAndNameString = "", string underLineColor = "13FFD5", int lineOffsetX = 60) { string name = "WorldChannelDialogLabelList"; int m_iLineNum = 0; int m_iSpaceNum = 0; Camera relatedCam = m_camWorldChannelCamera; AssetCacheMgr.GetUIInstance("ChatUIDialogLabel.prefab", (prefab, id, go) => { GameObject obj = (GameObject)go; UILabel lblChatUIDialogLabelText = obj.transform.FindChild("ChatUIDialogLabelText").GetComponentsInChildren<UILabel>(true)[0]; lblChatUIDialogLabelText.effectStyle = UILabel.Effect.Outline; UISprite spChatUIDialogLabelChannel = obj.transform.FindChild("ChatUIDialogLabelChannel").GetComponentsInChildren<UISprite>(true)[0]; SetChatUIDialogLabelChannel(channelIcon, spChatUIDialogLabelChannel); // 设置下划线 UILabel lblChatUIDialogLabelUnderLine = obj.transform.FindChild("ChatUIDialogLabelUnderLine").GetComponentsInChildren<UILabel>(true)[0]; float totalUnderline = m_inputText.label.font.CalculatePrintedSize(LvAndNameString, true, UIFont.SymbolStyle.None).x; float oneUnderLine = m_inputText.label.font.CalculatePrintedSize("_", true, UIFont.SymbolStyle.None).x; int underLineCount = (int)(totalUnderline / oneUnderLine); lblChatUIDialogLabelUnderLine.text = ""; for (int i = 0; i < underLineCount; i++) { lblChatUIDialogLabelUnderLine.text += "_"; } // 设置下划线颜色 lblChatUIDialogLabelUnderLine.text = string.Concat("[", underLineColor, "]", lblChatUIDialogLabelUnderLine.text, "[-]"); switch (channel) { case ChannelId.WORLD: name = "WorldChannelDialogLabelList"; m_iLineNum = m_iLineNumWorld; m_iSpaceNum = m_iSpaceNumWorld; relatedCam = m_camWorldChannelCamera; lblChatUIDialogLabelText.effectColor = new Color32(32, 19, 14, 255); break; case ChannelId.UNION: name = "TongChannelDialogLabelList"; m_iLineNum = m_iLineNumTong; m_iSpaceNum = m_iSpaceNumTong; relatedCam = m_camTongChannelCamera; lblChatUIDialogLabelText.effectColor = new Color32(0, 0, 0, 255); break; case ChannelId.PERSONAL: name = "PrivateChannelDialogLabelList"; m_iLineNum = m_iLineNumPrivate; m_iSpaceNum = m_iSpaceNumPrivate; relatedCam = m_camPrivateChannelCamera; lblChatUIDialogLabelText.effectColor = new Color32(13, 0, 16, 255); lblChatUIDialogLabelUnderLine.transform.localPosition = new Vector3(lineOffsetX, lblChatUIDialogLabelUnderLine.transform.localPosition.y, lblChatUIDialogLabelUnderLine.transform.localPosition.z); break; case ChannelId.SYSTEM: name = "WorldChannelDialogLabelList"; m_iLineNum = m_iLineNumWorld; m_iSpaceNum = m_iSpaceNumWorld; relatedCam = m_camWorldChannelCamera; lblChatUIDialogLabelText.effectColor = new Color32(0, 0, 0, 255); break; } obj.SetActive(true); obj.transform.parent = m_myTransform.FindChild(m_widgetToFullName[name]); obj.transform.parent.localScale = new Vector3(0.0008f, 0.0008f, 1); obj.transform.localPosition = Vector3.zero; obj.transform.localScale = new Vector3(1, 1, 1); obj.transform.GetComponentsInChildren<MyDragCamera>(true)[0].RelatedCamera = relatedCam; string strTmp = text; for (int i = 0; i < text.Length; ++i) { if (text[i] == '<' && text.Substring(i).Length >= 6 && text.Substring(i, 6) == "<info=") { int tmp = i + 7; while (tmp < text.Length) { if (text[tmp] == '>') { float length = m_inputText.label.font.CalculatePrintedSize(text.Substring(0, i), true, UIFont.SymbolStyle.None).x; string originString = text.Substring(i, tmp - i + 1); text = text.ReplaceFirst(originString, TranslateInputText(originString)); AddChatUIEquipmentLabel(TranslateInputText(originString), obj.transform.FindChild("ChatUIDialogLabelSLList"), (g) => { float width = m_inputText.label.font.size * length; int row = (int)((width + m_fOffect) / LINEWIDTH); float labelWidth = m_inputText.label.font.CalculatePrintedSize(TranslateInputText(originString), true, UIFont.SymbolStyle.None).x * m_inputText.label.font.size; if ((width + m_fOffect) + labelWidth > LINEWIDTH * (row + 1)) { m_iAddSpaceNum = (int)((LINEWIDTH * (row + 1) - (width + m_fOffect)) / (m_inputText.label.font.CalculatePrintedSize(" ", true, UIFont.SymbolStyle.None).x * m_inputText.label.font.size)); //m_fOffect += m_inputText.label.font.CalculatePrintedSize(" ", true, UIFont.SymbolStyle.None).x * // m_inputText.label.font.size; for (int j = 0; j < m_iAddSpaceNum; ++j) { text = text.Insert(i + j, " "); } width += (m_iAddSpaceNum * m_inputText.label.font.CalculatePrintedSize(" ", true, UIFont.SymbolStyle.None).x * m_inputText.label.font.size); m_fOffect += (LINEWIDTH * (row + 1) - (width + m_fOffect)); width += m_fOffect; } else { //width = width + m_fOffect - m_iAddSpaceNum * (m_inputText.label.font.CalculatePrintedSize(" ", true, UIFont.SymbolStyle.None).x * // m_inputText.label.font.size); width += m_fOffect; } //else //{ // width += m_fOffect; //} //g.transform.localPosition = new Vector3(obj.transform.localPosition.x + // width % 750, // obj.transform.localPosition.y - (int)(width / 750) * // 35, obj.transform.localPosition.z); //g.transform.localPosition = new Vector3(obj.transform.localPosition.x + //m_inputText.label.font.size * length % 750, // obj.transform.localPosition.y - (int)(m_inputText.label.font.size * length / 750) * //m_inputText.label.font.size, obj.transform.localPosition.z); //g.transform.GetComponentsInChildren<ChatUIEquipmentGrid>(true)[0].LogicText = originString; //g.transform.localPosition = new Vector3(obj.transform.localPosition.x + // width % LINEWIDTH, // obj.transform.localPosition.y - (int)(width / LINEWIDTH) * m_inputText.label.font.size, obj.transform.localPosition.z);//这里改成0 - ... g.transform.localPosition = new Vector3(obj.transform.localPosition.x + width % LINEWIDTH, 0 - (int)(width / LINEWIDTH) * m_inputText.label.font.size, obj.transform.localPosition.z); g.transform.GetComponentsInChildren<ChatUIEquipmentGrid>(true)[0].LogicText = originString; }); break; } ++tmp; } } else if (text[i] == '<' && text.Substring(i).Length >= 6 && text.Substring(i, 6) == "<face=") { int tmp = i + 7; while (tmp < text.Length) { if (text[tmp] == '>') { float length = m_inputText.label.font.CalculatePrintedSize(text.Substring(0, i), true, UIFont.SymbolStyle.None).x; string originString = text.Substring(i, tmp - i + 1); text = text.ReplaceFirst(originString, /*TranslateInputText(originString)*/" "); AddChatUIFaceLabel(TranslateInputText(originString), obj.transform.FindChild("ChatUIDialogLabelSLList"), (g) => { float width = m_inputText.label.font.size * length; int row = (int)((width + m_fOffect) / LINEWIDTH); if ((width + m_fOffect) + FONTSIZE > LINEWIDTH * (row + 1)) { m_fOffect += (LINEWIDTH * (row + 1) - (width + m_fOffect)); width = width + m_fOffect; } else { width += m_fOffect; } g.transform.localPosition = new Vector3(obj.transform.localPosition.x + width % LINEWIDTH, obj.transform.localPosition.y - (int)(width / LINEWIDTH) * FONTSIZE, obj.transform.localPosition.z); }); break; } ++tmp; } } else { float length = m_inputText.label.font.CalculatePrintedSize(text.Substring(0, i), true, UIFont.SymbolStyle.None).x; float width = m_inputText.label.font.size * length; int row = (int)((width + m_fOffect) / LINEWIDTH); float labelWidth = m_inputText.label.font.CalculatePrintedSize(text[i].ToString(), true, UIFont.SymbolStyle.None).x * m_inputText.label.font.size; if ((width + m_fOffect) + labelWidth > LINEWIDTH * (row + 1)) { // m_iAddSpaceNum = (int)((LINEWIDTH * (row + 1) - (width + m_fOffect)) / //(m_inputText.label.font.CalculatePrintedSize(" ", // true, UIFont.SymbolStyle.None).x * m_inputText.label.font.size)); m_fOffect += (LINEWIDTH * (row + 1) - (width + m_fOffect)); //width += m_fOffect; } //else //{ // width += m_fOffect; //}*/ } } lblChatUIDialogLabelText.text = text; lblChatUIDialogLabelText.supportEncoding = true; obj.transform.localPosition = new Vector3(0, 0 - FONTSIZE * m_iLineNum - FONTSPACE * m_iSpaceNum, 0); obj.transform.GetComponentsInChildren<BoxCollider>(true)[0].size = new Vector3(obj.transform.GetComponentsInChildren<BoxCollider>(true)[0].size.x, obj.transform.GetComponentsInChildren<BoxCollider>(true)[0].size.y * ((int)(m_inputText.label.font.CalculatePrintedSize(text, true, UIFont.SymbolStyle.None).x * FONTSIZE / LINEWIDTH) + 1), obj.transform.GetComponentsInChildren<BoxCollider>(true)[0].size.z); obj.transform.GetComponentsInChildren<BoxCollider>(true)[0].center = new Vector3(obj.transform.GetComponentsInChildren<BoxCollider>(true)[0].center.x, obj.transform.GetComponentsInChildren<BoxCollider>(true)[0].center.y - ((int)(m_inputText.label.font.CalculatePrintedSize(text, true, UIFont.SymbolStyle.None).x * FONTSIZE / LINEWIDTH)) * 0.5f * FONTSIZE, obj.transform.GetComponentsInChildren<BoxCollider>(true)[0].center.z); obj.GetComponentsInChildren<CommunityUIDialogLabel>(true)[0].ID = userId; m_iLineNum += ((int)(m_inputText.label.font.CalculatePrintedSize(text, true, UIFont.SymbolStyle.None).x * FONTSIZE / LINEWIDTH) + 1); relatedCam.GetComponentsInChildren<MyDragableCamera>(true)[0].MINY = -192 - (FONTSIZE * m_iLineNum + m_iSpaceNum * FONTSPACE) + 406; CommunityLabelInfo info = new CommunityLabelInfo(); info.height = FONTSIZE * ((int)(m_inputText.label.font.CalculatePrintedSize(text, true, UIFont.SymbolStyle.None).x * FONTSIZE / LINEWIDTH) + 1); info.go = obj; m_queueChatData.Enqueue(info); if (m_queueChatData.Count > 50) { CommunityLabelInfo infoTmp = m_queueChatData.Dequeue(); AssetCacheMgr.ReleaseInstance(infoTmp.go); //Debug.LogError(infoTmp.height); relatedCam.GetComponentsInChildren<MyDragableCamera>(true)[0].MAXY -= (infoTmp.height + FONTSPACE); } m_iSpaceNum++; //if (text.Length > 7 && (text[0] == '[' && text[7] == ']')) //{ // obj.transform.GetComponentsInChildren<BoxCollider>(true)[0].size = // new Vector3((text.Length - 8 - 2) * 22 + 14, 22, 0); // obj.transform.GetComponentsInChildren<BoxCollider>(true)[0].center = // new Vector3(obj.transform.GetComponentsInChildren<BoxCollider>(true)[0].size.x * 0.5f, 0f, 0f); // m_lblInputText.text += text.Substring(8); //} //else //{ // obj.transform.GetComponentsInChildren<BoxCollider>(true)[0].size = // new Vector3((text.Length - 2) * 22 + 14, 22, 0); // m_lblInputText.text += text; //} switch (channel) { case ChannelId.WORLD: case ChannelId.SYSTEM: m_iLineNumWorld = m_iLineNum; m_iSpaceNumWorld = m_iSpaceNum; break; case ChannelId.UNION: m_iLineNumTong = m_iLineNum; m_iSpaceNumTong = m_iSpaceNum; break; case ChannelId.PERSONAL: m_iLineNumPrivate = m_iLineNum; m_iSpaceNumPrivate = m_iSpaceNum; break; } if ((m_iLineNum * FONTSIZE + m_iSpaceNum * FONTSPACE) > 428) { float offect = ((int)(m_inputText.label.font.CalculatePrintedSize(text, true, UIFont.SymbolStyle.None).x * FONTSIZE / LINEWIDTH) + 1) * FONTSIZE + FONTSPACE; relatedCam.transform.localPosition = new Vector3(relatedCam.transform.localPosition.x, relatedCam.transform.localPosition.y - offect, relatedCam.transform.localPosition.z); } m_listChatUIDialogText.Add(obj); }); m_fOffect = 0; m_iAddSpaceNum = 0; }
/// <summary> /// Creates a new <see cref="AbstractSessionChannel"/> object from the specified channel id. /// </summary> protected override AbstractSessionChannel NewChannel(ChannelId channelId) { if (null == channelId) throw new ArgumentNullException("channelId"); return new BayeuxClientChannel(this, channelId); }
void OnTongChannelIconUp() { LoggerHelper.Debug("TongChannel"); MogoUIManager.Instance.SwitchTongChannelUI(); m_iCurrentChannel = ChannelId.UNION; }
/// <summary> /// Creates a new <see cref="AbstractSessionChannel"/> object from the specified channel id. /// </summary> protected abstract AbstractSessionChannel NewChannel(ChannelId channelId);