public static int SelectionList(int selected, string[] list, GUIStyle elementStyle, DoubleClickCallback callback) { for (var i = 0; i < list.Length; ++i) { var elementRect = GUILayoutUtility.GetRect(new GUIContent(list[i]), elementStyle); var hover = elementRect.Contains(Event.current.mousePosition); if (hover && Event.current.type == EventType.MouseDown) { selected = i; Event.current.Use(); } else if (hover && callback != null && Event.current.type == EventType.MouseUp && Event.current.clickCount == 2) { callback(i); Event.current.Use(); } else if (Event.current.type == EventType.Repaint) { elementStyle.Draw(elementRect, list[i], hover, false, i == selected, false); } } return(selected); }
public static int SelectionList(int selected, string[] list, GUIStyle elementStyle, DoubleClickCallback callback) { for (int i = 0; i < list.Length; ++i) { Rect elementRect = GUILayoutUtility.GetRect(new GUIContent(list[i]), elementStyle); bool hover = elementRect.Contains(Event.current.mousePosition); /* if (hover && Event.current.type == EventType.MouseDown) { selected = i; Event.current.Use(); } else if (hover && callback != null && Event.current.type == EventType.MouseUp && Event.current.clickCount == 2) { callback(i); Event.current.Use(); } else if (Event.current.type == EventType.repaint) { elementStyle.Draw(elementRect, list[i], hover, false, i == selected, false); } */ if (hover && Event.current.type == EventType.MouseDown && Event.current.clickCount == 1) { selected = i; Event.current.Use(); } else if (hover && callback != null && Event.current.type == EventType.MouseDown && Event.current.clickCount == 2) { callback(i); Event.current.Use(); } else if (Event.current.type == EventType.repaint) { elementStyle.Draw(elementRect, list[i], hover, false, i == selected, false); } } return selected; }
public static int SelectionList(int selected, GUIContent[] list, GUIStyle elementStyle, DoubleClickCallback callback) { for (int i = 0; i < list.Length; ++i) { Rect elementRect = GUILayoutUtility.GetRect(list [i], elementStyle); bool hover = elementRect.Contains(Event.current.mousePosition); if (hover && Event.current.type == EventType.MouseDown && Event.current.clickCount == 1) // added " && Event.current.clickCount == 1" { selected = i; Event.current.Use(); } else if (hover && callback != null && Event.current.type == EventType.MouseDown && Event.current.clickCount == 2) //Changed from MouseUp to MouseDown { //Debug.Log("Works !"); callback(i); Event.current.Use(); } else if (Event.current.type == EventType.repaint) { elementStyle.Draw(elementRect, list [i], hover, false, i == selected, false); } } return selected; }
public static int SelectionList(int selected, string[] list, DoubleClickCallback callback) { return(SelectionList(selected, list, "button", callback)); }
public static int SelectionList(int selected, string[] list, GUIStyle elementStyle, DoubleClickCallback callback) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Invalid comparison between Unknown and I4 //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Invalid comparison between Unknown and I4 //IL_007a: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < list.Length; i++) { Rect rect = GUILayoutUtility.GetRect(new GUIContent(list[i]), elementStyle); bool flag = rect.Contains(Event.current.mousePosition); if (flag && (int)Event.current.type == 0) { selected = i; Event.current.Use(); } else if (flag && callback != null && (int)Event.current.type == 1) { callback(i); Event.current.Use(); } else if ((int)Event.current.type == 7) { elementStyle.Draw(rect, list[i], flag, false, i == selected, false); } } return(selected); }
public static int SelectionList(int selected, string[] list, DoubleClickCallback callback) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown return(SelectionList(selected, list, (GUIStyle)("List Item"), callback)); }
public static int SelectionList(int selected, GUIContent[] list, GUIStyle elementStyle, DoubleClickCallback callback) { elementStyle = GUI.skin.customStyles [0]; for (int i = 0; i < list.Length; ++i) { //elementStyle.fontSize = 15; Rect elementRect = GUILayoutUtility.GetRect (list [i], elementStyle); bool hover = elementRect.Contains (Event.current.mousePosition); if (hover && Event.current.type == EventType.MouseDown && Event.current.clickCount == 1) { selected = i; Event.current.Use (); } else if (hover && callback != null && Event.current.type == EventType.MouseDown && Event.current.clickCount == 2) { callback (i); Event.current.Use (); } else if (Event.current.type == EventType.repaint) { elementStyle.Draw (elementRect, list [i], hover, false, i == selected, false); } } return selected; }
public static int SelectionList(int selected, string[] list, DoubleClickCallback callback) { return SelectionList(selected, list, GUIStyle.none, callback); }
public static int SelectionList(int selected, string[] list, DoubleClickCallback callback, SingleClickCallback selCallback) { return(SelectionList(selected, list, getListItemStyle("List Item"), callback, selCallback)); }
public static int SelectionList(int selected, string[] list, GUIStyle elementStyle, DoubleClickCallback callback, SingleClickCallback selCallback) { GUIContent[] contentList = new GUIContent[list.Length]; for (int i = 0; i < list.Length; ++i) { contentList[i] = new GUIContent(list[i]); } return(SelectionList(selected, contentList, elementStyle, callback, selCallback)); }
internal static List <int> SelectionList(List <int> selected, GUIContent[] list, DoubleClickCallback callback) { return(SelectionList(selected, list, "List Item", callback)); }
internal static List <int> SelectionList(List <int> selected, string[] list, GUIStyle element_style, DoubleClickCallback callback) { for (int i = 0; i < list.Length; ++i) { Rect element_rect = GUILayoutUtility.GetRect(new GUIContent(list[i]), element_style); bool hover = element_rect.Contains(Event.current.mousePosition); if (hover && Event.current.type == EventType.MouseDown && Input.GetKey("Shift")) { if (multiSelectionStartIndex == -1) { multiSelectionStartIndex = i; } else { selected.Clear(); int nb_element_selected = i - multiSelectionStartIndex; for (int id = 0; id < nb_element_selected; id++) { if (!selected.Contains(id)) { selected.Add(i + multiSelectionStartIndex); } } } Event.current.Use(); } else if (hover && Event.current.type == EventType.MouseDown) { selected.Clear(); selected.Add(i); Event.current.Use(); } else if (hover && callback != null && Event.current.type == EventType.MouseUp && Event.current.clickCount == 2) { if (multiSelection) { callback(new int[1] { i }); } else { callback(selected.ToArray()); } Event.current.Use(); } if (Event.current.type == EventType.Repaint) { bool is_selected = false; foreach (int indice in selected) { if (indice == i) { is_selected = true; break; } } element_style.Draw(element_rect, list[i], hover, is_selected, is_selected, false); } } return(selected); }
public static int SelectionList(int selected, GUIContent[] list, GUIStyle elementStyle, DoubleClickCallback callback) { for (int i = 0; i < list.Length; ++i) { Rect elementRect = GUILayoutUtility.GetRect(list[i], elementStyle); bool hover = elementRect.Contains(Event.current.mousePosition); if (hover && Event.current.type == EventType.MouseDown && Event.current.clickCount == 1) // added " && Event.current.clickCount == 1" { selected = i; Event.current.Use(); } else if (hover && callback != null && Event.current.type == EventType.MouseDown && Event.current.clickCount == 2) //Changed from MouseUp to MouseDown { Debug.Log("Works !"); callback(i); Event.current.Use(); } else if (Event.current.type == EventType.Repaint) { elementStyle.Draw(elementRect, list[i], hover, false, i == selected, false); } } return(selected); }
public static int SelectionList(int selected, GUIContent[] list, GUIStyle elementStyle, DoubleClickCallback callback) { elementStyle = GUI.skin.customStyles [0]; for (int i = 0; i < list.Length; ++i) { //elementStyle.fontSize = 15; Rect elementRect = GUILayoutUtility.GetRect(list [i], elementStyle); bool hover = elementRect.Contains(Event.current.mousePosition); if (hover && Event.current.type == EventType.MouseDown && Event.current.clickCount == 1) { selected = i; Event.current.Use(); } else if (hover && callback != null && Event.current.type == EventType.MouseDown && Event.current.clickCount == 2) { callback(i); Event.current.Use(); } else if (Event.current.type == EventType.Repaint) { elementStyle.Draw(elementRect, list [i], hover, false, i == selected, false); } } return(selected); }
public static int SelectionList(int selected, GUIContent[] list, DoubleClickCallback callback) { return(SelectionList(selected, list, "List Item", callback)); }
public static int SelectionList(int selected, string[] list, DoubleClickCallback callback) { return SelectionList(selected, list, "List Item", callback); }
internal static List <int> SelectionList(List <int> selected, GUIContent[] list, GUIStyle element_style, DoubleClickCallback callback) { for (int i = 0; i < list.Length; ++i) { Rect element_rect = GUILayoutUtility.GetRect(list[i], element_style); bool hover = element_rect.Contains(Event.current.mousePosition); if (hover && Event.current.type == EventType.MouseDown && Event.current.control) { if (multiSelection) { if (selected.Contains(i)) { selected.Remove(i); } else { selected.Add(i); } } Event.current.Use(); } else if (hover && Event.current.type == EventType.MouseDown && Event.current.shift) { if (selected.Count == 0) { selected.Add(i); } else { int nbelementselected = Math.Abs(i - selected[0]) + 1; int id_file_to_add; for (int id = 0; id < nbelementselected; id++) { id_file_to_add = id + Math.Min(i, selected[0]); if (!selected.Contains(id_file_to_add)) { selected.Add(id_file_to_add); } } multiSelection = true; } Event.current.Use(); } else if (hover && Event.current.type == EventType.MouseDown && Event.current.clickCount == 1) { selected = new List <int> { i }; Event.current.Use(); } else if (hover && callback != null && Event.current.type == EventType.MouseDown && Event.current.clickCount == 2) { if (!multiSelection) { callback(new int[1] { i }); } else { callback(selected.ToArray()); } Event.current.Use(); } if (Event.current.type == EventType.Repaint) { bool is_selected = false; if (selected != null) { foreach (int indice in selected) { if (indice == i) { is_selected = true; hover = true; break; } } } element_style.Draw(element_rect, list[i], hover, is_selected, is_selected, false); } } return(selected); }
public static int SelectionList(int selected, GUIContent[] list, DoubleClickCallback callback) { return(SelectionList(selected, list, getListItemStyle("List Item"), callback, null)); }
/* * public static int SelectionList(int selected, string[] list, GUIStyle elementStyle) * { * return SelectionList(selected, list, elementStyle, null); * }*/ public static int SelectionList(int selected, string[] list, DoubleClickCallback callback) { return(SelectionList(selected, list, "List Item", callback)); //return SelectionList(selected, list, callback); }
public static int SelectionList(int selected, GUIContent[] list, GUIStyle elementStyle, DoubleClickCallback callback, SingleClickCallback selCallback) { for (int i = 0; i < list.Length; ++i) { Rect elementRect = GUILayoutUtility.GetRect(list[i], elementStyle); if (elementRect.width > maxListWidth) { elementRect.width = maxListWidth; } bool hover = elementRect.Contains(Event.current.mousePosition); if (hover && Event.current.type == EventType.MouseDown && Event.current.clickCount == 1) { selected = i; Event.current.Use(); if (selCallback != null) { selCallback(i); } } else if (hover && callback != null && Event.current.type == EventType.MouseDown && Event.current.clickCount == 2) { callback(i); Event.current.Use(); } else if (Event.current.type == EventType.Repaint) { elementStyle.Draw(elementRect, list[i], hover, false, i == selected, false); } } return(selected); }
public static int SelectionList(int selected, GUIContent[] list, DoubleClickCallback callback) { return SelectionList (selected, list, "listitem", callback); }