本文整理汇总了C#中ChatEvent类的典型用法代码示例。如果您正苦于以下问题:C# ChatEvent类的具体用法?C# ChatEvent怎么用?C# ChatEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ChatEvent类属于命名空间,在下文中一共展示了ChatEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: SendPublicChatMessage
public void SendPublicChatMessage( string message )
{
if ( !MySandboxGameWrapper.IsGameStarted )
return;
if ( string.IsNullOrEmpty( message ) )
return;
bool commandParsed = ParseChatCommands( message );
try
{
if ( !commandParsed && message[ 0 ] != '/' )
{
Object chatMessageStruct = CreateChatMessageStruct( message );
List<ulong> connectedPlayers = PlayerManager.Instance.ConnectedPlayers;
foreach ( ulong remoteUserId in connectedPlayers )
{
if ( !remoteUserId.ToString( ).StartsWith( "9009" ) )
ServerNetworkManager.Instance.SendStruct( remoteUserId, chatMessageStruct, chatMessageStruct.GetType( ) );
ChatEvent chatEvent = new ChatEvent( ChatEventType.OnChatSent, DateTime.Now, 0, remoteUserId, message, 0 );
Instance.AddEvent( chatEvent );
}
m_chatMessages.Add( string.Format( "Server: {0}", message ) );
ApplicationLog.ChatLog.Info( string.Format( "Chat - Server: {0}", message ) );
}
//Send a loopback chat event for server-sent messages
ChatEvent selfChatEvent = new ChatEvent( ChatEventType.OnChatReceived, DateTime.Now, 0, 0, message, 0 );
Instance.AddEvent( selfChatEvent );
m_resourceLock.AcquireExclusive( );
m_chatHistory.Add( selfChatEvent );
OnChatMessage( 0, "Server", message );
m_resourceLock.ReleaseExclusive( );
}
catch ( Exception ex )
{
ApplicationLog.BaseLog.Error( ex );
}
}
开发者ID:LoganRickert,项目名称:SEServerExtender,代码行数:41,代码来源:ChatManager.cs
示例17: Command_Clear
protected void Command_Clear( ChatEvent chatEvent )
{
ulong remoteUserId = chatEvent.RemoteUserId;
List<string> commandParts = CommandParser.GetCommandParts( chatEvent.Message );
int paramCount = commandParts.Count - 1;
if ( paramCount != 1 )
return;
List<CubeGridEntity> cubeGrids = SectorObjectManager.Instance.GetTypedInternalData<CubeGridEntity>( );
int queueCount = 0;
foreach ( var cubeGrid in cubeGrids )
{
foreach ( CubeBlockEntity cubeBlock in cubeGrid.CubeBlocks )
{
if ( commandParts[ 1 ].ToLower( ).Equals( "productionqueue" ) && cubeBlock is ProductionBlockEntity )
{
ProductionBlockEntity block = (ProductionBlockEntity)cubeBlock;
block.ClearQueue( );
queueCount++;
}
if ( commandParts[ 1 ].ToLower( ).Equals( "refineryqueue" ) && cubeBlock is RefineryEntity )
{
RefineryEntity block = (RefineryEntity)cubeBlock;
block.ClearQueue( );
queueCount++;
}
if ( commandParts[ 1 ].ToLower( ).Equals( "assemblerqueue" ) && cubeBlock is AssemblerEntity )
{
AssemblerEntity block = (AssemblerEntity)cubeBlock;
block.ClearQueue( );
queueCount++;
}
}
}
SendPrivateChatMessage( remoteUserId, "Cleared the production queue of " + queueCount + " blocks" );
}
开发者ID:LoganRickert,项目名称:SEServerExtender,代码行数:38,代码来源:ChatManager.cs
示例18: Command_Stop
protected void Command_Stop( ChatEvent chatEvent )
{
ulong remoteUserId = chatEvent.RemoteUserId;
List<string> commandParts = CommandParser.GetCommandParts( chatEvent.Message );
int paramCount = commandParts.Count - 1;
if ( paramCount != 1 )
return;
if ( commandParts[ 1 ].ToLower( ).Equals( "all" ) )
{
List<BaseEntity> entities = SectorObjectManager.Instance.GetTypedInternalData<BaseEntity>( );
int entitiesStoppedCount = 0;
foreach ( BaseEntity entity in entities )
{
double linear = Math.Round( ( (Vector3)entity.LinearVelocity ).LengthSquared( ), 1 );
double angular = Math.Round( ( (Vector3)entity.AngularVelocity ).LengthSquared( ), 1 );
if ( linear > 0 || angular > 0 )
{
entity.LinearVelocity = Vector3.Zero;
entity.AngularVelocity = Vector3.Zero;
entitiesStoppedCount++;
}
}
SendPrivateChatMessage( remoteUserId, string.Format( "{0} entities are no longer moving or rotating", entitiesStoppedCount ) );
}
else
{
string rawEntityId = commandParts[ 1 ];
try
{
long entityId = long.Parse( rawEntityId );
List<BaseEntity> entities = SectorObjectManager.Instance.GetTypedInternalData<BaseEntity>( );
foreach ( BaseEntity entity in entities )
{
if ( entity.EntityId != entityId )
continue;
entity.LinearVelocity = Vector3.Zero;
entity.AngularVelocity = Vector3.Zero;
SendPrivateChatMessage( remoteUserId, string.Format( "Entity '{0}' is no longer moving or rotating", entity.EntityId ) );
}
}
catch ( Exception ex )
{
ApplicationLog.BaseLog.Error( ex );
}
}
}
开发者ID:LoganRickert,项目名称:SEServerExtender,代码行数:54,代码来源:ChatManager.cs
示例19: Command_Export
protected void Command_Export( ChatEvent chatEvent )
{
ulong remoteUserId = chatEvent.RemoteUserId;
List<string> commandParts = CommandParser.GetCommandParts( chatEvent.Message );
int paramCount = commandParts.Count - 1;
if ( paramCount == 1 )
{
string rawEntityId = commandParts[ 1 ];
try
{
long entityId = long.Parse( rawEntityId );
List<BaseEntity> entities = SectorObjectManager.Instance.GetTypedInternalData<BaseEntity>( );
foreach ( BaseEntity entity in entities )
{
if ( entity.EntityId != entityId )
continue;
string modPath = MyFileSystem.ModsPath;
if ( !Directory.Exists( modPath ) )
break;
string fileName = entity.Name.ToLower( );
Regex rgx = new Regex( "[^a-zA-Z0-9]" );
string cleanFileName = rgx.Replace( fileName, string.Empty );
string exportPath = Path.Combine( modPath, "Exports" );
if ( !Directory.Exists( exportPath ) )
Directory.CreateDirectory( exportPath );
FileInfo exportFile = new FileInfo( Path.Combine( exportPath, cleanFileName + ".sbc" ) );
entity.Export( exportFile );
SendPrivateChatMessage( remoteUserId, string.Format( "Entity '{0}' has been exported to Mods/Exports", entity.EntityId ) );
}
}
catch ( Exception ex )
{
ApplicationLog.BaseLog.Error( ex );
}
}
}
开发者ID:LoganRickert,项目名称:SEServerExtender,代码行数:43,代码来源:ChatManager.cs
示例20: Command_SyncSave
protected void Command_SyncSave( ChatEvent chatEvent )
{
ulong remoteUserId = chatEvent.RemoteUserId;
WorldManager.Instance.SaveWorld( );
SendPrivateChatMessage( remoteUserId, "World has been saved!" );
}
开发者ID:LoganRickert,项目名称:SEServerExtender,代码行数:8,代码来源:ChatManager.cs
注:本文中的ChatEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论