Exemple #1
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        EditorGUILayout.Space();

        LoopScrollRect scroll = (LoopScrollRect)target;

        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Clear"))
        {
            scroll.ClearCells();
        }
        if (GUILayout.Button("Refresh"))
        {
            scroll.RefreshCells();
        }
        if (GUILayout.Button("Refill"))
        {
            scroll.RefillCells(50);
        }
        if (GUILayout.Button("RefillFromEnd"))
        {
            scroll.RefillCellsFromEnd();
        }
        EditorGUILayout.EndHorizontal();
    }
Exemple #2
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        EditorGUILayout.Space();

        LoopScrollRect scroll = (LoopScrollRect)target;

        if (GUILayout.Button("Create PoolObject"))
        {
            var _tf = scroll.transform.Find(LoopScrollPrefabSource.__POOLSNAME);

            if (!_tf)
            {
                GameObject _gameObject = new GameObject(LoopScrollPrefabSource.__POOLSNAME);

                _gameObject.transform.SetParent(scroll.transform);
                _gameObject.transform.localScale    = Vector3.one;
                _gameObject.transform.localPosition = Vector3.zero;

                _tf = _gameObject.transform;
            }

            scroll.prefabSource.PoolGameObject = _tf;

            Debug.Log("Create Suc!");
        }

        GUI.enabled = Application.isPlaying;

        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Clear"))
        {
            scroll.ClearCells();
        }
        if (GUILayout.Button("Refresh"))
        {
            scroll.RefreshCells();
        }
        if (GUILayout.Button("Refill"))
        {
            scroll.RefillCells();
        }
        if (GUILayout.Button("RefillFromEnd"))
        {
            scroll.RefillCellsFromEnd();
        }
        EditorGUILayout.EndHorizontal();

        EditorGUIUtility.labelWidth = 45;
        float w = (EditorGUIUtility.currentViewWidth - 100) / 2;

        EditorGUILayout.BeginHorizontal();
        index = EditorGUILayout.IntField("Index", index, GUILayout.Width(w));
        speed = EditorGUILayout.FloatField("Speed", speed, GUILayout.Width(w));
        if (GUILayout.Button("Scroll", GUILayout.Width(45)))
        {
            scroll.SrollToCell(index, speed);
        }
        EditorGUILayout.EndHorizontal();
    }
Exemple #3
0
    /// <summary>
    /// 修改列表滑动状态
    /// </summary>
    /// <param name="type">0:始终显示最新数据 2:停留当前界面</param>
    public void ChangeListSlideType(int type)
    {
        //Debug.Log("更改列表填充状态");
        switch (type)
        {
        case 0:
            _loopScrollRect.RefillCellsFromEnd(0);
            break;

        case 1:
            _loopScrollRect.RefillCells();
            break;
        }
    }
Exemple #4
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            EditorGUILayout.Space();

            LoopScrollRect scroll = (LoopScrollRect)target;

            GUI.enabled = Application.isPlaying;

            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("Clear"))
            {
                scroll.ClearCells();
            }

            if (GUILayout.Button("Refresh"))
            {
                scroll.RefreshCells();
            }

            if (GUILayout.Button("Refill"))
            {
                scroll.RefillCells();
            }

            if (GUILayout.Button("RefillFromEnd"))
            {
                scroll.RefillCellsFromEnd();
            }

            EditorGUILayout.EndHorizontal();

            EditorGUIUtility.labelWidth = 45;
            float w = (EditorGUIUtility.currentViewWidth - 100) / 2;

            EditorGUILayout.BeginHorizontal();
            index = EditorGUILayout.IntField("Index", index, GUILayout.Width(w));
            speed = EditorGUILayout.FloatField("Speed", speed, GUILayout.Width(w));
            if (GUILayout.Button("Scroll", GUILayout.Width(45)))
            {
                scroll.SrollToCell(index, speed);
            }

            EditorGUILayout.EndHorizontal();
        }