public void RemoveProfile(string name) { if (File.Find(name + ".profile", false).IsNull()) { this.ShowProfiles(); this.selectionHeader = "Remove Profile"; Events.AddLimited("On Profile Selected", () => this.RemoveProfile(this.activeProfile.name), 1, this); return; } this.profiles.RemoveAll(x => x.name == name); File.Delete(name + ".profile"); foreach (var instance in Locate.GetSceneComponents <InputInstance>()) { if (!instance.profile.IsNull() && instance.profile.name == name) { this.instanceProfile.Remove(instance.alias); InputManager.Get().SelectProfile(instance); } } }
public void AddPlottableApiTable(XmlDoc xd) { AddGroupHeader("Plottable Types"); AddHTML("This table lists the types of plottable objects that can be added to a plot. " + "Many of these plottable types have helper methods to easily create, customize, and add them to the plot. " + "Public methods, properties, and fields of plottables can be used to customize their behavior and styling."); AddHTML("<table>"); AddTableRow(new string[] { "Method", "Summary" }, true); foreach (Type plottableType in Locate.GetPlottableTypes()) { string summary = xd.GetSummary(plottableType); string name = Locate.TypeName(plottableType); string url = Locate.TypeName(plottableType, urlSafe: true); string html = $"<a href='api-plottable-{url}.html'><strong>{name}</strong></a>"; AddTableRow(new string[] { html, summary }); } AddHTML("</table>"); }
// Note! This broke with CMS 8, but since we're not using the languageselector // from code, we just ignore it //public virtual T Get<T>(ContentReference contentLink) where T : IContentData //{ // // CMS 8 // // LoaderOptions options = new LoaderOptions(); // // options.Add(new LanguageLoaderOption() {FallbackBehaviour = LanguageBehaviour.Fallback}); // return this.Get<T>(contentLink, (LanguageSelector)LanguageSelector.AutoDetect(true)); //} public virtual T Get <T>(ContentReference contentLink) where T : IContentData { T obj = Locate.ContentRepository().Get <T>(contentLink); if ((object)obj == null) { return(default(T)); } AccessLevel access = contentLink.CompareToIgnoreWorkID(this.CurrentContentLink) ? AccessLevel.Read : AccessLevel.Read; ISecurable securable = (object)obj as ISecurable; if (securable != null && !securable.GetSecurityDescriptor().HasAccess(PrincipalInfo.CurrentPrincipal, access)) { if (PrincipalInfo.CurrentPrincipal.Identity.IsAuthenticated) { throw new AccessDeniedException(); } DefaultAccessDeniedHandler.AccessDenied((object)this); } return(obj); }
protected void Page_Init(object sender, EventArgs e) { bool UseForms = BVNetwork.Attend.Business.API.AttendRegistrationEngine.UseForms; var eventPage = Locate.ContentRepository().Get <EventPageBase>(CurrentBlock.EventPage); if (UseForms == false) { DetailsXFormControl.FormDefinition = XForm.CreateInstance(new Guid(eventPage.RegistrationForm.Id.ToString())); PopulateForm(); DetailsXFormControl.DataBind(); } else { FormData = BVNetwork.Attend.Business.API.AttendRegistrationEngine.GetFormData(CurrentBlock); FormElementsRepeater.DataSource = FormData; FormElementsRepeater.DataBind(); } XFormContainer.Visible = !UseForms; FormContainer.Visible = UseForms; SessionList.Controls.Add(AttendSessionEngine.GetSessionsControl(CurrentData.EventPage, CurrentData)); }
public virtual void Awake() { string name = this.GetType().Name.ToTitleCase(); this.parentPath = this.gameObject.GetPath(); this.path = this.GetPath(); this.lastAlias = this.alias = this.alias.SetDefault(name); if (this.autoRename) { while (Locate.GetObjectComponents <DataBehaviour>(this.gameObject).Exists(x => x != this && x.alias == this.alias)) { this.lastAlias = this.alias = this.alias.ToLetterSequence(); } } if (!Application.isPlaying) { Events.Register("On Destroy", this); Events.Register("On Validate", this); Events.Add("On Validate", this.CheckDependents, this); Events.Add("On Validate", this.CheckAlias, this); } }
private void AddPlotApiSummary() { string xmlPath = "../../../../../src/ScottPlot/ScottPlot.xml"; XDocument xmlDoc = XDocument.Load(xmlPath); AddHeading("The Plot Module", 1); Add("The Plot module is the primary way to interct with ScottPlot. " + "It has helper methods to make it easy to create and add Plottable objects. " + "Use the Render() method to render the plot as an image."); //AddHeading("Fields", 3); //foreach (var field in Locate.GetPlotFields().Select(x => new DocumentedField(x, xmlDoc))) //Add(OneLineInfo(field, "plot/")); AddHeading("Properties", 2); foreach (var property in Locate.GetPlotProperties().Select(x => new DocumentedProperty(x, xmlDoc))) { Add(OneLineInfo(property, "api/plot/")); } AddHeading("Methods", 2); foreach (var method in Locate.GetPlotMethodsNoAdd().Select(x => new DocumentedMethod(x, xmlDoc))) { Add(OneLineInfo(method, "api/plot/")); } AddHeading("Methods for Creating Plottables", 2); foreach (var method in Locate.GetPlotMethodsOnlyAdd().Select(x => new DocumentedMethod(x, xmlDoc))) { Add(OneLineInfo(method, "api/plot/")); } AddHeading("Plottable Types", 1); foreach (Type plottableType in Locate.GetPlottableTypes()) { var classInfo = new DocumentedClass(plottableType, xmlDoc); Add(OneLineInfo(classInfo, $"api/plottable/{Sanitize(plottableType.Name)}/")); } }
public static void ShowWindow() { if (Theme.window.IsNull()) { Theme.window = Locate.GetAssets <ThemeWindow>().FirstOrDefault(); if (Theme.window.IsNull()) { Theme.window = ScriptableObject.CreateInstance <ThemeWindow>(); Theme.window.position = ThemeWindow.hiddenPosition; Theme.window.minSize = ThemeWindow.hiddenSize; Theme.window.maxSize = ThemeWindow.hiddenSize; Theme.window.wantsMouseMove = Theme.hoverResponse != HoverResponse.None; Theme.window.ShowPopup(); } } try { if (Theme.window == null || (Theme.window != null && Theme.window.position == null)) { return; } if (Theme.window.position != ThemeWindow.hiddenPosition) { Theme.window.position = ThemeWindow.hiddenPosition; } if (Theme.window.maxSize != ThemeWindow.hiddenSize) { Theme.window.minSize = ThemeWindow.hiddenSize; Theme.window.maxSize = ThemeWindow.hiddenSize; } } catch { } }
protected void UpdateParticipant_Click(object sender, EventArgs e) { try { bool UseForms = BVNetwork.Attend.Business.API.AttendRegistrationEngine.UseForms; ParticipantBlock current = (CurrentBlock.CreateWritableClone() as ParticipantBlock); if (UseForms) { XmlDocument doc = new XmlDocument(); XmlNode rootNode = doc.CreateElement("FormData"); doc.AppendChild(rootNode); foreach (RepeaterItem item in FormElementsRepeater.Items) { if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem) { System.Web.UI.WebControls.Label label = (System.Web.UI.WebControls.Label)item.FindControl("FormLabel"); TextBox textBox = (TextBox)item.FindControl("FormTextBox"); XmlNode formElementNode = doc.CreateElement(label.Text); formElementNode.InnerText = textBox.Text; rootNode.AppendChild(formElementNode); } } current.XForm = doc.InnerXml; } else { current.XForm = DetailsXFormControl.Data.Data.OuterXml; } Locate.ContentRepository().Save(current as IContent, EPiServer.DataAccess.SaveAction.Publish); } catch (Exception ex) { StatusLiteral.Text = ex.Message; } }
// Note! This broke with CMS 8, but since we're not using the languageselector // from code, we just ignore it //public virtual T Get<T>(ContentReference contentLink) where T : IContentData //{ // // CMS 8 // // LoaderOptions options = new LoaderOptions(); // // options.Add(new LanguageLoaderOption() {FallbackBehaviour = LanguageBehaviour.Fallback}); // return this.Get<T>(contentLink, (LanguageSelector)LanguageSelector.AutoDetect(true)); //} public virtual T Get <T>(ContentReference contentLink) where T : IContentData { T obj = Locate.ContentRepository().Get <T>(contentLink); if ((object)obj == null) { return(default(T)); } AccessLevel access = contentLink.CompareToIgnoreWorkID(this.CurrentContentLink) ? AccessLevel.Read : AccessLevel.Read; ISecurable securable = (object)obj as ISecurable; if (securable != null && !securable.GetSecurityDescriptor().HasAccess(PrincipalInfo.CurrentPrincipal, access)) { if (PrincipalInfo.CurrentPrincipal.Identity.IsAuthenticated) { throw new AccessDeniedException(); } IAccessDeniedHandler handler = ServiceLocator.Current.GetInstance <IAccessDeniedHandler>(); handler.AccessDenied(new HttpContextWrapper(Context)); // Man - we really need to get rid of web forms soon! } return(obj); }
protected void Page_Load(object sender, EventArgs e) { SendOptionsControl.ApplyEditAttributes <ScheduledEmailBlock>(p => p.EmailSendOptions); BlockName.ApplyEditAttributes <ScheduledEmailBlock>(p => (p as IContent).Name); SendOnStatusControl.ApplyEditAttributes <ScheduledEmailBlock>(p => p.SendOnStatus); ScheduledRelativeAmountControl.ApplyEditAttributes <ScheduledEmailBlock>(p => p.ScheduledRelativeAmount); ScheduledRelativeToControl.ApplyEditAttributes <ScheduledEmailBlock>(p => p.ScheduledRelativeTo); ScheduledRelativeUnitControl.ApplyEditAttributes <ScheduledEmailBlock>(p => p.ScheduledRelativeUnit); (this as PageBase).EditHints.Add("ScheduledRelativeTo"); (this as PageBase).EditHints.Add("ScheduledRelativeAmount"); (this as PageBase).EditHints.Add("ScheduledRelativeUnit"); (this as PageBase).EditHints.Add("SendOnStatus"); (this as PageBase).EditHints.Add("EmailSendOptions"); (this as PageBase).EditHints.Add("SendOptions"); (this as PageBase).EditHints.Add("EmailTemplateContentReference"); if ((CurrentData as ScheduledEmailBlock).EmailTemplateContentReference != null && (CurrentData as ScheduledEmailBlock).EmailTemplateContentReference != ContentReference.EmptyReference) { SetupPreviewPropertyControl(MailTemplateBlockPreview, new[] { Locate.ContentRepository() .Get <IContent>((CurrentData as ScheduledEmailBlock).EmailTemplateContentReference) }, "MailPreview"); } else { ConfirmMailTemplateBlockPreviewPlaceHolder.Visible = false; } MailTemplateBlockPreview.RenderSettings.Tag = "edit"; MailTemplateBlockPreview.DataBind(); this.DataBind(); }
private static void MakeCategoryPages(string OutputFolderPath, RecipeSource[] Recipes) { string categoryFolderPath = Path.Combine(OutputFolderPath, "category"); if (!Directory.Exists(categoryFolderPath)) { Directory.CreateDirectory(categoryFolderPath); } List <KeyValuePair <string, IRecipe[]> > recipesByCategory = Locate.GetCategorizedRecipes(); foreach (KeyValuePair <string, IRecipe[]> pair in recipesByCategory) { string categoryFolderName = pair.Value.First().Category.Folder; string thisCategoryFolderPath = Path.Combine(categoryFolderPath, categoryFolderName); if (!Directory.Exists(thisCategoryFolderPath)) { Directory.CreateDirectory(thisCategoryFolderPath); } MakeCategoryPage(thisCategoryFolderPath, Recipes); } }
public static void Build(PoolPrefab blueprint) { if (blueprint == null || blueprint.prefab == null) { return; } Transform instanceGroup = Locate.GetScenePath("@Instances").transform; Instance[] slots = Pool.instances[blueprint.name] = new Instance[blueprint.maximum]; for (int current = 0; current < blueprint.maximum; ++current) { GameObject gameObject = (GameObject)GameObject.Instantiate(blueprint.prefab); Instance instance = slots[current] = gameObject.AddComponent <Instance>(); instance.prefab = blueprint; instance.gameObject.SetActive(false); instance.gameObject.transform.parent = instanceGroup; instance.gameObject.transform.localScale = blueprint.scale; if (blueprint.uniqueMaterial) { Material material = instance.gameObject.GetComponent <Renderer>().sharedMaterial; instance.gameObject.GetComponent <Renderer>().sharedMaterial = (Material)Material.Instantiate(material); } } }
public void SceneRefresh() { bool fullSweep = !Proxy.IsPlaying(); if (fullSweep) { Attribute.all.Clear(); Attribute.lookup.Clear(); } bool includeEnabled = Attribute.ready || !Proxy.IsPlaying(); bool includeDisabled = !Attribute.ready || this.editorIncludeDisabled; if (Attribute.debug.Has("ProcessRefresh")) { Log.Editor("[AttributeManager] Scene Refreshing..."); } this.data = Locate.GetSceneComponents <DataBehaviour>(includeEnabled, includeDisabled); if (Attribute.debug.Has("ProcessRefresh")) { Log.Editor("[AttributeManager] DataBehaviour Count : " + this.data.Length); } this.start = Time.Get(); this.nextIndex = 0; }
public static void CallChildren(object target, string name, object[] values, bool self = false) { if (Events.HasDisabled("Call")) { return; } if (self) { Events.Call(target, name, values); } if (target is GameObject) { var gameObject = (GameObject)target; Transform[] children = Locate.GetObjectComponents <Transform>(gameObject); foreach (Transform transform in children) { if (transform.gameObject == gameObject) { continue; } Events.CallChildren(transform.gameObject, name, values, true); } } }
public void Search() { if (this.mode != TargetMode.Search) { return; } if (this.search.IsEmpty()) { this.search = this.fallbackSearch; } if (this.search.IsEmpty()) { return; } string search = this.search.Replace("\\", "/"); if (!search.IsEmpty()) { for (int index = 0; index < this.special.Count; ++index) { string specialName = this.specialNames[index]; GameObject special = this.special[index]; if (!special.IsNull() && search.Contains(specialName, true)) { string specialPath = special.GetPath(); search = search.Replace(specialName, specialPath, true); } } if (search.ContainsAny("/", ".")) { string[] parts = search.Split("/"); string total = ""; GameObject current = null; for (int index = 0; index < parts.Length; ++index) { string part = parts[index]; current = GameObject.Find(total); if (part.IsEmpty()) { continue; } if (part == ".." || part == ".") { if (total.IsEmpty()) { int specialIndex = this.specialNames.FindIndex(x => x.Contains("[this]", true)); current = specialIndex != -1 ? this.special[index] : null; if (!current.IsNull()) { if (part == "..") { total = current.GetParent().IsNull() ? "" : current.GetParent().GetPath(); } else { total = current.GetPath(); } } continue; } current = GameObject.Find(total); if (!current.IsNull()) { if (part == "..") { total = current.GetParent().IsNull() ? "" : current.GetParent().GetPath(); } continue; } } GameObject next = GameObject.Find(total + part + "/"); if (next.IsNull() && !current.IsNull() && Attribute.lookup.ContainsKey(current)) { var match = Attribute.lookup[current].Where(x => x.Value.info.name.Matches(part)).FirstOrDefault().Value; if (match is AttributeGameObject) { next = match.As <AttributeGameObject>().Get(); if (!next.IsNull()) { total = next.GetPath(); } continue; } } total += part + "/"; } search = total; } this.searchObject = Locate.Find(search); } }
public void ApplyMain(Theme theme) { if (this.skin.IsNull()) { return; } var skin = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector); var isFragment = this.path.Contains("#"); var isDefault = this.skinset.name == "Default"; var main = this.skin; var palette = theme.palette; if (!isDefault) { main = theme.fontset.Apply(main); theme.palette.Apply(main); ThemeSkin.RemoveHover(main); } skin.Use(main, !isFragment, true); EditorGUIUtility.GetBuiltinSkin(EditorSkin.Game).Use(skin, !isFragment, true); EditorGUIUtility.GetBuiltinSkin(EditorSkin.Scene).Use(skin, !isFragment, true); var collabStyle = isDefault ? skin.Get("DropDown").Padding(24, 14, 2, 3) : skin.Get("DropDown"); Utility.GetUnityType("Toolbar.Styles").GetVariable <GUIStyle>("collabButtonStyle").Use(collabStyle); Utility.GetUnityType("AppStatusBar").ClearVariable("background"); Utility.GetUnityType("SceneRenderModeWindow.Styles").SetVariable("sMenuItem", skin.Get("MenuItem")); Utility.GetUnityType("SceneRenderModeWindow.Styles").SetVariable("sSeparator", skin.Get("sv_iconselector_sep")); Utility.GetUnityType("GameView.Styles").SetVariable("gizmoButtonStyle", skin.Get("GV Gizmo DropDown")); typeof(SceneView).SetVariable <GUIStyle>("s_DropDownStyle", skin.Get("GV Gizmo DropDown")); var hostView = Utility.GetUnityType("HostView"); if (palette.Has("Cursor")) { skin.settings.cursorColor = palette.Get("Cursor"); } if (palette.Has("Selection")) { skin.settings.selectionColor = palette.Get("Selection"); } if (palette.Has("Curve")) { typeof(EditorGUI).SetVariable("kCurveColor", palette.Get("Curve")); } if (palette.Has("CurveBackground")) { typeof(EditorGUI).SetVariable("kCurveBGColor", palette.Get("CurveBackground")); } if (palette.Has("Window")) { typeof(EditorGUIUtility).SetVariable("kDarkViewBackground", palette.Get("Window")); hostView.SetVariable("kViewColor", palette.Get("Window")); } foreach (var view in Resources.FindObjectsOfTypeAll(hostView)) { view.ClearVariable("background"); } foreach (var window in Locate.GetAssets <EditorWindow>()) { window.minSize = new Vector2(100, 20); } if (!isDefault) { Utility.GetUnityType("PreferencesWindow").InstanceVariable("constants").SetVariable("sectionHeader", skin.Get("HeaderLabel")); } Utility.GetUnityType("BuildPlayerWindow").InstanceVariable("styles").SetVariable("toggleSize", new Vector2(24, 16)); }
public static GUIStyle Get(string skin, string name, bool copy = false) { var guiSkin = Locate.GetAsset <GUISkin>(skin); return(Style.Get(guiSkin, name, copy)); }
public void AddAllRecipies() { IRecipe[] sortedRecipes = Locate.GetRecipes().OrderBy(x => x.ID).ToArray(); AddRecipes(sortedRecipes); }
public void AddRecipiesFromCategory(string category) => AddRecipes(Locate.GetRecipes().Where(x => x.Category == category).ToArray());
private IList <DisplayChannel> GetDisplayChannels() { return(Locate.DisplayChannelService().Channels); }
protected void DeleteScheduledEmail_OnClick(object sender, EventArgs e) { Locate.ContentRepository().Delete((CurrentBlock as IContent).ContentLink, true, AccessLevel.NoAccess); this.Visible = false; }
protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (!this._drag) { bool flag2; bool flag3; bool flag4; bool flag = flag2 = flag3 = flag4 = false; this._locmouse = Locate.None; if (this._arealeft.IntersectsWith(new Rectangle(e.X, e.Y, 1, 1))) { flag = true; this._locmouse |= Locate.Left; } else if (this._arearight.IntersectsWith(new Rectangle(e.X, e.Y, 1, 1))) { flag2 = true; this._locmouse |= Locate.Right; } if (this._areatop.IntersectsWith(new Rectangle(e.X, e.Y, 1, 1))) { flag3 = true; this._locmouse |= Locate.Top; } else if (this._areabottom.IntersectsWith(new Rectangle(e.X, e.Y, 1, 1))) { flag4 = true; this._locmouse |= Locate.Bottom; } if ((flag && flag3) || (flag2 && flag4)) { this.Cursor = Cursors.SizeNWSE; } else if ((flag && flag4) || (flag2 && flag3)) { this.Cursor = Cursors.SizeNESW; } else if (flag || flag2) { this.Cursor = Cursors.SizeWE; } else if (flag3 || flag4) { this.Cursor = Cursors.SizeNS; } else { this.Cursor = Cursors.Default; } } else { if ((this._locsel & Locate.Left) != Locate.None) { this.TrimLeft = e.X - 50; } if ((this._locsel & Locate.Right) != Locate.None) { this.TrimRight = e.X - 50; } if ((this._locsel & Locate.Top) != Locate.None) { this.TrimTop = e.Y - 50; } if ((this._locsel & Locate.Bottom) != Locate.None) { this.TrimBottom = e.Y - 50; } this.Refresh(); } }
public void DestroyGameObject(string[] values) { Locate.GetSceneObjects().Where(x => x.name == values[1]).ToList().ForEach(x => Destroy(x)); }
public void EnableGameObject(string[] values) { Locate.GetSceneObjects().Where(x => x.name == values[1]).ToList().ForEach(x => x.SetActive(true)); }
public void DrawProfileEdit() { if (this.uiState == InputUIState.EditProfile) { var profile = this.activeProfile; var group = this.groups[this.uiGroupIndex]; var action = group.actions[this.uiIndex]; var path = "@Main/InputUI/ProfileCreate/"; Locate.Find(path).SetActive(true); Locate.Find(path + "Text-Key").GetComponent <Text>().text = action.name; Locate.Find(path + "Text-Profile").GetComponent <Text>().text = "<size=100><color=#888888FF>" + profile.name + "</color></size>\nProfile"; Locate.Find(path + "Icon-Gamepad").SetActive(!action.helpImage.IsNull()); Locate.Find(path + "Icon-Gamepad/" + action.helpImage).SetActive(!action.helpImage.IsNull()); if (this.waitForRelease) { foreach (var key in this.lastInput.Keys.ToList()) { this.lastInput[key] = 0; } this.waitForRelease = this.waitForRelease && this.lastInput.Count != 0; } var progress = Locate.Find(path + "Image-Timer"); var highest = this.lastInput.OrderBy(x => x.Value).FirstOrDefault(); var timeHeld = highest.Key.IsEmpty() ? Time.Get() + InputManager.registerTime : highest.Value; var targetInput = this.lastInput.Where(x => Time.Get() > x.Value).FirstOrDefault(); progress.SetActive(highest.Value > 0); progress.GetComponent <Image>().fillAmount = InputManager.registerTime - (timeHeld - Time.Get()); if (!this.waitForRelease && !targetInput.Key.IsEmpty()) { this.waitForRelease = true; Locate.Find(path + "Icon-Gamepad/" + action.helpImage).SetActive(false); var inputName = targetInput.Key; string device = "Keyboard"; string groupName = group.name.ToPascalCase(); string actionName = action.name.ToPascalCase(); if (inputName.Contains("Joystick")) { int id = (int)Char.GetNumericValue(inputName.Remove("Joystick")[0]); device = this.joystickNames[id - 1]; inputName = inputName.ReplaceFirst(id.ToString(), "*"); } else if (inputName.Contains("Mouse")) { device = "Mouse"; } var existsText = Locate.Find(path + "Text-Exists"); var match = profile.mappings.collection.Where(x => x.Key.Contains(groupName + "-", true) && x.Value.Matches(inputName, true)).FirstOrDefault(); existsText.SetActive(!match.Key.IsEmpty()); if (!match.Key.IsEmpty()) { existsText.GetComponent <Text>().text = inputName.Remove("*") + " already mapped to : <color=#FF9999FF>" + match.Key.Split("-")[1] + "</color>"; return; } profile.requiredDevices.AddNew(device); profile.mappings[groupName + "-" + actionName] = inputName; this.uiIndex += 1; if (this.uiIndex >= group.actions.Count) { this.uiGroupIndex += 1; if (this.uiGroupIndex >= this.groups.Count) { profile.Save(); this.activeProfile = null; this.uiState = InputUIState.None; InputState.disabled = false; this.DelayEvent("On Profile Edited", 0); } } } } }
public void ToggleGameObject(string[] values) { Locate.GetSceneObjects().Where(x => x.name == values[1]).ToList().ForEach(x => x.SetActive(!x.activeInHierarchy)); }
private static void Step() { if (Class.complete) { return; } int index = Class.index; MeshFilter filter = Class.filters[index]; string updateMessage = "Mesh " + index + "/" + Class.meshCount; bool canceled = EditorUI.DrawProgressBar("Combining Meshes", updateMessage, ((float)index) / Class.meshCount); if (canceled) { Class.meshCount = 0; } else if (filter != null && filter.sharedMesh != null) { if ((Class.vertexCount + filter.sharedMesh.vertexCount) >= 65534) { Log.Show("[Combine Meshes] Added extra submesh due to vertices at " + Class.vertexCount); Class.StepLast(); Class.meshes.Add(new Mesh()); Class.subIndex = index; Class.vertexCount = 0; } Mesh currentMesh = filter.sharedMesh; if (filter.sharedMesh.subMeshCount > 1) { currentMesh = (Mesh)UnityEngine.Object.Instantiate(filter.sharedMesh); currentMesh.triangles = currentMesh.triangles; } Class.combines[index].mesh = currentMesh; Class.combines[index].transform = filter.transform.localToWorldMatrix; Class.vertexCount += currentMesh.vertexCount; if (Class.inline) { Component.DestroyImmediate(filter.gameObject.GetComponent <MeshRenderer>()); Component.DestroyImmediate(filter.gameObject.GetComponent <MeshFilter>()); } } Class.index += 1; if (Class.index >= Class.meshCount) { if (!canceled) { Class.StepLast(); //Material material = File.GetAsset<Material>("Baked.mat"); if (!Class.inline) { foreach (GameObject current in Class.selection) { GameObject target = (GameObject)GameObject.Instantiate(current); target.name = target.name.Replace("(Clone)", ""); target.transform.parent = Locate.GetScenePath("Scene-Combined").transform; MeshFilter[] filters = target.GetComponentsInChildren <MeshFilter>(); foreach (MeshFilter nullFilter in filters) { Component.DestroyImmediate(nullFilter.gameObject.GetComponent <MeshRenderer>()); Component.DestroyImmediate(nullFilter.gameObject.GetComponent <MeshFilter>()); } current.SetActive(false); } } bool singleRoot = Class.selection.Length == 1; string start = singleRoot ? Class.selection[0].name + "/" : ""; foreach (Mesh mesh in Class.meshes) { GameObject container = new GameObject("@Mesh" + Class.meshNumber); if (Class.inline && singleRoot) { container.transform.parent = Class.selection[0].transform; } else { container.transform.parent = Locate.GetScenePath("Scene-Combined/" + start).transform; } //MeshRenderer containerRenderer = container.AddComponent<MeshRenderer>(); MeshFilter containerFilter = container.AddComponent <MeshFilter>(); if (Class.path.IsEmpty()) { Class.path = EditorUtility.SaveFolderPanel("Combine Meshes", Application.dataPath, "").GetAssetPath(); } File.Create(path); ProxyEditor.CreateAsset(mesh, path + "/Combined" + meshNumber + ".asset"); containerFilter.mesh = mesh; //containerRenderer.material = new Material(material); Class.meshNumber += 1; } } TimeSpan span = TimeSpan.FromSeconds(Time.Get() - Class.time); string totalTime = span.Minutes + " minutes and " + span.Seconds + " seconds"; Log.Show("[Combine Meshes] Reduced " + Class.meshCount + " meshes to " + Class.meshes.Count + "."); Log.Show("[Combine Meshes] Completed in " + totalTime + "."); ProxyEditor.SaveAssets(); EditorUI.ClearProgressBar(); Class.complete = true; while (EditorApplication.update == Class.Step) { EditorApplication.update -= Class.Step; } } }
private static void MakeIndexPage(string OutputFolderPath, RecipeSource[] Recipes) { Console.WriteLine("Creating index page ..."); string categoryHeaderTemplate = "<div class='fs-1 mt-4' style='font-weight: 500;' id='{{ANCHOR}}'>" + " <a href='#{{ANCHOR}}' class='text-dark'>{{TITLE}}</a>" + "</div>" + "<div class='mb-3'>{{SUBTITLE}}</div>"; string recipeTemplate = "<div class='row py-3'>" + " <div class='col-4'>" + " <a href='{{RECIPEURL}}'><img src='{{IMAGEURL}}' style='max-width: 100%'></a>" + " </div>" + " <div class='col'>" + " <div class='fw-bold'><a href='{{RECIPEURL}}'>{{TITLE}}</a></div>" + " <div>{{DESCRIPTION}}</div>" + " </div>" + "</div>"; StringBuilder sb = new(); sb.AppendLine($"Generated by ScottPlot {ScottPlot.Plot.Version} on {DateTime.Now.ToShortDateString()} <br />"); // CATEGORY LIST sb.AppendLine("<h4>Customization</h4>"); sb.AppendLine("<ul>"); foreach (KeyValuePair <string, IRecipe[]> pair in Locate.GetCategorizedRecipes()) { if (pair.Value.First().Category.ToString() !.Contains("PlotType")) { continue; } ICategory category = pair.Value.First().Category; if (category.Name == "Miscellaneous" || category.Name == "Statistics") { continue; } sb.AppendLine($"<li><a href='#{GetAnchor(category)}'>{category.Name}</a> - {category.Description}</li>"); } sb.AppendLine("</ul>"); sb.AppendLine("<h4>Plot Types</h4>"); sb.AppendLine("<ul>"); foreach (KeyValuePair <string, IRecipe[]> pair in Locate.GetCategorizedRecipes()) { if (!pair.Value.First().Category.ToString() !.Contains("PlotType")) { continue; } ICategory category = pair.Value.First().Category; sb.AppendLine($"<li><a href='#{GetAnchor(category)}'>{category.Name}</a> - {category.Description}</li>"); } sb.AppendLine("</ul>"); sb.AppendLine("<h4>Additional Examples</h4>"); sb.AppendLine("<ul>"); foreach (KeyValuePair <string, IRecipe[]> pair in Locate.GetCategorizedRecipes()) { if (pair.Value.First().Category.ToString() !.Contains("PlotType")) { continue; } ICategory category = pair.Value.First().Category; if (category.Name == "Miscellaneous" || category.Name == "Statistics") { sb.AppendLine($"<li><a href='#{GetAnchor(category)}'>{category.Name}</a> - {category.Description}</li>"); } } sb.AppendLine("</ul>"); sb.AppendLine("<h4>Colors</h4>"); sb.AppendLine("<ul>"); sb.AppendLine("<li><a href='colors/'>Color</a> - Lists of colors in each color palette for representing categorical data</li>"); sb.AppendLine("<li><a href='colormaps/'>Colormaps</a> - Color gradients available to represent continuous data</li>"); sb.AppendLine("</ul>"); // SEPARATION sb.AppendLine("<hr class='my-5' />"); // EVERY RECIPE foreach (KeyValuePair <string, IRecipe[]> pair in Locate.GetCategorizedRecipes()) { ICategory category = pair.Value.First().Category; string categoryUrl = $"category/{category.Folder}/"; sb.AppendLine(categoryHeaderTemplate .Replace("{{ANCHOR}}", GetAnchor(category)) .Replace("{{TITLE}}", category.Name) .Replace("{{SUBTITLE}}", category.Description)); foreach (var recipe in Recipes.Where(x => x.CategoryFolder == category.Folder)) { sb.AppendLine(recipeTemplate .Replace("{{IMAGEURL}}", "images/" + recipe.ID.ToLower() + "_thumb.jpg") .Replace("{{RECIPEURL}}", categoryUrl + "#" + GetAnchor(recipe)) .Replace("{{TITLE}}", recipe.Title) .Replace("{{DESCRIPTION}}", recipe.Description)); } } Template.CreateMarkdownPage( mdFilePath: Path.Combine(OutputFolderPath, "index_.md"), body: sb.ToString(), title: "ScottPlot 4.1 Cookbook", description: "Example plots shown next to the code used to create them", url: "/cookbook/4.1/"); Template.CreateHtmlPage( filePath: Path.Combine(OutputFolderPath, "index.dev.html"), bodyHtml: sb.ToString().Replace("/#", "/index.dev.html#"), title: "ScottPlot 4.1 Cookbook", description: "Example plots shown next to the code used to create them"); }
public MySqlFunctionManager(bool allowFuncDefChange) { this.allowFuncDefChange = allowFuncDefChange; parsingStrateg["CAST"] = FunctionParsingStrategy.Cast; parsingStrateg["POSITION"] = FunctionParsingStrategy.Position; parsingStrateg["SUBSTR"] = FunctionParsingStrategy.Substring; parsingStrateg["SUBSTRING"] = FunctionParsingStrategy.Substring; parsingStrateg["TRIM"] = FunctionParsingStrategy.Trim; parsingStrateg["AVG"] = FunctionParsingStrategy.Avg; parsingStrateg["COUNT"] = FunctionParsingStrategy.Count; parsingStrateg["GROUP_CONCAT"] = FunctionParsingStrategy.GroupConcat; parsingStrateg["MAX"] = FunctionParsingStrategy.Max; parsingStrateg["MIN"] = FunctionParsingStrategy.Min; parsingStrateg["SUM"] = FunctionParsingStrategy.Sum; parsingStrateg["ROW"] = FunctionParsingStrategy.Row; parsingStrateg["CHAR"] = FunctionParsingStrategy.Char; parsingStrateg["CONVERT"] = FunctionParsingStrategy.Convert; parsingStrateg["EXTRACT"] = FunctionParsingStrategy.Extract; parsingStrateg["TIMESTAMPADD"] = FunctionParsingStrategy.Timestampadd; parsingStrateg["TIMESTAMPDIFF"] = FunctionParsingStrategy.Timestampdiff; parsingStrateg["GET_FORMAT"] = FunctionParsingStrategy.GetFormat; functionPrototype["ABS"] = new Abs(null); functionPrototype["ACOS"] = new Acos(null); functionPrototype["ADDDATE"] = new Adddate(null); functionPrototype["ADDTIME"] = new Addtime(null); functionPrototype["AES_DECRYPT"] = new AesDecrypt(null); functionPrototype["AES_ENCRYPT"] = new AesEncrypt(null); functionPrototype["ANALYSE"] = new Analyse(null); functionPrototype["ASCII"] = new Ascii(null); functionPrototype["ASIN"] = new Asin(null); functionPrototype["ATAN2"] = new Atan2(null); functionPrototype["ATAN"] = new Atan(null); functionPrototype["BENCHMARK"] = new Benchmark(null); functionPrototype["BIN"] = new Bin(null); functionPrototype["BIT_AND"] = new BitAnd(null); functionPrototype["BIT_COUNT"] = new BitCount(null); functionPrototype["BIT_LENGTH"] = new BitLength(null); functionPrototype["BIT_OR"] = new BitOR(null); functionPrototype["BIT_XOR"] = new BitXor(null); functionPrototype["CEIL"] = new Ceiling(null); functionPrototype["CEILING"] = new Ceiling(null); functionPrototype["CHAR_LENGTH"] = new CharLength(null); functionPrototype["CHARACTER_LENGTH"] = new CharLength(null); functionPrototype["CHARSET"] = new Charset(null); functionPrototype["COALESCE"] = new Coalesce(null); functionPrototype["COERCIBILITY"] = new Coercibility(null); functionPrototype["COLLATION"] = new Collation(null); functionPrototype["COMPRESS"] = new Compress(null); functionPrototype["CONCAT_WS"] = new ConcatWs(null); functionPrototype["CONCAT"] = new Concat(null); functionPrototype["CONNECTION_ID"] = new ConnectionId(null); functionPrototype["CONV"] = new Conv(null); functionPrototype["CONVERT_TZ"] = new ConvertTz(null); functionPrototype["COS"] = new Cos(null); functionPrototype["COT"] = new Cot(null); functionPrototype["CRC32"] = new Crc32(null); functionPrototype["CURDATE"] = new Curdate(); functionPrototype["CURRENT_DATE"] = new Curdate(); functionPrototype["CURRENT_TIME"] = new Curtime(); functionPrototype["CURTIME"] = new Curtime(); functionPrototype["CURRENT_TIMESTAMP"] = new Now(); functionPrototype["CURRENT_USER"] = new CurrentUser(); functionPrototype["CURTIME"] = new Curtime(); functionPrototype["DATABASE"] = new Database(null); functionPrototype["DATE_ADD"] = new DateAdd(null); functionPrototype["DATE_FORMAT"] = new DateFormat(null); functionPrototype["DATE_SUB"] = new DateSub(null); functionPrototype["DATE"] = new Date(null); functionPrototype["DATEDIFF"] = new Datediff(null); functionPrototype["DAY"] = new Dayofmonth(null); functionPrototype["DAYOFMONTH"] = new Dayofmonth(null); functionPrototype["DAYNAME"] = new Dayname(null); functionPrototype["DAYOFWEEK"] = new Dayofweek(null); functionPrototype["DAYOFYEAR"] = new Dayofyear(null); functionPrototype["DECODE"] = new Decode(null); functionPrototype["DEFAULT"] = new Default(null); functionPrototype["DEGREES"] = new Degrees(null); functionPrototype["DES_DECRYPT"] = new DesDecrypt(null); functionPrototype["DES_ENCRYPT"] = new DesEncrypt(null); functionPrototype["ELT"] = new Elt(null); functionPrototype["ENCODE"] = new Encode(null); functionPrototype["ENCRYPT"] = new Encrypt(null); functionPrototype["EXP"] = new Exp(null); functionPrototype["EXPORT_SET"] = new ExportSet(null); // functionPrototype.put("EXTRACT", new Extract(null)); functionPrototype["EXTRACTVALUE"] = new ExtractValue(null); functionPrototype["FIELD"] = new Field(null); functionPrototype["FIND_IN_SET"] = new FindInSet(null); functionPrototype["FLOOR"] = new Floor(null); functionPrototype["FORMAT"] = new Format(null); functionPrototype["FOUND_ROWS"] = new FoundRows(null); functionPrototype["FROM_DAYS"] = new FromDays(null); functionPrototype["FROM_UNIXTIME"] = new FromUnixtime(null); // functionPrototype.put("GET_FORMAT", new GetFormat(null)); functionPrototype["GET_LOCK"] = new GetLock(null); functionPrototype["GREATEST"] = new Greatest(null); functionPrototype["HEX"] = new Hex(null); functionPrototype["HOUR"] = new Hour(null); functionPrototype["IF"] = new IF(null); functionPrototype["IFNULL"] = new IFNull(null); functionPrototype["INET_ATON"] = new InetAton(null); functionPrototype["INET_NTOA"] = new InetNtoa(null); functionPrototype["INSERT"] = new Insert(null); functionPrototype["INSTR"] = new Instr(null); functionPrototype["INTERVAL"] = new Interval(null); functionPrototype["IS_FREE_LOCK"] = new IsFreeLock(null); functionPrototype["IS_USED_LOCK"] = new IsUsedLock(null); functionPrototype["ISNULL"] = new IsNull(null); functionPrototype["LAST_DAY"] = new LastDay(null); functionPrototype["LAST_INSERT_ID"] = new LastInsertId(null); functionPrototype["LCASE"] = new Lower(null); functionPrototype["LEAST"] = new Least(null); functionPrototype["LEFT"] = new Left(null); functionPrototype["LENGTH"] = new Length(null); functionPrototype["LN"] = new Log(null); // Ln(X) equals Log(X) functionPrototype["LOAD_FILE"] = new LoadFile(null); functionPrototype["LOCALTIME"] = new Now(); functionPrototype["LOCALTIMESTAMP"] = new Now(); functionPrototype["LOCATE"] = new Locate(null); functionPrototype["LOG10"] = new Log10(null); functionPrototype["LOG2"] = new Log2(null); functionPrototype["LOG"] = new Log(null); functionPrototype["LOWER"] = new Lower(null); functionPrototype["LPAD"] = new Lpad(null); functionPrototype["LTRIM"] = new Ltrim(null); functionPrototype["MAKE_SET"] = new MakeSet(null); functionPrototype["MAKEDATE"] = new Makedate(null); functionPrototype["MAKETIME"] = new Maketime(null); functionPrototype["MASTER_POS_WAIT"] = new MasterPosWait(null); functionPrototype["MD5"] = new Md5(null); functionPrototype["MICROSECOND"] = new Microsecond(null); functionPrototype["MID"] = new Substring(null); functionPrototype["MINUTE"] = new Minute(null); functionPrototype["MONTH"] = new Month(null); functionPrototype["MONTHNAME"] = new Monthname(null); functionPrototype["NAME_CONST"] = new NameConst(null); functionPrototype["NOW"] = new Now(); functionPrototype["NULLIF"] = new NullIF(null); functionPrototype["OCT"] = new Oct(null); functionPrototype["OCTET_LENGTH"] = new Length(null); functionPrototype["OLD_PASSWORD"] = new OldPassword(null); functionPrototype["ORD"] = new Ord(null); functionPrototype["PASSWORD"] = new Password(null); functionPrototype["PERIOD_ADD"] = new PeriodAdd(null); functionPrototype["PERIOD_DIFF"] = new PeriodDiff(null); functionPrototype["PI"] = new PI(null); functionPrototype["POW"] = new Pow(null); functionPrototype["POWER"] = new Pow(null); functionPrototype["QUARTER"] = new Quarter(null); functionPrototype["QUOTE"] = new Quote(null); functionPrototype["RADIANS"] = new Radians(null); functionPrototype["RAND"] = new Rand(null); functionPrototype["RELEASE_LOCK"] = new ReleaseLock(null); functionPrototype["REPEAT"] = new Repeat(null); functionPrototype["REPLACE"] = new Replace(null); functionPrototype["REVERSE"] = new Reverse(null); functionPrototype["RIGHT"] = new Right(null); functionPrototype["ROUND"] = new Round(null); functionPrototype["ROW_COUNT"] = new RowCount(null); functionPrototype["RPAD"] = new Rpad(null); functionPrototype["RTRIM"] = new Rtrim(null); functionPrototype["SCHEMA"] = new Database(null); functionPrototype["SEC_TO_TIME"] = new SecToTime(null); functionPrototype["SECOND"] = new Second(null); functionPrototype["SESSION_USER"] = new User(null); functionPrototype["SHA1"] = new Sha1(null); functionPrototype["SHA"] = new Sha1(null); functionPrototype["SHA2"] = new Sha2(null); functionPrototype["SIGN"] = new Sign(null); functionPrototype["SIN"] = new Sin(null); functionPrototype["SLEEP"] = new Sleep(null); functionPrototype["SOUNDEX"] = new Soundex(null); functionPrototype["SPACE"] = new Space(null); functionPrototype["SQRT"] = new Sqrt(null); functionPrototype["STD"] = new Std(null); functionPrototype["STDDEV_POP"] = new StdDevPop(null); functionPrototype["STDDEV_SAMP"] = new StdDevSamp(null); functionPrototype["STDDEV"] = new StdDev(null); functionPrototype["STR_TO_DATE"] = new StrToDate(null); functionPrototype["STRCMP"] = new Strcmp(null); functionPrototype["SUBDATE"] = new Subdate(null); functionPrototype["SUBSTRING_INDEX"] = new SubstringIndex(null); functionPrototype["SUBTIME"] = new Subtime(null); functionPrototype["SYSDATE"] = new Sysdate(null); functionPrototype["SYSTEM_USER"] = new User(null); functionPrototype["TAN"] = new Tan(null); functionPrototype["TIME_FORMAT"] = new TimeFormat(null); functionPrototype["TIME_TO_SEC"] = new TimeToSec(null); functionPrototype["TIME"] = new Time(null); functionPrototype["TIMEDIFF"] = new Timediff(null); functionPrototype["TIMESTAMP"] = new Timestamp(null); // functionPrototype.put("TIMESTAMPADD", new Timestampadd(null)); // functionPrototype.put("TIMESTAMPDIFF", new Timestampdiff(null)); functionPrototype["TO_DAYS"] = new ToDays(null); functionPrototype["TO_SECONDS"] = new ToSeconds(null); functionPrototype["TRUNCATE"] = new Truncate(null); functionPrototype["UCASE"] = new Upper(null); functionPrototype["UNCOMPRESS"] = new Uncompress(null); functionPrototype["UNCOMPRESSED_LENGTH"] = new UncompressedLength(null); functionPrototype["UNHEX"] = new Unhex(null); functionPrototype["UNIX_TIMESTAMP"] = new UnixTimestamp(null); functionPrototype["UPDATEXML"] = new UpdateXml(null); functionPrototype["UPPER"] = new Upper(null); functionPrototype["USER"] = new User(null); functionPrototype["UTC_DATE"] = new UtcDate(null); functionPrototype["UTC_TIME"] = new UtcTime(null); functionPrototype["UTC_TIMESTAMP"] = new UtcTimestamp(null); functionPrototype["UUID_SHORT"] = new UuidShort(null); functionPrototype["UUID"] = new Uuid(null); functionPrototype["VALUES"] = new Values(null); functionPrototype["VAR_POP"] = new VarPop(null); functionPrototype["VAR_SAMP"] = new VarSamp(null); functionPrototype["VARIANCE"] = new Variance(null); functionPrototype["VERSION"] = new Version(null); functionPrototype["WEEK"] = new Week(null); functionPrototype["WEEKDAY"] = new Weekday(null); functionPrototype["WEEKOFYEAR"] = new Weekofyear(null); functionPrototype["YEAR"] = new Year(null); functionPrototype["YEARWEEK"] = new Yearweek(null); }
private void SetupTextOverMap(Battle battle, double timeLeft, MapSettings settings) { Color color = settings.TextMapColor; Locate locate = new Locate(PictureBox.Width, PictureBox.Height); if (settings.ShowLifeSeconds) { TimerLabel.ForeColor = color; TimerLabel.Parent = PictureBox; TimerLabel.Visible = true; locate.BottomCenter(TimerLabel, 20); } if (settings.ShowLevelName || settings.ShowDesigner) { HeaderLabel.ForeColor = color; HeaderLabel.Parent = PictureBox; HeaderLabel.Visible = true; StringBuilder text = new StringBuilder(); if (settings.ShowLevelName) text.Append(battle.Name); if (settings.ShowDesigner) text.Append(" by " + battle.Desginer); HeaderLabel.Text = text.ToString(); HeaderLabel.MaximumSize = new Size(PictureBox.Width, PictureBox.Height); locate.BottomRight(HeaderLabel, 5); } if (settings.ShowType) { TypeLabel.ForeColor = color; TypeLabel.Parent = PictureBox; TypeLabel.Visible = true; TypeLabel.Text = EnumExtensions.GetDescription(battle.Type); locate.BottomLeft(TypeLabel, 5); } if (settings.ShowAttributes) { AttributesLabel.ForeColor = color; AttributesLabel.Parent = PictureBox; AttributesLabel.Visible = true; List<string> attributes = new List<string>(); foreach (BattleAttribute att in EnumExtensions.GetFlags(battle.Attributes)) attributes.Add(EnumExtensions.GetDescription(att)); AttributesLabel.Text = Util.FirstCharToUpper(string.Join(", ", attributes).ToLower()); AttributesLabel.MaximumSize = new Size(PictureBox.Width, PictureBox.Height); int margin = AttributesLabel.Height + 2; locate.BottomCenter(AttributesLabel, 20); locate.MoveUp(TimerLabel, margin); } // Check for collisions. if ((settings.ShowDesigner || settings.ShowLevelName) && settings.ShowType && HeaderLabel.Width > PictureBox.Width - TypeLabel.Width - 10) { locate.ToLeft(HeaderLabel, 5); locate.MoveUp(TypeLabel, HeaderLabel.Height + 2); locate.MoveUp(TimerLabel, HeaderLabel.Height + 2); if (settings.ShowAttributes) { locate.BottomRight(AttributesLabel, 5); locate.MoveUp(AttributesLabel, HeaderLabel.Height + 2); locate.BottomRight(TimerLabel, 5); locate.MoveUp(TimerLabel, AttributesLabel.Height + HeaderLabel.Height + TypeLabel.Height + 2 ); if (AttributesLabel.Width > PictureBox.Width - TypeLabel.Width - 10) { locate.ToLeft(AttributesLabel, 5); locate.MoveUp(TypeLabel, AttributesLabel.Height + 2); } } else if (settings.ShowLifeSeconds && TimerLabel.Location.Y + TimerLabel.Height > HeaderLabel.Location.Y) { // Timer is over Header, take out designer to fit everything. if (!showOnlyTimerAndType) { showOnlyTimerAndType = true; HeaderLabel.Visible = false; settings.ShowDesigner = false; tooSmallMap = true; SetupTextOverMap(battle, timeLeft, settings); } } } // Check if important information is not shown. if (settings.ShowLifeSeconds) { if (TimerLabel.Location.Y < 0) { if (!tooSmallMap) { tooSmallMap = true; AttributesLabel.Visible = false; settings.ShowAttributes = false; SetupTextOverMap(battle, timeLeft, settings); } else { HeaderLabel.Visible = false; locate.BottomRight(TimerLabel, 5); if (settings.ShowType) locate.BottomLeft(TypeLabel, 5); } } } }
public static void SetDirty() { LocateEvents.BuildComponents(); Locate.SetDirty(); }