Giter Club home page Giter Club logo

viewportedlayouts's Introduction

ViewportedLayouts

提供一些组件,解决在有限大小的可视区域内,显示和布局大量的UI对象。 对象仅在进入可见区域的时候被创建(或从池中获取),以及不可见时放回池中。

Layout large items in a limited rect viewport. Items will only be created(or get from pool) when it is actually visible in viewport, and put back to the pool when it is out of the viewport.

Dependencies

Install

install by Packages/manifest.json (you must add dependencies to project by yourself in this way)

"com.ms.ugui.viewportedlayouts":"https://github.com/wlgys8/ViewportedLayouts.git"

or install by openupm (dependenceis will be resolved automaticly)

openupm install com.ms.ugui.viewportedlayouts

简单说明

以简单的一个例子来说明:

制作一个垂直线性布局、可滑动的列表。支持一万个以上的元素项。

如果按照Unity传统的方式,ScrollView + VerticalLayoutGroup来制作,性能将是十分低下的。特别是创建一万个GameObject对象的代价是无法接受的。

本项目提供的组件,利用对象池的方式,对布局元素实现循环使用,实现高性能显示与布局。 基本规则如下 :

  • 当元素项从非可见区域进入到可见区域时,才创建或从对象池中获取,并刷新显示状态。
  • 当元素项从可见区域进入到非可见区域时,回收进对象池。

因此,至多只需要创建同时显示在可见区域的元素项数量

Supported Layouts

1. SimpleLinearLayout

线性布局

2. SimpleFlexGridLayout

可伸缩式的网格布局

Check Samples~ for more detail usage.

Samples

for Unity 2019+ , samples can be imported from Package Manager UI. Otherwise, drag Samples~/Layouts into your project.

viewportedlayouts's People

Contributors

wlgys8 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.