internal void Notify(string key) { #if LOG_DEBUG Debug.Log(string.Format("OBSERVER:{0}", key)); #endif// LOG_DEBUG BroadcastTunnel <string, object> .Notify(key, null, this.group); }
void OnActive(bool value) { //Debug.Log("ONACTIVE:" + value + ", OLD:" + this.activate + ", GEN:" + this.generation); this.activate = value; this.waitForDelay = 0; ++this.generation; BroadcastTunnel <int, bool> .Notify(LoadingIndicator.SCREEN_LOCK, value); //this.LockInputGuides(value); if (this.introOutro && this.introOutro.Animation) { float startTime = 0; if (this.inOutAction && this.introOutro.Animation.isPlaying) { startTime = 1 - this.introOutro.CurrentAnimState.normalizedTime; if (value) { if (null != this.outroDone) { this.outroDone(); } } else { if (null != this.introDone) { this.introDone(); } } } this.introOutro.SetCurrentAnimPair(value ? 0 : 1); this.introOutro.Animation.ForcePlay(true); if (0 < startTime) { this.introOutro.CurrentAnimState.normalizedTime = startTime; this.introOutro.Animation.Sample(); } this.inOutAction = true; if (value) { this.gameObject.SetActive(true); } } else { this.inOutAction = false; this.gameObject.SetActive(value); } if (value) { this.objectAnim.ForcePlay(true); } }
void IncreaseLock() { ++this.lockCount; if (!this.lockObject.enabled) { this.lockObject.enabled = true; BroadcastTunnel <int, bool> .Notify(Wait.SCREEN_LOCK, true); } }
void ClearLock() { this.lockCount = 0; if (this.lockObject.enabled) { this.lockObject.enabled = false; } BroadcastTunnel <int, bool> .Notify(Wait.SCREEN_LOCK, false); }
bool DoRemove(string key, int hash) { Action <object> wrappedReceiver; if (this.wrappedReceiverMap.TryGetValue(hash, out wrappedReceiver)) { this.wrappedReceiverMap.Remove(hash); return(BroadcastTunnel <string, object> .Remove(key, wrappedReceiver, this.group)); } return(false); }
internal void Notify <V>(string key, V value, Action <V> setFunc = null) { if (null != setFunc) { setFunc(value); } #if LOG_DEBUG if ("ticketcharger.updatedms" != key)// TODO: Ignore List { Debug.Log(string.Format("OBSERVER:{0}, VALUE:{1}, SET?:{2}", key, value, (null != setFunc))); } #endif// LOG_DEBUG BroadcastTunnel <string, object> .Notify(key, value, this.group); }
internal bool TryNotify <V>(string key, V value, V oldValue, Action <V> setFunc = null) { if (value.Equals(oldValue)) { return(false); } if (null != setFunc) { setFunc(value); } #if LOG_DEBUG Debug.Log(string.Format("OBSERVER_TRY_SUCCEED:{0}, VALUE:{1}, SET?:{2}", key, value, (null != setFunc))); #endif// LOG_DEBUG BroadcastTunnel <string, object> .Notify(key, value, this.group); return(true); }
static void UpdateScreenLock(bool value) { if (value == Popup.ScreenLocked) { return; } if (value) { if (Popup.IsShownPop) { Popup.ScreenLocked = true; BroadcastTunnel <int, bool> .Notify(Popup.SCREEN_LOCK, true); } } else { if (!Popup.IsShownPop) { Popup.ScreenLocked = false; BroadcastTunnel <int, bool> .Notify(Popup.SCREEN_LOCK, false); } } }
public void CloseSingleton() { BroadcastTunnel <string, object> .RemoveAllByGroup(this.group); }
internal void Clear() { this.wrappedReceiverMap.Clear(); BroadcastTunnel <string, object> .RemoveAllByGroup(this.group); }
void DoAdd(string key, int hash, Action <object> wrappedReceiver) { this.wrappedReceiverMap[hash] = wrappedReceiver; BroadcastTunnel <string, object> .Add(key, wrappedReceiver, this.group); }