예제 #1
0
    void Start()
    {
        playerLabels = new string[4];
        GameObject cameraTarget = new GameObject("Camera Target");

        pa = cameraTarget.AddComponent <PositionAverager>();
    }
예제 #2
0
 private void Cleanup()
 {
     m_Averager.PositionUpdated -= Averager_PositionUpdated;
     m_Averager = null;
     m_Location.StopListening();
     m_Location = null;
 }
예제 #3
0
 void Start()
 {
     pa = new GameObject("Camera Target").AddComponent <PositionAverager>();
     GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraController>().target = pa.transform;
     //canvas = GameObject.FindGameObjectWithTag("Canvas").GetComponent<Canvas>();
 }
예제 #4
0
        public TagHydrant()
            : base("Tag Hydrant")
        {
            m_MediaPicker = DependencyService.Get <IMediaPicker>();
            var device = Resolver.Resolve <IDevice>();

            m_MediaPicker = m_MediaPicker ?? device.MediaPicker;


            m_Header = new HWHeader("Hydrant Details")
            {
                Margin = new Thickness(0, 0, 0, 0)
            };
            OutsideLayout.Children.Add(m_Header);

            m_ButtonLayout = new HWButtonBar();
            OutsideLayout.Children.Add(m_ButtonLayout);

            CancelButton          = m_ButtonLayout.Add("Cancel", LayoutOptions.StartAndExpand);
            CancelButton.Clicked += CancelButton_Clicked;

            SaveButton          = m_ButtonLayout.Add("Save", LayoutOptions.EndAndExpand);
            SaveButton.Clicked += SaveButton_Clicked;

            m_layoutPhoto = new StackLayout
            {
                Orientation       = StackOrientation.Horizontal,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Margin            = new Thickness(5, 0, 5, 0)
            };
            OutsideLayout.Children.Add(m_layoutPhoto);

            Frame imageFrame = new Frame
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                HasShadow         = false,
                Margin            = new Thickness(3, 3, 3, 3),
                Padding           = new Thickness(0, 0, 0, 0)
            };

            m_layoutPhoto.Children.Add(imageFrame);

            m_imgHydrant = new Image
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Aspect            = Aspect.AspectFit,
                Margin            = new Thickness(0, 0, 0, 0)
            };
            imageFrame.Content = m_imgHydrant;

            m_btnTakePhoto = new HWButton
            {
                Text            = "Take Photo",
                VerticalOptions = LayoutOptions.Center,
                WidthRequest    = 80,
                HeightRequest   = 40,
                BorderColor     = Color.Black,
                BorderWidth     = 1,
                BackgroundColor = Color.White,
                FontAttributes  = FontAttributes.Bold,
                FontSize        = Device.GetNamedSize(NamedSize.Small, typeof(Button))
            };
            m_btnTakePhoto.Clicked += TakePhoto_Clicked;
            m_layoutPhoto.Children.Add(m_btnTakePhoto);

            if (m_MediaPicker.IsCameraAvailable)
            {
                m_btnTakePhoto.IsEnabled = true;
                SaveButton.IsEnabled     = false;
            }
            else
            {
                m_btnTakePhoto.IsEnabled = false;
                SaveButton.IsEnabled     = true;
            }

            StackLayout lableLayout = new StackLayout
            {
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Margin            = new Thickness(5, 10, 5, 10)
            };

            OutsideLayout.Children.Add(lableLayout);

            m_lblCount = new HWLabel
            {
                Text = "Position Count:",
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            lableLayout.Children.Add(m_lblCount);

            m_lblLatitude = new HWLabel
            {
                Text = "Latitude:",
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            lableLayout.Children.Add(m_lblLatitude);

            m_lblLongitude = new HWLabel
            {
                Text = "Longitude:",
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            lableLayout.Children.Add(m_lblLongitude);

            m_Location = new LocationManager();
            m_Location.StartListening();

            m_Averager = new PositionAverager(m_Location, 10);
            m_Averager.PositionUpdated += Averager_PositionUpdated;
            StartUpdateLocation();
        }