Exemplo n.º 1
0
 public void InFieldRect(ref Rect rect)
 {
     rect.Left = Math.Max(rect.Left, 0);
     rect.Top = Math.Max(rect.Top, 0);
     rect.Right = Math.Min(rect.Right, Width - 1);
     rect.Bottom = Math.Min(rect.Bottom, Height - 1);
 }
Exemplo n.º 2
0
 private TurnInfo CreateGameOverInfo(Rect changeRect = new Rect())
 {
     return new TurnInfo
     {
         AppraisalScore = -1,
         ChangeRect = changeRect,
     };
 }
Exemplo n.º 3
0
 public BattleStats(Rect areaRect)
     : base(areaRect)
 {
     AreaType = AreaUI.PlayerStats;
     const int playerOffset = 49;
     enemyCoord = new StatsArea(areaRect.Left+2, areaRect.Top+1, areaRect.Left+14, areaRect.Left+23);
     playerCoord = new StatsArea(areaRect.Left+playerOffset, areaRect.Top+1, areaRect.Left+12+playerOffset, areaRect.Left+21+playerOffset);
 }
Exemplo n.º 4
0
 public EventLog(Rect eventLogArea)
     : base(eventLogArea)
 {
     AreaType		= AreaUI.EventLog;
     ZMessageLog.Initialize(2, 2, eventLogArea.Width-2, eventLogArea.Height-2);
     eventLogDivider = "^-".PadRight(eventLogArea.Width - 6, '-') + "^";
     ZMessageLog.YesText = Lang["Common_Yes"];
     ZMessageLog.NoText  = Lang["Common_No"];
     ZUI.YesText = Lang["Common_Yes"];
     ZUI.NoText  = Lang["Common_No"];
 }
Exemplo n.º 5
0
 public void CopyTo(GameModel to, Rect rect)
 {
     to.Turn = Turn;
     to.Score = Score;
     to.RawScore = RawScore;
     to.ExtraScore = ExtraScore;
     to.FireCount = FireCount;
     to.MaxChain = MaxChain;
     to.MaxSameErase = MaxSameErase;
     Main.CopyTo(to.Main, rect);
 }
Exemplo n.º 6
0
        public GalaxyMap(Rect galaxyArea, int xStarCount, int yStarCount)
            : base(galaxyArea)
        {
            galaxySizeX		= xStarCount;
            galaxySizeY		= yStarCount;

            starDistanceX	= (galaxyArea.Width -2)/galaxySizeX;
            starDistanceY	= (galaxyArea.Height-2)/galaxySizeY;
            if (galaxySizeY == 5)
                starDistanceY = 5;

            TargetX			= Player.PosX;
            TargetY			= Player.PosY;
            AreaType		= AreaUI.GalaxyMap;
        }
Exemplo n.º 7
0
 public void CopyTo(MainField to, Rect rect)
 {
     for (int x = rect.Left; x <= rect.Right; x++)
     {
         for (int y = rect.Top; y <= rect.Bottom; y++)
         {
             to[x, y] = this[x, y];
         }
     }
     for (int i = 0; i < Width; i++)
     {
         to.earthPoint[i] = earthPoint[i];
         to.floatPoint[i] = floatPoint[i];
     }
 }
Exemplo n.º 8
0
        public ActionPanel(Rect actionPanelArea)
            : base(actionPanelArea)
        {
            AreaType = AreaUI.ActionPanel;
            xMenu = AreaRect.Left + 20;
            yMenu = AreaRect.Top  + 1;

            DefaultMenuOptions = new ZMenu.Options
            {
                Mode = ZMenu.MenuMode.ShortkeysAndArrows,
                FrameSpacingHorizontal = 2,
                UseSelectedBackColor = true,
                ColorScheme = new ZMenu.ColorScheme{ FrameForeColor = Color.Green, CaptionBackColor = Color.DarkGreen, CaptionForeColor = Color.Yellow },
                FrameOptions = new ZFrame.Options
                    {
                        FrameType = FrameType.Double,
                        Width = 10,
                        Height = 4,
                    },
            };
        }
Exemplo n.º 9
0
 public static extern unsafe int GetWindowRect(int hWnd, out Rect windowRect );
Exemplo n.º 10
0
 public TurnInfo IgnitionPointForwardStep(int num, int x, int y)
 {
     int ry = Main.SetBlock(num, x, y);
     Rect rect = new Rect { Left = x, Top = y, Right = x, Bottom = ry };
     return ChainLoop(rect);
 }
Exemplo n.º 11
0
 public PlayerStats(Rect areaRect)
     : base(areaRect)
 {
     AreaType = AreaUI.PlayerStats;
     coord = new StatsArea(areaRect.Left+2, areaRect.Top+1, areaRect.Left+16, areaRect.Right);
 }
Exemplo n.º 12
0
 public void CopyTo(GameModel to)
 {
     Rect rect = new Rect() { Left = 0, Top = 0, Right = Main.Width - 1, Bottom = Main.Height - 1 };
     CopyTo(to, rect);
 }
Exemplo n.º 13
0
 public TurnInfo ChainLoop(Rect rect)
 {
     Rect changeRect = rect;
     Rect eraseRect = Main.CreateReverseRect();
     long rawScore = 0, extraScore = 0;
     int c = 0, e = 0, eraseCount = 0, eraseBlock = 0, eraseObstacle = 0,
         maxEraseCount = 0, maxEraseChain = 0, fallingCount = 0;
     while ((e = Main.EraseBlocks(ref rect, ref eraseBlock, ref eraseObstacle)) > 0)
     {
         eraseRect.MaxRect(rect);
         rawScore += Setting.FigureChainScore(e, ++c);
         eraseCount += e;
         if (maxEraseCount <= e)
         {
             maxEraseCount = e;
             maxEraseChain = c;
         }
         extraScore += e * e * c;
         fallingCount += Main.FallingBlocks(ref rect);
     }
     long assessScore = Setting.FigureTurnScore(rawScore, FireCount);
     changeRect.MaxRect(eraseRect);
     int eraseWidth = eraseRect.Right - eraseRect.Left + 1;
     return new TurnInfo
     {
         AppraisalScore = assessScore,
         RawScore = rawScore,
         ExtraScore = extraScore,
         Chain = c,
         TotalEraseCount = eraseCount,
         EraseBlock = eraseBlock,
         EraseObstacle = eraseObstacle,
         EraseWidth = eraseWidth < 0 ? 0 : eraseWidth,
         MaxEraseCount = maxEraseCount,
         MaxEraseChain = maxEraseChain,
         MostBottom = Main.GetMostBottom(),
         FieldSpace = Main.GetSpace(Setting.GetGameOverLine()),
         FallingCount = fallingCount,
         ChangeRect = changeRect,
     };
 }
Exemplo n.º 14
0
 public int FallingBlocks(ref Rect rect)
 {
     int fallingCount = 0;
     Rect resultRect = CreateReverseRect();
     for (int x = rect.Left; x <= rect.Right; x++)
     {
         int top = floatPoint[x], bottom = earthPoint[x];
         for (int y = bottom; y >= top; y--)
         {
             byte num = this[x, y];
             if (num <= 0) continue;
             this[x, y] = 0;
             this[x, earthPoint[x]--] = num;
             fallingCount++;
         }
         int nowfp = earthPoint[x] + 1;
         if (bottom < nowfp) continue;
         resultRect.MaxRect(x, nowfp, x, bottom);
         floatPoint[x] = nowfp;
     }
     rect = resultRect;
     return fallingCount;
 }
Exemplo n.º 15
0
 public void MaxRect(Rect from)
 {
     MaxRect(from.Left, from.Top, from.Right, from.Bottom);
 }
Exemplo n.º 16
0
 public void CopyTo(MainField to)
 {
     Rect rect = new Rect() { Left = 0, Top = 0, Right = Width - 1, Bottom = Height - 1 };
     CopyTo(to, rect);
 }
Exemplo n.º 17
0
 private int RectEraseObstacles(ref Rect rect, ref int eraseBlock, ref int eraseObstacle)
 {
     int eraseSum = 0;
     Rect resultRect = CreateReverseRect();
     for (int x = rect.Left; x <= rect.Right; x++)
     {
         for (int y = rect.Top; y <= rect.Bottom; y++)
         {
             if (eraseFlag[x, y] == false) continue;
             int e = EraseObstacles(x, y);
             this[x, y] = 0;
             eraseFlag[x, y] = false;
             eraseBlock++;
             eraseObstacle += e;
             eraseSum += e;
         }
     }
     rect.MaxRect(rect.Left - 1, rect.Top - 1, rect.Right + 1, rect.Bottom + 1);
     InFieldRect(ref rect);
     return eraseSum;
 }
Exemplo n.º 18
0
        private int CheckRectSum(ref Rect rect)
        {
            Rect resultRect = CreateReverseRect();
            int tx, ty, length, eraseSum = 0;
            int w = rect.Right - rect.Left + 1, h = rect.Bottom - rect.Top + 1, side = w < h ? w : h;
            for (int y = rect.Top; y <= rect.Bottom; y++)
            {
                tx = rect.Left; ty = y; 
                length = w;
                eraseSum += CheckLineSum(ref tx, ref ty, 1, 0, ref length);
                resultRect.MaxRect(tx, ty, tx + length, ty);

                tx = rect.Left; ty = y; 
                length = Math.Min(side, rect.Top + h - y);
                eraseSum += CheckLineSum(ref tx, ref ty, 1, 1, ref length);
                resultRect.MaxRect(tx, ty, tx + length, ty + length);

                tx = rect.Left; ty = y; 
                length = Math.Min(side, y - rect.Top + 1);
                eraseSum += CheckLineSum(ref tx, ref ty, 1, -1, ref length);
                resultRect.MaxRect(tx, ty - length, tx + length, ty);
            }
            for (int x = rect.Left; x <= rect.Right; x++)
            {
                tx = x; ty = rect.Top; 
                length = h;
                eraseSum += CheckLineSum(ref tx, ref ty, 0, 1, ref length);
                resultRect.MaxRect(tx, ty, tx, ty + length);
                if (x == rect.Left) continue;

                tx = x; ty = rect.Top; 
                length = Math.Min(side, rect.Left + w - x);
                eraseSum += CheckLineSum(ref tx, ref ty, 1, 1, ref length);
                resultRect.MaxRect(tx, ty, tx + length, ty + length);

                tx = x; ty = rect.Bottom; 
                length = Math.Min(side, rect.Left + w - x);
                eraseSum += CheckLineSum(ref tx, ref ty, 1, -1, ref length);
                resultRect.MaxRect(tx, ty - length, tx + length, ty);
            }
            InFieldRect(ref resultRect);
            rect = resultRect;
            return eraseSum;
        }
Exemplo n.º 19
0
 public int EraseBlocks(ref Rect rect, ref int eraseBlock, ref int eraseObstacle)
 {
     int eraseCount = CheckRectSum(ref rect);
     if (eraseCount <= 0)
     {
         return eraseCount;
     }
     eraseCount += RectEraseObstacles(ref rect, ref eraseBlock, ref eraseObstacle);
     AdjustEarthFlort(ref rect);
     return eraseCount;
 }
Exemplo n.º 20
0
 private void AdjustEarthFlort(ref Rect rect)
 {
     Rect resultRect = CreateReverseRect();
     for (int x = rect.Left; x <= rect.Right; x++)
     {
         if (rect.Bottom < earthPoint[x]) continue;
         for (int y = rect.Bottom; y >= rect.Top; y--)
         {
             if (this[x, y] <= 0)
             {
                 earthPoint[x] = y;
                 break;
             }
         }
         if (floatPoint[x] > earthPoint[x]) continue;
         resultRect.MaxRect(x, floatPoint[x], x, earthPoint[x]);
     }
     rect = resultRect;
 }