public ReactiveDictionaryEditorPopupWindow(IElementEditor parent, ReactiveDictionary <T, U> rd) { this.parent = parent; this.rd = rd; PK = default(T); PV = default(U); }
public void ExecuteUnequip(int bodySlotIndex) { _unitSlotCompoundIndex = _unitController.SelectedUnit.BodySlots[bodySlotIndex]._CompoundIndex; _lifeCompounds = _planetController.SelectedPlanet.Life.Compounds; Unequip(); }
public override void Initialize() { RP_LabelTextNum = new ReactiveProperty <int> (); Numbers = new ReactiveCollection <int> (); MyDictionary = new ReactiveDictionary <string, string> (); RC_DefaultCommand = new ReactiveCommand(); RP_MyNewProperty = new ReactiveProperty <object> (); DefaultCollection = new ReactiveCollection <object> (); RP_DefaultProperty = new ReactiveProperty <object> (); RC_AddNum = new ReactiveCommand <AddNumCommand> (); RP_CurrentVector2 = new ReactiveProperty <UnityEngine.Vector2> (); RP_CurrentVector3 = new ReactiveProperty <UnityEngine.Vector3> (); RP_CurrentVector4 = new ReactiveProperty <UnityEngine.Vector4> (); RP_CurrentQuaternion = new ReactiveProperty <UnityEngine.Quaternion> (); RP_CurrentRect = new ReactiveProperty <UnityEngine.Rect> (); RP_CurrentBounds = new ReactiveProperty <UnityEngine.Bounds> (); RP_CurrentColor = new ReactiveProperty <UnityEngine.Color> (); RP_CurrentAC = new ReactiveProperty <UnityEngine.AnimationCurve> (); RP_CurrentDateTime = new ReactiveProperty <DateTime> (); RP_CurrentTimeSpan = new ReactiveProperty <TimeSpan> (); RP_CurrentJObject = new ReactiveProperty <JObject> (); RP_CurrentJArray = new ReactiveProperty <JArray> (); V3List = new ReactiveCollection <UnityEngine.Vector3> (); RectList = new ReactiveCollection <UnityEngine.Rect> (); RP_MyEA = new ReactiveProperty <EA> (); RP_SCA_a = new ReactiveProperty <SCA> (); RP_MyBooleanValue = new ReactiveProperty <bool> (); base.Initialize(); }
public override void Initialize() { RP_DefaultProperty1 = new ReactiveProperty <string> (); RP_DefaultProperty2 = new ReactiveProperty <string> (); RP_DefaultProperty3 = new ReactiveProperty <int> (); RP_DefaultProperty4 = new ReactiveProperty <float> (); DefaultCollection1 = new ReactiveCollection <string> (); DefaultCollection2 = new ReactiveCollection <int> (); DefaultDictionary1 = new ReactiveDictionary <string, string> (); DefaultDictionary2 = new ReactiveDictionary <int, string> (); RC_DefaultCommand1 = new ReactiveCommand <DefaultCommand1Command> (); RC_DefaultCommand2 = new ReactiveCommand(); RC_DefaultCommand3 = new ReactiveCommand(); RC_DefaultCommand4 = new ReactiveCommand(); RC_DefaultCommand5 = new ReactiveCommand(); RC_DefaultCommand6 = new ReactiveCommand(); RC_DefaultCommand7 = new ReactiveCommand(); RC_DefaultCommand8 = new ReactiveCommand <DefaultCommand8Command> (); RC_DefaultCommand9 = new ReactiveCommand(); RC_DefaultCommand10 = new ReactiveCommand(); RC_DefaultCommand11 = new ReactiveCommand(); RC_DefaultCommand12 = new ReactiveCommand(); RC_DefaultCommand13 = new ReactiveCommand(); RC_DefaultCommand14 = new ReactiveCommand(); RC_DefaultCommand15 = new ReactiveCommand(); RC_DefaultCommand16 = new ReactiveCommand(); RC_DefaultCommand17 = new ReactiveCommand(); RC_DefaultCommand18 = new ReactiveCommand(); RC_DefaultCommand19 = new ReactiveCommand(); RC_DefaultCommand20 = new ReactiveCommand(); RP_CurrentFB = new ReactiveProperty <FBViewModel> (); base.Initialize(); }
void Sync(ReactiveDictionary <int, string> syncState) { if (robotID % 10 != 0) { return; } if (syncState.TryGetValue(robotID, out mySyncState)) { var splitState = mySyncState.Split(new [] { '/' }); float x, z, rot; int intDead, en, hp; //sync position smoothly //transform.position.Set(x, 0, z); float.TryParse(splitState[0], out x); float.TryParse(splitState[1], out z); transform.position = Vector3.SmoothDamp(transform.position, new Vector3(x, 0, z), ref positionVelocity, Time.deltaTime); float.TryParse(splitState[2], out rot); // sync rotation smoothly transform.rotation.eulerAngles.Set(0, rot, 0); int.TryParse(splitState[3], out en); Energy.Value = en; int.TryParse(splitState[4], out hp); HitPoint.Value = hp; int.TryParse(splitState[5], out intDead); IsDead.Value = intDead; } }
public void TestOnValueChanged() { //Setup var scheduler = new TestScheduler(); ReactiveDictionary <string, int> dict = new ReactiveDictionary <string, int> { { "A", 1 }, { "B", 2 }, { "C", 3 }, }; //Define actions scheduler.Schedule(TimeSpan.FromTicks(10), () => dict["A"] = 0); scheduler.Schedule(TimeSpan.FromTicks(20), () => dict["Z"] = 1); scheduler.Schedule(TimeSpan.FromTicks(30), () => dict.Remove("Z")); var actual = scheduler.Start(() => dict.OnValueChanged, created: 0, subscribed: 0, disposed: 100); //Assert var expected = new[] { OnNext(10, new KeyValuePair <string, int>("A", 0)), OnNext(20, new KeyValuePair <string, int>("Z", 1)) }; ReactiveAssert.AreElementsEqual(expected, actual.Messages); }
public ResourcePackViewModel([NotNull] ResourcePack model) { Assert.IsNotNull(model, nameof(model)); _model = model; _resources = new ReactiveDictionary <string, ResourceViewModel>( _model.Content .ToDictionary(r => r.Name, r => new ResourceViewModel(r))); }
public MainModel() { Table = new ReactiveDictionary <int, float>(); OLS = new ReactiveProperty <Calculator>(); OLS.Value = null; Lagrange = new ReactiveProperty <Calculator>(); Lagrange.Value = null; }
public void Setup(ReactiveDictionary <int, LifeElementModel> elements) { disposables.Clear(); for (int i = 0; i < _compound.Elements.Count; i++) { AddListener(_compound.Elements[i], elements); } }
public static void SubscribeToPersistence <T1, T2>(this ReactiveDictionary <T1, T2> dictionary, string saveKey, CompositeDisposable disposables, bool isLocal = false) { dictionary.ObserveCountChanged().Subscribe(value => DIResolver.GetObject <PlayerDataManager>().TrySave(saveKey, dictionary.ToDictionary(x => x.Key, x => x.Value), isLocal) ).AddTo(disposables); dictionary.ObserveReplace().Subscribe(value => DIResolver.GetObject <PlayerDataManager>().TrySave(saveKey, dictionary.ToDictionary(x => x.Key, x => x.Value), isLocal) ).AddTo(disposables); }
protected override void OnDispose() { foreach (var browser in browsers) { browser.Value.Dispose(); } browsers.Dispose(); browsers.Clear(); browsers = null; // do your IDispose-actions here. It is called right after disposables got disposed }
public void RxDictObserve() { var dict = new ReactiveDictionary <string, int>(); var count = 0; DictionaryAddEvent <string, int> addE = null; DictionaryRemoveEvent <string, int> removeE = null; DictionaryReplaceEvent <string, int> replaceE = null; var resetCount = 0; dict.ObserveCountChanged().Subscribe(x => count = x); dict.ObserveAdd().Subscribe(x => addE = x); dict.ObserveRemove().Subscribe(x => removeE = x); dict.ObserveReplace().Subscribe(x => replaceE = x); dict.ObserveReset().Subscribe(x => resetCount += 1); dict.Add("a", 100); count.Is(1); addE.Key.Is("a"); addE.Value.Is(100); dict.Add("b", 200); count.Is(2); addE.Key.Is("b"); addE.Value.Is(200); count = -1; dict["a"] = 300; count.Is(-1); // not fired addE.Key.Is("b"); // not fired replaceE.Key.Is("a"); replaceE.OldValue.Is(100); replaceE.NewValue.Is(300); dict["c"] = 400; count.Is(3); replaceE.Key.Is("a"); // not fired addE.Key.Is("c"); addE.Value.Is(400); dict.Remove("b"); count.Is(2); removeE.Key.Is("b"); removeE.Value.Is(200); count = -1; dict.Remove("z"); count.Is(-1); // not fired removeE.Key.Is("b"); // not fired dict.Clear(); count.Is(0); resetCount.Is(1); count = -1; dict.Clear(); resetCount.Is(2); count.Is(-1); // not fired }
private void AddListener(LifeElementModel compoundElement, ReactiveDictionary <int, LifeElementModel> elements) { //set compound element amount when life's element amount change elements[compoundElement.Index]._Amount .Subscribe(_ => compoundElement.Amount = _) .AddTo(disposables); //when element is full, check if all elements in the compound are full too compoundElement._IsFull .Subscribe(_ => CheckCanCraft()) .AddTo(disposables); }
public void RxDictObserve() { var dict = new ReactiveDictionary<string, int>(); var count = 0; DictionaryAddEvent<string, int> addE = null; DictionaryRemoveEvent<string, int> removeE = null; DictionaryReplaceEvent<string, int> replaceE = null; var resetCount = 0; dict.ObserveCountChanged().Subscribe(x => count = x); dict.ObserveAdd().Subscribe(x => addE = x); dict.ObserveRemove().Subscribe(x => removeE = x); dict.ObserveReplace().Subscribe(x => replaceE = x); dict.ObserveReset().Subscribe(x => resetCount += 1); dict.Add("a", 100); count.Is(1); addE.Key.Is("a"); addE.Value.Is(100); dict.Add("b", 200); count.Is(2); addE.Key.Is("b"); addE.Value.Is(200); count = -1; dict["a"] = 300; count.Is(-1); // not fired addE.Key.Is("b"); // not fired replaceE.Key.Is("a"); replaceE.OldValue.Is(100); replaceE.NewValue.Is(300); dict["c"] = 400; count.Is(3); replaceE.Key.Is("a"); // not fired addE.Key.Is("c"); addE.Value.Is(400); dict.Remove("b"); count.Is(2); removeE.Key.Is("b"); removeE.Value.Is(200); count = -1; dict.Remove("z"); count.Is(-1); // not fired removeE.Key.Is("b"); // not fired dict.Clear(); count.Is(0); resetCount.Is(1); count = -1; dict.Clear(); resetCount.Is(2); count.Is(-1); // not fired }
private void Start() { _joints = new ReactiveDictionary <Kinect.JointType, JointData>() { { Kinect.JointType.Head, new JointData(Vector3.zero, Quaternion.identity) }, { Kinect.JointType.Neck, new JointData(Vector3.zero, Quaternion.identity) }, { Kinect.JointType.SpineShoulder, new JointData(Vector3.zero, Quaternion.identity) }, { Kinect.JointType.ShoulderLeft, new JointData(Vector3.zero, Quaternion.identity) }, { Kinect.JointType.ShoulderRight, new JointData(Vector3.zero, Quaternion.identity) }, { Kinect.JointType.ElbowLeft, new JointData(Vector3.zero, Quaternion.identity) }, { Kinect.JointType.ElbowRight, new JointData(Vector3.zero, Quaternion.identity) }, { Kinect.JointType.WristLeft, new JointData(Vector3.zero, Quaternion.identity) }, { Kinect.JointType.WristRight, new JointData(Vector3.zero, Quaternion.identity) }, { Kinect.JointType.SpineMid, new JointData(Vector3.zero, Quaternion.identity) }, { Kinect.JointType.SpineBase, new JointData(Vector3.zero, Quaternion.identity) }, { Kinect.JointType.HipLeft, new JointData(Vector3.zero, Quaternion.identity) }, { Kinect.JointType.HipRight, new JointData(Vector3.zero, Quaternion.identity) }, { Kinect.JointType.KneeLeft, new JointData(Vector3.zero, Quaternion.identity) }, { Kinect.JointType.KneeRight, new JointData(Vector3.zero, Quaternion.identity) }, { Kinect.JointType.AnkleLeft, new JointData(Vector3.zero, Quaternion.identity) }, { Kinect.JointType.AnkleRight, new JointData(Vector3.zero, Quaternion.identity) }, { Kinect.JointType.FootLeft, new JointData(Vector3.zero, Quaternion.identity) }, { Kinect.JointType.FootRight, new JointData(Vector3.zero, Quaternion.identity) }, }; _bodySource = BodySource.GetComponent <BodySourceManager>(); _joints.ObserveReplace() .Where(x => x.NewValue.pos != x.OldValue.pos) .Where(x => x.NewValue.rot != x.OldValue.rot) .Subscribe(x => { VisualizerController.Instance.JointDataModel._joints[x.Key] = x.NewValue; }); this.UpdateAsObservable().Subscribe(_ => { _body = _bodySource.GetData().FirstOrDefault(b => b.IsTracked); if (_body.IsTracked) { var keys = _joints.Keys.ToArray(); foreach (var k in keys) { _joints[k] = new JointData( JointUtility.GetJointPos(_body, k), JointUtility.GetJointRot(_body, k) ); } } }); }
public void ExecuteEquip(int compoundIndex, int bodySlotIndex) { _unitSlotCompoundIndex = _unitController.SelectedUnit.BodySlots[bodySlotIndex]._CompoundIndex; _lifeCompounds = _planetController.SelectedPlanet.Life.Compounds; Unequip(); //EQUIP _unitSlotCompoundIndex.Value = compoundIndex; _lifeCompounds[compoundIndex].Value--; ApplyCompoundEffects(_compounds[compoundIndex], 1); }
// Use this for initialization void Start() { gm = MRPM_GeneralManager._instance; oscIn = GetComponent <OscIn>(); oscIn.Open(gm.PORT_OPERATOR, null); oscIn.Map(gm.ADDRESS_SYNC, ParseOscMessage); SceneVariables = new ReactiveDictionary <int, string>(); //新しいオブジェクトを生成 SceneVariables.ObserveAdd().Subscribe(x => { SpawnSyncedObject(x); }); }
internal void UpdatePoints(ReactiveDictionary <int, float> dots) { points = new List <Dot>(); foreach (int x in dots.Keys) { Dot dot = new Dot(); dot.Point = new Point(); dot.Point.X = StartPosition.x + xStep * x; dot.Point.Y = dots[x] * yStep + StartPosition.y; dot.Mat = config.PointsMaterial; dot.Radius = config.PointRadius; points.Add(dot); } }
public static void ReactiveDictionaryExample() { var dict = new ReactiveDictionary <int, string>() { { 1, "Tom" }, { 2, "Jack" } }; dict.ObserveAdd() .Subscribe(value => { Debug.Log($"Add: {value}"); }); dict.ObserveRemove() .Subscribe(value => { Debug.Log($"Remove: {value}"); }); dict.Add(3, "Tony"); dict.Remove(1); }
public void TestModifying() { // New dictionary ReactiveDictionary <string, int> dict = new ReactiveDictionary <string, int> { { "A", 1 }, { "B", 2 }, { "C", 3 }, }; // Change B to 0 dict["B"] = 0; Assert.AreEqual(0, dict["B"]); Assert.IsTrue(dict.TryGetValue("B", out int value)); Assert.AreEqual(0, value); }
private void Start() { var rd = new ReactiveDictionary <string, string>(); //要素が増えた時の通知を購読 rd.ObserveAdd() .Subscribe((DictionaryAddEvent <string, string> a) => { Debug.Log($"[{a.Key}]に{a.Value}が追加されました"); }); //要素が削除された時の通知を購読 rd.ObserveRemove() .Subscribe((DictionaryRemoveEvent <string, string> r) => { Debug.Log($"[{r.Key}]の{r.Value}が削除されました"); }); //要素が更新された時の通知を購読 rd.ObserveReplace() .Subscribe((DictionaryReplaceEvent <string, string> r) => { Debug.Log($"[{r.Key}]の{r.OldValue}が{r.NewValue}に更新されました"); }); //要素数の変化の通知を購読 rd.ObserveCountChanged() .Subscribe((int c) => { Debug.Log("要素数が" + c + "になりました"); }); //Add rd["Apple"] = "りんご"; rd["Banana"] = "バナナ"; rd["Lemon"] = "レモン"; //Replace rd["Apple"] = "林檎"; //Remove rd.Remove("Banana"); // Dispose()時に各Observableに // OnCompletedメッセージが発行される rd.Dispose(); }
void Sync(ReactiveDictionary <int, string> syncState) { if (syncState.TryGetValue(objectID, out mySyncState)) { var splitState = mySyncState.Split(new [] { '/' }); float x, z, rot; int intDead, en, hp; //sync position smoothly //transform.position.Set(x, 0, z); float.TryParse(splitState[0], out x); float.TryParse(splitState[1], out z); transform.position = Vector3.SmoothDamp(transform.position, new Vector3(x, 0, z), ref positionVelocity, Time.deltaTime); float.TryParse(splitState[2], out rot); // sync rotation transform.rotation.eulerAngles.Set(0, rot, 0); } }
private void OnPlanetChange(PlanetModel value) { disposables.Clear(); RemoveAllChildren(transform); _LifeCompounds = value.Life.Compounds; foreach (KeyValuePair <int, IntReactiveProperty> item in _LifeCompounds) { Add(_compounds[item.Key], item.Value); } _LifeCompounds.ObserveAdd() .Where(_ => _.Key != Int32.MaxValue) .Subscribe(_ => Add(_compounds[_.Key], _.Value)) .AddTo(disposables); //_LifeCompounds.ObserveRemove().Subscribe( _ => Remove( _.Key ) ).AddTo( disposables ); }
public static ManagedReactiveDictionary <TKey, TElement> ToManagedReactiveDictionary <TSource, TKey, TElement>( this IObservable <IEnumerable <TSource> > source, Func <TSource, TKey> keySelector, Func <TSource, TElement> elementFactory, Action <TElement> elementDisposer) { var dict = new ReactiveDictionary <TKey, TElement>(); var newDict = new Dictionary <TKey, TSource>(); var keysToRemove = new List <TKey>(); var subscription = source .Subscribe(items => { foreach (var item in items) { newDict.Add(keySelector.Invoke(item), item); } foreach (var kvp in dict) { if (!newDict.ContainsKey(kvp.Key)) { keysToRemove.Add(kvp.Key); } } foreach (var key in keysToRemove) { var element = dict[key]; dict.Remove(key); elementDisposer.Invoke(element); } foreach (var kvp in newDict) { if (!dict.ContainsKey(kvp.Key)) { dict.Add(kvp.Key, elementFactory.Invoke(kvp.Value)); } } newDict.Clear(); keysToRemove.Clear(); }); return(new ManagedReactiveDictionary <TKey, TElement>(dict, StableCompositeDisposable.Create(dict, subscription))); }
public override void Initialize() { RP_IntValue = new ReactiveProperty <int> (); RP_LongValue = new ReactiveProperty <long> (); RP_FloatValue = new ReactiveProperty <float> (); RP_DoubleValue = new ReactiveProperty <double> (); IntList = new ReactiveCollection <int> (); LongList = new ReactiveCollection <long> (); FloatList = new ReactiveCollection <float> (); DoubleList = new ReactiveCollection <double> (); StringList = new ReactiveCollection <string> (); IntDictionary = new ReactiveDictionary <string, int> (); StringDictionary = new ReactiveDictionary <int, string> (); RC_StringCommand = new ReactiveCommand <StringCommandCommand> (); RC_IntCommand = new ReactiveCommand <IntCommandCommand> (); RC_SimpleCommand = new ReactiveCommand(); base.Initialize(); }
// Use this for initialization void Start() { var reactiveDictionary = new ReactiveDictionary <int, string>() { { 0, "酒酣胸胆尚开张" }, { 1, "鬓微霜" }, { 2, "又何妨" } }; reactiveDictionary.ObserveAdd() .Subscribe(addStr => { Debug.LogFormat("add str{0}", addStr); }); reactiveDictionary.ObserveRemove() .Subscribe(RemoveStr => { Debug.LogFormat("Remove str{0}", RemoveStr); }); reactiveDictionary.ObserveReplace() .Subscribe(MoveStr => { Debug.LogFormat("Move str{0}", MoveStr); }); reactiveDictionary.ObserveCountChanged() .Subscribe(addStr => { Debug.LogFormat("Change str{0}", addStr); }); reactiveDictionary.Add(3, "射天狼"); reactiveDictionary.Remove(0); foreach (var item in reactiveDictionary) { Debug.LogFormat("item:{0}", item); } }
public BoardViewModel(GameConfig.BoardSettings boardSetting, BubbleView.Factory bubbleViewFactory, AudioService audioService) { _minBounds = boardSetting.Min; _maxBounds = boardSetting.Max; _maxSpawnExponent = boardSetting.InitialMaxSpawnExponent + 2; _minNumberOfBubbles = boardSetting.MinNumberOfBubbles; _explosionExponent = boardSetting.ExplosionExponent; _bubbleViewFactory = bubbleViewFactory; _audioService = audioService; _isInitialized = new ReactiveProperty <bool>().AddTo(Disposer); _isMerging = new ReactiveProperty <bool>().AddTo(Disposer); _currentTopGridY = new ReactiveProperty <int>().AddTo(Disposer); _bubbleViewModels = new ReactiveDictionary <Vector2Int, BubbleViewModel>().AddTo(Disposer); _mergeSubscriptionDisposer = new CompositeDisposable().AddTo(Disposer); _bubbleAddedSerialDisposable = new SerialDisposable().AddTo(Disposer); IsInitialized .IfTrue() .Subscribe(_ => UpdateConnectedToCeiling()).AddTo(Disposer); BubbleViewModels .ObserveAnyChange() .OncePerFrame() .Where(_ => IsInitialized.Value) .DelayFrame(1) .Subscribe(_ => OnBubblesCountChanged()).AddTo(Disposer); CurrentTopGridY .SkipLatestValueOnSubscribe() .Where(_ => IsInitialized.Value) .OncePerFrame() .Subscribe(OnCurrentTopYChanged).AddTo(Disposer); IsMerging .SkipLatestValueOnSubscribe() .IfFalse() .OncePerFrame() .Subscribe(_ => TriggerExplosions()) .AddTo(Disposer); }
public void TestAddingAndRemoving() { // New dictionary ReactiveDictionary <string, int> dict = new ReactiveDictionary <string, int>(); Assert.IsFalse(dict.TryGetValue("A", out int _)); Assert.AreEqual(0, dict.Count); // Add {A, 1} dict["A"] = 1; Assert.IsTrue(dict.TryGetValue("A", out int value)); Assert.AreEqual(1, value); Assert.AreEqual(1, dict.Count); Assert.IsTrue(dict.SequenceEqual(new[] { new KeyValuePair <string, int>("A", 1) })); Assert.IsTrue(dict.Keys.SequenceEqual(new[] { "A" })); Assert.IsTrue(dict.Values.SequenceEqual(new[] { 1 })); // Add {B, 1} dict.Add("B", 2); Assert.AreEqual(2, dict["B"]); Assert.AreEqual(2, dict.Count); // Remove A Assert.IsTrue(dict.Remove("A")); Assert.IsFalse(dict.TryGetValue("A", out int _)); Assert.AreEqual(1, dict.Count); Assert.IsTrue(dict.ContainsKey("B")); Assert.IsFalse(dict.ContainsKey("A")); Assert.IsFalse(dict.ContainsKey("Z")); // Clear dict.Clear(); Assert.AreEqual(0, dict.Count); Assert.IsTrue(dict.SequenceEqual(new KeyValuePair <string, int> [0])); }
/// <summary> /// ReactiveDictionaryの実行 /// </summary> private void ExcuteReactiveDictionary() { // ReactiveDictionary ReactiveDictionary <string, int> reactiveDictionary = new ReactiveDictionary <string, int>(); // Subscribe時に値を発行 // 要素追加時 reactiveDictionary .ObserveAdd() .Subscribe(x => { Debug.Log(string.Format("要素追加, Key : {0}, Value : {1}", x.Key, x.Value)); }); // 要素削除時 reactiveDictionary .ObserveRemove() .Subscribe(x => { Debug.Log(string.Format("要素削除, Key : {0}, Value : {1}", x.Key, x.Value)); }); // 要素数変化時 reactiveDictionary .ObserveCountChanged() .Subscribe(x => { Debug.Log(string.Format("要素数変化, Count : {0}", x)); }); // 要素を追加するとOnNext reactiveDictionary.Add("スライム", 10); reactiveDictionary.Add("ドラゴン", 100); reactiveDictionary.Add("魔王", 1000); // 要素を削除するとOnNext reactiveDictionary.Remove("スライム"); foreach (var keyValue in reactiveDictionary) { Debug.Log(string.Format("Dictionaryの中身, Key : {0}, Value : {1}", keyValue.Key, keyValue.Value)); } }
public EasyWriter(string path) { FilePath = path; #if UNITY_EDITOR var directoryName = Path.GetDirectoryName(path); if (!Directory.Exists(directoryName)) { Directory.CreateDirectory(directoryName); } #endif if (dict == null) { dict = new ReactiveDictionary <string, ReactiveWriter>(); } if (!dict.ContainsKey(path)) { DeserializeAsync <EasyDictionary <string, EasyObject> >(path).Subscribe(o => { dict.Add(path, new ReactiveWriter(path, o)); }); } }
public RemoteDataModel() { Coins = new ReactiveProperty <double>(0.0); HeroRemoteModel = new ReactiveProperty <HeroRemoteDataModel>(); AnimalRemoteDatas = new ReactiveDictionary <long, AnimalRemoteDataModel>(); }