Ejemplo n.º 1
0
 public void RemoveEventListener(PlayEventType type, Action callback)
 {
     if (!events.ContainsKey(type))
     {
         return;
     }
     events[type].Remove(callback);
 }
Ejemplo n.º 2
0
 public void AddEventListener(PlayEventType type, Action callback)
 {
     if (!events.ContainsKey(type))
     {
         events[type] = new List <Action>();
     }
     events[type].Add(callback);
 }
Ejemplo n.º 3
0
        public static PlayEventProperties GetByType(PlayEventType type)
        {
            if (!ByType.ContainsKey(type))
            {
                throw AirainSimException.NoPropertiesForEventType(type);
            }

            return(ByType[type]);
        }
Ejemplo n.º 4
0
 public void SendEvent(PlayEventType type)
 {
     if (!events.ContainsKey(type))
     {
         return;
     }
     foreach (var _event in events[type])
     {
         _event();
     }
 }
Ejemplo n.º 5
0
        private void PlayRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            PlayDoWorkResult r = new PlayDoWorkResult();

            r.hr = 0;

            if (!e.Cancelled)
            {
                r = e.Result as PlayDoWorkResult;
            }

            PlayEventType t  = (e.Cancelled) ? PlayEventType.Canceled : PlayEventType.Finished;
            var           ev = new PlayEvent(t, r.hr, m_playWorker);

            CallEventCallback(ev);
        }
Ejemplo n.º 6
0
    public void StartEvent(PlayEventType type)
    {
        if (isPlay)
        {
            return;
        }

        playTime     = 0.0f;
        isSlowMotion = false;

        currentEvent = type;
        isPlay       = true;

        for (int i = 0; i < objList.Count; i++)
        {
            objList[i].SetActive(true);
            objList[i].transform.GetChild(0).localPosition = originPosList[i];
        }
    }
Ejemplo n.º 7
0
 public void AckEvent(PlayEventType t)
 {
     if (!inMission)
     {
         return;
     }
     if (curMission < missions.GetLength(0))
     {
         if (missions[curMission].condition == t)
         {
             curNum++;
             UpdateText();
             if (curNum >= missions[curMission].num)
             {
                 // next mission
                 StartCoroutine(NextMission());
             }
         }
     }
 }
Ejemplo n.º 8
0
        private PlayEventProperties(
            PlayEventType type,
            bool automatic,
            int baseEventScore,
            int baseTickScore,
            Func <GameStatus, bool> additionalValidation,
            Func <GameStatus, GameStatus> additionalEffects,
            Func <GameStatus, int> stepCount)
        {
            Type                 = type;
            Automatic            = automatic;
            BaseEventScore       = baseEventScore;
            BaseTickScore        = baseTickScore;
            AdditionalValidation = additionalValidation;
            AdditionalEffects    = additionalEffects;
            StepCount            = stepCount;

            All.Add(this);
            ByType[type] = this;
        }
Ejemplo n.º 9
0
 public static AirainSimException NoPropertiesForEventType(PlayEventType type) => new AirainSimException($"No properties declared for event type {type}");
Ejemplo n.º 10
0
 public PlayEvent(PlayEventType type)
 {
     Type = type;
 }
Ejemplo n.º 11
0
 public void SendEvent(PlayEventType type)
 {
     missionManager.AckEvent(type);
     eventDispatcher.SendEvent(type);
 }
Ejemplo n.º 12
0
 public void RemoveEventListener(PlayEventType type, Action callback)
 {
     eventDispatcher.RemoveEventListener(type, callback);
 }
Ejemplo n.º 13
0
 public PlayEvent(PlayEventType t, int aErcd, BackgroundWorker aBw)
 {
     eventType = t;
     ercd      = aErcd;
     bw        = aBw;
 }