免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費(fèi)電子書(shū)等14項(xiàng)超值服

開(kāi)通VIP
【通過(guò)Unity3d創(chuàng)建二維碼】
本帖最后由 ζ?隨風(fēng)去旅行 于 2014-11-25 14:24 編輯

在如今信息化發(fā)展飛速的世界中,二維碼 也越來(lái)越火,
大街小巷隨處可見(jiàn) ”掃一掃“,
當(dāng)然游戲里面加入二維碼也不是什么稀罕事了 ,
言歸正傳,到底如何實(shí)現(xiàn)?
那讓我們一起看看吧

1.下載ZXing.Net.0.14.0.0,下載地址為http://zxingnet.codeplex.com/


2.解壓下好的文件。


3.打開(kāi),然后找到其中的unity文件夾并打開(kāi)。


4.將文件夾內(nèi)的zxing.unity.dll,放到Unity的工程內(nèi)即可。


5.代碼編寫(xiě)。
代碼 QR_Code
[C#] 純文本查看 復(fù)制代碼
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using UnityEngine;
using System.Collections;
using ZXing;
using ZXing.QrCode;
public class QR_Code: MonoBehaviour
{
public Texture2D encoded;
public string Lastresult;
void Start ()
{
encoded = new Texture2D(256, 256);
Lastresult = "http://www.google.com"; //自己的地址 ,測(cè)試用的谷歌
}
private static Color32[] Encode(string textForEncoding, int width, int height)
{
var writer = new BarcodeWriter
{
Format = BarcodeFormat.QR_CODE,
Options = new QrCodeEncodingOptions
{
Height = height,
Width = width
}
};
return writer.Write(textForEncoding);
}
void Update ()
{
var textForEncoding = Lastresult;
if (textForEncoding != null)
{
var color32 = Encode(textForEncoding, encoded.width, encoded.height);
encoded.SetPixels32(color32);
encoded.Apply();
}
}
void OnGUI()
{
GUI.DrawTexture(new Rect(100, 100,256,256), encoded);
}
}


6.代碼寫(xiě)好以后,將腳本掛在一個(gè)空物體上、運(yùn)行、即可生成二維碼。
運(yùn)行效果如下:


如有不足歡迎點(diǎn)評(píng)~~~

下面是源碼,不想自己寫(xiě)的可以下載 2蠻牛幣一份
二維碼下載.txt(48 Bytes, 下載次數(shù): 30, 售價(jià): 2 蠻牛幣)





本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶(hù)發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
二維碼Java開(kāi)發(fā)(筆記)
ZXing 生成或讀取二維碼(解決中文亂碼的問(wèn)題) - 在鍵盤(pán)上跳舞 - ITeye技術(shù)網(wǎng)站
關(guān)于二維碼實(shí)驗(yàn)的總結(jié)(二探究竟)
QR二維碼生成器源碼(中間可插入小圖片)
基于 zxing 的二維碼掃描
二維碼、條形碼掃描——使用Google ZXing
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服