private void Start() { onSceneLoadStarted.AddListener(Mng.OnSceneLoadStarted); onSceneLoadStarted.AddListener(OnSceneLoadStarted); onSceneLoadStarted.AddListener(Mng.InputCtrl.ResetAllInputs); onSceneLoadEnded.AddListener(OnSceneLoadEnded); onMainMenuSceneLoadStarted.AddListener(Mng.OnMainMenuSceneLoadStarted); onLevelSceneLoadStarted.AddListener(Mng.OnLevelSceneLoadStarted); }
public static void StartListening(string eventName, UnityAction <int> listener) { UnityEventInt thisEvent = null; if (Instance.eventDictionaryInt.TryGetValue(eventName, out thisEvent)) { thisEvent.AddListener(listener); } else { thisEvent = new UnityEventInt(); thisEvent.AddListener(listener); Instance.eventDictionaryInt.Add(eventName, thisEvent); } }
public void SetMapZone(MapZone newZone) { buyOilField.RemoveListener(mapZone.buyOilField); buyCoalMine.RemoveListener(mapZone.buyCoalMine); buyLoggingCamp.RemoveListener(mapZone.buyLoggingSite); buyLobbyingPower.RemoveListener(mapZone.buyLobbyingPower); buyWasteDumpingSite.RemoveListener(mapZone.buyWasteDump); mapZone = newZone; buyOilField.AddListener(newZone.buyOilField); buyCoalMine.AddListener(newZone.buyCoalMine); buyLoggingCamp.AddListener(newZone.buyLoggingSite); buyWasteDumpingSite.AddListener(newZone.buyWasteDump); buyLobbyingPower.AddListener(newZone.buyLobbyingPower); }
// Override with parameter <int> public static void StartListening(string eventName, UnityAction <int> listener) { UnityEventInt thisEvent = null; Debug.Log("MessageManager adds " + eventName); // Try get value a eventName and add listener to it if (instance.eventDictionaryParamInt.TryGetValue(eventName, out thisEvent)) { thisEvent.AddListener(listener); } else { thisEvent = new UnityEventInt(); thisEvent.AddListener(listener); instance.eventDictionaryParamInt.Add(eventName, thisEvent); } }
public static void StartListening(string eventName, UnityAction <int> listener) { eventName = StandardizeString(eventName); VRsqrUtil.Debug.LogInfo("StartListening: eventName = " + eventName); UnityEventInt thisEvent = null; if (instance.NameToListenedEventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.AddListener(listener); } else { thisEvent = new UnityEventInt(); thisEvent.AddListener(listener); //instance.NameToListenedEventDictionary.Add(eventName.ToLower(), thisEvent); instance.NameToListenedEventDictionary[eventName] = thisEvent; } }