public WindowItem GetScreen(bool runtime = false) { #if UNITY_EDITOR var screens = runtime == true ? this.runtimeScreens : ((this.screens != null) ? this.screens.ToList() : null); #else var screens = this.runtimeScreens; #endif var emptyResult = this.emptyResult; if (runtime == true) { emptyResult = null; } if (this.storeType == StoreType.ReUseScreen) { var win = FlowSystem.GetWindow(this.screenWindowId); if (win == null) { return(emptyResult); } return(win.GetScreen(runtime)); } if (this.IsFunction() == true) { var func = FlowSystem.GetWindow(this.GetFunctionId()); if (func != null) { var win = FlowSystem.GetWindow(func.functionExitId); if (win == null) { return(emptyResult); } return(win.GetScreen(runtime)); } } if (screens == null || screens.Count == 0) { #if UNITY_EDITOR if (Application.isPlaying == false) { this.RefreshScreen(); } #endif if (screens == null || screens.Count == 0) { return(emptyResult); } return(screens.FirstOrDefault()); } this.selectedScreenIndex = Mathf.Clamp(this.selectedScreenIndex, 0, screens.Count - 1); return(screens[this.selectedScreenIndex]); }
public override System.Collections.Generic.IEnumerator <byte> OnEvent(int screenId, string group1, string group2, string group3, int weight) { #if FACEBOOK_ANALYTICS_API if (FB.IsInitialized == false) { yield break; } if (screenId >= 0) { var eventName = string.Format("{0}({1})", FlowSystem.GetWindow(screenId).title, screenId); //if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true) UnityEngine.Debug.Log("FB::OnEvent: " + eventName + " >> " + group1 + " >> " + group2 + " >> " + group3 + " >> " + weight); FB.LogAppEvent(eventName, 1f, new Dictionary <string, object>() { { "Group1", group1 }, { "Group2", group2 }, { "Group3", group3 }, { "Weight", weight }, { "CustomParameter", User.instance.customParameter }, }); } #endif yield return(0); }
public static WindowLayout GetLayout(int windowId, out LayoutWindowType screen) { screen = null; var window = FlowSystem.GetWindow(windowId); if (window == null) { return(null); } var screenInfo = window.GetScreen(); if (screenInfo == null) { return(null); } screen = screenInfo.Load <LayoutWindowType>(); if (screen == null || screen.GetCurrentLayout().layout == null) { return(null); } return(screen.GetCurrentLayout().layout); }
public override System.Collections.Generic.IEnumerator <byte> OnScreenTransition(int index, int screenId, int toScreenId, bool popup) { #if FACEBOOK_ANALYTICS_API if (FB.IsInitialized == false) { yield break; } if (screenId >= 0 && toScreenId >= 0) { //if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true) UnityEngine.Debug.Log("FB::OnScreenTransition: " + screenId + " >> " + toScreenId); var eventName = "Screen Transition"; FB.LogAppEvent(eventName, 1f, new Dictionary <string, object>() { { "From", string.Format("{0} (ID: {1})", FlowSystem.GetWindow(screenId).title, screenId) }, { "To", string.Format("{0} (ID: {1})", FlowSystem.GetWindow(toScreenId).title, toScreenId) }, { "Path", string.Format("Path Index: {0}", index) }, { "Popup", string.Format("Popup: {0}", popup) }, { "CustomParameter", User.instance.customParameter }, }); } #endif yield return(0); }
public WindowBase GetScreen() { if (this.storeType == StoreType.ReUseScreen) { var win = FlowSystem.GetWindow(this.screenWindowId); if (win == null) { return(null); } return(win.GetScreen()); } if (this.IsFunction() == true) { var func = FlowSystem.GetWindow(this.GetFunctionId()); if (func != null) { var win = FlowSystem.GetWindow(func.functionExitId); if (win == null) { return(null); } return(win.GetScreen()); } } return(this.screen); }
public void Validate(FD.FlowWindow window) { #if UNITY_EDITOR if (this.items == null) { this.items = new List <ABTestingItem>(); EditorUtility.SetDirty(window); FlowSystem.SetDirty(); FlowSystem.Save(); } if (this.Count() < 2) { for (int i = this.Count(); i < 2; ++i) { this.AddNew(); } EditorUtility.SetDirty(window); FlowSystem.SetDirty(); FlowSystem.Save(); } var data = FlowSystem.GetData(); if (data != null) { var attaches = window.attachItems.ToArray(); for (int i = 0; i < attaches.Count(); ++i) { var toId = attaches[i].targetId; var toIndex = attaches[i].index; if (this.items.FirstOrDefault(x => x.attachItem.targetId == toId && x.attachItem.index == toIndex) == null) { var fromId = window.id; if (FlowSystem.GetWindow(toId).IsContainer() == false) { EditorApplication.delayCall += () => { data.Detach(fromId, toIndex, toId, oneWay: false); }; } } } for (int i = 0; i < this.Count(); ++i) { var item = this.items[i]; if (data.AlreadyAttached(window.id, item.attachItem.index, item.attachItem.targetId) == false) { // no attachment - remove it item.Detach(); } } } #endif }
public override IEnumerator OnScreenTransition(int index, int screenId, int toScreenId, bool popup) { UnityEngine.Analytics.Analytics.CustomEvent("Screen Transition", new Dictionary <string, object>() { { "From", string.Format("{0} (ID: {1})", FlowSystem.GetWindow(screenId).title, screenId) }, { "To", string.Format("{0} (ID: {1})", FlowSystem.GetWindow(toScreenId).title, toScreenId) }, { "Path", string.Format("Path Index: {0}", index) }, { "Popup", string.Format("Popup: {0}", popup) } }); yield return(false); }
public override System.Collections.Generic.IEnumerator <byte> OnEvent(int screenId, string group1, string group2, string group3, int weight) { #if GOOGLE_ANALYTICS_V4 if (this.nativeService == null) { yield break; } this.nativeService.LogEvent(string.Format("Screen: {0} (ID: {1}) - {2}", FlowSystem.GetWindow(screenId).title, screenId, group1), group2, group3, weight); #endif yield return(0); }
public override System.Collections.Generic.IEnumerator <byte> OnTransaction(int screenId, string productId, decimal price, string currency, string receipt, string signature) { #if GOOGLE_ANALYTICS_V4 if (this.nativeService == null) { yield break; } this.nativeService.LogTransaction(string.Format("Screen: {0} (ID: {1})", FlowSystem.GetWindow(screenId).title, screenId), productId, (double)price, 0d, 0d, currency); #endif yield return(0); }
public FlowWindow GetContainer() { return(ME.Utilities.CacheByFrame("FlowWindow." + this.id.ToString() + ".GetContainer", () => { var container = this.attachItems.FirstOrDefault((item) => FlowSystem.GetWindow(item.targetId).IsContainer()); if (container == null) { return null; } return FlowSystem.GetWindow(container.targetId); })); }
public static string GenerateTransitionMethods(FlowWindow window) { var flowData = FlowSystem.GetData(); var transitions = flowData.windows.Where(w => window.attachItems.Any((item) => item.targetId == w.id) && w.CanCompiled() && !w.IsContainer()); var result = string.Empty; foreach (var each in transitions) { var className = each.directory; var classNameWithNamespace = Tpl.GetNamespace(each) + "." + Tpl.GetDerivedClassName(each); result += FlowTemplateGenerator.GenerateWindowLayoutTransitionMethod(window, each, className, classNameWithNamespace); } // Make FlowDefault() method if exists var c = 0; var everyPlatformHasUniqueName = false; foreach (var attachItem in window.attachItems) { var attachId = attachItem.targetId; var attachedWindow = FlowSystem.GetWindow(attachId); var tmp = UnityEditor.UI.Windows.Plugins.Flow.Flow.IsCompilerTransitionAttachedGeneration(window, attachedWindow); if (tmp == true) { ++c; } } everyPlatformHasUniqueName = c > 1; foreach (var attachItem in window.attachItems) { var attachId = attachItem.targetId; var attachedWindow = FlowSystem.GetWindow(attachId); if (attachedWindow.IsShowDefault() == true) { result += FlowTemplateGenerator.GenerateWindowLayoutTransitionMethodDefault(); } result += UnityEditor.UI.Windows.Plugins.Flow.Flow.OnCompilerTransitionAttachedGeneration(window, attachedWindow, everyPlatformHasUniqueName); } // Run addons transition logic result += UnityEditor.UI.Windows.Plugins.Flow.Flow.OnCompilerTransitionGeneration(window); return(result); }
public override System.Collections.Generic.IEnumerator <byte> OnTransaction(int screenId, string productId, decimal price, string currency, string receipt, string signature) { #if FACEBOOK_ANALYTICS_API FB.LogPurchase((float)price, currency, new Dictionary <string, object>() { { "Window", string.Format("{0} (ID: {1}), product: {2}", FlowSystem.GetWindow(screenId).title, screenId, productId) }, { "Receipt", receipt }, { "CustomParameter", User.instance.customParameter }, }); #endif yield return(0); }
public override IEnumerator OnEvent(int screenId, string group1, string group2, string group3, int weight) { var eventName = string.Format("{0}({1})", FlowSystem.GetWindow(screenId).title, screenId); UnityEngine.Analytics.Analytics.CustomEvent(eventName, new Dictionary <string, object>() { { "Group1", group1 }, { "Group2", group2 }, { "Group3", group3 }, { "Weight", weight } }); yield return(false); }
public override System.Collections.Generic.IEnumerator <byte> OnEvent(int screenId, string group1, string group2, string group3, int weight) { #if APPSFLYER_ANALYTICS_API AppsFlyer.trackRichEvent(string.Format("Screen: {0} (ID: {1}) - {2}", FlowSystem.GetWindow(screenId).title, screenId, group1), new Dictionary <string, string>() { { "Group1", group1 }, { "Group2", group2 }, { "Group3", group3 }, { "Weight", weight.ToString() }, { "CustomParameter", User.instance.customParameter }, }); #endif yield return(0); }
public override string OnCompilerTransitionGeneration(FlowWindow window) { var functionContainer = window.GetFunctionContainer(); if (functionContainer != null) { var exit = FlowSystem.GetWindow(functionContainer.functionExitId); if (exit != null && exit.id == window.id) { return(FlowFunctionsTemplateGenerator.GenerateReturnMethod(this.flowEditor, exit)); } } return(base.OnCompilerTransitionGeneration(window)); }
public FlowWindow GetContainer() { return(ME.Utilities.CacheByFrame(string.Format("FlowWindow.{0}.GetContainer", this.id), () => { var container = this.attachItems.FirstOrDefault((item) => { var w = FlowSystem.GetWindow(item.targetId); return w.IsContainer() == true && w.IsFunction() == false; }); if (container == null) { return null; } return FlowSystem.GetWindow(container.targetId); })); }
public List <FlowWindow> GetAttachedWindows() { List <FlowWindow> output = new List <FlowWindow>(); foreach (var attachItem in this.attachItems) { var window = FlowSystem.GetWindow(attachItem.targetId); if (window.IsContainer() == true) { continue; } output.Add(window); } return(output); }
public FlowWindow GetFunctionContainer() { // If current window attached to function var attaches = this.attachItems; foreach (var attachItem in attaches) { var win = FlowSystem.GetWindow(attachItem.targetId); if (win.IsContainer() == true && win.IsFunction() == true) { // We are inside a function return(win); } } return(null); }
public override System.Collections.Generic.IEnumerator <byte> OnEvent(int screenId, string group1, string group2, string group3, int weight) { #if AMPLITUDE_ANALYTICS_API if (screenId >= 0) { var amplitude = Amplitude.Instance; amplitude.logEvent(string.Format("Screen: {0} (ID: {1}) - {2}", FlowSystem.GetWindow(screenId).title, screenId, group1), new Dictionary <string, object>() { { "Group1", group1 }, { "Group2", group2 }, { "Group3", group3 }, { "Weight", weight.ToString() }, { "CustomParameter", User.instance.customParameter }, }); } #endif yield return(0); }
public override System.Collections.Generic.IEnumerator <byte> OnScreenTransition(int index, int screenId, int toScreenId, bool popup) { #if UNITY_ANALYTICS_API if (screenId >= 0 && toScreenId >= 0) { UnityEngine.Analytics.Analytics.CustomEvent("Screen Transition", new Dictionary <string, object>() { { "From", string.Format("{0} (ID: {1})", FlowSystem.GetWindow(screenId).title, screenId) }, { "To", string.Format("{0} (ID: {1})", FlowSystem.GetWindow(toScreenId).title, toScreenId) }, { "Path", string.Format("Path Index: {0}", index) }, { "Popup", string.Format("Popup: {0}", popup) }, { "CustomParameter", User.instance.customParameter }, }); } #endif yield return(0); }
public static WindowLayout GetLayout(int windowId, out LayoutWindowType screen) { screen = null; var window = FlowSystem.GetWindow(windowId); if (window == null) { return(null); } screen = window.GetScreen() as LayoutWindowType; if (screen == null || screen.layout.layout == null) { return(null); } return(screen.layout.layout); }
public override System.Collections.Generic.IEnumerator <byte> OnEvent(int screenId, string group1, string group2, string group3, int weight) { #if DELTADNA_ANALYTICS_API if (screenId >= 0) { var eventName = string.Format("{0}({1})", FlowSystem.GetWindow(screenId).title, screenId); var gameEvent = new GameEvent(eventName) .AddParam("Group1", group1) .AddParam("Group2", group2) .AddParam("Group3", group3) .AddParam("Weight", weight) .AddParam("CustomParameter", User.instance.customParameter); DDNA.Instance.RecordEvent(gameEvent); } #endif yield return(0); }
public override System.Collections.Generic.IEnumerator <byte> OnScreenTransition(int index, int screenId, int toScreenId, bool popup) { #if DELTADNA_ANALYTICS_API if (screenId >= 0 && toScreenId >= 0) { var eventName = "Screen Transition"; var gameEvent = new GameEvent(eventName) .AddParam("From", string.Format("{0} (ID: {1})", FlowSystem.GetWindow(screenId).title, screenId)) .AddParam("To", string.Format("{0} (ID: {1})", FlowSystem.GetWindow(toScreenId).title, toScreenId)) .AddParam("Path", string.Format("Path Index: {0}", index)) .AddParam("Popup", string.Format("Popup: {0}", popup)) .AddParam("CustomParameter", User.instance.customParameter); DDNA.Instance.RecordEvent(gameEvent); } #endif yield return(0); }
public override System.Collections.Generic.IEnumerator <byte> OnEvent(int screenId, string group1, string group2, string group3, int weight) { #if UNITY_ANALYTICS_API if (screenId >= 0) { var eventName = string.Format("{0}({1})", FlowSystem.GetWindow(screenId).title, screenId); UnityEngine.Analytics.Analytics.CustomEvent(eventName, new Dictionary <string, object>() { { "Group1", group1 }, { "Group2", group2 }, { "Group3", group3 }, { "Weight", weight }, { "CustomParameter", User.instance.customParameter }, }); } #endif yield return(0); }
public bool Attach(int id, int index = 0, bool oneWay = false, WindowLayoutElement component = null) { if (this.id == id) { return(false); } var result = false; if (component != null) { if (this.attachedComponents.Any((c) => c.targetWindowId == id && c.sourceComponentTag == component.tag) == false) { this.attachedComponents.Add(new ComponentLink(id, component.tag, component.comment)); // If we attaching component - try to attach window if not oneWay = true; result = true; } else { return(false); } } if (this.AlreadyAttached(id, index) == false) { this.attachItems.Add(new AttachItem(id, index)); if (oneWay == false) { var window = FlowSystem.GetWindow(id); window.Attach(this.id, oneWay: true); } return(true); } return(result); }
public override System.Collections.Generic.IEnumerator <byte> OnScreenTransition(int index, int screenId, int toScreenId, bool popup) { #if AMPLITUDE_ANALYTICS_API if (screenId >= 0 && toScreenId >= 0) { var amplitude = Amplitude.Instance; amplitude.logEvent( "ScreenTransition", new Dictionary <string, object>() { { "From", FlowSystem.GetWindow(screenId).title }, { "FromID", screenId }, { "To", FlowSystem.GetWindow(toScreenId).title }, { "ToID", toScreenId }, { "CustomParameter", User.instance.customParameter }, } ); } #endif yield return(0); }
public bool Detach(int id, int index = 0, bool oneWay = false, WindowLayoutElement component = null) { if (this.id == id) { return(false); } var result = false; if (component != null) { if (this.attachedComponents.Any((c) => c.targetWindowId == id && c.sourceComponentTag == component.tag) == true) { this.attachedComponents.RemoveAll((c) => c.targetWindowId == id && c.sourceComponentTag == component.tag); result = true; } } else { if (this.AlreadyAttached(id, index) == true) { this.attachItems.RemoveAll((c) => c.targetId == id && c.index == index); this.attachedComponents.RemoveAll((c) => c.targetWindowId == id); result = true; } if (oneWay == false) { var window = FlowSystem.GetWindow(id); if (window != null) { result = window.Detach(this.id, oneWay: true); } } } return(result); }
/*public override string OnCompilerTransitionGeneration(FD.FlowWindow window) { * * return Tpl.GenerateTransitionMethods(window); * * } * * public override string OnCompilerTransitionAttachedGeneration(FD.FlowWindow windowFrom, FD.FlowWindow windowTo, bool everyPlatformHasUniqueName) { * * if (windowTo.IsFunction() == true && * windowTo.IsSmall() == true && * windowTo.IsContainer() == false && * windowTo.GetFunctionId() > 0) { * * return FlowFunctionsTemplateGenerator.GenerateTransitionMethod(this.flowEditor, windowFrom, windowTo); * * } * * return base.OnCompilerTransitionAttachedGeneration(windowFrom, windowTo, everyPlatformHasUniqueName); * * }*/ public override string OnCompilerTransitionAttachedGeneration(FD.FlowWindow windowFrom, FD.FlowWindow windowTo, bool everyPlatformHasUniqueName) { if (windowTo.IsLinker() == true && windowTo.GetLinkerId() > 0) { var result = string.Empty; var linkerWindow = FlowSystem.GetWindow(windowTo.GetLinkerId()); var className = linkerWindow.directory; var classNameWithNamespace = Tpl.GetNamespace(linkerWindow) + "." + Tpl.GetDerivedClassName(linkerWindow); result += TemplateGenerator.GenerateWindowLayoutTransitionMethod(windowTo, linkerWindow, className, classNameWithNamespace); WindowSystem.CollectCallVariations(linkerWindow.GetScreen(), (listTypes, listNames) => { result += TemplateGenerator.GenerateWindowLayoutTransitionTypedMethod(windowTo, linkerWindow, className, classNameWithNamespace, listTypes, listNames); }); return(result); } return(base.OnCompilerTransitionAttachedGeneration(windowFrom, windowTo, everyPlatformHasUniqueName)); }
public override System.Collections.Generic.IEnumerator <byte> OnTransaction(int screenId, string productId, decimal price, string currency, string receipt, string signature) { #if DELTADNA_ANALYTICS_API if (screenId >= 0) { var gameEvent = new Transaction( string.Format("{0} (ID: {1}), product: {2}", FlowSystem.GetWindow(screenId).title, screenId, productId), "PURCHASE", new Product(), new Product().SetRealCurrency(currency, (int)price) ) .SetProductId(productId) .SetReceipt(receipt) .SetReceiptSignature(signature) .SetServer(WindowSystem.GetCurrentRuntimePlatform().ToString()) .AddParam("CustomParameter", User.instance.customParameter); DDNA.Instance.RecordEvent(gameEvent); } #endif yield return(0); }
public static string GenerateTransitionMethod(FlowSystemEditorWindow flowEditor, FD.FlowWindow windowFrom, FD.FlowWindow windowTo) { var file = UnityEngine.Resources.Load("UI.Windows/ABTesting/Templates/TemplateTransitionMethod") as TextAsset; if (file == null) { if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true) { UnityEngine.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 methodPatternDefault = "(item, h, wh) => WindowSystemFlow.DoFlow<{0}>(this, item, h, wh, false, 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.IsFunction() == true) { var winFunc = FlowSystem.GetWindow(window.functionId); if (winFunc != null) { window = FlowSystem.GetWindow(winFunc.functionRootId); } else { window = null; } } if (window == null) { methodList.Add("null"); } else { var classNameWithNamespace = Tpl.GetClassNameWithNamespace(window); methodList.Add(string.Format(methodPatternDefault, 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); }