예제 #1
0
파일: MapHud.cs 프로젝트: joshlatte/goarrow
		private void ShowContextMenu(Location loc)
		{
			CloseContextMenu();

			mContextMenu = new ToolbarHud(Manager);
			mContextMenu.Location = MouseLocation;
			mContextMenu.Orientation = ToolbarOrientation.Vertical;
			mContextMenu.PositionLocked = true;
			mContextMenu.RespondsToRightClick = true;

			ToolbarButton label;

			switch (loc.Type)
			{
				case LocationType.Bindstone:
					label = new ToolbarButton(Icons.Toolbar.HouseStone, loc.Name);
					break;
				case LocationType.Dungeon:
				case LocationType.AllegianceHall:
					label = new ToolbarButton(Icons.Toolbar.Dungeon, loc.Name);
					break;
				case LocationType.Landmark:
					label = new ToolbarButton(Icons.Toolbar.Landmark, loc.Name);
					break;
				case LocationType.Lifestone:
					label = new ToolbarButton(Icons.Toolbar.Lifestone, loc.Name);
					break;
				case LocationType.NPC:
					label = new ToolbarButton(Icons.Map.NPC, loc.Name);
					break;
				case LocationType.Outpost:
					label = new ToolbarButton(Icons.Map.TownSmall, loc.Name);
					break;
				case LocationType.Portal:
				case LocationType.AnyPortal:
				case LocationType.SettlementPortal:
				case LocationType.TownPortal:
				case LocationType.UndergroundPortal:
				case LocationType.WildernessPortal:
				case LocationType.PortalDevice:
					label = new ToolbarButton(Icons.Toolbar.Portal, loc.Name);
					break;
				case LocationType.PortalHub:
					label = new ToolbarButton(Icons.Toolbar.PortalHub, loc.Name);
					break;
				case LocationType.Village:
					label = new ToolbarButton(Icons.Map.Settlement, loc.Name);
					break;
				case LocationType.Town:
					label = new ToolbarButton(Icons.Map.Town, loc.Name);
					break;
				case LocationType.Vendor:
					label = new ToolbarButton(Icons.Map.Store, loc.Name);
					break;
				case LocationType.Custom:
					label = new ToolbarButton(Icons.Toolbar.Dereth, loc.Name);
					break;
				default:
					label = new ToolbarButton(loc.Name);
					break;
			}

			ToolbarButton coordsLabel = mContextMenu.AddButton(label);
			coordsLabel.IsLabelOnly = true;

			ToolbarButton showDetails = new ToolbarButton(Icons.Toolbar.MagnifyingGlass, "Show Details");
			showDetails.Click += new EventHandler(delegate(object s, EventArgs e)
			{
				mPluginCore.ShowDetails(loc);
				CloseContextMenu();
			});
			mContextMenu.AddButton(showDetails);

			ToolbarButton arrowDest = new ToolbarButton(Icons.Toolbar.GoArrow, "Point Arrow Here");
			arrowDest.Click += new EventHandler(delegate(object s, EventArgs e)
			{
				mPluginCore.mArrowHud.DestinationLocation = loc;
				mPluginCore.mArrowHud.Visible = true;
				CloseContextMenu();
			});
			mContextMenu.AddButton(arrowDest);

			ToolbarButton routeStart = new ToolbarButton(Icons.Toolbar.RouteStart, "Start Route Here");
			routeStart.Click += new EventHandler(delegate(object s, EventArgs e)
			{
				mPluginCore.SetRouteStart(loc);
				CloseContextMenu();
			});
			mContextMenu.AddButton(routeStart);

			ToolbarButton routeEnd = new ToolbarButton(Icons.Toolbar.RouteEnd, "End Route Here");
			routeEnd.Click += new EventHandler(delegate(object s, EventArgs e)
			{
				mPluginCore.SetRouteEnd(loc);
				CloseContextMenu();
			});
			mContextMenu.AddButton(routeEnd);

			if (mPluginCore.mDungeonHud.DungeonMapAvailable(loc))
			{
				ToolbarButton showDungeon = new ToolbarButton(Icons.Toolbar.Dungeon, "Show Dungeon Map");
				showDungeon.Click += new EventHandler(delegate(object s, EventArgs e)
				{
					mPluginCore.mDungeonHud.Visible = true;
					mPluginCore.mDungeonHud.LoadDungeonById(mPluginCore.mDungeonHud.GetDungeonId(loc));
					CloseContextMenu();
				});
				mContextMenu.AddButton(showDungeon);
			}

			if (loc.HasExitCoords)
			{
				ToolbarButton jumpToExit = new ToolbarButton(Icons.Toolbar.JumpToExit, "Jump to Exit (" + loc.ExitCoords + ")");
				jumpToExit.Click += new EventHandler(delegate(object s, EventArgs e)
				{
					mPluginCore.mMapHud.CenterOnCoords(loc.ExitCoords);
					CloseContextMenu();
				});
				mContextMenu.AddButton(jumpToExit);
			}

			mContextMenu.Visible = true;
		}
예제 #2
0
파일: MapHud.cs 프로젝트: joshlatte/goarrow
		private void ShowContextMenu(Coordinates coords)
		{
			CloseContextMenu();

			mContextMenu = new ToolbarHud(Manager);
			mContextMenu.Location = MouseLocation;
			mContextMenu.Orientation = ToolbarOrientation.Vertical;
			mContextMenu.PositionLocked = true;
			mContextMenu.RespondsToRightClick = true;

			ToolbarButton coordsLabel = mContextMenu.AddButton(new ToolbarButton(coords.ToString("0.0")));
			coordsLabel.IsLabelOnly = true;

			ToolbarButton arrowDest = new ToolbarButton(Icons.Toolbar.GoArrow, "Point Arrow Here");
			arrowDest.Click += new EventHandler(delegate(object s, EventArgs e)
			{
				mPluginCore.mArrowHud.DestinationCoords = coords;
				mPluginCore.mArrowHud.Visible = true;
				CloseContextMenu();
			});
			mContextMenu.AddButton(arrowDest);

			ToolbarButton routeStart = new ToolbarButton(Icons.Toolbar.RouteStart, "Start Route Here");
			routeStart.Click += new EventHandler(delegate(object s, EventArgs e)
			{
				mPluginCore.SetRouteStart(coords);
				CloseContextMenu();
			});
			mContextMenu.AddButton(routeStart);

			ToolbarButton routeEnd = new ToolbarButton(Icons.Toolbar.RouteEnd, "End Route Here");
			routeEnd.Click += new EventHandler(delegate(object s, EventArgs e)
			{
				mPluginCore.SetRouteEnd(coords);
				CloseContextMenu();
			});
			mContextMenu.AddButton(routeEnd);

			mContextMenu.Visible = true;
		}
예제 #3
0
		protected override void Startup()
		{
			try
			{
				Util.Initialize("GoArrow", Host, Core, base.Path);
				System.Threading.Thread.CurrentThread.CurrentCulture
					= new System.Globalization.CultureInfo("en-US", false);

				mSettingsLoaded = false;
				mLoggedIn = false;
				mLoginCompleted = false;

				FileInfo locationsFile = new FileInfo(Util.FullPath("locations.xml"));
				if (locationsFile.Exists)
				{
					mLocDb = new LocationDatabase(locationsFile.FullName);
				}
				else
				{
					// Load from resource
					XmlDocument locDoc = new XmlDocument();
					locDoc.LoadXml(RouteFinding.Data.LocationsDatabase);
					mLocDb = new LocationDatabase(locDoc);
				}

				mLastSpellId = 0;
				mLastSpellTarget = 0;
				mRecallingToLSBind = RecallStep.NotRecalling;
				mRecallingToLSTie = RecallStep.NotRecalling;
				mRecallingToBindstone = RecallStep.NotRecalling;

				mHudManager = new HudManager(Host, Core, DefaultView, delegate() { return mDefaultViewActive; }, false);
				mHudManager.ExceptionHandler += new EventHandler<ExceptionEventArgs>(HudManager_ExceptionHandler);
				GraphicsReset += new EventHandler(mHudManager.GraphicsReset);
				WindowMessage += new EventHandler<WindowMessageEventArgs>(mHudManager.DispatchWindowMessage);
				RegionChange3D += new EventHandler<RegionChange3DEventArgs>(mHudManager.DispatchRegionChange3D);

				mDungeonHud = new DungeonHud(mHudManager);

				mMapHud = new MapHud(mHudManager, this, mLocDb);

				mArrowHud = new ArrowHud(mHudManager);
				mArrowHud.AsyncLoadComplete += new RunWorkerCompletedEventHandler(ArrowHud_AsyncLoadComplete);
				mArrowHud.DestinationChanged += new EventHandler<DestinationChangedEventArgs>(mMapHud.ArrowHud_DestinationChanged);

				mToolbar = new ToolbarHud(mHudManager);
				mMainViewToolButton = mToolbar.AddButton(new ToolbarButton(Icons.Toolbar.Settings, "Settings"));
				mArrowToolButton = mToolbar.AddButton(new ToolbarButton(Icons.Toolbar.GoArrow, "Arrow"));
				mDerethToolButton = mToolbar.AddButton(new ToolbarButton(Icons.Toolbar.Dereth, "Dereth"));
				mDungeonToolButton = mToolbar.AddButton(new ToolbarButton(Icons.Toolbar.Dungeon, "Dungeon"));
				mMainViewToolButton.Click += new EventHandler(MainViewToolButton_Click);
				mArrowToolButton.Click += new EventHandler(ArrowToolButton_Click);
				mDerethToolButton.Click += new EventHandler(DerethToolButton_Click);
				mDungeonToolButton.Click += new EventHandler(DungeonToolButton_Click);

				mStartLocations = new SortedDictionary<string, RouteStart>(StringComparer.OrdinalIgnoreCase);

				// Load portal devices
				// Try to load from file. If that fails, load from resource
				XmlDocument portalDevicesDoc = new XmlDocument();
				string portalDevicesPath = Util.FullPath("PortalDevices.xml");
				if (File.Exists(portalDevicesPath))
				{
					portalDevicesDoc.Load(portalDevicesPath);
				}
				else
				{
					portalDevicesDoc.LoadXml(RouteFinding.Data.PortalDevices);
				}

				mPortalDevices = new SortedDictionary<string, PortalDevice>(StringComparer.OrdinalIgnoreCase);
				foreach (XmlElement portalDeviceEle in portalDevicesDoc.DocumentElement.GetElementsByTagName("device"))
				{
					PortalDevice device;
					if (PortalDevice.TryLoadXmlDefinition(portalDeviceEle, out device))
					{
						mPortalDevices[device.Name] = device;
					}
				}

				InitMainViewBeforeSettings();

				mRecallTimeout = new WindowsTimer();
				mRecallTimeout.Tick += new EventHandler(RecallTimeout_Tick);

				mLoginTime = DateTime.Now;

#if USING_D3D_CONTAINER
				RouteStart.Initialize(110011, "Digero", 220022, "DaBug", "DebugAccount");
				LoadSettings();
				InitMainViewAfterSettings();

				mHudManager.StartHeartbeat();
#endif
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}