Example #1
0
void CUIEntityDynTexTag::InitEventSystem()
{
    assert(gEnv->pFlashUI);

    if(!gEnv->pFlashUI)
        return;

    // event system to receive events from UI
    m_pUIOFct = gEnv->pFlashUI->CreateEventSystem("UIEntityTagsDynTex", IUIEventSystem::eEST_UI_TO_SYSTEM);
    s_EventDispatcher.Init(m_pUIOFct, this, "UIEntityDynTexTag");

    {
        SUIEventDesc evtDesc("AddEntityTag", "Adds a 3D entity Tag");
        evtDesc.AddParam<SUIParameterDesc::eUIPT_Int>("EntityID", "Entity ID of tagged entity");
        evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("uiElements_UIElement", "UIElement that is used for this tag (Instance with EntityId as instanceId will be created)");
        evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("EntityClass", "EntityClass of the spawned entity");
        evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("Material", "Material template that is used for the dyn texture");
        evtDesc.AddParam<SUIParameterDesc::eUIPT_Vec3>("Offset", "Offset in camera space relative to entity pos");
        evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("TagIDX", "Custom IDX to identify entity tag.");
        s_EventDispatcher.RegisterEvent(evtDesc, &CUIEntityDynTexTag::OnAddTaggedEntity);
    }

    {
        SUIEventDesc evtDesc("UpdateEntityTag", "Updates a 3D entity Tag");
        evtDesc.AddParam<SUIParameterDesc::eUIPT_Int>("EntityID", "Entity ID of tagged entity");
        evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("TagIDX", "Custom IDX to identify entity tag.");
        evtDesc.AddParam<SUIParameterDesc::eUIPT_Vec3>("Offset", "Offset in camera space relative to entity pos");
        evtDesc.AddParam<SUIParameterDesc::eUIPT_Float>("LerpSpeed", "Define speed of lerp between old and new offset, 0=instant");
        s_EventDispatcher.RegisterEvent(evtDesc, &CUIEntityDynTexTag::OnUpdateTaggedEntity);
    }

    {
        SUIEventDesc evtDesc("RemoveEntityTag", "Removes a 3D entity Tag");
        evtDesc.AddParam<SUIParameterDesc::eUIPT_Int>("EntityID", "Entity ID of tagged entity");
        evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("TagIDX", "Custom IDX to identify entity tag.");
        s_EventDispatcher.RegisterEvent(evtDesc, &CUIEntityDynTexTag::OnRemoveTaggedEntity);
    }

    {
        SUIEventDesc evtDesc("RemoveAllEntityTag", "Removes all 3D entity Tags for given entity");
        evtDesc.AddParam<SUIParameterDesc::eUIPT_Int>("EntityID", "Entity ID of tagged entity");
        s_EventDispatcher.RegisterEvent(evtDesc, &CUIEntityDynTexTag::OnRemoveAllTaggedEntity);
    }

    gEnv->pFlashUI->RegisterModule(this, "CUIEntityDynTexTag");
}
Example #2
0
void CUIObjectives::InitEventSystem()
{
	if ( gEnv->pFlashUI )
	{
		// events that be fired to the UI
		m_pUIEvents = gEnv->pFlashUI->CreateEventSystem( "UIObjectives", IUIEventSystem::eEST_SYSTEM_TO_UI );
		m_eventSender.Init(m_pUIEvents);

		{
			SUIEventDesc evtDesc("ObjectiveAdded", "Mission objective added");
			evtDesc.AddParam<SUIParameterDesc::eUIPT_Int>("MissionID", "ID of the mission" );
			evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("Name", "Name of the mission");
			evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("Desc", "Description of the mission");
			evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("State", "State of the objective");
			m_eventSender.RegisterEvent<eUIOE_ObjectiveAdded>(evtDesc);
		}

		{
			SUIEventDesc evtDesc( "ObjectiveRemoved", "Mission objective removed" );
			evtDesc.AddParam<SUIParameterDesc::eUIPT_Int>("MissionID", "ID of the mission" );
			m_eventSender.RegisterEvent<eUIOE_ObjectiveRemoved>(evtDesc);
		}

		{
			SUIEventDesc evtDesc( "ObjectivesReset", "All mission objectives reset" );
			m_eventSender.RegisterEvent<eUIOE_ObjectivesReset>(evtDesc);
		}

		{
			SUIEventDesc evtDesc( "ObjectiveStateChanged", "Objective status changed" );
			evtDesc.AddParam<SUIParameterDesc::eUIPT_Int>("MissionID", "ID of the mission" );
			evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("State", "State of the objective");
			m_eventSender.RegisterEvent<eUIOE_ObjectiveStateChanged>(evtDesc);
		}

		// event system to receive events from UI
		m_pUIFunctions = gEnv->pFlashUI->CreateEventSystem( "UIObjectives", IUIEventSystem::eEST_UI_TO_SYSTEM );
		m_eventDispatcher.Init(m_pUIFunctions, this, "CUIObjectives");

		{
			SUIEventDesc evtDesc( "RequestObjectives", "Request all mission objectives (force to call ObjectiveAdded for each objective)" );
			m_eventDispatcher.RegisterEvent( evtDesc, &CUIObjectives::OnRequestMissionObjectives );
		}
	}
	UpdateObjectiveInfo();
}
Example #3
0
//--------------------------------------------------------------------------------------------
CUIObjectives::CUIObjectives()
{
	if ( gEnv->pFlashUI )
	{
		// events that be fired to the UI
		m_pUIOEvt = gEnv->pFlashUI->CreateEventSystem( "UIObjectives", IUIEventSystem::eEST_SYSTEM_TO_UI );

		{
			SUIEventDesc evtDesc( "ObjectiveAdded", "ObjectiveAdded", "Mission objective added" );
			evtDesc.Params.push_back( SUIParameterDesc( "ObjectiveID", "MissionID", "ID of the mission" ) );
			evtDesc.Params.push_back( SUIParameterDesc( "Name", "Name", "Name of the mission" ) );
			evtDesc.Params.push_back( SUIParameterDesc( "Desc", "Desc", "Description of the mission" ) );
			evtDesc.Params.push_back( SUIParameterDesc( "State", "State", "State of the objective" ) );
			m_EventMap[ eUIOE_ObjectiveAdded ] = m_pUIOEvt->RegisterEvent( evtDesc );
		}

		{
			SUIEventDesc evtDesc( "ObjectiveRemoved", "ObjectiveRemoved", "Mission objective removed" );
			evtDesc.Params.push_back( SUIParameterDesc( "ObjectiveID", "MissionID", "ID of the mission" ) );
			m_EventMap[ eUIOE_ObjectiveRemoved ] = m_pUIOEvt->RegisterEvent( evtDesc );
		}

		{
			SUIEventDesc evtDesc( "ObjectivesReset", "ObjectivesReset", "All mission objectives reset" );
			m_EventMap[ eUIOE_ObjectivesReset ] = m_pUIOEvt->RegisterEvent( evtDesc );
		}

		{
			SUIEventDesc evtDesc( "ObjectiveStateChanged", "ObjectiveStateChanged", "Objective status changed" );
			evtDesc.Params.push_back( SUIParameterDesc( "ObjectiveID", "MissionID", "ID of the mission" ) );
			evtDesc.Params.push_back( SUIParameterDesc( "State", "State", "State of the objective" ) );
			m_EventMap[ eUIOE_ObjectiveStateChanged ] = m_pUIOEvt->RegisterEvent( evtDesc );
		}

		// event system to receive events from UI
		m_pUIOFct = gEnv->pFlashUI->CreateEventSystem( "UIObjectives", IUIEventSystem::eEST_UI_TO_SYSTEM );
		m_pUIOFct->RegisterListener( this );

		{
			SUIEventDesc evtDesc( "RequestObjectives", "RequestObjectives", "Request all mission objectives (force to call ObjectiveAdded for each objective)" );
			s_EventDispatcher.RegisterEvent( m_pUIOFct, evtDesc, &CUIObjectives::OnRequestMissionObjectives );
		}
	}
	UpdateObjectiveInfo();
}
Example #4
0
void CUIMultiPlayer::InitEventSystem()
{
	if (!gEnv->pFlashUI)
		return;

	ICVar* pServerVar = gEnv->pConsole->GetCVar("cl_serveraddr");
	m_ServerName = pServerVar ? pServerVar->GetString() : "";
	if (m_ServerName == "")
		m_ServerName = "localhost";

	// events to send from this class to UI flowgraphs
	m_pUIFunctions = gEnv->pFlashUI->CreateEventSystem("MP", IUIEventSystem::eEST_SYSTEM_TO_UI);
	m_eventSender.Init(m_pUIFunctions);

	{
		SUIEventDesc evtDesc("EnteredGame", "Triggered once the local player enters the game");
		m_eventSender.RegisterEvent<eUIE_EnteredGame>(evtDesc);
	}

	{
		SUIEventDesc evtDesc("ChatMessageReceived", "Triggered when chatmessages is received");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("Player", "Name of the player");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("Message", "Message");
		m_eventSender.RegisterEvent<eUIE_ChatMsgReceived>(evtDesc);
	}

	{
		SUIEventDesc evtDesc("PlayerJoined", "Triggered if a player joins the game");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_Int>("ID", "ID of player");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("Name", "Name of the player");
		m_eventSender.RegisterEvent<eUIE_PlayerJoined>(evtDesc);
	}

	{
		SUIEventDesc evtDesc("UpdateOrAddScoreBoardItem", "Triggered to update an item on the scoreboard");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_Int>("ID", "ID of player");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("Name", "Name of the player");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_Int>("Kills", "amount of kills this player has");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_Int>("Deaths", "amount of deaths this player had");
		m_eventSender.RegisterEvent<eUIE_UpdateScoreBoardItem>(evtDesc);
	}

	{
		SUIEventDesc evtDesc("PlayerLeft", "Triggered if a player left the game");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_Int>("ID", "ID of player");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("Name", "Name of the player");
		m_eventSender.RegisterEvent<eUIE_PlayerLeft>(evtDesc);
	}

	{
		SUIEventDesc evtDesc("PlayerKilled", "Triggered if a player gets killed");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_Int>("ID", "ID of player");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("Name", "Name of the player");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_Int>("ShooterID", "ID of the shooter");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("ShooterName", "Name of the shooter");
		m_eventSender.RegisterEvent<eUIE_PlayerKilled>(evtDesc);
	}

	{
		SUIEventDesc evtDesc("PlayerRenamed", "Triggered if a player was renamed");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_Int>("ID", "ID of player");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("NewName", "New name of the player");
		m_eventSender.RegisterEvent<eUIE_PlayerRenamed>(evtDesc);
	}

	{
		SUIEventDesc evtDesc("OnGetName", "Triggers once the \"GetPlayerName\" node was called");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("Name", "Name of the local player");
		m_eventSender.RegisterEvent<eUIE_SendName>(evtDesc);
	}

	{
		SUIEventDesc evtDesc("OnGetServerName", "Triggers once the \"GetLastServer\" node was called");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("Address", "Last server address");
		m_eventSender.RegisterEvent<eUIE_SendServer>(evtDesc);
	}


	// events that can be sent from UI flowgraphs to this class
	m_pUIEvents = gEnv->pFlashUI->CreateEventSystem("MP", IUIEventSystem::eEST_UI_TO_SYSTEM);
	m_eventDispatcher.Init(m_pUIEvents, this, "CUIMultiPlayer");

	{
		SUIEventDesc evtDesc("GetPlayers", "Request all players (will trigger the \"PlayerJoined\" node for each player)");
		m_eventDispatcher.RegisterEvent(evtDesc, &CUIMultiPlayer::RequestPlayers);
	}

	{
		SUIEventDesc evtDesc("GetPlayerName", "Get the name of the local player in mp (will trigger the \"OnGetName\" node)");
		m_eventDispatcher.RegisterEvent(evtDesc, &CUIMultiPlayer::GetPlayerName);
	}

	{
		SUIEventDesc evtDesc("ConnectToServer", "Connect to a server");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("Address", "server address");
		m_eventDispatcher.RegisterEvent(evtDesc, &CUIMultiPlayer::ConnectToServer);
	}

	{
		SUIEventDesc evtDesc("GetLastServer", "Get the server name that was last used");
		m_eventDispatcher.RegisterEvent(evtDesc, &CUIMultiPlayer::GetServerName);
	}

	{
		SUIEventDesc evtDesc("SendChatMessage", "");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("Message", "");
		m_eventDispatcher.RegisterEvent(evtDesc, &CUIMultiPlayer::OnSendChatMessage);
	}

	gEnv->pFlashUI->RegisterModule(this, "CUIMultiPlayer");
}
Example #5
0
void CUILobbyMP::InitEventSystem()
{
	if (!gEnv->pFlashUI)
		return;

	ICVar* pServerVar = gEnv->pConsole->GetCVar("cl_serveraddr");

	// events to send from this class to UI flowgraphs
	m_pUIFunctions = gEnv->pFlashUI->CreateEventSystem("LobbyMP", IUIEventSystem::eEST_SYSTEM_TO_UI);
	m_eventSender.Init(m_pUIFunctions);

	{
		SUIEventDesc evtDesc("ServerFound", "Triggered when server is found");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_Int>("ServerId", "ID of the server");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("ServerName", "Name of the server");
		m_eventSender.RegisterEvent<eUIE_ServerFound>(evtDesc);
	}

	{
		SUIEventDesc evtDesc("PlayerList", "Triggered when GetPlayerList is fired");
		evtDesc.SetDynamic("PlayerList", "List of players");
		m_eventSender.RegisterEvent<eUIE_PlayerListReturn>(evtDesc);
	}

	{
		SUIEventDesc evtDesc("PlayerIDList", "Triggered when GetPlayerList is fired");
		evtDesc.SetDynamic("PlayerIDs", "List of player ids");
		m_eventSender.RegisterEvent<eUIE_PlayerIdListReturn>(evtDesc);
	}

	{
		SUIEventDesc evtDesc("InviteAccepted", "An invite to a game was accepted");
		m_eventSender.RegisterEvent<eUIE_InviteAccepted>(evtDesc);
	}

	// events that can be sent from UI flowgraphs to this class
	m_pUIEvents = gEnv->pFlashUI->CreateEventSystem("LobbyMP", IUIEventSystem::eEST_UI_TO_SYSTEM);
	m_eventDispatcher.Init(m_pUIEvents, this, "CUILobbyMP");

	{
		SUIEventDesc evtDesc("HostGame", "Host a game, providing a map-path");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_Bool>("LAN", "1: Lan, 0: Internet");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("MapPath", "path to desired map");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_String>("Gamerules", "desired Gamerules to be used");
		m_eventDispatcher.RegisterEvent(evtDesc, &CUILobbyMP::HostGame);
	}


	{
		SUIEventDesc evtDesc("JoinGame", "Join a game");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_Int>("serverID", "provided from search servers");
		m_eventDispatcher.RegisterEvent(evtDesc, &CUILobbyMP::JoinGame);
	}

	{
		SUIEventDesc evtDesc("LeaveGame", "Leave game session");
		m_eventDispatcher.RegisterEvent(evtDesc, &CUILobbyMP::LeaveGame);
	}

	{
		SUIEventDesc evtDesc("SetMultiplayer", "Sets Multiplayer");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_Bool>("isMultiplayer", "true: multiplayer - false: singleplayer");
		m_eventDispatcher.RegisterEvent(evtDesc, &CUILobbyMP::SetMultiplayer);
	}

	{
		SUIEventDesc evtDesc("SearchGames", "Start quick-game with default settings");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_Bool>("LAN", "1: LAN or 0: Internet");
		m_eventDispatcher.RegisterEvent(evtDesc, &CUILobbyMP::SearchGames);
	}

	{
		SUIEventDesc evtDesc("AwardTrophy", "Test award trophy");
		evtDesc.AddParam<SUIParameterDesc::eUIPT_Int>("TrophyNr", "Index of trophy");
		m_eventDispatcher.RegisterEvent(evtDesc, &CUILobbyMP::AwardTrophy);
	}

	{
		SUIEventDesc evtDesc("GetPlayerlist", "Get list of all players in lobby");
		m_eventDispatcher.RegisterEvent(evtDesc, &CUILobbyMP::GetPlayerList);
	}


	{
		SUIEventDesc evtDesc("ReadLeaderboard", "Test reading leaderboard");
		m_eventDispatcher.RegisterEvent(evtDesc, &CUILobbyMP::ReadLeaderBoard);
	}

	{
		SUIEventDesc evtDesc("RegisterLeaderboard", "Test registering leaderboard");
		m_eventDispatcher.RegisterEvent(evtDesc, &CUILobbyMP::RegisterLeaderBoard);
	}

	{
		SUIEventDesc evtDesc("WriteLeaderboard", "Test writing to leaderboard");
		m_eventDispatcher.RegisterEvent(evtDesc, &CUILobbyMP::WriteLeaderBoard);
	}

	gEnv->pFlashUI->RegisterModule(this, "CUILobbyMP");
}