少年修仙传客户端基础资源
dabaoji
2023-11-13 0a23e1b83f8fda8ab9f9e32fe71c26c431faf63a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
using UnityEngine;
using System;
using System.Collections.Generic;
using qtools.qhierarchy.phierarchy;
 
namespace qtools.qhierarchy.pcomponent.pbase
{
    public class QBaseComponent
    {
        // PRIVATE
        protected bool enabled = false;
        protected bool showComponentDuringPlayMode = false;
 
        // CONSTRUCTOR
        public QBaseComponent()
        {
        }
 
        // PUBLIC
        public virtual void layout(GameObject gameObject, QObjectList objectList, ref Rect curRect)
        {
 
        }
 
        public virtual void draw(GameObject gameObject, QObjectList objectList, Rect selectionRect, Rect curRect)
        {
 
        }
 
        public virtual void eventHandler(GameObject gameObject, QObjectList objectList, Event currentEvent, Rect curRect)
        {
 
        }
 
        public virtual void disabledHandler(GameObject gameObject, QObjectList objectList)
        {
 
        }
 
        public virtual void setEnabled(bool value)
        {
            this.enabled = value;
        }       
 
        public virtual bool isEnabled()
        {
            if (!enabled) 
            {
                return false;
            }
            else 
            {
                if (Application.isPlaying) return showComponentDuringPlayMode;            
                else return true;
            }
        }
 
        // PROTECTED
        protected void getGameObjectListRecursive(GameObject gameObject, ref List<GameObject>result, int maxDepth = int.MaxValue)
        {
            result.Add(gameObject);
            if (maxDepth > 0)
            {
                Transform transform = gameObject.transform;
                for (int i = transform.childCount - 1; i >= 0; i--)      
                    getGameObjectListRecursive(transform.GetChild(i).gameObject, ref result, maxDepth - 1);     
            }
        }
    }
}