//---------------------------------------------------------------------------
void TChatRoomUsers::RemoveUser(String UserName)
{
  int i;
  TChatRoomUser *User;

  if (UserName == EmptyStr || ChatRoomUsersDestroyed)
    return;

  System::TMonitor::Enter(FUsers);
  try
  {
    for (i = 0; i < FUsers->Count; i++)
    {
      User = (TChatRoomUser *)FUsers->Items[i];
      //remove user if the name matches and exit
      if (CompareText(User->Name, UserName) == 0)
      {
        FUsers->Remove(User);
        delete User;
        NotifyUserChange(UserName, False);
        return;
      }
    }
  }
  __finally
  {
    System::TMonitor::Exit(FUsers);
    NotifyUI();
  }
}
//---------------------------------------------------------------------------
void TChatRoomUsers::AddUser(String UserName, String SessionId)
{
  TChatRoomUser User ;

  if (UserName == EmptyStr || ChatRoomUsersDestroyed)
    return;

  System::TMonitor::Enter(FUsers);
  try
  {
    for (int i = 0; i < FUsers->Count; i++)
    {
      //if you found a user with the specified name, update his session ID and exit
      if (CompareText(((TChatRoomUser *)FUsers->Items[i])->Name, UserName) == 0)
      {
        User.SessionId = SessionId;
        return;
      }
    }

    //if no user with the name was found, add a new one
    TChatRoomUser *User = new TChatRoomUser();
    User->Name = UserName;
    User->SessionId = SessionId;

    FUsers->Add(User);

    NotifyUserChange(UserName, True);
  }
  __finally
  {
    System::TMonitor::Exit(FUsers);
    NotifyUI();
  }
}
Beispiel #3
0
//--------------------------------------------------------------------------------------------
void CUIObjectives::MissionObjectiveRemoved( const string& objectiveID )
{
	SMissionObjectiveInfo* pInfo = GetMissionObjectiveInfo( objectiveID );
	if ( pInfo )
	{
		SUIArguments args;
		args.AddArgument( objectiveID );
		NotifyUI( eUIOE_ObjectiveRemoved, args );
	}
}
Beispiel #4
0
//--------------------------------------------------------------------------------------------
void CUIObjectives::MissionObjectiveStateChanged( const string& objectiveID, int state )
{
	SMissionObjectiveInfo* pInfo = GetMissionObjectiveInfo( objectiveID );
	if ( pInfo )
	{
		SUIArguments args;
		args.AddArgument( objectiveID );
		args.AddArgument( state );
		NotifyUI( eUIOE_ObjectiveStateChanged, args );
	}
}
Beispiel #5
0
void CUIObjectives::MissionObjectiveAdded( const string& objectiveID, int state )
{
	if ( gEnv->IsEditor() )
	{
		UpdateObjectiveInfo();
	}
	SMissionObjectiveInfo* pInfo = GetMissionObjectiveInfo( objectiveID );
	if ( pInfo )
	{
		SUIArguments args;
		args.AddArgument( objectiveID );
		args.AddArgument( pInfo->Name );
		args.AddArgument( pInfo->Desc );
		args.AddArgument( state );
		NotifyUI( eUIOE_ObjectiveAdded, args );
	}
}
Beispiel #6
0
//--------------------------------------------------------------------------------------------
void CUIObjectives::MissionObjectivesReset()
{
	NotifyUI( eUIOE_ObjectivesReset );
}