Пример #1
0
        public void Move(int src, int dst)
        {
            int off = Math.Abs(src - dst);

            if (GameBoard.GetGameBoard[dst].GetOwner != CurrentPerson && GameBoard.GetGameBoard[dst].GetOwner != null)
            {
                GameBoard.TransferPips(OtherPerson, dst, OtherPenIndx);
                OtherPerson.AddPoints(dst);
                OtherPerson.Penalize = true;
                GameWindow.UpdateStack(OtherPenIndx);
            }

            GameBoard.TransferPips(CurrentPerson, src, dst);
            GameWindow.UpdateStack(src);
            GameWindow.UpdateStack(dst);

            if (GameBoard.GetGameBoard[PenIndx].PipsCount == 0)
            {
                CurrentPerson.Penalize = false;
            }

            CurrentPerson.SubtractPoints(off);
            GameWindow.UpdatePlayerPoints();

            if (CheckWin(dst))
            {
                CurrentPerson.Game_Points += 1;
                EndGame();
                return;
            }

            if (off == dice[0] + dice[1])
            {
                mvs = 0;
            }
            else
            {
                mvs--;
                if (off == dice.GetResult[0])
                {
                    dice[0] = 0;
                }
                else
                {
                    dice[1] = 0;
                }
                GameWindow.UpdateGameDice();
            }

            if (ArtificialIntelligence.CountPossibleMoves(this) == 0)
            {
                mvs = 0;
            }

            if (mvs == 0)
            {
                NextPerson();
            }
            else
            {
                GameWindow.WaitingForMove();
            }
        }
Пример #2
0
        public void Execute()
        {
            var workbook = ExcelExtension.LoadExcel(Program.personListXlsx);
            var sheet    = workbook.GetSheetAt(0);

            int     startRow = 3, currentRow = 3;
            decimal sum = 0, payedSum = 0;

            var date   = DateTime.Now.ToString("yyyyMMdd");
            var dateCH = DateTime.Now.ToString("yyyy年M月d日");

            sheet.Cell("G2").SetValue($"制表时间:{dateCH}");

            Session.Use(session =>
            {
                session.SendService(new OtherPersonQuery(Type, "1", ""));
                var result = session.GetResult <OtherPerson>();
                result.Data.ForEach((otherPerson) =>
                {
                    if (otherPerson.grbh == null) // 无效数据
                    {
                        return;
                    }
                    if (!All && !otherPerson.dfState.Value.Equals("1"))
                    {
                        return;
                    }
                    if (!otherPerson.dfState.Value.Equals("1") &&  // 不是正常代发
                        !(otherPerson.dfState.Value.Equals("2") && // 是暂停代发且居保不是正常状态
                          otherPerson.jbState.Value.Equals("1")))
                    {
                        return;
                    }

                    decimal payAmount = 0;
                    if (otherPerson.standard is decimal standard)
                    {
                        var startYear  = otherPerson.startYearMonth / 100;
                        var startMonth = otherPerson.startYearMonth % 100;
                        startMonth    -= 1;
                        if (startMonth == 0)
                        {
                            startYear -= 1;
                            startMonth = 12;
                        }
                        if (otherPerson.endYearMonth is int endYearMonth)
                        {
                            startYear  = endYearMonth / 100;
                            startMonth = endYearMonth % 100;
                        }
                        var match = Regex.Match(Date, @"^(\d\d\d\d)(\d\d)$");
                        if (match.Success)
                        {
                            var endYear  = int.Parse(match.Groups[1].Value);
                            var endMonth = int.Parse(match.Groups[2].Value);
                            payAmount    =
                                ((endYear - startYear) * 12 + endMonth - startMonth) * standard;
                        }
                    }
                    else if (Type == "801" && otherPerson.standard == null &&
                             otherPerson.totalPayed == 5000)
                    {
                        return;
                    }

                    var row = sheet.GetOrCopyRow(currentRow++, startRow);
                    row.Cell("A").SetValue(currentRow - startRow);
                    row.Cell("B").SetValue(otherPerson.region);
                    row.Cell("C").SetValue(otherPerson.name);
                    row.Cell("D").SetValue(otherPerson.idcard);
                    row.Cell("E").SetValue(otherPerson.startYearMonth);
                    row.Cell("F").SetValue(otherPerson.standard?.ToString());
                    row.Cell("G").SetValue(otherPerson.type);
                    row.Cell("H").SetValue(otherPerson.dfState.Name);
                    row.Cell("I").SetValue(otherPerson.jbState.Name);
                    row.Cell("J").SetValue(otherPerson.endYearMonth?.ToString());
                    if (otherPerson.totalPayed != null)
                    {
                        var payed = (decimal)otherPerson.totalPayed;
                        row.Cell("K").SetValue(payed);
                        payedSum += payed;
                    }
                    row.Cell("L").SetValue(payAmount);

                    sum += payAmount;
                });
            });

            var trow = sheet.GetOrCopyRow(currentRow, startRow);

            trow.Cell("A").SetValue("");
            trow.Cell("C").SetValue("共计");
            trow.Cell("D").SetValue(currentRow - startRow);
            trow.Cell("F").SetValue("");
            trow.Cell("J").SetValue("合计");
            trow.Cell("K").SetValue(payedSum);
            trow.Cell("L").SetValue(sum);

            if (!All)
            {
                workbook.Save(Util.StringEx.AppendToFileName(
                                  Program.personListXlsx, $"({OtherPerson.Name(Type)}){date}"));
            }
            else
            {
                workbook.Save(Util.StringEx.AppendToFileName(
                                  Program.personListXlsx, $"({OtherPerson.Name(Type)}ALL){date}"));
            }
        }