Load() публичный Метод

public Load ( string path, string texturePrefix = "", string fontPrefix = "", float zOffset, float zRate = 1, int renderQueueOffset, Camera camera = null, bool autoUpdate = true, bool>.System.Func lwfDataCallback = null, System.Action lwfLoadCallback = null, System.Action lwfDestroyCallback = null, Func,System lwfDataLoader = null, UnityEngine.Texture2D>.System.Func textureLoader = null, System.Action textureUnloader = null, object luaState = null ) : bool
path string
texturePrefix string
fontPrefix string
zOffset float
zRate float
renderQueueOffset int
camera Camera
autoUpdate bool
lwfDataCallback bool>.System.Func
lwfLoadCallback System.Action
lwfDestroyCallback System.Action
lwfDataLoader Func,System
textureLoader UnityEngine.Texture2D>.System.Func
textureUnloader System.Action
luaState object
Результат bool
Пример #1
0
    void InitLWF()
    {
        DestroyLWF();

        if (string.IsNullOrEmpty(mPath))
        {
            Debug.LogWarning(
                "UILWFObject: path should be a correct lwf bytes path");
            return;
        }

        string texturePrefix = System.IO.Path.GetDirectoryName(mPath);

        if (texturePrefix.Length > 0)
        {
            texturePrefix += "/";
        }

        GameObject o = new GameObject(mPath);

        o.layer     = gameObject.layer;
        o.hideFlags = HideFlags.HideAndDontSave;

        Transform transform = o.transform;

        transform.parent        = gameObject.transform;
        transform.localPosition = Vector3.zero;
        transform.localRotation = Quaternion.identity;
        transform.localScale    = Vector3.one;

        Camera camera = NGUITools.FindCameraForLayer(o.layer);

        mLWFObject = o.AddComponent <LWFObject>();
        mLWFObject.Load(mPath, texturePrefix, "",
                        mZOffset, mZRate, mRenderQueueOffset, camera, true);

        int height = (int)camera.orthographicSize * 2;
        int width  = (int)(camera.aspect * (float)height);

        switch (mScaleType)
        {
        case ScaleType.FIT_FOR_HEIGHT:
            mLWFObject.FitForHeight(height);
            break;

        case ScaleType.FIT_FOR_WIDTH:
            mLWFObject.FitForWidth(width);
            break;

        case ScaleType.SCALE_FOR_HEIGHT:
            mLWFObject.ScaleForHeight(height);
            break;

        case ScaleType.SCALE_FOR_WIDTH:
            mLWFObject.ScaleForWidth(width);
            break;
        }
    }
Пример #2
0
    void InitLWF()
    {
        DestroyLWF();

        if (string.IsNullOrEmpty(mPath)) {
            Debug.LogWarning(
                "UILWFObject: path should be a correct lwf bytes path");
            return;
        }

        string texturePrefix = System.IO.Path.GetDirectoryName(mPath);
        if (texturePrefix.Length > 0)
            texturePrefix += "/";

        GameObject o = new GameObject(mPath);
        o.layer = gameObject.layer;
        o.hideFlags = HideFlags.HideAndDontSave;

        Transform transform = o.transform;
        transform.parent = gameObject.transform;
        transform.localPosition = Vector3.zero;
        transform.localRotation = Quaternion.identity;
        transform.localScale = Vector3.one;

        Camera camera = NGUITools.FindCameraForLayer(o.layer);
        mLWFObject = o.AddComponent<LWFObject>();
        mLWFObject.Load(mPath, texturePrefix, "",
            mZOffset, mZRate, mRenderQueueOffset, camera, true);

        int height = (int)camera.orthographicSize * 2;
        int width = (int)(camera.aspect * (float)height);
        switch (mScaleType) {
        case ScaleType.FIT_FOR_HEIGHT:
            mLWFObject.FitForHeight(height);
            break;
        case ScaleType.FIT_FOR_WIDTH:
            mLWFObject.FitForWidth(width);
            break;
        case ScaleType.SCALE_FOR_HEIGHT:
            mLWFObject.ScaleForHeight(height);
            break;
        case ScaleType.SCALE_FOR_WIDTH:
            mLWFObject.ScaleForWidth(width);
            break;
        }
    }