資源簡介
是一個完整的unity斗地主項目,很適合新手入門教學,很值
代碼片段和文件信息
using?UnityEngine;
using?UnityEditor;
using?System.Collections.Generic;
///?
///?Inspector?class?used?to?edit?Inventory?Databases.
///?
[CustomEditor(typeof(InvDatabase))]
public?class?InvDatabaseInspector?:?Editor
{
static?int?mIndex?=?0;
bool?mConfirmDelete?=?false;
///?
///?Draw?an?enlarged?sprite?within?the?specified?texture?atlas.
///?
public?Rect?DrawSprite?(Texture2D?tex?Rect?sprite?Material?mat)?{?return?DrawSprite(tex?sprite?mat?true?0);?}
///?
///?Draw?an?enlarged?sprite?within?the?specified?texture?atlas.
///?
public?Rect?DrawSprite?(Texture2D?tex?Rect?sprite?Material?mat?bool?addPadding)
{
return?DrawSprite(tex?sprite?mat?addPadding?0);
}
///?
///?Draw?an?enlarged?sprite?within?the?specified?texture?atlas.
///?
public?Rect?DrawSprite?(Texture2D?tex?Rect?sprite?Material?mat?bool?addPadding?int?maxSize)
{
float?paddingX?=?addPadding???4f?/?tex.width?:?0f;
float?paddingY?=?addPadding???4f?/?tex.height?:?0f;
float?ratio?=?(sprite.height?+?paddingY)?/?(sprite.width?+?paddingX);
ratio?*=?(float)tex.height?/?tex.width;
//?Draw?the?checkered?background
Color?c?=?GUI.color;
Rect?rect?=?NGUIEditorTools.DrawBackground(tex?ratio);
GUI.color?=?c;
if?(maxSize?>?0)
{
float?dim?=?maxSize?/?Mathf.Max(rect.width?rect.height);
rect.width?*=?dim;
rect.height?*=?dim;
}
//?We?only?want?to?draw?into?this?rectangle
if?(Event.current.type?==?EventType.Repaint)
{
if?(mat?==?null)
{
GUI.DrawTextureWithTexCoords(rect?tex?sprite);
}
else
{
//?NOTE:?DrawPreviewTexture?doesn‘t?seem?to?support?BeginGroup-based?clipping
//?when?a?custom?material?is?specified.?It?seems?to?be?a?bug?in?Unity.
//?Passing?‘null‘?for?the?material?or?omitting?the?parameter?clips?as?expected.
UnityEditor.EditorGUI.DrawPreviewTexture(sprite?tex?mat);
//UnityEditor.EditorGUI.DrawPreviewTexture(drawRect?tex);
//GUI.DrawTexture(drawRect?tex);
}
rect?=?new?Rect(sprite.x?+?rect.x?sprite.y?+?rect.y?sprite.width?sprite.height);
}
return?rect;
}
///?
///?Helper?function?that?sets?the?index?to?the?index?of?the?specified?item.
///?
public?static?void?SelectIndex?(InvDatabase?db?InvbaseItem?item)
{
mIndex?=?0;
foreach?(InvbaseItem?i?in?db.items)
{
if?(i?==?item)?break;
++mIndex;
}
}
///?
///?Draw?the?inspector?widget.
///?
public?override?void?OnInspectorGUI?()
{
NGUIEditorTools.SetLabelWidth(80f);
InvDatabase?db?=?target?as?InvDatabase;
NGUIEditorTools.DrawSeparator();
InvbaseItem?item?=?null;
if?(db.items?==?null?||?db.items.Count?==?0)
{
mIndex?=?0;
}
else
{
mIndex?=?Mathf.Clamp(mIndex?0?db.items.Count?-?1);
item?=?db.items[mIndex];
}
if?(mConfirmDelete)
{
//?Show?the?confirmation?dialog
GUILayout.Label(“Are?you?sure?you?want?to?delete?‘“?+?item.name?+?“‘?“);
NGUI
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????85450??2016-06-01?10:04??斗地主源碼(2017-11-15)\StartDouDiZhu\.vs\config\applicationhost.config
????..A..H.????140288??2018-03-09?21:35??斗地主源碼(2017-11-15)\StartDouDiZhu\.vs\StartDouDiZhu-csharp\v14\.suo
?????文件??????12860??2017-11-10?10:31??斗地主源碼(2017-11-15)\StartDouDiZhu\Assembly-CSharp-Editor-vs.csproj
?????文件??????12854??2017-11-10?10:31??斗地主源碼(2017-11-15)\StartDouDiZhu\Assembly-CSharp-Editor.csproj
?????文件??????17061??2018-03-08?17:21??斗地主源碼(2017-11-15)\StartDouDiZhu\Assembly-CSharp-vs.csproj
?????文件??????17061??2017-11-10?14:44??斗地主源碼(2017-11-15)\StartDouDiZhu\Assembly-CSharp.csproj
?????文件???????4192??2017-11-10?10:27??斗地主源碼(2017-11-15)\StartDouDiZhu\Assets\Altas\Poker.mat
????..A..H.????????95??2017-11-10?10:27??斗地主源碼(2017-11-15)\StartDouDiZhu\Assets\Altas\Poker.mat.me
?????文件?????492827??2017-11-10?10:27??斗地主源碼(2017-11-15)\StartDouDiZhu\Assets\Altas\Poker.png
????..A..H.???????977??2017-11-10?10:27??斗地主源碼(2017-11-15)\StartDouDiZhu\Assets\Altas\Poker.png.me
?????文件??????11336??2017-11-10?10:35??斗地主源碼(2017-11-15)\StartDouDiZhu\Assets\Altas\Poker.prefab
????..A..H.????????95??2017-11-10?10:27??斗地主源碼(2017-11-15)\StartDouDiZhu\Assets\Altas\Poker.prefab.me
????..A..H.???????107??2017-11-10?10:18??斗地主源碼(2017-11-15)\StartDouDiZhu\Assets\Altas.me
?????文件????????326??2018-03-08?20:52??斗地主源碼(2017-11-15)\StartDouDiZhu\Assets\data.json
????..A..H.????????93??2017-11-13?09:45??斗地主源碼(2017-11-15)\StartDouDiZhu\Assets\data.json.me
?????文件???18209004??2015-07-10?19:00??斗地主源碼(2017-11-15)\StartDouDiZhu\Assets\Fonts\SIMSUN.TTC
????..A..H.????????90??2017-11-10?20:25??斗地主源碼(2017-11-15)\StartDouDiZhu\Assets\Fonts\SIMSUN.TTC.me
?????文件????1848672??2017-11-09?09:04??斗地主源碼(2017-11-15)\StartDouDiZhu\Assets\Fonts\ygyxsziti2.0.ttf
????..A..H.???????301??2017-11-10?10:25??斗地主源碼(2017-11-15)\StartDouDiZhu\Assets\Fonts\ygyxsziti2.0.ttf.me
????..A..H.???????107??2017-11-10?10:18??斗地主源碼(2017-11-15)\StartDouDiZhu\Assets\Fonts.me
?????文件??????38460??2018-03-09?21:35??斗地主源碼(2017-11-15)\StartDouDiZhu\Assets\MainScene.unity
????..A..H.????????90??2017-11-10?10:35??斗地主源碼(2017-11-15)\StartDouDiZhu\Assets\MainScene.unity.me
?????文件?????522240??2014-07-14?07:05??斗地主源碼(2017-11-15)\StartDouDiZhu\Assets\NGUI\Editor\FreeType.dll
????..A..H.????????90??2017-11-10?10:20??斗地主源碼(2017-11-15)\StartDouDiZhu\Assets\NGUI\Editor\FreeType.dll.me
?????文件????1089968??2014-07-14?07:05??斗地主源碼(2017-11-15)\StartDouDiZhu\Assets\NGUI\Editor\FreeType.dylib
????..A..H.????????90??2017-11-10?10:20??斗地主源碼(2017-11-15)\StartDouDiZhu\Assets\NGUI\Editor\FreeType.dylib.me
?????文件??????15578??2014-07-14?07:06??斗地主源碼(2017-11-15)\StartDouDiZhu\Assets\NGUI\Editor\Preview\Control?-?Background.png
????..A..H.???????981??2017-11-10?10:20??斗地主源碼(2017-11-15)\StartDouDiZhu\Assets\NGUI\Editor\Preview\Control?-?Background.png.me
?????文件??????18984??2014-07-14?07:06??斗地主源碼(2017-11-15)\StartDouDiZhu\Assets\NGUI\Editor\Preview\Control?-?Colored?Button.png
????..A..H.???????981??2017-11-10?10:20??斗地主源碼(2017-11-15)\StartDouDiZhu\Assets\NGUI\Editor\Preview\Control?-?Colored?Button.png.me
............此處省略1740個文件信息
- 上一篇:普中單片機開發工具.rar
- 下一篇:廣聯達深思全國 全行業寫鎖及授權.rar
評論
共有 條評論