SetNativeObject() public method

设置内容为一个原生对象。这个图形对象相当于一个占位的用途。
public SetNativeObject ( DisplayObject obj ) : void
obj DisplayObject 原生对象
return void
示例#1
0
    public RenderImage(GGraph holder)
    {
        _width = (int)holder.width;
        _height = (int)holder.height;
        _cacheTexture = true;

        this._image = new Image();
        holder.SetNativeObject(this._image);

        if (_camera == null)
            CreateCamera();

        this._root = new GameObject("render_image" + _gid++).transform;
        Object.DontDestroyOnLoad(this._root.gameObject);
        this._root.SetParent(_camera.transform, false);
        SetLayer(this._root.gameObject, HIDDEN_LAYER);

        this.modelRoot = new GameObject("model_root").transform;
        Object.DontDestroyOnLoad(this.modelRoot.gameObject);
        this.modelRoot.SetParent(this._root, false);

        this._background = new GameObject("background").transform;
        Object.DontDestroyOnLoad(this._background.gameObject);
        this._background.SetParent(this._root, false);

        this._image.onAddedToStage.Add(OnAddedToStage);
        this._image.onRemovedFromStage.Add(OnRemoveFromStage);

        if (this._image.stage != null)
            OnAddedToStage();
    }
示例#2
0
    public RenderImage(GGraph holder)
    {
        _width = (int)holder.width;
        _height = (int)holder.height;
        _cacheTexture = true;

        this._image = new Image();
        holder.SetNativeObject(this._image);

        Object prefab = Resources.Load("RenderTexture/RenderImageCamera");
        GameObject go = (GameObject)Object.Instantiate(prefab);
        _camera = go.GetComponent<Camera>();
        _camera.transform.position = new Vector3(0, 1000, 0);
        _camera.cullingMask = 1 << RENDER_LAYER;
        _camera.enabled = false;
        Object.DontDestroyOnLoad(_camera.gameObject);

        this._root = new GameObject("RenderImage").transform;
        this._root.SetParent(_camera.transform, false);
        SetLayer(this._root.gameObject, HIDDEN_LAYER);

        this.modelRoot = new GameObject("model_root").transform;
        this.modelRoot.SetParent(this._root, false);

        this._background = new GameObject("background").transform;
        this._background.SetParent(this._root, false);

        this._image.onAddedToStage.Add(OnAddedToStage);
        this._image.onRemovedFromStage.Add(OnRemoveFromStage);

        if (this._image.stage != null)
            OnAddedToStage();
        else
            _camera.gameObject.SetActive(false);
    }
 static public int SetNativeObject(IntPtr l)
 {
     try {
         FairyGUI.GGraph        self = (FairyGUI.GGraph)checkSelf(l);
         FairyGUI.DisplayObject a1;
         checkType(l, 2, out a1);
         self.SetNativeObject(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#4
0
 static int SetNativeObject(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.GGraph        obj  = (FairyGUI.GGraph)ToLua.CheckObject <FairyGUI.GGraph>(L, 1);
         FairyGUI.DisplayObject arg0 = (FairyGUI.DisplayObject)ToLua.CheckObject <FairyGUI.DisplayObject>(L, 2);
         obj.SetNativeObject(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }