名字和符号
说 明
货币
C、c
使用货币符号把值格式化为货币,货币符号取决于所在PC的区域设置
精度说明符:小数位数
示例:Console.WriteLine("{0:C}",12.5);
输出:$12.50
十进制数
D、d
……继续阅读 »
sharezer
11年前 (2016-06-14) 2382浏览 0评论
1个赞
//转载地址:http://lizhiwei.me/?p=85
static public float soundVolume
//该属性是全局音效播放音量,按照文档说是用于NGUITools.PlaySound(),那也就意味着我的游戏如果用NGUITools.PlaySound()管理游戏中的音效,同时也可以用于产品音效控制。
static public bool fileAccess
//该属性用于检测是否可以访问用户磁盘
static public AudioSource PlaySound (AudioClip clip)
static public AudioSource……继续阅读 »
sharezer
11年前 (2016-06-13) 3051浏览 0评论
0个赞
接口 (interface) 定义了一个可由类和结构实现的协定。接口可以包含方法、属性、事件和索引器。接口
不提供它所定义的成员的实现 — 它仅指定实现该接口的类或结构必须提供的成员。
接口可支持多重继承。在下面的示例中,接口 IComboBox 同时从 ITextBox 和 IListBox 继承。
interface IControl
{
void Paint();
}
interface ITextBox: IControl
{
void SetText(string……继续阅读 »
sharezer
11年前 (2016-06-13) 2501浏览 0评论
0个赞
C# 中的类型有两种:值类型 (value type) 和引用类型 (reference type)。值类型的变量直接包含它们的数据,而引用类型的变量存储对它们的数据的引用,后者称为对象。对于引用类型,两个变量可能引用同一个对象,因此对一个变量的操作可能影响另一个变量所引用的对象。对于值类型,每个变量都有它们自己的数据副本(除 ref 和 out 参数变量外),因此对一个变量的操作不可能影响另一个变量。
C# 的值类型进一步划分为简单类型 (simple type)、枚举类型 (enum type)、结构类型 (struct type) 和可以为 null 的类型 (nullable ty……继续阅读 »
sharezer
11年前 (2016-06-12) 2942浏览 0评论
0个赞
一、质点的运动(1)——直线运动
……继续阅读 »
sharezer
11年前 (2016-06-07) 2620浏览 0评论
0个赞
AddComponentMenu
添加组件菜单(可以在UnityEditor的Component的Menu中增加自定义的项目)
[AddComponentMenu("Transform/Follow Transform")]
AssemblyIsEditorAssembly
汇编级属性,使用该属性的Class会被认为是EditorClass
ColorUsageAttribute
用于配置颜色和颜色选择
ContextMenu
可以在Inspector的ContextMenu中增加选项
[ContextMenu……继续阅读 »
sharezer
11年前 (2016-06-03) 2957浏览 0评论
0个赞
指定可以对它们应用特性的应用程序元素
成员名称
说明
All
可以对任何应用程序元素应用属性。
Assembly
可以对程序集应用属性。
Class
可以对类应用属性。
Constructor
可以对构造函数应用属性。
Delegate
……继续阅读 »
sharezer
11年前 (2016-05-27) 2365浏览 0评论
0个赞
为了从资源上优化安装包的大小,写了一个工具
点击查找,列出所以文件,并按从大到小的顺序排序
先上一下效果图
/// <summary>
/// 定义文件结构体
/// </summary>
public struct FileAttribute
{
public string path; //路径
public long size; /……继续阅读 »
sharezer
11年前 (2016-05-27) 3359浏览 0评论
0个赞
public static bool IsEnableTouchLayer(Camera cameraSeeTheLayer, string layer)
{
bool r = false;
string strLayer = "";
Vector3 posMouse = Input.mousePosition;
posMouse.z = 10;
Ray ray = cameraSee……继续阅读 »
sharezer
11年前 (2016-05-06) 2610浏览 0评论
0个赞
public static string timeStampToString(int time)
{
long ltime = (long )time;
DateTime t = new DateTime(time * TimeSpan.TicksPerSecond);
t = t. ToLocalTime();
int year = t.Year + 1969 ;
string syear = "" + year;
int month = t.Month ;
string smonth = month < 10……继续阅读 »
sharezer
11年前 (2016-04-27) 2681浏览 0评论
0个赞