Skip to content

Instantly share code, notes, and snippets.

@kyubuns
kyubuns / a.ts
Last active March 28, 2020 08:41
export interface Fuga {
id: string
}
let hoge = {}
hoge['id'] = 'a_text'
hoge['dummy'] = 'dummy_text'
let fuga = (<Fuga>hoge) // エラーになってくれーー頼むーー
class CharacteristicWrapper {
constructor(rawCharacteristic) {
this.rawCharacteristic = rawCharacteristic
this.uuid = rawCharacteristic.uuid.replace(/-/g, "")
this.properties = ["notify"]
}
toBuffer(ab) {
var buf = toio.scanner.Buffer.alloc(ab.byteLength);
var view = new Uint8Array(ab);
@kyubuns
kyubuns / Demo.cs
Created February 21, 2020 16:24
BasicShapeSpriteDemo
using System.Collections.Generic;
using System.Threading.Tasks;
using AnimeTask;
using BasicShapeSprite;
using UnityEditor;
using UnityEngine;
public class Demo : MonoBehaviour
{
[SerializeField] private List<Square> squares = new List<Square>();
@kyubuns
kyubuns / Component.cs
Last active February 3, 2020 16:48
Breakout
using System.Collections.Generic;
using Breakout.Component;
using Component;
using MessagePack;
namespace Component
{
[Union(0, typeof(KTransform))]
[Union(3, typeof(KCubeRenderer))]
[Union(4, typeof(KScale))]
https://github.com/kyubuns/AnimeTask
await UniTask.WhenAll(
// x
new UniTask(
async () =>
{
await Anime.Play(
Easing.Create<Linear>(
startPosition.x,
CompositeResolver.RegisterAndSetAsDefault(new IJsonFormatter[]
{
new IntValueFormatter<Gold>(x => new Gold(x)),
new IDFormatter<StageID>(x => new StageID(x)),
}, new[]
{
StandardResolver.Default,
});
// -----
using System;
using System.IO;
using UnityEditor;
using UnityEngine;
namespace AssetManager.Editor
{
public static class AssetBuilder
{
[MenuItem("Build/AssetBundles")]
struct User {
id int
}
fn show_user_id(user *User) {
println(user.id)
}
fn main() {
user := User{id: 10}
@kyubuns
kyubuns / Hoge.cs
Last active December 26, 2018 11:06
// HorizontalLayoutGroupのめっちゃシンプルで挙動が分かりやすくてスクリプトからサクッと入れれる版。
// SourceというGameObjectを、itemsの数だけ左から右に並べる。
var source = ui.Get<RectTransform>("Source");
var listView = new ListView(new LeftToRightLayouter(), source);
using (var editor = listView.Edit())
{
foreach(var item in items)
{
using System;
using System.Collections.Generic;
using System.Linq;
using Baum2;
using UnityEngine;
using Object = UnityEngine.Object;
namespace Baum2.Util
{
public class ListView