public WiiRemoteListener(FrameworkElement element) { _wiiremote = new MIG.Client.Devices.Wii.Remote(); _targetelement = element; _overlay = new Overlay(); (_targetelement as Panel).Children.Add(_overlay); _handtransform = new Animations.TransformHelper(_overlay.Hand); _handtransform.Delay = 0.25; _targetelement.Dispatcher.BeginInvoke(() => { _targetsize = new Size(_targetelement.ActualWidth, _targetelement.ActualHeight); // _wiiremote.AccelerationUpdate += new MIG.Client.Devices.Wii.Remote.AccelerationUpdateHandler(_wiiremote_AccelerationUpdate); _wiiremote.ButtonPressed += new MIG.Client.Devices.Wii.Remote.ButtonPressedHandler(_wiiremote_ButtonPressed); _wiiremote.ButtonReleased += new MIG.Client.Devices.Wii.Remote.ButtonReleasedHandler(_wiiremote_ButtonReleased); _wiiremote.InfraredUpdate += new MIG.Client.Devices.Wii.Remote.InfraredUpdateHandler(_wiiremote_InfraredUpdate); _wiiremote.RemoteConnected += new MIG.Client.Devices.Wii.Remote.RemoteConnectedHandler(_wiiremote_RemoteConnected); _wiiremote.RemoteDisconnected += new MIG.Client.Devices.Wii.Remote.RemoteDisconnectedHandler(_wiiremote_RemoteDisconnected); // try { _wiiremote.RequestConnect(); } catch { } }); }
public void Start(RenderWindow window, ushort numGroupsInit, ushort numGroupsLoad, float initProportion) { this.window = window; this.numGroupsInit = numGroupsInit; this.numGroupsLoad = numGroupsLoad; this.initProportion = initProportion; // We need to pre-initialise the 'Bootstrap' group so we can use // the basic contents in the loading screen ResourceGroupManager.Singleton.InitialiseResourceGroup("Bootstrap"); OverlayManager omgr = OverlayManager.Singleton; loadOverlay = omgr.GetByName("Core/LoadOverlay"); if (loadOverlay == null) System.Windows.Forms.MessageBox.Show("Cannot find loading overlay", "ExampleLoadingBar::start", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); loadOverlay.Show(); // Save links to the bar and to the loading text, for updates as we go loadingBarElement = omgr.GetOverlayElement("Core/LoadPanel/Bar/Progress"); loadingCommentElement = omgr.GetOverlayElement("Core/LoadPanel/Comment"); loadingDescriptionElement = omgr.GetOverlayElement("Core/LoadPanel/Description"); OverlayElement barContainer = omgr.GetOverlayElement("Core/LoadPanel/Bar"); progressBarMaxSize = barContainer.Width; loadingBarElement.Width = 0F; ResourceGroupManager.Singleton.ResourceGroupScriptingStarted += ResourceGroupScriptingStarted; ResourceGroupManager.Singleton.ScriptParseStarted += ScriptParseStarted; ResourceGroupManager.Singleton.ScriptParseEnded += ScriptParseEnded; ResourceGroupManager.Singleton.ResourceGroupLoadStarted += ResourceGroupLoadStarted; ResourceGroupManager.Singleton.ResourceLoadStarted += ResourceLoadStarted; ResourceGroupManager.Singleton.WorldGeometryStageStarted += WorldGeometryStageStarted; ResourceGroupManager.Singleton.WorldGeometryStageEnded += WorldGeometryStageEnded; }
public Cube(MapElementType type, Overlay overlay, WorldMap worldMap, Vector3Int position) : base(worldMap, position) { ElementType = type; Overlay = overlay; Solid = true; }
void Start() { head = Camera.main.GetComponent<StereoController>().Head; overlay = overlayObject.GetComponent<Overlay>(); progressBar = transform.parent.FindChild("Bar Progress Pivot").gameObject; text = transform.parent.FindChild("Text").GetComponent<TextMesh>(); }
protected void copyFromOverlay(Overlay overlay) { copyFromImageModifer(overlay); _position = new IntVector2(overlay._position); _mirror = overlay._mirror; _alpha = overlay._alpha; _textureAlpha = overlay._textureAlpha; _alphaOption = overlay._alphaOption; _normalScale = overlay._normalScale; _normalOption = overlay._normalOption; _blendMethod = overlay._blendMethod; _rotation = overlay._rotation; }
public DebugOverlayManager() { this.overlay = OverlayManager.Singleton.GetByName("Core/DebugOverlay"); Launch.OnEveryUnpausedTenthOfASecondEvent += EveryTenth; #if DEBUG ShowDebugOverlay(true); #endif guiAvg = OverlayManager.Singleton.GetOverlayElement("Core/AverageFps", false); guiCurr = OverlayManager.Singleton.GetOverlayElement("Core/CurrFps", false); guiTris = OverlayManager.Singleton.GetOverlayElement("Core/NumTris", false); guiBatches = OverlayManager.Singleton.GetOverlayElement("Core/NumBatches", false); }
public static void Show() { DebugOverlay = OverlayManager.Singleton.GetByName("Core/DebugOverlay"); myAvg = OverlayManager.Singleton.GetOverlayElement("Core/AverageFps"); myCurr = OverlayManager.Singleton.GetOverlayElement("Core/CurrFps"); myBest = OverlayManager.Singleton.GetOverlayElement("Core/BestFps"); myWorst = OverlayManager.Singleton.GetOverlayElement("Core/WorstFps"); myNumTris = OverlayManager.Singleton.GetOverlayElement("Core/NumTris"); myNumBatches = OverlayManager.Singleton.GetOverlayElement("Core/NumBatches"); DebugOverlay.Show(); }
public CursorOverlay(ushort zOrder) { Overlay = OverlayManager.Singleton.Create("CursorOverlay" + Guid.NewGuid().ToString()); Cursor = (PanelOverlayElement)OverlayManager.Singleton.CreateOverlayElement("Panel", "Cursor" + Guid.NewGuid().ToString()); Cursor.MetricsMode = GuiMetricsMode.GMM_PIXELS; Cursor.Width = 32; Cursor.Height = 32; Cursor.MaterialName = "Cursor"; // Set Material CursorKind = Kind.Default; Overlay.Add2D(Cursor); Overlay.ZOrder = zOrder; Overlay.Show(); }
private void BindingOverlays(Overlay defaultOverlay = null) { Dictionary<Overlay, bool> overlays = new Dictionary<Overlay, bool>(); if (wpfMap != null) { overlays = wpfMap.Overlays.Where(o => o.IsBase).ToDictionary(o => o, o => o.IsVisible); itemsControl.ItemsSource = overlays; if (defaultOverlay != null) { Overlay checkedOverlayKey = overlays.FirstOrDefault(o => o.Value).Key; overlays[checkedOverlayKey] = false; overlays[defaultOverlay] = true; } } }
private void BindingOverlays(Overlay defaultOverlay = null) { if (CurrentMap != null) { OverlayItem[] overlayItems = CurrentMap.Overlays.Where(o => o.IsBase).Select(o => new OverlayItem(o, o.IsVisible, ChangeBaseOverlay)).ToArray(); itemsControl.ItemsSource = overlayItems; if (defaultOverlay != null) { OverlayItem checkedOverlayItem = overlayItems.First(o => o.IsVisible); OverlayItem newOverlayItem = overlayItems.First(o => o.Overlay == defaultOverlay); checkedOverlayItem.IsVisible = false; newOverlayItem.IsVisible = true; } } }
public CommandLineBuilder Overlay(Overlay position, string over, string under, string output, bool shortest = false) { if(string.IsNullOrWhiteSpace(over)) throw new ArgumentNullException("over"); _owner.MarkFilterPosition(); if(under == null) { under = PreviousOutput; } if(output == null) { PreviousOutput = string.Format("[tmp{0}]", ++CurrentOperation); output = PreviousOutput + ";"; } else if(output.Length > 0 && !output.EndsWith(";")) { output += ";"; } _ol.AppendFormat(" {0} {1} overlay={2} {3}", under, over, position.Value(), output); return _owner; }
private void InitLayout() { this.padding1 = new Padding(0.0, 1.0 / 6.0); this.Children.Add(this.padding1); this.padding5 = new Padding(0.0, 1.0 - (1.0 - 0.01) * (1.0 - 0.02)); this.padding1.Children.Add(this.padding5); this.box1 = new Box(Direction.Vertical); this.padding5.Children.Add(this.box1); this.adapter1 = new Adapter(Direction.Horizontal); this.box1.Children.Add(this.adapter1); this.box2 = new Box(Direction.Horizontal); this.adapter1.Children.Add(this.box2); this.padding2 = new Padding(0.06, 0.04); this.box2.Children.Add(this.padding2); this.graveyardPlaceholder = new CardPlaceholderWidget(); this.padding2.Children.Add(this.graveyardPlaceholder); this.padding3 = new Padding(0.06, 0.04); this.box2.Children.Add(this.padding3); this.overlay1 = new Overlay(); this.padding3.Children.Add(this.overlay1); this.deckPlaceholder = new CardPlaceholderWidget(); this.overlay1.Children.Add(this.deckPlaceholder); this.padding4 = new Padding(0.02, 0.04); this.box1.Children.Add(this.padding4); this.solidColor1 = new SolidColor(); this.solidColor1.Color = new Cairo.Color(0.25, 0.25, 0.25, 0.3); this.padding4.Children.Add(this.solidColor1); this.selectionPlaceholder = new GeneralPlaceholderWidget(); this.solidColor1.Children.Add(this.selectionPlaceholder); }
public OverlayScene(Vector screenSize) { m_ScreenSize = screenSize; //note we need to load a font if we want to use a font var font = FontManager.Singleton.Create("Arial", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME); font.SetParameter("type", "truetype"); font.SetParameter("source", "Arial.ttf"); font.SetParameter("size", "16"); font.SetParameter("resolution", "96"); font.Load(); m_Container = (OverlayContainer)OverlayManager.Singleton.CreateOverlayElement("Panel", "PanelName"); //note positions and sizes are in relative screen space m_Container.SetPosition(0.35, 0.3); m_Container.SetDimensions(0.3, 0.5); m_Container.MaterialName = "triangle/red"; m_Overlay = OverlayManager.Singleton.Create("bob"); m_Overlay.Add2D(m_Container); m_Overlay.Show(); }
public override void OnBrowserNavigation(Addon parentAddon, Overlay overlay, ChromiumWebBrowser browser) { overlay.InjectJsFile("plugin://" + _owner.Key + "_Haptics/haptics.js"); }
public OverlayChangedOverlaySwitcherEventArgs(Overlay overlay) : base() { this.overlay = overlay; }
protected void removeOverlayColorFromConn(object sender, EventArgs e) { ImageButton sendBtn = (ImageButton)sender; String args = sendBtn.CommandArgument.ToString(); Overlay ovr = new Overlay(); ovr.setColor(args); // This should only be for the overlays in conn.overlays, not for overlayList -Micah /*foreach (Overlay over in overlayList) { if (over.getColor().Equals(ovr.getColor())) { overlayList.Remove(over); break; } }*/ foreach (Overlay over in conn.overlays) { if (over.getColor().Equals(ovr.getColor())) { conn.overlays.Remove(over); break; } } try { foreach (Overlay over in overlayListAvailableToRemove) { if (over.getColor().Equals(ovr.getColor())) { overlayListAvailableToRemove.Remove(over); this.fillOverlayPopupRemove(); this.genOverlayConditionTable(sender, e); break; } } } catch (ODBC2KMLException ex) { ErrorHandler eh = new ErrorHandler(ex.errorText, errorPanel1); eh.displayError(); return; } sessionSave(); }
public override void AddToOverlay(Overlay overlay) { Buttons.ForEach(b => b.AddToOverlay(overlay)); }
public OverlayItem(Overlay overlay, bool isVisible, Action<OverlayItem> command) { this.overlay = overlay; this.isVisible = isVisible; this.command = command; }
partial void pAddOverlay(Overlay overlay);
partial void pRemoveOverlay(Overlay overlay);
private void disableHotKeys() { MainTab?.DisableHotKeys(); Overlay?.DisableHotKeys(); YUDie?.DisableHotKeys(); }
// Just override the mandatory create scene method protected override void CreateScene() { RAND = new Random(0); // najak: use a time-based seed GuiMgr = OverlayElementManager.Instance; scene.AmbientLight = new ColorEx(0.75f, 0.75f, 0.75f); // default Ambient Light // Customize Controls - speed up camera and slow down the input update rate this.camSpeed = 5.0f; inputInterval = inputTimer = 0.02f; // Create water mesh and entity, and attach to sceneNode waterMesh = new WaterMesh("WaterMesh", PLANE_SIZE, CMPLX); waterEntity = scene.CreateEntity("WaterEntity", "WaterMesh"); SceneNode waterNode = scene.RootSceneNode.CreateChildSceneNode(); waterNode.AttachObject(waterEntity); // Add Ogre head, give it it's own node headNode = waterNode.CreateChildSceneNode(); Entity ent = scene.CreateEntity("head", "ogrehead.mesh"); headNode.AttachObject(ent); // Create the camera node, set its position & attach camera camera.Yaw(-45f); camera.Move(new Vector3(1500f, 700f, PLANE_SIZE + 700f)); camera.LookAt(new Vector3(PLANE_SIZE / 2f, 300f, PLANE_SIZE / 2f)); camera.SetAutoTracking(false, headNode); // Autotrack the head, but it isn't working right //scene.SetFog(FogMode.Exp, ColorEx.White, 0.000020f); // add Fog for fun, cuz we can // show overlay waterOverlay = (Overlay)OverlayManager.Instance.GetByName("Example/WaterOverlay"); waterOverlay.Show(); // Create Rain Emitter, but default Rain to OFF particleSystem = ParticleSystemManager.Instance.CreateSystem("rain", "Examples/Water/Rain"); particleEmitter = particleSystem.GetEmitter(0); particleEmitter.EmissionRate = 0f; // Attach Rain Emitter to SceneNode, and place it 3000f above the water surface SceneNode rNode = scene.RootSceneNode.CreateChildSceneNode(); rNode.Translate(new Vector3(PLANE_SIZE / 2.0f, 3000, PLANE_SIZE / 2.0f)); rNode.AttachObject(particleSystem); particleSystem.FastForward(20); // Fastforward rain to make it look natural // It can't be set in .particle file, and we need it ;) particleSystem.BillboardOrigin = BillboardOrigin.BottomCenter; // Set Lighting lightNode = scene.RootSceneNode.CreateChildSceneNode(); lightSet = scene.CreateBillboardSet("Lights", 20); lightSet.MaterialName = "Particles/Flare"; lightNode.AttachObject(lightSet); SetLighting("Ambient"); // Add Lights - added by Najak to show lighted Water conditions - cool! #region STUBBED LIGHT ANIMATION // Create a new animation state to track this // TODO: Light Animation not working. //this.animState = scene.CreateAnimationState("WaterLight"); //this.animState.Time = 0f; //this.animState.IsEnabled = false; // set up spline animation of light node. Create random Spline Animation anim = scene.CreateAnimation("WaterLight", 20); NodeAnimationTrack track = anim.CreateNodeTrack(0, this.lightNode); TransformKeyFrame key = (TransformKeyFrame)track.CreateKeyFrame(0); for (int ff = 1; ff <= 19; ff++) { key = (TransformKeyFrame)track.CreateKeyFrame(ff); Random rand = new Random(0); Vector3 lpos = new Vector3( (float)rand.NextDouble() % (int)PLANE_SIZE, //- PLANE_SIZE/2, (float)rand.NextDouble() % 300 + 100, (float)rand.NextDouble() % (int)PLANE_SIZE); //- PLANE_SIZE/2 key.Translate = lpos; } key = (TransformKeyFrame)track.CreateKeyFrame(20); #endregion STUBBED LIGHT ANIMATION // Initialize the Materials/Demo UpdateMaterial(); UpdateInfoParamC(); UpdateInfoParamD(); UpdateInfoParamU(); UpdateInfoParamT(); UpdateInfoNormals(); UpdateInfoHeadDepth(); UpdateInfoSkyBox(); UpdateInfoHeadSpeed(); UpdateInfoLights(); UpdateInfoTracking(); // Init Head Animation: Load adds[] elements - Ogre head animation adds[0] = 0.3f; adds[1] = -1.6f; adds[2] = 1.1f; adds[3] = 0.5f; sines[0] = 0; sines[1] = 100; sines[2] = 200; sines[3] = 300; } // end CreateScene()
public static void Reset() // Needed in the event client exits { instance = null; }
public void Run() { Gtk.Application.Init(); SetupTheme(); ApiExtensibility.Register(typeof(Windows.UI.Core.ICoreWindowExtension), o => new GtkCoreWindowExtension(o)); ApiExtensibility.Register <Windows.UI.Xaml.Application>(typeof(Uno.UI.Xaml.IApplicationExtension), o => new GtkApplicationExtension(o)); ApiExtensibility.Register(typeof(Windows.UI.ViewManagement.IApplicationViewExtension), o => new GtkApplicationViewExtension(o)); ApiExtensibility.Register(typeof(ISystemThemeHelperExtension), o => new GtkSystemThemeHelperExtension(o)); ApiExtensibility.Register(typeof(Windows.Graphics.Display.IDisplayInformationExtension), o => _displayInformationExtension ??= new GtkDisplayInformationExtension(o, _window)); ApiExtensibility.Register <TextBoxView>(typeof(ITextBoxViewExtension), o => new TextBoxViewExtension(o, _window)); ApiExtensibility.Register(typeof(ILauncherExtension), o => new LauncherExtension(o)); ApiExtensibility.Register <FileOpenPicker>(typeof(IFileOpenPickerExtension), o => new FileOpenPickerExtension(o)); ApiExtensibility.Register <FolderPicker>(typeof(IFolderPickerExtension), o => new FolderPickerExtension(o)); _isDispatcherThread = true; _window = new Gtk.Window("Uno Host"); _window.SetDefaultSize(1024, 800); _window.SetPosition(Gtk.WindowPosition.Center); _window.Realized += (s, e) => { // Load the correct cursors before the window is shown // but after the window has been initialized. Cursors.Reload(); }; _window.DeleteEvent += delegate { Gtk.Application.Quit(); }; bool EnqueueNative(DispatcherQueuePriority priority, DispatcherQueueHandler callback) { Dispatch(() => callback()); return(true); } Windows.System.DispatcherQueue.EnqueueNativeOverride = EnqueueNative; void Dispatch(System.Action d) { if (Gtk.Application.EventsPending()) { Gtk.Application.RunIteration(false); } GLib.Idle.Add(delegate { if (this.Log().IsEnabled(Microsoft.Extensions.Logging.LogLevel.Trace)) { this.Log().Trace($"Iteration"); } try { d(); } catch (Exception e) { Console.WriteLine(e); } return(false); }); } Windows.UI.Core.CoreDispatcher.DispatchOverride = Dispatch; Windows.UI.Core.CoreDispatcher.HasThreadAccessOverride = () => _isDispatcherThread; _window.Realized += (s, e) => { WUX.Window.Current.OnNativeSizeChanged(new Windows.Foundation.Size(_window.AllocatedWidth, _window.AllocatedHeight)); }; _window.SizeAllocated += (s, e) => { WUX.Window.Current.OnNativeSizeChanged(new Windows.Foundation.Size(e.Allocation.Width, e.Allocation.Height)); }; _window.WindowStateEvent += OnWindowStateChanged; var overlay = new Overlay(); _eventBox = new EventBox(); _area = new UnoDrawingArea(); _fix = new Fixed(); overlay.Add(_area); overlay.AddOverlay(_fix); _eventBox.Add(overlay); _window.Add(_eventBox); /* avoids double invokes at window level */ _area.AddEvents((int)GtkCoreWindowExtension.RequestedEvents); _window.ShowAll(); void CreateApp(ApplicationInitializationCallbackParams _) { var app = _appBuilder(); app.Host = this; } WUX.Application.Start(CreateApp, _args); UpdateWindowPropertiesFromPackage(); Gtk.Application.Run(); }
public void HandleVRInput(Overlay Overlay) { for (uint unDeviceId = 1; unDeviceId < OpenVR.k_unControllerStateAxisCount; unDeviceId++) { if (OpenVR.Overlay.HandleControllerOverlayInteractionAsMouse(Overlay.Handle, unDeviceId)) { break; } } VREvent_t vrEvent = new VREvent_t(); while (OpenVR.Overlay.PollNextOverlayEvent(Overlay.Handle, ref vrEvent, (uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(VREvent_t)))) { switch (vrEvent.eventType) { case (int)EVREventType.VREvent_MouseMove: Overlay.OnVREvent_MouseMove(vrEvent.data); break; case (int)EVREventType.VREvent_MouseButtonDown: Overlay.OnVREvent_MouseButtonDown(vrEvent.data); break; case (int)EVREventType.VREvent_MouseButtonUp: Overlay.OnVREvent_MouseButtonUp(vrEvent.data); break; case (int)EVREventType.VREvent_OverlayShown: Overlay.OnVREvent_OverlayShown(vrEvent.data); break; case (int)EVREventType.VREvent_Quit: Overlay.OnVREvent_Quit(vrEvent.data); break; case (int)EVREventType.VREvent_ButtonPress: Overlay.OnVREvent_ButtonPress(vrEvent.data); break; case (int)EVREventType.VREvent_ButtonTouch: Overlay.OnVREvent_ButtonTouch(vrEvent.data); break; case (int)EVREventType.VREvent_ButtonUnpress: Overlay.OnVREvent_ButtonUnpress(vrEvent.data); break; case (int)EVREventType.VREvent_ButtonUntouch: Overlay.OnVREvent_ButtonUntouch(vrEvent.data); break; case (int)EVREventType.VREvent_TouchPadMove: Overlay.OnVREvent_TouchPadMove(vrEvent.data); break; case (int)EVREventType.VREvent_Scroll: Overlay.OnVREvent_Scroll(vrEvent.data); break; } } }
protected override void OnRender() { Overlay.Render(target); }
public PlayState(int levelnum, SpriteBatch batch) { curLevel = Game1.levels[levels[levelnum]]; camera = new Camera(batch, new Vector2(800, 600), new Vector2(800, 600)); over = new Overlay(camera); }
private static async void UpdateOverlayAsync() { if (Config.Instance.CheckForUpdates) { Updater.CheckForUpdates(true); } var hsForegroundChanged = false; var useNoDeckMenuItem = TrayIcon.NotifyIcon.ContextMenu.MenuItems.IndexOfKey("startHearthstone"); UpdateOverlay = Helper.HearthstoneDirExists; while (UpdateOverlay) { if (User32.GetHearthstoneWindow() != IntPtr.Zero) { if (Game.CurrentRegion == Region.UNKNOWN) { //game started Game.CurrentRegion = Helper.GetCurrentRegion(); } Overlay.UpdatePosition(); if (Config.Instance.CheckForUpdates) { Updater.CheckForUpdates(); } if (!Game.IsRunning) { Overlay.Update(true); } MainWindow.BtnStartHearthstone.Visibility = Visibility.Collapsed; TrayIcon.NotifyIcon.ContextMenu.MenuItems[useNoDeckMenuItem].Visible = false; Game.IsRunning = true; if (User32.IsHearthstoneInForeground()) { if (hsForegroundChanged) { Overlay.Update(true); if (Config.Instance.WindowsTopmostIfHsForeground && Config.Instance.WindowsTopmost) { //if player topmost is set to true before opponent: //clicking on the playerwindow and back to hs causes the playerwindow to be behind hs. //other way around it works for both windows... what? Windows.OpponentWindow.Topmost = true; Windows.PlayerWindow.Topmost = true; Windows.TimerWindow.Topmost = true; } hsForegroundChanged = false; } } else if (!hsForegroundChanged) { if (Config.Instance.WindowsTopmostIfHsForeground && Config.Instance.WindowsTopmost) { Windows.PlayerWindow.Topmost = false; Windows.OpponentWindow.Topmost = false; Windows.TimerWindow.Topmost = false; } hsForegroundChanged = true; } } else { Overlay.ShowOverlay(false); if (Game.IsRunning) { //game was closed Logger.WriteLine("Exited game", "UpdateOverlayLoop"); Game.CurrentRegion = Region.UNKNOWN; Logger.WriteLine("Reset region", "UpdateOverlayLoop"); //HsLogReaderV2.Instance.ClearLog(); Game.Reset(); if (DeckList.Instance.ActiveDeck != null) { Game.SetPremadeDeck((Deck)DeckList.Instance.ActiveDeck.Clone()); } await LogReaderManager.Restart(); MainWindow.BtnStartHearthstone.Visibility = Visibility.Visible; TrayIcon.NotifyIcon.ContextMenu.MenuItems[useNoDeckMenuItem].Visible = true; if (Config.Instance.CloseWithHearthstone) { MainWindow.Close(); } } Game.IsRunning = false; } if (Config.Instance.NetDeckClipboardCheck.HasValue && Config.Instance.NetDeckClipboardCheck.Value && Initialized && !User32.IsHearthstoneInForeground()) { NetDeck.CheckForClipboardImport(); } await Task.Delay(Config.Instance.UpdateDelay); } CanShutdown = true; }
public virtual void CreateFrameListener() { debugOverlay = OverlayManager.Singleton.GetByName("Core/DebugOverlay"); debugOverlay.Show(); root.FrameStarted += new FrameListener.FrameStartedHandler(ExampleApp_FrameStarted); }
public MessageEventArgs(Overlay overlay, string message) : base(overlay) { this.Message = message; }
private XElement FindById(string id) { return(Overlay.Elements().SingleOrDefault(x => x.Attribute("id").Value == id)); }
public FocusEventArgs(Overlay overlay, bool focus) : base(overlay) { this.Focus = focus; }
public void DestroyOverlay(Overlay overlay) { this.overlays.Remove(overlay); }
private static void OnTick(int counter, EventArgs args) { if (processHandle == IntPtr.Zero) //if we still don't have a handle to the process { var wndHnd = Memory.FindWindowClassName("Respawn001"); //classname if (wndHnd != IntPtr.Zero) //if it exists { //Console.WriteLine("weheree"); var calcPid = Memory.GetPIDFromHWND(wndHnd); //get the PID of that same process if (calcPid > 0) //if we got the PID { processHandle = Memory.ZwOpenProcess(PROCESS_ALL_ACCESS, calcPid); //the driver will get a stripped handle, but doesn't matter, it's still OK if (processHandle != IntPtr.Zero) { //if we got access to the game, check if it's x64 bit, this is needed when reading pointers, since their size is 4 for x86 and 8 for x64 isWow64Process = Memory.IsProcess64Bit(processHandle); } else { //Console.WriteLine("failed to get handle"); } } } } else //else we have a handle, lets check if we should close it, or use it { var wndHnd = Memory.FindWindowClassName("Respawn001"); //classname if (wndHnd != IntPtr.Zero) //window still exists, so handle should be valid? let's keep using it { //the lines of code below execute every 33ms outside of the renderer thread, heavy code can be put here if it's not render dependant gameProcessExists = true; wndMargins = Renderer.GetWindowMargins(wndHnd); wndSize = Renderer.GetWindowSize(wndHnd); isGameOnTop = Renderer.IsGameOnTop(wndHnd); isOverlayOnTop = Overlay.IsOnTop(); GameCenterPos = new Vector2(wndSize.X / 2 + wndMargins.X, wndSize.Y / 2 + wndMargins.Y); //even if the game is windowed, calculate perfectly it's "center" for aim or crosshair if (GameBase == IntPtr.Zero) //do we have access to Gamebase address? { GameBase = Memory.ZwGetModule(processHandle, null, isWow64Process); //if not, find it Console.WriteLine($"GameBase: {GameBase.ToString("X")}"); } else { if (GameSize == IntPtr.Zero) { GameSize = Memory.ZwGetModuleSize(processHandle, null, isWow64Process); } else { //Console.WriteLine($"GameBase: {GameBase.ToString("X")}"); //easy way to check if we got reading rights //Console.WriteLine($"GameSize: {GameSize.ToString("X")}"); //easy way to check if we got reading rights if (EntityListPtr == IntPtr.Zero) { EntityListPtr = EntityListPtr = Memory.ZwFindSignature(processHandle, GameBase, GameSize, "0F B7 C8 48 8D 05 ? ? ? ? 48 C1 E1 05 48 03 C8", 0x6); } if (LocalPlayerPtr == IntPtr.Zero) { LocalPlayerPtr = LocalPlayerPtr = Memory.ZwFindSignature(processHandle, GameBase, GameSize, "48 8B 05 ? ? ? ? 48 0F 44 C7 48 89 05", 0x3); } if (ViewRenderPtr == IntPtr.Zero) { ViewRenderPtr = ViewRenderPtr = Memory.ZwFindSignature(processHandle, GameBase, GameSize, "48 8B 0D ? ? ? ? 44 0F 28 C2", 0x3); } if (ViewMatrixOffs == IntPtr.Zero) { ViewMatrixOffs = Memory.ZwFindSignature(processHandle, GameBase, GameSize, "48 89 AB ? ? ? ? 4C 89 9B", 0x3, true); } //Console.WriteLine($"EntityListPtr: {EntityListPtr.ToString("X")}"); //Console.WriteLine($"LocalPlayerIDPtr: {LocalPlayerIDPtr.ToString("X")}"); //Console.WriteLine($"ViewRenderPtr: {ViewRenderPtr.ToString("X")}"); } } } else //else most likely the process is dead, clean up { Memory.CloseHandle(processHandle); //close the handle to avoid leaks processHandle = IntPtr.Zero; //set it like this just in case for C# logic gameProcessExists = false; //clear your offsets, modules GameBase = IntPtr.Zero; GameSize = IntPtr.Zero; EntityListPtr = IntPtr.Zero; LocalPlayerPtr = IntPtr.Zero; ViewRenderPtr = IntPtr.Zero; ViewMatrixOffs = IntPtr.Zero; } } }
private void ResetOverlayPositionCommandExecuted() { Log.Debug($"Resetting overlay position, current size: {new Rect(Overlay.Left, Overlay.Top, Overlay.Width, Overlay.Height)}"); Overlay.ResetToDefault(); }
/// <summary> /// call create4LineDebugOverLay to create an Overlay with 4 text lines at the top left corrner /// </summary> protected virtual void create4LineDebugOverLay() { if (mPanel != null) { return; } // Create a panel // WTF I keep getting segmentfault when i use PanelOverlayElement, at the panel.addChild line. // prob in mono somewhere not reconizeing it derives from container? but HTF? //mPanel = OverlayManager.Instance.CreatePanelElement("Status/Panel"); OverlayElement el = OverlayManager.Instance.CreateOverlayElement("Panel", "DebugStatus/Panel"); mPanel = new OverlayContainer(OverlayElement.getCPtr(el).Handle, false); mPanel.setMetricsMode(GuiMetricsMode.GMM_PIXELS); mPanel.setPosition(10, 10); mPanel.setDimensions(500, 100); //mPanel->setMaterialName("MaterialName"); // Optional background material // Create a text area mODebugText1 = OverlayManager.Instance.CreateTextAreaElement("DebugStatus/DebugText1"); mPanel.addChild(mODebugText1); mODebugText1.setMetricsMode(GuiMetricsMode.GMM_PIXELS); mODebugText1.setPosition(0, 0); mODebugText1.setDimensions(100, 100); mODebugText1.setCaption(""); mODebugText1.setCharHeight(16); mODebugText1.setFontName("BlueHighway"); mODebugText1.setColourBottom(Converter.GetColor(0.3f, 0.5f, 0.3f)); mODebugText1.setColourTop(Converter.GetColor(0.5f, 0.7f, 0.5f)); // Create a text area mODebugText2 = OverlayManager.Instance.CreateTextAreaElement("DebugStatus/DebugText2"); mODebugText2.setMetricsMode(GuiMetricsMode.GMM_PIXELS); mODebugText2.setPosition(0, 20); mODebugText2.setDimensions(100, 100); mODebugText2.setCaption(""); mODebugText2.setCharHeight(16); mODebugText2.setFontName("BlueHighway"); mODebugText2.setColourBottom(Converter.GetColor(0.3f, 0.5f, 0.3f)); mODebugText2.setColourTop(Converter.GetColor(0.5f, 0.7f, 0.5f)); mPanel.addChild(mODebugText2); // Create a text area mODebugText3 = OverlayManager.Instance.CreateTextAreaElement("DebugStatus/DebugText3"); mODebugText3.setMetricsMode(GuiMetricsMode.GMM_PIXELS); mODebugText3.setPosition(0, 40); mODebugText3.setDimensions(100, 100); mODebugText3.setCaption(""); mODebugText3.setCharHeight(16); mODebugText3.setFontName("BlueHighway"); mODebugText3.setColourBottom(Converter.GetColor(0.3f, 0.5f, 0.3f)); mODebugText3.setColourTop(Converter.GetColor(0.5f, 0.7f, 0.5f)); mPanel.addChild(mODebugText3); // Create a text area mODebugText4 = OverlayManager.Instance.CreateTextAreaElement("DebugStatus/DebugText4"); mODebugText4.setMetricsMode(GuiMetricsMode.GMM_PIXELS); mODebugText4.setPosition(0, 60); mODebugText4.setDimensions(100, 100); mODebugText4.setCaption(""); mODebugText4.setCharHeight(16); mODebugText4.setFontName("BlueHighway"); mODebugText4.setColourBottom(Converter.GetColor(0.3f, 0.5f, 0.3f)); mODebugText4.setColourTop(Converter.GetColor(0.5f, 0.7f, 0.5f)); mPanel.addChild(mODebugText4); // Create an overlay, and add the panel mOverlay = OverlayManager.Instance.create("Status/Overlay"); mOverlay.add2D(mPanel); }
public OverlayChangedOverlaySwitcherEventArgs(Overlay overlay) { Overlay = overlay; }
public void Start() { manager = FindObjectOfType<AIMananger>(); overlay = Instantiate(overlayPrefab); overlay.transform.SetParent(transform); }
#pragma warning disable 1998 public static async void Initialize() #pragma warning restore 1998 { LocalizeDictionary.Instance.Culture = CultureInfo.GetCultureInfo("en-US"); _startUpTime = DateTime.UtcNow; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls; Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory); Config.Load(); Log.Info($"HDT: {Helper.GetCurrentVersion()}, Operating System: {Helper.GetWindowsVersion()}, .NET Framework: {Helper.GetInstalledDotNetVersion()}"); var splashScreenWindow = new SplashScreenWindow(); #if (SQUIRREL) if (Config.Instance.CheckForUpdates) { var updateCheck = Updater.StartupUpdateCheck(splashScreenWindow); while (!updateCheck.IsCompleted) { await Task.Delay(500); if (splashScreenWindow.SkipUpdate) { break; } } } #endif splashScreenWindow.ShowConditional(); Log.Initialize(); Reflection.Exception += e => Log.Warn("HearthMirror Exception: " + e); ConfigManager.Run(); LocUtil.UpdateCultureInfo(); var newUser = ConfigManager.PreviousVersion == null; LogConfigUpdater.Run().Forget(); LogConfigWatcher.Start(); UITheme.InitializeTheme().Forget(); ThemeManager.Run(); ResourceMonitor.Run(); Game = new GameV2(); Game.SecretsManager.OnSecretsChanged += cards => Overlay.ShowSecrets(cards); MainWindow = new MainWindow(); MainWindow.LoadConfigSettings(); MainWindow.Show(); splashScreenWindow.Close(); if (Config.Instance.DisplayHsReplayNoteLive && ConfigManager.PreviousVersion != null && ConfigManager.PreviousVersion < new Version(1, 1, 0)) { MainWindow.FlyoutHsReplayNote.IsOpen = true; } if (ConfigManager.UpdatedVersion != null) { #if (!SQUIRREL) Updater.Cleanup(); #endif MainWindow.FlyoutUpdateNotes.IsOpen = true; MainWindow.UpdateNotesControl.SetHighlight(ConfigManager.PreviousVersion); #if (SQUIRREL && !DEV) if (Config.Instance.CheckForDevUpdates && !Config.Instance.AllowDevUpdates.HasValue) { MainWindow.ShowDevUpdatesMessage(); } #endif } DataIssueResolver.Run(); #if (!SQUIRREL) Helper.CopyReplayFiles(); #endif BackupManager.Run(); if (Config.Instance.PlayerWindowOnStart) { Windows.PlayerWindow.Show(); } if (Config.Instance.OpponentWindowOnStart) { Windows.OpponentWindow.Show(); } if (Config.Instance.TimerWindowOnStartup) { Windows.TimerWindow.Show(); } PluginManager.Instance.LoadPluginsFromDefaultPath(); MainWindow.Options.OptionsTrackerPlugins.Load(); PluginManager.Instance.StartUpdateAsync(); UpdateOverlayAsync(); if (Config.Instance.ShowCapturableOverlay) { Windows.CapturableOverlay = new CapturableOverlayWindow(); Windows.CapturableOverlay.Show(); } if (LogConfigUpdater.LogConfigUpdateFailed) { MainWindow.ShowLogConfigUpdateFailedMessage().Forget(); } else if (LogConfigUpdater.LogConfigUpdated && Game.IsRunning) { ShowRestartRequiredMessageAsync().Forget(); Overlay.ShowRestartRequiredWarning(); } LogWatcherManger.Start(Game).Forget(); RemoteConfig.Instance.Load(); HotKeyManager.Load(); if (Helper.HearthstoneDirExists && Config.Instance.StartHearthstoneWithHDT && !Game.IsRunning) { HearthstoneRunner.StartHearthstone().Forget(); } HSReplayNetHelper.UpdateAccount().Forget(); Initialized = true; Influx.OnAppStart( Helper.GetCurrentVersion(), newUser, HSReplayNetOAuth.IsFullyAuthenticated, HSReplayNetOAuth.AccountData?.IsPremium?.Equals("true", StringComparison.InvariantCultureIgnoreCase) ?? false, (int)(DateTime.UtcNow - _startUpTime).TotalSeconds, PluginManager.Instance.Plugins.Count ); }
public bool Equals(DestinyVendorCategoryEntryDefinition input) { if (input == null) return false; return ( CategoryIndex == input.CategoryIndex || (CategoryIndex.Equals(input.CategoryIndex)) ) && ( SortValue == input.SortValue || (SortValue.Equals(input.SortValue)) ) && ( CategoryHash == input.CategoryHash || (CategoryHash.Equals(input.CategoryHash)) ) && ( QuantityAvailable == input.QuantityAvailable || (QuantityAvailable.Equals(input.QuantityAvailable)) ) && ( ShowUnavailableItems == input.ShowUnavailableItems || (ShowUnavailableItems != null && ShowUnavailableItems.Equals(input.ShowUnavailableItems)) ) && ( HideIfNoCurrency == input.HideIfNoCurrency || (HideIfNoCurrency != null && HideIfNoCurrency.Equals(input.HideIfNoCurrency)) ) && ( HideFromRegularPurchase == input.HideFromRegularPurchase || (HideFromRegularPurchase != null && HideFromRegularPurchase.Equals(input.HideFromRegularPurchase)) ) && ( BuyStringOverride == input.BuyStringOverride || (BuyStringOverride != null && BuyStringOverride.Equals(input.BuyStringOverride)) ) && ( DisabledDescription == input.DisabledDescription || (DisabledDescription != null && DisabledDescription.Equals(input.DisabledDescription)) ) && ( DisplayTitle == input.DisplayTitle || (DisplayTitle != null && DisplayTitle.Equals(input.DisplayTitle)) ) && ( Overlay == input.Overlay || (Overlay != null && Overlay.Equals(input.Overlay)) ) && ( VendorItemIndexes == input.VendorItemIndexes || (VendorItemIndexes != null && VendorItemIndexes.SequenceEqual(input.VendorItemIndexes)) ) && ( IsPreview == input.IsPreview || (IsPreview != null && IsPreview.Equals(input.IsPreview)) ) && ( IsDisplayOnly == input.IsDisplayOnly || (IsDisplayOnly != null && IsDisplayOnly.Equals(input.IsDisplayOnly)) ) && ( ResetIntervalMinutesOverride == input.ResetIntervalMinutesOverride || (ResetIntervalMinutesOverride.Equals(input.ResetIntervalMinutesOverride)) ) && ( ResetOffsetMinutesOverride == input.ResetOffsetMinutesOverride || (ResetOffsetMinutesOverride.Equals(input.ResetOffsetMinutesOverride)) ) ; }
DEFINE_STANDARD_OP(Overlay, OVERLAY)
public Keyboard(Overlay overlay) { _overlay = overlay; }
void Start() { stage = gameObject.GetComponent<Stage> (); size = stage.gridSize*2; tiles = new Tile[size, size]; originOff = size / 4; origin = AddTile (originOff, originOff, 0); bump = GetComponent<AudioSource> (); // Overlay overlay = gameObject.GetComponent<Overlay>(); overlay.overlayCoords = overlay.RedSquareOverlay(); //overlay.DrawOverlay(); }
public static void RefreshWithBufferSettings(this Overlay overlay) { overlay.Refresh(TimeSpan.FromMilliseconds(RefreshBufferTimeInMillisecond), RequestDrawingBufferTimeType.ResetDelay); }
public override void AddToOverlay(Overlay overlay) { Panel.AddChild(TextArea); overlay.Add2D(Panel); }
public void AddOverlay(Overlay overlay, OverlayLevel overlayLevel = OverlayLevel.AboveLabels) { if (IsInvalid) { return; } var circle = overlay as Circle; if (circle != null) { #if UNITY_IOS var lat = circle.Location.Latitude; var lng = circle.Location.Longitude; var circlePtr = _appleMapsViewAddCircle( _ptr, lat, lng, circle.Radius, circle.LineWidth, circle.FillColor.ToFloatArr(), circle.StrokeColor.ToFloatArr(), circle.LineDashPattern, circle.LineDashPattern.Length); circle.Ptr = circlePtr; #endif } else if (overlay is Polyline) { #if UNITY_IOS var polyline = (Polyline)overlay; var polylinePtr = _appleMapsViewAddPolyline(_ptr, polyline.Points.ToJson(), polyline.LineWidth, polyline.StrokeColor.ToFloatArr(), (int)polyline.LineCap, (int)polyline.LineJoin, polyline.MeterLimit, polyline.LineDashPhase, polyline.LineDashPattern, polyline.LineDashPattern.Length); polyline.Ptr = polylinePtr; #endif } else if (overlay is Polygon) { #if UNITY_IOS var polygon = (Polygon)overlay; var polylinePtr = _appleMapsViewAddPolygon(_ptr, polygon.Points.ToJson(), polygon.LineWidth, polygon.StrokeColor.ToFloatArr(), polygon.FillColor.ToFloatArr(), (int)polygon.LineCap, (int)polygon.LineJoin, polygon.MeterLimit, polygon.LineDashPhase, polygon.LineDashPattern, polygon.LineDashPattern.Length); polygon.Ptr = polylinePtr; #endif } else if (overlay is OverlayImage) { #if UNITY_IOS var image = (OverlayImage)overlay; var path = Path.Combine(Application.streamingAssetsPath, image.ImageName); var imagePtr = _appleMapsViewAddImage(_ptr, path, image.CenterLocation.Latitude, image.CenterLocation.Longitude, image.NorthBound, image.SouthBound, image.EastBound, image.WestBound, image.Rotation); image.Ptr = imagePtr; #endif } }
public override void AddToOverlay(Overlay overlay) { overlay.Add2D(Container); }
public CreateOverlayEventArgs(Character character, Overlay overlay) : base(overlay) { this.Character = character; }
protected void cancelModifyOverlayConditionPopup_Click(object sender, EventArgs e) { Button btn = (Button)sender; string overlayId = btn.CommandArgument; Overlay replaceWithThisOverlay = new Overlay(); foreach (Overlay overlay in overlayList) { if (overlay.getId() == overlayId) { replaceWithThisOverlay = overlay; break; } } foreach (Overlay overlay in conn.overlays) { if (overlay.getId() == overlayId) overlay.setConditions(replaceWithThisOverlay.getDeepCopyOfConditions()); } try { genOverlayConditionTable(sender, e); } catch (ODBC2KMLException ex) { ErrorHandler eh = new ErrorHandler(ex.errorText, errorPanel1); eh.displayError(); return; } sessionSave(); }
public IdOverlayEventArgs(Guid id, Overlay overlay) : base(overlay) { this.Id = id; }
protected void addOverlayColorToConn(object sender, EventArgs e) { Button sendBtn = (Button)sender; String args = HiddenValue.Value.ToString(); args = args.Substring(1); Overlay ovr = new Overlay(); ovr.setColor(args); bool exists = false; foreach (Overlay over in conn.overlays) { if (over.getColor().Equals(ovr.getColor())) { exists = true; break; } } if (ovr.getColor().Equals("-111111")) { this.AddOverlayPopupExtender.Hide(); ErrorHandler eh = new ErrorHandler("Overlay color must be selected!", errorPanel1, "AddOverlayPopupExtender"); eh.displayError(); } else if (exists) { this.AddOverlayPopupExtender.Hide(); ErrorHandler eh = new ErrorHandler("Overlay color already exists! Please choose another.", errorPanel1, "AddOverlayPopupExtender"); eh.displayError(); } else { try { ovr.setId(curOverlayCount.ToString()); curOverlayCount -= 1; overlayListAvailableToRemove.Add(ovr); //overlayList.Add(new Overlay(ovr)); conn.overlays.Add(new Overlay(ovr)); this.fillOverlayPopupRemove(); this.genOverlayConditionTable(sender, e); } catch (ODBC2KMLException ex) { ErrorHandler eh = new ErrorHandler(ex.errorText, errorPanel1); eh.displayError(); return; } } sessionSave(); }
public void SetOverlay(Enums.Overlay overlay) { //overlay = Enums.Overlay.None; if (Overlay != null) { Overlay.FreeResources(); } switch (overlay) { case Enums.Overlay.Night: { Overlay = new Graphics.Effects.Overlays.NightOverlay(); } break; case Enums.Overlay.Dawn: { Overlay = new Graphics.Effects.Overlays.DawnOverlay(); } break; case Enums.Overlay.Dusk: { Overlay = new Graphics.Effects.Overlays.DuskOverlay(); } break; default: if (Logic.Maps.MapHelper.ActiveMap.Indoors == false) { switch (Globals.GameTime) { case (Enums.Time.Dawn): { SetOverlay(Enums.Overlay.Dawn); } break; case (Enums.Time.Dusk): { SetOverlay(Enums.Overlay.Dusk); } break; case (Enums.Time.Night): { SetOverlay(Enums.Overlay.Night); } break; default: { Overlay = null; } break; } } else { Overlay = null; } break; } }
/// <summary> /// This method initalize a 3D overlay /// </summary> private void LoadOverlay3D() { overlay3D = OverlayManager.Singleton.Create("3DOverlay"); overlay3D.ZOrder = 15000; CreateHearts(); overlay3D.Show(); }
public static void Initialize() { Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory); var newUser = !Directory.Exists(Config.AppDataPath); Config.Load(); Log.Initialize(); ConfigManager.Run(); LogConfigUpdater.Run().Forget(); LogConfigWatcher.Start(); Helper.UpdateAppTheme(); ThemeManager.Run(); var splashScreenWindow = new SplashScreenWindow(); splashScreenWindow.ShowConditional(); Game = new GameV2(); LoginType loginType; var loggedIn = HearthStatsAPI.LoadCredentials(); if (!loggedIn && Config.Instance.ShowLoginDialog) { var loginWindow = new LoginWindow(); splashScreenWindow.Close(); loginWindow.ShowDialog(); if (loginWindow.LoginResult == LoginType.None) { Application.Current.Shutdown(); return; } loginType = loginWindow.LoginResult; splashScreenWindow = new SplashScreenWindow(); splashScreenWindow.ShowConditional(); } else { loginType = loggedIn ? LoginType.AutoLogin : LoginType.AutoGuest; } MainWindow = new MainWindow(); MainWindow.LoadConfigSettings(); if (Config.Instance.ReselectLastDeckUsed) { MainWindow.SelectLastUsedDeck(); Config.Instance.ReselectLastDeckUsed = false; Config.Save(); } MainWindow.Show(); splashScreenWindow.Close(); if (ConfigManager.UpdatedVersion != null) { Updater.Cleanup(); MainWindow.FlyoutUpdateNotes.IsOpen = true; MainWindow.UpdateNotesControl.SetHighlight(ConfigManager.PreviousVersion); MainWindow.UpdateNotesControl.LoadUpdateNotes(); } NetDeck.CheckForChromeExtention(); DataIssueResolver.Run(); Helper.CopyReplayFiles(); BackupManager.Run(); if (Config.Instance.PlayerWindowOnStart) { Windows.PlayerWindow.Show(); } if (Config.Instance.OpponentWindowOnStart) { Windows.OpponentWindow.Show(); } if (Config.Instance.TimerWindowOnStartup) { Windows.TimerWindow.Show(); } if (Config.Instance.HearthStatsSyncOnStart && HearthStatsAPI.IsLoggedIn) { HearthStatsManager.SyncAsync(background: true); } PluginManager.Instance.LoadPlugins(); MainWindow.Options.OptionsTrackerPlugins.Load(); PluginManager.Instance.StartUpdateAsync(); UpdateOverlayAsync(); if (Helper.HearthstoneDirExists) { if (LogConfigUpdater.LogConfigUpdateFailed) { MainWindow.ShowLogConfigUpdateFailedMessage().Forget(); } else if (LogConfigUpdater.LogConfigUpdated && Game.IsRunning) { MainWindow.ShowMessageAsync("Hearthstone restart required", "The log.config file has been updated. HDT may not work properly until Hearthstone has been restarted."); Overlay.ShowRestartRequiredWarning(); } LogReaderManager.Start(Game); } else { MainWindow.ShowHsNotInstalledMessage().Forget(); } NewsUpdater.UpdateAsync(); HotKeyManager.Load(); if (Helper.HearthstoneDirExists && Config.Instance.StartHearthstoneWithHDT && !Game.IsRunning) { Helper.StartHearthstoneAsync(); } Initialized = true; Analytics.Analytics.TrackPageView($"/app/v{Helper.GetCurrentVersion().ToVersionString()}/{loginType.ToString().ToLower()}{(newUser ? "/new" : "")}", ""); }
public CommandLineBuilder Overlay(Overlay position, string over, bool shortest = false) { return Overlay(position, over, null, null, shortest); }
public async Task GetCardCounts(Deck deck) { var hsHandle = User32.GetHearthstoneWindow(); if(!User32.IsHearthstoneInForeground()) { //restore window and bring to foreground User32.ShowWindow(hsHandle, User32.SwRestore); User32.SetForegroundWindow(hsHandle); //wait it to actually be in foreground, else the rect might be wrong await Task.Delay(500); } if(!User32.IsHearthstoneInForeground()) { MessageBox.Show("Can't find Hearthstone window."); Logger.WriteLine("Can't find Hearthstone window.", "ArenaImport"); return; } await Task.Delay(1000); Overlay.ForceHidden = true; Overlay.UpdatePosition(); const double xScale = 0.013; const double yScale = 0.017; const int targetHue = 53; const int hueMargin = 3; const int numVisibleCards = 21; var hsRect = User32.GetHearthstoneRect(false); var ratio = (4.0 / 3.0) / ((double)hsRect.Width / hsRect.Height); var posX = (int)DeckExporter.GetXPos(0.92, hsRect.Width, ratio); var startY = 71.0/768.0 * hsRect.Height; var strideY = 29.0/768.0 * hsRect.Height; int width = (int)Math.Round(hsRect.Width * xScale); int height = (int)Math.Round(hsRect.Height * yScale); for(var i = 0; i < Math.Min(numVisibleCards, deck.Cards.Count); i++) { var posY = (int)(startY + strideY * i); var capture = Helper.CaptureHearthstone(new System.Drawing.Point(posX, posY), width, height, hsHandle); if(capture != null) { var yellowPixels = 0; for(int x = 0; x < width; x++) { for(int y = 0; y < height; y++) { var pixel = capture.GetPixel(x, y); if(Math.Abs(pixel.GetHue() - targetHue) < hueMargin) yellowPixels++; } } //Console.WriteLine(yellowPixels + " of " + width * height + " - " + yellowPixels / (double)(width * height)); //capture.Save("arenadeckimages/" + i + ".png"); var yellowPixelRatio = yellowPixels / (double)(width * height); if(yellowPixelRatio > 0.25 && yellowPixelRatio < 50) deck.Cards[i].Count = 2; } } if(deck.Cards.Count > numVisibleCards) { const int scrollClicksPerCard = 4; const int scrollDistance = 120; var clientPoint = new System.Drawing.Point(posX, (int)startY); var previousPos = System.Windows.Forms.Cursor.Position; User32.ClientToScreen(hsHandle, ref clientPoint); System.Windows.Forms.Cursor.Position = new System.Drawing.Point(clientPoint.X, clientPoint.Y); for(int j = 0; j < scrollClicksPerCard * (deck.Cards.Count - numVisibleCards); j++) { User32.mouse_event((uint)User32.MouseEventFlags.Wheel, 0, 0, -scrollDistance, UIntPtr.Zero); await Task.Delay(30); } System.Windows.Forms.Cursor.Position = previousPos; await Task.Delay(100); var remainingCards = deck.Cards.Count - numVisibleCards; startY = 76.0 / 768.0 * hsRect.Height + (numVisibleCards - remainingCards) * strideY; for(int i = 0; i < remainingCards ; i++) { var posY = (int)(startY + strideY * i); var capture = Helper.CaptureHearthstone(new System.Drawing.Point(posX, posY), width, height, hsHandle); if(capture != null) { var yellowPixels = 0; for(int x = 0; x < width; x++) { for(int y = 0; y < height; y++) { var pixel = capture.GetPixel(x, y); if(Math.Abs(pixel.GetHue() - targetHue) < hueMargin) yellowPixels++; } } //Console.WriteLine(yellowPixels + " of " + width * height + " - " + yellowPixels / (double)(width * height)); //capture.Save("arenadeckimages/" + i + 21 + ".png"); var yellowPixelRatio = yellowPixels / (double)(width * height); if(yellowPixelRatio > 0.25 && yellowPixelRatio < 50) deck.Cards[numVisibleCards + i].Count = 2; } } System.Windows.Forms.Cursor.Position = new System.Drawing.Point(clientPoint.X, clientPoint.Y); for(int j = 0; j < scrollClicksPerCard * (deck.Cards.Count - 21); j++) { User32.mouse_event((uint)User32.MouseEventFlags.Wheel, 0, 0, scrollDistance, UIntPtr.Zero); await Task.Delay(30); } System.Windows.Forms.Cursor.Position = previousPos; } Overlay.ForceHidden = false; Overlay.UpdatePosition(); ActivateWindow(); }
public DirtCube(Overlay overlay, WorldMap worldMap, Vector3Int position) : base(MapElementType.Dirt, overlay, worldMap, position) { SpriteSource = new Rectangle(8*32, 20 * 2 + 32 * 1, 32, 32); }
private static async void UpdateOverlayAsync() { #if (!SQUIRREL) if (Config.Instance.CheckForUpdates) { Updater.CheckForUpdates(true); } #endif var hsForegroundChanged = false; var useNoDeckMenuItem = TrayIcon.NotifyIcon.ContextMenu.MenuItems.IndexOfKey("startHearthstone"); while (UpdateOverlay) { if (Config.Instance.CheckForUpdates) { Updater.CheckForUpdates(); } if (User32.GetHearthstoneWindow() != IntPtr.Zero) { if (Game.CurrentRegion == Region.UNKNOWN) { //game started Helper.VerifyHearthstonePath(); Game.CurrentRegion = await Helper.GetCurrentRegion(); if (Game.CurrentRegion != Region.UNKNOWN) { BackupManager.Run(); Game.MetaData.HearthstoneBuild = null; } } Overlay.UpdatePosition(); if (!Game.IsRunning) { Overlay.Update(true); Windows.CapturableOverlay?.UpdateContentVisibility(); } MainWindow.BtnStartHearthstone.Visibility = Visibility.Collapsed; TrayIcon.NotifyIcon.ContextMenu.MenuItems[useNoDeckMenuItem].Visible = false; Game.IsRunning = true; Helper.GameWindowState = User32.GetHearthstoneWindowState(); Windows.CapturableOverlay?.Update(); if (User32.IsHearthstoneInForeground() && Helper.GameWindowState != WindowState.Minimized) { if (hsForegroundChanged) { Overlay.Update(true); if (Config.Instance.WindowsTopmostIfHsForeground && Config.Instance.WindowsTopmost) { //if player topmost is set to true before opponent: //clicking on the playerwindow and back to hs causes the playerwindow to be behind hs. //other way around it works for both windows... what? Windows.OpponentWindow.Topmost = true; Windows.PlayerWindow.Topmost = true; Windows.TimerWindow.Topmost = true; } hsForegroundChanged = false; } } else if (!hsForegroundChanged) { if (Config.Instance.WindowsTopmostIfHsForeground && Config.Instance.WindowsTopmost) { Windows.PlayerWindow.Topmost = false; Windows.OpponentWindow.Topmost = false; Windows.TimerWindow.Topmost = false; } hsForegroundChanged = true; } } else if (Game.IsRunning) { Game.IsRunning = false; Overlay.ShowOverlay(false); if (Windows.CapturableOverlay != null) { Windows.CapturableOverlay.UpdateContentVisibility(); await Task.Delay(100); Windows.CapturableOverlay.ForcedWindowState = WindowState.Minimized; Windows.CapturableOverlay.WindowState = WindowState.Minimized; } Log.Info("Exited game"); Game.CurrentRegion = Region.UNKNOWN; Log.Info("Reset region"); await Reset(); Game.IsInMenu = true; Game.InvalidateMatchInfoCache(); Overlay.HideRestartRequiredWarning(); Helper.ClearCachedHearthstoneBuild(); TurnTimer.Instance.Stop(); MainWindow.BtnStartHearthstone.Visibility = Visibility.Visible; TrayIcon.NotifyIcon.ContextMenu.MenuItems[useNoDeckMenuItem].Visible = true; if (Config.Instance.CloseWithHearthstone) { MainWindow.Close(); } } if (Config.Instance.NetDeckClipboardCheck.HasValue && Config.Instance.NetDeckClipboardCheck.Value && Initialized && !User32.IsHearthstoneInForeground()) { NetDeck.CheckForClipboardImport(); } await Task.Delay(UpdateDelay); } CanShutdown = true; }
public OverlayGUI() { //setup the colours top = new ColourValue(0.9f, 0.9f, 0.9f); bot = new ColourValue(0.8f, 0.8f, 0.8f); seltop = new ColourValue(0.9f, 0.7f, 0.7f); selbot = new ColourValue(0.8f, 0.6f, 0.6f); //Overlay overlayManager = OverlayManager.Singleton; // Create a panel panel = (OverlayContainer)overlayManager.CreateOverlayElement("Panel", "PanelName"); panel.MetricsMode = GuiMetricsMode.GMM_PIXELS; panel.SetPosition(0, 0); panel.SetDimensions(Program.Instance.rWindow.Width, Program.Instance.rWindow.Height); panel.MaterialName = "fsO/Blank"; // Optional background material // Create a text area messageArea = (TextAreaOverlayElement)overlayManager.CreateOverlayElement("TextArea", "TextArea"); messageArea.MetricsMode = GuiMetricsMode.GMM_PIXELS; messageArea.SetPosition(0, 0); messageArea.SetDimensions(Program.Instance.rWindow.Width, 100); messageArea.CharHeight = 24; messageArea.FontName = "damn"; messageArea.ColourTop = top; messageArea.ColourBottom = bot; messageArea.Caption = ""; // Status text area statArea = (TextAreaOverlayElement)overlayManager.CreateOverlayElement("TextArea", "StatTextArea"); statArea.MetricsMode = GuiMetricsMode.GMM_PIXELS; statArea.SetPosition(0, Program.Instance.rWindow.Height - 50); statArea.SetDimensions(Program.Instance.rWindow.Width, 50); statArea.CharHeight = 24; statArea.FontName = "damn"; statArea.ColourTop = top; statArea.ColourBottom = bot; statArea.Caption = "this is a test" + Environment.NewLine + "This is the test's second line"; //Menus Text Areas titleArea = (TextAreaOverlayElement)overlayManager.CreateOverlayElement("TextArea", "TitleTextArea"); titleArea.MetricsMode = GuiMetricsMode.GMM_PIXELS; titleArea.SetPosition(64, 16); titleArea.SetDimensions(Program.Instance.rWindow.Width, 32); titleArea.CharHeight = 32; titleArea.FontName = "damn"; titleArea.ColourTop = top; titleArea.ColourBottom = bot; titleArea.Caption = "Title"; for (int i = 0; i < 10; i++) { optionAreas[i] = (TextAreaOverlayElement)overlayManager.CreateOverlayElement("TextArea", i+"TextArea"); optionAreas[i].MetricsMode = GuiMetricsMode.GMM_PIXELS; optionAreas[i].SetPosition(32, 64 + (i*26)); optionAreas[i].SetDimensions(Program.Instance.rWindow.Width, 24); optionAreas[i].CharHeight = 24; optionAreas[i].FontName = "damn"; optionAreas[i].ColourTop = top; optionAreas[i].ColourBottom = bot; optionAreas[i].Caption = "Option " + i.ToString(); } maxOptions = 10; // Create an overlay, and add the panel overlay = overlayManager.Create("OverlayName"); overlay.Add2D(panel); // Add the text area to the panel panel.AddChild(messageArea); panel.AddChild(titleArea); panel.AddChild(statArea); for (int i = 0; i < 10; i++) { panel.AddChild(optionAreas[i]); } // Show the overlay overlay.Show(); }
#pragma warning disable 1998 public static async void Initialize() #pragma warning restore 1998 { LocalizeDictionary.Instance.Culture = CultureInfo.GetCultureInfo("en-US"); _startUpTime = DateTime.UtcNow; Log.Info($"HDT: {Helper.GetCurrentVersion()}, Operating System: {Helper.GetWindowsVersion()}, .NET Framework: {Helper.GetInstalledDotNetVersion()}"); ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls; Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory); Config.Load(); var splashScreenWindow = new SplashScreenWindow(); #if (SQUIRREL) if (Config.Instance.CheckForUpdates) { var updateCheck = Updater.StartupUpdateCheck(splashScreenWindow); while (!updateCheck.IsCompleted) { await Task.Delay(500); if (splashScreenWindow.SkipUpdate) { break; } } } #endif splashScreenWindow.ShowConditional(); Log.Initialize(); ConfigManager.Run(); LocUtil.UpdateCultureInfo(); var newUser = ConfigManager.PreviousVersion == null; LogConfigUpdater.Run().Forget(); LogConfigWatcher.Start(); Helper.UpdateAppTheme(); ThemeManager.Run(); ResourceMonitor.Run(); Game = new GameV2(); MainWindow = new MainWindow(); MainWindow.LoadConfigSettings(); MainWindow.Show(); splashScreenWindow.Close(); if (Config.Instance.DisplayHsReplayNoteLive && ConfigManager.PreviousVersion != null && ConfigManager.PreviousVersion < new Version(1, 1, 0)) { MainWindow.FlyoutHsReplayNote.IsOpen = true; } if (ConfigManager.UpdatedVersion != null) { #if (!SQUIRREL) Updater.Cleanup(); #endif MainWindow.FlyoutUpdateNotes.IsOpen = true; MainWindow.UpdateNotesControl.SetHighlight(ConfigManager.PreviousVersion); } NetDeck.CheckForChromeExtention(); DataIssueResolver.Run(); #if (!SQUIRREL) Helper.CopyReplayFiles(); #endif BackupManager.Run(); if (Config.Instance.PlayerWindowOnStart) { Windows.PlayerWindow.Show(); } if (Config.Instance.OpponentWindowOnStart) { Windows.OpponentWindow.Show(); } if (Config.Instance.TimerWindowOnStartup) { Windows.TimerWindow.Show(); } PluginManager.Instance.LoadPluginsFromDefaultPath(); MainWindow.Options.OptionsTrackerPlugins.Load(); PluginManager.Instance.StartUpdateAsync(); UpdateOverlayAsync(); if (Config.Instance.ShowCapturableOverlay) { Windows.CapturableOverlay = new CapturableOverlayWindow(); Windows.CapturableOverlay.Show(); } if (LogConfigUpdater.LogConfigUpdateFailed) { MainWindow.ShowLogConfigUpdateFailedMessage().Forget(); } else if (LogConfigUpdater.LogConfigUpdated && Game.IsRunning) { MainWindow.ShowMessageAsync("Hearthstone restart required", "The log.config file has been updated. HDT may not work properly until Hearthstone has been restarted.").Forget(); Overlay.ShowRestartRequiredWarning(); } LogWatcherManger.Start(Game).Forget(); NewsManager.LoadNews(); HotKeyManager.Load(); if (Helper.HearthstoneDirExists && Config.Instance.StartHearthstoneWithHDT && !Game.IsRunning) { Helper.StartHearthstoneAsync().Forget(); } ApiWrapper.UpdateAccountStatus().Forget(); Initialized = true; Influx.OnAppStart(Helper.GetCurrentVersion(), newUser, (int)(DateTime.UtcNow - _startUpTime).TotalSeconds); }