public override void OnGUI(UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) { // Using BeginProperty / EndProperty on the parent property means that // prefab override logic works on the entire property. UnityEditor.EditorGUI.BeginProperty(position, label, property); SetupSerializedProperties(property); // Draw label position = UnityEditor.EditorGUI.PrefixLabel(position, UnityEngine.GUIUtility.GetControlID(UnityEngine.FocusType.Passive), label); /************************************************Update Properties**************************************************/ var componentGuid = new System.Guid[m_guidProperty.Length]; for (var i = 0; i < componentGuid.Length; i++) { var guidBytes = AkUtilities.GetByteArrayProperty(m_guidProperty[i]); componentGuid[i] = guidBytes == null ? System.Guid.Empty : new System.Guid(guidBytes); } var componentName = UpdateIds(componentGuid); /*******************************************************************************************************************/ /********************************************Draw GUI***************************************************************/ var style = new UnityEngine.GUIStyle(UnityEngine.GUI.skin.button); style.alignment = UnityEngine.TextAnchor.MiddleLeft; style.fontStyle = UnityEngine.FontStyle.Normal; if (string.IsNullOrEmpty(componentName)) { SetEmptyComponentName(ref componentName, ref style); } if (UnityEngine.GUI.Button(position, componentName, style)) { m_pressedPosition = position; m_buttonWasPressed = true; // We don't want to set object as dirty only because we clicked the button. // It will be set as dirty if the wwise object has been changed by the tree view. UnityEngine.GUI.changed = false; } var currentEvent = UnityEngine.Event.current; if (currentEvent.type == UnityEngine.EventType.Repaint && m_buttonWasPressed && m_pressedPosition.Equals(position)) { m_serializedObject = property.serializedObject; m_pickerPos = AkUtilities.GetLastRectAbsolute(position); UnityEditor.EditorApplication.delayCall += DelayCreateCall; m_buttonWasPressed = false; } HandleDragAndDrop(currentEvent, position); UnityEditor.EditorGUI.EndProperty(); }
public override float GetPropertyHeight(UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) { var h = 22f + 18f; var list = property.GetSerializedValue <ME.ECS.Collections.DataList <Entity> >(); var world = ME.ECS.Worlds.currentWorld; if (world == null || list.Count == 0) { h += DataListEntityListPropertyEditor.EMPTY_HEIGHT; } else { var i = 0; if (list.IsCreated() == true) { foreach (var item in list.Read()) { var elementLabel = new UnityEngine.GUIContent($"Element {i}"); h += EntityEditor.GetHeight(item, elementLabel); ++i; } } } return(h); }
/// <summary> /// Creates a new Message Item with all the fields filled. /// </summary> /// <param name="call">The callback</param> /// <param name="content">The message</param> /// <param name="cap">The caption</param> /// <param name="btns">The buttons</param> /// <param name="defaultBtn">The default buttons</param> public MessageItem(MessageCallback call, UnityEngine.GUIContent content, string cap, MessageBoxButtons btns, MessageBoxDefaultButton defaultBtn) { message = content; caption = cap; buttons = btns; defaultButton = defaultBtn; }
public override void OnGUI(UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) { UnityEditor.EditorGUI.BeginProperty(position, label, property); if (label != null && !string.IsNullOrEmpty(label.text)) { UnityEditor.EditorGUI.LabelField(position, label); position.x += UnityEditor.EditorGUIUtility.labelWidth; position.width -= UnityEditor.EditorGUIUtility.labelWidth; } var indent = UnityEditor.EditorGUI.indentLevel; UnityEditor.EditorGUI.indentLevel = 0; var value = property.FindPropertyRelative("value"); //Since some callback flags are unsupported, some bits are not used. //But when using EditorGUILayout.MaskField, clicking the third flag will set the third bit to one even if the third flag in the AkCallbackType enum is unsupported. //This is a problem because clicking the third supported flag would internally select the third flag in the AkCallbackType enum which is unsupported. //To solve this problem we use a mask for display and another one for the actual callback var displayMask = GetDisplayMask(value.intValue); displayMask = UnityEditor.EditorGUI.MaskField(position, displayMask, SupportedCallbackFlags); value.intValue = GetWwiseCallbackMask(displayMask); UnityEditor.EditorGUI.indentLevel = indent; UnityEditor.EditorGUI.EndProperty(); }
/// <summary> /// Creates an empty Message Item /// </summary> public MessageItem() { message = new UnityEngine.GUIContent(); caption = ""; buttons = MessageBoxButtons.OK; defaultButton = MessageBoxDefaultButton.Button1; }
public void OnEnable(UnityEditor.SerializedProperty m_Rotation, UnityEngine.GUIContent label) { if (__OnEnable_0_2 == null) { __OnEnable_0_2 = (Action <UnityEditor.SerializedProperty, UnityEngine.GUIContent>)Delegate.CreateDelegate(typeof(Action <UnityEditor.SerializedProperty, UnityEngine.GUIContent>), m_instance, UnityTypes.UnityEditor_TransformRotationGUI.GetMethod("OnEnable", R.InstanceMembers, null, new Type[] { typeof(UnityEditor.SerializedProperty), typeof(UnityEngine.GUIContent) }, null)); } __OnEnable_0_2(m_Rotation, label); }
public UIBox(UnityEngine.Rect rect, UnityEngine.GUIContent content, UnityEngine.GUIStyle style, UnityEngine.Color color, int depth) { _rect = rect; _content = content; _style = style; _color = color; _depth = depth; }
// Functionally like UnityEngine.GuiLayout.Toggle, but as a button rather than // a checkbox. private bool ToggleButton(bool value, UnityEngine.GUIContent content, params UnityEngine.GUILayoutOption[] options) { return(UnityEngine.GUILayout.Button( content, value ? Style.LitToggleButton() : Style.DarkToggleButton(), options) ? !value : value); }
static StackObject *Ctor_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *__ret = ILIntepreter.Minus(__esp, 0); var result_of_this_method = new UnityEngine.GUIContent(); return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
protected UnityEngine.GUISkin MakeSkin(UnityEngine.GUISkin template) { UnityEngine.GUISkin skin = UnityEngine.Object.Instantiate(template); // Creating a dynamic font as is done below results in Unity producing // incorrect character bounds and everything looks ugly. They even // "document" it in their source code, see // https://github.com/Unity-Technologies/UnityCsReference/blob/57f723ec72ca50427e5d17cad0ec123be2372f67/Modules/GraphViewEditor/Views/GraphView.cs#L262. // So here I am, sizing a pangram to get an idea of the shape of things and // nudging pixels by hand. It's the 90's, go for it! var pangram = new UnityEngine.GUIContent( "Portez ce vieux whisky au juge blond qui fume."); float button_height = skin.button.CalcHeight(pangram, width: 1000); float horizontal_slider_height = skin.horizontalSlider.CalcHeight(pangram, width: 1000); float horizontal_slider_thumb_height = skin.horizontalSliderThumb.CalcHeight(pangram, width: 1000); float label_height = skin.label.CalcHeight(pangram, width: 1000); float text_area_height = skin.textArea.CalcHeight(pangram, width: 1000); float text_field_height = skin.textField.CalcHeight(pangram, width: 1000); float toggle_height = skin.toggle.CalcHeight(pangram, width: 1000); skin.font = UnityEngine.Font.CreateDynamicFontFromOSFont( skin.font.fontNames, (int)(skin.font.fontSize * scale_)); skin.button.alignment = UnityEngine.TextAnchor.MiddleCenter; skin.button.contentOffset = new UnityEngine.Vector2(0, -button_height * scale_ / 10); skin.button.fixedHeight = button_height * scale_; skin.horizontalSlider.fixedHeight = 21 * scale_; skin.horizontalSliderThumb.fixedHeight = 21 * scale_; skin.horizontalSliderThumb.fixedWidth = 12 * scale_; skin.label.alignment = UnityEngine.TextAnchor.MiddleLeft; skin.label.contentOffset = new UnityEngine.Vector2(0, -label_height * scale_ / 20); skin.label.fixedHeight = label_height * scale_; skin.textArea.alignment = UnityEngine.TextAnchor.MiddleLeft; skin.textArea.contentOffset = new UnityEngine.Vector2(0, -text_area_height * scale_ / 20); skin.textArea.fixedHeight = text_area_height * scale_; skin.textField.alignment = UnityEngine.TextAnchor.MiddleLeft; skin.textField.contentOffset = new UnityEngine.Vector2(0, -text_area_height * scale_ / 20); skin.textField.fixedHeight = text_field_height * scale_; skin.toggle.fixedHeight = toggle_height * scale_; skin.toggle.contentOffset = new UnityEngine.Vector2(0, -toggle_height * (scale_ - 1) / 3); skin.toggle.alignment = UnityEngine.TextAnchor.UpperLeft; skin.toggle.margin = new UnityEngine.RectOffset( (int)(skin.toggle.margin.left * scale_), skin.toggle.margin.right, (int)(skin.toggle.margin.top * 1.7 * scale_), skin.toggle.margin.bottom); return(skin); }
public virtual void OnPropertyDrawer(UnityEditor.SerializedProperty prop) { if (editorContent == null || string.IsNullOrEmpty(editorContent.text)) { var name = UnityEditor.ObjectNames.NicifyVariableName(FieldName); editorContent = new UnityEngine.GUIContent(name); } UnityEditor.EditorGUILayout.PropertyField(prop, editorContent); }
public GUIContent(UnityEngine.GUIContent src) { //Mock Data: m_functionCallCounts = new Dictionary <string, int>(); if (!m_functionCallCounts.ContainsKey("Void .ctor(GUIContent)")) { m_functionCallCounts.Add("Void .ctor(GUIContent)", 0); } m_functionCallCounts["Void .ctor(GUIContent)"]++; }
public override void OnPropertyDrawer(UnityEditor.SerializedProperty prop) { if (editorContent == null || string.IsNullOrEmpty(editorContent.text)) { var name = UnityEditor.ObjectNames.NicifyVariableName(FieldName); editorContent = new UnityEngine.GUIContent(name); } editorContent.tooltip = AssetType == null ? string.Empty : AssetType.FullName; UnityEditor.EditorGUILayout.PropertyField(prop, editorContent); }
public override float GetPropertyHeight(SerializedProperty property, UnityEngine.GUIContent label) { var link = property.FindPropertyRelative("link"); var h = EditorGUI.GetPropertyHeight(link); if (link.objectReferenceValue is Blueprint blueprint && blueprint != null && blueprint.outputItem.box is OutputVariable outputVariable && outputVariable != null) { h += h; } return(h); }
static int _s_set_tooltip(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); try { UnityEngine.GUIContent __cl_gen_to_be_invoked = (UnityEngine.GUIContent)translator.FastGetCSObj(L, 1); __cl_gen_to_be_invoked.tooltip = LuaAPI.lua_tostring(L, 2); } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } return(0); }
static int _s_set_image(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); try { UnityEngine.GUIContent __cl_gen_to_be_invoked = (UnityEngine.GUIContent)translator.FastGetCSObj(L, 1); __cl_gen_to_be_invoked.image = (UnityEngine.Texture)translator.GetObject(L, 2, typeof(UnityEngine.Texture)); } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } return(0); }
public void Draw(UnityEngine.Rect position, UnityEngine.GUIContent content, System.Int32 controlID, System.Boolean on) { //Mock Data: if (m_functionCallCounts == null) { m_functionCallCounts = new Dictionary <string, int>(); } if (!m_functionCallCounts.ContainsKey("Void Draw(Rect, UnityEngine.GUIContent, Int32, Boolean)")) { m_functionCallCounts.Add("Void Draw(Rect, UnityEngine.GUIContent, Int32, Boolean)", 0); } m_functionCallCounts["Void Draw(Rect, UnityEngine.GUIContent, Int32, Boolean)"]++; }
public void Draw(UnityEngine.Rect position, UnityEngine.GUIContent content, System.Boolean isHover, System.Boolean isActive, System.Boolean on, System.Boolean hasKeyboardFocus) { //Mock Data: if (m_functionCallCounts == null) { m_functionCallCounts = new Dictionary <string, int>(); } if (!m_functionCallCounts.ContainsKey("Void Draw(Rect, UnityEngine.GUIContent, Boolean, Boolean, Boolean, Boolean)")) { m_functionCallCounts.Add("Void Draw(Rect, UnityEngine.GUIContent, Boolean, Boolean, Boolean, Boolean)", 0); } m_functionCallCounts["Void Draw(Rect, UnityEngine.GUIContent, Boolean, Boolean, Boolean, Boolean)"]++; }
public void DrawWithTextSelection(UnityEngine.Rect position, UnityEngine.GUIContent content, System.Int32 controlID, System.Int32 firstSelectedCharacter, System.Int32 lastSelectedCharacter) { //Mock Data: if (m_functionCallCounts == null) { m_functionCallCounts = new Dictionary <string, int>(); } if (!m_functionCallCounts.ContainsKey("Void DrawWithTextSelection(Rect, UnityEngine.GUIContent, Int32, Int32, Int32)")) { m_functionCallCounts.Add("Void DrawWithTextSelection(Rect, UnityEngine.GUIContent, Int32, Int32, Int32)", 0); } m_functionCallCounts["Void DrawWithTextSelection(Rect, UnityEngine.GUIContent, Int32, Int32, Int32)"]++; }
static StackObject *Ctor_7(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.GUIContent src = (UnityEngine.GUIContent) typeof(UnityEngine.GUIContent).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = new UnityEngine.GUIContent(src); return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
public override void OnGUI(UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) { // Using BeginProperty / EndProperty on the parent property means that // prefab override logic works on the entire property. UnityEditor.EditorGUI.BeginProperty(position, label, property); SetupSerializedProperties(property); // Draw label position = UnityEditor.EditorGUI.PrefixLabel(position, UnityEngine.GUIUtility.GetControlID(UnityEngine.FocusType.Passive), label); var componentGuid = new System.Guid[m_guidProperty.Length]; for (var i = 0; i < componentGuid.Length; i++) { var guidBytes = AkUtilities.GetByteArrayProperty(m_guidProperty[i]); componentGuid[i] = guidBytes == null ? System.Guid.Empty : new System.Guid(guidBytes); } var componentName = UpdateIds(componentGuid); var style = new UnityEngine.GUIStyle(UnityEngine.GUI.skin.button); style.alignment = UnityEngine.TextAnchor.MiddleLeft; style.fontStyle = UnityEngine.FontStyle.Normal; if (string.IsNullOrEmpty(componentName)) { SetEmptyComponentName(ref componentName, ref style); } if (UnityEngine.GUI.Button(position, componentName, style)) { new AkWwiseComponentPicker.PickerCreator { objectType = m_objectType, guidProperty = m_guidProperty, idProperty = m_IDProperty, pickerPosition = AkUtilities.GetLastRectAbsolute(position), serializedObject = property.serializedObject }; AkWwiseComponentPicker.LastFocusedWindow = UnityEditor.EditorWindow.focusedWindow; } HandleDragAndDrop(position); UnityEditor.EditorGUI.EndProperty(); }
public override float GetPropertyHeight(UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) { var height = (UnityEditor.EditorGUIUtility.singleLineHeight + UnityEditor.EditorGUIUtility.standardVerticalSpacing) * 2; var listenerListProperty = property.FindPropertyRelative("initialListenerList"); if (listenerListProperty != null && listenerListProperty.isArray) { height += (UnityEditor.EditorGUIUtility.singleLineHeight + UnityEditor.EditorGUIUtility.standardVerticalSpacing) * listenerListProperty.arraySize + UnityEditor.EditorGUIUtility.standardVerticalSpacing; } return(height); }
public override float GetPropertyHeight(UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) { var height = deltaHeight; var callbackData = (AkEventCallbackData)property.objectReferenceValue; if (callbackData != null) { height += (callbackDeltaHeight + callbackSpacerHeight) * callbackData.callbackGameObj.Count; height += deltaHeight * 2 + spacerHeight * 3; } return(height); }
public override void OnPropertyDrawer(UnityEditor.SerializedProperty prop) { if (editorContent == null || string.IsNullOrEmpty(editorContent.text)) { var name = UnityEditor.ObjectNames.NicifyVariableName(FieldName); editorContent = new UnityEngine.GUIContent(name); } if (reList == null) { Type type; if (FieldType.StartsWith("CS.")) { var typeName = FieldType.Substring(3); type = String2TypeCache.GetType(typeName); } else { type = typeof(LuaBinding); } reList = new UnityEditorInternal.ReorderableList(prop.serializedObject, prop) { elementHeight = UnityEditor.EditorGUIUtility.singleLineHeight }; reList.drawHeaderCallback += rect => { UnityEditor.EditorGUI.LabelField(rect, FieldName); }; reList.drawElementCallback += (rect, index, active, focused) => { var elemProp = reList.serializedProperty.GetArrayElementAtIndex(index); UnityEditor.EditorGUI.BeginChangeCheck(); UnityEditor.EditorGUI.ObjectField(rect, elemProp, type, editorContent); if (UnityEditor.EditorGUI.EndChangeCheck()) { var path = UnityEditor.AssetDatabase.GetAssetPath(elemProp.objectReferenceValue); if (string.IsNullOrEmpty(path)) { return; } UnityEditor.EditorUtility.DisplayDialog("ERROR", $"{FieldName} should use AssetReference to a non scene object!", "OK"); elemProp.objectReferenceValue = null; } }; } reList.serializedProperty = prop; reList.DoLayoutList(); }
public UnityEngine.Vector2 CalcSize(UnityEngine.GUIContent content) { //Mock Data: if (m_functionCallCounts == null) { m_functionCallCounts = new Dictionary <string, int>(); } if (!m_functionCallCounts.ContainsKey("Vector2 CalcSize(UnityEngine.GUIContent)")) { m_functionCallCounts.Add("Vector2 CalcSize(UnityEngine.GUIContent)", 0); } m_functionCallCounts["Vector2 CalcSize(UnityEngine.GUIContent)"]++; throw new NotImplementedException("This function was automatically generated by Mockery and has no real implementation yet."); }
public System.Single CalcHeight(UnityEngine.GUIContent content, System.Single width) { //Mock Data: if (m_functionCallCounts == null) { m_functionCallCounts = new Dictionary <string, int>(); } if (!m_functionCallCounts.ContainsKey("Single CalcHeight(UnityEngine.GUIContent, Single)")) { m_functionCallCounts.Add("Single CalcHeight(UnityEngine.GUIContent, Single)", 0); } m_functionCallCounts["Single CalcHeight(UnityEngine.GUIContent, Single)"]++; throw new NotImplementedException("This function was automatically generated by Mockery and has no real implementation yet."); }
public System.Int32 GetCursorStringIndex(UnityEngine.Rect position, UnityEngine.GUIContent content, UnityEngine.Vector2 cursorPixelPosition) { //Mock Data: if (m_functionCallCounts == null) { m_functionCallCounts = new Dictionary <string, int>(); } if (!m_functionCallCounts.ContainsKey("Int32 GetCursorStringIndex(Rect, UnityEngine.GUIContent, Vector2)")) { m_functionCallCounts.Add("Int32 GetCursorStringIndex(Rect, UnityEngine.GUIContent, Vector2)", 0); } m_functionCallCounts["Int32 GetCursorStringIndex(Rect, UnityEngine.GUIContent, Vector2)"]++; throw new NotImplementedException("This function was automatically generated by Mockery and has no real implementation yet."); }
public override float GetPropertyHeight(SerializedProperty property, UnityEngine.GUIContent label) { var h = 0f; h += this.DrawTooltipTipHeight(TOOLTIP_DESPAWN); h += this.DrawTooltipTipHeight(TOOLTIP_CUSTOM_VIEW_ID); h += this.DrawTooltipTipHeight(TOOLTIP_CACHE); h += this.DrawTooltipTipHeight(TOOLTIP_CACHE_TIMEOUT); if (property.isExpanded == true) { return(EditorGUI.GetPropertyHeight(property, true) + h); } return(EditorGUI.GetPropertyHeight(property, true)); }
public void CalcMinMaxWidth(UnityEngine.GUIContent content, out System.Single minWidth, out System.Single maxWidth) { //Mock Data: if (m_functionCallCounts == null) { m_functionCallCounts = new Dictionary <string, int>(); } if (!m_functionCallCounts.ContainsKey("Void CalcMinMaxWidth(UnityEngine.GUIContent, Single ByRef, Single ByRef)")) { m_functionCallCounts.Add("Void CalcMinMaxWidth(UnityEngine.GUIContent, Single ByRef, Single ByRef)", 0); } m_functionCallCounts["Void CalcMinMaxWidth(UnityEngine.GUIContent, Single ByRef, Single ByRef)"]++; minWidth = default(System.Single); maxWidth = default(System.Single); }
static StackObject *Ctor_5(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.String tooltip = (System.String) typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); UnityEngine.Texture image = (UnityEngine.Texture) typeof(UnityEngine.Texture).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = new UnityEngine.GUIContent(image, tooltip); return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }