Update on Project Valhalla delivered during the Japan Java User's Group Cross Community Conference Spring 2019 Keynote. After a very brief review of Project Valhalla and its goals, we cover nest-based access control (JEP 181, new in JDK 11) and an overview of the currently available value type prototypes (MVT and LW1).
Update on Project Valhalla delivered during the Japan Java User's Group Cross Community Conference Spring 2019 Keynote. After a very brief review of Project Valhalla and its goals, we cover nest-based access control (JEP 181, new in JDK 11) and an overview of the currently available value type prototypes (MVT and LW1).
18. CallBack関数で実装using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
using System;
using System.Threading;
using UniRx.Async;
public class CBUnityEvent: MonoBehaviour
{
[SerializeField]
private Button _button;
private async void Start()
{
var loadedText = await AsyncTextLoad("http://sample.com/sample.txt");
_button.onClick.AddListener(() => {
Debug.Log(loadedText);
});
}
}
19. IObservableで実装using System;
using System.Threading;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
using UniRx;
using UniRx.Async;
public class IObservableUnityEvent : MonoBehaviour
{
[SerializeField]
private Button _button;
private async void Start()
{
loadedText = await AsyncTextLoad(“http://sample.com/sample.txt");
_button.OnClickAsObservable().Subscribe(_ => Debug.Log(loadedText)).AddTo(gameObject);
}
}
buttonのイベントをIObservableに変換
Subscribeを発行してイベントの発行を待つ
呼び出し順番に注意