示例#1
0
 public static void HideToolTip()
 {
     if (ToolTip != null)
     {
         ToolTip.Close();
         ToolTip.Dispose();
         ToolTip = null;
     }
 }
示例#2
0
        public override void OnMouseMove(InputEngine.MouseMoveArgs e)
        {
            if (!Graphics.Visible)
            {
                return;
            }
            if (MicroWorld.Logics.GameInputHandler.isLine)
            {
                return;
            }

            if (isIn(e.curState.X, e.curState.Y) && !ToolTip.StayOpened)
            {
                ToolTip.GameOffset = new Vector2(e.curState.X, e.curState.Y) - Graphics.Position;
            }

            if (ToolTip.isVisible && MicroWorld.Graphics.GUI.GUIEngine.s_subComponentButtons.SelectedComponent != this)
            {
                var a = MicroWorld.Graphics.GUI.GUIEngine.GetAllHUDSceneType <GUI.GeneralProperties>();
                if (a.Length > 1)
                {
                    for (int i = 0; i < a.Length; i++)
                    {
                        if (a[i].AssociatedComponent is Joint && !(a[i].fadeState == GUI.GeneralProperties.FadeState.FadeOut))
                        {
                            ToolTip.Close();
                            return;
                        }
                    }
                }
            }

            if (dnd)
            {
                if (Settings.GameState != Settings.GameStates.Stopped)
                {
                    dnd = false;
                    base.OnMouseMove(e);
                    return;
                }
                RemoveComponentFromVisibilityMap();
                var g = Graphics as Graphics.WireGraphics;
                var a1 = g.DrawPath[dndIndex];
                var a2 = g.DrawPath[dndIndex + 1];
                int x = e.curState.X, y = e.curState.Y;
                int sx = Math.Sign(x), sy = Math.Sign(y);
                MicroWorld.Logics.GridHelper.GridCoords(ref x, ref y);
                x += 4;
                y += 4;
                if (a1.Y == a2.Y)
                {
                    bool t = true;
                    if (a1.X < a2.X)
                    {
                        for (float xx = a1.X; xx < a2.X; xx += 8)
                        {
                            if (ComponentsManager.VisibilityMap.GetAStarValue((int)xx, y) == 0)
                            {
                                t = false;
                                break;
                            }
                        }
                    }
                    else
                    {
                        for (float xx = a2.X; xx < a1.X; xx += 8)
                        {
                            if (ComponentsManager.VisibilityMap.GetAStarValue((int)xx, y) == 0)
                            {
                                t = false;
                                break;
                            }
                        }
                    }
                    if (t)
                    {
                        a1.Y = y;
                        a2.Y = y;
                    }
                }
                else
                {
                    bool t = true;
                    if (a1.Y < a2.Y)
                    {
                        for (float yy = a1.Y; yy < a2.Y; yy += 8)
                        {
                            if (ComponentsManager.VisibilityMap.GetAStarValue(x, (int)yy) == 0)
                            {
                                t = false;
                                break;
                            }
                        }
                    }
                    else
                    {
                        for (float yy = a2.Y; yy < a1.Y; yy += 8)
                        {
                            if (ComponentsManager.VisibilityMap.GetAStarValue(x, (int)yy) == 0)
                            {
                                t = false;
                                break;
                            }
                        }
                    }
                    if (t)
                    {
                        a1.X = x;
                        a2.X = x;
                    }
                }
                g.DrawPath[dndIndex]     = a1;
                g.DrawPath[dndIndex + 1] = a2;
                g.GenerateElectrons();
                SetComponentOnVisibilityMap();
                //Components.Graphics.WireGraphics.OptimizeDrawPath(ref g.DrawPath);
            }

            base.OnMouseMove(e);
        }