Exemplo n.º 1
0
    private void Awake()
    {
        but = GetComponent <Button>();
        if (acitveOBJ != null)
        {
            but.onClick.AddListener(() => { ActiveLowerObj(); });
        }

        manager = U_RectTransform.GetCanvas(transform).GetComponent <C_CascadeManager>();
    }
Exemplo n.º 2
0
    /// <summary>
    /// 协程,根据一个UI来截取指定范围的屏幕
    /// </summary>
    /// <param name="mFileName">地址+名字+后缀</param>
    /// <param name="tran">截取的UI工具</param>
    /// <returns></returns>
    public static IEnumerator Capture_RectTransform(string mFileName, RectTransform tran)
    {
        Rect rect = U_RectTransform.GetReal_Rect(tran);

        //等待渲染线程结束
        yield return(new WaitForEndOfFrame());

        //初始化Texture2D
        Texture2D mTexture = new Texture2D((int)rect.width, (int)rect.height, TextureFormat.RGB24, false);

        //读取屏幕像素信息并存储为纹理数据
        mTexture.ReadPixels(rect, 0, 0);
        mTexture.Apply();
        //将图片信息编码为字节信息
        byte[] bytes = mTexture.EncodeToPNG();
        //保存
        System.IO.File.WriteAllBytes(mFileName, bytes);
        count += 1;
    }
Exemplo n.º 3
0
 protected virtual void MatchED()
 {
     transform.SetParent(baseMono.hovered.transform);
     U_RectTransform.SetHefuqiYiyangda(itemRect);
 }
Exemplo n.º 4
0
 protected virtual void NotMactch(RectTransform itemRect)
 {
     //如果不匹配,就回到原位
     U_RectTransform.SetHefuqiYiyangda(itemRect);
 }