public void ScrollTo(GraphBlueprint bp)
        {
            int focus = -1;

            for (int i = 0; i < _nodes.Length; i++)
            {
                if (_nodes[i].ContentID == bp.ID)
                {
                    focus = i;
                }
            }
            if (focus == -1)
            {
                return;
            }

            var offset0 = GDConstants.VIEW_WIDTH / 2f - focus * DIST_X;

            for (int i = 0; i < _nodes.Length; i++)
            {
                _values[i]        = new AdaptionFloat(offset0 + i * DIST_X, FORCE, DRAG, MIN_SPEED);
                _nodes[i].NodePos = new FPoint(_values[i].Value, POSITION_Y);
            }

            CleanUpPositions(true);
        }
Exemplo n.º 2
0
        public OverworldScrollAgent(GDOverworldScreen scrn, OverworldNode[] nodes) : base(scrn)
        {
            _nodes  = nodes;
            _values = new AdaptionFloat[_nodes.Length];

            int focus = 0;

            if (GDConstants.USE_IAB)
            {
                for (int i = 0; i < nodes.Length; i++)
                {
                    if (!nodes[i].IsNodeEnabled)
                    {
                        break;
                    }
                    focus = i;
                }
            }
            else
            {
                focus = 1;
            }

            var offset0 = GDConstants.VIEW_WIDTH / 2f - focus * DIST_X;

            for (int i = 0; i < _nodes.Length; i++)
            {
                _values[i]        = new AdaptionFloat(offset0 + i * DIST_X, FORCE, DRAG, MIN_SPEED);
                _nodes[i].NodePos = new FPoint(_values[i].Value, POSITION_Y);
            }

            CleanUpPositions(true);
        }
        public OverworldScrollAgent(GDOverworldScreen scrn, OverworldNode[] nodes) : base(scrn)
        {
            _nodes  = nodes;
            _values = new AdaptionFloat[_nodes.Length];

            int focus = 0;

            switch (GDConstants.FLAVOR)
            {
            case GDFlavor.FREE:
            case GDFlavor.IAB:
                for (int i = 0; i < nodes.Length; i++)
                {
                    if (!nodes[i].IsNodeEnabled)
                    {
                        break;
                    }
                    focus = i;
                }
                break;

            default:
            case GDFlavor.FULL:
            case GDFlavor.FULL_NOMP:
                focus = 1;
                break;
            }

            var offset0 = GDConstants.VIEW_WIDTH / 2f - focus * DIST_X;

            for (int i = 0; i < _nodes.Length; i++)
            {
                _values[i]        = new AdaptionFloat(offset0 + i * DIST_X, FORCE, DRAG, MIN_SPEED);
                _nodes[i].NodePos = new FPoint(_values[i].Value, POSITION_Y);
            }

            CleanUpPositions(true);
        }
Exemplo n.º 4
0
        public OverworldScrollAgent(OverworldNode[] nodes)
        {
            _nodes  = nodes;
            _values = new AdaptionFloat[_nodes.Length];

            int focus = 0;

            switch (MainGame.Flavor)
            {
            case GDFlavor.FREE:
                focus = GetFocus_Free(nodes);
                break;

            case GDFlavor.IAB:
            case GDFlavor.IAB_NOMP:
                focus = GetFocus_IAB(nodes);
                break;

            case GDFlavor.FULL:
            case GDFlavor.FULL_NOMP:
                focus = GetFocus_Full(nodes);
                break;

            default:
                SAMLog.Error("OSA::EnumSwitch_CTR", "MainGame.Flavor = " + MainGame.Flavor);
                break;
            }

            var offset0 = GDConstants.VIEW_WIDTH / 2f - focus * DIST_X;

            for (int i = 0; i < _nodes.Length; i++)
            {
                _values[i]        = new AdaptionFloat(offset0 + i * DIST_X, FORCE, DRAG, MIN_SPEED);
                _nodes[i].NodePos = new FPoint(_values[i].Value, POSITION_Y);
            }

            CleanUpPositions(true);
        }