protected override void GetRequiredPosition(TextEditor Editor, Window tipWindow, out int requiredWidth, out double xalign)
        {
            TooltipWindow win = (TooltipWindow)tipWindow;

            requiredWidth = win.SetMaxWidth(win.Screen.Bounds.Width);
            xalign        = 0.5;
        }
    public override void OnInspectorGUI()
    {
        InventoryManager invUI = (InventoryManager)target;

        //Script in Inspector
        serializedObject.Update();
        SerializedProperty script = serializedObject.FindProperty("m_Script");

        EditorGUILayout.PropertyField(script, true, new GUILayoutOption[0]);
        serializedObject.ApplyModifiedProperties();

        if (GUILayout.Button("Open Inventory Database"))
        {
            InventoryDatabaseWindow.Init();
        }
        if (GUILayout.Button("Open Tooltip Settings"))
        {
            TooltipWindow.Init();
        }

        invUI.character = EditorGUILayout.ObjectField("Character", invUI.character, typeof(GameObject), true) as GameObject;

        invUI.cameraComponent = EditorGUILayout.ObjectField("Character Camera", invUI.cameraComponent, typeof(Camera), true) as Camera;

        invUI.dropTransform = EditorGUILayout.ObjectField("Drop Transform", invUI.dropTransform, typeof(Transform), true) as Transform;

        invUI.dropOffset = EditorGUILayout.FloatField("Drop Offset", invUI.dropOffset);

        invUI.stackingActive = EditorGUILayout.Toggle("Stacking Active", invUI.stackingActive);

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }
    }
    public static void Init()
    {
        TooltipWindow window = EditorWindow.GetWindow <TooltipWindow>();

        window.Show();
        window.autoRepaintOnSceneChange = true;
    }
        public void GetRequiredPosition(TextEditor Editor, Gtk.Window tipWindow, out int requiredWidth, out double xalign)
        {
            TooltipWindow win = (TooltipWindow)tipWindow;

            requiredWidth = win.SetMaxWidth(win.Screen.Width);
            xalign        = 0.5;
        }
Exemplo n.º 5
0
 private void OnCreateTooltip()
 {
     TooltipWindowDispose();
     _tooltipWindow = new TooltipWindow(Activity, Resource.Layout.tooltip_layout, Resource.Id.tooltipText)
     {
         DelayedMsec = 20000
     };
 }
Exemplo n.º 6
0
            public AbstractGauge(int id)
            {
                Log.Detail("creating gauge window for gauge id " + id + " of size " + GetWidth() + "x" + GetHeight());
                this.id     = id;
                this.bounds = new Rect(0, 0, GetWidth(), GetHeight());

                Log.Detail("position for gauge id " + id + ": " + NanoGauges.configuration.GetWindowPosition(id));
                SetPosition(NanoGauges.configuration.GetWindowPosition(id));

                this.tooltip = new TooltipWindow(this);
            }
        public Gtk.Window CreateTooltipWindow(TextEditor Editor, int offset, Gdk.ModifierType modifierState, TooltipItem item)
        {
            TextLink link = item.Item as TextLink;

            if (link == null || string.IsNullOrEmpty(link.Tooltip))
            {
                return(null);
            }

            TooltipWindow window = new TooltipWindow();

            window.Markup = link.Tooltip;
            return(window);
        }
        protected override Window CreateTooltipWindow(TextEditor Editor, int offset, ModifierKeys modifierState, TooltipItem item)
        {
            TextLink link = item.Item as TextLink;

            if (link == null || string.IsNullOrEmpty(link.Tooltip))
            {
                return(null);
            }

            TooltipWindow window = new TooltipWindow();

            window.Markup = link.Tooltip;
            return(window);
        }
Exemplo n.º 9
0
        private void OnClickedNode(BaseNodeView node)
        {
            _selectedNode = node;

            var attributes =
                (TaskTooltipAttribute[])node.Task.GetType().GetCustomAttributes(typeof(TaskTooltipAttribute), true);

            if (attributes.Length > 0)
            {
                var attribute = attributes.First();

                if (attribute != null)
                {
                    _tooltipWindow = GetWindow <TooltipWindow>(true, "Tooltip", false);

                    _tooltipWindow.position =
                        new Rect(position.xMin + 20 + _currentZoom * 10f, position.yMax - 100, 200, 80);
                    _tooltipWindow.Tooltip = attribute.Tooltip;
                    _tooltipWindow.ShowPopup();
                }
            }
        }
Exemplo n.º 10
0
    void DrawHooks()
    {
        selectedHook = null;

        GUIStyle style = new GUIStyle();

        style.fontSize         = 16;
        style.normal.textColor = Color.red;
        style.alignment        = TextAnchor.MiddleCenter;

        List <GameObject> allHooks = new List <GameObject>();

        foreach (GameObject obj in GameObject.FindGameObjectsWithTag("LookAtHook"))
        {
            //Debug.Log("Considering object " + obj.name);
            AuroraObject auroraObject = obj.GetComponent <LookAtHook>().obj;

            if (auroraObject == null)
            {
                continue;
            }

            if (auroraObject.GetType() == typeof(Door))
            {
                Door      door = (Door)auroraObject;
                AuroraUTD utd  = (AuroraUTD)door.template;
                // TODO: Support closing doors? Don't think this is a thing in KotOR/TSL
                if (door.open)
                {
                    //Debug.Log("Door is open, so not drawing hook");
                    continue;
                }
                //Debug.Log("Drawing hook for door");
                allHooks.Add(obj);
            }
            else if (auroraObject.GetType() == typeof(Creature))
            {
                // Check if the creature has a default conversation
                Creature  creature = (Creature)auroraObject;
                AuroraUTC utc      = (AuroraUTC)creature.template;

                bool selectable = false;

                if (utc.Conversation == null || utc.Conversation == "")
                {
                    //Debug.Log("Creature has no conversation, so not drawing hook");
                    selectable = true;
                }
                else if (NWScript.GetIsEnemy(creature, stateSystem.PC) > 0)
                {
                    selectable = true;
                }

                if (selectable)
                {
                    allHooks.Add(obj);
                }
            }
            else if (auroraObject.GetType() == typeof(Placeable))
            {
                // Check if the placeable can be interacted with
                Placeable placeable = (Placeable)auroraObject;
                AuroraUTP utp       = (AuroraUTP)placeable.template;

                if (utp.Useable == 0)
                {
                    //Debug.Log("Placeable is not useable, so not drawing hook");
                    continue;
                }
                //Debug.Log("Drawing hook for placeable");
                allHooks.Add(obj);
            }
        }

        //Debug.Log("Considering " + allHooks.Count + " hooks");

        List <GameObject> hooks = new List <GameObject>();

        foreach (GameObject g in allHooks)
        {
            //Debug.Log("Checking if hook " + g.name + " is visible");
            // Determine whether the object is blocked by another collider
            Vector2    point = Camera.main.WorldToScreenPoint(g.transform.position);
            Ray        r     = Camera.main.ScreenPointToRay(point);
            RaycastHit hit;

            if (Physics.Raycast(r, out hit, float.MaxValue, hookMask))
            {
                // We might hit the boundary of the object represented by the hook?
                if (hit.transform.gameObject == g || Vector3.Distance(hit.point, g.transform.position) < 1f)
                {
                    hooks.Add(g);
                }
            }
        }

        //Debug.Log("Showing " + hooks.Count + " hooks");

        float dist = float.PositiveInfinity;

        selectedHook = null;
        foreach (GameObject h in hooks)
        {
            Vector2 hPos = Camera.main.WorldToScreenPoint(h.transform.position);
            float   d    = Vector2.Distance(
                new Vector2(hPos.x, Screen.height - hPos.y),
                new Vector2(
                    Screen.width / 2,
                    Screen.height / 2
                    )
                );

            if (d < dist)
            {
                dist         = d;
                selectedHook = h;
            }
        }

        foreach (GameObject g in hooks)
        {
            Vector2 point = Camera.main.WorldToScreenPoint(g.transform.position);
            if (g == selectedHook)
            {
                if (Vector3.Distance(pc.transform.position, selectedHook.transform.position) < interactionRange)
                {
                    style.normal.textColor = Color.green;
                    style.fontSize         = 28;
                }
                else
                {
                    style.normal.textColor = Color.blue;
                    style.fontSize         = 28;
                }
            }
            else
            {
                style.normal.textColor = Color.red;
                style.fontSize         = 16;
            }

            Rect labelRect = new Rect(point.x - 90, Screen.height - point.y - 240, 180, 240);

            AuroraObject obj = g.GetComponent <LookAtHook>().obj;
            if (obj.GetType() == typeof(Door))
            {
                TooltipWindow doorTooltip = ((Door)obj).GetTooltip();
                using (new GUILayout.AreaScope(labelRect))
                {
                    doorTooltip.Draw();
                }
            }
            GUI.Label(
                new Rect(point.x - 25, Screen.height - point.y - 25, 50, 50),
                "O",
                style
                );;
        }
    }
Exemplo n.º 11
0
        //Called every time the editor is enabled.
        private void StartEditor(bool hasEnteredEditMode)
        {
            UDebug.Log("On Enable Called");
            Application.quitting += OnApplicationQuit;
            EditorApplication.playModeStateChanged += EditorApplicationOnPlayModeStateChanged;

            _saveOnPlay  = EditorPrefs.GetBool(saveOnPlayKey, false);
            _saveOnClose = EditorPrefs.GetBool(saveOnCloseKey, false);

            _skin = Resources.Load <GUISkin>("BTSkin");

            if (NodeSocket.OnSocketClicked == null)
            {
                NodeSocket.OnSocketClicked += OnNodeSocketClicked;
            }

            if (nodeIds == null)
            {
                nodeIds = new List <int>();
            }

            if (_blackBoardVariablesID == null)
            {
                _blackBoardVariablesID = new List <IDsListWrapper>();
            }

            BaseNodeView.OnNodeRightClicked += view => _rightClickedNode = view;

            _nodeViews          = new List <BaseNodeView>();
            _connections        = new List <NodeConnection>();
            _nodesToDestroy     = new List <BaseNodeView>();
            _variablesToDestroy = new List <BlackBoardVariable>();


            CreateEntryView();

            if (hasEnteredEditMode || EditorApplication.isPlayingOrWillChangePlaymode)
            {
                UDebug.Log("Getting the ids");
                _nodeViews.Clear();
                _connections.Clear();

                for (int i = 0; i < currentGraph.SavedNodes.Count; i++)
                {
                    _nodeViews.Add(currentGraph.SavedNodes[i]);

                    _nodeViews[i].Init(_nodeViews[i].GUID, _nodeViews[i].IsEntryPoint, _nodeViews[i].IsRootView, _nodeViews[i].IsParentView);
                    _nodeViews[i].OnClickedNode += OnClickedNode;

                    for (int j = 0; j < currentGraph.SavedNodes[i].variables.Count; j++)
                    {
                        _nodeViews[i].variables[j] = currentGraph.SavedNodes[i].variables[j];
                    }

                    //todo hacer conexiones por guid para que serialicen por guid, no por referenceia directa.

                    if (_nodeViews[i].IsRootView)
                    {
                        _connections.Add(new NodeConnection(_entryView.exitSocket, _nodeViews[i].entrySocket, Color.white, true));
                    }
                }

                EditorFix.SetObjectDirty(currentGraph);
            }
            else
            {
                if (currentGraph != null)
                {
                    LoadTreeGraph();
                    UDebug.Log("Full Load");
                }
            }


            _tooltipWindow = null;
            UDebug.Log("Awake Called");
        }
Exemplo n.º 12
0
 private void OnCreateTooltip()
 {
     TooltipWindowDispose();
     _tooltipWindow = new TooltipWindow(context: this, tooltipLayoutId: Resource.Layout.tooltip_layout,
                                        tooltipId: Resource.Id.tooltipText, delayedMsec: 5000);
 }
Exemplo n.º 13
0
 public void OnPointerExit(PointerEventData eventData)
 {
     TooltipWindow.Hide(this);
 }
Exemplo n.º 14
0
 public void OnPointerEnter(PointerEventData eventData)
 {
     TooltipWindow.Show(this);
 }
Exemplo n.º 15
0
 private void TooltipWindowDispose()
 {
     _tooltipWindow?.Dispose();
     _tooltipWindow = null;
 }
Exemplo n.º 16
0
 private void Awake()
 {
     Instance = this;
 }
Exemplo n.º 17
0
        public static void Main(string[] args)
        {
            Application.Initialize();

            var w = new Xwt.Window();

            w.Padding = 0;
            w.Title   = "Teststestse";
            w.Hidden += (object s, EventArgs ea) => {
                Application.Exit();
                w.Dispose();
            };

            var vb = new VBox();

            w.Content = vb;

            TooltipWindow ttw = null;
            var           b   = new Button("Show tooltip");

            b.Clicked += (object s, EventArgs ea) => {
                if (ttw != null)
                {
                    ttw.Dispose();
                }

                ttw = new TooltipWindow();
                ttw.TransientFor = w;
                ttw.Show();
            };

            vb.PackStart(b);

            b          = new Button("Hide tooltip");
            b.Clicked += (object s, EventArgs ea) => {
                if (ttw != null)
                {
                    ttw.Dispose();
                }
            };

            vb.PackStart(b);

            var mc = new MyMainComponent();

            mc.LineColor        = Colors.Green;
            mc.ExpandHorizontal = true;
            vb.PackStart(mc);

            var scr = new HScrollbar();

            scr.ExpandHorizontal = true;
            vb.PackEnd(scr);

            scr.LowerValue    = 0;
            scr.UpperValue    = 1;
            scr.PageSize      = 0.05;
            scr.PageIncrement = 0.05;


            mc = new MyMainComponent {
                LineColor = Colors.Blue, WidthRequest = 400, HeightRequest = 40
            };
            vb.PackEnd(mc);
            mc.ExpandHorizontal = true;
            mc.ExpandVertical   = true;

            scr.ValueChanged += (object o, EventArgs ea) =>
            {
                mc.modValue = scr.Value;
                mc.QueueDraw();
            };

            var button = new Button("Hello");

            mc.AddChild(button, 50, 20);

            w.Show();



            Application.Run();
            Application.Dispose();
        }