示例#1
0
        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);
        }
示例#3
0
		public DebugListener(string ident, ILifetimeObject owner,  Keys actionkey, KeyboardModifiers mod, DebugListenerType debugtype)
		{
			Identifier = ident;
			key = actionkey;
			modifiers = mod;
			type = debugtype;
			Owner = owner;
		}
示例#4
0
 public DebugListener(string parentIdent, string ident, ILifetimeObject owner, KeyCombinationList src, DebugListenerType debugtype)
 {
     ParentIdentifier = parentIdent;
     Identifier       = ident;
     keys             = src;
     Type             = debugtype;
     Owner            = owner;
 }
示例#5
0
 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;
 }
示例#6
0
		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);
		}
示例#7
0
		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);
		}
示例#8
0
        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);
        }
示例#9
0
        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);
        }
示例#10
0
        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);
        }
示例#11
0
        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();
 }
示例#13
0
 public SAMEffectWrapper GetEffectLaser(ILifetimeObject owner) => CreateEffect(owner, effectLaser);
示例#14
0
 public DebugTextDisplayLine AddLine(string debugSettingsKey, Func <string> text, ILifetimeObject owner)
 {
     return(AddLine(new DebugTextDisplayLine(text, () => DebugSettings.Get(debugSettingsKey))
     {
         Owner = owner
     }));
 }