本文整理汇总了C#中UnityEngine.UI.Windows.Plugins.Flow.Data.GetScreen方法的典型用法代码示例。如果您正苦于以下问题:C# Data.GetScreen方法的具体用法?C# Data.GetScreen怎么用?C# Data.GetScreen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.UI.Windows.Plugins.Flow.Data
的用法示例。
在下文中一共展示了Data.GetScreen方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateOnScene
private void CreateOnScene(FD.FlowWindow window) {
if (window.compiled == false) {
this.ShowNotification(new GUIContent("You need to compile this window to use `Create on Scene` command"));
} else {
var screen = window.GetScreen();
if (screen != null) {
screen.CreateOnScene(callEvents: false);
}
}
}
示例2: DrawWindowLayout
public void DrawWindowLayout(FD.FlowWindow window) {
var flowWindowWithLayout = FlowSystem.GetData().HasView(FlowView.Layout);
if (flowWindowWithLayout == true) {
GUILayout.Box(string.Empty, FlowSystemEditorWindow.styles.layoutBoxStyle, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
var rect = GUILayoutUtility.GetLastRect();
if (window.OnPreviewGUI(rect,
FlowSystemEditorWindow.defaultSkin.button,
FlowSystemEditorWindow.styles.layoutBoxStyle,
drawInfo: true,
selectable: true,
onCreateScreen: () => {
this.SelectWindow(window);
FlowChooserFilter.CreateScreen(Selection.activeObject, window.compiledNamespace, "/Screens", () => {
this.SelectWindow(window);
});
}, onCreateLayout: () => {
this.SelectWindow(window);
Selection.activeObject = window.GetScreen();
FlowChooserFilter.CreateLayout(Selection.activeObject, Selection.activeGameObject, () => {
this.SelectWindow(window);
});
}) == true) {
// Set for waiting connection
var element = WindowLayoutElement.waitForComponentConnectionElementTemp;
this.WaitForAttach(window.id, element);
WindowLayoutElement.waitForComponentConnectionTemp = false;
}
UnityEditor.UI.Windows.Plugins.Flow.Flow.OnDrawWindowLayoutGUI(rect, window);
}
}
示例3: DrawWindowToolbar
//.........这里部分代码省略.........
} else {
// Was not as default
FlowSystem.GetDefaultWindows().Add(id);
}
FlowSystem.SetDirty();
}
}
GUILayout.FlexibleSpace();
if (window.IsSmall() == false && FlowSceneView.IsActive() == false && window.storeType == FD.FlowWindow.StoreType.NewScreen) {
var state = GUILayout.Button("Screen", buttonDropdownStyle);
if (Event.current.type == EventType.Repaint) {
this.layoutStateSelectButtonRect = GUILayoutUtility.GetLastRect();
}
if (state == true) {
var menu = new GenericMenu();
menu.AddItem(new GUIContent("Select Package"), on: false, func: () => { this.SelectWindow(window); });
if (window.compiled == true) {
menu.AddItem(new GUIContent("Edit..."), on: false, func: () => {
var path = Path.GetDirectoryName(AssetDatabase.GetAssetPath(window.GetScreen()));
var filename = window.compiledDerivedClassName + ".cs";
EditorUtility.OpenWithDefaultApp(string.Format("{0}/../{1}", path, filename));
});
}
menu.AddItem(new GUIContent("Create on Scene"), on: false, func: () => { this.CreateOnScene(window); });
var screen = window.GetScreen();
var methodsCount = 0;
WindowSystem.CollectCallVariations(screen, (types, names) => {
++methodsCount;
});
menu.AddDisabledItem(new GUIContent("Calls/Methods: " + methodsCount.ToString()));
menu.AddSeparator("Calls/");
if (window.compiled == true &&
screen != null) {
methodsCount = 0;
WindowSystem.CollectCallVariations(screen, (types, names) => {
var parameters = new List<string>();
for (int i = 0; i < types.Length; ++i) {
parameters.Add(ME.Utilities.FormatParameter(types[i]) + " " + names[i]);
示例4: OnFlowWindowGUI
public override void OnFlowWindowGUI(FD.FlowWindow window) {
var data = FlowSystem.GetData();
if (data == null) return;
if (data.modeLayer == ModeLayer.Audio) {
if (window.IsContainer() == true ||
window.IsSmall() == true ||
window.IsShowDefault() == true)
return;
var screen = window.GetScreen();
if (screen != null) {
GUILayout.BeginHorizontal();
{
var playType = (int)screen.audio.playType;
playType = GUILayoutExt.Popup(playType, new string[2] { "Keep Current", "Restart If Equals" }, FlowSystemEditorWindow.defaultSkin.label, GUILayout.Width(EditorGUIUtility.labelWidth));
screen.audio.playType = (UnityEngine.UI.Windows.Audio.Window.PlayType)playType;
var rect = GUILayoutUtility.GetLastRect();
/*var newId = */AudioPopupEditor.Draw(new Rect(rect.x + rect.width, rect.y, window.rect.width - EditorGUIUtility.labelWidth - 10f, rect.height), screen.audio.id, (result) => {
screen.audio.id = result;
window.audioEditor = null;
}, screen.audio.clipType, screen.audio.flowData.audio, null);
/*if (newId != screen.audio.id) {
screen.audio.id = newId;
window.audioEditor = null;
}*/
}
GUILayout.EndHorizontal();
var state = data.audio.GetState(screen.audio.clipType, screen.audio.id);
if (state != null && state.clip != null) {
GUILayout.BeginVertical();
{
GUILayout.Box(string.Empty, FlowSystemEditorWindow.styles.layoutBoxStyle, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
var rect = GUILayoutUtility.GetLastRect();
if (Event.current.type == EventType.MouseDown && rect.Contains(Event.current.mousePosition) == true) {
window.audioEditor = null;
}
if (window.audioEditor == null) {
EditorPrefs.SetBool("AutoPlayAudio", false);
window.audioEditor = Editor.CreateEditor(state.clip);
//System.Type.GetType("AudioUtil").InvokeMember("StopClip", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public, null, null, new object[] { state.clip });
}
if (Event.current.type != EventType.MouseDrag && Event.current.type != EventType.DragPerform) {
window.audioEditor.OnPreviewGUI(rect, EditorStyles.helpBox);
GUILayout.BeginHorizontal();
window.audioEditor.OnPreviewSettings();
GUILayout.EndHorizontal();
}
}
GUILayout.EndVertical();
}
}
}
}
示例5: DrawTransitionChooser
public void DrawTransitionChooser(FD.FlowWindow.AttachItem attach, FD.FlowWindow fromWindow, FD.FlowWindow toWindow, Vector2 offset, float size) {
var _size = Vector2.one * size;
var rect = new Rect(Vector2.Lerp(fromWindow.rect.center, toWindow.rect.center, 0.5f) + offset - _size * 0.5f, _size);
var transitionStyle = ME.Utilities.CacheStyle("UI.Windows.Styles.DefaultSkin", "TransitionIcon", (name) => FlowSystemEditorWindow.defaultSkin.FindStyle("TransitionIcon"));
var transitionStyleBorder = ME.Utilities.CacheStyle("UI.Windows.Styles.DefaultSkin", "TransitionIconBorder", (name) => FlowSystemEditorWindow.defaultSkin.FindStyle("TransitionIconBorder"));
if (transitionStyle != null && transitionStyleBorder != null) {
if (fromWindow.GetScreen() != null) {
System.Action onClick = () => {
FlowChooserFilter.CreateTransition(fromWindow, toWindow, "/Transitions", (element) => {
FlowSystem.Save();
});
};
// Has transition or not?
var hasTransition = attach.transition != null && attach.transitionParameters != null;
if (hasTransition == true) {
GUI.DrawTexture(rect, Texture2D.blackTexture, ScaleMode.ScaleAndCrop, false);
var hovered = rect.Contains(Event.current.mousePosition);
if (attach.editor == null) {
attach.editor = Editor.CreateEditor(attach.transitionParameters) as IPreviewEditor;
hovered = true;
}
if (attach.editor.HasPreviewGUI() == true) {
if (hovered == false) {
attach.editor.OnDisable();
} else {
attach.editor.OnEnable();
}
var style = new GUIStyle(EditorStyles.toolbarButton);
attach.editor.OnPreviewGUI(Color.white, rect, style, false, false, hovered);
}
if (GUI.Button(rect, string.Empty, transitionStyleBorder) == true) {
onClick();
}
} else {
GUI.Box(rect, string.Empty, transitionStyle);
if (GUI.Button(rect, string.Empty, transitionStyleBorder) == true) {
onClick();
}
}
}
}
}
示例6: CreateTransition
public static void CreateTransition(FD.FlowWindow flowWindow, FD.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);
}
//.........这里部分代码省略.........