private void ActiveScenesGUI()
{
int num;
int num2;
int num3 = 0;
int row = this.lv.row;
bool shift = Event.current.shift;
bool actionKey = EditorGUI.actionKey;
Event current = Event.current;
Rect position = GUILayoutUtility.GetRect(styles.scenesInBuild, styles.title);
ArrayList list = new ArrayList(EditorBuildSettings.scenes);
this.lv.totalRows = list.Count;
if (this.selectedLVItems.Length != list.Count)
{
Array.Resize<bool>(ref this.selectedLVItems, list.Count);
}
int[] numArray = new int[list.Count];
for (num = 0; num < numArray.Length; num++)
{
EditorBuildSettingsScene scene = (EditorBuildSettingsScene) list[num];
numArray[num] = num3;
if (scene.enabled)
{
num3++;
}
}
IEnumerator enumerator = ListViewGUILayout.ListView(this.lv, ListViewOptions.wantsExternalFiles | ListViewOptions.wantsReordering, styles.box, new GUILayoutOption[0]).GetEnumerator();
try
{
while (enumerator.MoveNext())
{
ListViewElement element = (ListViewElement) enumerator.Current;
EditorBuildSettingsScene scene2 = (EditorBuildSettingsScene) list[element.row];
bool flag3 = File.Exists(scene2.path);
EditorGUI.BeginDisabledGroup(!flag3);
bool on = this.selectedLVItems[element.row];
if (on && (current.type == EventType.Repaint))
{
styles.selected.Draw(element.position, false, false, false, false);
}
if (!flag3)
{
scene2.enabled = false;
}
Rect rect2 = new Rect(element.position.x + 4f, element.position.y, styles.toggleSize.x, styles.toggleSize.y);
EditorGUI.BeginChangeCheck();
scene2.enabled = GUI.Toggle(rect2, scene2.enabled, string.Empty);
if (EditorGUI.EndChangeCheck() && on)
{
for (int i = 0; i < list.Count; i++)
{
if (this.selectedLVItems[i])
{
((EditorBuildSettingsScene) list[i]).enabled = scene2.enabled;
}
}
}
GUILayout.Space(styles.toggleSize.x);
string path = scene2.path;
if (path.StartsWith("Assets/"))
{
path = path.Substring("Assets/".Length);
}
Rect rect = GUILayoutUtility.GetRect(EditorGUIUtility.TempContent(path), styles.levelString);
if (Event.current.type == EventType.Repaint)
{
styles.levelString.Draw(rect, EditorGUIUtility.TempContent(path), false, false, on, false);
}
GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MaxWidth(36f) };
GUILayout.Label(!scene2.enabled ? string.Empty : numArray[element.row].ToString(), styles.levelStringCounter, options);
EditorGUI.EndDisabledGroup();
if ((ListViewGUILayout.HasMouseUp(element.position) && !shift) && !actionKey)
{
if (!shift && !actionKey)
{
ListViewGUILayout.MultiSelection(row, element.row, ref this.initialSelectedLVItem, ref this.selectedLVItems);
}
}
else if (ListViewGUILayout.HasMouseDown(element.position))
{
if ((!this.selectedLVItems[element.row] || shift) || actionKey)
{
ListViewGUILayout.MultiSelection(row, element.row, ref this.initialSelectedLVItem, ref this.selectedLVItems);
}
this.lv.row = element.row;
this.selectedBeforeDrag = new bool[this.selectedLVItems.Length];
this.selectedLVItems.CopyTo(this.selectedBeforeDrag, 0);
this.selectedBeforeDrag[this.lv.row] = true;
}
}
}
finally
{
IDisposable disposable = enumerator as IDisposable;
if (disposable == null)
{
}
disposable.Dispose();
}
GUI.Label(position, styles.scenesInBuild, styles.title);
if (GUIUtility.keyboardControl == this.lv.ID)
{
if ((Event.current.type == EventType.ValidateCommand) && (Event.current.commandName == "SelectAll"))
{
Event.current.Use();
}
else if ((Event.current.type == EventType.ExecuteCommand) && (Event.current.commandName == "SelectAll"))
{
for (num = 0; num < this.selectedLVItems.Length; num++)
{
this.selectedLVItems[num] = true;
}
this.lv.selectionChanged = true;
Event.current.Use();
GUIUtility.ExitGUI();
}
}
if (this.lv.selectionChanged)
{
ListViewGUILayout.MultiSelection(row, this.lv.row, ref this.initialSelectedLVItem, ref this.selectedLVItems);
}
if (this.lv.fileNames != null)
{
Array.Sort<string>(this.lv.fileNames);
int num6 = 0;
for (num = 0; num < this.lv.fileNames.Length; num++)
{
if (this.lv.fileNames[num].EndsWith("unity"))
{
EditorBuildSettingsScene scene3 = new EditorBuildSettingsScene {
path = FileUtil.GetProjectRelativePath(this.lv.fileNames[num])
};
if (scene3.path == string.Empty)
{
scene3.path = this.lv.fileNames[num];
}
scene3.enabled = true;
list.Insert(this.lv.draggedTo + num6++, scene3);
}
}
if (num6 != 0)
{
Array.Resize<bool>(ref this.selectedLVItems, list.Count);
for (num = 0; num < this.selectedLVItems.Length; num++)
{
this.selectedLVItems[num] = (num >= this.lv.draggedTo) && (num < (this.lv.draggedTo + num6));
}
}
this.lv.draggedTo = -1;
}
if (this.lv.draggedTo != -1)
{
ArrayList c = new ArrayList();
num2 = 0;
num = 0;
while (num < this.selectedLVItems.Length)
{
if (this.selectedBeforeDrag[num])
{
c.Add(list[num2]);
list.RemoveAt(num2);
num2--;
if (this.lv.draggedTo >= num)
{
this.lv.draggedTo--;
}
}
num++;
num2++;
}
this.lv.draggedTo = ((this.lv.draggedTo <= list.Count) && (this.lv.draggedTo >= 0)) ? this.lv.draggedTo : list.Count;
list.InsertRange(this.lv.draggedTo, c);
for (num = 0; num < this.selectedLVItems.Length; num++)
{
this.selectedLVItems[num] = (num >= this.lv.draggedTo) && (num < (this.lv.draggedTo + c.Count));
}
}
if ((current.type == EventType.KeyDown) && ((current.keyCode == KeyCode.Backspace) || (current.keyCode == KeyCode.Delete)))
{
num2 = 0;
num = 0;
while (num < this.selectedLVItems.Length)
{
if (this.selectedLVItems[num])
{
list.RemoveAt(num2);
num2--;
}
this.selectedLVItems[num] = false;
num++;
num2++;
}
this.lv.row = 0;
current.Use();
}
EditorBuildSettings.scenes = list.ToArray(typeof(EditorBuildSettingsScene)) as EditorBuildSettingsScene[];
}