我自己的代码段

记录一下自己工作中写的代码段,可以提高工作效率:
1.Debug.Log()

{
	"Debug.Log(Something)" :{
		"scope": "",
		"prefix": "De",
		"body": [
			"Debug.Log($0);"
		],
		"description": "快速Debug"
	}
}

2.等待协程

{
	"Create IEnumerator" :{
		"scope": "",
		"prefix": "IE",
		"body": [
			"public IEnumerator IE_temp$0(float duration)",
			"{",
			"\tyield return new WaitForSeconds(duration$1);",
			"}",
		] ,
		"description" : "协程快速使用"
	}

}

3.开启协程

{
	"Print to console": {
		"scope": "",
		"prefix": "SC",
		"body": [
			"StartCoroutine($2);",
		],
		"description": "开启协程的快速代码段"
	}
}

4. 协程中yield return null

{
	"yiled return null" :{
		"scope": "",
		"prefix": "yie",
		"body": [
			"yield return null$0;"
		] ,
		"description" : "协程中使用"
	}
}

下面是一些vs上的代码段
代码片段的位置:菜单栏->工具->代码片段管理器。

1.Debug.Log()

<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
	<CodeSnippet Format="1.0.0">
		<Header>
			<Title>DebugLog</Title> 
			<Shortcut>De</Shortcut>   
			<Description>Debug.Log的快速循环的代码片段</Description>
			<Author>yabaozi</Author>
			<SnippetTypes>
				<SnippetType>Expansion</SnippetType>
				<SnippetType>SurroundsWith</SnippetType>
			</SnippetTypes>
		</Header>
		<Snippet>
			<Code Language="csharp">
				<![CDATA[Debug.Log($selected$$end$);]]>
			</Code>
		</Snippet>
	</CodeSnippet>
</CodeSnippets>

2.Debug.LogError()

<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
	<CodeSnippet Format="1.0.0">
		<Header>
			<Title>DebugLogError</Title> 
			<Shortcut>Dee</Shortcut>   
			<Description>Debug.LogError的快速循环的代码片段</Description>
			<Author>yabaozi</Author>
			<SnippetTypes>
				<SnippetType>Expansion</SnippetType>
				<SnippetType>SurroundsWith</SnippetType>
			</SnippetTypes>
		</Header>
		<Snippet>
			<Code Language="csharp">
				<![CDATA[Debug.LogError($selected$$end$);]]>
			</Code>
		</Snippet>
	</CodeSnippet>
</CodeSnippets>


3.Debug.LogWaring()

<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
	<CodeSnippet Format="1.0.0">
		<Header>
			<Title>Debug.LogWarning</Title> 
			<Shortcut>DeW</Shortcut>   
			<Description>Debug.LogWaring的快速循环的代码片段</Description>
			<Author>yabaozi</Author>
			<SnippetTypes>
				<SnippetType>Expansion</SnippetType>
				<SnippetType>SurroundsWith</SnippetType>
			</SnippetTypes>
		</Header>
		<Snippet>
			<Code Language="csharp">
				<![CDATA[Debug.LogWaring($selected$$end$);]]>
			</Code>
		</Snippet>
	</CodeSnippet>
</CodeSnippets>


4.Debug.Assert()

<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
	<CodeSnippet Format="1.0.0">
		<Header>
			<Title>Debug</Title> 
			<Shortcut>DeA</Shortcut>   
			<Description>Debug.Assert的快速循环的代码片段</Description>
			<Author>yabaozi</Author>
			<SnippetTypes>
				<SnippetType>Expansion</SnippetType>
				<SnippetType>SurroundsWith</SnippetType>
			</SnippetTypes>
		</Header>
		<Snippet>
			<Code Language="csharp">
				<![CDATA[Debug.Assert($selected$$end$);]]>
			</Code>
		</Snippet>
	</CodeSnippet>
</CodeSnippets>


5.GetComponent<>()

<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
	<CodeSnippet Format="1.0.0">
		<Header>
			<Title>GetComponent</Title> 
			<Shortcut>Ge</Shortcut>   
			<Description>GetComponent的快速循环的代码片段</Description>
			<Author>yabaozi</Author>
			<SnippetTypes>
				<SnippetType>Expansion</SnippetType>
				<SnippetType>SurroundsWith</SnippetType>
			</SnippetTypes>
		</Header>
		<Snippet>
			<Code Language="csharp">
				<![CDATA[GetComponent<$selected$$end$>();]]>
			</Code>
		</Snippet>
	</CodeSnippet>
</CodeSnippets>

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值