Esempio n. 1
0
        /// <summary>

        ///

        /// </summary>

        protected override void UpdateMaterial()

        {
            //Debug.Log("*** STO-UI - UpdateMaterial() *** FRAME (" + Time.frameCount + ")");



            //if (!this.IsActive())

            //    return;



            if (m_canvasRenderer == null)
            {
                m_canvasRenderer = this.canvasRenderer;
            }



            m_canvasRenderer.materialCount = 1;

            m_canvasRenderer.SetMaterial(materialForRendering, 0);

            m_canvasRenderer.SetTexture(mainTexture);



            #if UNITY_EDITOR
            if (m_sharedMaterial != null && gameObject.name != "TMP SubMeshUI [" + m_sharedMaterial.name + "]")
            {
                gameObject.name = "TMP SubMeshUI [" + m_sharedMaterial.name + "]";
            }
            #endif
        }
Esempio n. 2
0
        protected override void UpdateMaterial()
        {
            base.UpdateMaterial();
            if (shouldEmojilize)
            {
                if (IsActive())
                {
                    CreateEmojiCanvasRenderer();

                    emojiCanvasRenderer.materialCount = 1;
                    if (config.material != null)
                    {
                        emojiCanvasRenderer.SetMaterial(GetModifiedEmojiMaterial(config.material), 0);
                    }
                    else
                    {
                        emojiCanvasRenderer.SetMaterial(materialForRendering, 0);
                    }
                    emojiCanvasRenderer.SetTexture(config.texture);
                }
            }
            else
            {
                if (emojiCanvasRenderer != null)
                {
                    emojiCanvasRenderer.Clear();
                }
            }
        }
Esempio n. 3
0
 void Update()
 {
     if (null != VideoChat.localViewTexture)
     {
         LocalViewCanvas.gameObject.GetComponent <Image>().color = Color.white;
         LocalViewCanvas.SetTexture(VideoChat.localViewTexture);
     }
 }
Esempio n. 4
0
 public void Display(string str, Texture image = null)
 {
     panel.SetActive(true);
     if (image == null)
     {
         if (defaultTexture != null)
         {
             canvasRenderer.SetTexture(defaultTexture);
         }
     }
     else
     {
         canvasRenderer.SetTexture(image);
     }
     mainText.text   = str;
     promptText.text = prompt;
 }
Esempio n. 5
0
 void Update()
 {
     if (null != VideoChat.networkTexture)
     {
         //UnityEngine.Debug.Log(VideoChat.networkTexture.width + " , " + VideoChat.networkTexture.height);
         calleeCanvas.SetTexture(VideoChat.networkTexture);
         CalleeCanvasZoom.transform.Find("Callee").gameObject.SetActive(false);
     }
 }
Esempio n. 6
0
 protected override void UpdateMaterial()
 {
     if (m_canvasRenderer == null)
     {
         m_canvasRenderer = canvasRenderer;
     }
     m_canvasRenderer.materialCount = 1;
     m_canvasRenderer.SetMaterial(materialForRendering, 0);
     m_canvasRenderer.SetTexture(mainTexture);
 }
Esempio n. 7
0
 protected override void UpdateMaterial()
 {
     if (m_canvasRenderer == null)
     {
         m_canvasRenderer = canvasRenderer;
     }
     m_canvasRenderer.materialCount = 1;
     m_canvasRenderer.SetMaterial(((Graphic)this).materialForRendering, 0);
     m_canvasRenderer.SetTexture(((Graphic)this).mainTexture);
     if (m_sharedMaterial != null && base.gameObject.name != "TMP SubMeshUI [" + m_sharedMaterial.name + "]")
     {
         base.gameObject.name = "TMP SubMeshUI [" + m_sharedMaterial.name + "]";
     }
 }
Esempio n. 8
0
 void Canvas_willRenderCanvases()
 {
     if (!IsDirty || Mesh == null)
     {
         return;
     }
     IsDirty        = false;
     Mesh.vertices  = Vertices;
     Mesh.triangles = Indices;
     CanvasRenderer.SetMesh(Mesh);
     CanvasRenderer.SetColor(Color);
     CanvasRenderer.materialCount = 1;
     CanvasRenderer.SetMaterial(Canvas.GetDefaultCanvasMaterial(), 0);
     CanvasRenderer.SetTexture(Texture2D.whiteTexture);
     CanvasRenderer.SetAlpha(0.5f);
 }
Esempio n. 9
0
    public static int SetTexture(IntPtr l)
    {
        int result;

        try
        {
            CanvasRenderer canvasRenderer = (CanvasRenderer)LuaObject.checkSelf(l);
            Texture        texture;
            LuaObject.checkType <Texture>(l, 2, out texture);
            canvasRenderer.SetTexture(texture);
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
    private IEnumerator LoadFromLikeCoroutine()
    {
        GameObject go = Instantiate(img);

        go.transform.SetParent(GameObject.Find("MainLayoutPanel").transform, false);
        WWW wwwLoader = new WWW(imageUrl);

        yield return(wwwLoader);


        //image.SetTexture(wwwLoader.texture);

        //go.transform.SetParent(GameObject.Find("MainLayoutPanel").transform, false);
        CanvasRenderer canv = go.GetComponent <CanvasRenderer>();

        canv.SetTexture(wwwLoader.texture);
        go.GetComponent <RectTransform>().sizeDelta = new Vector2(wwwLoader.texture.width, wwwLoader.texture.height);
        go.GetComponent <RectTransform>().position  = new Vector3(Screen.width / 2, Screen.height / 2);
        go.tag = "Draggable";
    }
    void MatToTexture2D()
    {
        //Convert Mat to Texture2D
        DllMainGetRawImageBytes(pixelPtr, out IntPtr pMarkerTransform, out int itemCount);

        int structSize = Marshal.SizeOf(typeof(MarkerTransform));

        List <GameObject> listObject = GameObject.FindGameObjectsWithTag("Planets").ToList <GameObject>();

        for (int i = 0; i < itemCount; ++i)
        {
            MarkerTransform info = (MarkerTransform)Marshal.PtrToStructure(pMarkerTransform, typeof(MarkerTransform));

            string strName = info.marker_id.ToString();

            float iPositionX = (-1.0f + info.x / m_iVideoFrameWidth * 2) * Camera.main.aspect;
            float iPositionY = 1.0f - info.y / m_iVideoFrameHeight * 2;

            Vector3 position = new Vector3(iPositionX, iPositionY, 0);

            GameObject objGame = GameObject.Find(strName);

            if (objGame == null)
            {
                objGame      = Instantiate(objPlanet, position, Quaternion.identity);
                objGame.name = strName;
            }
            else
            {
                objGame.GetComponent <Transform>().position = position;
                objGame.GetComponent <Renderer>().enabled   = true;
                listObject.Remove(objGame);
            }

            pMarkerTransform = new IntPtr(pMarkerTransform.ToInt64() + structSize);
        }

        foreach (GameObject obj in listObject)
        {
            obj.GetComponent <Renderer>().enabled = false;
        }

        if (m_bSpaceMode == true)
        {
            if (m_textureSpace != null)
            {
                canvasRenderer.SetTexture(m_textureSpace);
            }
        }
        else
        {
            tex.SetPixels32(pixel32);
            tex.Apply();
            canvasRenderer.SetTexture(tex);
        }

        //Update the Texture2D with array updated in C++



        RectTransform rectTransform = gameObject.GetComponent <RectTransform>();

        UnityEngine.Vector2 vec2 = new Vector2(Screen.width, Screen.height);
        rectTransform.sizeDelta = vec2;
    }