public new void Start() { base.Start(); var trackObjects = Resources.LoadAll(ResourcesLoader.Track_Objects, typeof(GameObject)).Cast <GameObject>(); buttons = new List <Button>(); foreach (var obj in trackObjects) { var trackObj = obj.GetComponent <TrackObject>(); var gameObj = new GameObject(); gameObj.transform.SetParent(transform, false); gameObj.AddComponent <RectTransform>(); gameObj.GetComponent <RectTransform>().sizeDelta = new Vector2(10, 10); var button = gameObj.AddComponent <Button>(); var image = gameObj.AddComponent <Image>(); button.targetGraphic = image; image.sprite = obj.GetComponent <TrackObject>().Icon; button.onClick.AddListener(() => { CursorEditor.CreateNewObject(ResourcesLoader.LoadTrackObject(trackObj.ID)); buttonsRect.gameObject.SetActive(false); CursorEditorUI.Exit(); }); buttons.Add(button); } }
public void Init(CursorEditor editorCursor) { this.editorCursor = editorCursor; SubmitButton.text = editorCursor.ControlScheme.Submit.ToString(); CopyButton.text = editorCursor.ControlScheme.Duplicate.ToString(); DeleteButton.text = editorCursor.ControlScheme.Delete.ToString(); }
private void RePopulateTreeView() { _guiController.ProjectTree.RemoveAllChildNodes(this, TOP_LEVEL_COMMAND_ID); _guiController.ProjectTree.StartFromNode(this, TOP_LEVEL_COMMAND_ID); foreach (MouseCursor item in _agsEditor.CurrentGame.Cursors) { _guiController.ProjectTree.AddTreeLeaf(this, GetNodeID(item), item.ID.ToString() + ": " + item.Name, "CursorIcon"); } if (_documents.ContainsValue(_guiController.ActivePane)) { CursorEditor editor = (CursorEditor)_guiController.ActivePane.Control; _guiController.ProjectTree.SelectNode(this, GetNodeID(editor.ItemToEdit)); } else if (_agsEditor.CurrentGame.Cursors.Count > 0) { _guiController.ProjectTree.SelectNode(this, "Cur0"); } }
public void CursorEditor_EditValue_ValidProvider_ReturnsValue(object value) { var editor = new CursorEditor(); var mockEditorService = new Mock <IWindowsFormsEditorService>(MockBehavior.Strict); var mockServiceProvider = new Mock <IServiceProvider>(MockBehavior.Strict); mockServiceProvider .Setup(p => p.GetService(typeof(IWindowsFormsEditorService))) .Returns(mockEditorService.Object) .Verifiable(); mockEditorService .Setup(e => e.DropDownControl(It.IsAny <Control>())) .Verifiable(); Assert.Equal(value, editor.EditValue(null, mockServiceProvider.Object, value)); mockServiceProvider.Verify(p => p.GetService(typeof(IWindowsFormsEditorService)), Times.Once()); mockEditorService.Verify(e => e.DropDownControl(It.IsAny <Control>()), Times.Once()); // Edit again. Assert.Equal(value, editor.EditValue(null, mockServiceProvider.Object, value)); mockServiceProvider.Verify(p => p.GetService(typeof(IWindowsFormsEditorService)), Times.Exactly(2)); mockServiceProvider.Verify(p => p.GetService(typeof(IWindowsFormsEditorService)), Times.Exactly(2)); }
public void CursorEditor_GetPaintValueSupported_Invoke_ReturnsFalse(ITypeDescriptorContext context) { var editor = new CursorEditor(); Assert.False(editor.GetPaintValueSupported(context)); }
public void CursorEditor_GetEditStyle_Invoke_ReturnsModal(ITypeDescriptorContext context) { var editor = new CursorEditor(); Assert.Equal(UITypeEditorEditStyle.DropDown, editor.GetEditStyle(context)); }
public void CursorEditor_EditValue_InvalidProvider_ReturnsValue(IServiceProvider provider, object value) { var editor = new CursorEditor(); Assert.Same(value, editor.EditValue(null, provider, value)); }
public void CursorEditor_Ctor_Default() { var editor = new CursorEditor(); Assert.True(editor.IsDropDownResizable); }
protected void Awake() { CursorEditor = GetComponentInParent <CursorEditor>(); buttons = new List <Button>(GetComponentsInChildren <Button>()); }
private void Awake() { terrainHeightEditor = GetComponentInChildren <TerrainEditorTools>(); brushRendererMesh = BrushRenderer.GetComponent <MeshFilter>(); cursorEditor = GetComponentInParent <CursorEditor>(); }
public void EditCheckpoints() { CursorEditor.CreateCheckpoint(); CursorEditorUI.Exit(); }
public void EditWaypoints() { CursorEditor.CreateWaypoint(); CursorEditorUI.Exit(); }