Ejemplo n.º 1
0
        static StackObject *Ctor_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *__ret = ILIntepreter.Minus(__esp, 0);

            var result_of_this_method = new UnityEngine.Rendering.SortingGroup();

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
 /// <summary>
 /// Write the specified value using the writer.
 /// </summary>
 /// <param name="value">Value.</param>
 /// <param name="writer">Writer.</param>
 public override void Write(object value, ISaveGameWriter writer)
 {
     UnityEngine.Rendering.SortingGroup sortingGroup = (UnityEngine.Rendering.SortingGroup)value;
     writer.WriteProperty("sortingLayerName", sortingGroup.sortingLayerName);
     writer.WriteProperty("sortingLayerID", sortingGroup.sortingLayerID);
     writer.WriteProperty("sortingOrder", sortingGroup.sortingOrder);
     writer.WriteProperty("enabled", sortingGroup.enabled);
     writer.WriteProperty("tag", sortingGroup.tag);
     writer.WriteProperty("name", sortingGroup.name);
     writer.WriteProperty("hideFlags", sortingGroup.hideFlags);
 }
        static int _g_get_sortingOrder(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

            try {
                UnityEngine.Rendering.SortingGroup __cl_gen_to_be_invoked = (UnityEngine.Rendering.SortingGroup)translator.FastGetCSObj(L, 1);
                LuaAPI.xlua_pushinteger(L, __cl_gen_to_be_invoked.sortingOrder);
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
            return(1);
        }
        static int _s_set_sortingLayerName(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

            try {
                UnityEngine.Rendering.SortingGroup __cl_gen_to_be_invoked = (UnityEngine.Rendering.SortingGroup)translator.FastGetCSObj(L, 1);
                __cl_gen_to_be_invoked.sortingLayerName = LuaAPI.lua_tostring(L, 2);
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
            return(0);
        }
Ejemplo n.º 5
0
 public override void ReadFrom(object obj)
 {
     base.ReadFrom(obj);
     if (obj == null)
     {
         return;
     }
     UnityEngine.Rendering.SortingGroup o = (UnityEngine.Rendering.SortingGroup)obj;
     sortingLayerName = o.sortingLayerName;
     sortingLayerID   = o.sortingLayerID;
     sortingOrder     = o.sortingOrder;
 }
        private void _UpdateSortingGroup()
        {
            //发现骨架有SortingGroup,那么子骨架也都加上,反之删除
            _sortingGroup = GetComponent <UnityEngine.Rendering.SortingGroup>();
            if (_sortingGroup != null)
            {
                _sortingMode      = SortingMode.SortByOrder;
                _sortingLayerName = _sortingGroup.sortingLayerName;
                _sortingOrder     = _sortingGroup.sortingOrder;

                foreach (UnitySlot slot in _armature.GetSlots())
                {
                    if (slot.childArmature != null)
                    {
                        var childArmatureProxy = slot.childArmature.proxy as UnityArmatureComponent;
                        childArmatureProxy._sortingGroup =
                            childArmatureProxy.GetComponent <UnityEngine.Rendering.SortingGroup>();
                        if (childArmatureProxy._sortingGroup == null)
                        {
                            childArmatureProxy._sortingGroup = childArmatureProxy.gameObject
                                                               .AddComponent <UnityEngine.Rendering.SortingGroup>();
                        }

                        childArmatureProxy._sortingGroup.sortingLayerName = _sortingLayerName;
                        childArmatureProxy._sortingGroup.sortingOrder     = _sortingOrder;
                    }
                }
            }
            else
            {
                _sortingMode = SortingMode.SortByZ;
                foreach (UnitySlot slot in _armature.GetSlots())
                {
                    if (slot.childArmature != null)
                    {
                        var childArmatureProxy = slot.childArmature.proxy as UnityArmatureComponent;
                        childArmatureProxy._sortingGroup =
                            childArmatureProxy.GetComponent <UnityEngine.Rendering.SortingGroup>();
                        if (childArmatureProxy._sortingGroup != null)
                        {
                            DestroyImmediate(childArmatureProxy._sortingGroup);
                        }
                    }
                }
            }

#if UNITY_EDITOR
            EditorUtility.SetDirty(this);
#endif

            _UpdateSlotsSorting();
        }
Ejemplo n.º 7
0
 public override object WriteTo(object obj, System.Collections.Generic.Dictionary <long, UnityEngine.Object> objects)
 {
     obj = base.WriteTo(obj, objects);
     if (obj == null)
     {
         return(null);
     }
     UnityEngine.Rendering.SortingGroup o = (UnityEngine.Rendering.SortingGroup)obj;
     o.sortingLayerName = sortingLayerName;
     o.sortingLayerID   = sortingLayerID;
     o.sortingOrder     = sortingOrder;
     return(o);
 }
Ejemplo n.º 8
0
        static StackObject *get_sortingOrder_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.Rendering.SortingGroup instance_of_this_method = (UnityEngine.Rendering.SortingGroup) typeof(UnityEngine.Rendering.SortingGroup).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.sortingOrder;

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method;
            return(__ret + 1);
        }
Ejemplo n.º 9
0
        static StackObject *set_sortingOrder_2(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 @value = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.Rendering.SortingGroup instance_of_this_method = (UnityEngine.Rendering.SortingGroup) typeof(UnityEngine.Rendering.SortingGroup).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.sortingOrder = value;

            return(__ret);
        }
        static int __CreateInstance(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

            try {
                if (LuaAPI.lua_gettop(L) == 1)
                {
                    UnityEngine.Rendering.SortingGroup __cl_gen_ret = new UnityEngine.Rendering.SortingGroup();
                    translator.Push(L, __cl_gen_ret);

                    return(1);
                }
            }
            catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
            return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.Rendering.SortingGroup constructor!"));
        }
Ejemplo n.º 11
0
        /// <private/>
        void Awake()
        {
#if UNITY_EDITOR
            if (_IsPrefab())
            {
                return;
            }
#endif
            if (unityData != null && unityData.dragonBonesJSON != null && unityData.textureAtlas != null)
            {
                var dragonBonesData = UnityFactory.factory.LoadData(unityData, isUGUI);
                if (dragonBonesData != null && !string.IsNullOrEmpty(armatureName))
                {
                    UnityFactory.factory.BuildArmatureComponent(armatureName, unityData.dataName, null, null, gameObject, isUGUI);
                    if (!string.IsNullOrEmpty(armatureBaseName))
                    {
                        ArmatureData baseData = UnityFactory.factory.GetArmatureData(armatureBaseName, unityData.dataName);
                        UnityFactory.factory.ReplaceAnimation(armature, baseData);
                    }
                }
            }

            if (_armature != null)
            {
#if UNITY_5_6_OR_NEWER
                if (!isUGUI)
                {
                    _sortingGroup = GetComponent <UnityEngine.Rendering.SortingGroup>();
                }
#endif
                _UpdateSlotsSorting();

                _armature.flipX = _flipX;
                _armature.flipY = _flipY;

                _armature.animation.timeScale = _timeScale;

                if (!string.IsNullOrEmpty(animationName))
                {
                    _armature.animation.Play(animationName, _playTimes);
                }
            }
        }
Ejemplo n.º 12
0
 void Awake()
 {
     SetAlphaTex();
     if (textureFrames != null && textureFrames.materials.Length > 0 && textureFrames.materials[0] != null)
     {
         m_PreMultiplyAlpha = textureFrames.materials[0].GetFloat("_BlendSrc") == (int)UnityEngine.Rendering.BlendMode.One;
     }
                 #if UNITY_5_6_OR_NEWER
     if (!isUGUI)
     {
         _sortingGroup = GetComponent <UnityEngine.Rendering.SortingGroup>();
         if (_sortingGroup)
         {
             sortType           = SortType.ZOrder;
             m_SortingLayerName = _sortingGroup.sortingLayerName;
             m_SortingOrder     = _sortingGroup.sortingOrder;
         }
     }
                 #endif
 }
Ejemplo n.º 13
0
        // Update is called once per frame
        void Update()
        {
            mousePos   = Input.mousePosition;
            mousePos.z = 10f;
            if (Input.GetMouseButtonDown(0))
            {
                GameObject target = targets[cnt % targets.Length];
                GameObject obj    = Instantiate(target, camera.ScreenToWorldPoint(mousePos), Quaternion.identity);
                obj.SetActive(true);
                list.Add(obj);
                UnityEngine.Rendering.SortingGroup sg = obj.GetComponent <UnityEngine.Rendering.SortingGroup>();
                sg.sortingOrder = cnt * 100;
                cnt++;
            }
            if (Input.GetMouseButtonDown(1))
            {
                GameObject target = lit;
                GameObject obj    = Instantiate(target, camera.ScreenToWorldPoint(mousePos), Quaternion.identity);
                obj.SetActive(true);
                list.Add(obj);
                cnt++;
            }

            if (Input.GetKeyDown(KeyCode.Space))
            {
                foreach (GameObject obj in list)
                {
                    Destroy(obj);
                }
                list.Clear();
                cnt = 0;
            }

            if (Input.GetKeyDown(KeyCode.G))
            {
                System.GC.Collect();
            }
        }
        /// <summary>
        /// Read the data into the specified value.
        /// </summary>
        /// <param name="value">Value.</param>
        /// <param name="reader">Reader.</param>
        public override void ReadInto(object value, ISaveGameReader reader)
        {
            UnityEngine.Rendering.SortingGroup sortingGroup = (UnityEngine.Rendering.SortingGroup)value;
            foreach (string property in reader.Properties)
            {
                switch (property)
                {
                case "sortingLayerName":
                    sortingGroup.sortingLayerName = reader.ReadProperty <System.String> ();
                    break;

                case "sortingLayerID":
                    sortingGroup.sortingLayerID = reader.ReadProperty <System.Int32> ();
                    break;

                case "sortingOrder":
                    sortingGroup.sortingOrder = reader.ReadProperty <System.Int32> ();
                    break;

                case "enabled":
                    sortingGroup.enabled = reader.ReadProperty <System.Boolean> ();
                    break;

                case "tag":
                    sortingGroup.tag = reader.ReadProperty <System.String> ();
                    break;

                case "name":
                    sortingGroup.name = reader.ReadProperty <System.String> ();
                    break;

                case "hideFlags":
                    sortingGroup.hideFlags = reader.ReadProperty <UnityEngine.HideFlags> ();
                    break;
                }
            }
        }
 /// <summary>
 /// Read the data using the reader.
 /// </summary>
 /// <param name="reader">Reader.</param>
 public override object Read(ISaveGameReader reader)
 {
     UnityEngine.Rendering.SortingGroup sortingGroup = SaveGameType.CreateComponent <UnityEngine.Rendering.SortingGroup> ();
     ReadInto(sortingGroup, reader);
     return(sortingGroup);
 }
Ejemplo n.º 16
0
        /// <summary>
        /// Lates the update. Sort slot
        /// </summary>
        void LateUpdate()
        {
                        #if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                if (animator != null)
                {
                    UpdateArmature();
                }

                if (parentArmature)
                {
                    sortType = parentArmature.sortType;
                }
                        #if UNITY_5_6_OR_NEWER
                if (!isUGUI)
                {
                    _sortingGroup = gameObject.GetComponent <UnityEngine.Rendering.SortingGroup>();
                    if (parentArmature)
                    {
                        if (parentArmature.sortingGroup != null)
                        {
                            if (_sortingGroup == null)
                            {
                                _sortingGroup = gameObject.AddComponent <UnityEngine.Rendering.SortingGroup>();
                                _sortingGroup.sortingLayerName = sortingLayerName;
                                _sortingGroup.sortingOrder     = sortingOrder;
                            }
                        }
                        else if (_sortingGroup)
                        {
                            DestroyImmediate(_sortingGroup);
                        }
                    }
                }
                        #endif
            }

            SetAlphaTex();
                        #endif

            //caculate sort
            if (slots != null)
            {
                int len = slots.Length;
                for (int i = 0; i < len; ++i)
                {
                    Slot slot = slots[i];
                    if (slot && slot.isActiveAndEnabled)
                    {
                        slot.CheckZorderChange();
                    }
                }
            }

            if (m_CanSortAllSlot)
            {
                ForceSortAll();
                m_CanSortAllSlot = false;
                int temp = (int)m_ZOrderValid;
                if (Mathf.Abs(m_ZOrderValid - temp) > 0.0001f)
                {
                    return;
                }
                if (temp != __ZOrderValid)
                {
                    __ZOrderValid = temp;
                }
            }
            else
            {
                int temp = (int)m_ZOrderValid;
                if (Mathf.Abs(m_ZOrderValid - temp) > 0.0001f)
                {
                    return;
                }
                if (temp != __ZOrderValid)
                {
                    __ZOrderValid = temp;
                    ResetSlotZOrder();
                }
            }
        }
Ejemplo n.º 17
0
        void LateUpdate()
        {
            if (_armature == null)
            {
                return;
            }

            flipX = _armature.flipX;
            flipY = _armature.flipY;

                        #if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                                #if UNITY_5_6_OR_NEWER
                if (!isUGUI)
                {
                    _sortingGroup = GetComponent <UnityEngine.Rendering.SortingGroup>();
                    if (_sortingGroup)
                    {
                        sortingMode       = SortingMode.SortByOrder;
                        _sortingLayerName = _sortingGroup.sortingLayerName;
                        _sortingOrder     = _sortingGroup.sortingOrder;
                    }
                }
                                #endif
                foreach (var slot in _armature.GetSlots())
                {
                    var display = slot.display as GameObject;
                    if (display != null)
                    {
                        display.transform.localPosition = new Vector3(display.transform.localPosition.x, display.transform.localPosition.y, -slot._zOrder * (_zSpace + 0.001f));
                        if (!isUGUI && sortingMode == SortingMode.SortByOrder)
                        {
                            UnitySlot us = slot as UnitySlot;
                            if (us.meshRenderer != null)
                            {
                                us.meshRenderer.sortingOrder = slot._zOrder;
                            }
                        }
                    }
                }
            }
                        #endif
            if (zorderIsDirty)
            {
                _sortedSlots = new List <Slot>(_armature.GetSlots());
                _sortedSlots.Sort(delegate(Slot x, Slot y) {
                    return(x._zOrder - y._zOrder);
                });
                for (int i = 0; i < _sortedSlots.Count; ++i)
                {
                    Slot slot    = _sortedSlots[i];
                    var  display = slot.display as GameObject;
                    if (display != null)
                    {
                        display.transform.SetSiblingIndex(i);
                        if (!isUGUI && sortingMode == SortingMode.SortByOrder)
                        {
                            UnitySlot us = slot as UnitySlot;
                            if (us.meshRenderer != null)
                            {
                                us.meshRenderer.sortingOrder = i;
                            }
                        }
                    }
                }
                zorderIsDirty = false;
            }
            if (unityBones != null)
            {
                int len = unityBones.Count;
                for (int i = 0; i < len; ++i)
                {
                    UnityBone bone = unityBones[i];
                    if (bone)
                    {
                        bone._Update();
                    }
                }
            }
        }
Ejemplo n.º 18
0
        /**
         * @private
         */
        void Awake()
        {
                        #if UNITY_5_6_OR_NEWER
            if (!isUGUI)
            {
                _sortingGroup = GetComponent <UnityEngine.Rendering.SortingGroup>();
                if (_sortingGroup)
                {
                    sortingMode       = SortingMode.SortByOrder;
                    _sortingLayerName = _sortingGroup.sortingLayerName;
                    _sortingOrder     = _sortingGroup.sortingOrder;
                }
            }
                        #endif
            if (slotsRoot == null)
            {
                GameObject go = new GameObject("Slots");
                go.transform.SetParent(transform);
                go.transform.localPosition = Vector3.zero;
                go.transform.localRotation = Quaternion.identity;
                go.transform.localScale    = Vector3.one;
                slotsRoot    = go;
                go.hideFlags = HideFlags.NotEditable;
            }
            zorderIsDirty = true;

            if (unityData != null && unityData.dragonBonesJSON != null && unityData.textureAtlas != null)
            {
                var dragonBonesData = UnityFactory.factory.LoadData(unityData, isUGUI);
                if (dragonBonesData != null && !string.IsNullOrEmpty(armatureName))
                {
                    UnityFactory.factory.BuildArmatureComponent(armatureName, dragonBonesData.name, null, unityData.dataName, gameObject);
                }
            }


            if (_armature != null)
            {
                sortingLayerName = sortingLayerName;
                sortingOrder     = sortingOrder;
                _armature.flipX  = flipX;
                _armature.flipY  = flipY;
                if (zSpace > 0)
                {
                    foreach (var slot in _armature.GetSlots())
                    {
                        var display = slot.display as GameObject;
                        if (display != null)
                        {
                            display.transform.localPosition = new Vector3(display.transform.localPosition.x, display.transform.localPosition.y, -slot._zOrder * (_zSpace + 0.001f));
                            if (!isUGUI && sortingMode == SortingMode.SortByOrder)
                            {
                                UnitySlot us = slot as UnitySlot;
                                if (us.meshRenderer != null)
                                {
                                    us.meshRenderer.sortingOrder = slot._zOrder;
                                }
                            }
                        }
                    }
                }
                if (!string.IsNullOrEmpty(animationName))
                {
                    _armature.animation.Play(animationName);
                }
                CollectBones();
            }
        }
        /// <private/>
        void Awake()
        {
#if UNITY_EDITOR
            if (_IsPrefab())
            {
                return;
            }
#endif

            if (slotsRoot == null)
            {
                var slotsContainer = transform.Find("Slots");
                if (slotsContainer == null)
                {
                    GameObject go = new GameObject("Slots");
                    go.transform.SetParent(transform);
                    go.transform.localPosition = Vector3.zero;
                    go.transform.localRotation = Quaternion.identity;
                    go.transform.localScale    = Vector3.one;
                    slotsRoot = go;
                }
                else
                {
                    slotsRoot = slotsContainer.gameObject;
                }
            }

            List <UnityEngine.Transform> destroySlots = new List <UnityEngine.Transform>();
            for (int i = 0; i < slotsRoot.transform.childCount; ++i)
            {
                destroySlots.Add(slotsRoot.transform.GetChild(i));
            }
            for (int i = 0; i < destroySlots.Count; ++i)
            {
                UnityFactoryHelper.DestroyUnityObject(destroySlots[i].gameObject);
            }
            destroySlots.Clear();
            destroySlots = null;


            if (unityData != null && unityData.dragonBonesJSON != null && unityData.textureAtlas != null)
            {
                var dragonBonesData = UnityFactory.factory.LoadData(unityData, isUGUI);
                if (dragonBonesData != null && !string.IsNullOrEmpty(armatureName))
                {
                    UnityFactory.factory.BuildArmatureComponent(armatureName, unityData.dataName, null, null, gameObject, isUGUI);
                    if (!string.IsNullOrEmpty(armatureBaseName))
                    {
                        ArmatureData baseData = UnityFactory.factory.GetArmatureData(armatureBaseName, unityData.dataName);
                        UnityFactory.factory.ReplaceAnimation(armature, baseData);
                    }
                }
            }

            if (_armature != null)
            {
#if UNITY_5_6_OR_NEWER
                if (!isUGUI)
                {
                    _sortingGroup = GetComponent <UnityEngine.Rendering.SortingGroup>();
                }
#endif
                _UpdateSlotsSorting();

                _armature.flipX = _flipX;
                _armature.flipY = _flipY;

                _armature.animation.timeScale = _timeScale;

                if (!string.IsNullOrEmpty(animationName))
                {
                    _armature.animation.Play(animationName, _playTimes);
                }
            }
            CollectBones();
        }
        /**
         * @private
         */
        void Awake()
        {
            #if UNITY_EDITOR
            if (_isPrefab())
            {
                return;
            }
            #endif

            #if UNITY_5_6_OR_NEWER
            if (!isUGUI)
            {
                _sortingGroup = GetComponent <UnityEngine.Rendering.SortingGroup>();
                if (_sortingGroup)
                {
                    sortingMode       = SortingMode.SortByOrder;
                    _sortingLayerName = _sortingGroup.sortingLayerName;
                    _sortingOrder     = _sortingGroup.sortingOrder;
                }
            }
                        #endif

            zorderIsDirty = true;
            //if(unityData != null && (unityData.dragonBonesJSON != null || unityData.dragonBonesBinary != null) && unityData.textureAtlas != null)
            if (unityData != null && unityData.dragonBonesJSON != null && unityData.textureAtlas != null)
            {
                var dragonBonesData = UnityFactory.factory.LoadData(unityData, isUGUI);
                if (dragonBonesData != null && !string.IsNullOrEmpty(armatureName))
                {
                    UnityFactory.factory.BuildArmatureComponent(armatureName, dragonBonesData.name, null, unityData.dataName, gameObject, isUGUI);
                }
            }

            if (_armature != null)
            {
                sortingLayerName = sortingLayerName;
                sortingOrder     = sortingOrder;
                _armature.flipX  = flipX;
                _armature.flipY  = flipY;
                _armature.animation.timeScale = _timeScale;

                if (zSpace > 0 || sortingMode == SortingMode.SortByOrder)
                {
                    foreach (var slot in _armature.GetSlots())
                    {
                        var display = slot.display as GameObject;
                        if (display != null)
                        {
                            display.transform.localPosition = new Vector3(display.transform.localPosition.x, display.transform.localPosition.y, -slot._zOrder * (zSpace + 0.001f));
                            if (!isUGUI && sortingMode == SortingMode.SortByOrder)
                            {
                                UnitySlot us = slot as UnitySlot;
                                if (us.meshRenderer != null)
                                {
                                    us.meshRenderer.sortingOrder = slot._zOrder;
                                }
                            }
                        }
                    }
                }
                if (!string.IsNullOrEmpty(animationName))
                {
                    _armature.animation.Play(animationName, _playTimes);
                }

                CollectBones();
            }
        }