Ejemplo n.º 1
0
		public void InitController(Boolean stop)
		{
			if (stop) {
				// Check location was aborted with quit
				locationManager.StopUpdatingLocation ();
				DestroyEngine ();
				appDelegate.CartStop ();

				return;
			}

			locationManager.StopUpdatingLocation ();
			locationManager.DistanceFilter = 2.0;
			locationManager.HeadingFilter = 5.0;
			locationManager.Delegate = new LocationManagerDelegate (this);
			locationManager.StartUpdatingLocation ();
			locationManager.StartUpdatingHeading ();

			// Create Engine
			CreateEngine (cart);

			// Create screens
			screenMain = new ScreenMain(this);

			// Set left button
			var leftBarButton = new UIBarButtonItem (Catalog.GetString("Quit"), UIBarButtonItemStyle.Plain, (sender, args) => {
				ButtonPressed(null);
				quit();
			});
			leftBarButton.TintColor = Colors.NavBarButton;
			screenMain.NavigationItem.SetLeftBarButtonItem(leftBarButton, true);

			// Set right button
			var rightBarButton = new UIBarButtonItem (Catalog.GetString("Save"), UIBarButtonItemStyle.Plain, (sender, args) => {
				ButtonPressed(null);
				Save();
			});
			rightBarButton.TintColor = Colors.NavBarButton;
			screenMain.NavigationItem.SetRightBarButtonItem(rightBarButton, true);

			screenListLocations = new ScreenList (this, ScreenType.Locations); 
			screenListItems = new ScreenList (this, ScreenType.Items); 
			screenListInventory = new ScreenList (this, ScreenType.Inventory); 
			screenListTasks = new ScreenList (this, ScreenType.Tasks); 

			Delegate = new ScreenControllerDelegate();

			// ... and push it to the UINavigationController while replacing the CheckLocation
			SetViewControllers (new UIViewController[] { screenMain }, animation);

			Title = cart.Name; 

			if (restore)
				Restore();
			else
				Start ();
		}
Ejemplo n.º 2
0
        public void RefreshCell(ScreenList owner, ScreenType screenType, Engine engine, UIObject obj)
        {
            if (imageIcon != null)
            {
                if (obj.Icon == null)
                {
                    imageIcon.Image = null;
                }
                else
                {
                    imageIcon.Image       = UIImage.LoadFromData(NSData.FromArray(obj.Icon.Data));
                    imageIcon.ContentMode = UIViewContentMode.ScaleAspectFit;
                }
            }

            string name = obj.Name == null ? "" : obj.Name;

            if (screenType == ScreenType.Tasks)
            {
                // If a task, than show CorrectState by character in front of name
                textTitle.Text = (((Task)obj).Complete ? (((Task)obj).CorrectState == TaskCorrectness.NotCorrect ? Strings.TaskNotCorrect : Strings.TaskCorrect) + " " : "") + name;
            }
            else
            {
                textTitle.Text = name;
            }

            if (HasDirection)
            {
                if (screenType != ScreenType.Tasks && screenType != ScreenType.Inventory)
                {
                    if (obj is Zone && ((Zone)obj).State == PlayerZoneState.Inside)
                    {
                        imageDirection.Hidden = false;
                        imageDirection.Image  = drawCenter();
                        textDistance.Hidden   = false;
                        textDistance.Text     = Catalog.GetString("Inside");
                    }
                    else
                    {
                        if ((obj is Item || obj is Character) && obj.ObjectLocation != null)
                        {
                            imageDirection.Hidden = true;
                            textDistance.Hidden   = true;
                        }
                        else
                        {
                            if (((Thing)obj).VectorFromPlayer != null)
                            {
                                imageDirection.Hidden = false;
                                imageDirection.Image  = drawArrow((((Thing)obj).VectorFromPlayer.Bearing.GetValueOrDefault() + owner.Ctrl.LocatitionManager.Heading.TrueHeading) % 360);                                  // * 180.0 / Math.PI);
                                textDistance.Hidden   = false;
                                textDistance.Text     = ((Thing)obj).VectorFromPlayer.Distance.BestMeasureAs(DistanceUnit.Meters);
                            }
                            else
                            {
                                imageDirection.Hidden = true;
                                textDistance.Hidden   = true;
                            }
                        }
                    }
                }
                else
                {
                    imageDirection.Hidden = true;
                    textDistance.Hidden   = true;
                }
            }
        }
Ejemplo n.º 3
0
 public ScreenListSource(ScreenList owner, ScreenController ctrl, ScreenType screen)
 {
     this.owner  = owner;
     this.ctrl   = ctrl;
     this.screen = screen;
 }
Ejemplo n.º 4
0
        public void InitController(Boolean stop)
        {
            if (stop)
            {
                // Check location was aborted with quit
                locationManager.StopUpdatingLocation();
                DestroyEngine();
                appDelegate.CartStop();

                return;
            }

            locationManager.StopUpdatingLocation();
            locationManager.DistanceFilter = 2.0;
            locationManager.HeadingFilter  = 5.0;
            locationManager.Delegate       = new LocationManagerDelegate(this);
            locationManager.StartUpdatingLocation();
            locationManager.StartUpdatingHeading();

            // Create Engine
            CreateEngine(cart);

            // Create screens
            screenMain = new ScreenMain(this);

            // Set left button
            var leftBarButton = new UIBarButtonItem(Catalog.GetString("Quit"), UIBarButtonItemStyle.Plain, (sender, args) => {
                ButtonPressed(null);
                quit();
            });

            leftBarButton.TintColor = Colors.NavBarButton;
            screenMain.NavigationItem.SetLeftBarButtonItem(leftBarButton, true);

            // Set right button
            var rightBarButton = new UIBarButtonItem(Catalog.GetString("Save"), UIBarButtonItemStyle.Plain, (sender, args) => {
                ButtonPressed(null);
                Save();
            });

            rightBarButton.TintColor = Colors.NavBarButton;
            screenMain.NavigationItem.SetRightBarButtonItem(rightBarButton, true);

            screenListLocations = new ScreenList(this, ScreenType.Locations);
            screenListItems     = new ScreenList(this, ScreenType.Items);
            screenListInventory = new ScreenList(this, ScreenType.Inventory);
            screenListTasks     = new ScreenList(this, ScreenType.Tasks);

            Delegate = new ScreenControllerDelegate();

            // ... and push it to the UINavigationController while replacing the CheckLocation
            SetViewControllers(new UIViewController[] { screenMain }, animation);

            Title = cart.Name;

            if (restore)
            {
                Restore();
            }
            else
            {
                Start();
            }
        }
Ejemplo n.º 5
0
		public void RefreshCell (ScreenList owner, ScreenType screenType, Engine engine, UIObject obj)
		{
			if (imageIcon != null) 
			{
				if (obj.Icon == null)
					imageIcon.Image = null;
				else
				{
					imageIcon.Image = UIImage.LoadFromData (NSData.FromArray (obj.Icon.Data));
					imageIcon.ContentMode = UIViewContentMode.ScaleAspectFit;
				}
			}

			string name = obj.Name == null ? "" : obj.Name;

			if (screenType == ScreenType.Tasks) 
			{
				// If a task, than show CorrectState by character in front of name
				textTitle.Text = (((Task)obj).Complete ? (((Task)obj).CorrectState == TaskCorrectness.NotCorrect ? Strings.TaskNotCorrect : Strings.TaskCorrect) + " " : "") + name;
			}
			else
				textTitle.Text = name;

			if (HasDirection)
			{
				if (screenType != ScreenType.Tasks && screenType != ScreenType.Inventory) {
					if (obj is Zone && ((Zone)obj).State == PlayerZoneState.Inside) {
						imageDirection.Hidden = false;
						imageDirection.Image = drawCenter ();
						textDistance.Hidden = false;
						textDistance.Text = Catalog.GetString("Inside");
					} else {
						if ((obj is Item || obj is Character) && obj.ObjectLocation != null) {
							imageDirection.Hidden = true;
							textDistance.Hidden = true;
						} else {
							if (((Thing)obj).VectorFromPlayer != null) {
								imageDirection.Hidden = false;
								imageDirection.Image = drawArrow ((((Thing)obj).VectorFromPlayer.Bearing.GetValueOrDefault () + owner.Ctrl.LocatitionManager.Heading.TrueHeading) % 360); // * 180.0 / Math.PI);
								textDistance.Hidden = false;
								textDistance.Text = ((Thing)obj).VectorFromPlayer.Distance.BestMeasureAs (DistanceUnit.Meters);
							} else {
								imageDirection.Hidden = true;
								textDistance.Hidden = true;
							}
						}
					}
				} else {
					imageDirection.Hidden = true;
					textDistance.Hidden = true;
				}
			}
		}
Ejemplo n.º 6
0
		public ScreenListSource(ScreenList owner, ScreenController ctrl, ScreenType screen) 
		{  
			this.owner = owner;
			this.ctrl = ctrl;
			this.screen = screen;
		}