private void OnDisable() { try { if (winSelectMidi != null) { //Debug.Log("OnDisable winSelectMidi " + winSelectMidi.Title); winSelectMidi.Close(); } } catch (Exception) { } }
private void DrawWindow() { int localstartX = 0; // EspaceX; int localstartY = 0; // EspaceY; int boxX = 0; int boxY = 0; Rect zone = new Rect(localstartX, localstartY, resizedWidth + EspaceX, resizedHeight + EspaceY); GUI.color = BackgroundColor; GUI.Box(zone, ""); GUI.color = Color.white; Rect listVisibleRect = new Rect(localstartX, localstartY, resizedWidth - localstartX, resizedHeight - EspaceY); Rect listContentRect = new Rect(0, 0, calculatedColCount * (ColWidth + EspaceX) + 0, countRow * ColHeight + EspaceY); scrollPos = GUI.BeginScrollView(listVisibleRect, scrollPos, listContentRect); boxX = 0; boxY = 0; int indexList = -1; try { foreach (MPTKListItem item in list) { if (item != null) { indexList++; GUIStyle style = myStyle.BtStandard; // if (patch.Index == selectedItem) style = myStyle.BtSelected; if (item.Index == SelectedItem) { GUI.color = myStyle.ButtonColor; } Rect rect = new Rect(boxX, boxY, ColWidth, ColHeight); if (GUI.Button(rect, indexList + " - " + item.Label, style)) { SelectedItem = item.Index; if (OnSelect != null) { OnSelect(Tag, item.Index); } if (!KeepOpen) { SelectWindow.Close(); } } GUI.color = Color.white; if (calculatedColCount <= 1 || indexList % calculatedColCount == calculatedColCount - 1) { // New row boxY += ColHeight; boxX = 0; } else { boxX += ColWidth + EspaceX; } } } } catch (Exception) { } GUI.EndScrollView(); }