internal void UpdateCreater() { var loc = PanAndZoom.fromGlobalToLocal(position); loc.Offset(-Size.Width / 2, -Size.Height / 2); Location = loc; }
private void Awake() { panAndZoom = PanAndZoom.instance; var audios = GetComponentsInChildren <AudioSource>(true); foreach (var a in audios) { a.enabled = true; } if (BoatEngine.LocalPlayerInstance != null && photonView.IsMine) { if (!PhotonNetwork.IsConnected) { PhotonNetwork.Destroy(this.gameObject); return; } } // #Important // used in GameManager.cs: we keep track of the localPlayer instance to prevent instantiation when levels are synchronized if (photonView.IsMine) { BoatEngine.LocalPlayerInstance = this.gameObject; } // #Critical // we flag as don't destroy on load so that instance survives level synchronization, thus giving a seamless experience when levels load. //DontDestroyOnLoad(this.gameObject); }
public Point getPosition() { var loc = Location; loc.Offset(Size.Width / 2, Size.Height / 2); return(PanAndZoom.fromLocalToGlobal(loc)); }
public ViewportService(MapsService mapsService, PanAndZoom cameraControl, DynamicMapsUpdater mapsUpdater, SignalBus signalBus) { this.mapsService = mapsService; this.cameraControl = cameraControl; this.mapsUpdater = mapsUpdater; _signalBus = signalBus; movedObjects = new List <GameObject>(); }
private void Awake() { transform = GetComponent <Transform>(); panAndZoom = gameObject.AddComponent <PanAndZoom>(); panAndZoom.onTap += OnTap; panAndZoom.onSwipe += OnSwipe; panAndZoom.onPinch += OnPinch; }
private void Awake() { if (instance != null) { Destroy(this.gameObject); return; } instance = this; DontDestroyOnLoad(this.gameObject); }
void Start() { CalcuateAngleConstrains(); if (photonView.IsMine == false || PhotonNetwork.IsConnected == false) { return; } panAndZoom = PanAndZoom.instance; panAndZoom.onTap += Fire; //panAndZoom.onStartTouch += }
protected override void paint(object o, PaintEventArgs e) { //PanAndZoom.Transform(e); //var p=position.getPosition(); e.Graphics.ResetTransform(); var p = PanAndZoom.fromGlobalToLocal(position.getPosition()); var size = 20; e.Graphics.TranslateTransform(p.X, p.Y); e.Graphics.DrawImage(image, new Rectangle(-size / 2, -size / 2, size, size)); }
public Zone(Editor e, Point p, int index) { editor = e; attachPoint = new VertexMarker(); attachPoint.setPosition(PanAndZoom.fromLocalToGlobal(p)); attachPoint.Colour = System.Drawing.Brushes.Green; outline = new Outline(p); propertypanel = new ZoneProperty(this); possession = Possession.Neutral; Name = string.Format("Zone {0}", index); setSelected(false); }
void Start() { PanAndZoom panAndZoom = GetComponent <PanAndZoom>(); panAndZoom.onTap += position => { Debug.Log("I've been tapped at " + position + "!, Input.mousePosition :" + Input.mousePosition); var ray = Camera.main.ScreenPointToRay(position); if (Physics.Raycast(ray, out RaycastHit hitData, 1000, layer)) { agent.destination = hitData.point; } }; }
protected override void paint(object sen, PaintEventArgs e) { PanAndZoom.Transform(e); Font font = new Font(System.Drawing.FontFamily.GenericSansSerif, 16); var namePos = attachPoint.getPosition(); namePos.Offset(-(int)(10 * Name.Length) / 2, -font.Height); e.Graphics.DrawString(Name, font, System.Drawing.Brushes.White, namePos); var valPos = attachPoint.getPosition(); var valString = string.Format("{0}", value); valPos.Offset(-(int)(10 * valString.Length) / 2, 0); e.Graphics.DrawString(valString, font, System.Drawing.Brushes.White, valPos); }
public Editor(ZoneEditorData ze, string path) { InitializeComponent(); zoneData = ze; buildImage(path); this.Name = "ZoneDrawer"; this.Text = "ZoneDrawer"; Graphics g = this.CreateGraphics(); var zoom = ((float)pictureBox1.Width / (float)image.Width) * (image.HorizontalResolution / g.DpiX); PanAndZoom.setZoom(zoom); pictureBox1.Paint += new PaintEventHandler(OnPaint); pictureBox1.MouseDown += PanAndZoom.MouseDown; pictureBox1.MouseMove += PanAndZoom.MouseMove; pictureBox1.MouseUp += PanAndZoom.MouseUp; pictureBox1.MouseClick += new MouseEventHandler(pictureBox1_Click); pictureBox1.MouseWheel += PanAndZoom.MouseWheel; pictureBox1.Select(); //contextMenuStrip1 PanAndZoom.redraw = redraw; contextMenuStrip1.Items[1].Click += ze.AddZone; var spawns = contextMenuStrip1.Items[2] as ToolStripMenuItem; spawns.DropDown.Items[0].Click += ze.AddLandSpawn; spawns.DropDown.Items[1].Click += ze.AddAirSpawn; spawns.DropDown.Items[2].Click += ze.AddSeaSpawn; var positions = contextMenuStrip1.Items[3] as ToolStripMenuItem; positions.DropDown.Items[0].Click += ze.AddCV; positions.DropDown.Items[1].Click += ze.AddFOB; this.button1.Click += new System.EventHandler(ze.deleteItem); //outline = new Outline(pictureBox1); //pictureBox1.Paint += new PaintEventHandler(outline.paint); }
protected override void paint(object sen, PaintEventArgs e) { PanAndZoom.Transform(e); Pen p = new Pen(Brushes.White, 10); var width = 5; Brush b = Brushes.White; switch (type) { case SpawnType.Land: width = 10; break; case SpawnType.Air: b = Brushes.Blue; break; case SpawnType.Sea: break; } p = new Pen(b, width); var ah = head.getPosition(); var ahBase = ah; ahBase = ah; var rot = getRotation(); ahBase.Offset(-(int)(width * arrowHeadLength * Math.Cos(rot) / Geometry.Geometry.scaleFactor), -(int)(width * arrowHeadLength * Math.Sin(rot) / Geometry.Geometry.scaleFactor)); var ahLeft = ahBase; rot += (float)Math.PI / 2; ahLeft.Offset(-(int)(width * arrowHeadLength * Math.Cos(rot) / Geometry.Geometry.scaleFactor), -(int)(width * arrowHeadLength * Math.Sin(rot) / Geometry.Geometry.scaleFactor)); var ahRight = ahBase; rot -= (float)Math.PI; ahRight.Offset(-(int)(width * arrowHeadLength * Math.Cos(rot) / Geometry.Geometry.scaleFactor), -(int)(width * arrowHeadLength * Math.Sin(rot) / Geometry.Geometry.scaleFactor)); rot += (float)Math.PI / 2; ahBase.Offset((int)(500 * width * Math.Cos(rot) / Geometry.Geometry.scaleFactor), (int)(500 * width * Math.Sin(rot) / Geometry.Geometry.scaleFactor)); e.Graphics.DrawLine(p, source.getPosition(), ahBase); e.Graphics.FillPolygon(b, new Point[] { ah, ahLeft, ahRight }); }
void Start() { if (photonView.IsMine == true && LocalPlayerInstance == this.gameObject) { panAndZoom = PanAndZoom.instance; panAndZoom.onSwipe += Control; CameraWork _cameraWork = this.gameObject.GetComponent <CameraWork>(); if (_cameraWork != null) { if (photonView.IsMine) { _cameraWork.OnStartFollowing(); } } else { Debug.LogError("<Color=Red><a>Missing</a></Color> CameraWork Component on playerPrefab.", this); } } }
public ZoneEditor(ZoneEditorData ze) { InitializeComponent(); buildImage("portWonsan.png"); this.Name = "ZoneDrawer"; this.Text = "ZoneDrawer"; /*this.qqToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click); * tropicThunToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click); * nuclearWinterIsComingToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click); * pungjingValleyToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click); * apocalypseImminentToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click); * wonsanHarborToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click); * paddyFieldToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click); * hopAndGloryToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click); * toughJungleToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click); * chosinReservoirToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click); * jungleLAWToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click); * standoffInBarentsToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click); * bloodyRidgeToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click); */ Graphics g = this.CreateGraphics(); var zoom = ((float)pictureBox1.Width / (float)image.Width) * (image.HorizontalResolution / g.DpiX); PanAndZoom.setZoom(zoom); pictureBox1.Paint += new PaintEventHandler(OnPaint); pictureBox1.MouseDown += PanAndZoom.MouseDown; pictureBox1.MouseMove += PanAndZoom.MouseMove; pictureBox1.MouseUp += PanAndZoom.MouseUp; pictureBox1.MouseClick += new MouseEventHandler(pictureBox1_Click); pictureBox1.MouseWheel += PanAndZoom.MouseWheel; pictureBox1.Select(); //contextMenuStrip1 PanAndZoom.redraw = redraw; /*var ms = new ContextMenuStrip(); * ms.Items.Add("Add..."); * ms.Items[0].Enabled = false; * ms.Items.Add("Zone"); * ms.Items.Add("Spawn"); * var t = new ToolStripDropDownItem(); * t. * t.Items.Add("Land"); * t.Items.Add("Air"); * t.Items.Add("Sea"); * ms.Items.Add(t); * ms.Items.Add("Starting position"); * pictureBox1.ContextMenuStrip=ms;*/ //pictureBox1.ContextMenuStrip = contextMenuStrip1; //contextMenuStrip1. /*contextMenuStrip1.Opening += new CancelEventHandler(delegate(object x, CancelEventArgs c) * { * //Console.WriteLine("aaa"); * c.Cancel = true; * });*/ //contextMenuStrip1. //contextMenuStrip1.ItemClicked += new ToolStripItemClickedEventHandler(menuStrip2_ItemClicked); contextMenuStrip1.Items[1].Click += ze.AddZone; var spawns = contextMenuStrip1.Items[2] as ToolStripMenuItem; spawns.DropDown.Items[0].Click += ze.AddLandSpawn; spawns.DropDown.Items[1].Click += ze.AddAirSpawn; spawns.DropDown.Items[2].Click += ze.AddSeaSpawn; var positions = contextMenuStrip1.Items[3] as ToolStripMenuItem; positions.DropDown.Items[0].Click += ze.AddCV; positions.DropDown.Items[1].Click += ze.AddFOB; //outline = new Outline(pictureBox1); //pictureBox1.Paint += new PaintEventHandler(outline.paint); }
private void OnPaint(object sender, PaintEventArgs e) { PanAndZoom.Transform(e); e.Graphics.DrawImage(image, 0, 0); }