Skip to content

Instantly share code, notes, and snippets.

public static void Test()
{
SugoiLogger.Log("Battle", "ゲーム開始");
// -> Battle | ゲーム開始
var hp = 20;
var mp = 10;
SugoiLogger.Log("Battle/Status", "今のステータス", (nameof(hp), hp), (nameof(mp), mp));
// -> Battle/Status | 今のステータス | hp = 20, mp = 10
}
using System;
using Cysharp.Threading.Tasks;
using Extensions;
using UnityEngine;
public class MessageTest : MonoBehaviour
{
public void Start() => Test().Forget();
private async UniTask Test()
var hoge = new[] { 1, 2, 3 };
hoge.ToUniTaskAsyncEnumerable().ForEachAwaitAsync(async x =>
{
Debug.Log($"Start hoge = {x}");
await UniTask.Delay(TimeSpan.FromSeconds(1));
Debug.Log($"Finish hoge = {x}");
}).Forget();
// Output
/*
var hoge = new[] { 1, 2, 3 };
Debug.Log($"hoge = {string.Join(", ", hoge)}");
await hoge.ToUniTaskAsyncEnumerable().SelectAwait(async x =>
{
var delay = Random.Range(0.0f, 1.0f);
Debug.Log($"x = {x}, Delay = {delay}");
await UniTask.Delay(TimeSpan.FromSeconds(delay));
return new { Before = x, After = x + 1 };
}).ForEachAwaitAsync(async x =>
{
var hp = new AsyncReactiveProperty<int>(0);
await hp.ForEachAwaitAsync(async x =>
{
Debug.Log($"{Time.frameCount} {Time.time:0.00} DiaplyHP Start hp = {x}");
await UniTask.Delay(TimeSpan.FromSeconds(1));
Debug.Log($"{Time.frameCount} {Time.time:0.00} DiaplyHP Finish hp = {x}");
});
@kyubuns
kyubuns / Sample.cs
Last active May 17, 2020 09:14
prism-theme-gist sample
using System;
namespace Sample
{
class Program
{
static void Main(string[] args)
{
// Hello World
Console.WriteLine("Hello World!");
@kyubuns
kyubuns / prism-theme-github.css
Created April 19, 2020 15:44
prism.js github theme
code,
code[class*='language-'],
pre[class*='language-'] {
color: #24292e;
text-align: left;
white-space: pre;
word-spacing: normal;
tab-size: 4;
hyphens: none;
}
public static class Dummy
{
public static void Run()
{
Debug.Log("Run!");
Observable.Timer(TimeSpan.FromSeconds(1))
.Subscribe(x =>
{
if (Random.Range(0, 2) == 0) Success?.Invoke();
else Failed?.Invoke("エラーメッセージ");
@:generic
class ArrayWrapper<T>
{
public function new() {}
public var value: Array<T> = [];
#if cs
public function toTyped(): List_1<T>
{
class ArrayTest
{
public var hoges: Array<Hoge>;
}
class Hoge
{
public var x: Int;
public var y: Int;
public var z: Int;