public static void Toggle(SmartRect position, Setting <bool> val, string label, float offset, bool move = false) { UGUI.Label(position.ToRect(), label, Style.Label); position.MoveOffsetX(position.width - Style.Height); val.Value = UGUI.Toggle(position.ToRect(), val.Value, string.Empty, Style.Toggle); position.ResetX(); if (move) { position.MoveY(); } }
public static bool Toggle(SmartRect position, bool val, string label, bool move = false) { UGUI.Label(position.ToRect(), label, Style.Label); position.MoveOffsetX(position.width - Height); val = UGUI.Toggle(position.ToRect(), val, string.Empty, Style.Toggle); position.ResetX(); if (move) { position.MoveY(); } return(val); }
private static bool DoToggle(bool value, GUIContent content, GUIStyle style, GUILayoutOption[] options) { return(GUI.Toggle(GUILayoutUtility.GetRect(content, style, options), value, content, style)); }
public static void Toggle(Rect position, Setting <bool> val, string label) { UGUI.Label(position, label, Style.Label); val.Value = UGUI.Toggle(new Rect(position.x + position.width - Style.Height, position.y, Style.Height, Style.Height), val.Value, string.Empty, Style.Toggle); }
public static bool Toggle(Rect position, bool val, string label) { UGUI.Label(position, label, Style.Label); return(UGUI.Toggle(new Rect(position.x + position.width - Style.Height, position.y, Style.Height, Style.Height), val, string.Empty, Style.Toggle)); }
public override void OnPreviewGUI(Rect r, GUIStyle background) { //if (!Application.isPlaying) // return; InitPreview(); var asset = Asset; bool fog = RenderSettings.fog; Unsupported.SetRenderSettingsUseFogNoDirty(false); previewRender.BeginPreview(r, background); previewRender.ambientColor = asset.ambientColor; previewRender.lights[0].intensity = asset.lightIntensity; Camera camera = previewRender.camera; if (skeleton) { camera.transform.position = skeleton.transform.position + Quaternion.Euler(angels) * skeleton.transform.rotation * new Vector3(0, height, distance); camera.transform.LookAt(skeleton.transform.position + new Vector3(0, height * 1f, 0), skeleton.transform.up); } camera.Render(); previewRender.EndAndDrawPreview(r); Unsupported.SetRenderSettingsUseFogNoDirty(fog); Rect itemRect = new Rect(r.x, r.y, selectedWidth, selectedHeight); if (avatarRes == null) { GUI.Label(itemRect, "Avatars Empty"); return; } if (GUI.Toggle(new Rect(itemRect.x, itemRect.y, selectedWidth, selectedHeight), combine, "Combine") != combine) { combine = !combine; } itemRect.y += itemRect.height + spaceWidth; itemRect = GUIOptions(itemRect, avatarRes.name, () => { SelectAvatar(selectedAvatarIndex - 1); }, () => { SelectAvatar(selectedAvatarIndex + 1); }); itemRect = GUIOptions(itemRect, avatarRes.animationNames.Count > 0 ? avatarRes.animationNames[avatarRes.selectedAnimationIndex] : "(None)", () => { SelectAnimation(avatarRes.selectedAnimationIndex - 1); }, () => { SelectAnimation(avatarRes.selectedAnimationIndex + 1); }); var parts = avatarRes.awatarParts; for (int i = 0; i < parts.Length; i++) { itemRect = AddCategory(itemRect, i, parts[i].partName); } OnGUIDrag(r); if (Event.current.type == EventType.Repaint) { if (skeleton) { UpdateAnimation(skeleton); Repaint(); } } }