Skip to content

Instantly share code, notes, and snippets.

View shinriyo's full-sized avatar

shinriyo shinriyo

View GitHub Profile
@shinriyo
shinriyo / UIActivityIndicatorView.mm
Created February 8, 2013 11:19
iOSのインジゲーターができない Objective−C側
#import <Foundation/Foundation.h>
#ifdef __cplusplus
extern "C" {
#endif
static UIActivityIndicatorView* spinner = nil;
void startSpinner() {
if(spinner == nil) {
spinner = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 100, 80)];
}
@shinriyo
shinriyo / hello.coffee
Last active December 14, 2015 17:39
cocos2d-x用サンプルコードをCoffeeScriptへ置き換えたhello.coffeeです。
try
cc.p = cc.p || (x, y)->
return {x:x, y:y}
cc.c4b = cc.c4 || (r, g, b, o)->
return {r: r, g: g, b: b, a: o}
cc.c3 = cc.c3 || (r, g, b)->
return {r: r, g: g, b: b}
cc.BLACK = cc.c3(0,0,0)
@shinriyo
shinriyo / SceneOverlay.cs
Created May 12, 2013 10:52
keijiroさんの「Unityプロジェクトを複数人で共同開発する方法の一案」のサンプル
using UnityEngine;
using UnityEditor;
using System.Collections;
public class SceneOverlay : EditorWindow
{
[MenuItem ("Window/Scene Overlay")]
static void Init ()
{
@shinriyo
shinriyo / SceneMerger.cs
Last active December 17, 2015 06:09
SceneMergerのソース
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
using System.Collections;
public class SceneMerger : MonoBehaviour
{
public string[] mergeScenes;
private static bool semaphore ;
@shinriyo
shinriyo / SceneSaveHook.cs
Last active October 24, 2018 11:15
シーン保存時に実行される
using UnityEngine;
using UnityEditor;
using System.Collections;
public class SceneSaveHook : AssetModificationProcessor
{
static string[] OnWillSaveAssets (string[] paths)
{
foreach (string path in paths) {
if (path.EndsWith (".unity")) {
using UnityEngine;
using System.Collections;
public class SwipeManager : MonoBehaviour
{
private float startTime;
private Vector2 startPos;
private bool couldBeSwipe;
public float comfortZone;
public float minSwipeDist;
@shinriyo
shinriyo / Ring.cs
Created May 14, 2013 00:30
keijiroさんのサンプルのRing部分のC#化 transformは最適化した
using UnityEngine;
using System.Collections;
public class Ring : MonoBehaviour
{
private Transform _myTransform ;
void Awake ()
{
_myTransform = transform;
@shinriyo
shinriyo / CSRect.cs
Created May 26, 2013 09:29
CSRectにメソッド追加
using UnityEngine;
using System.Collections;
public static class CSRect
{
public static Rect OffsetXRect(this Rect rect, float x)
{
Rect newRect = rect;
newRect.x = rect.x + x;
return newRect;
@shinriyo
shinriyo / SingletonMonoBehaviour.cs
Last active December 19, 2015 01:09
テラシュールウェアさんの
using UnityEngine;
public class SingletonMonoBehaviour<T> : MonoBehaviour where T : MonoBehaviour
{
private static T instance;
public static T Instance {
get {
if (instance == null) {
instance = (T)FindObjectOfType (typeof(T));
using UnityEngine;
public abstract class SingletonMonoBehaviour : MonoBehaviour
{
// name this after the prefab in the Resources folder.
public const string resourceName = "Singletons";
// this will be the object containing all components which are singletons.
static GameObject singletonsObject = null;