Beispiel #1
0
        /// <summary>
        /// パレット位置をセット
        /// </summary>
        private void picPallet_MouseClick(object sender, MouseEventArgs e)
        {
            if (this.mgr.EdittingData?.CurrentLayer == null || this.picPallet.Image == null)
            {
                return;
            }
            var scaled = new Point(e.X, e.Y);

            ViewScale.RestoreOriginalPoint(ref scaled, this.mgr.Scale);
            this.uctlSectionPos.Result = new Point(scaled.X / this.mgr.EdittingData.CurrentLayer.SectionSize.Width, scaled.Y / this.mgr.EdittingData.CurrentLayer.SectionSize.Height);
            this.frameValuesChanged(this.uctlSectionPos, e);
            this.picPallet.Refresh();
        }
Beispiel #2
0
            /// <summary>
            /// 指定したインデックスのエネミーの位置を指定した分だけ移動させます。
            /// </summary>
            public void OffsetPosition(int index, Point scaledposoffset, Size scaledwndSize, ViewScale.ScaleRate scale)
            {
                var enemyPos  = this.Enemies[index].Position;
                var enemySize = this.Enemies[index].Size;

                ViewScale.ApplyRateToPoint(ref enemyPos, scale);
                ViewScale.ApplyRateToSize(ref enemySize, scale);
                var afterRange = new Rectangle(enemyPos.X + scaledposoffset.X, enemyPos.Y + scaledposoffset.Y, enemySize.Width, enemySize.Height);

                //拡大率を解除する
                var originalposoffset = scaledposoffset;
                var originalwndSize   = scaledwndSize;

                ViewScale.RestoreOriginalPoint(ref originalposoffset, scale);
                ViewScale.RestoreOriginalSize(ref originalwndSize, scale);

                //端点に範囲外になる場合は調整する
                var limit = (int)(limitPosition * ViewScale.GetRate(scale));

                if (afterRange.Right < limit)
                {
                    this.Enemies[index].Position = new Point(-this.Enemies[index].Size.Width + limitPosition, this.Enemies[index].Position.Y);
                }
                else if (afterRange.Bottom < limit)
                {
                    this.Enemies[index].Position = new Point(this.Enemies[index].Position.X, -this.Enemies[index].Size.Height + limitPosition);
                }
                else if (afterRange.Left > scaledwndSize.Width - limit)
                {
                    this.Enemies[index].Position = new Point(originalwndSize.Width - limitPosition, this.Enemies[index].Position.Y);
                }
                else if (afterRange.Top > scaledwndSize.Height - limit)
                {
                    this.Enemies[index].Position = new Point(this.Enemies[index].Position.X, originalwndSize.Height - limitPosition);
                }
                else
                {
                    //調整しなかった場合のみ差分移動する
                    this.Enemies[index].OffsetPosition(originalposoffset);
                }

                this.IsDirty = true;
            }
Beispiel #3
0
        /// <summary>
        /// デザイナー:ドラッグ開始
        /// </summary>
        private void picPreview_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                return;
            }

            var NotFound = true;

            //レイヤーはインデックスが後ろになるほど上に描画される構造であるため、逆から判定する
            for (var i = this.mgr.EdittingData.Enemies.Count - 1; i >= 0; i--)
            {
                //拡大率を適用する
                var enemyPos  = this.mgr.EdittingData.Enemies[i].Position;
                var enemySize = this.mgr.EdittingData.Enemies[i].Size;
                var pos       = new Point(e.X, e.Y);
                ViewScale.RestoreOriginalPoint(ref pos, this.mgr.Scale);
                ViewScale.ApplyRateToPoint(ref enemyPos, this.mgr.Scale);
                ViewScale.ApplyRateToSize(ref enemySize, this.mgr.Scale);

                //ドラッグ可能な領域である場合
                if (new Rectangle(enemyPos, enemySize).Contains(e.X, e.Y))
                {
                    this.drugObj = new DrugObject(i, new Point(e.X, e.Y));
                    this.ltvAnalyzer.SelectedIndices.Add(i);
                    NotFound = false;
                    break;
                }
            }

            if (NotFound)
            {
                this.drugObj = null;
                this.ltvAnalyzer.SelectedIndices.Clear();
                this.picPreview.Refresh();
            }
        }