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.Text; | |
using System.Collections.Generic; | |
using System.Linq; | |
using Microsoft.CodeAnalysis; | |
using Microsoft.CodeAnalysis.CSharp; | |
using Microsoft.CodeAnalysis.CSharp.Syntax; | |
namespace MessagePackIikanzi |
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 UniRx; | |
namespace Development | |
{ | |
public static class MessagePublisherExtensions | |
{ | |
public static void PublishWithBaseType<T>(this IMessagePublisher self, T message) | |
{ | |
self.Publish(message); | |
for (var baseType = typeof(T).BaseType; null != baseType; baseType = baseType.BaseType) |
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.Generic; | |
using System.Linq; | |
using UniRx; | |
namespace Misc | |
{ | |
public class QueueAsyncMessageBroker | |
{ | |
private bool Running; |
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
namespace System.Linq | |
{ | |
public static class LinqExtensions | |
{ | |
public static string ToJoinString<T>(this IEnumerable<T> self) | |
{ | |
return string.Join(", ", self); | |
} | |
} | |
} |
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
Anime.Play(new Vector3(-5f, 0f, 0f), new Vector3(5f, 0f, 0f), Motion.Uniform(4f)) | |
.Wait(TimeSpan.FromSeconds(2.0f)) | |
.Play(new Vector3(10f, 0f, 0f), Motion.Uniform(4f)) | |
.SubscribeToPosition(cube); |
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
private IEnumerator Sample12() | |
{ | |
var hp = new ReactiveProperty<int>(100); | |
var gauge = new ReactiveProperty<float>(100.0f); | |
// HPゲージは、実際の値に1.5秒かけて追いつく | |
hp | |
.Select(x => Anime.Play(gauge.Value, x, Easing.EaseOutSine(TimeSpan.FromSeconds(1.5)))) | |
.Switch() | |
.Subscribe(x => gauge.Value = x); |
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
var x = Anime.Play(1.0f, 0.5f, Easing.EaseInOutSine(TimeSpan.FromSeconds(1f))) | |
.Play(1.0f, Easing.EaseOutElastic(TimeSpan.FromSeconds(0.8f))); | |
var y = Anime.Play(1.0f, 1.2f, Easing.EaseInOutSine(TimeSpan.FromSeconds(1f))) | |
.Play(1.0f, Easing.EaseOutElastic(TimeSpan.FromSeconds(0.8f))); | |
Observable.CombineLatest(x, y) | |
.Select(s => new Vector3(s[0], s[1], 1f)) | |
.SubscribeToLocalScale(sphere); |
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
public class BarAnimation : MonoBehaviour | |
{ | |
[SerializeField] private SpriteRenderer sprite; | |
private readonly Subject<Unit> subject = new Subject<Unit>(); | |
public void Start() | |
{ | |
subject.Select(_ => Anime.Play(new Vector3(1.5f, 1.5f, 1.5f), new Vector3(1f, 1f, 1f), Easing.OutElastic(TimeSpan.FromSeconds(0.5f)))) | |
.Switch() | |
.SubscribeToLocalScale(sprite.transform) |
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; | |
using UnityEngine.SceneManagement; | |
#if UNITY_EDITOR | |
using UnityEditor; | |
#endif | |
public class HotReload : MonoBehaviour | |
{ |
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
class String | |
def snakecase | |
#gsub(/::/, '/'). | |
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). | |
gsub(/([a-z\d])([A-Z])/,'\1_\2'). | |
tr('-', '_'). | |
gsub(/\s/, '_'). | |
gsub(/__+/, '_'). | |
downcase | |
end |