public ParticipationRequestOutcome(ParticipationRequest request, ParticipationState state, string gameObjectName, bool accepted)
 {
     Request         = request;
     State           = state;
     WinnerName      = gameObjectName;
     RequestAccepted = accepted;
 }
 private bool MoveRequestToParticipate(ParticipationRequest request)
 {
     if (participationData.isTopPriorityAndState(ParticipationState.Pending, request.Requestor))
     {
         participationData.CurrentParticipationState = ParticipationState.Participating;
     }
     return(participationData.isTopPriorityAndState(ParticipationState.Participating, request.Requestor));
 }
 public bool LockParticipation(ParticipationRequest request)
 {
     if (participationData.isTopPriorityAndState(ParticipationState.Participating, request.CompetitorReference))
     {
         participationData.CurrentParticipationState = ParticipationState.Retained;
         return(true);
     }
     return(false);
 }
        public bool StartParticipation(ParticipationRequest request)
        {
            bool result = false;

            if ((request.RequestType == ParticipationRequest.Type.Stop || !participationData.isTopPriorityAndState(ParticipationState.Retained, request.Requestor)) && request.RequestType == ParticipationRequest.Type.Start)
            {
                result = MoveRequestToParticipate(request);
            }
            return(result);
        }
        public bool PrepareParticipation(ParticipationRequest request)
        {
            bool result = true;

            if ((request.RequestType == ParticipationRequest.Type.Prepare || request.RequestType == ParticipationRequest.Type.ForcedInteraction) && doesRequestPassFilters(request))
            {
                EnterRequestIntoParticipationCompetition(request);
            }
            return(result);
        }
 private bool doesRequestPassFilters(ParticipationRequest request)
 {
     foreach (AbstractParticipationFilter value in participationFilters.Values)
     {
         if (!value.doesRequestPassFilter(request))
         {
             return(false);
         }
     }
     return(true);
 }
        private Competitor <GameObject> EnterRequestIntoParticipationCompetition(ParticipationRequest request)
        {
            Competitor <GameObject> competitor = null;

            if (PriorityCompetition != null)
            {
                competitor = PriorityCompetition.EnterCompetitor(request.Requestor);
                AddObserverAndListenersToParticipationRequestor(competitor);
                UpdateParticipationWhenRequestReceived(request);
            }
            return(competitor);
        }
        private bool StopCurrentParticipation(ParticipationRequest request)
        {
            bool flag = participationData.isTopPriorityAndState(ParticipationState.Participating, request.Requestor) || participationData.isTopPriorityAndState(ParticipationState.Retained, request.Requestor);

            if (flag)
            {
                Internal_UpdateParticipationWhenSomethingGotRemoved(request.CompetitorReference, "Controller_stopRequest");
                Competitor <GameObject> competitor = PriorityCompetition.GetCompetitor(request.Requestor);
                if (competitor == null)
                {
                    StopObserving(request.CompetitorReference);
                }
            }
            return(flag);
        }
 private void UpdateParticipationWhenRequestReceived(ParticipationRequest request)
 {
     if (participationData.CurrentParticipationState == ParticipationState.Participating || participationData.CurrentParticipationState == ParticipationState.Retained)
     {
         return;
     }
     PriorityCompetition.Decide();
     if (PriorityCompetition.LatestResults != null && PriorityCompetition.LatestResults.Winner != null)
     {
         participationData.ParticipatingGO = PriorityCompetition.LatestResults.Winner;
         if (request.RequestType == ParticipationRequest.Type.Prepare)
         {
             participationData.CurrentParticipationState = ParticipationState.Pending;
         }
         else if (request.RequestType == ParticipationRequest.Type.ForcedInteraction)
         {
             participationData.CurrentParticipationState = ParticipationState.Participating;
         }
     }
     else
     {
         ResetParticipation();
     }
 }
 public void LogRequest(ParticipationRequest request, bool accepted)
 {
 }
 public bool StopParticipation(ParticipationRequest request)
 {
     return(StopCurrentParticipation(request));
 }
 public void ForceStopParticipation(ParticipationRequest request)
 {
     Internal_UpdateParticipationWhenSomethingGotRemoved(request.CompetitorReference, "Controller_ForceStopRequest");
 }