Beispiel #1
0
    public virtual bool Load(string path,
                             string texturePrefix            = "", string fontPrefix = "",
                             float zOffset                   = 0, float zRate        = 1, int renderQueueOffset = 0,
                             Camera camera                   = null, bool autoUpdate = true,
                             LWFDataCallback lwfDataCallback = null,
                             LWFLoadCallback lwfLoadCallback = null,
                             LWFDataLoader lwfDataLoader     = null,
                             TextureLoader textureLoader     = null,
                             TextureUnloader textureUnloader = null)
    {
        lwfName    = path;
        callUpdate = autoUpdate;
        if (camera == null)
        {
            camera = Camera.main;
        }

        if (lwfLoadCallback != null)
        {
            lwfLoadCallbacks.Add(lwfLoadCallback);
        }

        LWF.Data data =
            ResourceCache.SharedInstance().LoadLWFData(lwfName, lwfDataLoader);
        if (data == null || !data.Check())
        {
            return(false);
        }

        if (lwfDataCallback != null && !lwfDataCallback(data))
        {
            return(false);
        }

        if (rendererFactoryConstructor != null)
        {
            RendererFactoryArguments arg = new RendererFactoryArguments(
                data, gameObject, zOffset, zRate, renderQueueOffset, camera,
                texturePrefix, fontPrefix, textureLoader, textureUnloader);
            factory = rendererFactoryConstructor(arg);
        }
        else if (useCombinedMeshRenderer && data.textures.Length == 1)
        {
            factory = new LWF.CombinedMeshRenderer.Factory(
                data, gameObject, zOffset, zRate, renderQueueOffset, camera,
                texturePrefix, fontPrefix, textureLoader, textureUnloader);
        }
        else
        {
            factory = new LWF.DrawMeshRenderer.Factory(
                data, gameObject, zOffset, zRate, renderQueueOffset, camera,
                texturePrefix, fontPrefix, textureLoader, textureUnloader);
        }

        lwf = new LWF.LWF(data, factory);

        OnLoad();

        return(true);
    }
	public virtual bool Load(string path,
		string texturePrefix = "", string fontPrefix = "",
		float zOffset = 0, float zRate = 1, int renderQueueOffset = 0,
		Camera camera = null, bool autoUpdate = true,
		bool useAdditionalColor = false,
		LWFDataCallback lwfDataCallback = null,
		LWFCallback lwfLoadCallback = null,
		LWFCallback lwfDestroyCallback = null,
		LWFDataLoader lwfDataLoader = null,
		TextureLoader textureLoader = null,
		TextureUnloader textureUnloader = null
#if LWF_USE_LUA
		, object luaState = null
#endif
		)
	{
		lwfName = path;
		callUpdate = autoUpdate;
		if (camera == null)
			camera = Camera.main;

		if (lwfLoadCallback != null)
			lwfLoadCallbacks.Add(lwfLoadCallback);
		if (lwfDestroyCallback != null)
			lwfDestroyCallbacks.Add(lwfDestroyCallback);

		LWF.Data data =
			ResourceCache.SharedInstance().LoadLWFData(lwfName, lwfDataLoader);
		if (data == null || !data.Check())
			return false;

		if (lwfDataCallback != null && !lwfDataCallback(data))
			return false;

		if (rendererFactoryConstructor != null) {
			RendererFactoryArguments arg = new RendererFactoryArguments(
				data, gameObject, zOffset, zRate, renderQueueOffset,
				useAdditionalColor, camera, texturePrefix, fontPrefix,
				textureLoader, textureUnloader);
			factory = rendererFactoryConstructor(arg);
		} else if (useCombinedMeshRenderer && data.textures.Length == 1) {
			factory = new LWF.CombinedMeshRenderer.Factory(
				data, gameObject, zOffset, zRate, renderQueueOffset,
				useAdditionalColor, camera, texturePrefix, fontPrefix,
				textureLoader, textureUnloader);
		} else {
			factory = new LWF.DrawMeshRenderer.Factory(
				data, gameObject, zOffset, zRate, renderQueueOffset,
				useAdditionalColor, camera, texturePrefix, fontPrefix,
				textureLoader, textureUnloader);
		}

#if LWF_USE_LUA
		lwf = new LWF.LWF(data, factory, luaState);
#else
		lwf = new LWF.LWF(data, factory);
#endif

		OnLoad();

		return true;
	}