public void Store(string key, ILifetimeObject obj) { var stack = GetStackFor(key); stack.Push(obj); obj.OwnerStack = stack; }
public SAMEffectWrapper CreateEffect(ILifetimeObject owner, SoundEffect effect) { var e = new SAMEffectWrapper(this, owner, effect); _activeEffects.Add(e); return(e); }
public DebugListener(string ident, ILifetimeObject owner, Keys actionkey, KeyboardModifiers mod, DebugListenerType debugtype) { Identifier = ident; key = actionkey; modifiers = mod; type = debugtype; Owner = owner; }
public DebugListener(string parentIdent, string ident, ILifetimeObject owner, KeyCombinationList src, DebugListenerType debugtype) { ParentIdentifier = parentIdent; Identifier = ident; keys = src; Type = debugtype; Owner = owner; }
public DebugListener(string parentIdent, string ident, ILifetimeObject owner, SKeys actionkey, KeyModifier mod, DebugListenerType debugtype) { ParentIdentifier = parentIdent; Identifier = ident; keys = new KeyCombinationList(new KeyCombination(actionkey, mod)); Type = debugtype; Owner = owner; }
public static void AddPush(string ident, ILifetimeObject owner, Keys actionkey, KeyboardModifiers mod, Action<DebugListener> listenerEvent = null) { var upperIdent = ident.ToUpper(); if (listeners.ContainsKey(upperIdent)) listeners.Remove(upperIdent); var result = new DebugListener(ident, owner, actionkey, mod, DebugListener.DebugListenerType.Push); if (listenerEvent != null) result.SetEvent(listenerEvent); listeners.Add(upperIdent, result); }
public static void AddSwitch(string ident, ILifetimeObject owner, Keys actionkey, KeyboardModifiers mod, bool initial) { var upperIdent = ident.ToUpper(); if (listeners.ContainsKey(upperIdent)) listeners.Remove(upperIdent); var result = new DebugListener(ident, owner, actionkey, mod, DebugListener.DebugListenerType.Switch); result.Set(initial); listeners.Add(upperIdent, result); }
public static void AddFunctionless(string parentIdent, string ident, ILifetimeObject owner) { var upperIdent = ident.ToUpper(); if (listeners.ContainsKey(upperIdent)) { listeners.Remove(upperIdent); } var result = new DebugListener(parentIdent, ident, owner, KCL.C(SKeys.X), DebugListener.DebugListenerType.Functionless); result.Set(true); listeners.Add(upperIdent, result); }
public static void AddSwitch(string parentIdent, string ident, ILifetimeObject owner, KeyCombinationList sources, bool initial) { var upperIdent = ident.ToUpper(); if (listeners.ContainsKey(upperIdent)) { initial = listeners[upperIdent].SelfActive; listeners.Remove(upperIdent); } var result = new DebugListener(parentIdent, ident, owner, sources, DebugListener.DebugListenerType.Switch); result.Set(initial); listeners.Add(upperIdent, result); }
public static void AddPush(string parentIdent, string ident, ILifetimeObject owner, SKeys actionkey, KeyModifier mod, Action <DebugListener> listenerEvent = null) { var upperIdent = ident.ToUpper(); if (listeners.ContainsKey(upperIdent)) { listeners.Remove(upperIdent); } var result = new DebugListener(parentIdent, ident, owner, actionkey, mod, DebugListener.DebugListenerType.Push); if (listenerEvent != null) { result.SetEvent(listenerEvent); } listeners.Add(upperIdent, result); }
public void Remove(ILifetimeObject obj) { var stack = obj.OwnerStack; if (stack == null || stack.Count == 0) { return; } var current = stack.Peek() as ILifetimeObject; if (obj != current) { throw new EventSourcingException("当前要移除的ILifetimeObject '{0}'不是其所属的Stack中的顶层元素,无法被移除"); } stack.Pop(); }
public SAMEffectWrapper(SAMSoundPlayer player, ILifetimeObject owner, SoundEffect effect) { Player = player; Owner = owner; Instance = effect.CreateInstance(); }
public SAMEffectWrapper GetEffectLaser(ILifetimeObject owner) => CreateEffect(owner, effectLaser);
public DebugTextDisplayLine AddLine(string debugSettingsKey, Func <string> text, ILifetimeObject owner) { return(AddLine(new DebugTextDisplayLine(text, () => DebugSettings.Get(debugSettingsKey)) { Owner = owner })); }