private void RemoveVRDeviceElement(BuildTargetGroup target, ReorderableList list) { List <string> list2 = VREditor.GetVREnabledDevices(target).ToList <string>(); list2.RemoveAt(list.index); this.ApplyChangedVRDeviceList(target, list2.ToArray()); }
private void VRDevicesGUIOneBuildTarget(BuildTargetGroup targetGroup) { if (!this.m_VRDeviceActiveUI.ContainsKey(targetGroup)) { ReorderableList reorderableList = new ReorderableList(VREditor.GetVREnabledDevices(targetGroup), typeof(VRDeviceInfoEditor), true, true, true, true); reorderableList.onAddDropdownCallback = delegate(Rect rect, ReorderableList list) { this.AddVRDeviceElement(targetGroup, rect, list); }; reorderableList.onRemoveCallback = delegate(ReorderableList list) { this.RemoveVRDeviceElement(targetGroup, list); }; reorderableList.onReorderCallback = delegate(ReorderableList list) { this.ReorderVRDeviceElement(targetGroup, list); }; reorderableList.drawElementCallback = delegate(Rect rect, int index, bool isActive, bool isFocused) { this.DrawVRDeviceElement(targetGroup, rect, index, isActive, isFocused); }; reorderableList.drawHeaderCallback = delegate(Rect rect) { GUI.Label(rect, "Virtual Reality SDKs", EditorStyles.label); }; this.m_VRDeviceActiveUI.Add(targetGroup, reorderableList); } this.m_VRDeviceActiveUI[targetGroup].DoLayoutList(); if (this.m_VRDeviceActiveUI[targetGroup].list.Count == 0) { EditorGUILayout.HelpBox("Must add at least one Virtual Reality SDK.", MessageType.Warning); } }
public static VRDeviceInfoEditor[] GetEnabledVRDeviceInfo(BuildTargetGroup targetGroup) { string[] enabledVRDevices = VREditor.GetVREnabledDevices(targetGroup); return((from d in VREditor.GetAllVRDeviceInfo(targetGroup) where enabledVRDevices.Contains(d.deviceNameKey) select d).ToArray <VRDeviceInfoEditor>()); }
private void AddVRDeviceElement(BuildTargetGroup target, Rect rect, ReorderableList list) { VRDeviceInfoEditor[] source = this.m_AllVRDevicesForBuildTarget[target]; List <string> enabledDevices = VREditor.GetVREnabledDevices(target).ToList <string>(); string[] options = (from d in source select d.deviceNameUI).ToArray <string>(); bool[] enabled = (from d in source select !enabledDevices.Any((string enabledDeviceName) => d.deviceNameKey == enabledDeviceName)).ToArray <bool>(); EditorUtility.DisplayCustomMenu(rect, options, enabled, null, new EditorUtility.SelectMenuItemFunction(this.AddVRDeviceMenuSelected), target); }
private void AddVRDeviceMenuSelected(object userData, string[] options, int selected) { BuildTargetGroup buildTargetGroup = (BuildTargetGroup)((int)userData); List <string> list = VREditor.GetVREnabledDevices(buildTargetGroup).ToList <string>(); string item; if (!this.m_MapVRUIStringToDeviceKey.TryGetValue(options[selected], out item)) { item = options[selected]; } list.Add(item); this.ApplyChangedVRDeviceList(buildTargetGroup, list.ToArray()); }