예제 #1
0
	/// <summary>
	/// Collects all textures intended for packing,
	/// as well as sprite frames, together into a 
	/// standard form for processing.
	/// </summary>
	public override void Aggregate(PathFromGUIDDelegate guid2Path, LoadAssetDelegate load, GUIDFromPathDelegate path2Guid)
	{
		List<Texture2D> texList = new List<Texture2D>();
		List<CSpriteFrame> frameList = new List<CSpriteFrame>();

		for (int i = 0; i < textureAnimations.Length; ++i)
		{
			textureAnimations[i].Allocate();

			// First try GUIDs:
			if (textureAnimations[i].frameGUIDs.Length >= textureAnimations[i].framePaths.Length)
			{
				for (int j = 0; j < textureAnimations[i].frameGUIDs.Length; ++j)
				{
					string path = guid2Path(textureAnimations[i].frameGUIDs[j]);
					texList.Add((Texture2D)load(path, typeof(Texture2D)));
					frameList.Add(textureAnimations[i].spriteFrames[j]);
				}

				// Make sure we always use GUIDs in the future:
				textureAnimations[i].framePaths = new string[0];
			}
			else
			{
				textureAnimations[i].frameGUIDs = new string[textureAnimations[i].framePaths.Length];

				textureAnimations[i].spriteFrames = new CSpriteFrame[textureAnimations[i].framePaths.Length];
				for (int j = 0; j < textureAnimations[i].spriteFrames.Length; ++j)
					textureAnimations[i].spriteFrames[j] = new CSpriteFrame();

				for (int j = 0; j < textureAnimations[i].framePaths.Length; ++j)
				{
					if (textureAnimations[i].framePaths[j].Length < 1)
						continue;

					// First get a GUID and save it:
					textureAnimations[i].frameGUIDs[j] = path2Guid(textureAnimations[i].framePaths[j]);

					texList.Add((Texture2D)load(textureAnimations[i].framePaths[j], typeof(Texture2D)));
					frameList.Add(textureAnimations[i].spriteFrames[j]);
				}
			}
		}
		
		// Get the static frame info:
		
		// First try GUID:
		if(staticTexGUID.Length > 1)
		{
			staticTexPath = guid2Path(staticTexGUID);
		}
		else // Else, populate the GUID:
		{
			staticTexGUID = path2Guid(staticTexPath);
		}

		texList.Add((Texture2D)load(staticTexPath, typeof(Texture2D)));
		frameList.Add(_ser_stat_frame_info);

		sourceTextures = texList.ToArray();
		spriteFrames = frameList.ToArray();
	}
예제 #2
0
	// Collects all textures intended for packing,
	// as well as sprite frames, together into a 
	// standard form for processing.
	public virtual void Aggregate(PathFromGUIDDelegate guid2Path, LoadAssetDelegate load, GUIDFromPathDelegate path2Guid)
	{
		ArrayList texList = new ArrayList();
		ArrayList frameList = new ArrayList();

		for (int i = 0; i < States.Length; ++i)
		{
			States[i].Allocate();

			// First try GUIDs:
			if (States[i].frameGUIDs.Length >= States[i].framePaths.Length)
			{
				for (int j = 0; j < States[i].frameGUIDs.Length; ++j)
				{
					string path = guid2Path(States[i].frameGUIDs[j]);
					texList.Add(load(path, typeof(Texture2D)));
					frameList.Add(States[i].spriteFrames[j]);
				}

				// Make sure we always use GUIDs in the future:
				States[i].framePaths = new string[0];
			}
			else
			{
				States[i].frameGUIDs = new string[States[i].framePaths.Length];

				States[i].spriteFrames = new CSpriteFrame[States[i].framePaths.Length];
				for (int j = 0; j < States[i].spriteFrames.Length; ++j)
					States[i].spriteFrames[j] = new CSpriteFrame();

				for (int j = 0; j < States[i].framePaths.Length; ++j)
				{
					// First get a GUID and save it:
					States[i].frameGUIDs[j] = path2Guid(States[i].framePaths[j]);

					texList.Add(load(States[i].framePaths[j], typeof(Texture2D)));
					frameList.Add(States[i].spriteFrames[j]);
				}
			}
		}

		sourceTextures = (Texture2D[])texList.ToArray(typeof(Texture2D));
		spriteFrames = (CSpriteFrame[])frameList.ToArray(typeof(CSpriteFrame));
	}
예제 #3
0
	// Collects all textures intended for packing,
	// as well as sprite frames, together into a 
	// standard form for processing.
	// Receives a delegate reference to AssetDatabase.LoadAssetAtPath
	public abstract void Aggregate(PathFromGUIDDelegate guid2Path, LoadAssetDelegate load, GUIDFromPathDelegate path2Guid);
    public virtual void Aggregate(PathFromGUIDDelegate guid2Path, LoadAssetDelegate load, GUIDFromPathDelegate path2Guid)
    {
        List <Texture2D>    list  = new List <Texture2D>();
        List <CSpriteFrame> list2 = new List <CSpriteFrame>();

        for (int i = 0; i < this.States.Length; i++)
        {
            this.States[i].Allocate();
            if (this.States[i].frameGUIDs.Length >= this.States[i].framePaths.Length)
            {
                for (int j = 0; j < this.States[i].frameGUIDs.Length; j++)
                {
                    string path = guid2Path(this.States[i].frameGUIDs[j]);
                    list.Add((Texture2D)load(path, typeof(Texture2D)));
                    list2.Add(this.States[i].spriteFrames[j]);
                }
                this.States[i].framePaths = new string[0];
            }
            else
            {
                this.States[i].frameGUIDs   = new string[this.States[i].framePaths.Length];
                this.States[i].spriteFrames = new CSpriteFrame[this.States[i].framePaths.Length];
                for (int k = 0; k < this.States[i].spriteFrames.Length; k++)
                {
                    this.States[i].spriteFrames[k] = new CSpriteFrame();
                }
                for (int l = 0; l < this.States[i].framePaths.Length; l++)
                {
                    this.States[i].frameGUIDs[l] = path2Guid(this.States[i].framePaths[l]);
                    list.Add((Texture2D)load(this.States[i].framePaths[l], typeof(Texture2D)));
                    list2.Add(this.States[i].spriteFrames[l]);
                }
            }
        }
        this.sourceTextures = list.ToArray();
        this.spriteFrames   = list2.ToArray();
    }
예제 #5
0
    // Collects all textures intended for packing,
    // as well as sprite frames, together into a
    // standard form for processing.
    public virtual void Aggregate(PathFromGUIDDelegate guid2Path, LoadAssetDelegate load, GUIDFromPathDelegate path2Guid)
    {
        ArrayList texList   = new ArrayList();
        ArrayList frameList = new ArrayList();

        for (int i = 0; i < States.Length; ++i)
        {
            States[i].Allocate();

            // First try GUIDs:
            if (States[i].frameGUIDs.Length >= States[i].framePaths.Length)
            {
                for (int j = 0; j < States[i].frameGUIDs.Length; ++j)
                {
                    string path = guid2Path(States[i].frameGUIDs[j]);
                    texList.Add(load(path, typeof(Texture2D)));
                    frameList.Add(States[i].spriteFrames[j]);
                }

                // Make sure we always use GUIDs in the future:
                States[i].framePaths = new string[0];
            }
            else
            {
                States[i].frameGUIDs = new string[States[i].framePaths.Length];

                States[i].spriteFrames = new CSpriteFrame[States[i].framePaths.Length];
                for (int j = 0; j < States[i].spriteFrames.Length; ++j)
                {
                    States[i].spriteFrames[j] = new CSpriteFrame();
                }

                for (int j = 0; j < States[i].framePaths.Length; ++j)
                {
                    // First get a GUID and save it:
                    States[i].frameGUIDs[j] = path2Guid(States[i].framePaths[j]);

                    texList.Add(load(States[i].framePaths[j], typeof(Texture2D)));
                    frameList.Add(States[i].spriteFrames[j]);
                }
            }
        }

        sourceTextures = (Texture2D[])texList.ToArray(typeof(Texture2D));
        spriteFrames   = (CSpriteFrame[])frameList.ToArray(typeof(CSpriteFrame));
    }
예제 #6
0
    /// <summary>
    /// Collects all textures intended for packing,
    /// as well as sprite frames, together into a
    /// standard form for processing.
    /// </summary>
    public override void Aggregate(PathFromGUIDDelegate guid2Path, LoadAssetDelegate load, GUIDFromPathDelegate path2Guid)
    {
        List <Texture2D>    texList   = new List <Texture2D>();
        List <CSpriteFrame> frameList = new List <CSpriteFrame>();

        for (int i = 0; i < textureAnimations.Length; ++i)
        {
            textureAnimations[i].Allocate();

            // First try GUIDs:
            if (textureAnimations[i].frameGUIDs.Length >= textureAnimations[i].framePaths.Length)
            {
                for (int j = 0; j < textureAnimations[i].frameGUIDs.Length; ++j)
                {
                    string path = guid2Path(textureAnimations[i].frameGUIDs[j]);
                    texList.Add((Texture2D)load(path, typeof(Texture2D)));
                    frameList.Add(textureAnimations[i].spriteFrames[j]);
                }

                // Make sure we always use GUIDs in the future:
                textureAnimations[i].framePaths = new string[0];
            }
            else
            {
                textureAnimations[i].frameGUIDs = new string[textureAnimations[i].framePaths.Length];

                textureAnimations[i].spriteFrames = new CSpriteFrame[textureAnimations[i].framePaths.Length];
                for (int j = 0; j < textureAnimations[i].spriteFrames.Length; ++j)
                {
                    textureAnimations[i].spriteFrames[j] = new CSpriteFrame();
                }

                for (int j = 0; j < textureAnimations[i].framePaths.Length; ++j)
                {
                    if (textureAnimations[i].framePaths[j].Length < 1)
                    {
                        continue;
                    }

                    // First get a GUID and save it:
                    textureAnimations[i].frameGUIDs[j] = path2Guid(textureAnimations[i].framePaths[j]);

                    texList.Add((Texture2D)load(textureAnimations[i].framePaths[j], typeof(Texture2D)));
                    frameList.Add(textureAnimations[i].spriteFrames[j]);
                }
            }
        }

        // Get the static frame info:

        // First try GUID:
        if (staticTexGUID.Length > 1)
        {
            staticTexPath = guid2Path(staticTexGUID);
        }
        else         // Else, populate the GUID:
        {
            staticTexGUID = path2Guid(staticTexPath);
        }

        texList.Add((Texture2D)load(staticTexPath, typeof(Texture2D)));
        frameList.Add(_ser_stat_frame_info);

        sourceTextures = texList.ToArray();
        spriteFrames   = frameList.ToArray();
    }
예제 #7
0
 // Collects all textures intended for packing,
 // as well as sprite frames, together into a
 // standard form for processing.
 // Receives a delegate reference to AssetDatabase.LoadAssetAtPath
 public abstract void Aggregate(PathFromGUIDDelegate guid2Path, LoadAssetDelegate load, GUIDFromPathDelegate path2Guid);