浏览代码

Icons + Base work on Find and Replace

/main
Thomas ICHÉ 5 年前
当前提交
e6a2c590
共有 7 个文件被更改,包括 286 次插入1 次删除
  1. 2
      Runtime/StateMachine/StateMachine.cs.meta
  2. 8
      Editor/FindAndReplace.meta
  3. 3
      Icons/ic-StateMachine.png
  4. 110
      Icons/ic-StateMachine.png.meta
  5. 153
      Editor/FindAndReplace/FindAndReplaceWindow.cs
  6. 11
      Editor/FindAndReplace/FindAndReplaceWindow.cs.meta

2
Runtime/StateMachine/StateMachine.cs.meta


serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
icon: {fileID: 2800000, guid: 67330c23d0e574745a580a19a9fa187c, type: 3}
userData:
assetBundleName:
assetBundleVariant:

8
Editor/FindAndReplace.meta


fileFormatVersion: 2
guid: 869fd8f9cbfa0cd468609db02f580990
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

3
Icons/ic-StateMachine.png

之前 之后
宽度: 32  |  高度: 32  |  大小: 247 B

110
Icons/ic-StateMachine.png.meta


fileFormatVersion: 2
guid: 67330c23d0e574745a580a19a9fa187c
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

153
Editor/FindAndReplace/FindAndReplaceWindow.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditor.IMGUI.Controls;
namespace GameplayIngredients.Editor
{
public class FindAndReplaceWindow : EditorWindow
{
[MenuItem("Edit/Find And Replace... %&#F", priority = 144)]
static void OpenWindow()
{
GetWindow<FindAndReplaceWindow>();
}
public enum SearchBy
{
Name,
ComponentType,
Tag,
Layer,
Mesh,
Material,
}
private void OnEnable()
{
titleContent = Contents.title;
}
private void OnGUI()
{
using (new GUILayout.HorizontalScope())
{
using (new GUILayout.VerticalScope(GUILayout.Width(320)))
{
SearchControlsGUI();
}
using (new GUILayout.VerticalScope(GUILayout.Width(4)))
{
GUILayout.FlexibleSpace();
Rect r = GUILayoutUtility.GetLastRect();
EditorGUI.DrawRect(r, Color.black);
}
using (new GUILayout.VerticalScope())
{
SearchResultsGUI();
}
}
}
[SerializeField]
GameObject prefabReplacement;
[SerializeField]
SearchBy searchBy;
[SerializeField]
string nameSearch = "GameObject";
[SerializeField]
string tagSearch = "Player";
[SerializeField]
string layerSearch = "PostProcessing";
[SerializeField]
string componentSearch = "Light";
[SerializeField]
Mesh meshSearch;
[SerializeField]
Material materialSearch;
void SearchControlsGUI()
{
EditorGUIUtility.labelWidth = 120;
GUILayout.Space(8);
GUILayout.Label("Search and Filter", EditorStyles.boldLabel);
searchBy = (SearchBy)EditorGUILayout.EnumPopup(Contents.searchBy, searchBy);
switch(searchBy)
{
case SearchBy.Name:
nameSearch = EditorGUILayout.TextField(Contents.nameSearch, nameSearch);
break;
case SearchBy.Tag:
tagSearch = EditorGUILayout.TextField(Contents.tagSearch, tagSearch);
break;
case SearchBy.Layer:
layerSearch = EditorGUILayout.TextField(Contents.layerSearch, layerSearch);
break;
case SearchBy.ComponentType:
componentSearch = EditorGUILayout.TextField(Contents.componentSearch, componentSearch);
break;
case SearchBy.Mesh:
meshSearch = (Mesh)EditorGUILayout.ObjectField(Contents.meshSearch, meshSearch, typeof(Mesh), true);
break;
case SearchBy.Material:
materialSearch = (Material)EditorGUILayout.ObjectField(Contents.materialSearch, materialSearch, typeof(Material), true);
break;
}
using (new GUILayout.HorizontalScope())
{
GUILayout.Button("Find",GUILayout.Height(32));
GUILayout.Button("Refine",GUILayout.Height(32));
}
GUILayout.FlexibleSpace();
GUILayout.Label("Replace By", EditorStyles.boldLabel);
prefabReplacement = (GameObject)EditorGUILayout.ObjectField(Contents.prefabReplacement, prefabReplacement, typeof(GameObject), true);
GUILayout.Button("Replace All", GUILayout.Height(32));
GUILayout.Space(8);
}
[SerializeField]
List<GameObject> searchResults= new List<GameObject>();
Vector2 scroll;
void SearchResultsGUI()
{
GUILayout.Space(8);
GUILayout.Label("Search Results", EditorStyles.boldLabel);
using (new GUILayout.ScrollViewScope(scroll, EditorStyles.helpBox))
{
foreach(var obj in searchResults)
{
using (new GUILayout.HorizontalScope(EditorStyles.helpBox))
{
GUILayout.Label(obj.name);
GUILayout.Button("X", GUILayout.Width(32));
}
}
}
}
static class Contents
{
public static GUIContent title = new GUIContent("Find and Replace", (Texture)EditorGUIUtility.LoadRequired("ViewToolZoom On"));
public static GUIContent searchBy = new GUIContent("Search by");
public static GUIContent nameSearch = new GUIContent("GameObject Name");
public static GUIContent tagSearch = new GUIContent("Tag");
public static GUIContent layerSearch = new GUIContent("Layer");
public static GUIContent componentSearch = new GUIContent("Component Type");
public static GUIContent meshSearch = new GUIContent("Mesh");
public static GUIContent materialSearch = new GUIContent("Material");
public static GUIContent prefabReplacement = new GUIContent("Prefab Replacement");
}
}
}

11
Editor/FindAndReplace/FindAndReplaceWindow.cs.meta


fileFormatVersion: 2
guid: 2ee173722a41c4c4c8388b7206e59a83
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存