Giter Site home page Giter Site logo

setchi / fancyscrollview Goto Github PK

View Code? Open in Web Editor NEW
2.8K 75.0 359.0 3.92 MB

[Unity] Scroll view component that can implement highly flexible animations.

Home Page: https://setchi.jp/FancyScrollView/

License: MIT License

C# 93.85% HLSL 2.23% ShaderLab 3.92%
unity unity3d ugui scrollview infinite-scroll csharp unity3d-games scroller unity-scripts unity-asset

fancyscrollview's People

Contributors

ccglp avatar rfadeev avatar setchi avatar sgamerw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fancyscrollview's Issues

Cells are not displayed on iPad when constructed but works fine after touch and slide.

Hi, first, great work, thank you ;)
But I find a bug I think.
It works fine in the editor but when I built it on my iPad, the cells are not shown on the screen like the picture I attached, it just shows the background. They will show correctly after you touch and slide.

img_4675

How to reproduce:

  1. I just cloned this repo and opened it in Unity directly.
  2. I'm testing the 02_CellEventHandling scene and built this scene to iPad and run.
  3. And the cells are not correctly displayed.

Environment:
Unity 2017.3.1f1
iPad Air 2
iOS 11.1.1

Unity reports a Shader warning on the Veroni example

The following warning is reported by Unity on the Shader used in the Veroni example

As follows

Shader warning in 'FancyScrollViewGallery/Voronoi': 'i': loop control variable conflicts with a previous declaration in the outer scope; most recent declaration will be used at Assets/unity-ui-extensions/Examples/FancyScrollView/Sources/05_Voronoi/Voronoi.hlsl(66) (on d3d11)

Compiling Vertex program
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR

It seems to dislike the Index "i" being used in both unroll loops.

Simple fix for the second unroll seems to be to change it to another name, e.g. "j"

Problem when autoscrolling immediately after scene load.

Hello,

I am working on this game : https://play.google.com/store/apps/details?id=com.Meludia.MicroMelody and used FancyScrollView to display game levels.
I have a scene for selecting game worlds then a scene for displaying levels from the selected world.
The levels scene must scroll the last played level. But when it scrolls it has strange behaviours, please see attached images and video.

missingcenter
missingleft
https://www.dropbox.com/s/s622j1wp5dzjvu5/Meludia_2017-10-30-09-37-40.mp4?dl=0

GameObjectのInactive後のActiveでセルが描画されない

サンプルの01_Basicを動かして下記の画像のように途中までスクロールした状態でシーン内のScrollViewのGameObjectの状態をInactiveからActiveに変えるとセルの状態が描画されないことがあります。

image

このような状態を回避するためには、どのようにすればよいでしょうか?

Please include changelogs with each release

You're doing a great job with the project and thanks for sharing it with the community but constant releases with zero info about new features and/or bug fixes are kinda annoying.
Commit messages are not meant to be used as "changelog points" since their titles are not self-explanatory for a random consumer.

Is there any way not to reuse cells?

I know that's the main point of the program, but there are times where i need an individual cell to have it's own information. Is it possible?

Dublicate snap settings in Scroller inspector

The latest versions of Unity with a new interface have added incorrect display of snap settings. This was not seen on versions prior to 2019.3. Settings are duplicated. It is fixed by commenting or deleting a section of the code from screenshot 3 in ScrollerEditor.cs.

Before
After

Reason

Different Cell Size support

Hi, first thanks for this amazing plugin.
I was struggling to expand this plugin to support cells with different height.
differentCellHeight

I find it is hard to do. Do you have any idea how to achieve that? Thanks

How to custom animation for scrollview

Hi,
I see you posted this in your description : https://github.com/setchi/FancyScrollView/blob/master/Documents/screencast2.gif
But the seem that it's not attached in the examples. Could you please share it?
BTW, I have a question: You are using the animator (animation) for your scrollview. Could you please help me support step by step to modify animation or something like that to custom animation for scrollview. I tried to custom but it's hard to handle it.
Thank so much for your scrollview. It's a awesome scrollview.

How to use event to reset the FancyScrollView

Hi, I very like the FancyScrollView
But I am facing some issues with resetting the scroller and its content.
For example, I want the Scroller and its contents to be reset whenever I press a button or hit something. By default, if I destroy the object inside the content, Unity will flag an error saying FancyScrollView is looking for objects that have been destroyed and stop the play.
If I replace the object inside the content, the position of the viewport will not change.

Is that any efficient way to reset the FancyScrollView?
Thanks,

how to load images inside cell dynamically using www

hi i tried to change UpdateContent function inside FancyScrollviewCell.cs file as below:
public virtual IEnumerator UpdateContent(TData itemData) { return new object[0].GetEnumerator(); }
and changed UpdateContent function inside Example02ScrollViewCell.cs as below:

public override IEnumerator UpdateContent(Example02CellDto itemData) { message.text = itemData.Message; WWW www = new WWW(itemData.url); yield return www; if (context != null) { var isSelected = context.SelectedIndex == DataIndex;
image.sprite = Sprite.Create(www.texture, new Rect(0, 0, www.texture.width, www.texture.height), new Vector2(0, 0));; /*image.color = isSelected ? new Color32 (0, 255, 255, 100) : new Color32 (255, 255, 255, 77);*/ } yield return new object[0].GetEnumerator(); }

I have also changed my data model to be as below in Example02CellDto.cs:
namespace UnityEngine.UI.Extensions.Examples { public class Example02CellDto { public string Message; public string url; } }

the odd thing is the UpdateContent in Example02ScrollViewCell.cs does not get called.
what is really wrong with this approach and what is the right one?

Version mismatched

Git tag: v1.8.8
package.json version: 1.8.7

To fix:

  • bump version in the package.json file
  • retag v1.8.8

Please add assembly definition

We're referencing FancyScrollView from Unity's package manager instead of importing it into the Assets folder (i.e. the new recommended way).

Now we want to add Unit Tests to our project, which requires us to setup assembly definitions for our code. Which in turn requires us to reference any third party library in our .asmdef file.

However, this is only possible if the library itself contains an .asmdef file. We can add these for libraries in the Assets folder, but not for libraries in the package manager.

So I wanted to kindly ask you to provide an .asmdef file as part of the default library. Thanks.

Refill the scrollview with new content

Hello,

My scrollview holds levels for a given world of the game.
When I select a new world I would like to repopulate the scrollview with the new world levels.

I created this method

    public void UpdateCellData()
    {
        var cellData = WorldManager.Instance.Levels
            .Select(kvp => new WorldLevelCellData()
            {
                LevelNumber = kvp.Key,
                LevelData = kvp.Value,
                Active = kvp.Value.Active || kvp.Key == 0
            })
            .ToList();

        scrollView.UpdateData(cellData);
    }

that is called when I select a level.
This does not immediately update the scrollview, but I have to scroll through the levels to see the cells update.

Any fix for this?

RFC: port package.json, license file back to master branch

Hi @setchi,

Thanks for creating the awesome upm package. I noticed that you contribute the package to OpenUPM list, but it's fail on the build pipeline.

The reason is that the build pipelines will checkout each valid semver git tags, and build package from there. For this project, only the upm branch contains the package.json and other necessary upm files (licenses...). As a result, the package can be only installed via git url.

Here's the suggestion to fix the issue with better folder strucutre (also make it more consistent between different branches).

  1. port package.json and other necessary files back to master Assets/FancyScrollView/
  2. consider to move the Assets/FancyScrollView/ to Packages/jp.setchi.fancyscrollview to it a local package. So you always test your library as a package in the unity project.
  3. optional you can move Example folder to Samples~ and update the package.json. see https://forum.unity.com/threads/samples-in-packages-manual-setup.623080/, it will be shown in the package manager ui window.

Here's the steps for further releases

  1. bump version in package.json and commit.
  2. git subtree Packages/jp.setchi.fancyscrollview to the upm branch.
  3. push changes.
  4. go to github releases page, create new release (tag) from upm branch and name as vx.y.z to match the version number from package.json.

(openupm will detect the changes, and publish new version).

Hope this help.

How can i change cells number?

I want to make a LAN chat software.So I need to change the number of cells and the contents of the cells when the program is running.but i don`t know how to change the number of cells.How can i do?thank you.
phot

NullReferenceException: Object reference not set to an instance of an object

Hi there

Not sure if it is my own implementation but it looks like there is a problem with your suggested simple example.

This is the error:
NullReferenceException: Object reference not set to an instance of an object
FancyScrollView.FancyScrollView2[TData,TContext].CreateCell () (at Assets/FancyScrollView/Scripts/FancyScrollView.cs:50) FancyScrollView.FancyScrollView2[TData,TContext].UpdatePosition (Single position) (at Assets/FancyScrollView/Scripts/FancyScrollView.cs:166)
FancyScrollView.FancyScrollView`2[TData,TContext].LateUpdate () (at Assets/FancyScrollView/Scripts/FancyScrollView.cs:90)

My scroll view cell looks like this:
`using UnityEngine;
using UnityEngine.UI;
using FancyScrollView;

public class MYOM_ScrollViewCell : FancyScrollViewCell<MYOM_CellData>
{
[SerializeField]
Text message;

public override void UpdateContent(MYOM_CellData itemData)
{
    message.text = itemData._message;
}

public override void UpdatePosition(float position)
{
    // position is a value between 0.0 and 1.0
    // You can control the appearance of the cell freely based on position
}

}`

so it looks like it is having a type mismatch in line 48 of FancyScrollView.cs var cell = cellObject.GetComponent<FancyScrollViewCell<TData, TContext>>();
with the following line 50 var cellRectTransform = cell.transform as RectTransform;

In Unity this problem clones non-stop 'Cells' and not inside a parent object.

Any ideas?

Thanks

スクロールできない場合padding headが効かない

お疲れ様です、エンジニアの楊と申します。
今担当している案件ではFancyScrollViewライブラリは使われています、とても優秀なライブラリと思いました、ありがとうございました。
開発中で一点気になったことがあります。スクロールビューの中セル数が多い場合(スクロールバーが表示される)padding headは効いてますけど、セル数が少ない場合(スクロールバーが表示されない)padding head設定は効かない、一番目のセルとTopの距離は固定されています。
ソースコードを拝見しまして、FancyScrollRect.cs#L108のところ、base.UpdatePosition(Scrollable ? ToFancyScrollViewPosition(p) : 0f);処理は分岐されています。ここは何か意図はございますか?スクロールできるできないににかかわらず、同じpadding headにしたい場合は如何設定すれば良いでしょうか?
お手数ですが、ご確認のほど宜しくお願い致します。

Instantiate cell object from prefab

Is there any special reason for instantiating cells from cellBase which is set to inactive in FancyScrollView's Awake? I was thinking that support of instantiating from prefab can be useful, plus it would allow not having disabled cellBase object in heirarchy.

How to add own object instead of instantiating cell?

I wanted to add my own button from scrollrect.
I create arry to contain those object.
try to use that arry instead of cell but get confused with too many changes.
in the end, can't use the script for buttons.
can anyone help me with this?
I want to use fancy scroll view in my project. for scrollrect.

PaddingTop doesn't work when the scrollview is initialized

Considering Example 7 Scroll Rect, the PaddingTop property doesn't work as intended when the scrollview is initialized at the start if we set the start index as 0.

It only works if we start scrolling the scrollview or if we set the start index as something other than 0.

Thanks for this wonderful plugin.

How can change cell fit multi screen

Hello, I have tried changing the anchor preset to make the cell auto resize on many different screen sizes, but it seems in the animation also change it. I see the anchor change on the inspector. So how does the cell size fit on multi screen? Thanks

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.