unity制作扫雷exe


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

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    ..A..H.    273408  2018-11-24 13:34  RemoveMine.vsRemoveMinev15.suo

     文件          0  2018-11-15 18:02  RemoveMine.vsRemoveMinev15Serversqlite3db.lock

     文件    1634304  2018-11-18 15:48  RemoveMine.vsRemoveMinev15Serversqlite3storage.ide

     文件      32768  2018-11-15 18:35  RemoveMine.vsRemoveMinev15Serversqlite3storage.ide-shm

     文件    4284832  2018-11-24 13:34  RemoveMine.vsRemoveMinev15Serversqlite3storage.ide-wal

     文件      15578  2017-02-25 01:37  RemoveMineAssetsNGUIEditorPreviewControl - Background.png

    ..A..H.       955  2017-02-25 01:37  RemoveMineAssetsNGUIEditorPreviewControl - Background.png.meta

     文件      18984  2017-02-25 01:37  RemoveMineAssetsNGUIEditorPreviewControl - Colored Button.png

    ..A..H.       955  2017-02-25 01:37  RemoveMineAssetsNGUIEditorPreviewControl - Colored Button.png.meta

     文件      18520  2017-02-25 01:38  RemoveMineAssetsNGUIEditorPreviewControl - Colored Checkbox.png

    ..A..H.       955  2017-02-25 01:38  RemoveMineAssetsNGUIEditorPreviewControl - Colored Checkbox.png.meta

     文件       8328  2017-02-25 01:36  RemoveMineAssetsNGUIEditorPreviewControl - Colored Horizontal Scroll Bar.png

    ..A..H.       955  2017-02-25 01:36  RemoveMineAssetsNGUIEditorPreviewControl - Colored Horizontal Scroll Bar.png.meta

     文件       4875  2017-02-25 01:39  RemoveMineAssetsNGUIEditorPreviewControl - Colored Popup List.png

    ..A..H.       955  2017-02-25 01:39  RemoveMineAssetsNGUIEditorPreviewControl - Colored Popup List.png.meta

     文件      13110  2017-02-25 01:35  RemoveMineAssetsNGUIEditorPreviewControl - Colored Progress Bar.png

    ..A..H.       955  2017-02-25 01:35  RemoveMineAssetsNGUIEditorPreviewControl - Colored Progress Bar.png.meta

     文件       6255  2017-02-25 01:37  RemoveMineAssetsNGUIEditorPreviewControl - Colored Slider.png

    ..A..H.       955  2017-02-25 01:37  RemoveMineAssetsNGUIEditorPreviewControl - Colored Slider.png.meta

     文件       8276  2017-02-25 01:38  RemoveMineAssetsNGUIEditorPreviewControl - Colored Vertical Scroll Bar.png

    ..A..H.       955  2017-02-25 01:38  RemoveMineAssetsNGUIEditorPreviewControl - Colored Vertical Scroll Bar.png.meta

     文件       6007  2017-02-25 01:41  RemoveMineAssetsNGUIEditorPreviewControl - Simple Button.png

    ..A..H.       955  2017-02-25 01:41  RemoveMineAssetsNGUIEditorPreviewControl - Simple Button.png.meta

     文件      16145  2017-02-25 01:42  RemoveMineAssetsNGUIEditorPreviewControl - Simple Checkbox.png

    ..A..H.       955  2017-02-25 01:42  RemoveMineAssetsNGUIEditorPreviewControl - Simple Checkbox.png.meta

     文件       3112  2017-02-25 01:38  RemoveMineAssetsNGUIEditorPreviewControl - Simple Horizontal Scroll Bar.png

    ..A..H.       955  2017-02-25 01:38  RemoveMineAssetsNGUIEditorPreviewControl - Simple Horizontal Scroll Bar.png.meta

     文件       5876  2017-02-25 01:36  RemoveMineAssetsNGUIEditorPreviewControl - Simple Horizontal Slider.png

    ..A..H.       955  2017-02-25 01:36  RemoveMineAssetsNGUIEditorPreviewControl - Simple Horizontal Slider.png.meta

     文件       8570  2017-02-25 01:37  RemoveMineAssetsNGUIEditorPreviewControl - Simple Input Field.png

............此处省略2909个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)