Example #1
0
        /// <summary>
        /// 新增基本場景物件
        /// </summary>
        public SceneBase()
        {
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            InitializeComponent();

            SceneSlow        = 1;
            DefaultCursor    = Cursors.Default;
            IntervalOfRound  = Global.DefaultIntervalOfRound;
            UIObjects        = new ObjectCollection(this);
            EffectObjects    = new EffectCollection(this);
            GameObjects      = new ObjectCollection(this);
            DrawClearCount   = new CounterObject(20); // 計次
            RoundTimer.Tick += RoundTimer_Tick;
        }
Example #2
0
        /// <summary>
        /// 發生於活動物件集合變更
        /// </summary>
        protected virtual void OnEffectObjectsChanged(EffectCollection oldValue, EffectCollection newValue)
        {
            if (oldValue != null)
            {
                oldValue.BindingUnlock();
            }

            if (newValue != null)
            {
                newValue.Binding(this, true);
            }

            if (EffectObjectsChanged != null)
            {
                EffectObjectsChanged(this, oldValue, newValue);
            }
        }
Example #3
0
        /// <summary>
        /// 綁定特性到集合(集合>場景,集合內綁定,除此之外勿使用此函數)
        /// </summary>
        /// <param name="collection">集合</param>
        /// <param name="bindingLock">綁定後是否鎖定綁定功能</param>
        public void Binding(EffectCollection collection, bool bindingLock = false)
        {
            if (_Container == collection)
            {
                return;
            }
            if (BindingLock)
            {
                throw new Exception("特效已被鎖定無法綁定");
            }
            if (collection != null && !collection.Contains(this))
            {
                throw new Exception("特效不在集合中");
            }

            Container   = collection;
            Scene       = null;
            BindingLock = bindingLock;
            OnBindingChanged();
        }