コード例 #1
0
        /// <summary>

        /// Constructor

        /// </summary>

        public PageManager(SceneNode rootNode)

        {
            if (instance != null)

            {
                throw new ApplicationException("PageManager.Constructor() called twice!");
            }

            instance = this;



            sceneRoot = rootNode;

            currentCameraPageX = 0;
            currentCameraPageZ = 0;
            currentCameraTileX = 0;
            currentCameraTileZ = 0;

            lastCameraPageState = CameraPageState.Change;

            lastCameraPos = new Vector3(-999999, 9999999, -999999);

            pause = 99;

            width  = Options.Instance.World_Width;
            heigth = Options.Instance.World_Height;

            pageLoadQueue       = new PageQueue();
            pageUnloadQueue     = new PageQueue();
            pagePreloadQueue    = new PageQueue();
            pagePostunloadQueue = new PageQueue();
            //setup the page array.
            //    mPages.reserve (mWidth);
            //    mPages.resize (mWidth);
            pages = new Pages(width);
            for (long i = 0; i < width; i++)
            {
                PageRow pr = new PageRow(heigth);

                //        mPages[ i ].reserve (mHeigth);
                //        mPages[ i ].resize (mHeigth);
                for (long j = 0; j < heigth; j++)
                {
                    pr.Add(new Page(i, j));
                }

                pages.Add(pr);
            }

            for (long j = 0; j < heigth; j++)
            {
                for (long i = 0; i < width; i++)
                {
                    if (j != heigth - 1)
                    {
                        pages[i][j].SetNeighbor(Neighbor.South, pages[i][j + 1]);
                        pages[i][j + 1].SetNeighbor(Neighbor.North, pages[i][j]);
                    }

                    if (i != width - 1)
                    {
                        pages[i][j].SetNeighbor(Neighbor.East, pages[i + 1][j]);
                        pages[i + 1][j].SetNeighbor(Neighbor.West, pages[i][j]);
                    }
                }
            }
        }
コード例 #2
0
        private UInt32Value CreateDataTableRow(Worksheet worksheet, SheetData sheetData, UInt32Value currentRowIndex, PageRow pageRow)
        {
            Row tableRow = new Row {
                RowIndex = currentRowIndex
            };

            if (!string.IsNullOrWhiteSpace(pageRow.Day))
            {
                string[] dateComponents = pageRow.Day.Split('-');
                DateTime day            = new DateTime(int.Parse(dateComponents[0]), int.Parse(dateComponents[1]), int.Parse(dateComponents[2]));
                Cell     tableCell_Date = new Cell
                {
                    DataType      = CellValues.String,
                    CellValue     = new CellValue(day.ToShortDateString()),
                    CellReference = $"A{currentRowIndex}",
                    StyleIndex    = 0,
                };

                Cell tableCell_Description = new Cell
                {
                    DataType      = CellValues.String,
                    CellValue     = new CellValue(pageRow.Description),
                    CellReference = $"B{currentRowIndex}",
                    StyleIndex    = 0,
                };

                Cell tableCell_DailyTotal = new Cell
                {
                    DataType      = CellValues.Number,
                    CellValue     = new CellValue(Convert.ToString(pageRow.DailyTotal.Value)),
                    CellReference = $"C{currentRowIndex}",
                    StyleIndex    = 0,
                };

                tableRow.Append(tableCell_Date, tableCell_Description, tableCell_DailyTotal);
            }
            else
            {
                Cell tableCell_VatCode = new Cell
                {
                    DataType      = CellValues.String,
                    CellValue     = new CellValue(pageRow.VatCode),
                    CellReference = $"D{currentRowIndex}",
                    StyleIndex    = 0,
                };

                Cell tableCell_Amount = new Cell
                {
                    DataType      = CellValues.Number,
                    CellValue     = new CellValue(Convert.ToString(pageRow.Amount.Value)),
                    CellReference = $"E{currentRowIndex}",
                    StyleIndex    = 0,
                };

                Cell tableCell_Vat = new Cell
                {
                    DataType      = CellValues.Number,
                    CellValue     = new CellValue(Convert.ToString(pageRow.Vat.Value)),
                    CellReference = $"F{currentRowIndex}",
                    StyleIndex    = 0,
                };

                Cell tableCell_Total = new Cell
                {
                    DataType      = CellValues.Number,
                    CellValue     = new CellValue(Convert.ToString(pageRow.Total.Value)),
                    CellReference = $"G{currentRowIndex}",
                    StyleIndex    = 0,
                };

                tableRow.Append(tableCell_VatCode, tableCell_Amount, tableCell_Vat, tableCell_Total);
            }

            sheetData.Append(tableRow);

            return(currentRowIndex);
        }