Skip to content

Latest commit

 

History

History
49 lines (39 loc) · 1.15 KB

README.md

File metadata and controls

49 lines (39 loc) · 1.15 KB

Wrap Content

Example for creating GUI elements using LeoECS and Unity3d

thanks leo GitHub Pages

screenshot_0 screenshot_1 screenshot_2

  1. create data structure. example:
public struct CustomWrapItemData
{
    public string str;
}
  1. create an inheritor class from MonoBehaviour and override interface IBaseItem functions this is for scroll item element
public class WrapItem : MonoBehaviour, IBaseItem<CustomWrapItemData>
{
    public int index{set; get;} 
    public void SetData(int index, ref T data){}
    public void SetSize(float size){}
    public void SetAction(ViewAction action){}
    public void SetAction(float tm_action, float tm_cur, ViewAction action){}
    public void Show(bool show){}
}
  1. create an inheritor class from BaseWrapContent - this is scroll class GetItemSize - return size of scroll item
public class CustomWrapContent:  BaseWrapContent<CustomWrapItemData, WrapItem>
{
    protected override float GetItemSize(CustomWrapItemData data)
    {
        return 60f;
    }
}

see scene example