Esempio n. 1
0
    void CleanContainer()
    {
        frames = GetFrames();
        frameByName.Clear();
        for (int f = 0; f < frames.Length; f++)
        {
            frames[f].index = f;
            if (!frameByName.ContainsKey(frames[f].name))
            {
                frameByName.Add(frames[f].name, frames[f]);
            }
        }

        // remove all cached materials for this container
        OT.ClearMaterials("spc:" + name.ToLower() + ":");
        List <OTSprite> sprites = OT.ContainerSprites(this);

        for (int s = 0; s < sprites.Count; s++)
        {
            sprites[s].GetMat();
        }

        if (Application.isPlaying)
        {
            CheckResolutionData();
        }

        dirtyContainer = false;
    }
Esempio n. 2
0
    // Update is called once per frame

    protected void Update()
    {
        if (!OT.isValid)
        {
            return;
        }

        if (!registered || !Application.isPlaying)
        {
            RegisterContainer();
        }

        if (frames.Length == 0 && !dirtyContainer)
        {
            dirtyContainer = true;
        }

        if (!Vector2.Equals(_sheetSize, _sheetSize_))
        {
            _sheetSize_    = _sheetSize;
            dirtyContainer = true;
        }

        if (_texture != texture)
        {
            _texture       = texture;
            dirtyContainer = true;
        }

        if (dirtyContainer || !isReady)
        {
            frames = GetFrames();
            frameByName.Clear();
            for (int f = 0; f < frames.Length; f++)
            {
                frames[f].index = f;
                if (!frameByName.ContainsKey(frames[f].name))
                {
                    frameByName.Add(frames[f].name, frames[f]);
                }
            }

            // remove all cached materials for this container
            OT.ClearMaterials("spc:" + name.ToLower() + ":");
            List <OTSprite> sprites = OT.ContainerSprites(this);
            for (int s = 0; s < sprites.Count; s++)
            {
                sprites[s].GetMat();
            }

            if (Application.isPlaying)
            {
                CheckSizeFactor();
            }

            dirtyContainer = false;
        }
    }