public ScriptView(ScriptsConfiguration config, Action drawHackGuiAction, Action saveAssetAction) { ScriptModified = false; this.config = config; this.saveAssetAction = saveAssetAction; CustomStyleSheet = config.CustomStyleSheet; ViewRange = new IntRange(0, config.VisualEditorPageLength - 1); styleSheets.Add(StyleSheet); if (CustomStyleSheet != null) { styleSheets.Add(CustomStyleSheet); } Add(new IMGUIContainer(drawHackGuiAction)); Add(new IMGUIContainer(() => MonitorKeys(null))); RegisterCallback <KeyDownEvent>(MonitorKeys); linesContainer = new VisualElement(); Add(linesContainer); paginationView = new PaginationView(SelectNextPage, SelectPreviousPage); paginationView.style.display = DisplayStyle.None; Add(paginationView); infoLabel = new Label("Loading, please wait..."); infoLabel.name = "InfoLabel"; Add(infoLabel); new ContextualMenuManipulator(ContextMenu).target = this; }
public ScriptView(ScriptsConfiguration config, Action drawHackGuiAction, Action saveAssetAction) { ScriptModified = false; this.config = config; this.saveAssetAction = saveAssetAction; editorResources = EditorResources.LoadOrDefault(); ViewRange = new IntRange(0, config.EditorPageLength - 1); styleSheets.Add(StyleSheet); if (EditorGUIUtility.isProSkin) { styleSheets.Add(DarkStyleSheet); } CustomStyleSheet = config.EditorCustomStyleSheet; if (CustomStyleSheet) { styleSheets.Add(CustomStyleSheet); } var commentItem = new SearcherItem("Comment"); var labelItem = new SearcherItem("Label"); var genericTextItem = new SearcherItem("Generic Text", config.InsertLineKey != KeyCode.None ? $"{(config.InsertLineModifier != EventModifiers.None ? $"{config.InsertLineModifier}+" : string.Empty)}{config.InsertLineKey}" : null); var commandsItem = new SearcherItem("Commands"); foreach (var commandId in Command.CommandTypes.Keys.OrderBy(k => k)) { commandsItem.AddChild(new SearcherItem(char.ToLowerInvariant(commandId[0]) + commandId.Substring(1))); } searchItems = new List <SearcherItem> { commandsItem, genericTextItem, labelItem, commentItem }; Add(new IMGUIContainer(drawHackGuiAction)); Add(new IMGUIContainer(() => HandleKeyDownEvent(null))); linesContainer = new VisualElement(); Add(linesContainer); paginationView = new PaginationView(SelectNextPage, SelectPreviousPage); paginationView.style.display = DisplayStyle.None; Add(paginationView); infoLabel = new Label("Loading, please wait..."); infoLabel.name = "InfoLabel"; ColorUtility.TryParseHtmlString(EditorGUIUtility.isProSkin ? "#cccccc" : "#555555", out var color); infoLabel.style.color = color; Add(infoLabel); RegisterCallback <KeyDownEvent>(HandleKeyDownEvent, TrickleDown.TrickleDown); RegisterCallback <MouseDownEvent>(HandleMouseDownEvent, TrickleDown.TrickleDown); new ContextualMenuManipulator(ContextMenu).target = this; }