Esempio n. 1
0
        static internal int RSElementSelector <T>(Rect inPosition, GUIContent inLabel, int inCurrentId, RSElementList <T> inElementList) where T : IRSInfo
        {
            inElementList.RefreshInspectorList();

            int currentIdx = inElementList.IndexOf(inCurrentId);
            int nextIdx    = EditorGUI.Popup(inPosition, inLabel, currentIdx, inElementList.InspectorList());

            if (nextIdx < 0)
            {
                return(inCurrentId);
            }

            var element = inElementList.ElementAt(nextIdx);

            return(element == null ? 0 : element.IdHash);
        }
Esempio n. 2
0
        static internal int RSElementSelectorImpl <T>(GUIContent inLabel, int inCurrentId, RSElementList <T> inElementList, params GUILayoutOption[] inOptions) where T : IRSInfo
        {
            inElementList.RefreshInspectorList();

            int currentIdx = inElementList.IndexOf(inCurrentId);
            int nextIdx    = EditorGUILayout.Popup(inLabel, currentIdx, inElementList.InspectorList(), inOptions);

            if (nextIdx < 0)
            {
                GUILayout.Label(RSGUI.NullHelpTooltip(typeof(T)), RSGUIStyles.HelpTooltipStyle, RSGUI.HelpTooltipLayoutOptions());
                return(inCurrentId);
            }

            var element = inElementList.ElementAt(nextIdx);

            if (element == null)
            {
                GUILayout.Label(RSGUI.NullHelpTooltip(typeof(T)), RSGUIStyles.HelpTooltipStyle, RSGUI.HelpTooltipLayoutOptions());
                return(0);
            }

            GUILayout.Label(RSGUI.HelpTooltip(element.Tooltip), RSGUIStyles.HelpTooltipStyle, RSGUI.HelpTooltipLayoutOptions());
            return(element.IdHash);
        }