本文整理汇总了C#中UnityEngine.UI.Windows.Plugins.Flow.FlowWindow.GetAttachItem方法的典型用法代码示例。如果您正苦于以下问题:C# FlowWindow.GetAttachItem方法的具体用法?C# FlowWindow.GetAttachItem怎么用?C# FlowWindow.GetAttachItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.UI.Windows.Plugins.Flow.FlowWindow
的用法示例。
在下文中一共展示了FlowWindow.GetAttachItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateTransition
public static void CreateTransition(FlowWindow flowWindow, FlowWindow toWindow, string localPath, System.Action<TransitionInputTemplateParameters> callback = null) {
if (flowWindow.GetScreen() == null) return;
var screenPath = AssetDatabase.GetAssetPath(flowWindow.GetScreen());
screenPath = System.IO.Path.GetDirectoryName(screenPath);
var splitted = screenPath.Split(new string[] {"/"}, System.StringSplitOptions.RemoveEmptyEntries);
var packagePath = string.Join("/", splitted, 0, splitted.Length - 1);
var path = packagePath + localPath;
FlowChooserFilterWindow.Show<TransitionInputTemplateParameters>(
root: null,
onSelect: (element) => {
// Clean up previous transitions if exists
var attachItem = flowWindow.GetAttachItem(toWindow);
if (attachItem != null) {
if (attachItem.transition != null && attachItem.transitionParameters != null) {
AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(attachItem.transitionParameters.gameObject));
attachItem.transition = null;
attachItem.transitionParameters = null;
}
}
if (System.IO.Directory.Exists(path) == false) {
System.IO.Directory.CreateDirectory(path);
}
if (element == null) return;
var elementPath = AssetDatabase.GetAssetPath(element.gameObject);
var targetName = "Transition-" + element.gameObject.name + "-" + (toWindow.IsFunction() == true ? FlowSystem.GetWindow(toWindow.functionId).directory : toWindow.directory);
var targetPath = path + "/" + targetName + ".prefab";
if (AssetDatabase.CopyAsset(elementPath, targetPath) == true) {
AssetDatabase.ImportAsset(targetPath);
var newInstance = AssetDatabase.LoadAssetAtPath<GameObject>(targetPath);
var instance = newInstance.GetComponent<TransitionInputTemplateParameters>();
instance.useAsTemplate = false;
EditorUtility.SetDirty(instance);
attachItem.transition = instance.transition;
attachItem.transitionParameters = instance;
if (callback != null) callback(instance);
}
},
onEveryGUI: (element) => {
// on gui
var style = new GUIStyle(GUI.skin.label);
style.wordWrap = true;
if (element != null) {
GUILayout.Label(element.name, style);
} else {
GUILayout.Label("None", style);
}
},
predicate: (element) => {
var elementPath = AssetDatabase.GetAssetPath(element.gameObject);
var isInPackage = FlowProjectWindowObject.IsValidPackage(elementPath + "/../");
if (element.transition != null && (isInPackage == true || element.useAsTemplate == true)) {
var name = element.GetType().FullName;
var baseName = name.Substring(0, name.IndexOf("Parameters"));
var type = System.Type.GetType(baseName + ", " + element.GetType().Assembly.FullName, throwOnError: true, ignoreCase: true);
if (type != null) {
var attribute = type.GetCustomAttributes(inherit: true).OfType<TransitionCameraAttribute>().FirstOrDefault();
if (attribute != null) {
return true;
} else {
Debug.Log("No Attribute: " + baseName, element);
}
//.........这里部分代码省略.........