예제 #1
0
			protected sealed override void CallbackTransport(shared.EffectEventType eType, shared.Effect cEffect)
			{
				if (null != _cAtom)
				{
					switch (eType)
					{
						case shared.EffectEventType.prepared:
							_cAtom.OnPrepared(cEffect);
							break;
						case shared.EffectEventType.started:
							_cAtom.OnStarted(cEffect);
							break;
						case shared.EffectEventType.stopped:
							_cAtom.OnStopped(cEffect);
							break;
						case shared.EffectEventType.failed:
							_cAtom.OnStopped(cEffect);
							break;
						default:
							throw new Exception("неизвестный тип события:" + eType.ToString()); //TODO LANG
					}
				}
				else
					(new Logger()).WriteWarning("effect:callback:transport: atom is null [" + eType.ToString() + "]");
			}
예제 #2
0
			protected sealed override void ContainerCallbackTransport(shared.ContainerEventType eType, shared.Effect cEffect)
			{
				(new Logger()).WriteDebug4("container:callback:transport:in:" + eType.ToString());
				if (null != _cAtom)
				{
					if (_cAtom is Container)
					{
						Container cContainer = (Container)_cAtom;
						switch (eType)
						{
							case shared.ContainerEventType.added:
								cContainer.OnEffectAdded(cEffect);
								break;
							case shared.ContainerEventType.prepared:
								cContainer.OnEffectPrepared(cEffect);
								break;
							case shared.ContainerEventType.started:
								cContainer.OnEffectStarted(cEffect);
								break;
							case shared.ContainerEventType.stopped:
								cContainer.OnEffectStopped(cEffect);
								break;
							case shared.ContainerEventType.onscreen:
								cContainer.OnEffectOnScreen(cEffect);
								break;
							case shared.ContainerEventType.offscreen:
								cContainer.OnEffectOffScreen(cEffect);
								break;
							case shared.ContainerEventType.failed:
								cContainer.OnEffectFailed(cEffect);
								break;
							default:
								throw new Exception("неизвестный тип события контейнера:" + eType.ToString()); //TODO LANG
						}
					}
					else
						throw new Exception("эффект не является контейнером:" + _cAtom.ToString() + ". событие контейнера:" + eType.ToString()); //TODO LANG
				}
				else
					(new Logger()).WriteWarning("container:callback:transport: atom is null [" + eType.ToString() + "]");
				(new Logger()).WriteDebug4("container:callback:transport:out:" + eType.ToString());
			}
예제 #3
0
		public static void OnEffectEvent(shared.EffectEventType eEventType, EffectCover cEffectCover)
		{
			Logger cLogger = new Logger();
            cLogger.WriteDebug3("in [" + eEventType.ToString() + "]");
			try
			{
				if (null != cEffectCover)
				{
					shared.Effect cEffectShared = null;
					cLogger.WriteDebug4("effect:event:" + eEventType.ToString() + ":lock:before [ec hc:" + cEffectCover.GetHashCode() + " info: " + cEffectCover.sInfo + "]");
					lock (_ahEffects)
						cEffectShared = _ahEffects.FirstOrDefault(row => row.Value == cEffectCover).Key;
					cLogger.WriteDebug4("effect:event:" + eEventType.ToString() + ":lock:after [ec hc:" + cEffectCover.GetHashCode() + "]");
					if (null != cEffectShared)
					{
						cLogger.WriteDebug4("effect:event:" + eEventType.ToString() + ":raise:before [ec hc:" + cEffectCover.GetHashCode() + "][shared hc:" + cEffectShared.GetHashCode() + "]");
						cEffectShared.OnEffectEventRaised(eEventType);
						cLogger.WriteDebug4("effect:event:" + eEventType.ToString() + ":raise:after [ec hc:" + cEffectCover.GetHashCode() + "][shared hc:" + cEffectShared.GetHashCode() + "]");
					}
					else
						throw new Exception("effect:event:" + eEventType.ToString() + ": указанный экземпляр эффекта не зарегистрирован на сервере [ec hc:" + cEffectCover.GetHashCode() + "]");
				}
				else
					throw new Exception("effect:event:" + eEventType.ToString() + ": экземпляр эффекта не может быть null");
			}
			catch (Exception ex)
			{
				cLogger.WriteError(ex);
			}
			cLogger.WriteDebug4("return [" + eEventType.ToString() + "]");
		}
예제 #4
0
		static void Roll_OnDirectionSet(shared.Roll cSender, shared.Roll.Direction eDirection)
		{
			try
			{
				EffectCover cEffectCover = EffectCoverGet(cSender);
				if (null == cEffectCover)
					throw new Exception("roll:direction:set: указанный объект не зарегистрирован на сервере [hc:" + cSender.GetHashCode() + "]");
				((BTL.Play.Roll)cEffectCover.oEffect).eDirection = (BTL.Play.Roll.Direction)Enum.Parse(typeof(BTL.Play.Roll.Direction), eDirection.ToString(), true);
			}
			catch (Exception ex)
			{
				(new Logger()).WriteError(ex);
			}
		}