This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- get identity of game from url. e.g. http://somewhere/game_key -> game_key | |
local identity = string.gsub (ngx.var.uri, "/", "") | |
-- generate pub-sub key from url. | |
IDENTIFIER_CENTRAL = identity .. "_pub" | |
IDENTIFIER_CLIENT = identity .. "_sub" | |
STATE_CONNECT = 1 | |
STATE_MESSAGE = 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- get identity of game from url. e.g. http://somewhere/game_key -> game_key | |
local identity = string.gsub (ngx.var.uri, "/", "") | |
-- generate identity of queue for target context. | |
IDENTIFIER_CONTEXT = identity .. "_context" | |
-- identifier-client = UUID. e.g. AD112CD4-3A23-4E49-B562-E07A360DD836 len is 36. | |
HEADER_STRING = 's' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local gameKey = "test" | |
local identity = string.gsub (ngx.var.uri, "/", "") --replace /wildcard_sample* to wildcard_sample* | |
IDENTIFIER_CENTRAL = identity .. "_pub" | |
IDENTIFIER_CLIENT = identity .. "_sub" | |
STATE_CONNECT = "connect" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Disque client for lua. | |
local sub = string.sub | |
local byte = string.byte | |
local tcp = ngx.socket.tcp | |
local concat = table.concat | |
local null = ngx.null | |
local pairs = pairs | |
local unpack = unpack | |
local setmetatable = setmetatable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[] | |
ゲームとか書けるところ。あとコンテキストの名の通り、データベースに依存せずにパラメータとか持てるぞ。 | |
]] | |
local M = {} | |
function M.onConnect(from, publish) | |
ngx.log(ngx.ERR, "connect from:", from) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityDebug = UnityEngine; | |
using System.IO; | |
using System.Text; | |
using System.Diagnostics; | |
public class LogWriter { | |
private static string targetPath = string.Empty; | |
public static void StartTransLogging (string path) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
/** | |
仮。もっと小さくしたい。 | |
ネームスペースごとに、扱える数が異なる。 | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
example | |
"2014/06/23 3:05:34".TimeAssert(30, "time over!"); | |
*/ | |
using System; | |
using System.Globalization; | |
using UnityEngine; | |
static class Assertions { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static class Assertions { | |
/** | |
assert which extends bool. | |
usage: | |
(0 < transform.position.y).Assert("fall in negative."); | |
*/ | |
public static void Assert (this bool condition, string reason) { | |
if (condition) return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// shader error & warning | |
{ | |
// Shader error in 'Custom/TestShader': Parse error: syntax error at line 9 | |
"Shader error in [']Custom/(.*)[']: (.*) at line ([0-9].*)": { | |
"injects": { | |
"groups[0]": "name", | |
"groups[1]": "message", | |
"groups[2]": "line" | |
}, | |
"selectors": [ |