void Start() { sendStr = new ReactiveProperty <string> (); sendStr.Subscribe(_ => _history.PushText(_)); _sendButton.onClick.AddListener(() => { sendStr.Value = _sendText.text; }); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); TextHistory history = target as TextHistory; GUILayout.BeginHorizontal(); sampleText = GUILayout.TextField(sampleText); if (GUILayout.Button("Push")) { if (!string.IsNullOrEmpty(sampleText)) { history.PushText(sampleText); } } GUILayout.EndHorizontal(); if (GUILayout.Button("Clean")) { history.Clear(); } }
public void Init(IObservable <string> obs) { _property = new ReactiveProperty <string> (obs); _property.Subscribe(_ => _history.PushText(_)); }
public void Init(string str) { _property = new StringReactiveProperty(str); _property.Subscribe(_ => _history.PushText(_)); }