当前位置: 首页>>代码示例>>C#>>正文


C# ChatEvent类代码示例

本文整理汇总了C#中ChatEvent的典型用法代码示例。如果您正苦于以下问题:C# ChatEvent类的具体用法?C# ChatEvent怎么用?C# ChatEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ChatEvent类属于命名空间,在下文中一共展示了ChatEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PostEvents

    public void PostEvents(Guid channelID, byte[] mainPasswordHash, ClientEvent[] args)
    {
        var channel = (from ch in Services.DataConnection.Channels
                       where ch.ChannelID == channelID && ch.MainPasswordHash == mainPasswordHash
                       select ch).FirstOrDefault();

        if (channel != null)
        {
            var eventCount = Services.ExistingEvents[channelID].Count;
            if (eventCount > 50)
            {
                var eventsToDelete = (from ev in Services.DataConnection.ChatEvents
                                      where ev.ChannelID == channelID
                                      orderby ev.EventID ascending
                                      select ev).Take(10);
                Services.DataConnection.ChatEvents.DeleteAllOnSubmit(eventsToDelete);
                Services.ExistingEvents[channelID].RemoveRange(0, 10);
            }

            foreach (ClientEvent ev in args)
            {
                ChatEvent newEvent = new ChatEvent() { ChannelID = channelID, EventData = Serialize(ev.EventData), Type = (int)ev.EventType };
                Services.DataConnection.ChatEvents.InsertOnSubmit(newEvent);
                Services.ExistingEvents[channelID].Add(newEvent);
            }
            Services.DataConnection.SubmitChanges();
        }
    }
开发者ID:Mofsy,项目名称:jinxbot,代码行数:28,代码来源:JinxBotWebApplication.cs

示例2: ClientChatEvent

 public ClientChatEvent(ChatEvent ev)
 {
     EventID = ev.EventID;
     EventData = JinxBotWebApplication.ArgsSerializer.ReadObject(new XmlTextReader(new StringReader(ev.EventData))) as BaseEventArgs;
     Time = ev.Time;
     EventType = (ClientEventType)ev.Type;
 }
开发者ID:Mofsy,项目名称:jinxbot,代码行数:7,代码来源:ClientChatEvent.cs

示例3: onChatReceived

        public void onChatReceived(ChatEvent eventObj)
        {
            com.shephertz.app42.gaming.multiplayer.client.SimpleJSON.JSONNode msg =  com.shephertz.app42.gaming.multiplayer.client.SimpleJSON.JSON.Parse(eventObj.getMessage());

            checkUser(eventObj.getSender());

            string sender = eventObj.getSender();
            string parameters = msg ["parameters"].ToString();
            string message = msg ["message"].ToString();

            if( parameters.Length > 0 )
            {
                parameters = parameters.Substring(0, parameters.Length - 1);
                parameters = parameters.Substring(1, parameters.Length - 1);

                appwarp.manageNotification(sender, parameters);
            }
            else if( message.Length > 0 )
            {
                message = message.Substring(0, message.Length - 1);
                message = message.Substring(1, message.Length - 1);

                appwarp.showMessage(message, sender);
            }
        }
开发者ID:ZWTGW,项目名称:unity,代码行数:25,代码来源:Listener.cs

示例4: HandleChatEvent

 private void HandleChatEvent(ChatEvent chatEvent)
 {
     var loweredCharacterName = chatEvent.SourceName.ToLower();
     Queue<SafeAction> queue;
     if (this._chatRecievedResponseQueue.TryGetValue(loweredCharacterName, out queue))
     {
         var action = queue.Dequeue();
         action();
     }
 }
开发者ID:mrvoorhe,项目名称:redox-extensions,代码行数:10,代码来源:GameEventResponseDispatcher.cs

示例5: onChatReceived

        public void onChatReceived(ChatEvent eventObj)
        {
            Log(eventObj.getSender() + " sended " + eventObj.getMessage());
            SimpleJSON.JSONNode msg =  SimpleJSON.JSON.Parse(eventObj.getMessage());

            if(eventObj.getSender() != appwarp.username)
            {
                appwarp.movePlayer(msg["x"].AsFloat,msg["y"].AsFloat,msg["z"].AsFloat);
            }
        }
开发者ID:HimanshuSShephertz,项目名称:AppWarpUnity,代码行数:10,代码来源:Listener.cs

示例6: onChatReceived

 public void onChatReceived(ChatEvent eventObj)
 {
     Log(eventObj.getSender() + " sended " + eventObj.getMessage());
     com.shephertz.app42.gaming.multiplayer.client.SimpleJSON.JSONNode msg =  com.shephertz.app42.gaming.multiplayer.client.SimpleJSON.JSON.Parse(eventObj.getMessage());
     //msg[0]
     if(eventObj.getSender() != appwarp.username)
     {
         appwarp.movePlayer(msg["x"].AsFloat,msg["y"].AsFloat,msg["z"].AsFloat);
         //Log(msg["x"].ToString()+" "+msg["y"].ToString()+" "+msg["z"].ToString());
     }
 }
开发者ID:shephertz,项目名称:AppWarpUnitySamples,代码行数:11,代码来源:Listener.cs

示例7: onChatReceived

 public void onChatReceived(ChatEvent eventObj)
 {
     Log(eventObj.getSender() + " sended " + eventObj.getMessage());
     //			//			SimpleJSON.JSONNode msg =  SimpleJSON.JSON.Parse("aa");//eventObj.getMessage());
     //			//			SimpleJSON.JSONNode msg =  SimpleJSON.JSONNode.Parse(eventObj.getMessage());
     //			SimpleJSON.JObject msg =  SimpleJSON.JSON.Parse(eventObj.getMessage());
     //			//msg[0]
     //			if(eventObj.getSender() != AppWarp.localusername)
     //			{
     ////				AppWarp.movePlayer(msg["x"].AsFloat,msg["y"].AsFloat,msg["z"].AsFloat);
     //				//Log(msg["x"].ToString()+" "+msg["y"].ToString()+" "+msg["z"].ToString());
     //			}
 }
开发者ID:4ONSports,项目名称:Prototype_2,代码行数:13,代码来源:NotificationListener.cs

示例8: onChatReceived

        public void onChatReceived(ChatEvent eventObj)
        {
            String sender = eventObj.getSender ();
            String message = eventObj.getMessage ();
            history [nextIndex].sender = sender;
            history [nextIndex].message = message;
            nextIndex++;
            if (nextIndex >= Constants.MAX_MSG_HISTORY) {
                nextIndex = 0;
            }

            String lines="";
            for (int i=0; i<Constants.MAX_MSG_HISTORY; i++) {
                if((history[i].message != null) && (history[i].message.Length > 0)){
                    String line = history[i].sender+":"+history[i].message+"\n";
                    lines += line;
                }
            }
            RunOnUiThread(() => updateHistory(lines));
        }
开发者ID:shephertz,项目名称:AppWarpMono,代码行数:20,代码来源:ChatActivity.cs

示例9: onChatReceived

        public void onChatReceived(ChatEvent eventObj)
        {
            String sender = eventObj.getSender ();
            String message = eventObj.getMessage ();
            history [nextIndex].sender = sender;
            history [nextIndex].message = message;
            nextIndex++;
            if (nextIndex >= Constants.MAX_MSG_HISTORY) {
                nextIndex = 0;
            }

            String lines="";
            for (int i=0; i<Constants.MAX_MSG_HISTORY; i++) {
                if((history[i].message != null) && (history[i].message.Length > 0)){
                    String line = "  "+history[i].sender+":"+history[i].message+"\n";
                    lines += line;
                }
            }
            InvokeOnMainThread (delegate {
                historyLabel.Text = lines;
            });
        }
开发者ID:shephertz,项目名称:AppWarpMono,代码行数:22,代码来源:ChatController.cs

示例10: onChatReceived

		public void onChatReceived(ChatEvent eventObj){
			Log(eventObj.getSender() + ":" + eventObj.getMessage());
		}
开发者ID:sheepbeo,项目名称:ChatTest,代码行数:3,代码来源:ChatClient.cs

示例11: OnPlayerChat

        private void OnPlayerChat(ChatEvent e)
        {
            var player = Scene.SceneTracker.allPlayerEntities.FirstOrDefault(ent => ent.networkId == e.Sender);
            if (player == null) return;
            var steamId = player.source.RemoteEndPoint.SteamId.Id;
            var name = SteamFriends.GetFriendPersonaName(new CSteamID(steamId));

            Interface.Oxide.LogInfo($"{name}: {e.Message}");
        }
开发者ID:AEtherSurfer,项目名称:Oxide,代码行数:9,代码来源:TheForestCore.cs

示例12: Command_Kick

        protected void Command_Kick( ChatEvent chatEvent )
        {
            ulong remoteUserId = chatEvent.RemoteUserId;
            List<string> commandParts = CommandParser.GetCommandParts( chatEvent.Message );
            int paramCount = commandParts.Count - 1;

            if ( paramCount != 1 )
                return;

            //Get the steam id of the player
            string rawSteamId = commandParts[ 1 ];

            if ( rawSteamId.Length < 3 )
            {
                SendPrivateChatMessage( remoteUserId, "3 or more characters required to kick." );
                return;
            }

            ulong steamId;
            var playerItems = PlayerManager.Instance.PlayerMap.GetPlayerItemsFromPlayerName( rawSteamId );
            if ( playerItems.Count == 0 )
            {
                steamId = PlayerManager.Instance.PlayerMap.GetSteamIdFromPlayerName( rawSteamId );
                if ( steamId == 0 )
                    return;
            }
            else
            {
                if ( playerItems.Count > 1 )
                {
                    SendPrivateChatMessage( remoteUserId, "There is more than one player with the specified name;" );

                    string playersString = playerItems.Aggregate( string.Empty, ( current, playeritem ) => string.Format( "{0}{1} ", current, playeritem.Name ) );

                    SendPrivateChatMessage( remoteUserId, playersString );
                    return;
                }

                steamId = playerItems[ 0 ].SteamId;
                if ( steamId == 0 )
                    return;
            }

            if ( steamId.ToString( ).StartsWith( "9009" ) )
            {
                SendPrivateChatMessage( remoteUserId, string.Format( "Unable to kick player '{0}'.  This player is the server.", steamId ) );
                return;
            }

            PlayerManager.Instance.KickPlayer( steamId );
            SendPrivateChatMessage( remoteUserId, string.Format( "Kicked player '{0}' off of the server", ( playerItems.Count == 0 ? rawSteamId : playerItems[ 0 ].Name ) ) );
        }
开发者ID:LoganRickert,项目名称:SEServerExtender,代码行数:52,代码来源:ChatManager.cs

示例13: Command_GetId

        protected void Command_GetId( ChatEvent chatEvent )
        {
            ulong remoteUserId = chatEvent.RemoteUserId;
            List<string> commandParts = CommandParser.GetCommandParts( chatEvent.Message );
            int paramCount = commandParts.Count - 1;

            if ( paramCount > 0 )
            {
                string entityName = commandParts[ 1 ];
                if ( commandParts.Count > 2 )
                {
                    for ( int i = 2; i < commandParts.Count; i++ )
                    {
                        entityName += string.Format( " {0}", commandParts[ i ] );
                    }
                }

                List<BaseEntity> entities = SectorObjectManager.Instance.GetTypedInternalData<BaseEntity>( );
                foreach ( BaseEntity entity in entities )
                {
                    if ( !entity.Name.ToLower( ).Equals( entityName.ToLower( ) ) )
                        continue;

                    SendPrivateChatMessage( remoteUserId, string.Format( "Entity ID is '{0}'", entity.EntityId ) );
                }
            }
        }
开发者ID:LoganRickert,项目名称:SEServerExtender,代码行数:27,代码来源:ChatManager.cs

示例14: Command_Delete

        protected void Command_Delete( ChatEvent chatEvent )
        {
            ulong remoteUserId = chatEvent.RemoteUserId;
            List<string> commandParts = CommandParser.GetCommandParts( chatEvent.Message );
            int paramCount = commandParts.Count - 1;

            //All entities
            if ( paramCount > 1 && commandParts[ 1 ].ToLower( ).Equals( "all" ) )
            {
                //All cube grids that have no beacon or only a beacon with no name
                if ( commandParts[ 2 ].ToLower( ).Equals( "nobeacon" ) )
                {
                    List<CubeGridEntity> entities = SectorObjectManager.Instance.GetTypedInternalData<CubeGridEntity>( );
                    List<CubeGridEntity> entitiesToDispose = new List<CubeGridEntity>( );
                    foreach ( CubeGridEntity entity in entities )
                    {
                        while ( entity.CubeBlocks.Count == 0 )
                        {
                            Thread.Sleep( 20 );
                        }
                        List<CubeBlockEntity> blocks = entity.CubeBlocks;
                        if ( blocks.Count > 0 )
                        {
                            bool foundBeacon = blocks.OfType<BeaconEntity>( ).Any( );
                            if ( !foundBeacon )
                            {
                                entitiesToDispose.Add( entity );
                            }
                        }
                    }

                    foreach ( CubeGridEntity entity in entitiesToDispose )
                    {
                        bool isLinkedShip = false;
                        List<CubeBlockEntity> blocks = entity.CubeBlocks;
                        foreach ( CubeBlockEntity cubeBlock in blocks )
                        {
                            if ( cubeBlock is MergeBlockEntity )
                            {
                                MergeBlockEntity block = (MergeBlockEntity)cubeBlock;
                                if ( block.IsAttached )
                                {
                                    if ( !entitiesToDispose.Contains( block.AttachedCubeGrid ) )
                                    {
                                        isLinkedShip = true;
                                        break;
                                    }
                                }
                            }
                            if ( cubeBlock is PistonEntity )
                            {
                                PistonEntity block = (PistonEntity)cubeBlock;
                                CubeBlockEntity topBlock = block.TopBlock;
                                if ( topBlock != null )
                                {
                                    if ( !entitiesToDispose.Contains( topBlock.Parent ) )
                                    {
                                        isLinkedShip = true;
                                        break;
                                    }
                                }
                            }
                            if ( cubeBlock is RotorEntity )
                            {
                                RotorEntity block = (RotorEntity)cubeBlock;
                                CubeBlockEntity topBlock = block.TopBlock;
                                if ( topBlock != null )
                                {
                                    if ( !entitiesToDispose.Contains( topBlock.Parent ) )
                                    {
                                        isLinkedShip = true;
                                        break;
                                    }
                                }
                            }
                        }
                        if ( isLinkedShip )
                            continue;

                        entity.Dispose( );
                    }

                    SendPrivateChatMessage( remoteUserId, string.Format( "{0} cube grids have been removed", entitiesToDispose.Count ) );
                }
                //All cube grids that have no power
                else if ( commandParts[ 2 ].ToLower( ).Equals( "nopower" ) )
                {
                    List<CubeGridEntity> entities = SectorObjectManager.Instance.GetTypedInternalData<CubeGridEntity>( );
                    List<CubeGridEntity> entitiesToDispose = entities.Where( entity => entity.TotalPower <= 0 ).ToList( );

                    foreach ( CubeGridEntity entity in entitiesToDispose )
                    {
                        entity.Dispose( );
                    }

                    SendPrivateChatMessage( remoteUserId, string.Format( "{0} cube grids have been removed", entitiesToDispose.Count ) );
                }
                else if ( commandParts[ 2 ].ToLower( ).Equals( "floatingobjects" ) )	//All floating objects
                {
                    /*
//.........这里部分代码省略.........
开发者ID:LoganRickert,项目名称:SEServerExtender,代码行数:101,代码来源:ChatManager.cs

示例15: Command_Spawn

        protected void Command_Spawn( ChatEvent chatEvent )
        {
            ulong remoteUserId = chatEvent.RemoteUserId;
            List<string> commandParts = CommandParser.GetCommandParts( chatEvent.Message );
            int paramCount = commandParts.Count - 1;

            if ( paramCount > 1 && commandParts[ 1 ].ToLower( ).Equals( "ship" ) )
            {
                if ( commandParts[ 2 ].ToLower( ).Equals( "all" ) )
                {
                }
                if ( commandParts[ 2 ].ToLower( ).Equals( "exports" ) )
                {
                }
                if ( commandParts[ 2 ].ToLower( ).Equals( "cargo" ) )
                {
                    CargoShipManager.Instance.SpawnCargoShipGroup( remoteUserId );
                }
            }
        }
开发者ID:LoganRickert,项目名称:SEServerExtender,代码行数:20,代码来源:ChatManager.cs


注:本文中的ChatEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。