最近因为学习Laya的原因,重新接触了一下JS
在写状态机的时间突然有一个想法
当我从状态机得到一个样的状态,把他转换方法名,通过得到的方法名,能不能直接调用方法
比方说,当前的状态为TestState,判断TestState()是否存在,如果存在则执行this.TestState()
方法一
通过hasOwnProprety判断
var funcName = "TestFunc";
if (GameManager.prototype.hasOwnProperty(funcName))
{
&nb……继续阅读 »
sharezer
8年前 (2016-09-13) 2995浏览 0评论
3个赞
有两个类NodeGraph和StateNode,继承于ScriptableObject
现在将一个NodeGraph实例保存到Assets中
AssetDatabase.CreateAsset(curGraph, "Assets/Database/" + wantedName + ".asset");
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
然后再生成一些StateNode的实例,插到这个NodeGraph的实例中
curNode.name……继续阅读 »
sharezer
8年前 (2016-09-06) 11494浏览 0评论
0个赞
正在序列化一下List的默认样式如下:
public class TestScript : MonoBehaviour
{
public List<string> TestList = new List<string>();
void Start ()
{
}
void Update ()
{
}
}
手动控制大小,不方便排序与删除
UnityEditorInternal有ReorderableList这个类,可以用于列表的排序
新建一个自定义扩展脚本
……继续阅读 »
sharezer
8年前 (2016-08-29) 5498浏览 0评论
6个赞
namespace TeseApplication
{
class Program
{
static void Main(string[] args)
{
MyClass2 my = new MyClass2(3, 4);
Console.ReadLine();
}
}
public class MyClass
{
public MyClass()
{
Console.WriteLine(&qu……继续阅读 »
sharezer
8年前 (2016-08-24) 2381浏览 0评论
0个赞
1、访问修饰符
public : 同一程序集的其他任何代码或引用该程序集的其他程序集都可以访问该类型或成员。
internal : 同一程序集中的任何代码都可以访问该类型或成员,但其他程序集不可以访问。
private : 同一类和结构的代码可以访问该类型和成员。
protected : 同一类和派生(继承特性)类中的代码可以访问该类型和成员。
protected internal : 同一程序集中的任何代码或其他程序集中的任何派生类都可以访问该类型或成员。
2、默认修饰符
……继续阅读 »
sharezer
8年前 (2016-08-24) 2306浏览 0评论
0个赞
//返回一个空白可用1x1白色纹理
static public Texture2D blankTexture
//返回一个可用的纹理,看起来像一个黑色的检查板
static public Texture2D backdropTexture
//返回一个可用的纹理,看起来像一个高对比度检查板
static public Texture2D contrastTexture
//用于标题栏/标题的梯度纹理
static public Texture2D gradientTexture
//创建一个白色的虚拟纹理
static Texture2D CreateDummyTex ()
//创建……继续阅读 »
sharezer
8年前 (2016-08-22) 2994浏览 0评论
0个赞
1、访问https://www.sslforfree.com/
2、输入申请的域名,点击Create Free SSL Certificate
3、点击Manual Verification 手动验证
4、按照步骤验证所有权
5、生成SSL证书
6、创建帐号和密码,90到到期后会通知
7、下载证书(得到三个文件Privacy Key、CA_bundle.crt 和 certificate.crt)
……继续阅读 »
sharezer
8年前 (2016-08-17) 2394浏览 0评论
0个赞
string str = "这是中文";
string msg = Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(str));
msg = System.Text.RegularExpressions.Regex.Unescape(msg);
……继续阅读 »
sharezer
8年前 (2016-08-11) 2953浏览 0评论
0个赞
1、备注的格式要规范
规范备注可以使用快捷键(输入三个///,回车)自动生成
2、输出到xml文件
3、使用
使用时把dll与生成的xml拷贝到相同目录
……继续阅读 »
sharezer
8年前 (2016-08-08) 2327浏览 0评论
0个赞
/// <summary>
/// 判断输入的字符串是否全是英文(不区分大小写)
/// </summary>
/// <param name="objString">所要匹配的字符串</param>
/// <returns>返回真假值,true:匹配;false:不匹配</returns>
public static bool isEnglishString(String objString)
{
Regex myReg = new Regex(@"^[a-zA-Z]+$"……继续阅读 »
sharezer
8年前 (2016-08-05) 2282浏览 0评论
0个赞