当前位置: 首页>>代码示例>>C#>>正文


C# Data.IsABTest方法代码示例

本文整理汇总了C#中UnityEngine.UI.Windows.Plugins.Flow.Data.IsABTest方法的典型用法代码示例。如果您正苦于以下问题:C# Data.IsABTest方法的具体用法?C# Data.IsABTest怎么用?C# Data.IsABTest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.UI.Windows.Plugins.Flow.Data的用法示例。


在下文中一共展示了Data.IsABTest方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateTransitionMethod

		public static string GenerateTransitionMethod(FlowSystemEditorWindow flowEditor, FD.FlowWindow windowFrom, FD.FlowWindow windowTo) {
			
			var file = Resources.Load("UI.Windows/ABTesting/Templates/TemplateTransitionMethod") as TextAsset;
			if (file == null) {
				
				Debug.LogError("ABTesting Template Loading Error: Could not load template 'TemplateTransitionMethod'");
				
				return string.Empty;
				
			}
			
			var data = FlowSystem.GetData();
			if (data == null) return string.Empty;
			
			if (windowTo.IsABTest() == false) {
				
				return string.Empty;
				
			}

			var result = string.Empty;
			var part = file.text;

			var methodPattern = "(item, h) => WindowSystemFlow.DoFlow<{0}>(this, item, h, null)";
			var methods = string.Empty;
			var methodList = new List<string>();

			foreach (var item in windowTo.abTests.items) {

				var window = FlowSystem.GetWindow(item.attachItem.targetId);
				if (window == null) {
					
					methodList.Add("null");

				} else {
					
					var classNameWithNamespace = Tpl.GetClassNameWithNamespace(window);
					methodList.Add(string.Format(methodPattern, classNameWithNamespace));

				}

			}

			methods = string.Join(", ", methodList.ToArray());

			result +=
				part.Replace("{METHOD_NAMES}", methods)
					.Replace("{FLOW_FROM_ID}", windowFrom.id.ToString())
					.Replace("{FLOW_TO_ID}", windowTo.id.ToString());
			
			return result;
			
		}
开发者ID:MJunak,项目名称:Unity3d.UI.Windows,代码行数:53,代码来源:ABTestingAddon.cs

示例2: DrawTransitionChooser

		public void DrawTransitionChooser(AttachItem attach, FD.FlowWindow fromWindow, FD.FlowWindow toWindow, bool doubleSided) {
			
			if (this.drawWindowContent == false) return;

			if (toWindow.IsEnabled() == false) return;
			if (toWindow.IsContainer() == true) return;

			var factor = 0.5f;
			var transitionsContainer = fromWindow;
			var namePrefix = string.Empty;

			if (fromWindow.IsSmall() == true &&
				fromWindow.IsABTest() == true) {

				// is ABTest
				//Debug.Log(fromWindow.id + " => " + toWindow.id + " :: " + attach.index + " :: " + doubleSided);
				transitionsContainer = FlowSystem.GetWindow(fromWindow.abTests.sourceWindowId);
				if (transitionsContainer == null) return;

				namePrefix = string.Format("Variant{0}", attach.index.ToString());
				factor = 0.2f;

			} else {

				if (toWindow.IsSmall() == true) {

					if (toWindow.IsFunction() == false) return;

				}

			}

			if (FlowSystem.GetData().modeLayer == ModeLayer.Audio) {

				if (FlowSystem.GetData().HasView(FlowView.AudioTransitions) == false) return;

			} else {
				
				if (FlowSystem.GetData().HasView(FlowView.VideoTransitions) == false) return;

			}

			const float size = 32f;
			const float offset = size * 0.5f + 5f;

			Vector2 centerOffset = Flow.OnDrawNodeCurveOffset(this, attach, fromWindow, toWindow, doubleSided);

			if (doubleSided == true) {

				var q = Quaternion.LookRotation(toWindow.rect.center - fromWindow.rect.center, Vector3.back);
				var attachRevert = FlowSystem.GetAttachItem(toWindow.id, fromWindow.id);
				
				this.DrawTransitionChooser(attachRevert, toWindow, toWindow, fromWindow, centerOffset, q * Vector2.left * offset, size, factor, namePrefix);
				this.DrawTransitionChooser(attach, fromWindow, fromWindow, toWindow, centerOffset, q * Vector2.right * offset, size, factor, namePrefix);

			} else {

				this.DrawTransitionChooser(attach, transitionsContainer, fromWindow, toWindow, centerOffset, Vector2.zero, size, factor, namePrefix);

			}

		}
开发者ID:MJunak,项目名称:Unity3d.UI.Windows,代码行数:62,代码来源:EditorWindow.cs

示例3: DrawWindowToolbar

		private void DrawWindowToolbar(FD.FlowWindow window) {

			/*if (FlowSystem.GetData().modeLayer != ModeLayer.Flow) {

				return;

			}*/

			//var edit = false;
			var id = window.id;
			
			var buttonStyle = ME.Utilities.CacheStyle("FlowEditor.DrawWindowToolbar.Styles", "toolbarButton", (name) => {
				
				var _buttonStyle = new GUIStyle(EditorStyles.toolbarButton);
				_buttonStyle.stretchWidth = false;
				
				return _buttonStyle;
				
			});
			
			var buttonDropdownStyle = ME.Utilities.CacheStyle("FlowEditor.DrawWindowToolbar.Styles", "toolbarDropDown", (name) => {
				
				var _buttonStyle = new GUIStyle(EditorStyles.toolbarDropDown);
				_buttonStyle.stretchWidth = false;
				
				return _buttonStyle;
				
			});

			var buttonWarningStyle = ME.Utilities.CacheStyle("FlowEditor.DrawWindowToolbar.Styles", "buttonWarningStyle", (name) => {
				
				var _buttonStyle = new GUIStyle(EditorStyles.toolbarButton);
				_buttonStyle.stretchWidth = false;
				_buttonStyle.fontStyle = FontStyle.Bold;
				
				return _buttonStyle;
				
			});

			GUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.ExpandWidth(true));
			if (this.waitForAttach == false || this.currentAttachComponent == null) {
				
				if (this.waitForAttach == true) {
					
					if (id != this.currentAttachId) {
						
						var currentAttach = FlowSystem.GetWindow(this.currentAttachId);
						if (currentAttach != null) {
							
							//var attachTo = FlowSystem.GetWindow(id);
							//var hasContainer = currentAttach.HasContainer();
							
							if (currentAttach.IsContainer() == false) {
								
								if (FlowSystem.AlreadyAttached(this.currentAttachId, this.currentAttachIndex, id) == true) {
									
									if (GUILayout.Button(string.Format("Detach Here{0}", (Event.current.alt == true ? " (Double Direction)" : string.Empty)), buttonStyle) == true) {
										
										FlowSystem.Detach(this.currentAttachId, this.currentAttachIndex, id, oneWay: Event.current.alt == false);
										if (this.onAttach != null) this.onAttach(id, this.currentAttachIndex, false);
										if (Event.current.shift == false) this.WaitForAttach(-1);
										
									}
									
								} else {

									var abTests = (window.abTests.sourceWindowId >= 0/* || currentAttach.attachItems.Any(x => FlowSystem.GetWindow(x.targetId).IsABTest() == true) == true*/);

									if (this.currentAttachIndex == 0 && 
									    (currentAttach.IsABTest() == true ||
									    abTests == true)) {
										/*
										if (abTests == true) {

											if (GUILayout.Button("Attach Here", buttonStyle) == true) {

												this.ShowNotification(new GUIContent("You can't connect using this method. Use `Attach` function on `A/B Test Condition`"));

											}

										}*/

									} else {

										if (GUILayout.Button(string.Format("Attach Here{0}", (Event.current.alt == true ? " (Double Direction)" : string.Empty)), buttonStyle) == true) {
											
											FlowSystem.Attach(this.currentAttachId, this.currentAttachIndex, id, oneWay: Event.current.alt == false);
											if (this.onAttach != null) this.onAttach(id, this.currentAttachIndex, true);
											if (Event.current.shift == false) this.WaitForAttach(-1);
											
										}

									}

								}
								
							}
							
						}
						
//.........这里部分代码省略.........
开发者ID:MJunak,项目名称:Unity3d.UI.Windows,代码行数:101,代码来源:EditorWindow.cs

示例4: OnFlowWindowTransition

		public override void OnFlowWindowTransition(int index, FD.FlowWindow fromWindow, FD.FlowWindow toWindow, bool doubleSided, Vector2 centerOffset) {
			
			var factor = 0.5f;

			if (fromWindow.IsSmall() == true &&
				fromWindow.IsABTest() == true) {

				factor = 0.2f;

			}

			var point = Vector2.Lerp(fromWindow.rect.center, toWindow.rect.center, factor) + centerOffset;
			var rect = new Rect(point, Vector2.zero);

			if (this.flowEditor.ContainsRect(rect) == false) return;

			if (doubleSided == true) {

				var q = Quaternion.LookRotation(toWindow.rect.center - fromWindow.rect.center, Vector3.back);

				this.DrawBubble(rect, index, fromWindow.id, toWindow.id, q * Vector2.left);

				this.DrawBubble(rect, index, toWindow.id, fromWindow.id, q * Vector2.right);

			} else {

				this.DrawBubble(rect, index, fromWindow.id, toWindow.id, Vector2.zero);

			}

		}
开发者ID:MJunak,项目名称:Unity3d.UI.Windows,代码行数:31,代码来源:HeatmapAddon.cs

示例5: OnFlowWindowGUI

		public override void OnFlowWindowGUI(FD.FlowWindow window) {

			var data = FlowSystem.GetData();
			if (data == null) return;

			var flag = window.IsABTest();
			if (flag == true) {
				
				this.Validate(window);

				var windowSize = window.rect;
				var repaint = false;
				
				var connectorActive = ME.Utilities.CacheStyle("UI.Windows.ABTesting", "flow shader out 2");
				var connectorInactive = ME.Utilities.CacheStyle("UI.Windows.ABTesting", "flow shader out 5");
				var connectorOuterActive = ME.Utilities.CacheStyle("UI.Windows.ABTesting", "flow shader in 2");
				var connectorOuterInactive = ME.Utilities.CacheStyle("UI.Windows.ABTesting", "flow shader in 5");
				var editButtonStyle = ME.Utilities.CacheStyle("UI.Windows.ABTesting.EditButton", "LargeButtonRight", (name) => {
					
					var _style = new GUIStyle(name);
					_style.fixedWidth = 0f;
					_style.stretchWidth = true;
					
					return _style;
					
				});
				var addButtonStyle = ME.Utilities.CacheStyle("UI.Windows.ABTesting.AddButtonStyle", "MiniButton", (name) => {
					
					var _style = new GUIStyle(name);
					_style.fixedWidth = 0f;
					_style.stretchWidth = false;
					
					return _style;
					
				});
				var removeButtonStyle = ME.Utilities.CacheStyle("UI.Windows.ABTesting.RemoveButtonStyle", "LargeButtonLeft", (name) => {
					
					var _style = new GUIStyle(name);
					_style.fixedWidth = 0f;
					_style.stretchWidth = false;
					
					return _style;
					
				});

				var buttonHeight = editButtonStyle.fixedHeight;

				var height = 0f;

				const float topOffset = 5f;
				const float margin = 2f;
				const float marginHorizontalLeft = 2f;
				const float bottomOffset = 2f;

				Color oldColor;
				Color c;

				GUILayout.Space(topOffset);

				System.Action<int, ABTestingItem> onItem = (i, item) => {
					
					var hasAttach = (data.AlreadyAttached(window.id, item.attachItem.index, item.attachItem.targetId) == true);
					var connectorStyle = hasAttach ? connectorActive : connectorInactive;
					var connectorOuterStyle = hasAttach ? connectorOuterActive : connectorOuterInactive;
					
					var size = Mathf.Max(connectorStyle.fixedHeight, buttonHeight);
					var connectorSize = new Vector2(size, size);
					
					GUILayout.BeginHorizontal();
					{
						
						GUILayout.Space(marginHorizontalLeft);

						var canEdit = (i > 0);
						var canRemove = canEdit && (window.abTests.Count() > 2);
						
						oldColor = GUI.color;
						c = (canRemove == true) ? Color.red : Color.grey;
						GUI.color = c;
						EditorGUI.BeginDisabledGroup(!canRemove);
						{
							
							if (GUILayout.Button("X", removeButtonStyle) == true) {
								
								window.abTests.RemoveAt(i);
								EditorUtility.SetDirty(window);
								repaint = true;
								
							}
							
						}
						EditorGUI.EndDisabledGroup();
						GUI.color = oldColor;
						
						EditorGUI.BeginDisabledGroup(!canEdit);
						{
							
							if (GUILayout.Button(canEdit == true ? "Edit Condition" : "On Any Other", editButtonStyle) == true) {
								
								this.flowEditor.SetDisabled();
//.........这里部分代码省略.........
开发者ID:MJunak,项目名称:Unity3d.UI.Windows,代码行数:101,代码来源:ABTestingAddon.cs

示例6: OnFlowDrawNodeCurveOffset

		public override Vector2 OnFlowDrawNodeCurveOffset(UnityEngine.UI.Windows.AttachItem attachItem, FD.FlowWindow window, FD.FlowWindow toWindow, bool doubleSide) {
			
			var offset = Vector2.zero;

			var data = FlowSystem.GetData();
			if (data == null) return offset;

			Vector2 dotOffset = new Vector2(5f, 0f);

			var flag = window.IsABTest();
			if (flag == true) {

				this.Validate(window);

				for (int i = 0; i < window.abTests.Count(); ++i) {

					var abTest = window.abTests.items[i];
					if (abTest.attachItem.targetId == attachItem.targetId && abTest.attachItem.index == attachItem.index) {

						var editorRect = abTest.editorRect;
						var delta = editorRect.center - window.rect.size * 0.5f + dotOffset;

						offset = delta;

					}

				}

			}

			return offset;

		}
开发者ID:MJunak,项目名称:Unity3d.UI.Windows,代码行数:33,代码来源:ABTestingAddon.cs

示例7: IsCompilerTransitionAttachedGeneration

		public override bool IsCompilerTransitionAttachedGeneration(FD.FlowWindow windowFrom, FD.FlowWindow windowTo) {

			return windowTo.IsABTest() == true;

		}
开发者ID:MJunak,项目名称:Unity3d.UI.Windows,代码行数:5,代码来源:ABTestingAddon.cs

示例8: OnCompilerTransitionAttachedGeneration

		public override string OnCompilerTransitionAttachedGeneration(FD.FlowWindow windowFrom, FD.FlowWindow windowTo, bool everyPlatformHasUniqueName) {
			
			if (windowTo.IsABTest() == true && 
			    windowTo.IsSmall() == true) {
				
				return FlowABTestingTemplateGenerator.GenerateTransitionMethod(this.flowEditor, windowFrom, windowTo);
				
			}
			
			return base.OnCompilerTransitionAttachedGeneration(windowFrom, windowTo, everyPlatformHasUniqueName);
			
		}
开发者ID:MJunak,项目名称:Unity3d.UI.Windows,代码行数:12,代码来源:ABTestingAddon.cs


注:本文中的UnityEngine.UI.Windows.Plugins.Flow.Data.IsABTest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。