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
-- 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
using System; | |
using System.IO; | |
using System.Collections.Generic; | |
using System.Globalization; | |
namespace XrossPeerUtility { | |
public class XrossPeer { | |
static string logPath = string.Empty; | |
private static Action<string> logAction; |
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 System.Collections.Generic; | |
using System.Linq; | |
using UnityEngine; | |
public class SingletonHolder : MonoBehaviour { | |
private List<Base> instances = new List<Base>(); | |
private static SingletonHolder holderInstance; | |
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] private static void NewSingleton () { |
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 System; | |
using System.Collections; | |
using AutoyaFramework; | |
using UnityEngine; | |
public class ResourcesController | |
{ | |
public static void LoadAsset<T>(string assetPath, Action<string, T> succeeded, Action<string, int, string, object> failed) where T : UnityEngine.Object | |
{ | |
var resRequest = Resources.LoadAsync(assetPath); |
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
#import "UnityAppController.h" | |
@interface OverrideAppDelegate : UnityAppController | |
@end | |
IMPL_APP_CONTROLLER_SUBCLASS(OverrideAppDelegate) | |
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
// TMProのコンポーネント TMPro.TextMeshProUGUI textComponentというのがあったとして | |
textComponent.text = text; | |
// textComponentに対してwidthをセットする必要がある。高さは無限設定でOK | |
textComponent.rectTransform.sizeDelta = new Vector2(viewWidth, float.PositiveInfinity); | |
// このメソッドは、コンポーネントがgameobjectにアタッチされて、かつgameobjectがcanvasに乗っている場合のみ動作する。 | |
var textInfos = textComponent.GetTextInfo(text); |
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
// Text textComponent みたいなものに対して | |
// TextGenerator generator = new TextGenerator(); みたいなのをグローバルで取得しておいて使い回すことができる | |
// invalidate first. | |
generator.Invalidate(); | |
// set content to prefab. | |
var defaultText = textComponent.text; | |
textComponent.text = text; |
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 UnityEditor; | |
using UnityEngine; | |
public class StopAfterCompileProcess | |
{ | |
[UnityEditor.Callbacks.DidReloadScripts] | |
public static void StopAfterCompile() | |
{ | |
if (EditorApplication.isPlaying) | |
{ |
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
[MenuItem("Window/TakeScreenshotWithCaptureScreenshotAsTexture")] | |
public static void Menu() | |
{ | |
var tex = ScreenCapture.CaptureScreenshotAsTexture(); | |
var jpgBytes = tex.EncodeToJPG(10);// 90KB | |
using (var sw = new StreamWriter("a.jpg")) | |
{ | |
sw.BaseStream.Write(jpgBytes, 0, jpgBytes.Length); | |
} | |
} |