public static bool AreParametersValid(ParameterInfo[] parameters) { if (parameters.Length == 0) { return(true); } if (parameters.Length > 1) { Debug.Warn( $"method {parameters[0].Member.Name} has InspectorCallableAttribute but it has more than 1 parameter"); return(false); } var paramType = parameters[0].ParameterType; if (paramType == typeof(int) || paramType == typeof(float) || paramType == typeof(string) || paramType == typeof(bool)) { return(true); } Debug.Warn( $"method {parameters[0].Member.Name} has InspectorCallableAttribute but it has an invalid paraemter type {paramType}"); return(false); }
public static string GetContents() { Debug.Warn("Clipboard implementation has been removed due to fatal errors."); // Currently broken /* * if (_instance == null) * _instance = new Clipboard(); * return _instance.GetContents(); */ return(""); }
internal void Begin() { if (_renderers.Length == 0) { AddRenderer(new DefaultRenderer()); Debug.Warn("Scene has begun with no renderer. A DefaultRenderer was added automatically so that something is visible."); } Physics.Reset(); // prep our render textures UpdateResolutionScaler(); GraphicsDeviceExt.SetRenderTarget(Core.GraphicsDevice, _sceneRenderTarget); if (EntityProcessors != null) { EntityProcessors.Begin(); } Core.Emitter.AddObserver(CoreEvents.GraphicsDeviceReset, OnGraphicsDeviceReset); _didSceneBegin = true; OnStart(); }
/// <summary> /// gets an Inspector subclass that can handle valueType. If no default Inspector is available the memberInfo custom attributes /// will be checked for the CustomInspectorAttribute. /// </summary> /// <returns>The inspector for type.</returns> /// <param name="valueType">Value type.</param> /// <param name="memberInfo">Member info.</param> protected static Inspector GetInspectorForType(Type valueType, object target, MemberInfo memberInfo) { // built-in types if (valueType == typeof(int)) { return(new IntInspector()); } if (valueType == typeof(float)) { return(new FloatInspector()); } if (valueType == typeof(bool)) { return(new BoolInspector()); } if (valueType == typeof(string)) { return(new StringInspector()); } if (valueType == typeof(Vector2)) { return(new Vector2Inspector()); } if (valueType == typeof(Color)) { return(new ColorInspector()); } if (valueType.GetTypeInfo().IsEnum) { return(new EnumInspector()); } if (valueType.GetTypeInfo().IsValueType) { return(new StructInspector()); } // check for custom inspectors before checking Nez types in case a subclass implemented one var customInspectorType = CustomAttributeExtensions.GetCustomAttribute <CustomInspectorAttribute>(valueType.GetTypeInfo()); if (customInspectorType != null) { if (customInspectorType.InspectorType.GetTypeInfo().IsSubclassOf(typeof(Inspector))) { return((Inspector)Activator.CreateInstance(customInspectorType.InspectorType)); } Debug.Warn( $"found CustomInspector {customInspectorType.InspectorType} but it is not a subclass of Inspector"); } // Nez types if (valueType == typeof(Material)) { return(GetMaterialInspector(target)); } if (valueType.GetTypeInfo().IsSubclassOf(typeof(Effect))) { return(GetEffectInspector(target, memberInfo)); } //Debug.log( $"no inspector for type {valueType}" ); return(null); }