private void Start() { dataEntityCollection = Service.Get <CPDataEntityCollection>(); if (AvatarDataHandle.TryGetPlayerHandle(base.gameObject, out var handle)) { if (dataEntityCollection.TryGetComponent <ParticipationData>(handle, out var component)) { participationData = component; ResetParticipation(); initializePriorityCompetition(); if (InitializationCompleteAction != null) { InitializationCompleteAction(); } } else { dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <ParticipationData> >(onParticipationDataReady); } } else { Log.LogError(this, "Unable to find handle"); } }
private bool onParticipationDataReady(DataEntityEvents.ComponentAddedEvent <ParticipationData> evt) { ResetParticipation(); if (AvatarDataHandle.TryGetPlayerHandle(base.gameObject, out var handle) && evt.Handle == handle) { participationData = evt.Component; dataEntityCollection.EventDispatcher.RemoveListener <DataEntityEvents.ComponentAddedEvent <ParticipationData> >(onParticipationDataReady); initializePriorityCompetition(); } return(false); }
public ParticipationCompetitionRules(DataEntityHandle playerHandle, CPDataEntityCollection dataEntityCollection, ParticipationData data) { PlayerHandle = playerHandle; DataEntityCollection = dataEntityCollection; participation = data; }