(个人)AR电子书系统创新实训中期总结

AR电子书项目实训中期总结

已完成内容:

  • 使用ZXing.Net库,验证并测试Unity中生成和识别二维码的功能。
    这里写图片描述

这里写图片描述
- 使用Unity自带的WWW类测试并实现了本地图像和视屏资源的读取,并使用File方法实现了资源的写入。

    //通过www读入本地文件。
    private IEnumerator opt(string path)
    {
        string str = "file:///" + path;
        string filename = path.Substring(path.LastIndexOf("\\") + 1);
        filename = filename.Substring(0, filename.LastIndexOf('.'));
        www = new WWW(@str);
        yield return www;
        if (www != null && string.IsNullOrEmpty(www.error))
        {
            //获取Texture
            //Texture texture = www.texture;

            string fullpath = UnityEngine.Application.dataPath + "/Resources/" + filename + ".png";
            Debug.Log(fullpath);
            testimage.canvasRenderer.SetTexture(txt);

            Debug.Log("加载成功");
        }
        else
        {
            Debug.Log(www.error);
        }
    }
            //文件输出到目标地址
            byte[] data = www.texture.EncodeToPNG();
            File.WriteAllBytes(fullpath, data);
  • 使用ICSharpCode.SharpZipLib库测实现了Unity中文件的打包压缩功能。
        //文件打包为zip
        string[] Array = new string[1];
        Array[0] = UnityEngine.Application.dataPath + "/Resources";
        ZipUtility.Zip(Array, UnityEngine.Application.dataPath + "/ZIPS/test.zip",null, cbk)
  • 初步搭建了一个服务器,并在Unity端使用WWW实现了Post请求上传文件的功能,同时使用PHP在服务器端实现了接收并存储文件的功能。
    这里写图片描述
            //使用WWW上传数据
            byte[] bytes = readingZipWWW.bytes;
            WWWForm form = new WWWForm();
            form.AddField("Name", name);
            form.AddBinaryData("post", bytes);
            uploadWWW = new WWW(url, form);
            Uploading = true;
            StartCoroutine(PostData(uploadWWW));
    <?php  
    //服务器端存储数据
    $myFile = $_FILES["post"]["tmp_name"];  
    $content = '';  
    $fh = fopen($myFile, 'r') or die("can't open file");  
    while (!feof($fh)) {  
        $content .= fgets($fh);//filesize($myFile)) or die('can\'t read');  
    }  
    fclose($fh);  

     //文件存储路径  
    $file_path="upload/";  
     if(is_dir($file_path)!=TRUE) mkdir($file_path,0664) ;  
    $myFile = $file_path.$_REQUEST['Name'].".zip";  
    $fh = fopen($myFile, 'w') or die("can't open file");  
    //$stringData = $_FILES["fileUpload"];  
    $stringData = $content;//"START:\n" . join(',\n',headerCustom()) . ' \END';  
    fwrite($fh, $stringData);  
    fclose($fh);  
    echo $myFile;  
    //echo $file_path + 
    ?>  
  • 使用Unity自带的JsonUtility类验证了数据对象和Json字符串之间相互转换的功能,同时使用File方法以文本形式将Json字符串输出到本地。
        //实例和Json的相互转化
        AssetsArrangementInfo tmpinfo = new AssetsArrangementInfo();
        tmpinfo.srcList.Add("Test00");
        string jsonresult = JsonUtility.ToJson(tmpinfo);
        Debug.Log(jsonresult);
        AssetsArrangementInfo dstInfo = JsonUtility.FromJson<AssetsArrangementInfo>(jsonresult);
        Debug.Log(dstInfo.srcList[0]);

这里写图片描述

目前的工作:

目前正在制作桌面端的资源编辑和管理软件,该软件使用了如上所述的知识,拥有导入多个目标图片和视屏资源,将图片和视屏进行组合,并将资源进行打包上传的功能,上传成功后,程序还会根据服务器返回的地址生成资源的二维码,以供手机端扫描并下载资源。目前该软件的多数功能已设计完成,具体会在以后的几篇博客中进行介绍。
这里写图片描述
这里写图片描述
这里写图片描述
这里写图片描述
这里写图片描述
这里写图片描述

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值