private void Start() { _inputHandler = GetComponent <RingInputHandler>(); _inputHandler.PointerDown += OnPointerDown; _inputHandler.Drag += OnDrag; _inputHandler.PointerUp += OnPointerUp; _contactHandler = GetComponent <RingContactHandler>(); _contactHandler.Entered += OnTowerEntered; _contactHandler.Exited += OnTowerExited; _ringView = GetComponent <RingView>(); _ringView.SetInteractive(false); _isAnchoredToTower = true; }
/// <summary> /// Shows the talkback window. /// </summary> private void ShowTalkbackWindow() { LayoutInflater inflater = (LayoutInflater)GetSystemService(LayoutInflaterService); View view = inflater.Inflate(Resource.Layout.camera_talkback, null, true); int height = FindViewById(Resource.Id.viewCameraCtrlContainer).Height; PopupWindow window = new PopupWindow(view, ViewGroup.LayoutParams.MatchParent, height, true); window.ShowAsDropDown((View)btnPlay.Parent); ImageButton btnClose = view.FindViewById <ImageButton>(Resource.Id.btnClose); btnClose.Touch += (sender, e) => window.Dismiss(); RingView ringView = view.FindViewById <RingView>(Resource.Id.ringView); ringView.Visibility = ViewStates.Invisible; Button btnTalk = view.FindViewById <Button>(Resource.Id.btnTalkback); btnTalk.Touch += (sender, e) => { switch (e.Event.Action) { case MotionEventActions.Down: ringView.Visibility = ViewStates.Visible; break; case MotionEventActions.Up: ringView.Visibility = ViewStates.Invisible; break; } }; window.Update(); ringView.Post(() => { ringView.SetMinRadiusAndDistance(btnTalk.Height / 2.0f, Utils.Dip2px(this, 22)); }); }
private void Awake() { model = GetComponent <RingModel>(); view = GetComponent <RingView>(); }