Exemple #1
0
        public void RemoveMahjongScript()
        {
            if (_roll != null)
            {
                DestroyImmediate(_roll);
                _roll = null;
            }

            if (_uc != null)
            {
                DestroyImmediate(_uc);
                _uc = null;
            }

            if (_box != null)
            {
                DestroyImmediate(_box);
                _box = null;
            }

            if (_icon != null)
            {
                _icon.OnRemoveComponent();
                DestroyImmediate(_icon);
                _icon = null;
            }
            else
            {
                //删除复制出来的麻将的 听或游金Icon
                for (int i = 0; i < transform.childCount; i++)
                {
                    var obj = transform.GetChild(i);
                    if (obj.name.Contains("Clone"))
                    {
                        DestroyImmediate(obj.gameObject);
                    }
                }
            }
        }