public void RemoveEventListener(PlayEventType type, Action callback) { if (!events.ContainsKey(type)) { return; } events[type].Remove(callback); }
public void AddEventListener(PlayEventType type, Action callback) { if (!events.ContainsKey(type)) { events[type] = new List <Action>(); } events[type].Add(callback); }
public static PlayEventProperties GetByType(PlayEventType type) { if (!ByType.ContainsKey(type)) { throw AirainSimException.NoPropertiesForEventType(type); } return(ByType[type]); }
public void SendEvent(PlayEventType type) { if (!events.ContainsKey(type)) { return; } foreach (var _event in events[type]) { _event(); } }
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); }
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]; } }
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()); } } } }
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; }
public static AirainSimException NoPropertiesForEventType(PlayEventType type) => new AirainSimException($"No properties declared for event type {type}");
public PlayEvent(PlayEventType type) { Type = type; }
public void SendEvent(PlayEventType type) { missionManager.AckEvent(type); eventDispatcher.SendEvent(type); }
public void RemoveEventListener(PlayEventType type, Action callback) { eventDispatcher.RemoveEventListener(type, callback); }
public PlayEvent(PlayEventType t, int aErcd, BackgroundWorker aBw) { eventType = t; ercd = aErcd; bw = aBw; }