Initial Commit (broken due to version update)

This commit is contained in:
Reinier Vens 2020-09-25 07:12:38 +01:00
commit 3f7b3b7440
3132 changed files with 1103305 additions and 0 deletions

View file

@ -0,0 +1,49 @@
using UnityEngine;
using System.IO;
namespace NaughtyAttributes.Editor
{
public static class IOUtility
{
public static string GetPersistentDataPath()
{
return Application.persistentDataPath + "/";
}
public static void WriteToFile(string filePath, string content)
{
using (FileStream fileStream = new FileStream(filePath, FileMode.Create, FileAccess.Write))
{
using (StreamWriter streamWriter = new StreamWriter(fileStream, System.Text.Encoding.ASCII))
{
streamWriter.WriteLine(content);
}
}
}
public static string ReadFromFile(string filePath)
{
using (FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
using (StreamReader streamReader = new StreamReader(fileStream, System.Text.Encoding.ASCII))
{
string content = streamReader.ReadToEnd();
return content;
}
}
}
public static bool FileExists(string filePath)
{
return File.Exists(filePath);
}
public static string GetPathRelativeToProjectFolder(string fullPath)
{
int indexOfAssetsWord = fullPath.IndexOf("\\Assets");
string relativePath = fullPath.Substring(indexOfAssetsWord + 1);
return relativePath;
}
}
}

View file

@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: bf376371b2951274e823154c03f066e2
timeCreated: 1508232215
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,22 @@
using UnityEditor;
using System;
using System.Reflection;
namespace NaughtyAttributes.Editor
{
public static class PropertyUtility
{
public static T[] GetAttributes<T>(SerializedProperty property) where T : NaughtyAttribute
{
Type targetType = GetTargetObject(property).GetType();
FieldInfo fieldInfo = targetType.GetField(property.name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
return (T[])fieldInfo.GetCustomAttributes(typeof(T), true);
}
public static UnityEngine.Object GetTargetObject(SerializedProperty property)
{
return property.serializedObject.targetObject;
}
}
}

View file

@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: e2d50a3c7c8a9754cb3936216494be66
timeCreated: 1508153828
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: