资源简介
使用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个文件信息
相关资源
- Unity3D海面效果不错的学习资料
- 基于VHDL的贪吃蛇小游戏
- 游戏策划培训生面试笔试大礼包.rar
- 微信小游戏策划文档
- Unity3D Glow Effect 自发光 颜色溢出效果
- 即时双人联机对战扫雷小游戏
- 基于CortexM4的俄罗斯方块游戏代码加文
- Cocos2D游戏之旅六:流星、烟花、火焰
- Unity3d雨水特效资源包
- Unity3D画笔 涂鸦 签字
- 动作游戏策划设计文档
- 财神到游戏源码
- 推箱子游戏素材 箱子图 背景图 人物
- 游戏策划参考文档-各种系统设计方法
- 打地鼠AppInventor--课堂作业
- 各类游戏答题题库内容,共六万多道
- 安卓贪吃蛇游戏开发源代码及开发文
- Unity3D掷筛子游戏源码
- Unity3d_动态改变按键设置
- Unity3d_项目_足球Game
- Unity 最新T4M地形插件,适用于5.6以上
- VS2010写的连连看
- 基于FPGA的打地鼠游戏248061
- 基于FPGA开发的小游戏
- Cocos2dx游戏源代码《萝莉快跑》
- flash as3连连看游戏源码
- Unity3D小DEMO源码
- LayaAIR 开发格斗游戏
- 推箱子小游戏win32 sdk
- unity3d基础讲解 ppt
评论
共有 条评论