Skip to content

Instantly share code, notes, and snippets.

View sujoyu's full-sized avatar

すじょうゆ sujoyu

View GitHub Profile
@sujoyu
sujoyu / EnumLikeJava.cs
Last active October 12, 2022 17:03
C# enum like Java sample.
using System;
public class EnumLikeJava {
public static readonly EnumLikeJava enum1 = new EnumLikeJava("enum1", (s) => s + "foo");
public static readonly EnumLikeJava enum2 = new EnumLikeJava("enum2", (s) => s + "bar");
public static readonly EnumLikeJava enum3 = new EnumLikeJava("enum3", (s) => s + "baz");
public readonly string Field;
public readonly Func<string, string> _method;
@sujoyu
sujoyu / EventManager.cs
Last active August 4, 2016 10:59
A simple weak event pattern by C# for Game.
using System;
using System.Collections.Generic;
using System.Linq;
// Static singleton class.
// There is no necessary to access this class directly.
public class EventManager {
private static Dictionary<GameEvent, List<WeakReference>> listeners =
new Dictionary<GameEvent, List<WeakReference>>();
@sujoyu
sujoyu / Closer.cs
Last active August 3, 2016 04:55
A Simple unity script for modal dialogs on uGUI. When click outside the modal, close it.
using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
using System.Linq;
public class Closer : MonoBehaviour, IPointerClickHandler {
public int ancestorLevel = 0;
public void OnPointerClick(PointerEventData data) {
@sujoyu
sujoyu / balloon-annotation-sample.html
Last active August 29, 2015 14:17
Tooltip(balloon annotation) implemented with only CSS3.
<html>
<head>
<link rel="stylesheet" type="text/css" href="https://gist.githubusercontent.com/sujoyu/d3a187ee3b30a2f2009f/raw/5a1e111f77ae49c8173fc8574738eb9e8c3cd312/balloon-annotation.css">
</head>
<body>
<br />
<div class="balloon-annotation">
annotation legend.
<p class="balloon-annotation-body">annotation body! FOOOOOOOO!!</p>
</div>