JSBinding / Code Snippets

new a gameobject & overloaded methds

var go1 = new UnityEngine.GameObject.ctor();
var go2 = new UnityEngine.GameObject.ctor$$String("Hello");

add/get c# component

var image = go.AddComponent$1(UnityEngine.UI.Image.ctor);
var image = go.GetComponent$1(UnityEngine.UI.Image.ctor);

add/get javascript component

define a javascript monobehaviour

define_mb("UIController", function () {

    // UnityEngine.Object
    // add this variable to Unity Inspector and drag something to it
    this.oTileRoot = null;

    this.oScore = null;
    this.oBestScore = null;

    // auto called from c#
    this.Start = function () {
    }

    // auto called from c#
    this.Update = function () {
    }
});

use Inspector

static methods & enum

if (UnityEngine.Input.GetKeyDown$$KeyCode(UnityEngine.KeyCode.UpArrow)) {
    inputMgr.emit("move", 0);
    break;
}

properties (get_, set_)

var e = this.animator.get_enabled();
this.animator.set_enabled(!e);var pos = this.trans.get_position();other.trans.set_position(pos);

ref/out

var $cv = { Value: UnityEngine.Vector3.get_zero() };
var newPos = UnityEngine.Vector3.SmoothDamp$$Vector3$$Vector3$$Vector3$$Single(
    this.trans.get_position(),
    this.toPos,
    $cv,
    0.07);

print("new pos: " + $cv.Value);

delegates & properties & overloaded functions

btn.get_onClick().RemoveAllListeners();
btn.get_onClick().AddListener$$UnityAction(function () {
    print("button clicked!");
});
时间: 2024-11-07 16:35:08

JSBinding / Code Snippets的相关文章

Code Snippets

发现SSMS的Tools菜单中有一个Code Snippets Manager,Code Snippets 是预先写好的代码段,只需要在Query Editor 的context 中,右击弹出快捷菜单,然后点击Insert Snippet,就能选择需要的Code Snippets,添加到Query Editor中. Step1,右击,点击 Insert Snippet Step2, 选择需要创建的Object Type Step3,选择Index 这就是 Create Index Basic 的

Code Snippets懒人输入

在做项目开发的过程中,实际上是比较麻烦的,因为相同内容,我们需要书写多次,无形中给我们的开发增加了工作量.那么有什么办法可以避免这样重复的工作量吗?这就是这里要说的Code Snippets Library. 在项目开发中,我们经常可以看到如下所示的代码: @property (nonatomic, copy) NSString *isbatchapprove; @property (nonatomic, copy) NSString *currentResult; @property (non

Xcode-编程技巧-Code Snippets Library

在做项目开发的过程中,实际上是比较麻烦的,因为相同内容,我们需要书写多次,无形中给我们的开发增加了工作量.那么有什么办法可以避免这样重复的工作量吗?这就是这里要说的. 在项目开发中,我们经常可以看到如下所示的代码: @property (nonatomic, copy) NSString *isbatchapprove; @property (nonatomic, copy) NSString *currentResult; @property (nonatomic, copy) NSStrin

Problem and Solution Code Snippets

(积累知识,遇到发展,本文仅用于备忘录,不时它需要召回准备) Problem: 依据String的大小来调整Label的frame.在view中又一次更新views的layout并显示. Solution Code Snippets: -(void)updateData { self.view.layer.cornerRadius=10.0; [HYGlobalFunction setTTLabelText:@"二维码内容test" withParent:self.view withT

Xcode开发技巧—— Code Snippets

[属性说明] 1.Title:Code Snippets的标题: 2.Summary:Code Snippets的描述文字: 3.Platform:可以使用Code Snippets的平台,有IOS/OS X/All三个选项 4.Language:可以在哪些语言中使用该Code Snippets 5.Completion Shortcut:Code Snippets的快捷方式,比如本文第二部分编写switch代码段用到的sw,在这里,把属性设置的快捷方式设为pc 6.Completion Sco

Xcode Code Snippets Library 代码块的创建

我们在做项目开发过程中,因为内容的相同会需要书写很多次同样的代码,那么有什么办法可以避免这些重复的工作量吗,答案是有的,那就是我接下来要介绍的Code Snippets Library 在项目开发中我们会看到如下提示的额代码: @property (nonatomic, copy) NSString *isbatchapprove; @property (nonatomic, copy) NSString *currentResult; @property (nonatomic, copy) N

Useful code snippets with C++ boost

Useful code snippets with C++ boost Is Punctuation It's very straight forward to use boost.regex as a solution. We can match the input string with a regex like if (boost::regex_match(",", boost::regex("[[:punct:]]"))) { std::cout <&

Random Javascript code snippets

MollyPages.org"You were wrong case.To live here is to live." Home Pages / Database / Forms / Servlet / Javadocs / License & Download / Tutorials / Cookbook / Contact Return to Tutorials index Random collection of misc. code and snippets Priv

25+ Useful Selenium Web driver Code Snippets For GUI Testing Automation

本文总结了使用Selenium Web driver 做页面自动化测试的一些 tips, tricks, snippets. 1. Chrome Driver 如何安装 extensions 两种方式 a) Packed (.crx file) --  crx为Chrome的插件后缀名,FireFox的是xpi ChromeOptions options = new ChromeOptions(); options.addExtensions(new File("/path/to/extensi