상속: ISubject
예제 #1
0
        public void OpenScreenUseScreenLocation_WhenNoMatchingScreenIsOpen_CreatesNewScreen()
        {
            var conductor    = CreateConductor();
            var firstSubject = new BaseSubject {
                Value = "First Subject"
            };
            var differentSubject = new BaseSubject {
                Value = "Different Subject"
            };

            conductor.OpenScreen(
                ScreenFactory
                .For <MultipleInstancesScreen>(Locator)
                );

            conductor.OpenScreen(
                ScreenFactory
                .WithSubject(firstSubject)
                .For <LocatableScreen>(Locator)
                );

            conductor.OpenScreen(
                ScreenFactory
                .WithSubject(differentSubject)
                .For <LocatableScreen>(Locator)
                );

            CollectionAssert.AreEqual(
                new[] { firstSubject, differentSubject },
                GetSubjectsOfOpenScreens(conductor)
                );
        }
예제 #2
0
	public void Notify(BaseSubject subject)
	{
		if (subject is GPS)
		{
			double distance = trigger.keyPosition.GetMeterDistanceTo(((GPS)subject).currentPosition);
			if (distance <= trigger.toleranceRadius)
			{
				KeyIsFind();
			}
		}
	}
예제 #3
0
        public void Update(BaseSubject <string> baseSubject, params string[] args)
        {
            if (baseSubject == this.baseSubject)
            {
                if (this.baseSubject.GetType() == typeof(NotifyPropertyChange))
                {
                    var subject         = this.baseSubject as NotifyPropertyChange;
                    var changedProperty = subject.NotifiableProperty;

                    Console.WriteLine($"Changed Property: {changedProperty}");
                }
            }
        }
예제 #4
0
파일: GPS.cs 프로젝트: jodoudou/BROU_SVPRA
	public void Notify(BaseSubject subject)
	{

        //////////////// Peut être désactiver le StepDetector
        //////////////// Le "if" ici  et au dessus le ToolBox.Instance.sensorManager.stepDetector.AddObserver(this);
        //////////////// La classe StepDetector
        //////////////// SensorManager -> 2 lignes : 20 et 11

        if (subject is StepDetector)
		{
			Vector3 direction = Quaternion.Euler(0, 0, -ToolBox.Instance.sensorManager.orientation.azimut) * Vector3.up;
			currentPosition.SetCoordinate(currentPosition.ToVector()/*+ (direction.normalized * LENGHT_STEP)*/);
			NotifyAllObservers();
		}
	}
예제 #5
0
	public void Notify(BaseSubject subject)
	{
		if (subject is NextStep)
		{
			if (inPre)
			{
				inPre = false;
				ExecuteTrigger();
			}
			else if (inPost)
			{
				inPost = false;
				GameToolBox.Instance.nextStep.RemoveObserver(this);
				NotifyAllObservers();
			}
		}
	}
예제 #6
0
	public void Notify(BaseSubject subject)
	{
		if (subject is Download)
		{
			DownloadType type = ((Download)subject).theDownload.type;
			if (type == DownloadType.Attractions)
			{
				if (toolBox.data.attractions != null)
				{
					BuildMenuAttractions();
				}
				else
				{
					ActiveMenuAttraction(false);
					ActiveMainMenu(true);
					toolBox.loadingScreen.enable(false);
				}
			}
			else if (type == DownloadType.Route)
			{
				if (toolBox.data.route != null)
				{
					if (openRoute)
					{
						GotoNavigation();
					}
					else
					{
						save.SaveRoute();
						toolBox.data.eleRoute = null;
						ActiveOptionRoute(false);
					}
				}
				else
				{
					toolBox.loadingScreen.enable(false);
				}
			}
		}
		else if (subject is GPS)
		{
			subject.RemoveObserver(this);
			toolBox.download.EnqueueAttraction(toolBox.sensorManager.gps.currentPosition);
		}
	}
예제 #7
0
        public void OpenScreenUseScreenLocation_WhenScreenFactoryIsDowncasted_Works()
        {
            var conductor     = CreateConductor();
            var singleSubject = new BaseSubject {
                Value = "Single Subject"
            };

            conductor.OpenScreen(
                ScreenFactory
                .WithSubject(singleSubject)
                .For <DerivedLocatableScreen>(Locator)
                );

            IScreenFactory <IScreenBase> downcasted = ScreenFactory
                                                      .WithSubject(singleSubject)
                                                      .For <DerivedLocatableScreen>(Locator);

            conductor.OpenScreen(downcasted);

            CollectionAssert.AreEqual(
                new[] { singleSubject },
                GetSubjectsOfOpenScreens(conductor)
                );
        }
예제 #8
0
        public void OpenScreenUseScreenLocation_WhenAttributeIsOnBaseClass_Works()
        {
            var conductor     = CreateConductor();
            var singleSubject = new BaseSubject {
                Value = "Single Subject"
            };

            conductor.OpenScreen(
                ScreenFactory
                .WithSubject(singleSubject)
                .For <DerivedLocatableScreen>(Locator)
                );

            conductor.OpenScreen(
                ScreenFactory
                .WithSubject(singleSubject)
                .For <DerivedLocatableScreen>(Locator)
                );

            CollectionAssert.AreEqual(
                new[] { singleSubject },
                GetSubjectsOfOpenScreens(conductor)
                );
        }
예제 #9
0
        public void OpenScreenUseScreenLocation_WhenMatchingScreenIsAlreadyOpen_ActivatesScreen()
        {
            var conductor     = CreateConductor();
            var singleSubject = new BaseSubject {
                Value = "Single Subject"
            };

            conductor.OpenScreen(
                ScreenFactory
                .WithSubject(singleSubject)
                .For <LocatableScreen>(Locator)
                );

            conductor.OpenScreen(
                ScreenFactory
                .WithSubject(singleSubject)
                .For <LocatableScreen>(Locator)
                );

            CollectionAssert.AreEqual(
                new[] { singleSubject },
                GetSubjectsOfOpenScreens(conductor)
                );
        }
예제 #10
0
 public View(BaseSubject <string> baseSubject)
 {
     this.baseSubject = baseSubject;
     this.baseSubject.Attach(this);
 }
예제 #11
0
	/// <summary>
	/// Call by the device sensor to orientate the camera 
	/// </summary>
	/// <param name="subject">the sensor</param>
	public void Notify(BaseSubject subject)
	{
		if (subject is GPS)
		{
			position.UpdateArLocation(((GPS)subject).currentPosition);
			transform.position = position.position + (3 * Vector3.up);//we don't use the gps altitude so we manualy put de camera above the ground.
		}
		else if (subject is Orientation)
		{
			Orientation o = (Orientation)subject;
			transform.rotation = Quaternion.Euler(new Vector3(o.pitch, o.azimut, o.roll));
		}
	}
예제 #12
0
	/// <summary>
	/// call by a trigger when the user finish it
	/// </summary>
	/// <param name="subject">the trigger</param>
	public void Notify(BaseSubject subject)
	{
		if (subject is Trigger)
		{
			if (subject is MultipleChoiceTrigger)
			{
				MultipleChoiceTrigger trigger = (MultipleChoiceTrigger)subject;
				if (data.route.Waypoints.ContainsKey(trigger.ChoiceMade.Waypoint))
				{
					nextGoal = data.route.Waypoints[trigger.ChoiceMade.Waypoint];
				}
			}
			subject.RemoveObserver(this);
			executeNextCondition();
		}
		else if (subject is Download)
		{
			Download download = (Download)subject;
			if (download.theDownload.type == DownloadType.Direction)
			{
				UpdateDirection(Polyline.GetPolylineFromXML(download.lastDownload.text));
			}
		}
	}
예제 #13
0
	/// <summary>
	/// call by the gps and compass to navigate.
	/// </summary>
	/// <param name="subject"></param>
	public void Notify(BaseSubject subject)
	{
		if (subject is GPS)
		{
			GPS gps = (GPS)subject;
			userGPSLocation = gps.currentPosition;
			UpdateGoogleMapNavigation();
		}
		else if (subject is Orientation)
		{
			Orientation o = (Orientation)subject;
			cursor.rotation = Quaternion.Euler(new Vector3(cursor.rotation.eulerAngles.x, cursor.rotation.eulerAngles.y, -o.azimut));
		}
		else if (subject is Download)
		{
			Download download = (Download)subject;
			if (download.theDownload.type == DownloadType.Map)
			{
				UpdateNewMap(download.lastDownload);
			}
		}
	}