コード例 #1
0
        /// <summary>
        /// Changes the active visual tool in composite visual tool.
        /// </summary>
        /// <param name="compositeVisualTool">The composite visual tool.</param>
        /// <param name="activeTool">The active tool.</param>
        /// <returns>
        /// <b>True</b> if active visual tool is changed; otherwise, <b>false</b>.
        /// </returns>
        private bool ChangeActiveTool(CompositeVisualTool compositeVisualTool, VisualTool activeTool)
        {
            if (activeTool == null)
            {
                compositeVisualTool.ActiveTool = null;

                return(true);
            }
            else
            {
                foreach (VisualTool tool in compositeVisualTool)
                {
                    if (tool == activeTool)
                    {
                        compositeVisualTool.ActiveTool = activeTool;
                        return(true);
                    }
                    else if (tool is CompositeVisualTool)
                    {
                        CompositeVisualTool nestedCompositeTool = (CompositeVisualTool)tool;

                        if (ChangeActiveTool(nestedCompositeTool, activeTool))
                        {
                            compositeVisualTool.ActiveTool = nestedCompositeTool;
                            return(true);
                        }
                    }
                }

                return(false);
            }
        }
コード例 #2
0
        private IEnumerator ActivateAegisOfZeusCoroutine()
        {
            Visual.instance.disableInput(true);
            float             timeMovement    = Const.mediumCardTimeMovement;
            HelmOfHadesTarget targetcomponent = target.GetComponent <HelmOfHadesTarget>();

            HelmOfHadesTarget[] targetsarray = GameObject.FindObjectsOfType <HelmOfHadesTarget>();
            foreach (var VARIABLE in targetsarray)
            {
                if (VARIABLE != targetcomponent)
                {
                    GameObject.DestroyImmediate(VARIABLE);
                }
            }



            HelmOfHadesActivated[] arractivated = GameObject.FindObjectsOfType <HelmOfHadesActivated>();
            HelmOfHadesActivated   activated    = arractivated[0];
            OneCardManager         helmcm       = activated.GetComponent <OneCardManager>();


            VisualTool.DiscardCardToWinningPile(helmcm);
            VisualTool.DiscardCardToDiscardPile(target);

            GameLogicEvents.eventUpdateCurrentEncounter.Invoke();
            GameLogicEvents.eventUpdateLossCounter.Invoke();

            yield return(Const.mediumCardTimeMovement + EndTurn.SmallAmountOfTime);

            VisualTool.SwitchAllControls(true);
            Visual.instance.disableInput(false);
            Command.CommandExecutionComplete();
        }
コード例 #3
0
        public bool Clicked(VisualTool Tool, double Zoom, Double Xpos, Double Ypos)
        {
            Xpos = Xpos / Zoom;
            Ypos = Ypos / Zoom;

            Object oldSelection = m_selection;

            m_selection = null;

            foreach (GNode gnode in m_GNodes.Values)
            {
                if (gnode.Clicked(Tool, oldSelection == gnode, Zoom, Xpos, Ypos))
                {
                    m_selection = gnode;
                }
            }

            foreach (GNode gnode in m_GNodes.Values)
            {
                Dictionary <GNode, List <GConnection> > conns = m_Connections.From(gnode);
                foreach (GNode to in conns.Keys)
                {
                    foreach (GConnection c in conns[to])
                    {
                        if (c.Clicked(Tool, oldSelection == c, Zoom, Xpos, Ypos))
                        {
                            m_selection = c;
                        }
                    }
                }
            }

            return(m_selection != null);
        }
コード例 #4
0
    public void Activate()
    {
        VisualTool.SwitchAllControls(false);
        GameLogicEvents.eventCardVisual.Invoke(this.GetComponent <OneCardManager>());

        activated = true;
        ActivateTargets();
    }
コード例 #5
0
    public void OnPointerDown(PointerEventData eventData)
    {
        AegisOfZeusTarget.DeactivateTargets();
        VisualTool.SwitchAllControls(true);
        List <OneCardManager> enclist = Visual.instance.GetCurrentEncounter();

        this.enabled = false;
        HighlightCardManager();
    }
コード例 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VisualToolAction"/> class.
 /// </summary>
 /// <param name="visualTool">The visual tool.</param>
 /// <param name="text">The action text.</param>
 /// <param name="toolTip">The action tool tip.</param>
 /// <param name="icon">The action icon.</param>
 /// <param name="subActions">The sub-actions of the action.</param>
 public VisualToolAction(
     VisualTool visualTool,
     string text,
     string toolTip,
     Image icon,
     params VisualToolAction[] subActions)
     : this(visualTool, text, toolTip, icon, true, subActions)
 {
 }
コード例 #7
0
 public static void DeactivateTargets()
 {
     ApolloBowTarget[] comparray = GameObject.FindObjectsOfType <ApolloBowTarget>();
     foreach (var VARIABLE in comparray)
     {
         GameObject.DestroyImmediate(VARIABLE);
     }
     VisualTool.SwitchAllControls(true);
     MessageManager.Instance.Hide();
 }
コード例 #8
0
        public void MouseMoved(VisualTool Tool, Double Zoom, Double newX, Double newY)
        {
            newX = newX / Zoom;
            newY = newY / Zoom;

            if (m_selection != null)
            {
                m_selection.Move(Tool, (int)(newX - m_selection.MouseOffset.X), (int)(newY - m_selection.MouseOffset.Y));
            }
        }
コード例 #9
0
 public void Activate()
 {
     VisualTool.SwitchAllControls(false);
     GameLogicEvents.eventCardVisual.Invoke(this.GetComponent <OneCardManager>());
     activated = true;
     CardListChooser.instance.FillByCards(Game.instance.winningPile);
     CardListChooser.instance.Show();
     CardListChooser.instance.AddComponentToCards <OrpheusLyreActivatedTarget>();
     MessageManager.Instance.ShowMessage(LocalizationManager.Localize("chooseCardOrpheusLyre"), 10);
 }
コード例 #10
0
        public abstract void Draw(Graphics gr, bool selected, Double Zoom, Int32 Xpos, Int32 Ypos, Int32 Width, Int32 Height); // abstraktna funkciq, koqto iz4ertava obekta na ekrana. Definira se ot vseki obekt koito nasledqva Element

        public virtual bool Clicked(VisualTool Tool, bool selected, Double Zoom, Double Xpos, Double Ypos)                     // proverqva dali to4ka s koortinadi x,y leji vurhu obekta
        {
            bool clicked = BoundingBox().Contains((int)Xpos, (int)Ypos);

            if (clicked)
            {
                m_mouseOffset.X = (float)Xpos - X;
                m_mouseOffset.Y = (float)Ypos - Y;
            }
            return(clicked);
        }
コード例 #11
0
        public void MouseUp(VisualTool Tool)
        {
            if (Tool == VisualTool.Connect && Connecting != null)
            {
                if (Connecting.Start != EndPoint && Connecting.End != EndPoint)
                {
                    m_Connections.Add(Connecting);
                }

                Connecting = null;
            }
        }
コード例 #12
0
        /// <summary>
        /// Returns the UI actions of visual tool.
        /// </summary>
        /// <param name="visualTool">The visual tool.</param>
        /// <param name="uiActions">The list of UI actions supported by the current visual tool.</param>
        /// <returns>
        /// <b>true</b> - UI actions are found; otherwise, <b>false</b>.
        /// </returns>
        public static bool TryGetCurrentToolActions(
            VisualTool visualTool,
            out IList <UIAction> uiActions)
        {
            uiActions = null;
            ISupportUIActions currentToolWithUIActions = visualTool as ISupportUIActions;

            if (currentToolWithUIActions != null)
            {
                uiActions = currentToolWithUIActions.GetSupportedUIActions();
            }

            return(uiActions != null);
        }
コード例 #13
0
    private IEnumerator ActivateEffectCoroutine()
    {
        Visual.instance.disableInput(true);
        float firstTimeDuration = .7f;

        GameLogicEvents.eventCardVisual.Invoke(this.activatedCard);
        GameLogicEvents.eventNewEffect.Invoke(this.activatedCard.cardAsset.effecttype);
        yield return(new WaitForSeconds(firstTimeDuration));

        VisualTool.DiscardCardToWinningPile(this.activatedCard);
        yield return(new WaitForSeconds(.2f));

        Visual.instance.disableInput(false);
    }
コード例 #14
0
        /// <summary>
        /// Starts the preview.
        /// </summary>
        public void StartPreview()
        {
            // if current tool is CustomSelectionTool
            if (_viewer.VisualTool is CustomSelectionTool)
            {
                CustomSelectionTool selectionTool = (CustomSelectionTool)_viewer.VisualTool;
                RectangleF          selectionBBox = RectangleF.Empty;
                if (selectionTool.Selection != null)
                {
                    selectionBBox = selectionTool.Selection.GetBoundingBox();
                }
                if (selectionBBox.Width >= 1 && selectionBBox.Height >= 1)
                {
                    _selectionRegionView          = selectionTool.Selection.View;
                    _processedSelectionRegionView = new SelectionRegionViewWithImageProcessingPreview();
                    _processedSelectionRegionView.UseViewerZoomForProcessing = UseCurrentViewerZoomWhenPreviewProcessing;
                    selectionTool.Selection.View = _processedSelectionRegionView;
                    _isPreviewStarted            = true;
                    return;
                }
            }

            // set current tool to ImageProcessingTool
            _viewerTool         = _viewer.VisualTool;
            _rectangularPreview = new ImageProcessingTool();
            Rectangle imageRect = new System.Drawing.Rectangle(0, 0, _viewer.Image.Width, _viewer.Image.Height);
            Rectangle rect      = imageRect;

            if (_viewer.VisualTool is RectangularSelectionTool)
            {
                RectangularSelectionTool rectangularSelection = (RectangularSelectionTool)_viewer.VisualTool;
                if (!rectangularSelection.Rectangle.Size.IsEmpty)
                {
                    if (_viewer.VisualTool is RectangularSelectionToolWithCopyPaste)
                    {
                        rect = rectangularSelection.Rectangle;
                    }
                    _rectangularSelectionToolRect = rectangularSelection.Rectangle;
                }
            }
            _rectangularPreview.UseViewerZoomForPreviewProcessing = UseCurrentViewerZoomWhenPreviewProcessing;
            _viewer.VisualTool            = _rectangularPreview;
            _rectangularPreview.Rectangle = rect;
            if (rect == imageRect)
            {
                _rectangularPreview.InteractionController = null;
            }
            _isPreviewStarted = true;
        }
コード例 #15
0
    public void FillByCards(List <CardManager.Card> cards)
    {
        VisualTool.RemoveChildrensFromTransform(CardListContent.transform);

        foreach (CardManager.Card VARIABLE in cards)

        {
            GameObject    slot      = Instantiate(Visual.instance.prefabBasicRect, CardListContent.transform);
            RectTransform transform = slot.GetComponent <RectTransform>();
            VisualTool.SetAnchorPreset(transform);

            GameObject cmObject = OneCardManager.CreateOneCardManager(VARIABLE, slot);
            VisualTool.SetAnchorPreset(cmObject.GetComponent <RectTransform>());
        }
    }
コード例 #16
0
    public static void ActivateTargets()
    {
        VisualTool.SwitchAllControls(false);
        List <OneCardManager> enclist = Visual.instance.GetCurrentEncounter();

        foreach (OneCardManager cm in enclist)
        {
            if (cm.cardAsset.type == CardType.monster)
            {
                cm.gameObject.AddComponent <HelmOfHadesTarget>();
            }
        }

        MessageManager.Instance.ShowMessage(LocalizationManager.Localize("choosemonstertoignoredeadliness"), 2);
    }
コード例 #17
0
    public static void ActivateTargets()
    {
        VisualTool.SwitchAllControls(false);

        List <OneCardManager> enclist = Visual.instance.GetCurrentEncounter();

        foreach (OneCardManager cm in enclist)
        {
            if (cm.cardAsset.resolved == ResolvedType.notresolved && (GameLogic.cardIsMonsterOrTreasure(cm.cardAsset)))
            {
                cm.gameObject.AddComponent <ApolloBowTarget>();
            }
        }

        MessageManager.Instance.ShowMessage(LocalizationManager.Localize("chooseapollobowtarget"), 2);
    }
コード例 #18
0
        private IEnumerator ActivateOrpheusLyreCoroutine()
        {
            Visual.instance.disableInput(true);
            float          timeMovement  = Const.mediumCardTimeMovement;
            OneCardManager orpheusLyreCM =
                Visual.instance.GetOneCardManagerByName(Const.orpheuslyre, Visual.instance.TreasureHand.transform);

            VisualTool.DiscardCardToDiscardPile(target);
            VisualTool.DiscardCardToWinningPile(orpheusLyreCM);

            yield return(Const.mediumCardTimeMovement + EndTurn.SmallAmountOfTime);

            CardListChooser.instance.Hide();
            VisualTool.SwitchAllControls(true);
            Visual.instance.disableInput(false);
            Command.CommandExecutionComplete();
        }
コード例 #19
0
        private IEnumerator ActivateApolloBowTargetCoroutine()
        {
            Visual.instance.disableInput(true);
            float          timeMovement = Const.mediumCardTimeMovement;
            OneCardManager apolloBowCM  = Visual.instance.GetOneCardManagerByName(Const.apollobow, Visual.instance.TreasureHand.transform);

            GameLogicModifyGame.ApolloBowEffect(target.cardAsset);
            target.ReadCardFromAsset();
            VisualTool.DiscardCardToDiscardPile(apolloBowCM, 0);

            yield return(timeMovement + EndTurn.SmallAmountOfTime);

            ApolloBowActivated.DeactivateTargets();
            VisualTool.SwitchAllControls(true);
            Visual.instance.disableInput(false);

            Command.CommandExecutionComplete();
        }
コード例 #20
0
        /// <summary>
        /// Returns the UI action of the visual tool.
        /// </summary>
        /// <param name="visualTool">Visual tool.</param>
        /// <returns>The UI action of the visual tool.</returns>
        public static T GetUIAction <T>(VisualTool visualTool)
            where T : UIAction
        {
            IList <UIAction> uiActions = null;

            // if visual tool has actions
            if (TryGetCurrentToolActions(visualTool, out uiActions))
            {
                // for each action in list
                foreach (UIAction uiAction in uiActions)
                {
                    if (uiAction is T)
                    {
                        return((T)uiAction);
                    }
                }
            }
            return(default(T));
        }
コード例 #21
0
ファイル: GNodeSubprocess.cs プロジェクト: Gefix/Ilnet
        public override bool Clicked(VisualTool Tool, bool selected, Double Zoom, Double Xpos, Double Ypos)
        {
            bool clicked = base.Clicked(Tool, selected, Zoom, Xpos, Ypos);

            m_selectedPort = "";
            if (clicked)
            {
                foreach (KeyValuePair <string, RectangleF> kvp in m_ports)
                {
                    if (kvp.Value.Contains((float)Xpos, (float)Ypos))
                    {
                        m_selectedPort = kvp.Key;
                        break;
                    }
                }
            }

            return(clicked);
        }
コード例 #22
0
        private IEnumerator MoveCardsOutsideFromDeckCoroutine()
        {
            yield return(new WaitForSeconds(.01f));

            Visual.instance.CardDeckFrame.gameObject.SetActive(true);

            OneCardManager[] cards = Visual.instance.CardPointOutside.GetComponentsInChildren <OneCardManager>();
            foreach (OneCardManager cardmanager in cards)
            {
                GameObject cardObject = cardmanager.gameObject;
                // int cardindex = Array.IndexOf(cards, cardmanager);
                //SetCanvasOrderInObject(cardObject, cardindex);


                VisualTool.MoveCardToAnotherParentNoSequence(cardObject, Visual.instance.CardDeckFrame.transform, TimeMovement);
                yield return(new WaitForSeconds(SmallAmountOfTime));
            }
            yield return(new WaitForSeconds(TimeMovement + SmallAmountOfTime));

            Command.CommandExecutionComplete();
        }
コード例 #23
0
        public static IEnumerator PansFluteEffectCoroutine()
        {
            //int numberofdiscard=Math.Min(2,Visual.instance.GetCurrentDeck().Count)
            yield return(new WaitForSeconds(.01f));

            float firstMoveDuration        = .35f;
            List <OneCardManager> decklist = Visual.instance.GetCurrentDeck();
            int discardNumber = Math.Min(2, decklist.Count);

            for (int i = 0; i < discardNumber; i++)
            {
                OneCardManager cm = decklist[decklist.Count - i - 1];


                yield return(new WaitForSeconds(.1f));

                cm.transform.DOMove(Visual.instance.CardPointShuffle.transform.position, firstMoveDuration);
                yield return(new WaitForSeconds(.05f));

                VisualTool.DiscardCardToDiscardPile(cm, firstMoveDuration);
            }
            yield return(new WaitForSeconds(firstMoveDuration * 3));
        }
コード例 #24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="VisualToolAction"/> class.
        /// </summary>
        /// <param name="visualTool">The visual tool.</param>
        /// <param name="text">The action text.</param>
        /// <param name="toolTip">The action tool tip.</param>
        /// <param name="icon">The action icon.</param>
        /// <param name="isCheckOnActivate">A value indicating whether the action must be checked after activation.</param>
        /// <param name="subActions">The sub-actions of the action.</param>
        public VisualToolAction(
            VisualTool visualTool,
            string text,
            string toolTip,
            Image icon,
            bool isCheckOnActivate,
            params VisualToolAction[] subActions)
        {
            _isActivated = false;

            _visualTool = visualTool;
            _text       = text;
            _toolTip    = toolTip;
            _icon       = icon;
            _checkActionButtonOnActivate = isCheckOnActivate;

            if (subActions == null)
            {
                subActions = new VisualToolAction[0];
            }

            SetSubActions(subActions);
        }
コード例 #25
0
        /// <summary>
        /// Returns the visual tool, which is associated with specified visual tool action.
        /// </summary>
        /// <param name="visualToolAction">The visual tool action.</param>
        /// <returns>
        /// The visual tool.
        /// </returns>
        protected virtual VisualTool GetVisualTool(VisualToolAction visualToolAction)
        {
            // if mandatory visual tool is not specified
            if (MandatoryVisualTool == null)
            {
                return(visualToolAction.VisualTool);
            }

            // get current visual tool
            VisualTool result = visualToolAction.VisualTool;

            // if visual tool must be created
            if (!_visualToolItemToVisualTool.TryGetValue(visualToolAction, out result))
            {
                // if action visual tool is not specified
                if (visualToolAction.VisualTool == null)
                {
                    // use mandatory visual tool
                    result = MandatoryVisualTool;
                }
                else
                {
                    // create composite visual tool: mandatory visual tool + action visual tool
                    CompositeVisualTool compositeTool = new CompositeVisualTool(
                        MandatoryVisualTool, visualToolAction.VisualTool);
                    // set active visual tool
                    compositeTool.ActiveTool = visualToolAction.VisualTool;
                    result = compositeTool;
                }

                // save current visual tool
                _visualToolItemToVisualTool.Add(visualToolAction, result);
            }

            return(result);
        }
コード例 #26
0
ファイル: EndTurn.cs プロジェクト: maxdk9/argonautsexpedition
            private IEnumerator DoCasualtiesCoroutine()
            {
                yield return(new WaitForSeconds(.2f));

                GameLogicEvents.eventRemoveSingleEffects.Invoke();
                if (Game.instance.Casualties > 0)
                {
                    Vector2 pos = Visual.instance.LossCounter.transform.localPosition;
                    DamageEffect.CreateDamageEffect(pos, Game.instance.Casualties);
                }


                List <OneCardManager> curEnc = Visual.instance.GetCurrentEncounter();

                foreach (OneCardManager cm in curEnc)
                {
                    yield return(new WaitForSeconds(EndTurn.SmallAmountOfTime));

                    bool isResolved = cm.cardAsset.resolved == ResolvedType.resolved_win;
                    if (isResolved)
                    {
                        VisualTool.DiscardCardToWinningPile(cm);
                    }
                    else
                    {
                        VisualTool.DiscardCardToDiscardPile(cm);
                    }
                }
                yield return(new WaitForSeconds(TimeMovement1 + DelayTime));

                Debug.Log("CommandDoCasualties");
                GameLogicModifyGame.DoCasualties();
                GameLogicEvents.eventUpdateLossCounter.Invoke();
                GameLogicEvents.eventUpdateCrewCounter.Invoke();
                Command.CommandExecutionComplete();
            }
コード例 #27
0
		private void ChangeTool(VisualTool tool)
		{
			_imageContainer.VisualTool = _imageContainer.VisualTool != null && tool != null && tool.GetType() == _imageContainer.VisualTool.GetType() ? null : tool;
			ImageCrop.Checked = (_imageContainer.VisualTool as CropSelectionTool) != null;
			ImageSelect.Checked = (_imageContainer.VisualTool as RectangularSelectionToolWithCopyPaste) != null;
		}
コード例 #28
0
ファイル: GConnection.cs プロジェクト: Gefix/Ilnet
        public override bool Clicked(VisualTool Tool, bool Selected, Double Zoom, Double Xpos, Double Ypos)
        {
            m_tool = Tool;

            int radius    = 2;
            int zoneWidth = radius * 2 + 1;

            Bitmap   bmp = new Bitmap(zoneWidth, zoneWidth);
            Graphics gr  = Graphics.FromImage(bmp);

            gr.ScaleTransform((float)Zoom, (float)Zoom);
            gr.TranslateTransform((float)(-Xpos + radius / Zoom), (float)(-Ypos + radius / Zoom));

            gr.Clear(Color.FromArgb(0, Color.Black));

            Draw(gr, false, Zoom, (int)Xpos, (int)Ypos, 1, 1);

            int alphaSum = 0;

            for (int i = 0; i < zoneWidth; i++)
            {
                for (int j = 0; j < zoneWidth; j++)
                {
                    alphaSum += bmp.GetPixel(i, j).A;
                }
            }

            if (alphaSum > 0 || Selected)
            {
                m_SelectedAnchor = -1;

                // select anchor
                Rectangle region = new Rectangle((int)Xpos - radius, (int)Ypos - radius, zoneWidth, zoneWidth);

                if (Tool == VisualTool.Select)
                {
                    for (int i = 0; i < AnchorCount; i += 3)
                    {
                        PointF p = GetAnchorPoint(i);

                        if (region.Contains((int)p.X, (int)p.Y))
                        {
                            m_SelectedAnchor = i;
                        }
                    }
                }

                if (m_SelectedAnchor < 0)
                {
                    for (int i = 0; i < AnchorCount; i++)
                    {
                        if (i % 3 == 0)
                        {
                            continue;
                        }

                        PointF p = GetAnchorPoint(i);

                        if (region.Contains((int)p.X, (int)p.Y))
                        {
                            m_SelectedAnchor = i;
                        }
                    }
                }

                if (Tool == VisualTool.AnchorAdd ||
                    Tool == VisualTool.AnchorDelete ||
                    Tool == VisualTool.AnchorCollapse)
                {
                    if (m_SelectedAnchor < 0)
                    {
                        for (int i = 0; i < AnchorCount; i += 3)
                        {
                            PointF p = GetAnchorPoint(i);

                            if (region.Contains((int)p.X, (int)p.Y))
                            {
                                m_SelectedAnchor = i;
                            }
                        }
                    }

                    if (m_SelectedAnchor < 0 && Tool == VisualTool.AnchorAdd)
                    {
                        // find insertion point

                        Anchor a = new Anchor();
                        a.Origin      = new Point((int)Xpos, (int)Ypos);
                        a.InputLength = a.OutputLength = 0;

                        int insertAt = 0;

                        List <PointF> points = new List <PointF>();

                        for (int i = 0; i < m_Anchors.Count - 1; i++)
                        {
                            points.Clear();

                            points.Add(m_Anchors[i].Origin);
                            points.Add(GetWingPoint(m_Anchors[i], false));
                            points.Add(GetWingPoint(m_Anchors[i + 1], true));
                            points.Add(m_Anchors[i + 1].Origin);

                            gr.Clear(Color.FromArgb(0, Color.Black));

                            gr.DrawBeziers(new Pen(Color.Black, 2), points.ToArray());

                            int alphaSum2 = 0;
                            for (int k = 0; k < zoneWidth; k++)
                            {
                                for (int j = 0; j < zoneWidth; j++)
                                {
                                    alphaSum2 += bmp.GetPixel(k, j).A;
                                }
                            }

                            if (alphaSum2 > 0)
                            {
                                insertAt = i + 1;
                                break;
                            }
                        }

                        if (insertAt > 0)
                        {
                            m_Anchors.Insert(insertAt, a);
                            m_SelectedAnchor = insertAt * 3;
                        }
                    }

                    else if (m_SelectedAnchor >= 0 && Tool == VisualTool.AnchorDelete)
                    {
                        if (m_SelectedAnchor > 1 && m_SelectedAnchor < AnchorCount - 2)
                        {
                            m_Anchors.RemoveAt((m_SelectedAnchor + 1) / 3);
                            m_SelectedAnchor = -1;
                        }
                    }

                    else if (m_SelectedAnchor >= 0 && Tool == VisualTool.AnchorCollapse)
                    {
                        Anchor a = m_Anchors[(m_SelectedAnchor + 1) / 3];
                        if (a.InputLength == 0 && a.OutputLength == 0)
                        {
                            a.Angle       = 0;
                            a.InputLength = a.OutputLength = 20;
                            if (m_SelectedAnchor <= 1)
                            {
                                a.InputLength = 0;
                            }
                            if (m_SelectedAnchor >= AnchorCount - 2)
                            {
                                a.OutputLength = 0;
                            }
                        }
                        else
                        {
                            a.InputLength = a.OutputLength = 0;
                        }
                        m_Anchors[(m_SelectedAnchor + 1) / 3] = a;
                        m_SelectedAnchor = ((m_SelectedAnchor + 1) / 3) * 3;
                    }
                }

                return(Selected ? m_SelectedAnchor >= 0 || alphaSum > 0 : true);
            }

            return(false);
        }
コード例 #29
0
        public void Move(VisualTool Tool, Int32 newX, Int32 newY)
        {
            if (Tool == VisualTool.Select)
            {
                X = newX;
                Y = newY;
                return;
            }
            if (Tool == VisualTool.Connect && this is GNode)
            {
                int X = newX + (int)m_mouseOffset.X;
                int Y = newY + (int)m_mouseOffset.Y;

                if (m_gprocess.EndPoint == null)
                {
                    m_gprocess.EndPoint = new GNodeStub(m_gprocess);
                }
                m_gprocess.EndPoint.X = X;
                m_gprocess.EndPoint.Y = Y;
                if (m_gprocess.Connecting == null)
                {
                    if (this is GNodeSubprocess)
                    {
                        string p = (this as GNodeSubprocess).SelectedParameter;
                        if (p.StartsWith("in"))
                        {
                            m_gprocess.Connecting = new GConnection(m_gprocess.EndPoint, this as GNode, m_gprocess);
                            if (p.StartsWith("in:"))
                            {
                                m_gprocess.Connecting.EndPort = p.Substring(3);
                                m_gprocess.EndPoint.Name      = "VO";
                            }
                            else
                            {
                                m_gprocess.EndPoint.Name = "SO";
                            }
                        }
                        else
                        {
                            m_gprocess.Connecting = new GConnection(this as GNode, m_gprocess.EndPoint, m_gprocess);
                            if (p.StartsWith("out:"))
                            {
                                m_gprocess.Connecting.StartPort = p.Substring(4);
                                m_gprocess.EndPoint.Name        = "VI";
                            }
                            else
                            {
                                m_gprocess.EndPoint.Name = "SI";
                            }
                        }
                    }
                    else if (this is GNodeFunction)
                    {
                        m_gprocess.Connecting    = new GConnection(this as GNode, m_gprocess.EndPoint, m_gprocess);
                        m_gprocess.EndPoint.Name = "SI";
                    }
                    else if (this is GNodeVariable)
                    {
                        m_gprocess.Connecting    = new GConnection(this as GNode, m_gprocess.EndPoint, m_gprocess);
                        m_gprocess.EndPoint.Name = "CI";
                    }
                    else
                    {
                        return;
                    }
                }

                m_gprocess.Clicked(VisualTool.Select, 1, X, Y);

                bool hasPoint = false;

                if (m_gprocess.SelectedElement != null && m_gprocess.SelectedElement is GNode)
                {
                    if (m_gprocess.EndPoint.Name[0] == 'S')
                    {
                        if (m_gprocess.SelectedElement is GNodeFunction)
                        {
                            if (m_gprocess.EndPoint.Name[1] == 'O')
                            {
                                m_gprocess.Connecting.Start     = m_gprocess.SelectedElement as GNode;
                                m_gprocess.Connecting.StartPort = "";
                                hasPoint = true;
                            }
                            else
                            {
                                m_gprocess.Connecting.End     = m_gprocess.SelectedElement as GNode;
                                m_gprocess.Connecting.EndPort = "";
                                hasPoint = true;
                            }
                        }
                        else if (m_gprocess.SelectedElement is GNodeSubprocess)
                        {
                            string p = (m_gprocess.SelectedElement as GNodeSubprocess).SelectedParameter;

                            if (m_gprocess.EndPoint.Name[1] == 'O')
                            {
                                if (p == "out" || p == "")
                                {
                                    m_gprocess.Connecting.Start     = m_gprocess.SelectedElement as GNode;
                                    m_gprocess.Connecting.StartPort = "";
                                    (m_gprocess.SelectedElement as GNodeSubprocess).SelectedParameter = "out";
                                    hasPoint = true;
                                }
                            }
                            else
                            {
                                if (p == "in" || p == "")
                                {
                                    m_gprocess.Connecting.End     = m_gprocess.SelectedElement as GNode;
                                    m_gprocess.Connecting.EndPort = "";
                                    (m_gprocess.SelectedElement as GNodeSubprocess).SelectedParameter = "in";
                                    hasPoint = true;
                                }
                            }
                        }
                    }
                    if (m_gprocess.EndPoint.Name[0] == 'V')
                    {
                        if (m_gprocess.SelectedElement is GNodeVariable)
                        {
                            if (m_gprocess.EndPoint.Name[1] == 'O')
                            {
                                m_gprocess.Connecting.Start     = m_gprocess.SelectedElement as GNode;
                                m_gprocess.Connecting.StartPort = "";
                                hasPoint = true;
                            }
                            else
                            {
                                m_gprocess.Connecting.End     = m_gprocess.SelectedElement as GNode;
                                m_gprocess.Connecting.EndPort = "";
                                hasPoint = true;
                            }
                        }
                    }
                    if (m_gprocess.EndPoint.Name[0] == 'V' || m_gprocess.EndPoint.Name[0] == 'C')
                    {
                        if (m_gprocess.SelectedElement is GNodeSubprocess)
                        {
                            string p = (m_gprocess.SelectedElement as GNodeSubprocess).SelectedParameter;

                            if (m_gprocess.EndPoint.Name[1] == 'O')
                            {
                                if (p.StartsWith("out:"))
                                {
                                    m_gprocess.Connecting.Start     = m_gprocess.SelectedElement as GNode;
                                    m_gprocess.Connecting.StartPort = p.Substring(4);
                                    hasPoint = true;
                                }
                            }
                            else
                            {
                                if (p.StartsWith("in:"))
                                {
                                    m_gprocess.Connecting.End     = m_gprocess.SelectedElement as GNode;
                                    m_gprocess.Connecting.EndPort = p.Substring(3);
                                    hasPoint = true;
                                }
                            }
                        }
                    }
                }
                if (hasPoint == false)
                {
                    m_gprocess.Clicked(VisualTool.Select, 1, Double.MaxValue, Double.MaxValue);

                    if (m_gprocess.EndPoint.Name[1] == 'O')
                    {
                        m_gprocess.Connecting.Start = m_gprocess.EndPoint;
                    }
                    else
                    {
                        m_gprocess.Connecting.End = m_gprocess.EndPoint;
                    }
                }

                m_gprocess.SelectedElement = this;
            }
        }
コード例 #30
0
 public void Deactivate()
 {
     activated = false;
     CardListChooser.instance.Hide();
     VisualTool.SwitchAllControls(true);
 }
コード例 #31
0
 private void ChangeTool(VisualTool tool)
 {
     _imageContainer.VisualTool = _imageContainer.VisualTool != null && tool != null && tool.GetType() == _imageContainer.VisualTool.GetType() ? null : tool;
     ImageCrop.Checked          = (_imageContainer.VisualTool as CropSelectionTool) != null;
     ImageSelect.Checked        = (_imageContainer.VisualTool as RectangularSelectionToolWithCopyPaste) != null;
 }