Наследование: MonoBehaviour
    public void playNextStepEvent(int nextStepIndex)
    {
        if (nextStepIndex < sectorPlayer.sectorEvent.eventSteps.Length)
        {
            EventStep eventStepToPlay = sectorPlayer.sectorEvent.eventSteps[nextStepIndex];

            switch (eventStepToPlay.eventStepType) //Play first step of the sector event
            {
            case EventStepType.battleEventStep:
                MenuManagerScript.current.contextualCanvas.enabled = false;
                startBattleEvent(eventStepToPlay);
                break;

            case EventStepType.contextualEventStep:
                StartCoroutine(startContextualEvent(eventStepToPlay));
                break;

            case EventStepType.stationEventStep:
                sectorPlayer.stationUnlocked = true;
                startStationEvent(eventStepToPlay);
                break;
            }

            sectorPlayer.sectorEvent.actualEventStepIndex = nextStepIndex;
        }
        else //No more step to play, go back to starmap
        {
            MenuManagerScript.current.contextualCanvas.enabled = false;
            sectorPlayer.sectorIsExplored = true;
            StartCoroutine(fadeBattlezoneToStarmap());
            AudioManager.current.StartCoroutine(AudioManager.current.musicSwitch(MusicType.Starmap));
            restObjectsStates();
        }
    }
    ///////// Contextual step event /////////

    IEnumerator startContextualEvent(EventStep eventStepToPlay)
    {
        //Set background
        if ((eventStepToPlay as ContextualEventStep).contextualBackgroundMaterial != null)
        {
            Material[] newMaterial = new Material[1];
            newMaterial[0] = (eventStepToPlay as ContextualEventStep).contextualBackgroundMaterial;
            MenuManagerScript.current.backgroundMesh.materials = newMaterial;

            MenuManagerScript.current.backgroundMesh.transform.localScale = (eventStepToPlay as ContextualEventStep).contextualBackgroundScaleRatios;
        }

        if (!isInBattlezone)
        {
            StartCoroutine(fadeStarmapToBattlezone());
            isInBattlezone = true;
        }
        AudioManager.current.StartCoroutine(AudioManager.current.musicSwitch(MusicType.BattlezoneCalm));

        yield return(new WaitForSeconds(1.2f));

        MenuManagerScript.current.contextualCanvas.enabled = true;
        StoryReader.current.actualEventStep = eventStepToPlay;
        StoryReader.current.StartStory();
    }
Пример #3
0
 public static void RegisterEvent(string appCode, EventStep step, ActivityStep type, Func <IWorkflowContext, IActivity, bool> predicate)
 {
     if (predicate != null)
     {
         string key = KeyTemplate.FormatTo(step.ToString(), type.ToString());
         EntityEventList.Add(key, predicate);
     }
 }
Пример #4
0
 public static void RegisterWorkItemEvent(EventStep step, ItemActionType type, Action <IWorkflowInstance, IWorkflowItem> predicate)
 {
     if (predicate != null)
     {
         string key = KeyTemplate.FormatTo(step.ToString(), type.ToString());
         WorkItemEventList.Add(key, predicate);
     }
 }
Пример #5
0
    void PlayStep()
    {
        Debug.Log("Playing Step: " + next.type);
        EventStep newStep = gameObject.AddComponent <EventStep>();

        newStep.Begin(this, next);

        GetNext();
    }
Пример #6
0
        public void RemoveForwardsToNextStep()
        {
            var vg = new VerificationGroup();

            EventStep.ExpectedUsage(vg, null, expectedNumberOfAdds: 0, expectedNumberOfRemoves: 1);

            EventStep.Remove(MockInfo.Lenient, _eventHandler);

            vg.Assert();
        }
Пример #7
0
 public static void RegisterEvent <TEntity>(EventStep step, EventType type, Func <object, bool> predicate)
 {
     if (predicate != null)
     {
         var    tfromType = ObjectHelper.GetRegisterType <TEntity>();
         string key       = KeyTemplate.FormatTo(step.ToString(), type.ToString(), tfromType.FullName);
         Logger.Debug("Register Event:{0}".FormatTo(key));
         EntityEventList.Add(key, predicate);
     }
 }
Пример #8
0
        public static bool RaiseEvent <TEntity>(EventStep step, EventType type, TEntity o)
        {
            string key = KeyTemplate.FormatTo(step.ToString(), type.ToString(), o.GetType().FullName);

            Logger.Debug("Raise Event:{0}".FormatTo(key));
            if (EntityEventList.ContainsKey(key))
            {
                return(EntityEventList[key](o));
            }
            return(true);
        }
    ///////// Battle step event /////////

    public void startBattleEvent(EventStep eventStepToPlay)
    {
        if (!isInBattlezone)
        {
            StartCoroutine(fadeStarmapToBattlezone());
            isInBattlezone = true;
        }
        AudioManager.current.StartCoroutine(AudioManager.current.musicSwitch(MusicType.BattlezoneAction));

        isInBattle = true;
        PlayerStats.current.isPlaying = true;

        EnnemySpawner.current.wavesToPlay = (eventStepToPlay as BattleEventStep).waves;
        EnnemySpawner.current.StartBattle();
    }
Пример #10
0
        public static void RaiseWorkItemEvent(EventStep step, ItemActionType type, IWorkflowInstance instance, IWorkflowItem item)
        {
            string key = KeyTemplate.FormatTo(step.ToString(), type.ToString());

            if (WorkItemEventList.ContainsKey(key))
            {
                try
                {
                    Logger.GetLogger("Workflow").Info("{0}:Raise WorkflowItemEvent:{1}".FormatTo(instance.Id, key));
                    WorkItemEventList[key](instance, item);
                }
                catch (Exception ex)
                {
                    Logger.GetLogger("Workflow").Info("{0}:Raise WorkflowEvent:{1} Error:{2},{3}".FormatTo(instance.Id, key, ex.Message, ex.StackTrace));
                }
            }
        }
Пример #11
0
        public static bool RaiseEvent(EventStep step, ActivityStep type, IWorkflowContext context, IActivity activity)
        {
            string key = KeyTemplate.FormatTo(step.ToString(), type.ToString());

            if (EntityEventList.ContainsKey(key))
            {
                Logger.GetLogger("Workflow").Info("{0}:Raise WorkflowEvent:{1}".FormatTo(context.FlowInstance.Id, key));
                try
                {
                    return(EntityEventList[key](context, activity));
                }
                catch (Exception ex)
                {
                    Logger.GetLogger("Workflow").Info("{0}:Raise WorkflowEvent:{1} Error:{2},{3}".FormatTo(context.FlowInstance.Id, key, ex.Message, ex.StackTrace));
                }
            }
            return(true);
        }
Пример #12
0
        public StepClosureStatisticDTO ClosedSchedulingStepStatistic()
        {
            StepClosureStatisticDTO closedSchedulingStepStatistic = new StepClosureStatisticDTO();

            try
            {
                IEnumerable <PatientStepSchedulingEvent> closedScheduling = _patientSchedulingEventRepository.GetAll
                                                                                (e => e.ClickEvent == ClickEvent.Close);

                closedSchedulingStepStatistic.NumberOfClosuresOnDateStep        = closedScheduling.Where(e => e.EventStep == EventStep.Date).Count();
                closedSchedulingStepStatistic.NumberOfClosuresOnSpecialtyStep   = closedScheduling.Where(e => e.EventStep == EventStep.Specialty).Count();
                closedSchedulingStepStatistic.NumberOfClosuresOnDoctorStep      = closedScheduling.Where(e => e.EventStep == EventStep.Doctor).Count();
                closedSchedulingStepStatistic.NumberOfClosuresOnAppointmentStep = closedScheduling.Where(e => e.EventStep == EventStep.Appointment).Count();
                closedSchedulingStepStatistic.TotalNumberOfClosures             = closedScheduling.Count();

                EventStep mostClosedStep = EventStep.Date;
                int       maxNumber      = closedSchedulingStepStatistic.NumberOfClosuresOnDateStep;

                if (closedSchedulingStepStatistic.NumberOfClosuresOnSpecialtyStep > maxNumber)
                {
                    mostClosedStep = EventStep.Specialty;
                    maxNumber      = closedSchedulingStepStatistic.NumberOfClosuresOnSpecialtyStep;
                }
                if (closedSchedulingStepStatistic.NumberOfClosuresOnDoctorStep > maxNumber)
                {
                    mostClosedStep = EventStep.Doctor;
                    maxNumber      = closedSchedulingStepStatistic.NumberOfClosuresOnDoctorStep;
                }
                if (closedSchedulingStepStatistic.NumberOfClosuresOnAppointmentStep > maxNumber)
                {
                    mostClosedStep = EventStep.Appointment;
                    maxNumber      = closedSchedulingStepStatistic.NumberOfClosuresOnAppointmentStep;
                }

                closedSchedulingStepStatistic.MostClosedStep = mostClosedStep;
            }
            catch (Exception)
            {
                return(new StepClosureStatisticDTO());
            }

            return(closedSchedulingStepStatistic);
        }
Пример #13
0
        public StepPreviousStatisticDTO PreviousSchedulingStepStatistic()
        {
            StepPreviousStatisticDTO previousSchedulingStepStatistic = new StepPreviousStatisticDTO();

            try
            {
                IEnumerable <PatientStepSchedulingEvent> closedScheduling = _patientSchedulingEventRepository.GetAll
                                                                                (e => e.ClickEvent == ClickEvent.Previous);

                previousSchedulingStepStatistic.NumberOfPreviousOnSpecialtyStep   = closedScheduling.Where(e => e.EventStep == EventStep.Specialty).Count();
                previousSchedulingStepStatistic.NumberOfPrevoiusOnDoctorStep      = closedScheduling.Where(e => e.EventStep == EventStep.Doctor).Count();
                previousSchedulingStepStatistic.NumberOfPreviousOnAppointmentStep = closedScheduling.Where(e => e.EventStep == EventStep.Appointment).Count();
                previousSchedulingStepStatistic.TotalNumberOfPrevious             = closedScheduling.Count();

                EventStep mostReturnedStep = EventStep.Specialty;
                int       maxNumber        = previousSchedulingStepStatistic.NumberOfPreviousOnSpecialtyStep;

                if (previousSchedulingStepStatistic.NumberOfPrevoiusOnDoctorStep > maxNumber)
                {
                    mostReturnedStep = EventStep.Doctor;
                    maxNumber        = previousSchedulingStepStatistic.NumberOfPrevoiusOnDoctorStep;
                }
                if (previousSchedulingStepStatistic.NumberOfPreviousOnAppointmentStep > maxNumber)
                {
                    mostReturnedStep = EventStep.Appointment;
                    maxNumber        = previousSchedulingStepStatistic.NumberOfPreviousOnAppointmentStep;
                }
                previousSchedulingStepStatistic.MostReturnedStep = mostReturnedStep;
            }
            catch (Exception)
            {
                return(new StepPreviousStatisticDTO());
            }

            return(previousSchedulingStepStatistic);
        }
    ///////// Station step event /////////

    public void startStationEvent(EventStep eventStepToPlay)
    {
        Debug.Log("Station unlocked");
        MenuManagerScript.current.enterStationButton.SetActive(true);
        //StartCoroutine(fadeBattlezoneToStarmap());
    }
Пример #15
0
 public void InsertStep(EventStep s, int pos)
 {
     step = ArrayHelper.Add(s, step);
     s.SetNextIndex(step.Length);
     this.MoveStepTo(pos, step.Length-1);
 }
Пример #16
0
 public void NextStepMissingForRemoveInVeryStrictMode()
 {
     Log("In very strict mode we need a next step so a call to 'Remove' should throw a 'mock missing' exception.");
     Assert.Throws <MockMissingException>(() => EventStep.Remove(MockInfo.VeryStrict, _eventHandler));
 }
Пример #17
0
 public void NextStepMissingForRemoveInStrictMode()
 {
     Log("In strict mode we don't need a next step so a call to 'Remove' should not throw.");
     EventStep.Remove(MockInfo.Strict, _eventHandler);
 }
Пример #18
0
 public void NextStepMissingForAddInLenientMode()
 {
     Log("In lenient mode we don't need a next step so a call to 'Add' should not throw.");
     EventStep.Add(MockInfo.Lenient, _eventHandler);
 }
Пример #19
0
 public static EventStep[] Add(EventStep n, EventStep[] list)
 {
     ArrayList tmp = new ArrayList();
     foreach(EventStep str in list) tmp.Add(str);
     tmp.Add(n);
     return tmp.ToArray(typeof(EventStep)) as EventStep[];
 }
Пример #20
0
 public static EventStep[] Remove(int index, EventStep[] list)
 {
     ArrayList tmp = new ArrayList();
     foreach(EventStep str in list) tmp.Add(str);
     tmp.RemoveAt(index);
     return tmp.ToArray(typeof(EventStep)) as EventStep[];
 }