Skip to content

Instantly share code, notes, and snippets.

@liyonghelpme
liyonghelpme / ActorAndCoroutine.cs
Last active September 18, 2015 05:23
c# Actor Coroutine
using System;
using System.Collections.Generic;
using System.Collections;
using System.Threading.Tasks;
using System.Threading;
using System.Threading.Tasks.Dataflow;
using System.Collections.Concurrent;
namespace LuaCoroutine
@liyonghelpme
liyonghelpme / csharpCoroutine.cs
Created August 25, 2015 14:01
csharp实现的嵌套协程
using System;
using System.Collections;
using System.Collections.Generic;
namespace TestIENumerator
{
public class DelayCall {
static List<Coroutine> queue = new List<Coroutine>();
public static void Run() {
var p = queue[0];
@liyonghelpme
liyonghelpme / decodePB.py
Created July 19, 2015 10:12
decode protobuff wireformat
#coding:utf8
#解析protobuf wireformat
#https://developers.google.com/protocol-buffers/docs/encoding
import struct
f = open('server0_5.json').read()
#filenum << type value
#0 varint
@liyonghelpme
liyonghelpme / packItem.py
Created March 19, 2015 01:53
将 ogre 火炬之光 cegui的 九宫格 图片 拼接为一个 大图 给 ngui使用
import PIL
from PIL import Image
import xml
import xml.sax
import xml.sax.handler
import os
imname = ["TopLeft", "TopEdge", "TopRight",
"LeftEdge", "Middle", "RightEdge",
"BottomLeft", "BottomEdge", "BottomRight",
@liyonghelpme
liyonghelpme / cutImageSet.py
Created March 19, 2015 01:51
切割火炬之光 ogre cegui的 图集为单张图片
import PIL
from PIL import Image
import xml
import xml.sax
import xml.sax.handler
import os
#filename = "itemicons5.imageset"
#expName = "export13"
@liyonghelpme
liyonghelpme / ConvertLayoutToJson.py
Created February 25, 2015 23:25
用于将火炬之光 关卡布局 layout中 特定Layout文件导出为json文件, 用于unity中加载使用
#coding:utf8
'''
用于将火炬之光 关卡布局 layout中 特定Layout文件导出为json文件, 用于unity中加载使用
'''
import os
import sys
import json
import re
import codecs
@liyonghelpme
liyonghelpme / ConvertMineDataToJson.py
Created February 25, 2015 23:23
将Mine.dat 文件转化为json文件用于Unity 中使用这些 场景组件的信息
#coding:utf8
'''
生成mine.dat 所有的地图组成块 组件信息转化为 json 文件, 用于unity中加载使用
'''
import json
import re
import codecs
import os
import json
import sys
@liyonghelpme
liyonghelpme / layout_import.py
Last active August 29, 2015 14:16
根据火炬之光的 levelsets中的 dat文件,导出相关场景所需要的所有的场景组件,转化为 fbx文件
#!BPY
'''
从火炬之光 mine.dat 文件中导入 矿洞 所需要的所有的 场景组件
'''
bl_info = {
"name" : "torchlight tileset import",
"author" : "liyonghelpme",
"version" : {1, 0, 0},
"blender": (2, 70, 0),
"location": "File > Import > layout (.dat)",
#!BPY
""" Registration info for Blender menus:
Name: 'OGRE (.mesh.xml)...'
Blender: 236
Group: 'Import'
Tip: 'Import an Ogre-Mesh (.mesh.xml) file.'
"""
'''
@liyonghelpme
liyonghelpme / convertToRss.py
Created February 4, 2015 17:45
将oschina导出的html转化为 rss文件
#coding:utf8
#将oschina导出的html 转化为rss格式
import re, sys, codecs, types
import htmlentitydefs
import urlparse
import HTMLParser
import urllib
rssheader = '''<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" title="XSL Formatting" href="/rss.xsl" media="all" ?>