Ejemplo n.º 1
0
    void WrapSetting()
    {
        List <AchivementTypeData> type_Data = MyCsvLoad.Instance.GetAchivementTypeDivideByTabName(current_tab);

        //Dictionary<string, AchivementTypeData> dic_type = MyCsvLoad.Instance.GetAchivementTypeDatas();

        wrap.minIndex = -(type_Data.Count - 1);
        if (type_Data.Count == 1)
        {
            wrap.minIndex = 1;
        }
        wrap.maxIndex = 0;

        Transform trans = wrap.transform;

        if (type_Data.Count < 10)
        {
            for (int i = type_Data.Count; i < trans.childCount; i++)
            {
                trans.GetChild(i).gameObject.SetActive(false);
            }
        }
        else
        {
            for (int i = 0; i < trans.childCount; i++)
            {
                trans.GetChild(i).gameObject.SetActive(true);
            }
        }

        wrap.SortAlphabetically();
        wrap.WrapContent(true);

        scrollView.ResetPosition();
    }
Ejemplo n.º 2
0
    static int SortAlphabetically(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        UIWrapContent obj = (UIWrapContent)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UIWrapContent");

        obj.SortAlphabetically();
        return(0);
    }
Ejemplo n.º 3
0
    void SetWrapContent(UIGrid grid, List <ItemDataManager.ItemData> dataList, Dictionary <int, PropsItem> dataDic, UIWrapContent.OnInitializeItem OnUpdateItemMain)
    {
        grid.enabled = true;
        int tankCont  = dataList.Count;
        int gridCont  = grid.GetChildList().Count;
        int itemCount = 0;

        if (tankCont % 2 == 0)
        {
            itemCount = tankCont / 2;
        }
        else
        {
            itemCount = tankCont / 2 + 1;
        }
        if (itemCount <= 3)
        {
            if (grid.gameObject.GetComponent <UIWrapContent>())
            {
                NGUITools.Destroy(grid.gameObject.GetComponent <UIWrapContent>());
            }
            if (gridCont != itemCount)
            {
                StartCoroutine(CreateUnit(grid, dataList, dataDic));
            }
        }
        else
        {
            UIWrapContent wrap = null;
            if (grid.gameObject.GetComponent <UIWrapContent>())
            {
                wrap = grid.gameObject.GetComponent <UIWrapContent>();
            }
            else
            {
                grid.gameObject.AddComponent <UIWrapContent>();
                wrap = grid.gameObject.GetComponent <UIWrapContent>();
            }
            _wrapList.Add(wrap);
            if (gridCont != 4)
            {
                if (grid != null)
                {
                    grid.DestoryAllChildren();
                }
                CreateWrapUnit(grid, 4);
                if (wrap != null)
                {
                    //绑定方法
                    wrap.itemSize         = (int)grid.cellHeight;
                    wrap.minIndex         = -(itemCount - 1);
                    wrap.maxIndex         = 0;
                    wrap.onInitializeItem = OnUpdateItemMain;
                    wrap.SortAlphabetically();
                }
            }
        }
    }
Ejemplo n.º 4
0
 static public int SortAlphabetically(IntPtr l)
 {
     try {
         UIWrapContent self = (UIWrapContent)checkSelf(l);
         self.SortAlphabetically();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 5
0
 static int SortAlphabetically(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UIWrapContent obj = (UIWrapContent)ToLua.CheckObject <UIWrapContent>(L, 1);
         obj.SortAlphabetically();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Ejemplo n.º 6
0
    void SetWrapContent(UIGrid grid, List <TankDataManager.UnitData> dataList, Dictionary <int, StrengthenTankItem> dataDic, UIWrapContent.OnInitializeItem OnUpdateItemMain)
    {
        int tankCont = dataList.Count;
        int gridCont = grid.GetChildList().Count;

        if (tankCont <= 7)
        {
            if (grid.gameObject.GetComponent <UIWrapContent>())
            {
                NGUITools.Destroy(grid.gameObject.GetComponent <UIWrapContent>());
            }
            if (gridCont != tankCont)
            {
                StartCoroutine(CreateUnit(grid, dataList, dataDic));
            }
            _scrollview.enabled = false;
        }
        else
        {
            _scrollview.enabled = true;
            UIWrapContent wrap = null;
            if (grid.gameObject.GetComponent <UIWrapContent>())
            {
                wrap = grid.gameObject.GetComponent <UIWrapContent>();
            }
            else
            {
                grid.gameObject.AddComponent <UIWrapContent>();
                wrap = grid.gameObject.GetComponent <UIWrapContent>();
            }
            if (gridCont != 8)
            {
                if (grid != null)
                {
                    grid.DestoryAllChildren();
                }
                CreateWrapUnit(grid, 8);
                if (wrap != null)
                {
                    //绑定方法
                    wrap.itemSize         = (int)grid.cellWidth;
                    wrap.minIndex         = 0;
                    wrap.maxIndex         = (tankCont - 1);
                    wrap.onInitializeItem = OnUpdateItemMain;
                    wrap.enabled          = true;
                    wrap.SortAlphabetically();
                }
            }
        }
    }
Ejemplo n.º 7
0
    public static int SortAlphabetically(IntPtr l)
    {
        int result;

        try
        {
            UIWrapContent uIWrapContent = (UIWrapContent)LuaObject.checkSelf(l);
            uIWrapContent.SortAlphabetically();
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Ejemplo n.º 8
0
    private static int SortAlphabetically(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 1);
            UIWrapContent uIWrapContent = (UIWrapContent)ToLua.CheckObject(L, 1, typeof(UIWrapContent));
            uIWrapContent.SortAlphabetically();
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
Ejemplo n.º 9
0
    //
    void SetWrapContent(UIGrid grid, UIScrollView scrollView, List <Model_Unit> dataList, UIWrapContent.OnInitializeItem OnUpdateItemMain)
    {
        int tankCont  = dataList.Count;
        int itemCount = 0;

        if (tankCont <= 4)
        {
            scrollView.enabled = false;
        }
        else
        {
            scrollView.enabled = true;
        }
        if (tankCont % 2 == 0)
        {
            itemCount = tankCont / 2;
        }
        else
        {
            itemCount = tankCont / 2 + 1;
        }

        UIWrapContent wrap = null;

        if (grid.gameObject.GetComponent <UIWrapContent>())
        {
            wrap = grid.gameObject.GetComponent <UIWrapContent>();
        }
        else
        {
            grid.gameObject.AddComponent <UIWrapContent>();
            wrap = grid.gameObject.GetComponent <UIWrapContent>();
        }
        if (wrap != null)
        {
            //绑定方法
            wrap.itemSize = (int)grid.cellHeight;
            wrap.minIndex = -(itemCount - 1);
            wrap.maxIndex = 0;

            wrap.onInitializeItem = OnUpdateItemMain;
            wrap.enabled          = true;
            wrap.SortAlphabetically();
        }
    }
Ejemplo n.º 10
0
    protected void EventResetPosition()
    {
        for (int i = 0; i < _iCountScrollItem; i++)
        {
            _listScrollViewItem[i].SetActive(i < _iCountRealItem);
        }

        int iMaxItem = Mathf.Max(1, _iCountRealItem - 1);

        _pUIWrapContent.minIndex = -iMaxItem;
        _pUIWrapContent.maxIndex = 0;

        _pUIWrapContent.SortAlphabetically();
        _pUIWrapContent.WrapContent();

        if (_iCountRealItem < _iCountScrollItem)
        {
            _pUIScrollView.ResetPosition();
            _pUIScrollView.RestrictWithinBounds(true);
        }

        ProcCheckDisableDrag();
    }
Ejemplo n.º 11
0
    void SetWrapContent(UIGrid grid, UIScrollView scrollview, List <SlgPB.PVPUser> dataList, UIWrapContent.OnInitializeItem OnUpdateItemMain)
    {
        int dataCount = dataList.Count;

        if (dataCount <= 7)
        {
            scrollview.enabled = false;
        }
        else
        {
            scrollview.enabled = true;
        }
        Trace.trace("dataCount  " + dataCount, Trace.CHANNEL.UI);
        UIWrapContent wrap = null;

        if (grid.gameObject.GetComponent <UIWrapContent>())
        {
            wrap = grid.gameObject.GetComponent <UIWrapContent>();
        }
        else
        {
            grid.gameObject.AddComponent <UIWrapContent>();
            wrap = grid.gameObject.GetComponent <UIWrapContent>();
        }
        if (wrap != null)
        {
            //绑定方法
            wrap.itemSize = (int)grid.cellHeight;
            wrap.minIndex = -(dataCount - 1);
            wrap.maxIndex = 0;

            wrap.onInitializeItem = OnUpdateItemMain;
            wrap.enabled          = true;
            wrap.SortAlphabetically();
        }
    }
Ejemplo n.º 12
0
    void SetWrapContent(UIGrid grid, UIScrollView scrollview, List <HeroDataManager.HeroData> heroDataList, UIWrapContent.OnInitializeItem OnUpdateItemMain)
    {
        int dataCount = heroDataList.Count;

        if (dataCount <= 10)
        {
            _gridChildList[2].SetActive(false);
            scrollview.enabled = false;
        }
        else
        {
            _gridChildList[2].SetActive(true);
            scrollview.enabled = true;
        }
        UIWrapContent wrap = null;

        if (grid.gameObject.GetComponent <UIWrapContent>())
        {
            wrap = grid.gameObject.GetComponent <UIWrapContent>();
        }
        else
        {
            grid.gameObject.AddComponent <UIWrapContent>();
            wrap = grid.gameObject.GetComponent <UIWrapContent>();
        }
        if (wrap != null)
        {
            //绑定方法
            wrap.itemSize         = (int)grid.cellHeight;
            wrap.minIndex         = -(dataCount - 1);
            wrap.maxIndex         = 0;
            wrap.onInitializeItem = OnUpdateItemMain;
            wrap.enabled          = true;
            wrap.SortAlphabetically();
        }
    }