コード例 #1
0
        protected override void OnFree()
        {
            base.OnFree();

            PositionBindable.UnbindFrom(HitObject.PositionBindable);
            IndexInBeatmap.UnbindFrom(HitObject.IndexInBeatmapBindable);
        }
コード例 #2
0
        protected override void OnFree()
        {
            base.OnFree();

            OriginalXBindable.UnbindFrom(HitObject.OriginalXBindable);
            XOffsetBindable.UnbindFrom(HitObject.XOffsetBindable);
        }
コード例 #3
0
        protected override void OnFree()
        {
            base.OnFree();

            isStrong.UnbindFrom(HitObject.IsStrongBindable);
            // ensure the next application does not accidentally overwrite samples.
            isStrong.UnbindEvents();
        }
コード例 #4
0
        protected override void OnFree()
        {
            HyperDash.UnbindFrom(HitObject.HyperDashBindable);
            ScaleBindable.UnbindFrom(HitObject.ScaleBindable);
            IndexInBeatmap.UnbindFrom(HitObject.IndexInBeatmapBindable);

            base.OnFree();
        }
コード例 #5
0
        /// <summary>
        /// Removes the currently applied <see cref="HitObject"/>
        /// </summary>
        private void free()
        {
            if (!hasHitObjectApplied)
            {
                return;
            }

            StartTimeBindable.UnbindFrom(HitObject.StartTimeBindable);
            if (HitObject is IHasComboInformation combo)
            {
                comboIndexBindable.UnbindFrom(combo.ComboIndexBindable);
            }
            samplesBindable.UnbindFrom(HitObject.SamplesBindable);

            // Changes in start time trigger state updates. When a new hitobject is applied, OnApply() automatically performs a state update anyway.
            StartTimeBindable.ValueChanged -= onStartTimeChanged;

            // When a new hitobject is applied, the samples will be cleared before re-populating.
            // In order to stop this needless update, the event is unbound and re-bound as late as possible in Apply().
            samplesBindable.CollectionChanged -= onSamplesChanged;

            // Release the samples for other hitobjects to use.
            if (Samples != null)
            {
                Samples.Samples = null;
            }

            if (nestedHitObjects.IsValueCreated)
            {
                foreach (var obj in nestedHitObjects.Value)
                {
                    obj.OnNewResult            -= onNewResult;
                    obj.OnRevertResult         -= onRevertResult;
                    obj.ApplyCustomUpdateState -= onApplyCustomUpdateState;
                }

                nestedHitObjects.Value.Clear();
                ClearNestedHitObjects();
            }

            HitObject.DefaultsApplied -= onDefaultsApplied;

            OnFree();

            HitObject       = null;
            ParentHitObject = null;
            Result          = null;
            lifetimeEntry   = null;

            clearExistingStateTransforms();

            hasHitObjectApplied = false;
        }
コード例 #6
0
        protected override void OnPreHide()
        {
            base.OnPreHide();

            isShowAniEnded = false;

            loadingState.Value = GameLoadState.Idle;
            loadingState.UnbindFrom(GameModel.LoadState);

            UnbindEscape();

            GameModel.LoadState.OnNewValue -= OnLoadStateChange;
        }
コード例 #7
0
        public void TestUnbindFrom()
        {
            var bindable1 = new Bindable <int>(5);
            var bindable2 = new Bindable <int>();

            bindable2.BindTo(bindable1);

            Assert.AreEqual(bindable1.Value, bindable2.Value);

            bindable2.UnbindFrom(bindable1);
            bindable1.Value = 10;

            Assert.AreNotEqual(bindable1.Value, bindable2.Value);
        }
コード例 #8
0
        /// <summary>
        /// Removes the currently applied <see cref="HitObject"/>
        /// </summary>
        private void free()
        {
            if (!hasHitObjectApplied)
            {
                return;
            }

            startTimeBindable.UnbindFrom(HitObject.StartTimeBindable);
            if (HitObject is IHasComboInformation combo)
            {
                comboIndexBindable.UnbindFrom(combo.ComboIndexBindable);
            }

            samplesBindable.UnbindFrom(HitObject.SamplesBindable);

            // When a new hitobject is applied, the samples will be cleared before re-populating.
            // In order to stop this needless update, the event is unbound and re-bound as late as possible in Apply().
            samplesBindable.CollectionChanged -= onSamplesChanged;

            if (nestedHitObjects.IsValueCreated)
            {
                foreach (var obj in nestedHitObjects.Value)
                {
                    obj.OnNewResult            -= onNewResult;
                    obj.OnRevertResult         -= onRevertResult;
                    obj.ApplyCustomUpdateState -= onApplyCustomUpdateState;
                }

                nestedHitObjects.Value.Clear();
                ClearNestedHitObjects();
            }

            HitObject.DefaultsApplied -= onDefaultsApplied;

            OnFree(HitObject);

            HitObject           = null;
            hasHitObjectApplied = false;
        }
コード例 #9
0
        public void TestBindToAndUnbindFrom()
        {
            Bindable <Dummy> dummy  = new Bindable <Dummy>(new Dummy());
            Bindable <Dummy> dummy2 = new Bindable <Dummy>(new Dummy());

            Assert.AreNotEqual(dummy.Value, dummy2.Value);

            dummy2.BindTo(dummy);
            Assert.AreEqual(dummy.Value, dummy2.Value);

            dummy.Value = null;
            Assert.IsNull(dummy.Value);
            Assert.IsNull(dummy2.Value);

            dummy2.UnbindFrom(dummy);
            dummy.Value = new Dummy();
            Assert.IsNotNull(dummy.Value);
            Assert.IsNull(dummy2.Value);

            Bindable <SubDummy> subDummy = new Bindable <SubDummy>(new SubDummy());

            dummy.BindToRaw(subDummy);
            Assert.AreEqual(subDummy.Value, dummy.Value);

            subDummy.Value = new SubDummy();
            Assert.AreEqual(subDummy.Value, dummy.Value);

            dummy.UnbindFromRaw(subDummy);
            subDummy.Value = null;
            Assert.IsNull(subDummy.Value);
            Assert.IsNotNull(dummy.Value);

            dummy.Value = new Dummy();
            Assert.Throws(typeof(ArgumentException), () =>
            {
                subDummy.BindToRaw(dummy);
            });
        }
コード例 #10
0
 protected override void OnFree()
 {
     base.OnFree();
     major.UnbindFrom(HitObject.MajorBindable);
 }
コード例 #11
0
        protected override void OnFree()
        {
            base.OnFree();

            XBindable.UnbindFrom(HitObject.XBindable);
        }