Ejemplo n.º 1
0
 internal LayerState(StateModeEnum mode, LayersImpl layers, LayerStates baseStates)
 {
     this.mode               = mode;
     this.layers             = layers;
     this.layers.parentState = this;
     Attach(baseStates);
 }
Ejemplo n.º 2
0
    void Awake()
    {
        layerStates = GetComponent<LayerStates> ();
        camera = GameObject.Find ("Main Camera").camera;
        /*
         * First we need to determine how large the array of children
         * with Renderers is going to be so that we can update the
         * childRenderers arrays size
         */
        int rendererCount = 0;
        foreach (Transform transformChild in transform) {
            if(transformChild.gameObject.GetComponent<Renderer>()) {
                rendererCount++;
            }
        }

        childRenderers = new Renderer[rendererCount];							// Set the new array size
        int rendererIterator = 0;												// Set up an iterator count so we can add renderers into array and set up material Colors
        foreach (Transform transformChild in transform) {						// Iterate through all the child transforms of this Shape Layer
            if(transformChild.gameObject.GetComponent<Renderer>()) {			// Check to see if this child has a renderer component
                Renderer thisRenderer = transformChild.gameObject.GetComponent<Renderer>();	// Cache this iteration's Renderer
                childRenderers[rendererIterator] = thisRenderer;				// Add it into the array
                Color col = thisRenderer.material.color;						// Cache the Color
                var newMat = new Color(col.r, col.g, col.b, 1);					// Create a new Color reference
                thisRenderer.material.color = newMat;							// Set the renderer material's colour to the newMat variable reference
                rendererIterator++;												// Increment the iteration counter
            }
        }
    }
Ejemplo n.º 3
0
 /**
  * <summary>Creates a new action within the given document context.</summary>
  */
 public SetLayerState(
     Document context,
     params LayerState[] states
     ) : base(context, PdfName.SetOCGState)
 {
     States = new LayerStates();
     if (states != null && states.Length > 0)
     {
         var layerStates = States;
         foreach (var state in states)
         {
             layerStates.Add(state);
         }
     }
 }
Ejemplo n.º 4
0
                protected override void RemoveItem(int index)
                {
                    // High-level definition.
                    base.RemoveItem(index);
                    // Low-level definition.
                    LayerStates baseStates = BaseStates;

                    if (baseStates != null)
                    {
                        int baseIndex = baseStates.GetBaseIndex(parentState);
                        int itemIndex = baseIndex
                                        + 1      // Name object offset.
                                        + index; // Layer object offset.
                        baseStates.BaseDataObject.RemoveAt(itemIndex);
                    }
                }
Ejemplo n.º 5
0
                protected override void InsertItem(int index, Layer item)
                {
                    // High-level definition.
                    base.InsertItem(index, item);
                    // Low-level definition.
                    LayerStates baseStates = BaseStates;

                    if (baseStates != null)
                    {
                        int baseIndex = baseStates.GetBaseIndex(parentState);
                        int itemIndex = baseIndex
                                        + 1      // Name object offset.
                                        + index; // Layer object offset.
                        baseStates.BaseDataObject[itemIndex] = item.BaseObject;
                    }
                }
Ejemplo n.º 6
0
                protected override void ClearItems()
                {
                    // Low-level definition.
                    LayerStates baseStates = BaseStates;

                    if (baseStates != null)
                    {
                        int itemIndex = baseStates.GetBaseIndex(parentState)
                                        + 1; // Name object offset.
                        for (int count = Count; count > 0; count--)
                        {
                            baseStates.BaseDataObject.RemoveAt(itemIndex);
                        }
                    }
                    // High-level definition.
                    base.ClearItems();
                }
Ejemplo n.º 7
0
 /**
  * <summary>Creates a new action within the given document context.</summary>
  */
 public SetLayerState(
     Document context
     ) : base(context, PdfName.SetOCGState)
 {
     States = new LayerStates();
 }
Ejemplo n.º 8
0
 internal void Detach(
     )
 {
     baseStates = null;
 }
Ejemplo n.º 9
0
 internal void Attach(
     LayerStates baseStates
     )
 {
     this.baseStates = baseStates;
 }
Ejemplo n.º 10
0
 public Layer()
 {
     chainStack = new StackManager();
     state      = LayerStates.Unchained;
 }
Ejemplo n.º 11
0
 void Awake()
 {
     layerStates = gameObject.transform.parent.GetComponent<LayerStates> ();
 }