﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-点点滴滴-随笔分类-02 编程语言</title><link>http://www.cppblog.com/ming81/category/15281.html</link><description /><language>zh-cn</language><lastBuildDate>Sat, 01 Nov 2014 08:21:37 GMT</lastBuildDate><pubDate>Sat, 01 Nov 2014 08:21:37 GMT</pubDate><ttl>60</ttl><item><title>(地基工)NodeJs 双感叹号用法  </title><link>http://www.cppblog.com/ming81/archive/2014/10/31/208736.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Fri, 31 Oct 2014 07:54:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2014/10/31/208736.html</guid><description><![CDATA[<h3><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.63636302948px; font-weight: normal; line-height: 18.981819152832px; background-color: #ffffff;"><span style="font-size: 13.63636302948px; line-height: 18.981819152832px;">当值是非空字符串和非零数字返回true，当值是空字符串、0或者null返回false。<br /><br /></span></p><div style="margin: 5px 0px; font-weight: normal; font-size: 12px !important;"><div style="margin: 5px 0px 0px;"><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->var&nbsp;a&nbsp;=&nbsp;"&nbsp;";&nbsp;alert(!!a);&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">true</span><span style="color: #008000; "><br /></span>var&nbsp;a&nbsp;=&nbsp;"s";&nbsp;alert(!!a);&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">true</span><span style="color: #008000; "><br /></span>var&nbsp;a&nbsp;=&nbsp;<span style="color: #0000FF; ">true</span>;&nbsp;alert(!!a);&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">true</span><span style="color: #008000; "><br /></span>var&nbsp;a&nbsp;=&nbsp;1;&nbsp;alert(!!a);&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">true</span><span style="color: #008000; "><br /></span>var&nbsp;a&nbsp;=&nbsp;-1;&nbsp;alert(!!a);&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">true</span><span style="color: #008000; "><br /></span>var&nbsp;a&nbsp;=&nbsp;-2;&nbsp;alert(!!a);&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">true</span><span style="color: #008000; "><br /></span>&nbsp;<br />var&nbsp;a&nbsp;=&nbsp;0;&nbsp;alert(!!a);&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">false</span><span style="color: #008000; "><br /></span>var&nbsp;a&nbsp;=&nbsp;"";&nbsp;alert(!!a);&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">false</span><span style="color: #008000; "><br /></span>var&nbsp;a&nbsp;=&nbsp;<span style="color: #0000FF; ">false</span>;&nbsp;alert(!!a);&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">false</span><span style="color: #008000; "><br /></span>var&nbsp;a&nbsp;=&nbsp;<span style="color: #0000FF; ">null</span>;&nbsp;alert(!!a);&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">false</span></div></div></div></h3><img src ="http://www.cppblog.com/ming81/aggbug/208736.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2014-10-31 15:54 <a href="http://www.cppblog.com/ming81/archive/2014/10/31/208736.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)推荐！国外程序员整理的 C++ 资源大全</title><link>http://www.cppblog.com/ming81/archive/2014/10/27/208684.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Mon, 27 Oct 2014 07:51:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2014/10/27/208684.html</guid><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 标准库C++标准库，包括了STL容器，算法和函数等。C++ Standard Library：是一系列类和函数的集合，使用核心语言编写，也是C++ISO自身标准的一部分。Standard Template Library：标准模板库C POSIX library&nbsp;： POSIX系统的C标准库规范ISO C++ Standards Committee&nbsp;：C++标准委员会&nbsp...&nbsp;&nbsp;<a href='http://www.cppblog.com/ming81/archive/2014/10/27/208684.html'>阅读全文</a><img src ="http://www.cppblog.com/ming81/aggbug/208684.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2014-10-27 15:51 <a href="http://www.cppblog.com/ming81/archive/2014/10/27/208684.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)数学库：UMFPACK </title><link>http://www.cppblog.com/ming81/archive/2014/10/20/208626.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Mon, 20 Oct 2014 03:53:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2014/10/20/208626.html</guid><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;&nbsp;<a href='http://www.cppblog.com/ming81/archive/2014/10/20/208626.html'>阅读全文</a><img src ="http://www.cppblog.com/ming81/aggbug/208626.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2014-10-20 11:53 <a href="http://www.cppblog.com/ming81/archive/2014/10/20/208626.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(地基工)人脸标定框架（目前史上最牛的，比Face++还强大）</title><link>http://www.cppblog.com/ming81/archive/2014/09/25/208411.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Thu, 25 Sep 2014 05:46:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2014/09/25/208411.html</guid><description><![CDATA[<div style="display: inline-block;"><div style="background-color: #ffffff; font-family: 宋体;"><strong>人脸标定框架，使用&nbsp;CLM, CLM-Z 和 CLNF 算法</strong><br />1、人脸检测与跟踪技术提供快速、高准确率的人像检测功能。普遍适用于图片与实时视频流，能够应对复杂的光照并支持多种人脸姿态。可检出不小于16*16像素的人脸，并可在移动设备上实时跟踪人脸（20帧/秒）<br />2、人脸关键点检测可以精确定位面部的关键区域位置，包括眉毛、眼睛、鼻子、嘴巴，脸部轮廓等。支持一定程度遮挡以及多角度人脸。使用关键点检测技术，可以精确定位人脸美化局部<br /><br /><strong><span style="font-family: verdana, 'courier new';"><br />效果图如下：</span></strong></div><div style="background-color: #ffffff; font-family: 宋体;"><img data-media-type="image" src="http://note.youdao.com/yws/res/4514/F3F81D28FF1A4C43B91D59C0FE1EB1C6" data-ke-src="http://note.youdao.com/yws/res/4514/F3F81D28FF1A4C43B91D59C0FE1EB1C6" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 24px; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4525/C0C502DE5F3C489898AA6094AD54835C" data-ke-src="http://note.youdao.com/yws/res/4525/C0C502DE5F3C489898AA6094AD54835C" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4523/F29AADDBD7C0418BA8E24FE6767A7F82" data-ke-src="http://note.youdao.com/yws/res/4523/F29AADDBD7C0418BA8E24FE6767A7F82" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4497/848627979B1E45AC89AB35C2CCF5B53B" data-ke-src="http://note.youdao.com/yws/res/4497/848627979B1E45AC89AB35C2CCF5B53B" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4520/4475F28DC6D84F16A3ED3F9AD0DBF29E" data-ke-src="http://note.youdao.com/yws/res/4520/4475F28DC6D84F16A3ED3F9AD0DBF29E" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4498/519F2714B0F341B0A262DBAB8CAB3A9E" data-ke-src="http://note.youdao.com/yws/res/4498/519F2714B0F341B0A262DBAB8CAB3A9E" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4519/4F39932235584D8D881A601C953AE9AA" data-ke-src="http://note.youdao.com/yws/res/4519/4F39932235584D8D881A601C953AE9AA" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4527/5E1D999778A44FB3A11C42C3B8089069" data-ke-src="http://note.youdao.com/yws/res/4527/5E1D999778A44FB3A11C42C3B8089069" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4515/D89221DF72AE4FE59D7C0A3F66DB8B61" data-ke-src="http://note.youdao.com/yws/res/4515/D89221DF72AE4FE59D7C0A3F66DB8B61" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4508/E42D69AD0E02429181AA83817439DFCF" data-ke-src="http://note.youdao.com/yws/res/4508/E42D69AD0E02429181AA83817439DFCF" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4532/76D5E259DF0C44BCB6D39DD2B7AA8860" data-ke-src="http://note.youdao.com/yws/res/4532/76D5E259DF0C44BCB6D39DD2B7AA8860" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4524/BBD33AFCBEE74CB791E533D4BA968EB9" data-ke-src="http://note.youdao.com/yws/res/4524/BBD33AFCBEE74CB791E533D4BA968EB9" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4516/578CCD41317E4DB08068C3D0518927DF" data-ke-src="http://note.youdao.com/yws/res/4516/578CCD41317E4DB08068C3D0518927DF" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4495/C6F5D3DF046348698A3DBDDEAAC66E5D" data-ke-src="http://note.youdao.com/yws/res/4495/C6F5D3DF046348698A3DBDDEAAC66E5D" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4535/C70D836DFF624CB79EAAFEDDFE23E3EB" data-ke-src="http://note.youdao.com/yws/res/4535/C70D836DFF624CB79EAAFEDDFE23E3EB" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4511/AA540219FC70431C8FB129D1F8015264" data-ke-src="http://note.youdao.com/yws/res/4511/AA540219FC70431C8FB129D1F8015264" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4518/F8CB4CA6B233428E8A66788A45AF7D5E" data-ke-src="http://note.youdao.com/yws/res/4518/F8CB4CA6B233428E8A66788A45AF7D5E" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4512/6B57114732F74B4FA00552CABEF70616" data-ke-src="http://note.youdao.com/yws/res/4512/6B57114732F74B4FA00552CABEF70616" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4517/CD84BD89030C4655BF0D3B3844197A06" data-ke-src="http://note.youdao.com/yws/res/4517/CD84BD89030C4655BF0D3B3844197A06" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4505/B172AED905C348B09B589E06DC0DC57C" data-ke-src="http://note.youdao.com/yws/res/4505/B172AED905C348B09B589E06DC0DC57C" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4507/90ED5167ECAA48D78D921AB09CBB2FA3" data-ke-src="http://note.youdao.com/yws/res/4507/90ED5167ECAA48D78D921AB09CBB2FA3" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4504/D601202241DF4EC39B292EA6588AE52F" data-ke-src="http://note.youdao.com/yws/res/4504/D601202241DF4EC39B292EA6588AE52F" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4529/9936C037E2E64E62B1140E5DCCE5AD42" data-ke-src="http://note.youdao.com/yws/res/4529/9936C037E2E64E62B1140E5DCCE5AD42" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4503/3400CD01A5B0415781BFFFF99CBCE714" data-ke-src="http://note.youdao.com/yws/res/4503/3400CD01A5B0415781BFFFF99CBCE714" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4533/B85131B25B5A4792B27F3EF3A3619C36" data-ke-src="http://note.youdao.com/yws/res/4533/B85131B25B5A4792B27F3EF3A3619C36" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4528/9DE6B74C5864460E9C22D72BF0BEC14E" data-ke-src="http://note.youdao.com/yws/res/4528/9DE6B74C5864460E9C22D72BF0BEC14E" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4509/423887A7D56C4BB28D419B4FE8DC9831" data-ke-src="http://note.youdao.com/yws/res/4509/423887A7D56C4BB28D419B4FE8DC9831" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4502/E8E1FDA6F573499D8852264E0E8B1449" data-ke-src="http://note.youdao.com/yws/res/4502/E8E1FDA6F573499D8852264E0E8B1449" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4506/5CEF5503051B48E89E70A226000E6352" data-ke-src="http://note.youdao.com/yws/res/4506/5CEF5503051B48E89E70A226000E6352" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4521/0B78B37FD5FC468F9916CDD517AF51DA" data-ke-src="http://note.youdao.com/yws/res/4521/0B78B37FD5FC468F9916CDD517AF51DA" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4536/C5F5D26B71B247BFA2DAA8E3B7ED5DBF" data-ke-src="http://note.youdao.com/yws/res/4536/C5F5D26B71B247BFA2DAA8E3B7ED5DBF" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4500/8BA23ECDDAA2473392B00511B02B988D" data-ke-src="http://note.youdao.com/yws/res/4500/8BA23ECDDAA2473392B00511B02B988D" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4494/439CFA24793946849496F7DED68437AF" data-ke-src="http://note.youdao.com/yws/res/4494/439CFA24793946849496F7DED68437AF" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4496/AF4EDF9C72D04C62BCA343ABAE1758D9" data-ke-src="http://note.youdao.com/yws/res/4496/AF4EDF9C72D04C62BCA343ABAE1758D9" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4526/B0F932AD136740E398C9D65AB35357AC" data-ke-src="http://note.youdao.com/yws/res/4526/B0F932AD136740E398C9D65AB35357AC" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4531/B2405781C1544951A772ABA85BCA1F0A" data-ke-src="http://note.youdao.com/yws/res/4531/B2405781C1544951A772ABA85BCA1F0A" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4538/29E946DE4E964B77AFA41C5002B3CB7E" data-ke-src="http://note.youdao.com/yws/res/4538/29E946DE4E964B77AFA41C5002B3CB7E" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4530/373442664E974BA7907D915A3B4F3124" data-ke-src="http://note.youdao.com/yws/res/4530/373442664E974BA7907D915A3B4F3124" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4537/A730931FA86448F292DC6D163EE0450F" data-ke-src="http://note.youdao.com/yws/res/4537/A730931FA86448F292DC6D163EE0450F" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4534/B842FFD66997409BB9C6B8BD45B9F025" data-ke-src="http://note.youdao.com/yws/res/4534/B842FFD66997409BB9C6B8BD45B9F025" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4493/ADC0285FE2DD41AF86F4747D8FEEB43A" data-ke-src="http://note.youdao.com/yws/res/4493/ADC0285FE2DD41AF86F4747D8FEEB43A" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4499/F1935C9167134C6D833C6CF5A9F6EF88" data-ke-src="http://note.youdao.com/yws/res/4499/F1935C9167134C6D833C6CF5A9F6EF88" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="http://note.youdao.com/yws/res/4539/5C539F7E67344F2B88E7559B93FD7E91" data-ke-src="http://note.youdao.com/yws/res/4539/5C539F7E67344F2B88E7559B93FD7E91" style="font-family: 宋体, 'sans serif', tahoma, verdana, helvetica; font-size: 16px; line-height: 1.5; border: 0px;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/fa81d91314314da3b88d0f4e14778b18/101_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/e90b423f3797449eac4cf9cf3a5eeb1b/106_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/fd3b5abf3fad4312b0fc66db7e4771ea/107_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/da8e18adc5b648c781396800b484f2d3/108_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/bceb1b48d631400a8c1b04f72b100397/109_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/15ceac7f5acf4d29b8ec6f144491e9c8/111_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/7d0f9f1bd3334aa09a8a981b6358464b/112_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/0e78656703b14c43b262f5c4521089ea/114_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/b3dd294efc064042955083468a3c6ea4/115_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/9a646550c2f44a1a900ce88a3f554c53/116_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/2ededa8579544bf3946077a3cb252c89/121_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/f5a3d29a2b46497ebb752dedce17c552/122_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/3961818c69dd4d3db298690d30f7f995/123_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/81c2d47e3b2746f1bac5033d18a2cf13/126_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/d41d0dacf76d456e8333c63aad6a6d43/128_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/2a56e6255f684921bdc8c3ef7a48d212/201_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/b97ae3569bef43089ee584e973df81bf/202_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/28536c8aa906437984a5dcd4469beff8/203_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/e0cd5cae64d74044ac8e4800270e40ba/204_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/940c4895b8264b0b9da5df3ccec37322/206_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/a00dfc1cf53a46968ce77f0a766f2789/207_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/94c3ed76afc14cdcbb67a37021cc2e27/210_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/ad2e34f4c65d4a14a290926bab22ea81/211_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/9fab6647d2cf4643ba96bee9d666dc1c/212_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/e116b90c72c148219be42851119e02dd/213_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/41ead5b8f09f43f695b27336a95f8ac9/215_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/61fb29333c9c4e0881bd71927dd3c8ef/216_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/b3d5df0167f3422cb9e0a4058e942848/217_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/ba623d8d155e48f1a41754f3accda09a/218_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/5c943e8f7fd2487e800c27470b7840ee/219_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/3aa06745188d4d64b0f5466ba3466530/220_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/7a833ac605d948d694d0cf5fce5bda05/222_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/2147813680e4406d8b748fc37f2d98fd/222_det_1.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/995dad9bb01241d9b2e6ca1ff4929cd9/222_det_2.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/fc54b900e7064567994076155ab9c5e2/233_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/0111b0172da74863b4ac43fe6e6433c2/233_det_1.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/6a1820c58ad949edb9305be3136d9319/233_det_2.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/ab95574d16614cdabff99a83db545c35/233_det_3.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/439c3e4588a54e0099b6276ee2bd7b72/666_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/2714daaeea634ae185477bf87742c251/1111_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/1b78f8780b0c4d2a878f45379ffb879f/6640ce8a-013c-4fc5-8531-aa05c47ceadd%3Dkorean%20dr.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/967044fa573e48e08db7f0e85f3486bb/222222_det_1.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/636d4c3b35bd4f95a5004a92833caf61/a01289b3-a28a-432d-b9a1-647fda859f56(1)_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /><img data-media-type="image" src="file:///C:/Users/Administrator/AppData/Local/YNote/Data/971336@163.com/c638187d441e4991afef956aaeb156c0/aaaa_det_0.jpg" data-inited="true" style="background-color: inherit; cursor: default; display: inline-block; margin-top: 8px; max-width: 800px; line-height: 1.5;" alt="" /></div></div><img src ="http://www.cppblog.com/ming81/aggbug/208411.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2014-09-25 13:46 <a href="http://www.cppblog.com/ming81/archive/2014/09/25/208411.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)【OpenCV入门教程之一】 安装OpenCV：OpenCV 3.0、OpenCV 2.4.8、OpenCV 2.4.9 +VS 开发环境配置</title><link>http://www.cppblog.com/ming81/archive/2014/09/15/208315.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Mon, 15 Sep 2014 02:03:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2014/09/15/208315.html</guid><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 本系列文章由@浅墨_毛星云出品，转载请注明出处。文章链接：http://blog.csdn.net/poem_qianmo/article/details/19809337作者：毛星云（浅墨）&nbsp;微博：http://weibo.com/u/1723155442邮箱：&nbsp;happylifemxy@163.com知乎：http://www.zhihu.com/people/mao-xi...&nbsp;&nbsp;<a href='http://www.cppblog.com/ming81/archive/2014/09/15/208315.html'>阅读全文</a><img src ="http://www.cppblog.com/ming81/aggbug/208315.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2014-09-15 10:03 <a href="http://www.cppblog.com/ming81/archive/2014/09/15/208315.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)在Visual Studio上开发Node.js程序</title><link>http://www.cppblog.com/ming81/archive/2014/07/25/207803.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Fri, 25 Jul 2014 06:03:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2014/07/25/207803.html</guid><description><![CDATA[<p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;">最近准备用Node.js做些东西，于是找找看能否有Visual Studio上的插件以方便开发。结果还真找到了一个，来自微软的Node.js Tools for Visual Studio（NTVS），虽然现在仅发布了1.0 Alpha版本，但使用起来已经非常方便。而且，其开发团队<span style="margin: 0px; padding: 0px; line-height: 1.5;">与Python Tools for Visual Studio（PTVS）是同一个，而PTVS就是Visual Studio 2013中要创建自带的Python项目需要安装的那个程序，所以大可放心的使用NTVS。</span></p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;"><strong style="margin: 0px; padding: 0px;">【系列索引】</strong></p><ol style="margin: 0px; padding: 0px 0px 0px 50px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;"><li style="margin: 0px; padding: 0px; list-style: decimal;"><a href="http://www.cnblogs.com/mayswind/p/3547413.html" target="_blank" style="margin: 0px; padding: 0px; text-decoration: none; color: #000000; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #333333;">在Visual Studio上开发Node.js程序&#8212;&#8212;NTVS介绍及使用</a></li><li style="margin: 0px; padding: 0px; list-style: decimal;"><a href="http://www.cnblogs.com/mayswind/p/3549891.html" target="_blank" style="margin: 0px; padding: 0px; text-decoration: none; color: #000000; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #333333;">在Visual Studio上开发Node.js程序(2)&#8212;&#8212;NTVS远程调试及发布到Azure</a></li></ol><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;"><strong style="margin: 0px; padding: 0px;">【文章索引】</strong></p><ol style="margin: 0px; padding: 0px 0px 0px 50px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;"><li style="margin: 0px; padding: 0px; list-style: decimal;"><a href="http://www.cnblogs.com/mayswind/p/3547413.html#para1" style="margin: 0px; padding: 0px; text-decoration: none; color: #000000; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #333333;">NTVS介绍与安装</a></li><li style="margin: 0px; padding: 0px; list-style: decimal;"><a href="http://www.cnblogs.com/mayswind/p/3547413.html#para2" style="margin: 0px; padding: 0px; text-decoration: none; color: #000000; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #333333;">NTVS项目创建和使用</a></li><li style="margin: 0px; padding: 0px; list-style: decimal;"><a href="http://www.cnblogs.com/mayswind/p/3547413.html#para3" style="margin: 0px; padding: 0px; text-decoration: none; color: #000000; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #333333;">NTVS项目的调试</a></li><li style="margin: 0px; padding: 0px; list-style: decimal;"><a href="http://www.cnblogs.com/mayswind/p/3547413.html#para4" style="margin: 0px; padding: 0px; text-decoration: none; color: #000000; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #333333;">NTVS项目的包管理</a></li></ol><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;"><a name="para1" style="margin: 0px; padding: 0px; color: rgb(0, 0, 0); border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(51, 51, 51);"></a><strong style="margin: 0px; padding: 0px;">【一、NTVS介绍与安装】</strong></p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;">从其官网（<a href="http://nodejstools.codeplex.com/" target="_blank" style="margin: 0px; padding: 0px; text-decoration: none; color: #000000; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #333333;">http://nodejstools.codeplex.com</a>）上可以找到其介绍，NTVS是一个使Visual Studio成为Node.js集成开发环境的免费、开源的插件，NTVS支持编辑、Intellisense、Profiling、npm包管理器、本地以及远程调试（Windows、MacOS及Linux），同时其支持Windows Azure网站及云服务。</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;">总之，该有的都有了。如果要安装NTVS的话，需要VS 2013或2012 Update4的Professional（或Test Professional）、Premium或Ultimate版本，同时需要安装有Node.js的0.10.20或以上的版本，有了这些准备后，就可以去官网下载安装包进行安装了，需要注意的是，VS 2013和2012的安装包是各自独立的。</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;">安装完成后，就会在Visual Studio的JavaScript类型中多出以下的项目类型：</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;"><img src="http://images.cnitblog.com/blog/495906/201402/130143592692207.png" alt="" style="margin: 0px auto; padding: 0px; border: 0px; display: block;" /></p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;"><a name="para2" style="margin: 0px; padding: 0px; color: rgb(0, 0, 0); border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(51, 51, 51);"></a><strong style="margin: 0px; padding: 0px;">【二、NTVS项目创建和使用】</strong></p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;">对于Node.js而言，项目类型并不像.NET项目有这么多不同的类型，每种之间的开发环境等还有差异。对于上面的Blank Node.js Console Application和Web Application两个项目而言，无非就是前者模板的代码只提供了在控制台输出Hello World的代码；而后者则用Node.js创建了一个Http服务器，并为每个请求都输出Hello World罢了，即实现了一个简单的Web应用程序。而Express Application则是使用Node.js上的Express框架+Jade模板引擎+Stylus实现了一个小的Web应用程序。而剩下的第一个项目则是从已有的Node.js项目中创建，后两个与其他的类似，只不过已经配置好了脚本和配置文件等可以直接部署到Windows Azure中。</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;">项目创建后与Visual Studio的C#等项目没有太大区别，Intellisense功能也非常强大，敲入require的时候会提示所有的模块名称，同时选择每个模块的时候会提示这个模块的作用和说明（如下图），然后键入回车可以直接补齐单引号等等，都非常方便。而对于每个模块，其所有方法和成员变量也都能自动显示出来，只不过不像require那样会显示说明信息。</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;"><img src="http://images.cnitblog.com/blog/495906/201402/130212256533518.png" alt="" style="margin: 0px auto; padding: 0px; border: 0px; display: block;" /></p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;"><a name="para3" style="margin: 0px; padding: 0px; color: rgb(0, 0, 0); border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(51, 51, 51);"></a><strong style="margin: 0px; padding: 0px;">【三、NTVS项目的调试】</strong></p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;">NTVS项目调试的方式与C#一样，都是F5运行并调试和Ctrl+F5只运行不调试，其会自动运行已安装的Node程序执行当前项目的代码。对于Web Application项目并且使用了使用了http模块的话，还会自动打开浏览器访问指定的端口（可以在项目属性中关闭）。需要说明的是，对于Node.js项目，有且仅有一个启动文件（即使用node.exe执行的文件，相当于程序的Main()函数），程序从这个文件的开始执行，默认情况下项目创建后第一个创建的js文件为启动文件，启动文件用粗体表示。如果需要设置其他文件为启动文件，右键单击选择设置就可以了（如下图） 。</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;"><img src="http://images.cnitblog.com/blog/495906/201402/130219194911512.png" alt="" style="margin: 0px auto; padding: 0px; border: 0px; display: block;" /></p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;">在调试过程中，与其他项目一样，都可以设置断点、单步执行以及监视什么的都是可以用的，同时如果在程序代码中抛出了异常，在调试过程中也会提示出来（如下图）。</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;"><img src="http://images.cnitblog.com/blog/495906/201402/130248382472591.png" alt="" style="margin: 0px auto; padding: 0px; border: 0px; display: block;" /></p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;">默认情况下，所有异常都将提示，当然也可以自己选择哪些异常不提示。可以在提示了异常之后选择&#8220;打开异常设置&#8221;，或者选择&#8220;调试&#8221;菜单，选择&#8220;异常&#8221;，如下图：</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;"><img src="http://images.cnitblog.com/blog/495906/201402/130250010894366.png" alt="" style="margin: 0px auto; padding: 0px; border: 0px; display: block;" /></p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;">&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;"><a name="para4" style="margin: 0px; padding: 0px; color: rgb(0, 0, 0); border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(51, 51, 51);"></a><strong style="margin: 0px; padding: 0px;">【四、NTVS项目的包管理】</strong></p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;">NTVS还提供了非常方便的包管理方式，就如同在C#项目中添加引用一样方便的添加其他包。当然也可以自己使用npm安装相应的包，然后在项目中使用，虽然调试运行没有问题，不过这样是没有Intellisense提示的。所以，如果项目中需要其他的包，可以右键单击npm，选择&#8220;Manage npm Modules...&#8221;（如下图），在npm包管理器中右侧的包名称中输入包的名称，然后点击下方的本地安装（为当前项目安装）就可以了，完成后会在左侧出现已安装的包，然后在项目中require也会出现相应的包名，在使用包的时候也会有方法成员的提示等等。</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;"><img src="http://images.cnitblog.com/blog/495906/201402/130234318016861.png" alt="" style="margin: 0px auto; padding: 0px; border: 0px; display: block;" /></p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;">安装完包后就会在解决方案管理器的npm下出现相应的包名，与C#项目添加引用类似。同时，与执行npm ls命令一样，也是可以查看包的依赖关系的（如下图）。</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;"><img src="http://images.cnitblog.com/blog/495906/201402/130240471703240.png" alt="" style="margin: 0px auto; padding: 0px; border: 0px; display: block;" />&nbsp;</p><p style="margin-top: 10px; margin-bottom: 10px; padding: 0px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;"><strong style="margin: 0px; padding: 0px;">【相关链接】</strong></p><ol style="margin: 0px; padding: 0px 0px 0px 50px; color: #333333; font-family: verdana, Arial, Helvetica, sans-serif; line-height: 25px; background-color: #ffffff;"><li style="margin: 0px; padding: 0px; list-style: decimal;"><a name="link1" style="margin: 0px; padding: 0px; color: rgb(0, 0, 0); border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(51, 51, 51);"></a>Introducing node.js Tools for Visual Studio：<a href="http://www.hanselman.com/blog/IntroducingNodejsToolsForVisualStudio.aspx" target="_blank" style="margin: 0px; padding: 0px; text-decoration: none; color: #000000; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #333333;">http://www.hanselman.com/blog/IntroducingNodejsToolsForVisualStudio.aspx</a></li><li style="margin: 0px; padding: 0px; list-style: decimal;"><a name="link2" style="margin: 0px; padding: 0px; color: rgb(0, 0, 0); border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(51, 51, 51);"></a>[Visual Studio]NTVS - Node.js Tools For Visual Studio Bootcamp：<a href="http://www.dotblogs.com.tw/blackie1019/archive/2013/12/27/136557.aspx" target="_blank" style="margin: 0px; padding: 0px; text-decoration: none; color: #000000; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #333333;">http://www.dotblogs.com.tw/blackie1019/archive/2013/12/27/136557.aspx</a></li><li style="margin: 0px; padding: 0px; list-style: decimal;"><a name="link3" style="margin: 0px; padding: 0px; color: rgb(0, 0, 0); border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(51, 51, 51);"></a>Microsoft Joins Forces with RedGate and Clickberry to Offer Node.js Tools for Visual Studio：<a href="http://www.infoq.com/news/2013/12/NTVS?utm_source=tuicool" target="_blank" style="margin: 0px; padding: 0px; text-decoration: none; color: #000000; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #333333;">http://www.infoq.com/news/2013/12/NTVS</a></li></ol><img src ="http://www.cppblog.com/ming81/aggbug/207803.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2014-07-25 14:03 <a href="http://www.cppblog.com/ming81/archive/2014/07/25/207803.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)Android APK反编译详解（附图）</title><link>http://www.cppblog.com/ming81/archive/2013/11/29/204517.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Fri, 29 Nov 2013 09:53:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2013/11/29/204517.html</guid><description><![CDATA[<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px">这段时间在学Android应用开发，在想既然是用Java开发的应该很好反编译从而得到源代码吧，google了一下，确实很简单，以下是我的实践过程。</p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px">在此郑重声明，贴出来的目的不是为了去破解人家的软件，完全是一种学习的态度，不过好像通过这种方式也可以去汉化一些外国软件。</p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><strong></strong></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><span style="color: rgb(255,0,0)"><strong><br /></strong></span></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><strong>本文Android反编译教程，测试环境：</strong></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><span style="color: rgb(255,0,0)">Win7 Ultimate x64</span></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><span style="color: rgb(255,0,0)">Ubuntu 12.04 x86_x64</span></p><br style="text-align: left; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-stroke-width: 0px" />
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><strong>一、Apk<strong>反编译</strong>得到Java源代码</strong><br /></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px">下载上述反编译工具包，打开<span style="color: rgb(255,0,0)">apk2java</span>目录下的<span style="color: rgb(255,0,0)">dex2jar-0.0.9.9</span>文件夹，内含apk反编译成java源码工具，以及源码查看工具。</p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px">apk反编译工具dex2jar，是将apk中的classes.dex转化成jar文件</p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px">源码查看工具jdgui，是一个反编译工具，可以直接查看反编译后的jar包源代码</p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><br /></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px">dex2jar 和 jdgui 最新版本下载，分别见google code：</p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><a style="color: rgb(255,153,0); text-decoration: none" href="http://code.google.com/p/dex2jar/downloads/list" target="_blank">dex2jar</a>（google code）</p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><a style="color: rgb(255,153,0); text-decoration: none" href="http://code.google.com/p/innlab/downloads/list" target="_blank">jdgui</a>（google code），最新版本请见&nbsp;<a style="color: rgb(255,153,0); text-decoration: none" href="http://java.decompiler.free.fr/?q=jdgui" target="_blank">官方</a></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><br /></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><strong>具体步骤：</strong></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px">首先将apk文件后缀改为zip并解压，得到其中的classes.dex，它就是java文件编译再通过dx工具打包而成的，将classes.dex复制到dex2jar.bat所在目录<span style="color: rgb(102,0,204)">dex2jar-0.0.9.9</span>文件夹。</p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px">在命令行下定位到dex2jar.bat所在目录，运行</p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><span style="color: rgb(51,51,255)"><strong>dex2jar.bat&nbsp;&nbsp;&nbsp; classes.dex</strong></span></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px">生成</p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><span style="color: rgb(204,0,0)">classes_dex2jar.jar</span></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><span style="color: rgb(204,0,0)"><br /></span></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px">然后，进入jdgui文件夹双击<span style="color: rgb(255,0,0)">jd-gui.exe</span>，打开上面生成的jar包<span style="color: rgb(204,0,0)">classes_dex2jar.jar</span>，即可看到源代码了，如下图：</p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><img style="border-bottom: medium none; border-left: medium none; border-top: medium none; border-right: medium none" alt="" src="http://hi.csdn.net/attachment/201108/28/0_1314542895t80o.gif" /><br /><br /></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px">HelloAndroid源码在反编译前后的对照如下：</p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px">&nbsp;<strong><img style="border-bottom: medium none; border-left: medium none; border-top: medium none; border-right: medium none" alt="" src="http://hi.csdn.net/attachment/201108/28/0_1314542945u7Th.gif" /></strong></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><strong><br /></strong></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><strong><br /></strong></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><strong>二、apk<strong>反编译</strong>生成程序的源代码和图片、XML配置、语言资源等文件</strong></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px">如果是汉化软件，这将特别有用</p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px">首先还是要下载上述反编译工具包，其中最新的apktool，请到google code下载</p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><a style="color: rgb(255,153,0); text-decoration: none" href="https://code.google.com/p/android-apktool/downloads/list" target="_blank">apktool</a>（google code）</p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><strong><br /></strong></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><strong>具体步骤：</strong></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px">下载上述反编译工具包，打开<span style="color: rgb(255,0,0)">apk2java</span>目录下的<span style="color: rgb(255,0,0)">apktool1.4.1</span>文件夹，内含三个文件：<span style="color: rgb(255,0,0)">aapt.exe</span>，<span style="color: rgb(255,0,0)">apktool.bat</span>，<span style="color: rgb(255,0,0)">apktool.jar&nbsp;</span></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px">注：里面的apktool_bk.jar是备份的老版本，最好用最新的apktool.jar</p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><br /></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px">在命令行下定位到apktool.bat文件夹，输入以下命令：<span style="color: rgb(51,51,255)"><strong>apktool.bat &nbsp;d &nbsp;-f &nbsp; abc123.apk &nbsp; abc123</strong></span>，如下图：</p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px">&nbsp;<img style="border-bottom: medium none; border-left: medium none; border-top: medium none; border-right: medium none" alt="" src="http://hi.csdn.net/attachment/201108/28/0_1314543082NXJ7.gif" /></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px">上图中，apktool.bat 命令行解释：apktool.bat &nbsp; d &nbsp;-f &nbsp; &nbsp;[apk文件 ]&nbsp;&nbsp; [输出文件夹]</p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><br /></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px">反编译的文件如下（AndroidManifest.xml为例）：</p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><img style="border-bottom: medium none; border-left: medium none; border-top: medium none; border-right: medium none" alt="" src="http://hi.csdn.net/attachment/201108/28/0_131454313515no.gif" /><br /></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><br /></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px">将反编译完的文件重新打包成apk，很简单，输入<span style="color: rgb(51,51,255)"><strong>apktool.bat &nbsp; b &nbsp; &nbsp;abc123</strong></span>（你编译出来文件夹）即可，命令如下：</p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px">&nbsp;<img style="border-bottom: medium none; border-left: medium none; border-top: medium none; border-right: medium none" alt="" src="http://hi.csdn.net/attachment/201108/28/0_1314543163UrUV.gif" /></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px">打包apk后的文件在目录C:\HelloAndroid下，生成了两个文件夹：</p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><span style="color: rgb(51,51,255)">build</span></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px"><span style="color: rgb(51,51,255)">dist</span></p>
<p style="text-align: left; padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-stroke-width: 0px">其中，打包生成的HelloAndroid.apk，在上面的dist文件夹下，Ok</p><img src ="http://www.cppblog.com/ming81/aggbug/204517.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2013-11-29 17:53 <a href="http://www.cppblog.com/ming81/archive/2013/11/29/204517.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)Pomelo官方demo Chatofpomelo简析之二——聊天</title><link>http://www.cppblog.com/ming81/archive/2013/11/08/204162.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Fri, 08 Nov 2013 03:31:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2013/11/08/204162.html</guid><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 上一篇分析客户端登陆的过程。当用户登陆成功后，聊天又是个什么过程呢？下面就来分析聊天时，客户端与服务器端的交互过程。客户端我们先来看看下，聊天发送消息的过程。当用户在文本框内输入文字，并回车就可以发送消息了 &nbsp; 1: $("#entry").keypress(function (e) { &nbsp; 2:var route = "chat.chatHandler.sen...&nbsp;&nbsp;<a href='http://www.cppblog.com/ming81/archive/2013/11/08/204162.html'>阅读全文</a><img src ="http://www.cppblog.com/ming81/aggbug/204162.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2013-11-08 11:31 <a href="http://www.cppblog.com/ming81/archive/2013/11/08/204162.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)Pomelo官方demo ChatofPomelo简析之一——用户登录</title><link>http://www.cppblog.com/ming81/archive/2013/11/07/204147.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Thu, 07 Nov 2013 10:30:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2013/11/07/204147.html</guid><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 官方给的tutorial真是简单明了，简的刚开始学pomelo，压根就不知道代码写在哪。所以还是自己研究研究。首先看服务器端，处理逻辑的主要在game-server/app/servers下。650) this.width=650;" onresize="" onfocus="" onmouseover="" onmousemove="" title=image ondblclick=""...&nbsp;&nbsp;<a href='http://www.cppblog.com/ming81/archive/2013/11/07/204147.html'>阅读全文</a><img src ="http://www.cppblog.com/ming81/aggbug/204147.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2013-11-07 18:30 <a href="http://www.cppblog.com/ming81/archive/2013/11/07/204147.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)使用 WebStorm IDE 调试 Pomelo 应用程序</title><link>http://www.cppblog.com/ming81/archive/2013/11/07/204143.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Thu, 07 Nov 2013 08:17:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2013/11/07/204143.html</guid><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 使用得心应手的IDE来开发应用程序，可以使我们的工作事半功倍。而调试则更可以让我们准确的定位BUG，发现问题。本文讲述如何使用&nbsp;WebStorm&nbsp;这个怪兽级JavaScript IDE来调试&nbsp;Chat of Pomelo。如果你更喜欢&nbsp;Eclipse&nbsp;等其他IDE，希望本文也可以有一些帮助。前言首先我们需要知道，NodeJS应用程序可以...&nbsp;&nbsp;<a href='http://www.cppblog.com/ming81/archive/2013/11/07/204143.html'>阅读全文</a><img src ="http://www.cppblog.com/ming81/aggbug/204143.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2013-11-07 16:17 <a href="http://www.cppblog.com/ming81/archive/2013/11/07/204143.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)Unity3D 游戏引擎之游戏场景的切换与持久化简单数据的储存</title><link>http://www.cppblog.com/ming81/archive/2013/10/31/204015.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Thu, 31 Oct 2013 01:26:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2013/10/31/204015.html</guid><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 持久化简单的数据储存在Unity3D 中提供了一个简单有效的方法，如果之前的你做过Android的开发你会发现在Unity3D中持久化数据的储存和Android非常的想象。那么下面MOMO 将用一个简单有效的例子向大家介绍Unity3D中持久化数据。首先我们须要熟悉一下Unity3D中的PlayerPrefs这个类。这个类中一共帮助我们封装了9个方法，用来数据的储存与读取。举一个例子...&nbsp;&nbsp;<a href='http://www.cppblog.com/ming81/archive/2013/10/31/204015.html'>阅读全文</a><img src ="http://www.cppblog.com/ming81/aggbug/204015.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2013-10-31 09:26 <a href="http://www.cppblog.com/ming81/archive/2013/10/31/204015.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)场景管理插件Scene Manager</title><link>http://www.cppblog.com/ming81/archive/2013/10/30/204002.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Wed, 30 Oct 2013 10:40:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2013/10/30/204002.html</guid><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Unity3d中提供了场景Scene的概念，Scene就是一组相关联的游戏对象的一个集合，通常每个集合就是一个场景，但是也有可能只是一个场景的一部分！场景中的游戏对象是任意的，可以是HUD的UI组件，场景地图，模型等等Unity3d提供了一些切换场景的规则和方法（例如在切换场景时不销毁某些GameObject，同步，异步加载场景API），但是并没有提供一个通用的场景管理的模块（想要做到&#...&nbsp;&nbsp;<a href='http://www.cppblog.com/ming81/archive/2013/10/30/204002.html'>阅读全文</a><img src ="http://www.cppblog.com/ming81/aggbug/204002.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2013-10-30 18:40 <a href="http://www.cppblog.com/ming81/archive/2013/10/30/204002.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)Unity3D中GameObject 详细介绍</title><link>http://www.cppblog.com/ming81/archive/2013/10/30/203997.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Wed, 30 Oct 2013 06:16:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2013/10/30/203997.html</guid><description><![CDATA[<span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">通过Hierarchy面板下的Create菜单可以手动地创建一个GameObject，它可以是一个相机，一个灯光，或者一个简单的模型，当我们要在程序里面动态地创建一个相机的时候，可以new一个GameObject，然后把Camera组件Add给它就可以了，创建灯光，GUI等也类似，但要创建简单模型的时候，我发现并没有类似Cube，Sphere这样的组件可供添加，后面知道，通过GameObject这个类的一个静态方法可以达到这个目的</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">static GameObject CreatePrimitive(PrimitiveType type);</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">可以根据PrimitiveType创建五种类型的基础模型</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">PrimitiveType.Plane，PrimitiveType.Cube，PrimitiveType.Sphere，PrimitiveType.Capsule，PrimitiveType.Cylinder</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">Unity3D提供一种被称为Prefab的预置对象，它是以文件的形式保存在硬盘上的一个GameObject，它里面可能包含了各种设置，组件，还有一些脚本。Prefab允许我们在不同的Scene，甚至Project中使用同一个对象，例如我实现了一个子弹，通过打包成Prefab，我可以在另外一个游戏里面直接使用它。</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">当一个Prefab对象被修改的时候，它的所有实例都会相应地被修改</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">在代码里面动态地实例化一个Prefab对象</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">public GameObject obj;</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">obj = Instantiate( obj&nbsp;&nbsp;);</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">要先创建一个公有变量，然后把这个Prefab拖到这个变量上，然后才可以用它来实例化对象（我感到一种蛋蛋的忧伤，能不拖吗）</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">通过Resources这个类的静态方法可以将Prefab对象动态加载进来，创建GameObject</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">GameObject之间的通讯，在游戏中，我们往往需要知道其他对象的一些信息，所以我们经常需要动态地查询另外一个GameObject</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">1. 查找父节点 transform.parent</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">2. 查找子节点 transform.Find("name");&nbsp;&nbsp;transform.Find("Arm/Hand/Finger"); 没有找到会返回null，名字如果包含"/"字符将像路径一样穿越层次</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">3. 查找场景中的其他GameObject<span class="Apple-converted-space">&nbsp;</span></span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">GameObject.Find 从Scene下开始查找，根据GameObject的名字进行查找，允许使用"/"穿越层次查找，</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">GameObject.FindWithTag根据Tag查找一个GameObject，</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">GameObject.FindGameObjectsWithTag 根据Tag批量查找GameObject</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">GameObject的name和Tag可以直接设置，但Tag需要在标签管理器先定义一个Tag，这个Tag才可用，你不能将一个未定义的Tag赋给GameObject的Tag变量</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">最后还有一种搓搓的通讯方法，通过Message来调用其他GameObject，默认是垃圾短信群发，也可以将一个Object穿进去，然后调它的方法</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">methodName为方法名，value为方法的参数，options表示是否必须有对象接收该消息（如果是，且没有对象接受，u3d报错）</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">//调用本级别所有的GameObject上所有脚本的methodName方法</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">void SendMessage(string methodName, object value = null, SendMessageOptions options = SendMessageOptions.RequireReceiver);</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">//朝本级别和上级父节点发送调用命令</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">void SendMessageUpwards(...)</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">//目标是本级别和全部子节点...</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">void BroadcastMessage(...)</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">调用Object的Destroy方法可以销毁一个GameObject，组件，或者资源。这是一个静态方法，函数的原型为 static void Destroy(Object obj, float t = 0.0F );</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">可以通过将this传入，销毁自己。</span><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">GameObject的成员变量很多</span><img src ="http://www.cppblog.com/ming81/aggbug/203997.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2013-10-30 14:16 <a href="http://www.cppblog.com/ming81/archive/2013/10/30/203997.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)unity3d协作过程中svn的应用</title><link>http://www.cppblog.com/ming81/archive/2013/10/29/203960.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Tue, 29 Oct 2013 02:06:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2013/10/29/203960.html</guid><description><![CDATA[<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/25px Helvetica, Tahoma, Arial, sans-serif; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="p1"><strong style="font-weight: bold">算是从</strong><span class="s1"><strong style="font-weight: bold">unity3d</strong></span><strong style="font-weight: bold">官方网站上的翻译，如果你没有看到，可以看下，这个也是我自己碰到比较麻烦的事情，经常</strong><span class="s1"><strong style="font-weight: bold">windows</strong></span><strong style="font-weight: bold">下提交，然后</strong><span class="s1"><strong style="font-weight: bold">mac</strong></span><strong style="font-weight: bold">下更新下去一堆关联没了，有些可以</strong><span class="s1"><strong style="font-weight: bold">reimport</strong></span><strong style="font-weight: bold">可以变好，有些要重新关联，麻烦的很，因为我们漏了</strong><span class="s2"><strong style="font-weight: bold">一些东西没有提交到版本控制中。</strong></span></p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/25px Helvetica, Tahoma, Arial, sans-serif; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="p2">&nbsp;</p>
<ol style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px 0px 1.5em; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/1.4em Helvetica, Tahoma, Arial, sans-serif; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="ol1"><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li3">在<span class="s3">unity3d</span>中建立一个项目，如：<span class="s4">InitialUnityProject</span>，你可以加入一些<span class="s4">assets</span>的<span class="s4">package</span>或者放到以后加也没关系，我一般是刚开始是空的项目，空的场景，然后保存，一些<span class="s4">asset</span>可以在用到的时候选择性的添加，不然一堆东西看着也是麻烦的</li><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li3"><span class="s3"><strong style="font-weight: bold">Edit-&gt;Project Settings-&gt;Editor</strong></span><strong style="font-weight: bold">，选择</strong><span class="s3"><strong style="font-weight: bold">Enable,<span class="Apple-converted-space">&nbsp;</span></strong></span><strong style="font-weight: bold">我在</strong><span class="s3"><strong style="font-weight: bold">4.3.1</strong></span><strong style="font-weight: bold">的时候，安装了默认是</strong><span class="s3"><strong style="font-weight: bold">disable</strong></span><strong style="font-weight: bold">的，这里要开起来，这样你的</strong><span class="s3"><strong style="font-weight: bold">asset</strong></span><strong style="font-weight: bold">每个就会有</strong><span class="s3"><strong style="font-weight: bold">meta<span class="Apple-converted-space">&nbsp;</span></strong></span><strong style="font-weight: bold">文件生成，大家可以用</strong><span class="s3"><strong style="font-weight: bold">ultraedit</strong></span><strong style="font-weight: bold">等打开看下里面的东西，注意这个文件最好生成后不要自己去修改和删除，提交到</strong><span class="s3"><strong style="font-weight: bold">svn</strong></span><strong style="font-weight: bold">即可，这个文件是文本，</strong><span class="s3"><strong style="font-weight: bold">svn</strong></span><strong style="font-weight: bold">可以</strong><span class="s3"><strong style="font-weight: bold">merge</strong></span><strong style="font-weight: bold">的</strong></li><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li3">退出<span class="s3">unity3d,</span>当然你可以保存你的空场景</li><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li3">删除<span class="s3">Library</span>下的所有文件和目录，不过以下的文件要保留，其实也就是一些配置的东西： 
<ul style="padding-bottom: 0px; margin: 0px 0px 1.5em; padding-left: 0px; padding-right: 0px; padding-top: 0px" class="ul1"><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li4">EditorBuildSettings.asset</li><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li4">InputManager.asset</li><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li4">ProjectSettings.asset</li><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li4">QualitySettings.asset</li><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li4">TagManager.asset</li><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li4">TimeManager.asset</li><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li4">AudioManager.asset</li><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li4">DynamicsManager.asset</li><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li4">NetworkManager.asset</li><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li3">不过在<span class="s4">mac</span>下面比较搞笑的是，它不会自动生成<span class="s4">cache</span>目录，他会生成其他的如<span class="s4">preview</span>之类的，但<span class="s4">cache</span>不会，你如果<span class="s4">reimport</span>，则他会报错，说不能从<span class="s4">temp</span>复制到<span class="s4">cache.</span>搞不清楚他自己为啥不创建，怀疑写程序的人有点想当然了，没判断目录是否存在吧。所以在<span class="s4">mac</span>下，自己要创建下<span class="s4">cache</span>目录，不然你报错可能不知道怎么回事情。</li></ul></li><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li4"><span class="s2">把项目文件夹</span><span class="s3">Import</span><span class="s2">到</span><span class="s3">svn</span><span class="s2">服务器上，命令行如下：</span><span class="s3"><br /></span>svn import -m"Initial project import" InitialUnityProject svn://my.svn.server.com/MyUnityProject<span class="s3"><br /></span></li><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li3">你可以从<span class="s3">svn<span class="Apple-converted-space">&nbsp;</span></span>服务器上<span class="s3">check out</span>出来整个项目，任何组内的开发人员都可以<span class="s3"><br /></span><span class="s4">svn co svn://my.svn.server.com/MyUnityProject</span><span class="s3"><br /></span>看看所有用到的<span class="s3">Assets</span>下面的文件是否都已经在版本控制下了</li><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li3"><span class="s3"><strong style="font-weight: bold"></strong></span><strong style="font-weight: bold">建议：</strong><span class="s3"><strong style="font-weight: bold"><span class="Apple-converted-space">&nbsp;</span></strong></span><strong style="font-weight: bold">可以为</strong><span class="s3"><strong style="font-weight: bold">Library</strong></span><strong style="font-weight: bold">设立</strong><span class="s3"><strong style="font-weight: bold">ignore ,</strong></span><strong style="font-weight: bold">如果用命令行的话</strong><span class="s3"><strong style="font-weight: bold"><br /></strong></span><span class="s4">svn propedit svn:ignore MyUnityProject/Library</span><span class="s3"><br />svn<span class="Apple-converted-space">&nbsp;</span></span>会打开一个文本编辑器，添加所有除了下面文件外的目录和文件到这个文本中 
<ul style="padding-bottom: 0px; margin: 0px 0px 1.5em; padding-left: 0px; padding-right: 0px; padding-top: 0px" class="ul1"><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li4">EditorBuildSettings.asset</li><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li4">InputManager.asset</li><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li4">ProjectSettings.asset</li><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li4">QualitySettings.asset</li><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li4">TagManager.asset</li><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li4">TimeManager.asset</li><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li4">AudioManager.asset</li><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li4">DynamicsManager.asset</li><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li4">NetworkManager.asset</li></ul></li><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li3">当用<span class="s3">unity3d</span>打开项目的时候，一些丢失的文件会全部重新建立，如<span class="s3">Library</span>中被我们删除了的，如果还是不行，可以用<span class="s3">reimport all</span></li><li style="padding-bottom: 0px; margin: 0px 0px 0.25em 30px; padding-left: 0px; padding-right: 0px; font-size: 1em; padding-top: 0px" class="li4"><span class="s2">最后就可以用</span><span class="s3">svn commit</span><span class="s2">了</span><span class="s3"><br /></span>svn ci -m"Finishing project import" MyUnityProject</li></ol><img src ="http://www.cppblog.com/ming81/aggbug/203960.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2013-10-29 10:06 <a href="http://www.cppblog.com/ming81/archive/2013/10/29/203960.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)unity3D的FingerGestures插件</title><link>http://www.cppblog.com/ming81/archive/2013/10/28/203941.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Mon, 28 Oct 2013 01:30:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2013/10/28/203941.html</guid><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 目录FingerGestures包结构FingerGestures例子列表设置场景教程：识别一个轻敲手势教程：手势识别器教程：轻击手势识别器教程：拖拽手势识别器教程：滑动手势识别器教程：长按手势识别器教程：缩放手势识别器教程：旋转手势识别器教程：自定义手势识别器教程：识别手势事件建议：使用.net代理事件 fingerGestures包结构路径，相对Asse...&nbsp;&nbsp;<a href='http://www.cppblog.com/ming81/archive/2013/10/28/203941.html'>阅读全文</a><img src ="http://www.cppblog.com/ming81/aggbug/203941.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2013-10-28 09:30 <a href="http://www.cppblog.com/ming81/archive/2013/10/28/203941.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)Unity3D引擎崩溃、异常、警告、BUG与提示总结及解决方法 </title><link>http://www.cppblog.com/ming81/archive/2013/10/22/203865.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Tue, 22 Oct 2013 03:03:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2013/10/22/203865.html</guid><description><![CDATA[<p>1.Unity3D经常莫名奇妙崩溃。</p>
<p>一般是由于空异常造成的，多多检查自己的引用是否空指针。</p>
<p>2.编码切换警告提示。</p>
<p>警告提示：Some are Mac OS X (UNIX) and some are Windows.</p>
<p>This might lead to incorrect line numbers in stacktraces andcompiler errors. Many text editors can fix this using Convert LineEndings menu commands.</p>
<p>编码格式问题，VS的话直接高级保存方案里面修改，一般我选的是UNICODE（UTF8代签名）MACINTOSH(CR)，WINDOW下的可以选WINDOWS的格式，两边都要用的话，推荐选CR。</p>
<p>3.中文界面解决问题。</p>
<p>monodevelop中文显示解决方法：http://www.cocoachina.com/bbs/read.php?tid-78563.html</p>
<p>中文Mac系统下MonoDevelop乱码解决：http://blog.csdn.net/ssihc0/article/details/6796118</p>
<p>4.安装空项目报错</p>
<p>不知道怎么地，在IOS试过一次空项目也在错误提示。大概是说什么&#8220;找不到需要的方法&#8221;。</p>
<p>重装一下就好了，估计是UNITY文件损坏或者安装不完全出错了。</p>
<p>错误提示：MissingMethodException: Cannot find the requestedmethod.</p>
<p>估计是破解Unity3D造成的，该破解文件可能是不支持WIN7下的。<br />解决方法：换正版或换个破解文件。</p>
<p>5.平台编译错误或库引用缺失</p>
<p>错误提示：error CS1061: Type `System.IO.FileInfo' does not containa definition for `Delete' and no extension method `Delete' of type`System.IO.FileInfo' could be found (are you missing a usingdirective or an assembly reference?)</p>
<p>出了这个错误一般有两个原因了。</p>
<p>1.没有引用相关的库。</p>
<p>2.选错编译平台。（BuildSetting里面的Platform）</p>
<p>错误提示：Could not startcompilationWin32Exception:ApplicationName=&#8220;XXXX\mono.exe&#8221;,&#8230;&#8230;</p>
<p>解决方式：重装UNITY3D。</p>
<p>6.内存资源加载错误问题</p>
<p>错误提示：Trying to reload asset from disk that is not stored ondisk</p>
<p>个人是在加载多个ASSETBUNDLE时，用了释放镜像之后，发生了下面的BUG。</p>
<p>这个警告它并没有对游戏流程有任何影响，不过一直跳出来很烦人。我们项目中是因为用Dictionary删除的时候没有删除完整导致的。</p>
<p>解决方案参考：http://blog.sina.com.cn/s/blog_5b6cb95001019ipi.html</p>
<p>个人认为比较大可能是下面的原因：</p>
<p>还没释放完镜像再次加载就出BUG了。将所有ASSETBUNDLE加载完后再同一释放，这样就没问题了。</p>
<p>Unity will only allow you to have a single instance of aparticular AssetBundle loaded at one time in your application. Whatthis means is that you can't retrieve an AssetBundle from a WWWobject if the same one has been loaded previously and has not beenunloaded. In practical terms it means that when you try to access apreviously loaded AssetBundle like this:</p>
<p>（BY:http://docs.unity3d.com/Documentation/Manual/keepingtrackofloadedassetbundles.html）</p>
<p>国外论坛的讨论：</p>
<p>http://forum.unity3d.com/threads/49298-Trying-to-reload-asset-from-disk-that-is-not-stored-on-disk</p>
<p>貌似老外也没完全确切搞定这个。</p>
<p>错误提示：Deletingpersistent object without writing it first</p>
<p>不论如何你都不应该直接修改一个从assetbundle加载进来的最初数据，一般都要先实例化出来再对其修改。但是引用的东西（例如mesh），这些也不能修改它。若要修改的话，则先复制一份出来。</p>
<p>复制一份模型出来重新复制，以免直接修改被引用的镜像模型。如下：</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="C#"><table class="devcodetools"><tbody><tr><td></td><td width="99%"></td><td style="background-image: url(http://www.unitymanual.com/wp-content/plugins/devformatter/img/devformatter-copy.png); width: 16px; background-repeat: no-repeat; background-position: 50% 50%; height: 16px"><embed id="ZeroClipboard1" height="16" type="application/x-shockwave-flash" align="center" pluginspage="http://www.macromedia.com/go/getflashplayer" width="16" src="http://www.unitymanual.com/wp-content/plugins/devformatter/_zclipboard.swf" wmode="transparent" flashvars="id=1&amp;width=16&amp;height=16" allowfullscreen="false" allowscriptaccess="always" bgcolor="#ffffff" quality="best" menu="false" loop="false"></td></tr></tbody></table><div class="devcodeoverflow"><table class="devcodearea" width="100%"><tbody><tr><td class="devcodelines" width="1%">1</td><td class="devcodelinesarea"><pre class="devcode devcodeline">　Mesh temp <span style="color: rgb(0,128,0)">=</span> Mesh<span style="color: rgb(0,128,0)">.</span><span style="color: rgb(0,0,255)">Instantiate</span><span style="color: rgb(0,128,0)">(</span>smr<span style="color: rgb(0,128,0)">.</span><span style="color: rgb(0,0,255)">sharedMesh</span><span style="color: rgb(0,128,0)">)</span> <span style="color: rgb(6,0,255); font-weight: bold">as</span> Mesh<span style="color: rgb(0,128,0)">;</span></pre></td></tr><tr><td class="devcodelines devcodelinesodd devcodelinesodd" width="1%">2</td><td class="devcodelinesarea devcodelinesareaodd devcodelinesareaodd"><pre class="devcode devcodeline"> </pre></td></tr><tr><td class="devcodelines" width="1%">3</td><td class="devcodelinesarea"><pre class="devcode devcodeline">　　myMesh<span style="color: rgb(0,128,0)">.</span><span style="color: rgb(0,0,255)">sharedMesh</span> <span style="color: rgb(0,128,0)">=</span> temp<span style="color: rgb(0,128,0)">;</span></pre></td></tr></tbody></table></div></pre><!--END_DEVFMTCODE-->

<p>&nbsp;</p>
<p>7.时间错误、NaN错误</p>
<p>错误提示：transform.position assign attempt for 'XXX' is notvalid。Input rotation is {NaN, NaN, NaN, NaN}.</p>
<p>一般是由于游戏暂停将timescale设为0引起的，需要寻找相应用了Time.deltTime等参数的函数修改。否则会导致计算出错报空异常。</p>
<p>详细解决看另一篇文章：关于NaN（Not a Number)的问题http://blog.sina.com.cn/s/blog_5b6cb9500101cd9e.html</p>
<p>8.动画错误</p>
<p>这个错误是4.0新引进动画系统才出现的。</p>
<p>错误提示：Mecanim: BindSkeleton: Cannot findtransform&#8220;objectname&#8221;</p>
<p>解决方式：</p>
<p>1.找到该对应transform&#8220;objectname&#8221;的模型，直接在检索面板搜索所有相应名字，能容易找到。</p>
<p>2.将模型的面板的Rig部分的动画AnimationType改为none</p>
<p>9.坐标系向量计算的错误提示</p>
<p>错误提示：Look rotation viewing vector is zero</p>
<p>解决方式：一般是由于摄像机的旋转角度造成的。也可能是向量的计算多余而系统提示。我们项目中是强制摄像机90度的时候出现，改成89.9度就没问题了。</p>
<p>具体还有的参考Unity3D官方论坛：</p>
<p>http://answers.unity3d.com/questions/397425/look-rotation-viewing-vector-is-zero-error.html</p>
<p>若没找到解决方法再搜索下。</p>
<p>10.关于AssetServer</p>
<p>错误：明明上传了所有修改，但是别人的机子却没有下载带最新代码。</p>
<p>原因：Merge完代码之后，操作了ignore serverchange,UNITY默认是以你本机子的为准，若此代码没有再次修改，则AssetServer不认为这个东西被修改过，没有上传那代码。</p>
<p>解决方式：打个空格重新保存一下该代码。</p>
<p>11.关于数据格式的错误</p>
<p>错误提示：IllegalJSON sequence</p>
<p>解决方式：http://forum.unity3d.com/threads/143168-JsonFX-WTF-Illegal-JSON-sequence</p>
<p>12.导出WINDOS平台下的项目运行不成功</p>
<p>错误提示：没有找到相应assetbundle的路径</p>
<p>解决方式：因为用了assetbundle加载，而游戏在有中文路径下，assetbundle的路径不能有中文。换个无中文的目录即可。从根源上能解决的方案现在暂时没有。</p>
<p>13.导入资源出错</p>
<p>错误提示：Error while importing package :Couldn't decompresspackage</p>
<p>解决方式：导入资源出错，大部分都是中文路径惹的祸。将资源换到无中文路径试试。如C/D盘根目录。</p><img src ="http://www.cppblog.com/ming81/aggbug/203865.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2013-10-22 11:03 <a href="http://www.cppblog.com/ming81/archive/2013/10/22/203865.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)NGUI中深度depth和z轴关系的小试验 </title><link>http://www.cppblog.com/ming81/archive/2013/10/19/203813.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Sat, 19 Oct 2013 04:30:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2013/10/19/203813.html</guid><description><![CDATA[<table width="100%">
     <tbody>
         <tr>
             <td floor_right"="">
             <div id="J_read_main">
             <div>GUI中是用depth来控制sprite显示顺序的，本来这很好用，但碰到上面帖子中的问题时却不好解决了，于是我试验了下。以下是一些总结，不对的地方请指正。<br />
             下面的内容可能看起来比较绕，这样的话只需实际试验下就能很容易的知道结果，呵呵<br />
             如果还是看不明白，可以先看1楼，那里有个总结<br />
             &nbsp;<br />
             1，同一个panel下，同一个atlas的不同sprite的显示只受depth的控制，这是最经常用的方式。此时不论精灵的z轴如何变化，depth高的一定在前面。<br />
             比如精灵A的z轴是-10，更靠近相机，但它的depth是0，而精灵B的z轴是0但depth是1，那么精灵B还是显示在前面<br />
             如下图，0、1、2的前缀分别是三者的depth值，则三者的排列就是如图的由下到上，2_Label在最上面<br />
             <img src="http://game.ceeger.com/forum/attachment/thumb/Mon_1302/16_773_84b6f73158794a9.jpg" border="0" title="点击查看原图" alt="" /><br />
             &nbsp;<br />
             现在在depth不变的前提下修改z轴的值。将0_Dark的z轴调为-100，则它离相机更近了，看上去应该挡住后面的两个才对，但Game场景中三者的关系并没有改变，也就是说虽然看上去0_Dark应该挡住后面的东西，但并没有这样，还是depth起作用，也就是feiben同学所说的&#8220;相同atlas其实是共用同一个Z轴深度&#8221;。<br />
             <img src="http://game.ceeger.com/forum/attachment/thumb/Mon_1302/16_773_26eaadc1ac2fa97.jpg" border="0" title="点击查看原图" alt="" /><br />
             2，不同panel下，同一个atlas的不同sprite不受depth的控制，而受z轴控制。此时只需稍微调节下其中一个精灵的z轴就可以，比如0.1，就可以控制sprite的显示<br />
             比如接着1中的图，新建一个panel_B，将1_NGUI拖到里面，会看到它盖住了0和2，现在调节depth不起作用，无论1_NGUI的depth调成多少，都不会改变它在最上面的状态<br />
             <img src="http://game.ceeger.com/forum/attachment/thumb/Mon_1302/16_773_145dddd7ffe64e4.jpg" border="0" title="点击查看原图" alt="" /><br />
             现在调节下1_NGUI的z轴为0.1，则它到了最后面<br />
             <img src="http://game.ceeger.com/forum/attachment/thumb/Mon_1302/16_773_ee15833134b5502.jpg" border="0" title="点击查看原图" alt="" /><br />
             而比如现在想把在panel_B中的1_NGUI重新显示在0和2之间，能办到么？经过试验会发现无论怎么调三者的z轴，都不能将NGUI放到1和2之间，因为它们是一个图集中的精灵，共用一个z轴深度<br />
             比如将0_Dark的z设为100，此时1_NGUI的z轴还是0.1，但1_NGUI重新跑到了最上面，而不是中间<br />
             <img src="http://game.ceeger.com/forum/attachment/thumb/Mon_1302/16_773_f5127fb5215e14b.jpg" border="0" title="点击查看原图" alt="" /><br />
             再把Label的z设为-100，NGUI是被覆盖了，但Dark也跟着跑到了上面，注意此时三者的空间位置，NGUI的确是在中间的，但还是被后面的Dark挡住了<br />
             <img src="http://game.ceeger.com/forum/attachment/thumb/Mon_1302/16_773_0843e30cfcd4889.jpg" border="0" title="点击查看原图" alt="" /><br />
             你也许会感觉这是自找麻烦，没事把同一个atlas的精灵放到两个panel中干什么呢？一般情况下是自找麻烦，但为了解决上面帖子中提到的问题，这是个解决的办法，如3<br />
             &nbsp;<br />
             3，不同panel下，不同atlas的精灵的穿插，受z轴的控制。<br />
             现在回到帖子中提出的问题，怎么让多个atlas的sprite能进行穿插。办法是用多个panel。<br />
             比如有两个atlas，分别为SiFi和Wooden，而SiFi中有两个要显示的精灵Dark和Label，Wooden中有一个要显示的精灵wooden，现在想把wooden放到Dark和Label之间。那么设置两个panel，一个放Dark和wooden，另一个放Label，或者一个放Label和wooden，另一个放Dark，只要SiFi图集中的两个精灵不在同一个panel中就可以，之后微调其中一个精灵的z轴就可以了，比如调节Label的z轴为-0.1，则如下图，wooden到了Dark和Label的中间<br />
             <img src="http://game.ceeger.com/forum/attachment/thumb/Mon_1302/16_773_de12cc79d87e794.jpg" border="0" title="点击查看原图" alt="" /><br />
             &nbsp;<br />
             不过如果认为为什么要这么麻烦呢，只需要在一个panel中调节就可以了，那就回到了2中的问题上，总是在上或在下，而不会在中间<br />
             &nbsp;<br />
             如下图，三者在一个panel下，现在空间位置是wooden在中间z为0，Dark为100，Lable为-100，且三者的depth也是相应的，但wooden还是在最上面<img src="http://game.ceeger.com/forum/attachment/thumb/Mon_1302/16_773_bcfe3cf29d81c11.jpg" border="0" title="点击查看原图" alt="" /><br /><br />
             <br /><br />现在修改下wooden的z轴，比如改为1，而Dark和Label的z不变，则wooden跑到了最后面，但就是不到中间去<br /><br /><br /><br /><img src="http://game.ceeger.com/forum/attachment/thumb/Mon_1302/16_773_d0237c3d33e97d1.jpg" border="0" title="点击查看原图" alt="" /><br /><br />
             此外，即使用两个panel，但同是SiFi图集中的Dark和Label还是在同一个panel下，而把wooden放到另一个panel中，还是无法达到插入的目的，如下图，无论怎么调节wooden的z轴，它要么在最前面，要么在最后面<br /><br />
             <img src="http://game.ceeger.com/forum/attachment/thumb/Mon_1302/16_773_e72fa09bd579a03.jpg" border="0" title="点击查看原图" alt="" /><br />
             此时只需把Dark或Label之一放到wooden的panel下就能实现wooden在中间的目的，比如把Dark和wooden放到一起<br />
             <img src="http://game.ceeger.com/forum/attachment/thumb/Mon_1302/16_773_1d8ae5e23868e21.jpg" border="0" title="点击查看原图" alt="" /><br /><br />
             而现在有个有趣的想法，就是既然这样可以达到wooden在中间的目的，那能不能把label放到两者中间呢？试一下就知道，是可以的。而既然这样，那Dark能放到两者中间么，试一下，还是可以的。这就让定位更加灵活<br />
             &nbsp;<br />
             当然这是最简单的穿插，如果有多个panel和多个atlas的话情况会比较复杂，此时要记着2中的情况，否则还是容易出现无法穿插的问题。而解决这个问题的方法最好还是atlas设计的时候更全面，让穿插的sprite在一个atlas中，这样只用depth深度就可以控制了<br />
             &nbsp;<br />
             4，同一个panel下，不同Atlas的sprite，受z轴控制，depth不起作用。而默认添加的时候覆盖关系似乎和atlas有关，比如从SiFi图集和Wooden图集中分别添加任意一个精灵到同一个panel下，总是SiFi的精灵在下面，此时depth不起作用，可以直接调节z轴比如-0.1就可以<br />
             &nbsp;<br />
             5，（修改）对于panel是否会产生drawcall，之前的试验存在误区，当时是直接复制带着sprite的Panel，这的确会产生新的drawcall，这是因为在复制时panel的scale被修改了，由1变成了0.9999304之类的，这会导致drawcall增加了1个，而之后再复制这个由复制产生的panel，scale还是0.9999304，所以drawcall不会再变。<br />
             现在发现修改panel的缩放scale的确会增加drawcall。所以如果为了方便而复制一个panel的话，别忘了reset它的缩放<br />
             &nbsp;<br />
             <br />
             而之所以对panel是否会产生drawcall，是因为官方例7中只用了2个Atlas，但drawcall却是5个，当时简单的认为是panel的问题。</div>
             </div>
             </td>
         </tr>
         <tr>
             <td floor_bottom"="" valign="bottom">
             <div>
             <div>
             <ul big_img=""  j_gallery_list"="">
                 <li><a data-big="http://game.ceeger.com/forum/attachment/Mon_1302/16_773_82d7fed661ef06d.jpg"><br />
                 <br />
                 <br />
                 <img src="http://game.ceeger.com/forum/attachment/thumb/Mon_1302/16_773_82d7fed661ef06d.jpg" border="0" title="点击查看原图" alt="" /><br /><br /></a></li>
                 <li><a data-big="http://game.ceeger.com/forum/attachment/Mon_1302/16_773_2278728e2f21881.jpg"><img src="http://game.ceeger.com/forum/attachment/thumb/Mon_1302/16_773_2278728e2f21881.jpg" border="0" title="点击查看原图" alt="" /><br /><br /></a></li>
                 <li><a data-big="http://game.ceeger.com/forum/attachment/Mon_1302/16_773_211d63fde6cc025.jpg"><img src="http://game.ceeger.com/forum/attachment/Mon_1302/16_773_211d63fde6cc025.jpg" border="0" title="点击查看原图" alt="" /><br /><br /><br />
                 其实上面的东西总结出来就一句话：（啰嗦那么多，总结却这么少，好没成就感，呵呵）<br />
                 在相同Panel下，相同Atlas中的Sprite才受Depth控制，其他情况则受z轴控制，但同时又受前者影响。&nbsp;<br />
                 &nbsp;<br />
                 列个表的话就是：<br />
                 1、相同panel &nbsp; &nbsp;相同atlas &nbsp; &nbsp; sprite受depth控制<br />
                 2、相同panel&nbsp;&nbsp;&nbsp;&nbsp;不同atlas &nbsp; &nbsp; sprite受z轴控制 &nbsp; &nbsp;（同时受1的影响）<br />
                 3、不同panel &nbsp; &nbsp;相同atlas &nbsp; &nbsp; sprite受z轴控制 &nbsp; &nbsp;（同时受1的影响）<br />
                 4、不同panel &nbsp; &nbsp;不同atlas &nbsp; &nbsp; sprite受z轴控制 &nbsp; &nbsp;（同时受1的影响）<br />
                 <br />
                 &nbsp; &nbsp; &nbsp;不过要特别注意的是，虽然depth控制的范围看似较少，但它却占主导地位，是最常被用到的，这是因为NGUI基于Atlas，只有在1无法达到目的的时候，才会去用其他的。&nbsp;而且在较复杂的情况时它也是易被忽略的，也就是2、3、4括号中的&#8220;同时受1的影响&#8221;。比如在2中，相同panel下，有三个sprite：A、B、C，但A和B的Atlas是相同的，C是的Atlas是另一个，此时即使用z轴控制，也无法将C放到AB之间，这也是上楼中3中所提到的问题。<br />
                 <br />
                 此外关于字体，感觉要分两方面，一个是英语等外语，一个是中文。<br />
                 <br />
                 对于英文，因为就那些有限的字母（因为只会点英语，所以不知道是不是有的外语制作起来也很繁杂），所以可以和图片sprite放到一起，官方的atlas中就是这样的分布，把字体和图片打包在了一起。这种情况下我感觉字体和图片是在同一个atlas里面的，使用起来也只是占1个drawcall。而同一个atlas中的sprite，则可用depth来调整深度。比如上面1234例子里的Label就是英文字体，它是和Dark这个图片同在SiFi图集中，所以在相同panel下可用depth来控制显示顺序。但此时想再插入一个其他atlas中的sprite到他俩之间的话，就会不成功，因为他俩是一个atlas中的。<br />
                 而不同的panel下就只能用z轴来控制了。比如用SiFi的Label，此外再用wooden图集的button，他俩只用depth是没法控制的。如下图中，后缀表示label的depth是10，而button的depth是0，但button还是挡住了label，这和上面说的第4条一样。<br /><br /><br />
                 <img src="http://game.ceeger.com/forum/attachment/thumb/Mon_1302/16_773_bdaa69968a481ab.jpg" border="0" title="点击查看原图" alt="" /><br /><br />
                 此外对于将文字打包到Atlas中，是在制作字体是，在FontMaker中选择目标Atlas，此时就会将文字打包到了此Atlas中。不过要注意，这个操作会修改Atlas，所以不要弄错了<br />
                 如下图，就是将官方的Arimo14字体打包到了DiShuTest图集中，也就是在Output选项中选择Atlas。而or select这项中的字体会被替换掉，可以不选，当然Atlas在不打包字体的时候也可以不选<br />
                 <img src="http://game.ceeger.com/forum/attachment/Mon_1302/16_773_a85bccfec8ede68.jpg" border="0" title="点击查看原图" alt="" /><br /><br />
                 而对于中文，文字因为不能像英文那样用单个的字母来组成，所以为了能显示大多数的常用字，一般都是用单独的UIFont来制作，可看做是一个atlas，这种情况下，字体的atlas和其他的atlas就是在不同的图集了。此时可用z轴来控制。<br />
                 比如下图中，用了3个Atlas，都放到同一个panel下，后缀表示的depth，注意左边的那4个是参照，只为了能看清都是那些东西。分别是：<br />
                 Atlas1，使用一个sprite，人物为程咬金，depth为3<br />
                 Atlas2，实际是一个中文Font字体的label，也看做是图集，depth是2<br />
                 Atlas3，最后两个精灵都是用的Sift中的，depth是0和1<br />
                 然后把它们都放到一个panel下，而你做试验的时候可能显示的顺序不一样，但不要紧，我们关注的是它们是不是以depth的顺序排列了，而看一下就知道，它们并没按顺序排列，比如NGUI的depth是1，但它却显示在了最上面。<br />
                 <img src="http://game.ceeger.com/forum/attachment/thumb/Mon_1302/16_773_41c35d201629916.jpg" border="0" title="点击查看原图" alt="" /><br />
                 现在用z轴控制他们的显示顺序和depth一样，很容易就做到了。<br />
                 <img src="http://game.ceeger.com/forum/attachment/thumb/Mon_1302/16_773_d8f2b9bfca72cbb.jpg" border="0" title="点击查看原图" alt="" /><br />
                 这些试验都是在比较简单的情况下做的，所以可能并不真的对，所以如果有错误的地方请指出。<br />
                 <br />
                 <br />
                 <br />
                 </a></li>
             </ul>
             </div>
             </div>
             </td>
         </tr>
     </tbody>
</table><img src ="http://www.cppblog.com/ming81/aggbug/203813.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2013-10-19 12:30 <a href="http://www.cppblog.com/ming81/archive/2013/10/19/203813.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)Unity开发之NGUI系列 </title><link>http://www.cppblog.com/ming81/archive/2013/10/17/203790.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Thu, 17 Oct 2013 11:47:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2013/10/17/203790.html</guid><description><![CDATA[<blockquote><blockquote><p>在Unity开发中收集了一些插件，收集这些插件的目的并不是我喜欢在开发中使用插件。本着喜欢的态度去收集的，就像我喜欢收集模型一样；还有一点就是通过了解插件能让我知道Unity更多的功能与应用，假设说：我想做一个RPG的手机游戏，但是不知道如何通过做出打斗的那种真实感，在Assets Store已经有这样的pack或kit，我就可以从它的代码结构，资源使用及Demo截图、文字描述中大概得知一二，再经过分析，能为我做好前期的准备工作，及项目规化。当然了收集这么多插件，有些也是因为在Assets Store上宣传特别地给力，所以想收藏过来看一看其强大之处&#8230;&#8230;</p><p>相对收集插件及模型来说，我更偏向看Unity方面的书箱，读书能够让我更全面地了解unity方方面面，包括一些基础的技能。</p><p>其中与NGUI相关的一系列的插件就有如下：(还有一些未整理)<a href="http://images.cnitblog.com/blog/363476/201310/03124526-8eb4b1dae0b84feeb05aabd486d5b1b4.png"><img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; margin-right: 0px; margin-left: 0px; float: left; display: inline; background-image: none;" title="image" border="0" alt="image" align="left" src="http://images.cnitblog.com/blog/363476/201310/03124527-4302916e94a0421b8721f6852d1f67a7.png" width="352" height="381" /></a>，版本也从刚开始使用的2.0到现在的3.0.1，经历这么多的版本变化，对我来说，我要使用的核心的功能还是一样&#8220;提高开发效率，减少Draw Call。&#8221;</p><p>最常用的要数NGUI、NGUI&amp;HUD Text、StarlinkUI，其它的仅打开看了，没有应用到具体的项目中</p><p> </p><p>以下是部分插件在Assets Store上的截图</p><p><a href="http://images.cnitblog.com/blog/363476/201310/03124527-8046f4713ae84efcb32903c5f704db71.png"><img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://images.cnitblog.com/blog/363476/201310/03124528-568f480e2ade4680a9c82a8caa9b0cf5.png" width="828" height="471" /></a></p><p align="center"><strong>检视面板</strong></p><p><a href="http://images.cnitblog.com/blog/363476/201310/03124529-191c38c3f76c4d968b137e0f0965cb92.png"><img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://images.cnitblog.com/blog/363476/201310/03124530-4138a0dea3b4424f9b8b712aa0bf85c2.png" width="824" height="474" /></a></p><p align="center"><strong>UI的MVVM模式</strong></p><p><a href="http://images.cnitblog.com/blog/363476/201310/03124532-66c2ca751cba47508e1868ec5567677e.png"><img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://images.cnitblog.com/blog/363476/201310/03124532-d4fb4a1b8d764fff9c8094134332da17.png" width="823" height="475" /></a></p><p align="center"><strong>文字添加右键功能</strong></p><p><a href="http://images.cnitblog.com/blog/363476/201310/03124533-d89011f139b544f39b0a0784326dea53.png"><img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://images.cnitblog.com/blog/363476/201310/03124535-a561c00b88554ce5b0df428050870ef0.png" width="822" height="469" /></a></p><p align="center"><strong>PS&#8212;&#8212;&gt;Unity</strong></p><p><a href="http://images.cnitblog.com/blog/363476/201310/03124536-b32060949a2b4a9983bddd8b98d575a0.png"><img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://images.cnitblog.com/blog/363476/201310/03124538-52cdf4d946834864a1ecae8a81454729.png" width="811" height="589" /></a></p><p align="center"><strong>深度管理</strong></p><p><a href="http://images.cnitblog.com/blog/363476/201310/03124540-0d1122e737aa4d08959831f2f9fc2fda.png"><img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://images.cnitblog.com/blog/363476/201310/03124540-4637b2ffd3bb4a82afff1106140198a6.png" width="821" height="585" /></a></p><p align="center"><strong>屏幕适配</strong></p><p><a href="http://images.cnitblog.com/blog/363476/201310/03124542-e71ffb7517714c93b338da5493e86b1d.png"><img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://images.cnitblog.com/blog/363476/201310/03124544-43b45a25ceee43119f505fd2552c35aa.png" width="809" height="596" /></a></p><p align="center"><strong>HUD Text漂浮的文字</strong></p><p><a href="http://images.cnitblog.com/blog/363476/201310/03124547-d50471d4f0784ac6a141eb46a0a3cb1b.png"><img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://images.cnitblog.com/blog/363476/201310/03124549-0a9c2a2fc54743d09ab7c14dada4aaed.png" width="791" height="593" /></a></p><p align="center"><strong>主UI库</strong></p><p><a href="http://images.cnitblog.com/blog/363476/201310/03124551-723627d57dc4430ca515b56a38c7fe78.png"><img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://images.cnitblog.com/blog/363476/201310/03124553-d98ee3ea29fc4830a5d3e83d3f5c455b.png" width="814" height="587" /></a></p><p align="center"><strong>我把它当作成品UI库</strong></p><p><a href="http://images.cnitblog.com/blog/363476/201310/03124555-01586c9c500f45c3a543e014de7199c4.png"><img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="http://images.cnitblog.com/blog/363476/201310/03124556-d11fcf0217164417bb166bb82ffb5d75.png" width="816" height="586" /></a></p><p align="center"><strong>在NGUI中使用Html标签</strong></p><p>在使用3.0的时候，在readme中的这段话让我考虑了一下是否继续提升当前的NGUI版本：</p><pre>*** WARNING *** PLEASE BACK UP YOUR PROJECT BEFORE UPDATING! 3.0.0 is a major changeset. You will need to open and re-save all of your scenes and prefabs after updating! After updating, expect some things to no longer work the same way they used to. Widgets scale is no longer used as its size, so any code that you had relying on this will need to change to use 'width' and 'height'. You can also expect compile errors related to delegate usage. The following links may help you:  http://www.youtube.com/watch?v=uNSZsMnhS1o&amp;list=UUQGZdUwzE8gmvgjomZSNFJg http://www.tasharen.com/forum/index.php?topic=11.msg27296#msg27296  3.0.0: - NEW: Changed the way widgets get batched, properly fixing all remaining Z/depth issues. - NEW: Draw calls are now automatically split up as needed (no more sandwiching issues!) - NEW: Re-designed the way widget width &amp; height gets specified. The values are now explicit, and scale is no longer used. - NEW: NGUI will now automatically replace UITextures with Sprites when they get added to an atlas. - NEW: It's now possible to have clipped panels in 3D and not have them break when tilting the camera. - NEW: It's now possible to nest widgets. - NEW: It's now possible to have multiple widgets on the same object. - NEW: It's now possible to change the selection handles color via the NGUI menu. - NEW: UICheckbox is now a UIToggle, and you now specify a 'group' ID rather than a common root object. - NEW: Added TweenWidth and TweenHeight to tween widgets width and height properties. - NEW: You can now specify the label overflow method: shrink content, clamp content, resize height, or resize freely. - NEW: When labels are in "resize label" overflow mode, the drag handles will be greyed out. - NEW: Added a simple EventDelegate class and improved all generic components to use it. - NEW: Added a Widget Container class that can be used to easily select and move groups of widgets (think: buttons, windows). - NEW: Added the RealTime helper class that removed IgnoreTimeScale. Usage: RealTime.time, RealTime.deltaTime. - NEW: Improved the inspector look of just about every component. - NEW: UIPanel now shows a list of all of its draw calls and the widgets causing them. - NEW: Added a way to auto-normalize the depth hierarchy from the NGUI menu. - NEW: You can now hide explicit draw calls by collapsing the draw call fold-outs on the panel. - NEW: Sprite selection window now shows sprite names as well. - NEW: Atlas maker will now automatically sort the sprites, saving them in an alphabetical order. - NEW: UICamera now has a better inspector, and it automatically hides properties if it's not the main one. - FIX: CTRL+ and CTRL- now adjust all widgets under the selected object. - FIX: Labels will now again align vertically properly. - FIX: Atlas maker will now respect textures that were imported with a non-native size. - FIX: Atlas maker will no longer change so many import settings on source textures. - FIX: Make Pixel Perfect is now undoable. - FIX: You can once again rename sprites in the atlas. - DEL: Removed the long-ago deprecated UISlicedSprite, UITiledSprite, and UIFilledSprite classes and some other legacy code.</pre></blockquote></blockquote>  <blockquote><p>当我把原来的项目中的NGUIv2.6.4换成3.0之后有很多的Error，看着这些Error，权衡了一下与我们现在的项目(中国风跑酷)的关系，决定选择V2.7.0比较妥当。我也明白太过追求最新的版本并不是最好的，考虑到我们组的开发人员有限(目前U3D只有两名)，另外我要花时间去了解新版本特性及其修改的地方(Component细微的改变)，但是项目组没有预算到这部分时间，所以稳定版的才是最适合我们的。</p></blockquote><img src ="http://www.cppblog.com/ming81/aggbug/203790.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2013-10-17 19:47 <a href="http://www.cppblog.com/ming81/archive/2013/10/17/203790.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)Unity3D开发（一）：NGUI之UIRoot屏幕分辨率自适应</title><link>http://www.cppblog.com/ming81/archive/2013/10/15/203748.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Tue, 15 Oct 2013 06:47:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2013/10/15/203748.html</guid><description><![CDATA[<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">NGUI在Unity3D游戏开发中非常常用，而NGUI对于每一个UI场景，都是以一个UIRoot为UI游戏对象树的根的，那么这个UIRoot是起什么作用的呢？</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">先简单看一下UIRoot中的基本属性</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><img style="border-bottom: medium none; border-left: medium none; max-width: 100%; border-top: medium none; border-right: medium none" alt="" src="http://img.blog.csdn.net/20130915201111718?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvb25lUmFpbjg4/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" /></p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">UIRoot游戏对象的属性只有4个，分别是缩放规则，手动高度，最小高度和最大高度</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">而正是这4个属性，将影响整个UI场景中整体的缩放比例，当设置好这4个属性之后，UIRoot游戏对象的相对缩放值(LocalScale)将会生成并且不能被直接修改（NGUI中很多属性都是不能直接被修改的，这种控制是在UIRoot脚本中，通过设置[ExecuteInEditMode]做到的，其相对缩放值是根据UIRoot的4个属性计算出来的），那么这4个属性分别是什么含义呢？</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">（吐槽一下，也许这里的用户体验并不足够友好，因为Manual Height和Minimum Height, Maximum Height并不会同时起作用，如果能做到在选择Scaling Style时动态的切换，使用者也许能更清楚它们之间的关系）</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><br /></p>
<h2 style="text-align: left; padding-bottom: 0px; line-height: 26px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font-family: Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><a style="color: rgb(202,0,0); text-decoration: none" name="t0"></a><span style="color: rgb(0,102,0)">1.Scaling Style (缩放类型)</span></h2>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">这是一个简单的枚举变量，包括三个枚举值</p>
<div style="text-align: left; widows: 2; text-transform: none; background-color: rgb(85,85,85); text-indent: 0px; margin: 18px 0px; width: 1356px; letter-spacing: normal; font: 12px/26px Consolas, 'Courier New', Courier, mono, serif; white-space: normal; orphans: 2; color: rgb(0,0,0); overflow: auto; word-spacing: 0px; padding-top: 1px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="dp-highlighter bg_csharp">
<div style="padding-left: 45px" class="bar">
<div style="border-left: rgb(153,153,153) 3px solid; padding-bottom: 10px; background-color: rgb(85,85,85); padding-left: 10px; padding-right: 8px; font: 9px Verdana, Geneva, Arial, Helvetica, sans-serif; color: silver; padding-top: 3px" class="tools"><strong>[csharp]</strong><span class="Apple-converted-space">&nbsp;</span><a style="background-image: none; border-bottom: medium none; border-left: medium none; padding-bottom: 0px; margin: 0px 10px 0px 0px; padding-left: 0px; padding-right: 0px; color: rgb(204,204,204); font-size: 9px; border-top: medium none; border-right: medium none; text-decoration: none; padding-top: 0px" class="ViewSource" title="view plain" onclick="dp.sh.Toolbar.Command('ViewSource',this);return false;" href="http://blog.csdn.net/onerain88/article/details/11713299#">view plain</a><a style="background-image: none; border-bottom: medium none; border-left: medium none; padding-bottom: 0px; margin: 0px 10px 0px 0px; padding-left: 0px; padding-right: 0px; color: rgb(204,204,204); font-size: 9px; border-top: medium none; border-right: medium none; text-decoration: none; padding-top: 0px" class="CopyToClipboard" title="copy" onclick="dp.sh.Toolbar.Command('CopyToClipboard',this);return false;" href="http://blog.csdn.net/onerain88/article/details/11713299#">copy</a><a style="background-image: none; border-bottom: medium none; border-left: medium none; padding-bottom: 0px; margin: 0px 10px 0px 0px; padding-left: 0px; padding-right: 0px; color: rgb(204,204,204); font-size: 9px; border-top: medium none; border-right: medium none; text-decoration: none; padding-top: 0px" class="PrintSource" title="print" onclick="dp.sh.Toolbar.Command('PrintSource',this);return false;" href="http://blog.csdn.net/onerain88/article/details/11713299#">print</a><a style="background-image: none; border-bottom: medium none; border-left: medium none; padding-bottom: 0px; margin: 0px 10px 0px 0px; padding-left: 0px; padding-right: 0px; color: rgb(204,204,204); font-size: 9px; border-top: medium none; border-right: medium none; text-decoration: none; padding-top: 0px" class="About" title="?" onclick="dp.sh.Toolbar.Command('About',this);return false;" href="http://blog.csdn.net/onerain88/article/details/11713299#">?</a> 
<div style="z-index: 99; position: absolute; width: 29px; height: 14px; top: 967px; left: 443px"><embed style="-webkit-animation: playerInserted 0.001s" id="ZeroClipboardMovie_1" height="14" name="ZeroClipboardMovie_1" type="application/x-shockwave-flash" align="center" pluginspage="http://www.macromedia.com/go/getflashplayer" width="29" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" allowscriptaccess="always" allowfullscreen="false" flashvars="id=1&amp;width=29&amp;height=14" wmode="transparent"></div></div></div>
<ol style="border-bottom: medium none; border-left: medium none; padding-bottom: 0px; background-color: rgb(255,255,255); list-style-type: decimal; margin: 0px 0px 1px 45px; padding-left: 0px; padding-right: 0px; color: rgb(0,204,0); border-top: medium none; border-right: medium none; padding-top: 0px" class="dp-c"><li style="list-style-position: outside; border-bottom-style: none; border-left: rgb(153,153,153) 3px solid; padding-bottom: 0px !important; line-height: 18px; background-color: rgb(85,85,85); list-style-type: decimal-leading-zero; margin: 0px; padding-left: 10px !important; padding-right: 3px !important; border-top-style: none; color: rgb(255,153,153); border-right-style: none; padding-top: 0px !important" class="alt"><span style="border-bottom: medium none; border-left: medium none; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; color: rgb(0,204,0); border-top: medium none; border-right: medium none; padding-top: 0px"><span style="border-bottom: medium none; border-left: medium none; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; color: rgb(102,204,255); border-top: medium none; font-weight: bold; border-right: medium none; padding-top: 0px" class="keyword">public</span><span style="border-bottom: medium none; border-left: medium none; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; color: rgb(0,204,0); border-top: medium none; border-right: medium none; padding-top: 0px">&nbsp;</span><span style="border-bottom: medium none; border-left: medium none; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; color: rgb(102,204,255); border-top: medium none; font-weight: bold; border-right: medium none; padding-top: 0px" class="keyword">enum</span><span style="border-bottom: medium none; border-left: medium none; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; color: rgb(0,204,0); border-top: medium none; border-right: medium none; padding-top: 0px">&nbsp;Scaling&nbsp;&nbsp;</span></span></li><li style="list-style-position: outside; border-bottom-style: none; border-left: rgb(153,153,153) 3px solid; padding-bottom: 0px !important; line-height: 18px; background-color: rgb(85,85,85); list-style-type: decimal-leading-zero; margin: 0px; padding-left: 10px !important; padding-right: 3px !important; border-top-style: none; color: rgb(255,153,153); border-right-style: none; padding-top: 0px !important"><span style="border-bottom: medium none; border-left: medium none; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; color: rgb(0,204,0); border-top: medium none; border-right: medium none; padding-top: 0px">&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;</span></li><li style="list-style-position: outside; border-bottom-style: none; border-left: rgb(153,153,153) 3px solid; padding-bottom: 0px !important; line-height: 18px; background-color: rgb(85,85,85); list-style-type: decimal-leading-zero; margin: 0px; padding-left: 10px !important; padding-right: 3px !important; border-top-style: none; color: rgb(255,153,153); border-right-style: none; padding-top: 0px !important" class="alt"><span style="border-bottom: medium none; border-left: medium none; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; color: rgb(0,204,0); border-top: medium none; border-right: medium none; padding-top: 0px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PixelPerfect,&nbsp;&nbsp;</span></li><li style="list-style-position: outside; border-bottom-style: none; border-left: rgb(153,153,153) 3px solid; padding-bottom: 0px !important; line-height: 18px; background-color: rgb(85,85,85); list-style-type: decimal-leading-zero; margin: 0px; padding-left: 10px !important; padding-right: 3px !important; border-top-style: none; color: rgb(255,153,153); border-right-style: none; padding-top: 0px !important"><span style="border-bottom: medium none; border-left: medium none; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; color: rgb(0,204,0); border-top: medium none; border-right: medium none; padding-top: 0px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FixedSize,&nbsp;&nbsp;</span></li><li style="list-style-position: outside; border-bottom-style: none; border-left: rgb(153,153,153) 3px solid; padding-bottom: 0px !important; line-height: 18px; background-color: rgb(85,85,85); list-style-type: decimal-leading-zero; margin: 0px; padding-left: 10px !important; padding-right: 3px !important; border-top-style: none; color: rgb(255,153,153); border-right-style: none; padding-top: 0px !important" class="alt"><span style="border-bottom: medium none; border-left: medium none; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; color: rgb(0,204,0); border-top: medium none; border-right: medium none; padding-top: 0px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FixedSizeOnMobiles,&nbsp;&nbsp;</span></li><li style="list-style-position: outside; border-bottom-style: none; border-left: rgb(153,153,153) 3px solid; padding-bottom: 0px !important; line-height: 18px; background-color: rgb(85,85,85); list-style-type: decimal-leading-zero; margin: 0px; padding-left: 10px !important; padding-right: 3px !important; border-top-style: none; color: rgb(255,153,153); border-right-style: none; padding-top: 0px !important"><span style="border-bottom: medium none; border-left: medium none; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; color: rgb(0,204,0); border-top: medium none; border-right: medium none; padding-top: 0px">&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li></ol></div><span style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/26px Arial; white-space: normal; orphans: 2; float: none; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">（FixedSize和FixedSizeOnMobiles类似，并且后者只添加了对ios和android平台的判断，所以前者可以替代后者使用）</span> 
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"></p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">这里只讨论PixelPerfect和FixedSize的区别，两者都是针对于所有在此UIRoot之下的UI组件而言的，也可以认为是在此UIRoot下，整个游戏屏幕的尺寸的缩放类型！</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><br /></p>
<h2 style="text-align: left; padding-bottom: 0px; line-height: 26px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font-family: Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><a style="color: rgb(202,0,0); text-decoration: none" name="t1"></a><span style="color: rgb(0,102,0)">2.Manual Height和Minimum Height, Maximum Height (手动高度和最小高度，最大高度)</span></h2>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">Manual Height和Minimum Height, Maximum Height不会同时对此UIRoot起作用，当选择Scaling Style为PixelPerfect时，我们需要设置Minimum Height, Maximum Height；而当Scaling Style为FixedSize或FixedSizeOnMobiles时，我们需要设置Manual Height。（这就是我前面吐槽的原因）</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><br /></p>
<h2 style="text-align: left; padding-bottom: 0px; line-height: 26px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font-family: Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><a style="color: rgb(202,0,0); text-decoration: none" name="t2"></a><span style="color: rgb(0,102,0)">3.使用</span></h2>
<h3 style="text-align: left; padding-bottom: 0px; line-height: 26px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font-family: Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><a style="color: rgb(202,0,0); text-decoration: none" name="t3"></a><span style="color: rgb(0,51,51)">（1）PexelPerfect和Minimum Height, Maximum Height</span></h3>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">这个组合主要用于我们期望所有的UI纹理都&#8220;尽量&#8221;不进行缩放，所谓&#8220;尽量&#8221;的程度，则是取决于Minimum Height和Maximum Height，Minimum Height表示当设备分别率小于此设置值时，根据此设置值对UIRoot进行缩放；Maximum Height表示当设备分辨率大于此设置值时，根据此设置值对UIRoot进行缩放（UIRoot是UI游戏对象树的根，修改UIRoot的缩放，则会影响整棵UI树的缩放）</p>
<h3 style="text-align: left; padding-bottom: 0px; line-height: 26px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font-family: Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><a style="color: rgb(202,0,0); text-decoration: none" name="t4"></a><span style="color: rgb(0,51,51)">（2）FixedSize和Manul Height</span></h3>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">这个组合主要用于我们期望所有的UI纹理都进行&#8220;合适&#8221;的缩放，所谓&#8220;合适&#8221;缩放的原则，则是根据Manual Height设置值，当设备分辨率的高度值不同于此设置值时，则根据其比例（即Manual Height /&nbsp;Screen Height）对整棵UI树的进行&#8220;等比&#8221;缩放（宽度的缩放比也是此比例值），这样，我们就可以做一套资源，在不同尺寸的分辨率最好的&#8220;不变形&#8221;的适配了</p>
<h3 style="text-align: left; padding-bottom: 0px; line-height: 26px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font-family: Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><a style="color: rgb(202,0,0); text-decoration: none" name="t5"></a><span style="color: rgb(0,51,51)">（3）交集</span></h3>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">前面两组在什么情况下等同呢？</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">Manual Height == Minimum Height == Maximum Height&nbsp;</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">推导过程，呵呵~~</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">具体可参考UIRoot中activeHeight属性和GetPixelSizeAdjustment的计算过程</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><br /></p>
<h2 style="text-align: left; padding-bottom: 0px; line-height: 26px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font-family: Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><a style="color: rgb(202,0,0); text-decoration: none" name="t6"></a><span style="color: rgb(0,102,0)">4.这也许并不够</span></h2>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">基于以上推到，当我们以1024x768为标准分辨率做一套UI资源（也就是选择FixedSize并且Manual Height=768），似乎可以满足百分之90以上的机型了，而为什么是1024x768呢？</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">既然我们已经容忍在除1024x768之外的其他设备上进行等比缩放了，那为什么不是960x640呢？</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">计算一下1024x768的宽高比=1.33，960x640的宽高比=1.5，这就是移动设备的分辨率比例的全部了吗？</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">当然不是，iphone5的比例就要大于1.5，还有各种奇葩的android设备呢，比如夏新的n828就是960x540，宽高比=1.78</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">那为什么以1024x768为标准呢？</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">因为1.33的宽高比，当我们的1024x768的资源到960x640的设备上时会有什么现象？</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">根据Manual Height / Screen Height的比例可知，我们需要缩放768 / 640 = 1.2倍，假设是一张1024x768的纹理，高度缩放1.2倍变为了640，宽度也要相应缩放1.2倍变为853（保证等比缩放不变形），也就是说1024x768的资源放到960x640上反而两边有了黑边，这是我们可以容忍的，我们可以做一个很大的背景或者拉伸，保证UI组件不变形即可，很多游戏都是这么做的，比如植物大战僵尸在iphone5和ipad上看到的背景视野并不一样大！</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">当放到夏新的机器上呢？</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">我们需要缩放768 / 540 = 1.4倍，宽度1024 / 1.4 = 731，这是可以的，只是看起来更怪一些，因为两边的黑边相对比例更大了（960 - 731=229的黑边区域）</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">而我表示android机器的分辨率奇葩到只有想不到，没有做不到的程度，也许宽高比1.7并不是终点，当遇到1.8之后，黑边的相对比例会更大。。。</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><br /></p>
<h2 style="text-align: left; padding-bottom: 0px; line-height: 26px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font-family: Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><a style="color: rgb(202,0,0); text-decoration: none" name="t7"></a><span style="color: rgb(0,102,0)">5.问题又来了</span></h2>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">假设我们的游戏类型更适合iphone手机玩，不太适合ipad，所以我希望能以960x640为标准做一套资源，可以吗？</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">我只能说不太可以，因为你要在设计UI组件的大小做限制了，为什么需要做限制？</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">假设我有一张纹理是960x640大小的，在iphone上铺满整屏，根据我们的设置（FixedSize和Manual Height=640），拿到1024x768的分辨率上，高度640 / 768 = 0.83，为了保证等比缩放，宽度960 / 0.83 = 1156，不幸的事情发生了，1156 &gt; 1024，这个UI组件宽度超过了屏幕的宽度，被裁剪了。。。这是我们不能容忍的，或许你可以说我们尽量不做这种尺寸的UI，OK，你可以对UI尺寸加限制，但是当面对android那些奇葩的分辨率的时候，你会发现限制越来越大，这也许会让美术和策划疯掉！</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><br /></p>
<h2 style="text-align: left; padding-bottom: 0px; line-height: 26px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font-family: Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><a style="color: rgb(202,0,0); text-decoration: none" name="t8"></a><span style="color: rgb(0,102,0)">6.解决方案</span></h2>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">当我们花上一些时间去观察现在移动设备的分辨率时，虽然奇葩很多，但是还是有一些规律的，规律的在于宽高比而不在于具体尺寸，大体上划分一下宽高比在1.3,1.5,1.7的范围上的居多（基本是全部吧！）即便是再有1.2,1.8的比例也无妨。。。</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="color: rgb(0,51,0)"><strong>NGUI为我们提供的方案只有以各种高度为衡量标准是不够的，我们应该加上一种以宽度为衡量标准的缩放类型</strong></span></p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="color: rgb(0,51,0)"><strong>而对于UI资源的标准，我们选取960x640，宽高比为1.5</strong></span></p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="color: rgb(0,51,0)"><strong>这样，当我们在兼容大于1.5的尺寸的时候，使用NGUI的现有方案；当我们在兼容小于1.5的尺寸的时候，使用以宽度为衡量标准</strong></span></p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="color: rgb(0,51,0)"><strong>也就是说有一个类似Manual Width的属性，当小于1.5时，我们使用Manual Width / Screen Width得出整棵UI树的缩放比例！</strong></span></p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 0px; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="color: rgb(0,51,0)"><strong>这样做的好处是&#8220;黑边&#8221;区域不会太大，并且不需要对UI组件的大小做限制！</strong></span></p><img src ="http://www.cppblog.com/ming81/aggbug/203748.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2013-10-15 14:47 <a href="http://www.cppblog.com/ming81/archive/2013/10/15/203748.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)【Unity3D插件】NGUI屏幕自适应</title><link>http://www.cppblog.com/ming81/archive/2013/10/15/203746.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Tue, 15 Oct 2013 06:15:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2013/10/15/203746.html</guid><description><![CDATA[<h2 style="border-bottom: rgb(145,150,153) 1px solid; text-align: left; padding-bottom: 2px; line-height: 26px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; margin: 2em 0px 0.5em; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font-family: Arial, Helvetica, FreeSans, sans-serif; white-space: normal; orphans: 2; color: rgb(54,46,43); font-size: 1.6em; word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">屏幕自适应</h2>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); margin-top: 10px; text-indent: 0px; letter-spacing: normal; font: 13px/17px Arial, Helvetica, FreeSans, sans-serif; white-space: normal; orphans: 2; margin-bottom: 10px; color: rgb(51,51,51); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">NGUI可以比较方便的实现屏幕自适应，但是它的官方教程里面针对这个问题没有详细的教程，所以可能在实现的时候会走比较多的弯路。以下是我在开发过程中找到的一个比较方便的实现方法。</p>
<h2 style="border-bottom: rgb(145,150,153) 1px solid; text-align: left; padding-bottom: 2px; line-height: 26px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; margin: 2em 0px 0.5em; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font-family: Arial, Helvetica, FreeSans, sans-serif; white-space: normal; orphans: 2; color: rgb(54,46,43); font-size: 1.6em; word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><a style="color: rgb(106,57,6); text-decoration: none" name="t1"></a><a style="color: rgb(106,57,6); text-decoration: none" name="%E3%80%90NGUI%E3%80%91%E5%B1%8F%E5%B9%95%E5%88%86%E8%BE%A8%E7%8E%87%E8%87%AA%E9%80%82%E5%BA%94-%E4%B8%BB%E8%A6%81%E7%BB%84%E4%BB%B6"></a>主要组件</h2>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); margin-top: 10px; text-indent: 0px; letter-spacing: normal; font: 13px/17px Arial, Helvetica, FreeSans, sans-serif; white-space: normal; orphans: 2; margin-bottom: 10px; color: rgb(51,51,51); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">1. UIAnchor</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); margin-top: 10px; text-indent: 0px; letter-spacing: normal; font: 13px/17px Arial, Helvetica, FreeSans, sans-serif; white-space: normal; orphans: 2; margin-bottom: 10px; color: rgb(54,46,43); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="color: rgb(51,51,51)">这个是用来确定控件在屏幕中的位置，另外有一篇教程专门讲它的功能，所有不会再赘述</span></p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); margin-top: 10px; text-indent: 0px; letter-spacing: normal; font: 13px/17px Arial, Helvetica, FreeSans, sans-serif; white-space: normal; orphans: 2; margin-bottom: 10px; color: rgb(51,51,51); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">2. UIStretch</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); margin-top: 10px; text-indent: 0px; letter-spacing: normal; font: 13px/17px Arial, Helvetica, FreeSans, sans-serif; white-space: normal; orphans: 2; margin-bottom: 10px; color: rgb(51,51,51); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">这个是用来做缩放的组件。老版本的NGUI是集成在UIAnchor上的。新版本的UIStretch提供了4种缩放方式：</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); margin-top: 10px; text-indent: 0px; letter-spacing: normal; font: 13px/17px Arial, Helvetica, FreeSans, sans-serif; white-space: normal; orphans: 2; margin-bottom: 10px; color: rgb(51,51,51); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">Horizontal：只缩放水平方向</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); margin-top: 10px; text-indent: 0px; letter-spacing: normal; font: 13px/17px Arial, Helvetica, FreeSans, sans-serif; white-space: normal; orphans: 2; margin-bottom: 10px; color: rgb(51,51,51); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">Vertical：只缩放垂直方向</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); margin-top: 10px; text-indent: 0px; letter-spacing: normal; font: 13px/17px Arial, Helvetica, FreeSans, sans-serif; white-space: normal; orphans: 2; margin-bottom: 10px; color: rgb(51,51,51); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">Bose：缩放两个方向</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); margin-top: 10px; text-indent: 0px; letter-spacing: normal; font: 13px/17px Arial, Helvetica, FreeSans, sans-serif; white-space: normal; orphans: 2; margin-bottom: 10px; color: rgb(51,51,51); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="white-space: nowrap" class="nobr"><a style="outline-style: none; outline-color: invert; outline-width: medium; color: maroon; text-decoration: none" class="createlink" href="http://enveesoft.dyndns.biz:8082/pages/createpage.action?spaceKey=~daiguangda&amp;title=BasedOnHeight&amp;linkCreation=true&amp;fromPageId=20906019">BasedOnHeight<sup><img style="border-bottom: medium none; border-left: medium none; max-width: 100%; border-top: medium none; border-right: medium none" class="rendericon" border="0" alt="" align="absMiddle" src="http://enveesoft.dyndns.biz:8082/images/icons/plus.gif" width="7" height="7" /></sup></a></span>：基于高度等比缩放</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); margin-top: 10px; text-indent: 0px; letter-spacing: normal; font: 13px/17px Arial, Helvetica, FreeSans, sans-serif; white-space: normal; orphans: 2; margin-bottom: 10px; color: rgb(51,51,51); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">然后基于这些我自己实现了一个</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); margin-top: 10px; text-indent: 0px; letter-spacing: normal; font: 13px/17px Arial, Helvetica, FreeSans, sans-serif; white-space: normal; orphans: 2; margin-bottom: 10px; color: rgb(51,51,51); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="white-space: nowrap" class="nobr"><a style="outline-style: none; outline-color: invert; outline-width: medium; color: maroon; text-decoration: none" class="createlink" href="http://enveesoft.dyndns.biz:8082/pages/createpage.action?spaceKey=~daiguangda&amp;title=BasedOnWidth&amp;linkCreation=true&amp;fromPageId=20906019">BasedOnWidth<sup><img style="border-bottom: medium none; border-left: medium none; max-width: 100%; border-top: medium none; border-right: medium none" class="rendericon" border="0" alt="" align="absMiddle" src="http://enveesoft.dyndns.biz:8082/images/icons/plus.gif" width="7" height="7" /></sup></a></span>：基于宽度等比缩放</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); margin-top: 10px; text-indent: 0px; letter-spacing: normal; font: 13px/17px Arial, Helvetica, FreeSans, sans-serif; white-space: normal; orphans: 2; margin-bottom: 10px; color: rgb(51,51,51); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">代码如下：</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); margin-top: 10px; text-indent: 0px; letter-spacing: normal; font: 13px/17px Arial, Helvetica, FreeSans, sans-serif; white-space: normal; orphans: 2; margin-bottom: 10px; color: rgb(51,51,51); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"></p>
<div style="text-align: left; widows: 2; text-transform: none; background-color: rgb(231,229,220); text-indent: 0px; margin: 18px 0px; width: 693px; letter-spacing: normal; font: 12px/26px Consolas, 'Courier New', Courier, mono, serif; white-space: normal; orphans: 2; color: rgb(54,46,43); overflow: auto; word-spacing: 0px; padding-top: 1px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="dp-highlighter bg_csharp">
<div style="padding-left: 45px" class="bar">
<div style="border-left: rgb(108,226,108) 3px solid; padding-bottom: 10px; background-color: rgb(248,248,248); padding-left: 10px; padding-right: 8px; font: 9px Verdana, Geneva, Arial, Helvetica, sans-serif; color: silver; padding-top: 3px" class="tools"><strong>[csharp]</strong><span class="Apple-converted-space">&nbsp;</span><a style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); border-bottom: medium none; border-left: medium none; padding-bottom: 1px; text-indent: -2000px; margin: 0px 10px 0px 0px; padding-left: 1px; width: 16px; padding-right: 1px; display: inline-block; background-position: 0% 0%; height: 16px; color: rgb(160,160,160); font-size: 9px; border-top: medium none; border-right: medium none; text-decoration: none; padding-top: 1px" class="ViewSource" title="view plain" onclick="dp.sh.Toolbar.Command('ViewSource',this);return false;" href="http://blog.csdn.net/daiguangda/article/details/7888942#">view plain</a><a style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); border-bottom: medium none; border-left: medium none; padding-bottom: 1px; text-indent: -2000px; margin: 0px 10px 0px 0px; padding-left: 1px; width: 16px; padding-right: 1px; display: inline-block; background-position: 0% 0%; height: 16px; color: rgb(160,160,160); font-size: 9px; border-top: medium none; border-right: medium none; text-decoration: none; padding-top: 1px" class="CopyToClipboard" title="copy" onclick="dp.sh.Toolbar.Command('CopyToClipboard',this);return false;" href="http://blog.csdn.net/daiguangda/article/details/7888942#">copy</a> 
<div style="z-index: 99; position: absolute; width: 18px; height: 18px; top: 1033px; left: 736px"><embed style="-webkit-animation: playerInserted 0.001s" id="ZeroClipboardMovie_1" height="18" name="ZeroClipboardMovie_1" type="application/x-shockwave-flash" align="center" pluginspage="http://www.macromedia.com/go/getflashplayer" width="18" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" allowscriptaccess="always" allowfullscreen="false" flashvars="id=1&amp;width=18&amp;height=18" wmode="transparent"></div></div></div>
<ol style="border-bottom: medium none; border-left: medium none; padding-bottom: 0px; background-color: rgb(255,255,255); list-style-type: decimal; margin: 0px 0px 1px 45px; padding-left: 0px; padding-right: 0px; color: rgb(92,92,92); border-top: medium none; border-right: medium none; padding-top: 0px" class="dp-c"><li style="list-style-position: outside; border-bottom-style: none; border-left: rgb(108,226,108) 3px solid; padding-bottom: 0px !important; line-height: 18px; background-color: rgb(255,255,255); list-style-type: decimal-leading-zero; margin: 0px; padding-left: 10px !important; padding-right: 3px !important; border-top-style: none; color: ; border-right-style: none; padding-top: 0px !important" class="alt"><span style="border-bottom: medium none; border-left: medium none; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; color: black; border-top: medium none; border-right: medium none; padding-top: 0px"><span style="border-bottom: medium none; border-left: medium none; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; color: rgb(0,102,153); border-top: medium none; font-weight: bold; border-right: medium none; padding-top: 0px" class="keyword">else</span><span style="border-bottom: medium none; border-left: medium none; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; color: black; border-top: medium none; border-right: medium none; padding-top: 0px">&nbsp;</span><span style="border-bottom: medium none; border-left: medium none; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; color: rgb(0,102,153); border-top: medium none; font-weight: bold; border-right: medium none; padding-top: 0px" class="keyword">if</span><span style="border-bottom: medium none; border-left: medium none; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; color: black; border-top: medium none; border-right: medium none; padding-top: 0px">(style&nbsp;==&nbsp;Style.BasedOnWidth)&nbsp;&nbsp;</span></span></li><li style="list-style-position: outside; border-bottom-style: none; border-left: rgb(108,226,108) 3px solid; padding-bottom: 0px !important; line-height: 18px; background-color: rgb(248,248,248); list-style-type: decimal-leading-zero; margin: 0px; padding-left: 10px !important; padding-right: 3px !important; border-top-style: none; color: rgb(92,92,92); border-right-style: none; padding-top: 0px !important"><span style="border-bottom: medium none; border-left: medium none; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; color: black; border-top: medium none; border-right: medium none; padding-top: 0px">{&nbsp;&nbsp;</span></li><li style="list-style-position: outside; border-bottom-style: none; border-left: rgb(108,226,108) 3px solid; padding-bottom: 0px !important; line-height: 18px; background-color: rgb(255,255,255); list-style-type: decimal-leading-zero; margin: 0px; padding-left: 10px !important; padding-right: 3px !important; border-top-style: none; color: ; border-right-style: none; padding-top: 0px !important" class="alt"><span style="border-bottom: medium none; border-left: medium none; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; color: black; border-top: medium none; border-right: medium none; padding-top: 0px">&nbsp;&nbsp;&nbsp;&nbsp;localScale.x&nbsp;=&nbsp;relativeSize.x&nbsp;*&nbsp;screenWidth;&nbsp;&nbsp;</span></li><li style="list-style-position: outside; border-bottom-style: none; border-left: rgb(108,226,108) 3px solid; padding-bottom: 0px !important; line-height: 18px; background-color: rgb(248,248,248); list-style-type: decimal-leading-zero; margin: 0px; padding-left: 10px !important; padding-right: 3px !important; border-top-style: none; color: rgb(92,92,92); border-right-style: none; padding-top: 0px !important"><span style="border-bottom: medium none; border-left: medium none; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; color: black; border-top: medium none; border-right: medium none; padding-top: 0px">&nbsp;&nbsp;&nbsp;&nbsp;localScale.y&nbsp;=&nbsp;relativeSize.y&nbsp;*&nbsp;screenWidth;&nbsp;&nbsp;</span></li><li style="list-style-position: outside; border-bottom-style: none; border-left: rgb(108,226,108) 3px solid; padding-bottom: 0px !important; line-height: 18px; background-color: rgb(255,255,255); list-style-type: decimal-leading-zero; margin: 0px; padding-left: 10px !important; padding-right: 3px !important; border-top-style: none; color: ; border-right-style: none; padding-top: 0px !important" class="alt"><span style="border-bottom: medium none; border-left: medium none; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; color: black; border-top: medium none; border-right: medium none; padding-top: 0px">&nbsp;&nbsp;&nbsp;&nbsp;localScale.z&nbsp;=&nbsp;localScale.x;&nbsp;&nbsp;</span></li><li style="list-style-position: outside; border-bottom-style: none; border-left: rgb(108,226,108) 3px solid; padding-bottom: 0px !important; line-height: 18px; background-color: rgb(248,248,248); list-style-type: decimal-leading-zero; margin: 0px; padding-left: 10px !important; padding-right: 3px !important; border-top-style: none; color: rgb(92,92,92); border-right-style: none; padding-top: 0px !important"><span style="border-bottom: medium none; border-left: medium none; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; color: black; border-top: medium none; border-right: medium none; padding-top: 0px">}&nbsp;&nbsp;</span></li></ol></div>
<p style="text-align: left; widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; color: rgb(54,46,43); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"></p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); margin-top: 10px; text-indent: 0px; letter-spacing: normal; font: 13px/17px Arial, Helvetica, FreeSans, sans-serif; white-space: normal; orphans: 2; margin-bottom: 10px; color: rgb(51,51,51); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">这段代码添加在Update方法里面。为了能将UIStretch挂在UIPanel上面不出问题，所有将Z轴也缩放了。</p>
<h2 style="border-bottom: rgb(145,150,153) 1px solid; text-align: left; padding-bottom: 2px; line-height: 26px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; margin: 2em 0px 0.5em; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font-family: Arial, Helvetica, FreeSans, sans-serif; white-space: normal; orphans: 2; color: rgb(54,46,43); font-size: 1.6em; word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><a style="color: rgb(106,57,6); text-decoration: none" name="t2"></a><a style="color: rgb(106,57,6); text-decoration: none" name="%E3%80%90NGUI%E3%80%91%E5%B1%8F%E5%B9%95%E5%88%86%E8%BE%A8%E7%8E%87%E8%87%AA%E9%80%82%E5%BA%94-%E8%87%AA%E9%80%82%E5%BA%94%E6%B5%81%E7%A8%8B"></a>自适应流程</h2>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); margin-top: 10px; text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; margin-bottom: 10px; color: rgb(54,46,43); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-family: Arial, Helvetica, FreeSans, sans-serif; color: rgb(51,51,51); font-size: 12px"><span style="line-height: 17px">1. 创建一个新的UI，将Anchor里面的UIAnchor调整的合适的位置，注意最好将Anchor设置为Bottom。</span></span></p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); margin-top: 10px; text-indent: 0px; letter-spacing: normal; font: 13px/17px Arial, Helvetica, FreeSans, sans-serif; white-space: normal; orphans: 2; margin-bottom: 10px; color: rgb(51,51,51); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">2. 将<span style="white-space: nowrap" class="nobr"><a style="outline-style: none; outline-color: invert; outline-width: medium; color: maroon; text-decoration: none" class="createlink" href="http://enveesoft.dyndns.biz:8082/pages/createpage.action?spaceKey=~daiguangda&amp;encodedTitle=Q2FtZXJh55qEU2l6ZQ==&amp;linkCreation=true&amp;fromPageId=20906019">Camera的Size<sup><img style="border-bottom: medium none; border-left: medium none; max-width: 100%; border-top: medium none; border-right: medium none" class="rendericon" border="0" alt="" align="absMiddle" src="http://enveesoft.dyndns.biz:8082/images/icons/plus.gif" width="7" height="7" /></sup></a></span>调节到默认屏幕大小。比如UI是以960*640分辨率制作的，那么将<span style="white-space: nowrap" class="nobr"><a style="outline-style: none; outline-color: invert; outline-width: medium; color: maroon; text-decoration: none" class="createlink" href="http://enveesoft.dyndns.biz:8082/pages/createpage.action?spaceKey=~daiguangda&amp;encodedTitle=Q2FtZXJh55qEU2l6ZQ==&amp;linkCreation=true&amp;fromPageId=20906019">Camera的Size<sup><img style="border-bottom: medium none; border-left: medium none; max-width: 100%; border-top: medium none; border-right: medium none" class="rendericon" border="0" alt="" align="absMiddle" src="http://enveesoft.dyndns.biz:8082/images/icons/plus.gif" width="7" height="7" /></sup></a></span>调整到960。</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); margin-top: 10px; text-indent: 0px; letter-spacing: normal; font: 13px/17px Arial, Helvetica, FreeSans, sans-serif; white-space: normal; orphans: 2; margin-bottom: 10px; color: rgb(51,51,51); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">3. 在Panel上面添加一个UIStretch，模式选择<span style="white-space: nowrap" class="nobr"><a style="outline-style: none; outline-color: invert; outline-width: medium; color: maroon; text-decoration: none" class="createlink" href="http://enveesoft.dyndns.biz:8082/pages/createpage.action?spaceKey=~daiguangda&amp;title=BasedOnWidth&amp;linkCreation=true&amp;fromPageId=20906019">BasedOnWidth<sup><img style="border-bottom: medium none; border-left: medium none; max-width: 100%; border-top: medium none; border-right: medium none" class="rendericon" border="0" alt="" align="absMiddle" src="http://enveesoft.dyndns.biz:8082/images/icons/plus.gif" width="7" height="7" /></sup></a></span>。完成之后你可以看到你的<span style="white-space: nowrap" class="nobr"><a style="outline-style: none; outline-color: invert; outline-width: medium; color: maroon; text-decoration: none" class="createlink" href="http://enveesoft.dyndns.biz:8082/pages/createpage.action?spaceKey=~daiguangda&amp;encodedTitle=UGFuZWznmoRTY2FsZQ==&amp;linkCreation=true&amp;fromPageId=20906019">Panel的Scale<sup><img style="border-bottom: medium none; border-left: medium none; max-width: 100%; border-top: medium none; border-right: medium none" class="rendericon" border="0" alt="" align="absMiddle" src="http://enveesoft.dyndns.biz:8082/images/icons/plus.gif" width="7" height="7" /></sup></a></span>被修改到了当前屏幕的X方向分辨率大小。</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); margin-top: 10px; text-indent: 0px; letter-spacing: normal; font: 13px/17px Arial, Helvetica, FreeSans, sans-serif; white-space: normal; orphans: 2; margin-bottom: 10px; color: rgb(51,51,51); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">4. 将UI控件添加到Panel上，调整位置，在Panel下的所有控件都会以X方向为标准做等比缩放来适应屏幕大小。</p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); margin-top: 10px; text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; margin-bottom: 10px; color: rgb(54,46,43); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-family: Arial, Helvetica, FreeSans, sans-serif; color: rgb(51,51,51); font-size: 12px"><span style="line-height: 17px">5. 添加一张作为背景的图，将UISprite的anchor设置为Bottom，添加之后你可以看到这个sprite可以在不同的分辨率下自适应了。</span></span></p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); margin-top: 10px; text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; margin-bottom: 10px; color: rgb(54,46,43); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-family: Arial, Helvetica, FreeSans, sans-serif; color: rgb(51,51,51); font-size: 12px"><span style="line-height: 17px">6. 以上一步添加的背景图作为参照物来摆放页面上的控件，这样不仅仅是大小，位置也同样会按照相同的模式进行等比缩放</span></span></p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); margin-top: 10px; text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; margin-bottom: 10px; color: rgb(54,46,43); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-family: Arial, Helvetica, FreeSans, sans-serif; color: rgb(51,51,51); font-size: 12px"><span style="line-height: 17px">7. 可以在第3步创建的Panel下面添加子Panel，子Panel不需要UIStretch（一般用来做Draggable Panel，否则没必要，会增加额外的Draw Call）</span></span></p>
<p style="text-align: left; padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(255,255,255); margin-top: 10px; text-indent: 0px; letter-spacing: normal; font: 14px/26px Arial; white-space: normal; orphans: 2; margin-bottom: 10px; color: rgb(54,46,43); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="font-family: Arial, Helvetica, FreeSans, sans-serif; color: rgb(51,51,51); font-size: 12px"><span style="line-height: 17px">8. 如果某一些控件需要定位在屏幕上下左右中的某一角，可以单独给他添加一个UIAnchor，这个时候UIStretch只会缩放这个控件的大小，它的位置由他自己的UIAnchor控制了</span></span></p><br class="Apple-interchange-newline" /><img src ="http://www.cppblog.com/ming81/aggbug/203746.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2013-10-15 14:15 <a href="http://www.cppblog.com/ming81/archive/2013/10/15/203746.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)NGUI官网示例13 –Character角色装配与储物箱（四）</title><link>http://www.cppblog.com/ming81/archive/2013/10/15/203745.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Tue, 15 Oct 2013 04:59:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2013/10/15/203745.html</guid><description><![CDATA[<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2">选择Shoulders对象，为其添加一个EquipmentSlot（Component-&gt;NGUI-&gt;Example-&gt; EquipmentSlot）,并把shoulders中的各个子对象赋值给该组件对应的变量中，再为其添加音效，最后把场景中Orc对象赋值给Equipment，表示要把装备装配到该物体上，接着在slot中选择shoulders，如图所示</font></div>
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2"><span id="J_att_5794"><span id="td_att_5794" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_072646bc4992770.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_072646bc4992770.png"></span></span></font></div>
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2">为该元件添加一个按键动画，选择Shoulders，并添加一个Button Scale（Component-&gt; NGUI-&gt;Interaction-&gt;Button Scale）,并为该按键添加一个Collider（NGUI-）Attach a collider）如图所示</font></div>
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2"><span id="J_att_5795"><span id="td_att_5795" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_81953d1206fee3d.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_81953d1206fee3d.png"></span></span></font></div>
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2">为其他的Boots和Bracers做相似的操作</font></div>
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2"><span id="J_att_5796"><span id="td_att_5796" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_eaa162c0d26b863.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_eaa162c0d26b863.png"></span></span></font></div>
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2">选择RandomBotton对象，为其添加一个Equip Random Item组件（Component-&gt;NGUI-&gt; Example-&gt;EquipRandomItem）,并把Orc对象赋值给Equipment参数，如图所示</font></div>
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2"><span id="J_att_5797"><span id="td_att_5797" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_3daeacf074b1533.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_3daeacf074b1533.png"></span></span></font></div><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">为该场景的装备创建一个简单的数据库。创建一个空的游戏对象，并命名为ItemDatabase，并为其添加一个ItemDatabase（Component-&gt;NGUI-&gt;example-&gt;Item Database）。如图所示</font> 
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2"><span id="J_att_5798"><span id="td_att_5798" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_ec4c8caf263a437.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_ec4c8caf263a437.png"></span></span></font></div><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">接下来就是不断地重复劳动了，为该数据库添加各种数据。点击New Item，为其添加Item Name，和Item描述，Slot等等，我们以shoulders为例，如图所示</font> 
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2"><span id="J_att_5799"><span id="td_att_5799" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_521b4f86af20ee2.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_521b4f86af20ee2.png"></span></span></font></div>
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2">大家在做这个database数据库的时候，需要思考一下他们这些参数的作用。这里不赘述，还是比较好理解的。</font></div>
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2">接下来，激动人心的时刻到了，点击播放，看，操作一下左边的按钮，看，可以自动装配上去了！如图所示</font></div>
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2"><span id="J_att_5800"><span id="td_att_5800" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_4baccb9f85c6d7c.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_4baccb9f85c6d7c.png"></span></span></font></div><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">大家可能会问，它怎么知道把装备安装到什么地方了呢？好，以Shoulders为例子，选择Orc对象，不断展开它的子对象，找到Bip01 L Clavicle，看下面有一个名为Attachment-Left Shoulder的游戏对象，而且这个游戏对象添加了一个InvAttachmentPoint组件，而且这个组件里面的Slot被设置成Shoulders，也就是说，这个游戏对象就是真正识别需要添加什么装备的地方。如图所示</font> 
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2"><span id="J_att_5801"><span id="td_att_5801" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_d3dc80b5433b27a.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_d3dc80b5433b27a.png"></span></span></font></div><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">接下来，实现装备的描述窗口，当鼠标停放在一个装备图标上面时，它会出现一个装备描述窗口，如图所示</font> 
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2"><span id="J_att_5802"><span id="td_att_5802" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_eb1d8f92852f6c0.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_eb1d8f92852f6c0.png"></span></span></font></div><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">选择我们上面制作好的Tooltip对象，把2D UI Camera对象赋值给它的UI Camera。点击播放，把鼠标放置在装备按钮上，ok，显示出来了！现在来实现装备从左边的图标中移动到右边的储物箱中的制作。创建一个空的游戏对象，并命名为Storage Icon Template，并在其下创建一个SlicedSprite，并命名为background，创建一个Sprite，命名为Icon，如图所示</font> 
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2"><span id="J_att_5803"><span id="td_att_5803" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_80183998fc59a99.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_80183998fc59a99.png"></span></span></font></div><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">为Storage Icon Template添加一个UI Storage Slot组件（Component -&gt; NGUI -&gt; Example -&gt; UI Storage Slot）,并设置参数，接着把该对象的enable勾选掉，如图所示</font> 
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2"><span id="J_att_5804"><span id="td_att_5804" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_47799d9201cce2b.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_47799d9201cce2b.png"></span></span></font></div>
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2">选择Backpack对象，为其添加一个UIItemStorage组件（Component-&gt;NGUI-&gt;Example-&gt; UIItemStorage）并设置其参数，点击播放，如图所示</font></div>
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2"><span id="J_att_5805"><span id="td_att_5805" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_b777608def2ac7d.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_b777608def2ac7d.png"></span></span></font></div>
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2">现在来设置这个储物箱里面为空。选择Storage Icon Template中的Icon，把Sprite组件的enable关闭掉，重新点击播放，ok</font></div>
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2"><span id="J_att_5806"><span id="td_att_5806" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_8b3ed6403422175.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_8b3ed6403422175.png"></span></span></font></div>
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2">接下来，当在左边点击装备图标之后，要可以显示该图标并可以对图标进行拖动，如图所示</font></div>
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2"><span id="J_att_5807"><span id="td_att_5807" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_7dc38e1343b71bd.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_7dc38e1343b71bd.png"></span></span></font></div>
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2"></font></div>
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2">选择Cursor对象，接着把2D UI Camera赋值给该对象下的Cursor组件中的UIＣａｍｅｒａ就ｏｋ了，如图所示</font></div>
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2"><span id="J_att_5808"><span id="td_att_5808" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_3c6b4f6f51634dc.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_3c6b4f6f51634dc.png"></span></span></font></div>
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2">现在来实现最后一步，拖动装备图标之后，放置到储物箱中。选择Storage Icon Template,重新打开其Enable，接着为其添加一个Collider（NGUI-&gt;Attach a collider），接着重新把该对象的Enable关掉，点击播放，ok，全部搞定！</font></div>
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2">如图所示</font></div>
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font size="2"><span id="J_att_5809"><span id="td_att_5809" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_935573729f997c8.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_935573729f997c8.png"></span></span></font></div><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><img src ="http://www.cppblog.com/ming81/aggbug/203745.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2013-10-15 12:59 <a href="http://www.cppblog.com/ming81/archive/2013/10/15/203745.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)NGUI官网示例13 –Character角色装配与储物箱（三）</title><link>http://www.cppblog.com/ming81/archive/2013/10/15/203744.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Tue, 15 Oct 2013 04:58:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2013/10/15/203744.html</guid><description><![CDATA[<font size="2"><font color="#333333"><font face="Tahoma">该部分主要是为实现装备在拖动的时候出现拖动图标的效果和当鼠标放置在装备上时提示装备的一些信息而做准备。<br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">使用UI Tool创建一个Simple 2D UI层级结构，其Layer为2DGUI，我们通过不同的图层的设置让摄像机只显示我们设定的图层中的对象，有点像photoshop中的图层，如图所示</font></font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5788"><span id="td_att_5788" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_3661df8ca9077cf.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_3661df8ca9077cf.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">调整该结构，把Panel和Camera从UIRoot（2D）中分离出来，接着删除UIRoot（2D）和Anchor对象，接着把Camera放置到Panel中成为其子物体。并命名Panel为2D UI，Camera命名为2D UI Camera。最后为2DUI添加一个Root组件（Component-&gt;NGUI-&gt;UI-&gt; Root）如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5789"><span id="td_att_5789" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_66326bdd03e2df1.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_66326bdd03e2df1.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">制作拖动图标的参考对象。在2DUI对象下，创建一个空的游戏对象，并命名为Anchor-Center，并reset一下，接着为该对象添加一个Anchor组件（NGUI-&gt;Attach a anchor）,并把2D UI Camera赋值给该组件下的UI Camera，这样这个Anchor才能找到与这个摄像机对齐， 如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5790"><span id="td_att_5790" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_dea8d385ba1032d.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_dea8d385ba1032d.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">在Anchor-Center下面添加一个空的游戏对象，并命名为Cursor，reset一下。接着为其添加一个Sprite组件（Component-&gt;NGUI-&gt;UI-&gt;Sprite）,接着为其添加一个UICursor组件（Component-&gt;NGUI-&gt;Example-&gt;Cursor），这样NGUI才能够识别出将来的拖动图标是使用了哪个对象，如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5791"><span id="td_att_5791" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_5233c96e4393b97.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_5233c96e4393b97.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">接下来创建装备提示窗口。在Anchor-Center下创建一个空的游戏对象，并命名为Tooltip，reset一下，接着在其下创建一个SliceSprite元件和一个Label元件，并修改这两个元件的Pivot为LeftTop如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5792"><span id="td_att_5792" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_012ea1770ab3bea.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_012ea1770ab3bea.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">接着为ToolTip对象添加一个Tooltip组件（Component-&gt;NGUI-&gt;UI-&gt;UITooltip），接着把刚才我们创建的Table和SlicedSprite赋值给该组件中的Text和Background，该组件可以帮助我们实现动态显示装备说明的功能</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5793"><span id="td_att_5793" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_2a78e93d06cdb16.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_2a78e93d06cdb16.png"></span></span></font><img src ="http://www.cppblog.com/ming81/aggbug/203744.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2013-10-15 12:58 <a href="http://www.cppblog.com/ming81/archive/2013/10/15/203744.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)NGUI官网示例13 –Character角色装配与储物箱（二） </title><link>http://www.cppblog.com/ming81/archive/2013/10/15/203741.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Tue, 15 Oct 2013 04:01:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2013/10/15/203741.html</guid><description><![CDATA[<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="center"><font size="2"><strong>第二步</strong><strong><span class="Apple-converted-space">&nbsp;</span></strong><strong>创建储物箱界面</strong><strong></strong></font></div><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">1. &nbsp; &nbsp; &nbsp; &nbsp; 使用UI Tool创建一个Advanced 3D UI结构，Layer 为GUI（如果没有该GUI层，可以在Layer添加面板中添加），如图所示：<br /><span id="J_att_5779"><span id="td_att_5779" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_8fcb283596c0e00.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_8fcb283596c0e00.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">把Panel和Camera分离出来，接着删除UIRoot（3D）和Anchor对象，并把Camera调整成为Panel的子物体，最后把Panel改名为3DUI，Camera命名为3DUICamera，最后如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5780"><span id="td_att_5780" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_1a640469cd08352.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_1a640469cd08352.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">在3DUI下创建一个空的子物体，并命名为Scale，reset一下，如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5781"><span id="td_att_5781" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_72ee15483c2967f.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_72ee15483c2967f.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">在Scale下创建一个空的游戏对象，并命名为Shoulders，reset一下。接着在其下创建一个Sliced sprite元件，并命名为Background，其Sprite为Flat Outline，并调整其大小和位置，如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5782"><span id="td_att_5782" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_049176cbe1fc667.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_049176cbe1fc667.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">接着，同样在Shoulders下，创建一个Label，并命名为Caption，并为其输入Shoulder字样，并调整它的位置，如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5783"><span id="td_att_5783" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_d29635bf10252e9.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_d29635bf10252e9.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">同样在Shoulders下，创建一个Sprite，sprite为Orc Armor-should，并命名为Icon，并调整它的位置，如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5784"><span id="td_att_5784" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_b96280a38300900.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_b96280a38300900.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">使用同样的方法，创建另外两个图标，分别命名为：Boots，Bracers，并修改其Icon和Caption的图片和文字，最终效果如下</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5785"><span id="td_att_5785" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_3977b1a8fa0a53c.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_3977b1a8fa0a53c.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">选择Scale，在其下创建一个Button元件，并命名为Random Button，并设置其Label文本和背景颜色以及整个按钮大小位置，最终效果如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5786"><span id="td_att_5786" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_6b5857e1b34bfeb.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_6b5857e1b34bfeb.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">在Scale下创建一个空的游戏对象，并命名为Backpack。接着在其下，创建一个Label元件，并把文本设置成Backpack，最后调整Backpack的位置，如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5787"><span id="td_att_5787" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_a79a3f2cbeab097.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_a79a3f2cbeab097.png"></span></span></font><img src ="http://www.cppblog.com/ming81/aggbug/203741.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2013-10-15 12:01 <a href="http://www.cppblog.com/ming81/archive/2013/10/15/203741.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)NGUI官网示例13 –Character角色装配与储物箱（一） </title><link>http://www.cppblog.com/ming81/archive/2013/10/15/203740.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Tue, 15 Oct 2013 03:58:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2013/10/15/203740.html</guid><description><![CDATA[<span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><span style="color: rgb(0,0,0)"><font size="2">物箱和角色装配装配在游戏当中可以实现人物外观的自定义，其用途非常广泛，例如魔兽当中的角色自设定，所以NGUI也提供了这样的功能，如图所示：</font></span></span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><span style="color: rgb(0,0,0)"><font size="2"><span id="J_att_5772"><span id="td_att_5772" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_22ac37204a282ce.png');" border=0 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_22ac37204a282ce.png"></span></span></font></span></span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">我们将分四步来制作该GUI。第一步，创建基本的游戏背景；第二步，创建储物箱界面；第三步，创建装备拖动图标和装备提示栏；第四步，实现装备的装配。<span style="color: rgb(0,0,0)"></span></font> 
<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="center"><strong><font size="2">第一步，创建基本的游戏背景</font></strong><strong></strong></div><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">创建一个空的游戏对象，并命名为Scene，同时reset一下。接着为其添加一个UIPanel组件（Component -&gt; NGUI -&gt; UI -&gt; Panel）。这样，我们就可以在其地下添加各种NGUI元件了。如图所示：<br /><span id="J_att_5773"><span id="td_att_5773" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_07a71d6c481e173.png');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_07a71d6c481e173.png"></span></span>新建一个空的游戏对象，并命名为Pivot，reset一下，并成为Scene的子物体，如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5774"><span id="td_att_5774" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_e5034b0e9046d60.png');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_e5034b0e9046d60.png"></span></span>在Pivot下创建一个摄像机，并为该摄像机添加一个UICamera（Component -&gt; NGUI -&gt; UI -&gt; Camera），该组件主要控制该摄像机能够接受的输入方式，比如鼠标，键盘等等。如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5775"><span id="td_att_5775" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_2ac68236f741070.png');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_2ac68236f741070.png"></span></span>选择Camera，打开Widget Tool对话框，在Camera下创建一个Simple Texture。创建完成之后，在Project窗口中把NGUI -&gt; Materials -&gt; Backrop材质付给其UITexture组件中的Material，并调整其大小和位置，这样背景就做好了，最后效果如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5776"><span id="td_att_5776" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_51a93ab0c6c959b.png');" border=0 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_51a93ab0c6c959b.png"></span></span>在scene下创建一个空的游戏对象，并命名为Orc Pivot，reset一下。在Project中找到Orc 的Prefab（NGUI -&gt; Model -&gt; orc），把它拖到场景中，并成为Orc Pivot的子对象。添加完Orc 的Prefab之后，调整摄像机和角色之间的位置，最终效果如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5777"><span id="td_att_5777" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_ebdba20a751bb35.png');" border=0 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_ebdba20a751bb35.png"></span></span>大家选择Orc对象，可以看到其组件中有EquipItem组件和InvEquipment组件，这两个组件分别用于装备的转配和卸装。如果要向某个对象装配对象时，需要这两个组件。这里这个Orc模型已经为我们添加了这两个组件。</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">接着再Pivot下创建一个Directional Light灯光，照亮场景，这样，我们的角色和背景就添加完成了，如图所示<span id="J_att_5778"><span id="td_att_5778" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_7a4dc0158cd5c97.png');" border=0 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_7a4dc0158cd5c97.png"></span></span></font><img src ="http://www.cppblog.com/ming81/aggbug/203740.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2013-10-15 11:58 <a href="http://www.cppblog.com/ming81/archive/2013/10/15/203740.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)NGUI官网示例12 –Chat Window（聊天对话框，中文输入和显示）</title><link>http://www.cppblog.com/ming81/archive/2013/10/15/203739.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Tue, 15 Oct 2013 03:57:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2013/10/15/203739.html</guid><description><![CDATA[<div style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; word-wrap: break-word; white-space: normal; orphans: 2; color: rgb(51,51,51); word-break: break-all; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" align="left"><font face="宋体 ">聊天对话框是网络游戏中经常会用到的</font><font face="Calibri ">GUI</font><font face="宋体 ">之一，它可以通过用户的键盘输入来获取输入信息并发送到其他的游戏客户端中。当然，聊天对话框的用途还有很多。在</font><font face="Calibri ">NGUI</font><font face="宋体 ">中，也为我们创建聊天对话框提供了方便，如图所示：</font></div><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 "><span id="J_att_5689"><span id="td_att_5689" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_39fcc316b04f8c4.png');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_39fcc316b04f8c4.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 ">首先先床架一个窗口层次结构，这里不再赘述，请看前面的教程。在里面的Label中，我使用了中文的字体为3698Font包<span id="J_att_5699"><span style="font-size: 12px" class="file_insert"><a style="color: rgb(16,92,182); margin-right: 5px !important; text-decoration: none" class="mr5 J_post_attachs" href="http://game.ceeger.com/forum/index.php?c=attach&amp;a=download&amp;aid=5699" data-descrip="" data-hits="217" data-size="949" data-role="attach" data-credit="" data-util="" data-typelang="" data-type="0" data-price="0" data-id="5699"><span class="file_list_wrap"><span style="background-image: url(http://game.ceeger.com/forum/res/images/editor/file_icon.png); width: 18px; display: inline-block; background-position: 0px 0px; height: 18px; vertical-align: -5px; overflow: hidden; margin-right: 0px" class="file_icon_unitypackage"></span></span>3698font.unitypackage</a></span></span>，如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 "><span id="J_att_5690"><span id="td_att_5690" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_b933706596f5f74.png');" border=0 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_b933706596f5f74.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 ">为该窗口创建一个Input元件，该元件用于接收用户的输入，其参数如下</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 "><span id="J_att_5691"><span id="td_att_5691" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_927544df860a904.png');" border=0 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_927544df860a904.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 ">创建一个TextList，用于显示用户输入信息之后显示信息。新建一个空的游戏对象，并命名为TextList，并成为Window的子物体，同时reset一下；一个TextList组件（Component-&gt; NGUI-&gt;UI-&gt;Text List），并设置该组件中的Style属性设置成Chat，如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 "><span id="J_att_5692"><span id="td_att_5692" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_a985e7243929563.png');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_a985e7243929563.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 ">为该TextList对象添加一个Label和一个SlicedSprite，注意SlicedSprite和Label之间的深度关系，Label的深度值应该比SlicedSprite大，如Label为2，那么SlicedSprite为2，如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 "><span id="J_att_5693"><span id="td_att_5693" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_418aa323b24d7c5.png');" border=0 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_418aa323b24d7c5.png"></span></span><br />选择Input对象，为其添加一个Chat Input组件（Component-&gt;NGUI-&gt;Interal-&gt;chat Input），并把TextList对象赋值给TextList属性，如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 "><span id="J_att_5694"><span id="td_att_5694" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_e0e1277a6ee3001.png');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_e0e1277a6ee3001.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 ">点击播放，ok！你在输入框中输入中文和英文都可以正常显示！如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 "><span id="J_att_5695"><span id="td_att_5695" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_931096bfecd7626.png');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_931096bfecd7626.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 ">如果你输入多行，你会发现，其TextList中的文字不会自动往上，现在选择TextList中的Label，然后把其他的Pivot设置成BottomLeft，这样便可以使得随着文字的显示的增加而不断往上升了。如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 "><span id="J_att_5696"><span id="td_att_5696" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_bfbe41e57666391.png');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_bfbe41e57666391.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 ">选择Input对象，并把Fill with Dummy Data选项打开，点击播放，这个时候可以通过这个选项来控制是否显示测试文字，如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 "><span id="J_att_5697"><span id="td_att_5697" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_cade6479dc45d70.png');" border=0 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_cade6479dc45d70.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 ">可以看出文字都跑外面去了，选择TextList，在UITextList组件中，设置其MaxWidth和MaxHeight，这个可以设置其显示文本的最大高度和最大宽度。如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 "><span id="J_att_5698"><span id="td_att_5698" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_e3c6b79723c441e.png');" border=0 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_e3c6b79723c441e.png"></span></span></font><img src ="http://www.cppblog.com/ming81/aggbug/203739.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2013-10-15 11:57 <a href="http://www.cppblog.com/ming81/archive/2013/10/15/203739.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)NGUI官网示例11 –Drag ; Drop（图标与物体拖拽放置）(二)</title><link>http://www.cppblog.com/ming81/archive/2013/10/15/203738.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Tue, 15 Oct 2013 03:56:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2013/10/15/203738.html</guid><description><![CDATA[<font size="2"><font color="#333333"><font face="Tahoma">为ListPanel创建一个空的游戏对象，并命名为DragDropContainer，reset一下，并为它添加一个Collider（NGUI-&gt;Attach a collider），如图所示<br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><span id="J_att_5626"><span id="td_att_5626" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_8641421ac990bd3.png');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_8641421ac990bd3.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">在DragDropContainer对象下创建一个空的游戏对象，并命名为Item0，并为其添加一个Collider（NGUI-&gt;Attach a collider），接着在Item0下创建一个Sprite和一个SlicedSprite，构成了一个图标，并调整它们的大小和位置，如图所示</font></font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5627"><span id="td_att_5627" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_259cd48253f6560.png');" border=0 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_259cd48253f6560.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">选择Item0，使用Ctrl+D复制出三个来，并重新命名为Item1，Item2和Item3，位置没有关系，并把其中的两个Item中的sprite换个图片，如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5628"><span id="td_att_5628" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_b11b9b0bb1fd392.png');" border=0 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_b11b9b0bb1fd392.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">选择WindowPanel，来设置这个Panel的可见范围。把Clipping设置成SoftClip，参数如下</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5629"><span id="td_att_5629" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_267d338270ee5c9.png');" border=0 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_267d338270ee5c9.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">选择DragDropContainer，为其添加一个Table组件（Component-&gt;NGUI-&gt;Interaction-&gt; Table），该组件可以自动排列它的子物体，并调整它的位置，其参数和效果如下</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5630"><span id="td_att_5630" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_15c60a3cbf197f9.png');" border=0 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_15c60a3cbf197f9.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">接下来，选择Item0，为其添加一个DragDropItem（Component-&gt;NGUI-&gt;Example-&gt;Drag atl+DropItem），这个组件可以跟已经保存好的Prefab连接起来，把NGUI中的对应的prefab拖到它的参数中，如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5631"><span id="td_att_5631" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_fed15ea820bdc07.png');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_fed15ea820bdc07.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">1. &nbsp; &nbsp; &nbsp; &nbsp; 对其他的Item进行相似的操作，只是Prefab的参数不同而已。</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">现在，点击播放，拖动Item，结果没有任何效果。来解决这个问题，第一，选择UIRoot（2D）下的Camera，然后把UICamera组件中的EventReceiverMask中的参数设置成2DGUI，这样这个Camera中的消息就只接受这个Layer中的消息；如下图</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5632"><span id="td_att_5632" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_f958a89af389e20.png');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_f958a89af389e20.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">1. &nbsp; &nbsp; &nbsp; &nbsp; 第二，选择DragDropContainer，修改一下里面的BoxCollider中的Center和Size参数，使其覆盖所有的Item，如下图绿色框所示，</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5630"><span id="td_att_5630" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_15c60a3cbf197f9.png');" border=0 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_15c60a3cbf197f9.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">接着，选择Item，会发现，其中的Collider中的Center中的Z值，其值与DragDropContainer中的z值相同，都为0.5，这样可能造成消息指发送给DragDropContainer而Item接收不到鼠标消息，所以，把所有Item中的Collider中的Z值往</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">外移动一些，如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5633"><span id="td_att_5633" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_1befa7b4b0b1411.png');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_1befa7b4b0b1411.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">选择Cube，为其添加一个DragDropSurface组件。</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">现在点击播放，拖动其中的Item，会发现Item在Panel中消失了，然后拖到Cube上，哈，效果达到了。如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5634"><span id="td_att_5634" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_8624c0f94b6f7e6.png');" border=0 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_8624c0f94b6f7e6.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">现在在实现item拖动的效果。在UIRoot（2D）下创建一个空的游戏对象，并命名为Anchor-Center，为其添加一个Anchor（NGUI-&gt;Attach a anchor）,并reset一下，如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5635"><span id="td_att_5635" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_a736011f8f93c91.png');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_a736011f8f93c91.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">选择Anchor-Center，在其下添加一个Panel（NGUI-&gt;Create a panel），并为其添加一个DragDropRoot（Component-&gt;NGUI-&gt;Example-&gt;Drap Drop Root）,请注意UI Root（2D）中的所有对象的Layer都是2DGUI，如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5636"><span id="td_att_5636" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_ac143aa700bb0fd.png');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_ac143aa700bb0fd.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">点击播放，ok，成功！</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5637"><span id="td_att_5637" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_8125929d634e05d.png');" border=0 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_8125929d634e05d.png"></span></span></font><img src ="http://www.cppblog.com/ming81/aggbug/203738.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2013-10-15 11:56 <a href="http://www.cppblog.com/ming81/archive/2013/10/15/203738.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)NGUI官网示例11 –Drag ; Drop（图标与物体拖拽放置）(一) </title><link>http://www.cppblog.com/ming81/archive/2013/10/15/203737.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Tue, 15 Oct 2013 03:55:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2013/10/15/203737.html</guid><description><![CDATA[<span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/25px Tahoma; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">NGUI官网示例11 &#8211;Drag ; Drop（图标与物体拖拽放置）</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/25px Tahoma; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">游戏中经常会用到储物箱等GUI，GUI的一边是物品的图标，另一边是一个角色，你可以拖动这些图标放置到角色上，为它装配装备。那么我们首先来实现较为简单的Drag;Drop功能。如图所示：</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" id="J_att_5611"><span id="td_att_5611" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_2582fcc08df8dc7.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_2582fcc08df8dc7.png"></span></span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/25px Tahoma; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">&nbsp;</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/25px Tahoma; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">首先来制作三维的场景：</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/25px Tahoma; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">1. &nbsp; &nbsp; &nbsp; &nbsp; 使用Create a new UI对话框创建一个Advanced3D UI，如图所示：</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" id="J_att_5612"><span id="td_att_5612" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_524ead846910f1c.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_524ead846910f1c.png"></span></span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/25px Tahoma; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">把Panel拖出来，脱离Anchor父物体，然后改名为3D，接着把Camera作为子物体拖动到Panel下面，reset一下Camera对象，最后删除UI Root（3D）对象和Anchor对象，这里删除UIRoot是因为这个对象只是用于调整GUI大小的，</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/25px Tahoma; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">而我们这个层级只要显示一个立方体和一个背景而已，如图所示</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" id="J_att_5613"><span id="td_att_5613" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_0dc483d3eec7092.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_0dc483d3eec7092.png"></span></span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/25px Tahoma; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">选择Camera，使用WidgetTool对话框在Camera下创建一个SlicedSprite对象，调整其大小和位置，作为其背景，如图所示</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" id="J_att_5614"><span id="td_att_5614" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_ca82aefe7803a01.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_ca82aefe7803a01.png"></span></span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/25px Tahoma; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">创建一个空的游戏对象，并命名为stage，该对象用来使得其子物体能够自动旋转，把该游戏对象放置到3D对象下，成为其子物体，并reset一下，如图所示</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" id="J_att_5615"><span id="td_att_5615" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_25eb6c2605bbcc7.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_25eb6c2605bbcc7.png"></span></span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/25px Tahoma; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">在stage下创建一个Cube，并为该Cube赋予一个brick材质，在project窗中，打开NGUI-&gt; Example-&gt;brick。并调整它的大小，如图所示</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" id="J_att_5616"><span id="td_att_5616" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_ba881203e8c6141.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_ba881203e8c6141.png"></span></span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/25px Tahoma; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">选择stage对象，调整它的位置，如图所示</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" id="J_att_5617"><span id="td_att_5617" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_7b296509004070b.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_7b296509004070b.png"></span></span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/25px Tahoma; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">再次选择stage对象，为它添加一个spin组件（Component-&gt;NUI-&gt;Example-&gt;spin），这个组件可以旋转自身，并设置其参数，点击播放，可以看到立方体旋转起来了。当然这里大家应该知道，子物体会继承父物体的所有变换</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/25px Tahoma; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">（平移、缩放和旋转）。如图所示</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" id="J_att_5618"><span id="td_att_5618" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_2acf8b90b0993b2.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_2acf8b90b0993b2.png"></span></span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/25px Tahoma; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">选择cube对象，为其添加一个SpinWithMouse组件（Component-&gt;NGUI-&gt;Example-&gt;Spin With Mouse）,该组件可以使得物体随着鼠标的拖动而转动，如图所示</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" id="J_att_5619"><span id="td_att_5619" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_7a56e389e926905.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_7a56e389e926905.png"></span></span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/25px Tahoma; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">在3D对象下创建一个Direction Light，这样就把场景照亮了，这样场景就漂亮多了，如图所示</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" id="J_att_5620"><span id="td_att_5620" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_e581a69510840a9.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_e581a69510840a9.png"></span></span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/25px Tahoma; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">接下来，我们来制作GUI部分。使用Create a new UI对话框，创建一个Simple 2D，如图所示</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" id="J_att_5621"><span id="td_att_5621" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_2b6072331fdb6ba.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_2b6072331fdb6ba.png"></span></span><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/25px Tahoma; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">把Anchor对象改名为Anchor Bottom，并设置其side参数为Bottom。如图所示</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" id="J_att_5622"><span id="td_att_5622" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_975a69819adc7ed.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_975a69819adc7ed.png"></span></span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/25px Tahoma; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">选择Panel，改名为Window Panel，使用WidgetTool创建一个SlicedSprite，设置参数，并把该元件改名为background，并调整它的大小和位置，如图所示</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" id="J_att_5623"><span id="td_att_5623" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_0df76a8be98ab4c.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_0df76a8be98ab4c.png"></span></span><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/25px Tahoma; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">现在看到视口中间还有一个正方形，这个东西是我们上面那个3D对象层级的背景，我们选择UIRoot（2D）对象包括其子对象，为其添加一个2DGUI layer（如何添加Layer和Layer的作用在unity文档中有描述，这里不再赘述）。选择UIRoot（2D）中的Camera，设置其Culling Mask为2DGUI，也就是说这个摄像机只显示这个Layer中的对象，其他Layer的对象不会在这个摄像机中显示。最后效果如图所示</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" id="J_att_5624"><span id="td_att_5624" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_3f51ab6135ff2a1.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_3f51ab6135ff2a1.png"></span></span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/25px Tahoma; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">选择WindowPanel，为其添加一个新的Panel（NGUI-&gt;create a Panel），并重新命名为ListPanel，如图所示</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" id="J_att_5625"><span id="td_att_5625" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_b3f5b25ec721400.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_b3f5b25ec721400.png"></span></span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/25px Tahoma; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">为ListPanel创建一个空的游戏对象，并命名为DragDropContainer，reset一下，并为它添加一个Collider（NGUI-&gt;Attach a collider），如图所示</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" id="J_att_5625"><span id="td_att_5625" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_b3f5b25ec721400.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_b3f5b25ec721400.png"></span></span><img src ="http://www.cppblog.com/ming81/aggbug/203737.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2013-10-15 11:55 <a href="http://www.cppblog.com/ming81/archive/2013/10/15/203737.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)NGUI官网示例10 – Localization(本土化)讲解-中英文转换,包括NGUI 常用中文字3698 </title><link>http://www.cppblog.com/ming81/archive/2013/10/15/203736.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Tue, 15 Oct 2013 03:55:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2013/10/15/203736.html</guid><description><![CDATA[<font color="#333333"><font face="Tahoma"><strong><font color="#333333" size="2">随着游戏国际化的发展，很多游戏都会在多个国家发行，那么其中有一个很重要的工作就是游戏的本土化，包括里面的文字，画面，情节等等都要符合该国的语言和文化以及法律等等。那么在NGUI中，我们的本土化最主要的就是语言的显示。那么，在该教程中，我将根据NGUI的官网教程，实现英文和中文的转换（我们要摒弃那个好像是德文的例子，呵呵，那个德国国旗暂时不改了，等说道制作altas再来了解）。<br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><span id="J_att_5581"><span id="td_att_5581" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_ff260f720b51d8c.png');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_ff260f720b51d8c.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /></font><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">首先先制作一个窗口背景，我这里只用简单的窗口来表示，不关注美术方面的问题，我表示这个界面做得有点丑了！在这里有两点要注意，在创建每一个组件的时候，其Font参数为3699Font字库（该字库点击下载<span id="J_att_5590"><span style="font-size: 12px" class="file_insert"><a style="color: rgb(16,92,182); margin-right: 5px !important; text-decoration: none" class="mr5 J_post_attachs" href="http://game.ceeger.com/forum/index.php?c=attach&amp;a=download&amp;aid=5590" data-descrip="" data-hits="453" data-size="949" data-role="attach" data-credit="" data-util="" data-typelang="" data-type="0" data-price="0" data-id="5590"><span class="file_list_wrap"><span style="background-image: url(http://game.ceeger.com/forum/res/images/editor/file_icon.png); width: 18px; display: inline-block; background-position: 0px 0px; height: 18px; vertical-align: -5px; overflow: hidden; margin-right: 0px" class="file_icon_unitypackage"></span></span>3698font.unitypackage</a></span></span>导进Unity中就好了），接着，每一个Label的z轴都要稍微向前平移一些，不然会消失。那个下拉菜单的Option设置成Language，如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5582"><span id="td_att_5582" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_b943f64390acf3b.png');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_b943f64390acf3b.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">1. &nbsp; &nbsp; &nbsp; &nbsp; 接着创建两个txt文件，命名为English.txt和Chinese.txt。我们将从这两个txt文件中获取文字描述。我建议不要用monodevelop编辑器来操作，因为它支持中方字体实在太糟糕，我选用UltraEditor编辑器来做，有人说动用visualStudio，这样有点大材小用了。</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">English.txt文件内容如下:<br />&nbsp;</font><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/25px Tahoma; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><span class="Apple-converted-space">&nbsp;</span>&nbsp; &nbsp;</span> 
<hr style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" />
<br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/25px Tahoma; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">Flag = Flag-US</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">Language = English</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">English = English</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">chinese = 中文</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">Info = Localization example</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">Sound</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">Music</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">Desc = English localization</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">Paragraph = This example shows how to implement localization using NGUI. In order to localize a widget, simply attach [000000]UILocalize[-] script to it. The script will localize the sprite if it's a [000000]UISprite[-], or the text if it's a [000000]UILabel[-]. If you want to localize something else, just implement the [000000]OnLocalize[-] function. Either way, the actual data is defined via text assets specified on the [000000]Localization[-] script which must be present in the scene.</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"></font><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/25px Tahoma; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">&nbsp; &nbsp;</span> 
<hr style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" />
<br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">Chinese.txt内容如下:</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">Flag = Flag-FR</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">Language = 中文</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">English = English</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">Chinese = 中文</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">Info = 本土化示例</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">Sound = 音效</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">Music = 音乐</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">Desc = 中文本土</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">Paragraph = 《老人与海》写的是老渔夫桑地亚哥在海上的捕鱼经历，描写老人制服大鱼后，在返航途中又同鲨鱼进行惊险的搏斗，然而作品中的形象却具有很强的象征意蕴。他用大马哈鱼象征人生的理想和人类作为生命本身所不可避免的所具有的欲望，用鲨鱼象征无法摆脱的悲剧命运，用大海象征变化无常的人类社会，而狮子则为勇武健壮，仇视邪恶，能创造奇迹的象征，桑地亚哥则是人类中的勇于与强大势力搏斗的&#8220;硬汉子&#8221;代表，他那捕鱼的不幸遭遇象征人类总是与厄运不断抗争却无论如何都无法试图去改变命运。</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"></font><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/25px Tahoma; white-space: normal; orphans: 2; float: none; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">&nbsp; &nbsp;</span> 
<hr style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" />
<br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">这两个txt文件先留着。创建一个空游戏对象，命名为Localization，并为其添加一个Localization组件（Component-&gt;NGUI-&gt;Internal-&gt;Localization）。打开该组件，把Starting Language设置成English，Languages中的size设置成2，把english.txt赋值给Element0，把chinese.txt赋值给Element1。如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5583"><span id="td_att_5583" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_9711be9b684b623.png');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_9711be9b684b623.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">为每个Label（除了PopupList中的Label）添加一个Localize组件（Component-&gt;NGUI-&gt;UI-&gt; Localize），打开该组件，可以看到该组件下面有一个参数为Key，这个参数就是用来设置关键字的，也就是在txt中&#8220;=&#8221;号前面的名称。我们把这些label一一中的Key设置成我们需要的关键字（Voice和Music的Label只要添加这个组件，不用为它的Key赋值），例如如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5584"><span id="td_att_5584" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_d9a8185bedb0a86.png');" border=0 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_d9a8185bedb0a86.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">选择PopList，为其添加一个LanguageSelection组件（Component-&gt;NGUI-&gt;Interaction-&gt; Select Language）。现在点击播放试试，可以看到，已经可以在两个字体之间转换了</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5585"><span id="td_att_5585" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_d6d391bca5b2c10.png');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_d6d391bca5b2c10.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">现在只剩下国旗没换了，选择国旗的Sprite，也为其添加一个Localize组件，设置其key为Flag。这些key都和txt文件中的key一一对应的。点击播放，ok，成功。</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">现在剩下最后一个问题，当你选择那个下拉菜单时，文字会消失掉，通过观察发现，下拉菜单在点击之后会新建一个名为Drop-down List的新游戏对象，如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5586"><span id="td_att_5586" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_52b9cff78faf7bb.png');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_52b9cff78faf7bb.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">选择里面的label，会发现，那些label的z轴都在0的数值上，我们前面已经提到，如果要显示中文字体，需要把这些label的位置往外拉出一些，在该例子中将成为负值。我本来想修改下它的源代码，后来发现，只要把窗口的背景往后挪一些就ok了，好，那么我们把这个窗口的背景往后挪1个单位，如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5587"><span id="td_att_5587" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_87b064d31dc385f.png');" border=0 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_87b064d31dc385f.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">Ok，问题解决！<br /><span id="J_att_5588"><span id="td_att_5588" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_21441ceeb54f0d6.png');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_21441ceeb54f0d6.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">还有，我看下拉菜单里面那个chinese太碍眼了，如果那些对英文一窍不通的人，都不知道chinese到底是什么东西，所以，我索性把chinese.txt文件名改成&#8221;中文.txt&#8221;(没双引号的,不要忘了把改完名的txt文件重新复制给Localization中的element1)。哈哈，居然这样也可以，最后效果如下</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5589"><span id="td_att_5589" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_05e667b28b9305e.png');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_05e667b28b9305e.png"></span></span></font></strong></font></font><img src ="http://www.cppblog.com/ming81/aggbug/203736.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2013-10-15 11:55 <a href="http://www.cppblog.com/ming81/archive/2013/10/15/203736.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)NGUI官网示例9 – QuestLog(可展开元件) </title><link>http://www.cppblog.com/ming81/archive/2013/10/15/203735.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Tue, 15 Oct 2013 03:53:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2013/10/15/203735.html</guid><description><![CDATA[<font size="2"><font color="#333333"><font face="Tahoma">这个示例展示的是可伸缩的界面，点击没一个Quest，可以把里面的内容展开。如图所示：<br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><span id="J_att_5564"><span id="td_att_5564" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_14b1d7175bf7b43.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_14b1d7175bf7b43.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">首先先制作出基本的界面，这里就不再赘述（可以参考我上面的系列教程），在这里提一下，在制作背景时，可以使用Create a Widget创建出一个SimpleTexture，贴上合适的材质之后，不要缩放和移动它，为它添加一个Stretch组件（Component-&gt;NGUI-&gt;UI -&gt; Stretch），该组件可以根据窗口的大小自动调整尺寸。注意该层级结构，最终效果如图所示<span id="J_att_5565"><span id="td_att_5565" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_11b924f18302b5b.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_11b924f18302b5b.png"></span></span></font></font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">接下来就是这个示例的重头戏了。选择Quest Log，并为其创建一个新的Panel（NGUI-&gt;Create a panel），并命名为SubPanel，如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5566"><span id="td_att_5566" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_6677a74e62f2a85.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_6677a74e62f2a85.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">选择SubPanel，创建一个空的游戏对象，作为它的子物体，并命名为Table。该对象将来用于排列它的所有子对象的位置，现在暂时不管。如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5567"><span id="td_att_5567" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_988a352a06b1d93.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_988a352a06b1d93.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">选择Table对象，创建一个空的游戏对象，作为它的子物体，并命名为Quest1，reset一下。如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5568"><span id="td_att_5568" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_7acbfa13b018203.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_7acbfa13b018203.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">选择Quest1，为其添加一个Lable和一个SlicedSprite，最终效果如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5569"><span id="td_att_5569" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_c2ae41de2a188d1.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_c2ae41de2a188d1.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">选择Quest1，创建一个空的游戏对象，并命名为Tween，成为它的子对象，reset一下，并在Tween下创建一个Label，并输入文字描述，最终效果如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5570"><span id="td_att_5570" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_45e86e4952c77c5.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_45e86e4952c77c5.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">首先先把Tween对象的Enable关掉，再使用同样的方式再制作出三个这样的Quest出来，我这里偷懒，直接使用Ctrl+D复制出2个来，并命名为Quest2和Quest3。不用去管它的位置，如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5571"><span id="td_att_5571" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_f03d246fa871c81.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_f03d246fa871c81.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">选择Table对象，为其添加一个Table组件（Component-&gt;NGUI-&gt;Interaction-&gt;Table），并设置Colomn参数为1，Direction为Down，Padding的Y为4，Sorted、Hide Inactive和Keep Within Panel勾选上，点击播放之后，其子物体就会自动地排列了，神奇！（大家从英文上应该能看出这些参数的意思吧，这里不赘述了）。如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5572"><span id="td_att_5572" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_76b236214a4ff11.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_76b236214a4ff11.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">接下来实现点击这些Quest时，会自动展开其下面的说明。选择Quest1下面的Tween对象，为其添加一个TweenScale组件（Component-&gt;NGUI-&gt;Tween-&gt;Scale），并设置其参数如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5573"><span id="td_att_5573" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_070f4544d557f55.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_070f4544d557f55.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">选择Quest1下面的SlicedSprite，为其添加一个Trigger组件（NGUI-&gt;Attach a collider）用来接收输入事件，接着为其添加一个Button Tween组件（Component-&gt; NGUI-&gt;Interaction-&gt;Button Tween）这个组件很熟悉吧，对其他的几个Quest进行类似的操作，点击播放，鼠标放在Quest上点击，ok，实现了！其参数如下</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5574"><span id="td_att_5574" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_4e39a0bc6f95d4b.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_4e39a0bc6f95d4b.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">如果你三个Quest同时展开，会发现，此时内容都漏出来了，呵呵，霸气外漏！我们来解决这个问题。选择SubPanel，设置其Panel组件中的Clipping为SoftClip，并设置它的size中x为420，Y为290，softness为X为1，Y为8，然后点击再播放，哈，内容在这个设置的范围内了。如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5575"><span id="td_att_5575" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_7413b401839f3cd.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_7413b401839f3cd.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">问题又来了，我想看下面的内容呢。那么我们可以给他添加一个ScrollBar滚动条。在Quest Log下创建一个垂直ScrollBar元件，我们现在想当内容超出panel时scollBar才显示出来，我们设置其Alpha为0，最后参数如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5576"><span id="td_att_5576" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_bbda7a5203e9d77.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_bbda7a5203e9d77.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2">现在来连接SubPanel和ScrollBar。选择SubPanel，为其添加一个DraggablePanel组件（Component-&gt; NGUI-&gt;Interaction-&gt;DraggablePanel）。然后把ScrollBar对象赋值给VerticalScrollBar，如图所示</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><span id="J_att_5577"><span id="td_att_5577" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_c59082e914cd8bb.png');" border=0 alt=请输入描述 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_c59082e914cd8bb.png"></span></span></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><img src ="http://www.cppblog.com/ming81/aggbug/203735.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2013-10-15 11:53 <a href="http://www.cppblog.com/ming81/archive/2013/10/15/203735.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(搬运工)NGUI官网示例8 – Scroll View(Camera)</title><link>http://www.cppblog.com/ming81/archive/2013/10/15/203734.html</link><dc:creator>点点滴滴</dc:creator><author>点点滴滴</author><pubDate>Tue, 15 Oct 2013 03:52:00 GMT</pubDate><guid>http://www.cppblog.com/ming81/archive/2013/10/15/203734.html</guid><description><![CDATA[<font size="2"><font color="#333333">在上一个示例中的<font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><font face="Calibri ">ScrollView</font></font><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><font face="宋体 ">使用到了</font></font><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><font face="Calibri ">Shader</font></font><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><font face="宋体 ">的处理，而对于一些低端的机器或者移动设备可能会出现显示不正常的结果，所以，</font></font><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><font face="Calibri ">NGUI</font></font><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><font face="宋体 ">还为我们准备了另外一个处理方式，也就是通过摄像机的移动来达到同样的目的。接下来，这个示例就是告诉大家如何实现这个功能。</font></font><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"></font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><font face="宋体 ">首先先制作一个普通的</font></font><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><font face="Calibri ">GUI</font></font><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><font face="宋体 ">界面，这些界面在上面的教程中已经说过，这里就不再赘述，其最终效果如图所示：</font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><font face="宋体 "><span id="J_att_5537"><span id="td_att_5537" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_159845d4187568b.jpg');" border=0 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_159845d4187568b.jpg"></span></span></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><font face="宋体 "></font></font><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><font face="宋体 "><font size="2"></font><font face="宋体 ">现在来制作那些可以滚动的</font><font face="Calibri ">Item</font><font face="宋体 ">结构。使用</font><font face="Calibri ">Create &nbsp;a new UI</font><font face="宋体 ">创建一个</font><font face="Calibri ">NGUI</font><font face="宋体 ">基本结构，并调整它们的层次关系，并把</font><font face="Calibri ">UIRoot</font><font face="宋体 ">下的</font><font face="Calibri ">Panel</font><font face="宋体 ">组件删除掉，最终如图所示：</font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><font face="宋体 "><font face="宋体 "></font><font size="2"><span id="J_att_5538"><span id="td_att_5538" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_28d652f67e1fcbb.jpg');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_28d652f67e1fcbb.jpg"></span></span></font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><font face="宋体 "><font size="2"></font></font></font><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><font size="2"><font face="宋体 ">新建一个新的空游戏对象，并命名为</font><font face="Calibri ">Offset</font><font face="宋体 ">，并放置在</font><font face="Calibri ">anchor</font><font face="宋体 ">成为它的子物体，并</font><font face="Calibri ">reset</font><font face="宋体 ">一下，同时给它添加一个</font><font face="Calibri ">Panel</font><font face="宋体 ">组件（</font><font face="Calibri ">Component-&gt;NGUI-&gt;Interation-&gt; Panel</font><font face="宋体 ">）</font><font face="Calibri ">,</font><font face="宋体 ">这样，该对象才能放置</font><font face="Calibri ">NGUI</font><font face="宋体 ">元件。如图所示</font><font face="Calibri ">:</font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><font size="2"><font face="Calibri "><span id="J_att_5539"><span id="td_att_5539" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_f4787b15798df00.jpg');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_f4787b15798df00.jpg"></span></span></font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><font face="宋体 "><font size="2"></font></font></font><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><font face="Calibri "><font size="2"></font><font face="宋体 ">同</font><font face="Arial ">NGUI</font><font face="宋体 ">官网示例</font><font face="Arial ">7-- ScrollView</font><font face="宋体 ">讲解</font><font face="Arial ">(</font><font face="宋体 ">一</font><font face="Arial ">)<span class="Apple-converted-space">&nbsp;</span></font><font face="宋体 ">（</font><font face="Arial "><a style="color: rgb(16,92,182); text-decoration: none" href="http://game.ceeger.com/forum/read.php?tid=4269" target="_blank">http://game.ceeger.com/forum/read.php?tid=4269</a></font><font face="宋体 ">）</font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><font face="Calibri "><font face="宋体 "></font><font face="宋体 ">一样，创建</font><font face="Calibri ">1</font><font face="宋体 ">个</font><font face="Calibri ">Item</font><font face="宋体 ">元件，然后用</font><font face="Calibri ">Ctrl+D</font><font face="宋体 ">的方法复制出</font><font face="Calibri ">9</font><font face="宋体 ">个来，当然你也可以复制你需要的数量，现在这些</font><font face="Calibri ">Item</font><font face="宋体 ">都是重叠在一起的，最终效果如图所示：</font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><font face="Calibri "><font face="宋体 "><span id="J_att_5540"><span id="td_att_5540" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_f317fae2439ed1e.jpg');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_f317fae2439ed1e.jpg"></span></span></font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><font face="Calibri "><font face="宋体 "></font></font></font><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="Calibri "><font face="宋体 "><font face="宋体 ">选择</font><font face="Calibri ">Offset</font><font face="宋体 ">，为其添加一个</font><font face="Calibri ">Table</font><font face="宋体 ">组件（</font><font face="Calibri ">Component-&gt;NGUI-&gt;Interaction -&gt; Table</font><font face="宋体 ">）。哈，神奇的效果在此出现，只是上一个教程使用</font><font face="Calibri ">Grid</font><font face="宋体 ">组件，这次使用的是</font><font face="Calibri ">Table</font><font face="宋体 ">，这个</font><font face="Calibri ">Table</font><font face="宋体 ">和</font><font face="Calibri ">Grid</font><font face="宋体 ">的不同，可以查下官网的说明。这里不赘述。如图所示：</font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="Calibri "><font face="宋体 "><font face="宋体 "><span id="J_att_5541"><span id="td_att_5541" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_84cf4d06cdb4085.jpg');" border=0 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_84cf4d06cdb4085.jpg"></span></span></font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="Calibri "><font face="宋体 "><font face="宋体 "></font></font><font size="2">&nbsp;<span class="Apple-converted-space">&nbsp;</span></font><font size="2"><font face="宋体 ">选择第一次创建的</font></font><font size="2"><font face="Calibri ">GUI</font></font><font size="2"><font face="宋体 ">结构，选择</font></font><font size="2"><font face="Calibri ">Window</font></font><font size="2"><font face="宋体 ">下的</font></font><font size="2"><font face="Calibri ">TiledSprite</font></font><font size="2"><font face="宋体 ">，如图所示：</font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><font face="Calibri "><font face="宋体 "><span id="J_att_5542"><span id="td_att_5542" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_ea078294801eab5.jpg');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_ea078294801eab5.jpg"></span></span></font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="Calibri "><font face="宋体 "><font face="宋体 ">在下面创建两个空的游戏对象，并分别命名为</font><font face="Calibri ">BottomRight</font><font face="宋体 ">和</font><font face="Calibri ">TopLeft</font><font face="宋体 ">，这两个空对象用来标记滚动</font><font face="Calibri ">Item</font><font face="宋体 ">的边界，并在场景编辑窗口中放置在对应的位置，最后为该</font><font face="Calibri ">TiledSprite</font><font face="宋体 ">添加一个</font><font face="Calibri ">UIDragCamera</font><font face="宋体 ">组件（</font><font face="Calibri ">Component-&gt;NGUI-&gt;Interation -&gt; DragCamera</font><font face="宋体 ">）如图所示:</font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="Calibri "><font face="宋体 "><font face="宋体 "><span id="J_att_5543"><span id="td_att_5543" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_f974b0b64aa2d33.jpg');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_f974b0b64aa2d33.jpg"></span></span></font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 "><font face="宋体 "><font face="宋体 ">选择第二个</font><font face="Calibri ">Camera</font><font face="宋体 ">，为其添加一个</font><font face="Calibri ">ViewCamera</font><font face="宋体 ">组件（</font><font face="Calibri ">Component-&gt;NGUI-&gt;UI-&gt; ViewCamera</font><font face="宋体 ">）</font><font face="Calibri ">,</font><font face="宋体 ">并把第一个摄像机赋值给</font><font face="Calibri ">SourceCamera</font><font face="宋体 ">，把</font><font face="Calibri ">TopLeft</font><font face="宋体 ">对象赋值给</font><font face="Calibri ">Top Left</font><font face="宋体 ">，把</font><font face="Calibri ">BottomRight</font><font face="宋体 ">赋值给</font><font face="Calibri ">Bottom Right</font><font face="宋体 ">，然后选择</font><font face="Calibri ">Offset</font><font face="宋体 ">，调整该对象的位置，如图所示：</font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 "><font face="宋体 "><font face="宋体 "><span id="J_att_5544"><span id="td_att_5544" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_1fdec39911b17fd.jpg');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_1fdec39911b17fd.jpg"></span></span></font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 "><font face="宋体 "><font face="宋体 ">为该摄像机添加一个</font><font face="Calibri ">DraggableCamera</font><font face="宋体 ">组件（</font><font face="Calibri ">Component-&gt;NGUI-&gt;Interaction-&gt; DraggableCamera</font><font face="宋体 ">）</font><font face="Calibri ">,</font><font face="宋体 ">并为其设置参数，如图所示</font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 "><font face="宋体 "><font face="宋体 "><span id="J_att_5545"><span id="td_att_5545" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_5ac485374c285da.jpg');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_5ac485374c285da.jpg"></span></span></font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 "><font face="宋体 "><font face="宋体 ">再次选择刚才添加了两个空对象的择</font><font face="Calibri ">Window</font><font face="宋体 ">下的</font><font face="Calibri ">TiledSprite</font><font face="宋体 ">，把第二个</font><font face="Calibri ">Camera</font><font face="宋体 ">赋值给该元件中的</font><font face="Calibri ">DragCamera</font><font face="宋体 ">组件中的</font><font face="Calibri ">DraggableCamera</font><font face="宋体 ">，其结果如下</font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 "><font face="宋体 "><font face="宋体 "><span id="J_att_5546"><span id="td_att_5546" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_961a707115b6415.jpg');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_961a707115b6415.jpg"></span></span></font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 "><font face="宋体 "><font face="宋体 "></font></font></font><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><font size="2"><font face="宋体 ">接着同样选择该</font></font><font size="2"><font face="Calibri ">TiledSprite</font></font><font size="2"><font face="宋体 ">，为其添加一个</font></font><font size="2"><font face="Calibri ">Collider</font></font><font size="2"><font face="宋体 ">，这样，才能接受输入信息（</font></font><font size="2"><font face="Calibri ">NGUI-&gt; Attach a Collider</font></font><font size="2"><font face="宋体 ">）。哈哈。真好</font></font><font size="2"><font face="Calibri ">Happy</font></font><font size="2"><font face="宋体 ">，看结果，结果一个点击播放，成这样了？！虽然能够接受到输入信息，但是，死活拖不动</font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><font size="2"><font face="宋体 "><span id="J_att_5547"><span id="td_att_5547" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_91796b2eda9941c.jpg');" border=0 src="http://game.ceeger.com/forum/attachment/thumb/Mon_1210/16_7487_91796b2eda9941c.jpg"></span></span></font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><font face="宋体 "><font face="宋体 ">原来，在第二个</font><font face="Calibri ">GUI</font><font face="宋体 ">结构中的</font><font face="Calibri ">Anchor</font><font face="宋体 ">对象中，原来默认组件</font><font face="Calibri ">UIAnchor</font><font face="宋体 ">中的参数</font><font face="Calibri ">UICamera</font><font face="宋体 ">是第二个摄像机，我们现在把它改成第一个摄像机，再点击播放，</font><font face="Calibri ">Well Done</font><font face="宋体 ">！成功了！</font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; font-family: Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" size="2"><font face="宋体 "><font face="宋体 "><span id="J_att_5548"><span id="td_att_5548" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_300ef23d0593678.jpg');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_300ef23d0593678.jpg"></span></span></font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 "><font face="宋体 "><font face="宋体 ">接着给每个</font><font face="Calibri ">Item</font><font face="宋体 ">添加一个</font><font face="Calibri ">DragCamera</font><font face="宋体 ">组件（</font><font face="Calibri ">Component-&gt;NGUI-&gt; Interaction -&gt; DragCamera</font><font face="宋体 ">）和一个</font><font face="Calibri ">Trigger</font><font face="宋体 ">（</font><font face="Calibri ">Ngui-&gt;Attach a Collider</font><font face="宋体 ">）。再为其添加一个</font><font face="Calibri ">ButtonScale</font><font face="宋体 ">组件和一个</font><font face="Calibri ">buttonSound</font><font face="宋体 ">组件（都在</font><font face="Calibri ">Component-&gt;NGUI-&gt;Interaction</font><font face="宋体 ">中）</font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 "><font face="宋体 "><font face="宋体 "><span id="J_att_5549"><span id="td_att_5549" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_e9f746b770df7e7.jpg');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_e9f746b770df7e7.jpg"></span></span></font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 "><font face="宋体 "><font face="宋体 ">最后来实现那个</font><font face="Calibri ">Press me</font><font face="宋体 ">按钮。首先，选择</font><font face="Calibri ">Window</font><font face="宋体 ">对象，为其添加一个</font><font face="Calibri ">TweenPosisiton</font><font face="宋体 ">组件（</font><font face="Calibri ">Component-&gt;Tween-&gt;Position</font><font face="宋体 ">），并关闭它（我们将用按钮来开启它），并设置它的参数，如图所示</font></font></font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/25px Tahoma; white-space: normal; orphans: 2; color: rgb(51,51,51); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" /><font style="line-height: 25px; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; letter-spacing: normal; white-space: normal; orphans: 2; color: rgb(51,51,51); font-size: 14px; font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px" face="宋体 "><font face="宋体 "><font face="宋体 "><span id="J_att_5550"><span id="td_att_5550" class="J_attach_img_wrap single_img"><img style="border-bottom: 0px; border-left: 0px; max-width: 726px; max-height: 700px; vertical-align: top; border-top: 0px; border-right: 0px" onload="if(this.offsetWidth>726 || this.offsetHeight>700){if(this.offsetWidth/726 > this.offsetHeight/700){this.width=726;}else{this.height=700;}}" class=J_post_img title=点击查看原图 onclick="if(this.parentNode.tagName!='A') window.open('http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_f3e2254280fe5b2.jpg');" border=0 src="http://game.ceeger.com/forum/attachment/Mon_1210/16_7487_f3e2254280fe5b2.jpg"></span></span></font></font></font> <img src ="http://www.cppblog.com/ming81/aggbug/203734.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/ming81/" target="_blank">点点滴滴</a> 2013-10-15 11:52 <a href="http://www.cppblog.com/ming81/archive/2013/10/15/203734.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>