Пример #1
0
    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);
        }
    }
Пример #2
0
    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();
    }
Пример #3
0
        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");
            }
        }
Пример #4
0
        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));
        }
Пример #5
0
        public void CursorEditor_GetPaintValueSupported_Invoke_ReturnsFalse(ITypeDescriptorContext context)
        {
            var editor = new CursorEditor();

            Assert.False(editor.GetPaintValueSupported(context));
        }
Пример #6
0
        public void CursorEditor_GetEditStyle_Invoke_ReturnsModal(ITypeDescriptorContext context)
        {
            var editor = new CursorEditor();

            Assert.Equal(UITypeEditorEditStyle.DropDown, editor.GetEditStyle(context));
        }
Пример #7
0
        public void CursorEditor_EditValue_InvalidProvider_ReturnsValue(IServiceProvider provider, object value)
        {
            var editor = new CursorEditor();

            Assert.Same(value, editor.EditValue(null, provider, value));
        }
Пример #8
0
        public void CursorEditor_Ctor_Default()
        {
            var editor = new CursorEditor();

            Assert.True(editor.IsDropDownResizable);
        }
Пример #9
0
 protected void Awake()
 {
     CursorEditor = GetComponentInParent <CursorEditor>();
     buttons      = new List <Button>(GetComponentsInChildren <Button>());
 }
Пример #10
0
 private void Awake()
 {
     terrainHeightEditor = GetComponentInChildren <TerrainEditorTools>();
     brushRendererMesh   = BrushRenderer.GetComponent <MeshFilter>();
     cursorEditor        = GetComponentInParent <CursorEditor>();
 }
Пример #11
0
 public void EditCheckpoints()
 {
     CursorEditor.CreateCheckpoint();
     CursorEditorUI.Exit();
 }
Пример #12
0
 public void EditWaypoints()
 {
     CursorEditor.CreateWaypoint();
     CursorEditorUI.Exit();
 }