Class PlayerManagerComponent
- All Implemented Interfaces:
Component<Object>
,AssetLoadingFragment
,Fragment
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AssetManager
protected Collection
<String> protected boolean
protected Map
<org.ngengine.nostr4j.keypair.NostrPublicKey, LocalPlayer> protected org.ngengine.nostr4j.NostrPool
protected Runner
-
Constructor Summary
ConstructorsConstructorDescriptionPlayerManagerComponent
(Collection<String> idRelays) PlayerManagerComponent
(org.ngengine.platform.VStore dataStore, org.ngengine.nostr4j.NostrPool pool) -
Method Summary
Modifier and TypeMethodDescriptionvoid
getPlayer
(HostedConnection conn) getPlayer
(P2PChannel chan) getPlayer
(RemotePeer peer) getPlayer
(org.ngengine.nostr4j.keypair.NostrPublicKey pubkey) getPlayer
(org.ngengine.nostr4j.signer.NostrSigner signer) org.ngengine.nostr4j.NostrPool
getPool()
void
loadAssets
(AssetManager assetManager) Load assets using the provided AssetManager.void
onAttached
(ComponentManager mng, Runner runner, DataStoreProvider dataStoreProvider) Called immediately when the component is attached to aComponentManager
and aRunner
.void
onDisable
(ComponentManager mng, Runner runner, DataStoreProvider dataStoreProvider) Called when the component is disabled.void
onEnable
(ComponentManager mng, Runner runner, DataStoreProvider dataStoreProvider, boolean firstTime, Object slot) Called when the component is enabled.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.ngengine.components.Component
getId, getSlot, onDetached, onNudge
-
Field Details
-
DEFAULT_ID_RELAYS
-
connectToRelays
-
nostrPool
protected org.ngengine.nostr4j.NostrPool nostrPool -
externalPool
protected boolean externalPool -
players
-
localPlayers
-
runner
-
assetManager
-
-
Constructor Details
-
PlayerManagerComponent
public PlayerManagerComponent() -
PlayerManagerComponent
-
PlayerManagerComponent
public PlayerManagerComponent(org.ngengine.platform.VStore dataStore, org.ngengine.nostr4j.NostrPool pool)
-
-
Method Details
-
enqueueToRenderThread
-
getPool
public org.ngengine.nostr4j.NostrPool getPool() -
onEnable
public void onEnable(ComponentManager mng, Runner runner, DataStoreProvider dataStoreProvider, boolean firstTime, Object slot) Description copied from interface:Component
Called when the component is enabled. This is the most important method of the component lifecycle, where the component's main logic is implemented.This method is called when the component is enabled, all its dependencies are satisfied, the fragments are initialized, and the resources are loaded.
- Specified by:
onEnable
in interfaceComponent<Object>
- Parameters:
mng
- - the ComponentManager to which this component is attachedrunner
- - the Runner that executes the logicdataStoreProvider
- - the DataStoreProvider for storing and retrieving data and cachesfirstTime
- - whether this is the first time the component is being enabledslot
- - an argument that can be passed when enabling this component, can be null
-
onDisable
Description copied from interface:Component
Called when the component is disabled.This should undo anything that was done in
Component.onEnable(org.ngengine.components.ComponentManager, org.ngengine.runner.Runner, org.ngengine.store.DataStoreProvider, boolean, T)
and reset the component state to allow future re-enabling.This method is called when the component is explicitly disabled or when one of its dependencies is disabled.
If $
invalid reference
#onDetach
It is always called before an enabled component is detached from the
ComponentManager
. -
loadAssets
Description copied from interface:AssetLoadingFragment
Load assets using the provided AssetManager. The reference to the AssetManager can be stored and used later in the component logic.- Specified by:
loadAssets
in interfaceAssetLoadingFragment
- Parameters:
assetManager
- the AssetManager instance
-
getAssetManager
-
onAttached
Description copied from interface:Component
Called immediately when the component is attached to aComponentManager
and aRunner
.This method can be overridden to perform initialization tasks when the component is attached.
- Specified by:
onAttached
in interfaceComponent<Object>
- Parameters:
mng
- the ComponentManager to which this component is attachedrunner
- the Runner associated with this componentdataStoreProvider
- the DataStoreProvider for accessing shared data
-
getPlayer
-
getPlayer
-
getPlayer
-
getPlayer
-
getPlayer
-