Пример #1
0
    // Changes the current area
    public void changeArea(KnyttPoint new_area, bool force_jump = false, bool regenerate_same = true)
    {
        // Regenerate current area if no change, else deactivate old area
        if (this.CurrentArea != null)
        {
            if (CurrentArea.Area.Position.Equals(new_area))
            {
                if (regenerate_same)
                {
                    CurrentArea.regenerateArea(regenerate_same: regenerate_same);
                }
                return;
            }

            CurrentArea.scheduleDeactivation();
        }

        // Update the paging
        GDWorld.Areas.setLocation(new_area);
        var area = GDWorld.getArea(new_area);

        if (area == null)
        {
            return;
        }

        this.CurrentArea = area;
        this.CurrentArea.activateArea();
        this.beginTransitionEffects(force_jump);

        Juni.stopHologram(cleanup: true);
    }
Пример #2
0
    // Changes the current area
    public void changeArea(KnyttPoint new_area, bool force_jump = false, bool regenerate_same = true)
    {
        // Regenerate current area if no change, else deactivate old area
        if (this.CurrentArea != null)
        {
            if (CurrentArea.Area.Position.Equals(new_area))
            {
                if (regenerate_same)
                {
                    CurrentArea.regenerateArea(regenerate_same: regenerate_same);
                }
                return;
            }

            CurrentArea.scheduleDeactivation();
            Juni.juniInput.altInput.ClearInput();
        }

        // Update the paging
        GDWorld.Areas.setLocation(new_area);
        var area = GDWorld.getArea(new_area);

        if (area == null)
        {
            return;
        }

        int change_distance = CurrentArea == null ? 0 : CurrentArea.Area.Position.manhattanDistance(new_area);

        this.CurrentArea = area;
        this.CurrentArea.activateArea();
        this.beginTransitionEffects(force_jump || change_distance > 1); // never scroll if jump distance is over 1

        Juni.stopHologram(cleanup: true);
        if (area.Area.ExtraData?.ContainsKey("Attach") ?? false)
        {
            Juni.enableAttachment(area.Area.getExtraData("Attach"));
        }
        if (hasMap())
        {
            Juni.Powers.setVisited(CurrentArea.Area);
        }
    }