private void OnGUI() { EditorGUILayout.Space(); EditorGUILayout.LabelField("Touch Options", EditorStyles.boldLabel); touchColor = EditorGUILayout.ColorField("Touch Highlight Color", touchColor); EditorGUILayout.Space(); EditorGUILayout.LabelField("Grab Options", EditorStyles.boldLabel); useGrab = EditorGUILayout.Toggle("Is Grabbable", useGrab); holdGrab = EditorGUILayout.Toggle("Hold Button To Grab", holdGrab); EditorGUILayout.Space(); primGrab = (PrimaryGrab)EditorGUILayout.EnumPopup("Grab Attach Mechanic", primGrab); secGrab = (SecondaryGrab)EditorGUILayout.EnumPopup("Secondary Grab Attach", secGrab); EditorGUILayout.Space(); EditorGUILayout.LabelField("Use Options", EditorStyles.boldLabel); useUse = EditorGUILayout.Toggle("Is Usable", useUse); holdUse = EditorGUILayout.Toggle("Hold Button To Use", holdUse); useIfGrabbed = EditorGUILayout.Toggle("Use Only If Grabbed", useIfGrabbed); EditorGUILayout.Space(); EditorGUILayout.LabelField("Misc Options", EditorStyles.boldLabel); disableIdle = EditorGUILayout.Toggle("Disable On Idle", disableIdle); addrb = EditorGUILayout.Toggle("Add RigidBody", addrb); addHaptics = EditorGUILayout.Toggle("Add Haptics", addHaptics); EditorGUILayout.Space(); if (GUILayout.Button("Setup selected object(s)", GUILayout.Height(40))) { SetupObject(); } }
private void OnGUI() { GUILayout.Space(10); GUI.skin.label.fontSize = 24; GUI.skin.label.fontStyle = FontStyle.Bold; GUI.skin.label.alignment = TextAnchor.MiddleCenter;//居中 GUILayout.Label("C L K J"); GUILayout.Space(8); EditorGUILayout.Space(); EditorGUILayout.LabelField("【触碰设置】", EditorStyles.boldLabel); touchColor = EditorGUILayout.ColorField("触碰时高亮颜色", touchColor); EditorGUILayout.Space(); EditorGUILayout.LabelField("【抓取设置】", EditorStyles.boldLabel); useGrab = EditorGUILayout.Toggle("是否可抓取?", useGrab); holdGrab = EditorGUILayout.Toggle("长按抓取?", holdGrab); EditorGUILayout.Space(); primGrab = (PrimaryGrab)EditorGUILayout.EnumPopup("抓取方式", primGrab); secGrab = (SecondaryGrab)EditorGUILayout.EnumPopup("二级联动抓取方式", secGrab); EditorGUILayout.Space(); EditorGUILayout.LabelField("【使用设置】", EditorStyles.boldLabel); useUse = EditorGUILayout.Toggle("是否可以使用?", useUse); holdUse = EditorGUILayout.Toggle("长按使用?", holdUse); useIfGrabbed = EditorGUILayout.Toggle("仅当抓取时使用?", useIfGrabbed); EditorGUILayout.Space(); EditorGUILayout.LabelField("【优化设置】", EditorStyles.boldLabel); disableIdle = EditorGUILayout.Toggle("空闲时,不启用对应组件?", disableIdle); addrb = EditorGUILayout.Toggle("添加刚体?", addrb); addHaptics = EditorGUILayout.Toggle("添加震动组件?", addHaptics); EditorGUILayout.Space(); if (GUILayout.Button("设置当前Hierarchy面板选中物体!", GUILayout.Height(40))) { SetupObject(); } }
private void OnGUI() { GUILayout.Space(10); GUI.skin.label.fontSize = 24; GUI.skin.label.fontStyle = FontStyle.Bold; GUI.skin.label.alignment = TextAnchor.MiddleCenter;//居中 GUILayout.Label(texture); GUILayout.Label("向 阳 的 黑 小 孩"); GUILayout.Space(8); GUI.skin.label.fontStyle = FontStyle.Normal; EditorGUILayout.Space(); EditorGUILayout.LabelField("【触碰设置】", EditorStyles.boldLabel); touchColor = EditorGUILayout.ColorField("触碰时高亮颜色", touchColor); EditorGUILayout.Space(); EditorGUILayout.LabelField("【抓取设置】", EditorStyles.boldLabel); useGrab = EditorGUILayout.Toggle("是否可抓取?", useGrab); holdGrab = EditorGUILayout.Toggle("长按抓取?", holdGrab); EditorGUILayout.Space(); primGrab = (PrimaryGrab)EditorGUILayout.EnumPopup("单手抓取方式", primGrab); string temp = ""; switch (primGrab) { case PrimaryGrab.父子物体式: temp = "交互物体当被抓取时会自动的成为手柄的子对象,使物体自然的跟随手柄移动和旋转。"; break; case PrimaryGrab.FixedJoint连接式: temp = "抓取时,在手柄和抓取物体之间建立一个Fixed Joint来连接。"; break; case PrimaryGrab.攀爬式: temp = "使用这种触碰抓取方式的物体会被标记为一个可攀爬的交互对象"; break; case PrimaryGrab.关节式: temp = "在可交互物体上自定义一个抓取关节,运行时会把这个关节作为交互物体的子对象。"; break; case PrimaryGrab.SpringJoint连接式: temp = "在手柄和抓取物体之间创建一个Spring Joint来连接。"; break; case PrimaryGrab.模拟碰撞式: temp = "这种抓取方式物体只是跟随手柄方向进行移动,当碰到其他刚体时,超过限制就会掉落。"; break; } //GUILayout.BeginVertical(); GUI.skin.label.fontSize = 10; GUI.skin.label.fontStyle = FontStyle.Normal; GUI.skin.label.alignment = TextAnchor.MiddleLeft; GUILayout.Label(" 解释:" + temp, GUILayout.MaxHeight(20)); //temp = EditorGUILayout.TextArea(temp, GUILayout.MaxHeight(100)); //GUILayout.BeginVertical(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); string temp1 = ""; switch (secGrab) { case SecondaryGrab.换手: temp1 = "一只手抓握,第二只手上来时,给第二只手(换手操作)。"; break; case SecondaryGrab.控制方向: temp1 = "两只手同时握着一个东西,比如机枪,等很重的,需要两只手一起拿东西"; break; case SecondaryGrab.缩放: temp1 = "通过两只手的距离,来控制缩放"; break; } secGrab = (SecondaryGrab)EditorGUILayout.EnumPopup("双手同时抓取方式", secGrab); GUILayout.Label(" 解释:" + temp1, GUILayout.MaxHeight(20)); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.LabelField("【使用设置】", EditorStyles.boldLabel); useUse = EditorGUILayout.Toggle("是否可以使用?", useUse); holdUse = EditorGUILayout.Toggle("长按使用?", holdUse); useIfGrabbed = EditorGUILayout.Toggle("仅当抓取时使用?", useIfGrabbed); EditorGUILayout.Space(); EditorGUILayout.LabelField("【优化设置】", EditorStyles.boldLabel); disableIdle = EditorGUILayout.Toggle("空闲时,不启用对应组件?", disableIdle); addrb = EditorGUILayout.Toggle("添加刚体?", addrb); addHaptics = EditorGUILayout.Toggle("添加震动组件?", addHaptics); EditorGUILayout.Space(); if (GUILayout.Button("设置当前Hierarchy面板选中物体!", GUILayout.Height(40))) { SetupObject(); } }