예제 #1
0
    /// <summary>
    /// 弹出框回调
    /// </summary>
    void PaintTipsResponse()
    {
        TipsType type = PaintTips.GetInstance().PaintTipsType;

        switch (type)
        {
        case TipsType.DELETE:
            string delName = CheckDeleteOpetion();
            //进行删除操作
            if (delName != string.Empty)
            {
                print("name:" + delName);
                string imagFullPath = m_strSaveImagePath + delName;
                if (File.Exists(imagFullPath))
                {
                    File.Delete(imagFullPath);
                }
                InitSaveImageList();
                //删除后重新设置背景
                m_PaintPanel.GetComponent <Image>().sprite = m_CurrentBgSp;
            }
            break;

        case TipsType.SAVE:
            string texName = PaintTips.GetInstance().GetSaveName();
            //判断名称是否为空
            if (texName == string.Empty)
            {
                CommonMesTips.GetInstance().AlertTips("输入的名称不能为空!");
                return;
            }
            //检测是否该文件是否已经存在
            string tempPath = m_strSaveImagePath + texName + ".png";
            //不能进行保存
            if (File.Exists(tempPath))
            {
                PaintTips.GetInstance().Show(TipsType.COVER);
                return;
            }
            else
            {
                StartCoroutine(CaptureByRect(new Rect(130, 0, Screen.width - 260, Screen.height), tempPath));
            }
            break;

        //进行清空操作
        case TipsType.CLEAN:
            m_BackBtn.interactable = false;
            for (int i = 0; i < m_LineHistoryObjList.Count; i++)
            {
                Destroy(m_LineHistoryObjList[i]);
            }
            m_LineHistoryObjList.RemoveRange(0, m_LineHistoryObjList.Count);
            break;

        case TipsType.COVER:
            string texName2 = PaintTips.GetInstance().GetSaveName();
            //检测是否该文件是否已经存在
            string tempPath2 = m_strSaveImagePath + texName2 + ".png";
            StartCoroutine(CaptureByRect(new Rect(130, 0, 1074, 750), tempPath2));
            break;

        default:
            break;
        }
    }
예제 #2
0
 private void Awake()
 {
     m_sInstance = this;
 }