블로그 이미지
Every unexpected event is a path to learning for you.

카테고리

분류 전체보기 (2737)
Unity3D (817)
Programming (474)
Server (33)
Unreal (4)
Gamebryo (56)
Tip & Tech (228)
협업 (58)
3DS Max (3)
Game (12)
Utility (136)
Etc (96)
Link (32)
Portfolio (19)
Subject (90)
iOS,OSX (53)
Android (14)
Linux (5)
잉여 프로젝트 (2)
게임이야기 (3)
Memories (20)
Interest (38)
Thinking (38)
한글 (30)
PaperCraft (5)
Animation (408)
Wallpaper (2)
재테크 (18)
Exercise (3)
나만의 맛집 (3)
냥이 (10)
육아 (16)
Total
Today
Yesterday
04-26 00:00

[링크] https://cho22.tistory.com/55

 

[UnityNGUI] ScrollView에 Particle Clipping하기

NGUI 스크롤뷰 내부에 파티클이 붙어있는 아이템을 추가했더니 스크롤시 스크롤뷰 밖에서 파티클이 보이는 현상이 발생하였다. 이 현상 수정을 위해 NGUI Particle Clipping, 유니티 파티클 스크롤뷰,

cho22.tistory.com

 

 

 

 

반응형
Posted by blueasa
, |

[링크]

https://qits.tistory.com/m/entry/NGUI-%EC%8A%A4%ED%81%AC%EB%A1%A4-%EB%8A%90%EB%A0%A4%EC%A7%80%EB%8A%94-%ED%98%84%EC%83%81-%EC%9E%AC%EC%82%AC%EC%9A%A9%EB%A6%AC%EC%8A%A4%ED%8A%B8%EB%A5%BC-%EC%82%AC%EC%9A%A9%ED%95%98%EC%A7%80-%EC%95%8A%EA%B3%A0-%EA%B8%B0%EB%8A%A5-%EA%B0%9C%EC%84%A0

 

NGUI 스크롤 느려지는 현상 (재사용리스트를 사용하지 않고 기능 개선)

NGUI로 스크롤 을 구현하다보면 Grid를 사용하는 것이 일반적인데, 아이템이 많아지면 느려지는것을 자주 보게 된다. 아이템이 많아지니까 느려지는것은 어찌보면 당연한 일이다. 하지만 그대로 사용할수없으니 해..

qits.tistory.com

 

반응형
Posted by blueasa
, |

[링크] https://redforce01.tistory.com/242

 

[NGUI] Infinite ScrollView (AT)

최근 회사에서 채팅UI의 구조 개선에 대한 이슈가 발생하여 만들어두었던 채팅창을 모두 갈아엎게 되었다. 기존의 채팅 UI구조는 채팅메세지가 들어올 때마다 Instantiate ( ) 가 수행되어 말풍선 UI가 계속해서..

redforce01.tistory.com

 

반응형
Posted by blueasa
, |
초맨  2013.05.29 16:40  
자답입니다. 

NGUI 소스를 분석해 보니 직접적으로 이벤트를 발생시켜주지는 않는군요., 
대신 UIDraggablePanel 에서 드래그를 완료했을때 발생시켜 주는 이벤트(델리게이트로 구현)를 받아 
좌표 계산 후 상단끝에 도달했는지 하단끝에 도달했는지 판단할 수 있습니다. 

1. 델리게이트 등록 
dragPanel.onDragFinished = new UIDraggablePanel.OnDragFinished(OnDragFinished); 

2. 드래그완료 이벤트에서 좌표계산 후 영역판단. 
void OnDragFinished() 

Vector3 constraint = dragPanel.panel.CalculateConstrainOffset(dragPanel.bounds.min, dragPanel.bounds.max); 
if (constraint.y > 0) 

// 상단끝 

else if (constraint.y < 0) 

// 하단끝 

}




[출처] http://www.devkorea.co.kr/bbs/board.php?bo_table=m03_qna&wr_id=30574

반응형
Posted by blueasa
, |

 

 

[기존 소스에 일부 코드 수정]

CUIListView.cs
0.03MB

 

 

스크롤뷰 아이템을 재사용 할 수 있게 해주는 스크립트 입니다.

인터넷에 이미 몇가지 있는 걸로 알지만, 제가 쓰고 있는 것도 공유해 봅니다.

 

사용법은 간단합니다.

스크립트에 멤버 변수로 CUIListView를 등록하면 다음과 같이 나옵니다. 

 

 

Item List - 스크롤뷰가 포함되어 있는 오브젝트.

Item - 리스트로 출력할 프리팹.

Add Row of Column - 0일 경우 View사이즈에 딱 맞게 아이템을 생성해줍니다. 이렇게 되면 아이템 재사용이 제대로 동작하지 않으니, 1이나 2로 지정합니다.

Item Padding - 아이템 사이의 간격입니다. 알아서 다 맞춰주기 때문에 Grid 사용하지 않아도 됩니다.

Scrollbar - 스크롤바가 있을경우 지정해줍시다.

그리고 UIPanel의 offset과 Center 좌표는 0으로 두는게 좋습니다. 패널 위치를 옮기려면 게임오브젝트의 좌표를 움직이는게 좋습니다.


using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class CListViewTest : MonoBehaviour
{
    public CUIListView m_ListView;

    private List m_ItemList = new List();

    void Start ()
    {
        for(int i = 0; i < 500; ++i)
        {
            m_ItemList.Add(i);
        }

        m_ListView.OnUpdateItem = OnUpdateItem;
        m_ListView.OnGetItemCount = OnGetItemCount;

        m_ListView.Init();
    }

    public void OnUpdateItem(int index, GameObject go)
    {
        CListViewTestItem item = go.GetComponent<CListViewTestItem>();
        item.m_Label.text = index.ToString();
    }

    public int OnGetItemCount()
    {
        return m_ItemList.Count;
    }
}

public class CListViewTestItem : MonoBehaviour
{
    public UILabel m_Label;
}

 

코드는 위와같이 작성합니다. 

OnUpdateItem - 아이템이 갱신될 때 호출됩니다. 나머지 부분은 직접 구현하시면 됩니다. 

OnGetItemCount - 리스트의 전체 개수가 필요할 때 호출됩니다.

추가로 Refresh와 Reset, SetFocus 함수가 있는데 필요에 따라서 호출하여 쓰시면 될 것 같습니다.

 

미구현 기능 및 버그

- 스크롤 바를 클릭해서 뷰를 이동하는 기능. 이 기능을 쓸일이 없고 작업하기도 힘들어서 구현하지 않았습니다.

- 아이템이 한페이지 이상 삭제되었을 경우에 Refresh를 호출하면 뷰 이동이 안되는 버그. (이런 경우에는 Reset을 쓰는 걸 추천).

2015. 4. 15 업데이트

아이템이 리스트에 딱 맞게 설정되어 있을 경우에 스크롤이 되는 버그가 있어서 수정하였습니다.

 

2015. 5. 26 업데이트

아이템의 크기가 뷰사이즈 보다 작을 경우 드래그가 불가능 하도록 스크롤뷰를 disable 시키는 기능 추가.

SetFocus(0); 을 호출 할 경우 0번째 아이템이 화면 중앙에 위치하는 버그 수정.

 

출처 : http://kheldon.tistory.com/2

 

반응형
Posted by blueasa
, |

"Infinite Scrolling" for Unity3D Using NGUI's UIScrollView (1st attempt)

For latest update please check this post instead 
I've been using NGUI for UI related work on my Unity project for the past few weeks and it is a breath of fresh air when compared to the stock UnityGUI (OnGUI()).

Part of my project relate to display a relatively large amount of data dynamically (well not very large but in thousands) and instantiating a prefab for each data element didn't seem like a good idea to me :-)

So instead I decided to add some logic to do a scroll view with fixed pool of items that I reuse and position according to the direction of the scroll and get it fed with the correct data. 

Although I am sure that there are existing solutions I decided to do my own.

The logic so far is built using UIGrid with fixed cell height for the moment (not well suited for UITable with different cell height) and the panel is using soft clip. the Scroll view is using momentum only (Spring physics breaks my current logic for some reason)

Initialization steps: 
  1. Pool size is calculated using the cell height against the panel height plus some buffer (currently I am using a buffer of 4 list items)
  2. List items' pool is instantiated with corresponding data from the data list
  3. A map is maintained to keep track of which data item are used in which list items
While Scrolling:
  1. Any item that turns a visible from an invisible state will notify the main controller
  2. We check the direction of the scroll based on which item is visible (e.g. if the next item is visible means that we are dragging upwards)
  3. based on the direction we reuse the items at the top or the bottom of the list accordingly (e.g. if direction is up the top item moves to the bottom and get populated with data from the corresponding data element)

 

 This is a first attempt and further posts will follow as the logic evolve.

==UPDATE==
I am in the process of making this component available as open source.
Meanwhile we've launched a free app on Android that uses it called Avatar Messenger
==UPDATE 2==
 The component is available as open source
https://github.com/OrangeLabsUK/InfiniteList_NGUI



[파일]

InfiniteList_NGUI-master.zip



출처 : http://www.geekyhamster.com/2013/12/infinite-scrolling-for-unity3d-using.html

반응형

'Unity3D > NGUI' 카테고리의 다른 글

NGUI UI의 현재 위치 표시하기[수정중]  (0) 2015.05.08
NGUI 다양한 해상도 대응하기  (2) 2015.04.21
NGUI: Symbols & Emoticons  (0) 2015.02.12
NGUI Emoticons  (0) 2015.02.12
NGUI UILabel로 Emoticon 넣기..  (0) 2015.02.12
Posted by blueasa
, |


링크 : http://jenemia.tistory.com/311

반응형
Posted by blueasa
, |