资源简介
使用unity3D开发的游戏,界面用NGUI开发,能够单机 对战 网络对玩等功能的实现 很好的资源 供初学者学习

代码片段和文件信息
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 ()
{
EditorGUIUtility.LookLikeControls(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 + “‘?“);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-05-23 16:49 wzq2\
文件 8613 2013-05-23 16:37 wzq2\Assembly-CSharp-Editor-vs.csproj
文件 8607 2013-05-23 16:37 wzq2\Assembly-CSharp-Editor.csproj
文件 110163 2013-05-23 16:46 wzq2\Assembly-CSharp-Editor.pidb
文件 14858 2013-05-23 16:37 wzq2\Assembly-CSharp-vs.csproj
文件 14858 2013-05-23 16:37 wzq2\Assembly-CSharp.csproj
文件 360642 2013-05-23 16:46 wzq2\Assembly-CSharp.pidb
文件 5827 2013-05-21 19:49 wzq2\Assembly-Unitysc
文件 11500 2013-05-21 19:43 wzq2\Assembly-Unitysc
文件 5827 2013-05-21 19:49 wzq2\Assembly-Unitysc
目录 0 2013-05-21 20:04 wzq2\Assets\
目录 0 2013-05-14 20:29 wzq2\Assets\NGUI\
目录 0 2013-05-23 16:38 wzq2\Assets\NGUI\Examples\
目录 0 2013-05-14 20:29 wzq2\Assets\NGUI\Examples\Animations\
文件 11216 2013-05-06 09:57 wzq2\Assets\NGUI\Examples\Animations\Button.anim
文件 10240 2013-05-06 09:57 wzq2\Assets\NGUI\Examples\Animations\Checkmark.anim
文件 12904 2013-05-06 09:57 wzq2\Assets\NGUI\Examples\Animations\Logo.anim
文件 11816 2013-05-06 09:57 wzq2\Assets\NGUI\Examples\Animations\Window - Back.anim
文件 11704 2013-05-06 09:57 wzq2\Assets\NGUI\Examples\Animations\Window - Forward.anim
目录 0 2012-08-01 11:07 wzq2\Assets\NGUI\Examples\Atlases\
目录 0 2013-05-14 20:29 wzq2\Assets\NGUI\Examples\Atlases\Fantasy\
文件 3546 2013-05-06 09:57 wzq2\Assets\NGUI\Examples\Atlases\Fantasy\Fantasy Atlas.mat
文件 7597 2013-05-06 09:57 wzq2\Assets\NGUI\Examples\Atlases\Fantasy\Fantasy Atlas.prefab
文件 1192501 2013-05-06 09:57 wzq2\Assets\NGUI\Examples\Atlases\Fantasy\Fantasy Atlas.psd
文件 16006 2013-05-06 09:57 wzq2\Assets\NGUI\Examples\Atlases\Fantasy\Fantasy Font - Normal.prefab
文件 21846 2013-05-06 09:57 wzq2\Assets\NGUI\Examples\Atlases\Fantasy\Fantasy Font - Normal.txt
目录 0 2013-05-14 20:29 wzq2\Assets\NGUI\Examples\Atlases\Refractive\
文件 1654198 2013-05-06 09:57 wzq2\Assets\NGUI\Examples\Atlases\Refractive\Refractive Atlas - Bump.psd
文件 98430 2013-05-06 09:57 wzq2\Assets\NGUI\Examples\Atlases\Refractive\Refractive Atlas - Masks.psd
文件 4117 2013-05-06 09:57 wzq2\Assets\NGUI\Examples\Atlases\Refractive\Refractive Atlas.mat
文件 7696 2013-05-06 09:57 wzq2\Assets\NGUI\Examples\Atlases\Refractive\Refractive Atlas.prefab
............此处省略846个文件信息
相关资源
- flash3.0小游戏
- Scrach 欢乐狙击手.sb2
- linux应用层的华容道游戏源代码
- 小鸡快跑游戏.
- 五子棋C 源代码
- Unity3D登录界面工程
- [易语言]游戏多开例程
- 贪吃蛇游戏设计(汇编语言)
- VC 游戏编程—附源代码
- unity3d反编译工具
- C 纸牌游戏——21点
- 分享 mud 文字游戏 源码
- c 制作的RPG小游戏
- 五子棋游戏实现悔棋功能
- 找不同FLASH游戏源码
- planeGame飞机游戏
- 拼图游戏源代码 powerbuilder 9.0实例
- 解决WPE进不了游戏的最佳方法(闭屏
- linux扫雷游戏代码
- 多线程实例:桌面智能弹球小游戏
- “猜数字”游戏 算法破解
- OpenGL-3D坦克模拟
- 联机版井字棋源码
- 拼图游戏(可自由选择难度)
- 扫雷(MVC架构)
- 解封SHOW 51VV 9158 封机器码类游戏机
-
UnityWebPla
yerFull - scratch穿越迷宫.sb2
- 小鱼捉迷藏Scratch小游戏
- GlowtoolsA-wdf网易游戏wdf查看及解包
评论
共有 条评论