private void test5() { //Matrix m = new Matrix(); //m.Scale(2.0,2.0); //m.Rotate(30); //m.Translate(200, 200); //image.RenderTransform = new MatrixTransform(m); //this.image.AddHandler(TouchEvent.TouchDownEvent, new TouchHandler(OnTouchDown)); //, null //MultiTouch.EnableGesture(this.canvas, new DragScaleRotate_G2(), null); //MultiTouch.EnableGesture(this.image, new DragScaleRotate_G2(true, true, true), null); //MultiTouch.EnableGesture(this.button, new DragScaleRotate_G2(true, true, true), null); Rect ScreenResolutionRect = new Rect(0, 0, System.Windows.SystemParameters.PrimaryScreenWidth, System.Windows.SystemParameters.PrimaryScreenHeight); DragScaleRotate dsr = MultiTouch.EnableGesture(this.image, new DragScaleRotate(true, true, true, true, ScreenResolutionRect), null) as DragScaleRotate; dsr.TranslateDamping = 0.95; //MultiTouch.EnableGesture(this.image, new MultiDragScaleRotate(true, true, true, true, ScreenResolutionRect), null); //MDSRInstance = MultiTouch.EnableGesture(this.image, new MultiDragScaleRotate(true, true, true, true, ScreenResolutionRect), null) as MultiDragScaleRotate; //MultiTouch.EnableGesture(this.image, new TouchEndGesture(), new GestureHandler(OnTouchEnd)); }
private void OnTouchUp(object sender, PQ.Multitouch.TouchEventArgs e) { System.Diagnostics.Debug.WriteLine(e.DownObj); BlobInfo[] blobs = MultiTouch.GetLocalBlobs(sender as UIElement); System.Diagnostics.Debug.WriteLine(blobs.Count()); //lb.Items.Add(blobs.Count()); }
private void ConnectFailed() { if (MessageBox.Show("Warning: PQMultiTouch Server not running. Please start it and then Click Ok to reconnect the server, otherwise the program will run without the support of PQMultiTouch Server.", "Warning", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { MultiTouch.ReConnect(); } }
private void test6() { //MultiTouch.EnableGesture(this.image, new SingleMoveGesture(), new GestureHandler(Ontest6SingleMoveImage)); //MultiTouch.EnableGesture(this, new SingleMoveGesture(), new GestureHandler(Ontest6SingleMoveImage),true); MultiTouch.EnableGesture(this, new ZoomGesture(), new ZoomHandler(OnZoom1)); }
private void CheckFlick() { if (MultiTouch.GetTouch() == TouchInfo.Began) { _startTouchPos = MultiTouch.GetTouchPosition(); } else if (MultiTouch.GetTouch() == TouchInfo.Ended) { _endTouchPos = MultiTouch.GetTouchPosition(); var direction = _endTouchPos - _startTouchPos; var aTapPoint = Camera.main.ScreenToWorldPoint(_startTouchPos); var aCollider2D = Physics2D.OverlapPoint(aTapPoint); if (direction.x < 0) { Debug.Log("LEFT"); soundeffect.AngleChange.Play(); nextZombieImage.transform.Rotate(new Vector3(0, 0, 90f)); } else if (direction.x > 0) { Debug.Log("RIGHT"); soundeffect.AngleChange.Play(); nextZombieImage.transform.Rotate(new Vector3(0, 0, -90f)); } } }
private void test1() { //MultiTouch.EnableGesture(this.image, new SingleDownGesture(), new GestureHandler(DebugGestureHandler)); //MultiTouch.EnableGesture(this.image, new SingleMoveGesture(), new GestureHandler(DebugGestureHandler)); //MultiTouch.EnableGesture(this.image, new SingleUpGesture(), new GestureHandler(DebugGestureHandler)); //MultiTouch.EnableGesture(this.image, new SingleClickGesture(), new GestureHandler(DebugGestureHandler)); //MultiTouch.EnableGesture(this.image, new SecondDownGesture(), new GestureHandler(DebugGestureHandler)); //MultiTouch.EnableGesture(this.image, new SecondUpGesture(), new GestureHandler(DebugGestureHandler)); //MultiTouch.EnableGesture(this.image, new SecondClickGesture(), new GestureHandler(DebugGestureHandler)); //MultiTouch.EnableGesture(this.image, new DualDownGesture(), new GestureHandler(DebugGestureHandler)); //MultiTouch.EnableGesture(this.image, new DualMoveGesture(), new GestureHandler(DebugGestureHandler)); //MultiTouch.EnableGesture(this.image, new OnePauseOneMoveGesture(), new GestureHandler(DebugGestureHandler)); //MultiTouch.EnableGesture(this.image, new DualUpGesture(), new GestureHandler(DebugGestureHandler)); //MultiTouch.EnableGesture(this.image, new DualClickGesture(), new GestureHandler(DebugGestureHandler)); //MultiTouch.EnableGesture(this.image, new MultiDownGesture(), new GestureHandler(DebugGestureHandler)); //MultiTouch.EnableGesture(this.image, new MultiMoveGesture(), new GestureHandler(DebugGestureHandler),true); //MultiTouch.EnableGesture(this.image, new MultiUpGesture(), new GestureHandler(DebugGestureHandler)); //MultiTouch.EnableGesture(this.image, new ZoomGesture(), new ZoomHandler(OnZoom)); //MultiTouch.EnableGesture(this.image, new RotateGesture(), new RotateHandler(OnRotate)); //MultiTouch.EnableGesture(this.image, new DragMoveGesture(), new DragHandler(OnDrag),true); //MultiTouch.EnableGesture(this.image, new FlickGesture(), new FlickHandler(OnFlick), true); MultiTouch.EnableGesture(this.image, new ManipulateGesture(), new ManipulateHandler(OnManipulate), true); }
public void GenerateZombie() { if (_isGameOver) { return; } var position = MultiTouch.GetTouchWorldPosition(Camera.main); var prefab = _nextZombieNum == -2 ? jamBlock : block[_nextZombieNum]; var obj = Utility.Instantiate(_blocks, prefab); obj.GetComponent <Rigidbody2D>().Pause(obj.gameObject); obj.transform.position = position; Debug.Log("ZombiePosition" + obj.transform.position); obj.transform.rotation = nextZombieImage.transform.rotation; obj.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 0.5f); foreach (var boxCollider2D in obj.GetComponents <BoxCollider2D>()) { boxCollider2D.enabled = false; } _movingBlock = obj; _zombieMoving = true; soundeffect.Catch.Play(); obj.GetComponent <GetTopPosition>().CollisionAction = GetTop; }
private void Application_Startup(object sender, StartupEventArgs e) { MainWindow w = new MainWindow(); w.Show(); MultiTouch.Init(new ZeroParamHandler(OnConnectedFailed)); }
void AppStartup(object sender, StartupEventArgs args) { Window1 mainWindow = new Window1(); mainWindow.Show(); MultiTouch.Init(new ZeroParamHandler(ConnectFailed)); }
void test10() { Rect ScreenResolutionRect = new Rect(0, 0, System.Windows.SystemParameters.PrimaryScreenWidth, System.Windows.SystemParameters.PrimaryScreenHeight); MultiDragScaleRotate dsr = new MultiDragScaleRotate(true, true, true, true, ScreenResolutionRect); dsr.MinTouchCount = 2; MultiTouch.EnableGesture(this.image, dsr, null); }
public SimCorpMobile() { this.vFourthGen = new FourthGen(); this.vCasioBattery = new CasioBattery(); this.vHiFiDynamic = new HiFiDynamic(); this.vTouchKeyboard = new TouchKeyboard(); this.vBlueYeti = new BlueYeti(); this.vMultiTouch = new MultiTouch(); this.vNewSimCard = new NewSimCard(); }
private void Application_Startup(object sender, StartupEventArgs e) { //MouseSupport w = new MouseSupport(); //AutoDebugWindow w = new AutoDebugWindow(); DragScaleRotateWindow w = new DragScaleRotateWindow(); w.Show(); MultiTouch.Init(new ZeroParamHandler(ConnectFailed)); }
/////////////////////////////////////////////////////////////////////////////////////////// private void test2() { //System.Diagnostics.Debug.WriteLine("================================"); //UtilDebugger.TraceLogicalTree(this, 0); //System.Diagnostics.Debug.WriteLine("================================"); //UtilDebugger.TraceVisualTree(MainRoot, 0); //MultiTouch.EnableGesture(this.MainRoot, new SingleDownGesture(), new RoutedEventHandler(DebugGestureHandler)); //MultiTouch.EnableGesture(this.image, new DragMoveGesture(), new RoutedEventHandler(OnDrag)); MultiTouch.EnableGesture(this.canvas, new DragMoveGesture(), new DragHandler(OnDrag)); }
public SimCorpMobile(bool isTaskForMessages = false) { SMSProvider = isTaskForMessages ? (SMSProvider) new SMSTask() : new SMSThread(); this.vFourthGen = new FourthGen(); this.vCasioBattery = new CasioBattery(); this.vHiFiDynamic = new HiFiDynamic(); this.vTouchKeyboard = new TouchKeyboard(); this.vBlueYeti = new BlueYeti(); this.vMultiTouch = new MultiTouch(); this.vNewSimCard = new NewSimCard(); }
private static bool CheckTapMoon() { var position = MultiTouch.GetTouchPosition(); var aTapPoint = Camera.main.ScreenToWorldPoint(position); var aCollider2D = Physics2D.OverlapPoint(aTapPoint); if (!aCollider2D) { return(false); } var obj = aCollider2D.transform.gameObject; return(obj.name == "Moon"); }
private void MouseSupport_Loaded(object sender, RoutedEventArgs e) { rect = new Rect(this.Left, this.Top, this.Width, this.Height); DragScaleRotate dsr = new DragScaleRotate(true, true, true, true, rect); dsr.TranslateDamping = 0.9; MultiTouch.EnableGesture(myImage, dsr, null); //MultiDragScaleRotate mdsr = MultiTouch.EnableGesture(myImage, new MultiDragScaleRotate(true, true, true, true, rect), null) as MultiDragScaleRotate; //mdsr.TranslateDamping = 0.9; //mdsr.AngleDamping = 0.95; //mdsr.ScaleDamping = 0.99; }
/////////////////////////////////////////////////////////////////////////////////////////// private void test4() { MultiTouch.EnableGesture(this.image, new SingleMoveGesture(), new GestureHandler(OnTest4SingleMoveImage)); MultiTouch.EnableGesture(this.canvas, new SingleMoveGesture(), new GestureHandler(OnTest4SingleMoveCanvas)); }
void test8() { MultiTouch.EnableGesture(this.image, new DragScaleRotate(true, false, false, false, null), null); MultiTouch.EnableGesture(this.canvas, new SingleClickGesture(), new GestureHandler(OnSingleClick), true); }
protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); MultiTouch.EnableGesture(keyboard, new ZoomGesture(), new ZoomHandler(OnZoom)); this.AddHandler(TouchEvent.TouchDoubleClickEvent, new TouchHandler(OnTouchDoubleClick)); }
private void LoadFile(string file) { string fileExt = System.IO.Path.GetExtension(file).ToLower(); if (fileExt == ".jpg" || fileExt == ".png" || fileExt == ".gif" || fileExt == ".bmp" || fileExt == ".tif" || fileExt == ".ico" || fileExt == ".jpeg" || fileExt == ".tiff") { Image image = new Image(); image.Source = new BitmapImage(new Uri(file)); image.Width = 400; image.Height = 300; myCanvas.Children.Add(image); double x = rand.NextDouble() * rect.Width; double y = rand.NextDouble() * rect.Height; image.SetValue(Canvas.LeftProperty, x); image.SetValue(Canvas.TopProperty, y); MultiDragScaleRotate mdsr = new MultiDragScaleRotate(true, true, true, false, rect); MultiTouch.EnableGesture(image, mdsr, null); } else if (fileExt == ".avi" || fileExt == ".wmv" || fileExt == ".mpg" || fileExt == ".mpeg" || fileExt == ".mp4") { MediaElement me = new MediaElement(); me.Source = new Uri(file); me.LoadedBehavior = MediaState.Manual; me.Play(); me.MediaEnded += new RoutedEventHandler(me_MediaEnded); myCanvas.Children.Add(me); double x = rand.NextDouble() * rect.Width; double y = rand.NextDouble() * rect.Height; me.SetValue(Canvas.LeftProperty, x); me.SetValue(Canvas.TopProperty, y); MultiDragScaleRotate mdsr = new MultiDragScaleRotate(true, true, true, false, rect); MultiTouch.EnableGesture(me, mdsr, null); } else if (fileExt == ".xps") { DocumentViewer dv = (DocumentViewer)this.Resources["myDocViewer"]; dv.Document = new XpsDocument(file, FileAccess.Read).GetFixedDocumentSequence(); dv.FitToMaxPagesAcross(1); double x = rand.NextDouble() * rect.Width; double y = rand.NextDouble() * rect.Height; dv.SetValue(Canvas.LeftProperty, x); dv.SetValue(Canvas.TopProperty, y); myCanvas.Children.Add(dv); MultiDragScaleRotate mdsr = new MultiDragScaleRotate(true, true, true, false, rect); MultiTouch.EnableGesture(dv, mdsr, null); } }
private void MoveBlock() { if (!_zombieMoving) { return; } switch (MultiTouch.GetTouch()) { case TouchInfo.Moved: Vector2 position = MultiTouch.GetTouchWorldPosition(Camera.main); _movingBlock.transform.position = position; break; case TouchInfo.Ended: //Time.timeScale = 1.0F; if (CheckTapMoon()) { nextZombieImage.transform.rotation = _movingBlock.transform.rotation; Destroy(_movingBlock); _movingBlock = null; _zombieMoving = false; return; } _movingBlock.GetComponent <Rigidbody2D>().Resume(_movingBlock.gameObject); _movingBlock.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 1f); foreach (var collider in _movingBlock.GetComponents <BoxCollider2D>()) { collider.enabled = true; } BlList.Add(_movingBlock); //落ちたブロックを順々に保存 if (trackingcamera != null) { trackingcamera.TrackObject = _movingBlock; } _movingBlock = null; _zombieMoving = false; nextZombieImage.transform.LookAt(nextZombieImage.transform.position + Vector3.forward); _nextZombieNum = _nextZombie[0]; _nextZombie.RemoveAt(0); if (_nextZombie.Count() <= 1) { var list = GenerateZombieList(); _nextZombie.AddRange(list); } soundeffect.Release.Play(); // イベント発生の確認 if (!IsFeverTime) { _piledZombies++; } if (_piledZombies == _nextEventTime) { Debug.Log("EVENT!!"); soundeffect.EventStart.Play(); //eventType = (eventType % 3 == 2) ? 0 : UnityEngine.Random.Range(1, 3); _eventType = (_eventcount % 3 == 2) ? 0 : 1; _eventcount++; _nextEventTime = GenerateNextEventTime(_piledZombies); switch (_eventType) { case 0: // フィーバータイム StartCoroutine(FeverTime()); break; case 1: // お邪魔ゾンビ出現 StartCoroutine(AppearJamZombie()); break; } } break; } }