static public int constructor(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.SortingLayer o;
         o = new UnityEngine.SortingLayer();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
    static void SortingLayer_value(JSVCall vc)
    {
        UnityEngine.SortingLayer _this = (UnityEngine.SortingLayer)vc.csObj;
        var result = _this.value;

        JSApi.setInt32((int)JSApi.SetType.Rval, (System.Int32)(result));
    }
    static void SortingLayer_name(JSVCall vc)
    {
        UnityEngine.SortingLayer _this = (UnityEngine.SortingLayer)vc.csObj;
        var result = _this.name;

        JSApi.setStringS((int)JSApi.SetType.Rval, result);
    }
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.SortingLayer o;
         o=new UnityEngine.SortingLayer();
         pushValue(l,true);
         pushValue(l,o);
         return 2;
     }
     catch(Exception e) {
         return error(l,e);
     }
 }
Ejemplo n.º 5
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.SortingLayer o;
         o = new UnityEngine.SortingLayer();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Ejemplo n.º 6
0
        private void SelectLayer(SortingLayer selectedLayer)
        {
            if (!highlightSelectedLayer) return;

            // Loop through all SpriteRenderers and set opacity of those who are on an unselected layer
            foreach(SpriteRenderer r in MapRootObject.GetComponentsInChildren<SpriteRenderer>())
            {
                int id = r.GetInstanceID();

                // Check if opacity needs to be restored to original value
                if(selectedLayer == SortingLayer.All || r.sortingLayerName == selectedLayer.ToString())
                {
                    // Get stored original opacity (if it wasn't stored for the current object, skip it)
                    float originalOpacity = 1;
                    if (originalSpriteOpacities.ContainsKey(id)) originalOpacity = originalSpriteOpacities[id];
                    else continue;

                    // Only restore value if the opacity matches the constant unselected layer-opacity, otherwise the
                    // user might changed the value beforehand
                    if (r.color.a == UNSELECTED_LAYER_OPACITY) r.color = new Color(r.color.r, r.color.g, r.color.b, originalOpacity);
                }
                else if(r.color.a != UNSELECTED_LAYER_OPACITY)
                {
                    // Current object isn't on a selected layer and isn't already hidden, store original opacity value
                    if (originalSpriteOpacities.ContainsKey(id)) originalSpriteOpacities[id] = r.color.a;
                    else originalSpriteOpacities.Add(id, r.color.a);

                    // Hide it!
                    r.color = new Color(r.color.r, r.color.g, r.color.b, UNSELECTED_LAYER_OPACITY);
                }
            }
        }
Ejemplo n.º 7
0
 public SortingLayerId(string name)
 {
     this.id = SortingLayer.NameToID(name);
 }