Skip to content

Instantly share code, notes, and snippets.

View jareguo's full-sized avatar
:octocat:

Jare Guo jareguo

:octocat:
View GitHub Profile
@jareguo
jareguo / Promise.cs
Last active August 29, 2015 13:57 — forked from cuppster/1.cs
/*
modified from original source: https://bitbucket.org/mattkotsenas/c-promises/overview
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Promises
@jareguo
jareguo / spawn.js
Created October 14, 2015 16:41
spawn a child process in gulp task
gulp.task('compile-cocos2d', function (done) {
console.log('Spawn ant in ' + paths.originCocos2dCompileDir);
var child = Spawn('ant', {
cwd: paths.originCocos2dCompileDir,
stdio: [0, 1, 'pipe']
});
child.on('error', function (err) {
var ANT = Chalk.inverse('ant');
if (err.code === 'ENOENT') {
@jareguo
jareguo / js-perf-tests.md
Last active August 19, 2016 02:02
Javascript Performence Tests
@jareguo
jareguo / Use UnityYAMLMerge in SourceTree.txt
Created December 30, 2015 03:17
Use UnityYAMLMerge in SourceTree
/Applications/Unity/Unity.app/Contents/Tools/UnityYAMLMerge merge -p $(cd $(dirname "$BASE") && pwd)/$(basename "$BASE") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE") $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$MERGED") && pwd)/$(basename "$MERGED")

开始学习的时候为了直观的看效果确实是经常把子节点放在中间,但用来开发的几个项目就不会再以中心点为基点了。

我也算做了10年游戏了,一直都习惯于设置在父节点的中心点。我个人不太理解一个编辑器,创建的子物体默认会跑到父物体的下方这种做法。而且假如我是一个美术/策划,或者将来 Creator 支持 3D 以后,这种子物体一创建就跑到父物体最边上的行为,会更加让人困惑。

假如父节点的大小会动态增加的话。现在的坐标系统就会出问题。

会有什么问题?

假如父节点是超级长的地图话,位置怎么设置

@jareguo
jareguo / add-jsperf-test.js
Last active May 23, 2016 10:32
在 jsperf 里动态加入一个新的测试项目
javascript:(function() {
var tbody = document.querySelector('table#test-table>tbody');
var lastTr = tbody.querySelector('tr:last-child');
var tr = document.createElement('tr');
tbody.appendChild(tr);
tr.innerHTML = lastTr.innerHTML;
var th = tr.querySelector('th');
th.id = 'title-' + tbody.childElementCount;
find . -name "*.js"|xargs cat|wc -l
@jareguo
jareguo / creator-debug-scripts.md
Last active October 19, 2016 10:00
运行时 Creator 调试工具集

在收藏夹中新增一个网页,将网址设为下面的其中一个源码。然后打开任一 Creator 页面,接着直接在收藏夹点击刚刚收藏的网址即可。

打印 Hierarchy

javascript:(function () {
    function visitNode (node, visitor) {
        visitor(node);
        var children = node._children;
        for (var i = 0; i < children.length; ++i) {