[原創]在ios android裝置上使用 Protobuf (使用源碼方式)

來源:互聯網
上載者:User

標籤:android   style   http   io   os   使用   ar   strong   for   

自:http://game.ceeger.com/forum/read.php?tid=13479

 

如果你的工程只能以.Net 2.0而不能以.Net 2.0 subset運行,請看另外一個方法。 
地址:http://game.ceeger.com/forum/read.php?tid=13479&fid=27 

=============================================================== 
在此感謝下ganqiang87童鞋,本來之前試過這個方法的 但是不行,可是後來他說可以。我就試了下另外一個模式,結果就成了。 

步驟: 
1. 下載protobuf-net源碼, 把其中“protobuf-net”檔案夾 拷貝到unity 即可 . (我從svn下載好之後有很多檔案夾的,比如protobuf-net,protobuf-net_IKVM,protobuf-net_MonoDroid,protobuf-net_Phone7 ,ProtoGen,QuickStart 等等 ,只複製那個protobuf-net就可以 。) 
地址:http://code.google.com/p/protobuf-net/source/checkout 
通過svn下載。 
================================================================================ 
注意:  現在protobuf-net google官網已經不存在源碼了, 作者已經把代碼轉移到github上去了 
         新地址: https://github.com/mgravell/protobuf-net
 
================================================================================ 
2. 建立一個新的檔案smcs.rsp  ,內容是-unsafe 
3. 把工程設定為.Net 2.0 subset 
4. 重啟Unity 
這樣就搞定了。 

需要注意的是: 
你的工程必須是.Net 2.0 subset,  如果是.Net 2.0是無法在ios上用這個方法的。(看文章開頭的紅字) 


如果你之前使用dll的方式,而要轉換成源碼的方式 , 是很簡單的(反之也一樣)。 具體可以看一下源碼中的Serializer類,函數名都一樣。 


提供包下載(裡麵包括了protobuf-net源碼和smcs.rsp ,直接匯入到工程就可以使用):http://pan.ceeger.com/viewfile.php?file_id=1832

(轉)[原創]在ios android裝置上使用 Protobuf (使用源碼方式)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.