public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. compass = new CompassModel(); compass.DegreesChanged += Compass_DegreesChanged; compass.TimeChanged += Compass_TimeChanged; timeLabel.Text = DateTime.Now.ToString("hh:mm tt"); UpdateBackgroundColor(); stackviewDegrees.Alignment = UIStackViewAlignment.Center; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource compass = new CompassModel(); compass.DegreesChanged += Compass_DegreesChanged; compass.TimeChanged += Compass_TimeChanged; SetContentView(Resource.Layout.Main); timeLabel = FindViewById <TextView>(Resource.Id.timeLabel); degreesLabel = FindViewById <TextView>(Resource.Id.degreesLabel); directionLabel = FindViewById <TextView>(Resource.Id.directionLabel); timeLabel.Text = DateTime.Now.ToString("hh:mm tt"); UpdateBackground(); // Get our button from the layout resource, // and attach an event to it //Button button = FindViewById<Button>(Resource.Id.myButton); //button.Click += delegate { button.Text = $"{count++} clicks!"; }; }
void Start() { mountainHandler = GameObject.Find ("Map").GetComponent<MountainHandler> (); compassModel = GameObject.Find ("Compass").GetComponent<CompassModel> (); changePiece = gameObject.GetComponent<ChangePiece> (); rotationMiddle = GameObject.Find ("Main Camera").GetComponent<ChangePiece> ().rotationMiddlePositions; for (int n = 0; n<16; n++) for (int i = 0; i<3; i++) // calculate camera positions on leaving the compass mode leavingCameraPositions [n, i] = rotationMiddle [i] + (Quaternion.Euler (0, 22.5f * n, 0) * new Vector3(19.696f,3.473f,0));// x = Distance * sin(80) / sin(90); y = Distance * sin(10) / sin(90) Vector3 angles = transform.eulerAngles; rotationYAxis = angles.y; rotationXAxis = angles.x; // Make the rigid body not change rotation if(GetComponent<Rigidbody>()) { GetComponent<Rigidbody>().freezeRotation = true; } }