コード例 #1
0
		public GameDetailScreen(GameController ctrl, UIObject obj)
		{
			this.ctrl = ctrl;
			this.activeObject = obj;
			if (this.activeObject != null) {
				this.activeObject.PropertyChanged += OnPropertyChanged;
			}

			_refresh = new CallDelayer(100, 500, (o) => Refresh(o));
		}
コード例 #2
0
		/// <summary>
		/// Initializes a new instance of the <see cref="WF.Player.Android.ScreenMainAdapter"/> class.
		/// </summary>
		/// <param name="context">Context.</param>
		/// <param name="engine">Engine.</param>
		public GameMainScreenAdapter(GameMainScreen owner, GameController ctrl) : base()
		{
			_ctrl = ctrl;
			_owner = owner;
		}
コード例 #3
0
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			base.OnCreateView (inflater, container, savedInstanceState);

			// Save ScreenController for later use
			ctrl = ((GameController)this.Activity);

			if (container == null)
				return null;

			var view = inflater.Inflate(Resource.Layout.GameDialogScreen, container, false);

			imageView = view.FindViewById<ImageView> (Resource.Id.imageView);
			textDescription = view.FindViewById<TextView> (Resource.Id.textDescription);
			spinnerInput = view.FindViewById<Spinner> (Resource.Id.spinnerMulti);
			editInput = view.FindViewById<EditText> (Resource.Id.editInput);
			layoutDialog = view.FindViewById<LinearLayout> (Resource.Id.layoutDialog);
			layoutInput = view.FindViewById<LinearLayout> (Resource.Id.layoutInput);
			layoutButton = view.FindViewById<LinearLayout> (Resource.Id.layoutButton);

			// Don't know a better way
			layoutDialog.SetBackgroundResource(Main.BottomBackground);
			layoutButton.SetBackgroundResource(Main.BottomBackground);

			if (input == null) {
				// Normal dialog
				layoutDialog.Visibility = ViewStates.Visible;
				layoutInput.Visibility = ViewStates.Gone;

				btnView1 = view.FindViewById<Button> (Resource.Id.button1);
				btnView1.SetTextColor(Color.White);
				btnView1.SetBackgroundResource(Main.ButtonBackground);
				btnView1.Click += OnButtonClicked;

				btnView2 = view.FindViewById<Button> (Resource.Id.button2);
				btnView2.SetTextColor(Color.White);
				btnView2.SetBackgroundResource(Main.ButtonBackground);
				btnView2.Click += OnButtonClicked;
			} else {
				if (input.InputType == InputType.MultipleChoice) {
					// Multiple choice dialog
					layoutDialog.Visibility = ViewStates.Gone;
					layoutInput.Visibility = ViewStates.Visible;
					spinnerInput.Visibility = ViewStates.Visible;
					editInput.Visibility = ViewStates.Gone;
				} else {
					// Input dialog
					layoutDialog.Visibility = ViewStates.Gone;
					layoutInput.Visibility = ViewStates.Visible;
					spinnerInput.Visibility = ViewStates.Gone;
					editInput.Visibility = ViewStates.Visible;

					editInput.Text = "";
					editInput.EditorAction += HandleEditorAction;  
				}

				btnInput = view.FindViewById<Button> (Resource.Id.buttonInput);
				btnInput.Text = ctrl.Resources.GetString(Resource.String.done);
				btnInput.SetBackgroundResource(Resource.Drawable.apptheme_btn_default_holo_light);
				btnInput.Click += OnInputClicked;
			}

			return view;
		}
コード例 #4
0
		public GameListScreenAdapter(GameListScreen owner, GameController ctrl, ScreenTypes screen) : base()
		{
			this.ctrl = ctrl;
			this.owner = owner;
			this.screen = screen;

			_directionSize = (int)(ctrl.Resources.DisplayMetrics.Density * 32.0);

		}
コード例 #5
0
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			mapView = base.OnCreateView (inflater, container, savedInstanceState);

			// Save ScreenController for later use
			ctrl = ((GameController)this.Activity);

			RelativeLayout view = new RelativeLayout(ctrl);
			view.AddView(mapView, new RelativeLayout.LayoutParams(-1, -1));

//			var view = inflater.Inflate(Resource.Layout.ScreenMap, container, false);
//
//			mapView = new MapView(ctrl);
//			mapView.OnCreate(savedInstanceState);
//
			// Set all relevant data for map

			_zoom = (float)Main.Prefs.GetDouble("MapZoom", 16);

			_map = this.Map;
			_map.MapType = GoogleMap.MapTypeNormal;
			_map.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(Main.GPS.Location.Latitude, Main.GPS.Location.Longitude), _zoom));
			_map.MyLocationEnabled = true;
			_map.BuildingsEnabled = true;
			_map.UiSettings.ZoomControlsEnabled = false;
			_map.UiSettings.MyLocationButtonEnabled = false;
			_map.UiSettings.CompassEnabled = false;
			_map.UiSettings.TiltGesturesEnabled = false;
			_map.UiSettings.RotateGesturesEnabled = false;
			_map.MapClick += OnMapClick;

			// Create tile layers
			_osmTileLayer = new OsmTileProvider("http://a.tile.openstreetmap.org/{0}/{1}/{2}.png");
			_ocmTileLayer = new OsmTileProvider("http://c.tile.opencyclemap.org/cycle/{0}/{1}/{2}.png");

			// Set selected map type
			SetMapType(Main.Prefs.GetInt("map_source", 0));

			// Create the zones the first time
			CreateZones();

			// Create layout for map buttons
			layoutButtons = new RelativeLayout(ctrl);

			// Button for center menu
			var lp = new RelativeLayout.LayoutParams(64, 64);
			lp.SetMargins(16, 16, 16, 8);
			lp.AddRule(LayoutRules.AlignParentLeft);
			lp.AddRule(LayoutRules.AlignParentTop);

			btnMapCenter = new ImageButton(ctrl);
			btnMapCenter.Id = 1;
			btnMapCenter.SetImageResource(Resource.Drawable.ic_button_center);
			btnMapCenter.SetBackgroundResource(Resource.Drawable.MapButton);
			btnMapCenter.Click += OnMapCenterButtonClick;

			layoutButtons.AddView(btnMapCenter, lp);

			// Button for the orientation: north up or always in direction
			lp = new RelativeLayout.LayoutParams(64, 64);
			lp.SetMargins(16, 8, 16, 16);
			lp.AddRule(LayoutRules.Below, btnMapCenter.Id);
			lp.AddRule(LayoutRules.AlignParentLeft);

			btnMapOrientation = new ImageButton(ctrl);
			if (Main.Prefs.GetBool ("MapOrientationNorth", true))
				btnMapOrientation.SetImageResource (Resource.Drawable.ic_button_orientation_north);
			else
				btnMapOrientation.SetImageResource (Resource.Drawable.ic_button_orientation);
			btnMapOrientation.SetBackgroundResource(Resource.Drawable.MapButton);
			btnMapOrientation.Click += OnMapOrientationButtonClick;

			layoutButtons.AddView(btnMapOrientation, lp);

			// Button for selecting the map type
			lp = new RelativeLayout.LayoutParams(64, 64);
			lp.SetMargins(16, 16, 16, 8);
			lp.AddRule(LayoutRules.AlignParentTop);
			lp.AddRule(LayoutRules.AlignParentRight);

			btnMapType = new ImageButton(ctrl);
			btnMapType.SetImageResource(Resource.Drawable.ic_button_layer);
			btnMapType.SetBackgroundResource(Resource.Drawable.MapButton);
			btnMapType.Click += OnMapTypeButtonClick;

			layoutButtons.AddView(btnMapType, lp);

			view.AddView(layoutButtons);

			return view;
		}
コード例 #6
0
		public GameMapScreen(GameController ctrl, UIObject obj)
		{
			this.ctrl = ctrl;
			this.activeObject = obj;
		}