public override void OnInspectorGUI() { serializedObject.Update(); EditorGUI.BeginChangeCheck(); EditorGUILayout.BeginVertical(); EditorGUILayout.HelpBox("Do not play any videos with Web Panels, use VRC_VideoPlayerSync instead!", MessageType.Error); showHelp = EditorGUILayout.Toggle("Show Help", showHelp); EditorGUILayout.Space(); InspectorField("proximity", "Proximity for Interactivity"); EditorGUILayout.Space(); VRC_WebPanel web = (VRC_WebPanel)target; if (Application.isPlaying) { InspectorField("webRoot", "Web Root"); InspectorField("defaultUrl", "URI"); showFiles = web.webData != null && EditorGUILayout.Foldout(showFiles, web.webData.Count.ToString() + " files imported"); if (showFiles) { foreach (var file in web.webData) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(file.path); EditorGUILayout.LabelField(file.data.Length.ToString()); EditorGUILayout.EndHorizontal(); } } } else { SerializedProperty webRoot = serializedObject.FindProperty("webRoot"); RenderDirectoryList(serializedObject, "webRoot", "Path To Web Content"); if (string.IsNullOrEmpty(webRoot.stringValue)) { InspectorField("defaultUrl", "Start URI"); } else { RenderWebRootSelector(serializedObject, "defaultUrl", "Start Page"); if (showHelp) { EditorGUILayout.HelpBox("Javascript API bindings are called with engine.call('methodName', ...), which returns a promise-like object.", MessageType.Info); EditorGUILayout.HelpBox("Javascript may call ListBindings() to discover available API bindings.", MessageType.Info); EditorGUILayout.HelpBox("Javascript may listen for the 'onBindingsReady' event to execute script when the page is fully loaded and API bindings are available.", MessageType.Info); } } } EditorGUILayout.Space(); InspectorField("cookiesEnabled", "Enable Cookies"); InspectorField("interactive", "Is Interactive"); InspectorField("localOnly", "Only Visible Locally"); if (!web.localOnly) { InspectorField("syncURI", "Synchronize URI"); InspectorField("syncInput", "Synchronize Mouse Position"); } InspectorField("transparent", "Transparent Background"); EditorGUILayout.Space(); InspectorField("station", "Interaction Station"); EditorGUILayout.Space(); InspectorField("cursor", "Mouse Cursor Object"); EditorGUILayout.Space(); InspectorField("resolutionWidth", "Resolution Width"); InspectorField("resolutionHeight", "Resolution Height"); InspectorField("displayRegion", "Display Region"); EditorGUILayout.Space(); InspectorField("extraVideoScreens", "Duplicate Screens"); EditorGUILayout.EndVertical(); if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); } }
void OnEnable() { web = (VRC_WebPanel)target; }