Ejemplo n.º 1
0
 public void OnDestroy()
 {
     //if (_FakeObj != null)
     //{
     //    CGFakeObj(_FakeObj);
     //}
     _FakeObj = null;
 }
Ejemplo n.º 2
0
 private void InitImage()
 {
     if (_FakeObj == null || _FakeObj._ObjTransorm == null)
     {
         _RawImage.color = new Color(1, 1, 1, 0);
         _FakeObj        = CreateNewFake();
         if (_FakeObj != null && _FakeObj._ObjCamera != null)
         {
             _FakeObj._ObjCamera.transform.SetParent(null);
         }
         _RawImage.texture = _FakeObj._ObjTexture;
         //_RawImage.material = Resources.Load<Material>("Material/UIRenderTex");
         _RawImage.color = new Color(1, 1, 1, 1);
     }
 }
Ejemplo n.º 3
0
    //private static Stack<FakeShowObj> _IdleFakeList = new Stack<FakeShowObj>();
    //private FakeShowObj GetIdleFakeShow()
    //{
    //    if (_IdleFakeList != null && _IdleFakeList.Count > 0)
    //    {
    //        var popFakeObj = _IdleFakeList.Pop();
    //        if (popFakeObj._ObjCamera != null)
    //        {
    //            popFakeObj._ObjCamera.gameObject.SetActive(true);
    //            return popFakeObj;
    //        }
    //    }

    //    return CreateNewFake();
    //}

    private FakeShowObj CreateNewFake()
    {
        FakeShowObj fakeObj = new FakeShowObj();

        GameObject cameraGO = Instantiate(_CameraPrefab);

        cameraGO.transform.SetParent(null);
        fakeObj._ObjCamera                  = cameraGO.GetComponent <Camera>();
        cameraGO.transform.position         = new Vector3(1000 + 100 * _CallTimes, -1000, 0);
        cameraGO.transform.rotation         = Camera.main.transform.rotation;
        fakeObj._ObjTransorm                = cameraGO.transform.Find("GameObject");
        fakeObj._ObjTexture                 = new RenderTexture(1024, 1024, 16, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Default);
        fakeObj._ObjTexture.depth           = 32;
        fakeObj._ObjCamera.orthographicSize = (cameraSize <= 0 ? 1 : cameraSize);
        fakeObj._ObjCamera.targetTexture    = fakeObj._ObjTexture;
        //fakeObj._ObjCamera.cullingMask = _CameraPrefab.layer;
        fakeObj._ObjCamera.depthTextureMode = DepthTextureMode.Depth;
        ++_CallTimes;

        return(fakeObj);
    }