public void Draw(Rect r, NGRemoteInspectorWindow inspector) { this.dataDrawer.Init(this.parentBehaviour.parent.instanceID.ToString() + NGServerScene.ValuePathSeparator + this.parentBehaviour.instanceID, inspector); DataDrawer drawer = this.dataDrawer.DrawChild(this.fieldIndex.ToString(), this.name, this.value); try { this.drawer.Draw(r, drawer); } catch (Exception ex) { throw new Exception("Drawing field \"" + drawer.GetPath() + "\" failed.", ex); } }
public float GetHeight(NGRemoteInspectorWindow inspector) { float height = ClientComponent.Spacing + ClientComponent.ComponentHeaderHeight; // Top spacing + Component bar if (this.fold == true) { for (int i = 0; i < this.fields.Length; i++) { if (this.fields[i].isPublic == true && this.enabledFieldIndex != i) { height += ClientComponent.MemberSpacing + this.fields[i].GetHeight(inspector); } } } return(height); }
public void OnGUI(Rect r, NGRemoteInspectorWindow inspector) { this.DrawHeader(r, inspector); if (this.fold == false) { return; } r.y += ClientComponent.Spacing + ClientComponent.ComponentHeaderHeight; ++EditorGUI.indentLevel; for (int i = 0; i < this.fields.Length; i++) { if (this.fields[i].isPublic == true && this.enabledFieldIndex != i) { float height = this.fields[i].GetHeight(inspector); r.y += ClientComponent.MemberSpacing; if (r.y + height <= inspector.ScrollPosition.y) { r.y += height; continue; } r.height = height; this.fields[i].Draw(r, inspector); r.y += height; if (r.y - inspector.ScrollPosition.y > inspector.BodyRect.height) { break; } } } --EditorGUI.indentLevel; }
private void DrawHeader(Rect r, NGRemoteInspectorWindow inspector) { if (Event.current.type == EventType.Repaint) { Rect bar = r; bar.y += 1F; bar.x = 0F; bar.width = inspector.position.width; bar.height = 1F; EditorGUI.DrawRect(bar, ClientComponent.BackgroundColorBar); } r.y += ClientComponent.Spacing; r.height = ClientComponent.ComponentHeaderHeight; if (this.type != null && Event.current.type == EventType.MouseDown && Event.current.button == 1 && r.Contains(Event.current.mousePosition) == true) { GenericMenu menu = new GenericMenu(); if (this.deletable == true) { menu.AddItem(new GUIContent("Remove Component"), false, this.RequestRemoveComponent); } menu.AddItem(new GUIContent("Copy Component"), false, this.CopyComponent); menu.ShowAsContext(); Event.current.Use(); } if (this.togglable == true && this.enabledFieldIndex != -1 && this.fields[this.enabledFieldIndex].value != null) { Rect r2 = r; r2.width = 16F; r2.x += 34F; if (inspector.Hierarchy.GetUpdateNotification(this.parent.instanceID.ToString() + NGServerScene.ValuePathSeparator + this.instanceID.ToString() + NGServerScene.ValuePathSeparator + this.enabledFieldIndex) != NotificationPath.None) { this.animEnable.af.valueChanged.RemoveAllListeners(); this.animEnable.af.valueChanged.AddListener(inspector.Repaint); this.animEnable.Start(); } using (this.animEnable.Restorer(0F, .8F + this.animEnable.Value, 0F, 1F)) { EditorGUI.BeginChangeCheck(); bool enable = EditorGUI.Toggle(r2, (bool)this.fields[this.enabledFieldIndex].value); if (EditorGUI.EndChangeCheck() == true) { this.unityData.AddPacket(new ClientUpdateFieldValuePacket(this.parent.instanceID.ToString() + NGServerScene.ValuePathSeparator + this.instanceID.ToString() + NGServerScene.ValuePathSeparator + this.enabledFieldIndex, this.booleanHandler.Serialize(enable), this.booleanHandler), this.OnComponentToggled); } } } if (this.methodNames.Length > 0) { r.width -= ClientComponent.MethodsWidth; } this.fold = EditorGUI.Foldout(r, this.fold, GUIContent.none, true); Rect r3 = r; r3.x += 16F; r3.width = 16F; GUI.DrawTexture(r3, this.icon); r.x += 48F; r.width -= 48F; EditorGUI.LabelField(r, new GUIContent(Utility.NicifyVariableName(this.name)), GeneralStyles.ComponentName); if (this.methodNames.Length > 0) { r.x += r.width; r.width = ClientComponent.MethodsWidth - ClientComponent.OpenMethodButtonWidth; this.selectedMethod = EditorGUI.Popup(r, this.selectedMethod, this.methodNames); r.x += r.width; r.width = ClientComponent.OpenMethodButtonWidth; if (GUI.Button(r, "@") == true) { EditorWindow.GetWindow <MethodArgumentsWindow>("Method Invoker Form").Init(this.unityData.Client, this.parent.instanceID, this.instanceID, this.methods[this.selectedMethod]); } } }
public float GetHeight(NGRemoteInspectorWindow inspector) { return(this.drawer.GetHeight(this.value)); }