Exemplo n.º 1
0
        public void UpdateMapSheet()
        {
            MapTable mt = DC.I.MapTableList[DC.I.MapTableIndex];

            for (int x = 0; x < mt.Width; x++)
            {
                for (int y = 0; y < mt.Height; y++)
                {
                    TileImage tile = mt.Table[y][x].Tile;
                    Image     image;

                    if (this.MapSheet[x, y].Selected)
                    {
                        image = tile.SelectedImage.ImageData;
                    }
                    else
                    {
                        image = tile.NormalImage.ImageData;
                    }

                    if (this.MapSheet[x, y].Value != image)
                    {
                        this.MapSheet[x, y].Value = image;
                    }
                }
            }
        }
Exemplo n.º 2
0
 public Enemy(ImageFile mitame, TileImage ti, string name, ResourceDataList ppl)
 {
     this.Mitame          = mitame;
     this.Tile            = ti;
     this.Name            = name;
     this.ParamPromptList = ppl;
 }
Exemplo n.º 3
0
 public MapCell(TileImage ti, int mapIndex, int xPos, int yPos)
 {
     this.Tile     = ti;
     this.MapIndex = mapIndex;
     this.XPos     = xPos;
     this.YPos     = yPos;
 }
Exemplo n.º 4
0
        public void Touch()
        {
            for (int y = 0; y < this.Height; y++)
            {
                BusyWin.SetMessage("マップ読み込み中... " + y + " / " + this.Height);

                for (int x = 0; x < this.Width; x++)
                {
                    TileImage tile = this.Table[y][x].Tile;

                    if (tile.NormalImage.ImageData == null)
                    {
                    }                                                               // touch
                    if (tile.SelectedImage.ImageData == null)
                    {
                    }                                                                 // touch
                }
            }
        }
Exemplo n.º 5
0
        public void Init()
        {
            this.DefaultTile = new TileImage(
                new ImageFile(Consts.RESOURCE_DIR + "\\normal\\empty.bmp"),
                new ImageFile(Consts.RESOURCE_DIR + "\\selected\\empty.bmp")
                );

            BusyWin.SetMessage("背景オブジェクトを読み込んでいます...");

            {
                string[] niDirs = Directory.GetDirectories(Consts.RESOURCE_DIR + "\\normal\\map");
                string[] siDirs = Directory.GetDirectories(Consts.RESOURCE_DIR + "\\selected\\map");

                for (int index = 0; index < niDirs.Length; index++)
                {
                    string niDir = niDirs[index];
                    string siDir = siDirs[index];

                    this.MapTableList.Add(new MapTable(niDir, siDir, index));
                }

                // Check ...

                if (this.MapTableList.Count < Consts.MAPTABLE_NUM_MIN)
                {
                    throw new Exception("マップテーブルが少なすぎます。");
                }
            }

            BusyWin.SetMessage("敵オブジェクトを読み込んでいます...");

            {
                ResourceData reader = new ResourceData(Consts.DATA_DIR + "\\Enemy.txt");

                DC.I.EnemyCommonParamPromptList = reader.ReadBlock();

                string[] files   = Directory.GetFiles(Consts.RESOURCE_DIR + "\\enemy");
                string[] niFiles = Directory.GetFiles(Consts.RESOURCE_DIR + "\\normal\\enemy");
                string[] siFiles = Directory.GetFiles(Consts.RESOURCE_DIR + "\\selected\\enemy");

                for (int index = 0; ; index++)
                {
                    string name = reader.ReadValue();

                    if (name == ResourceData.DEFAULT_VALUE)
                    {
                        break;
                    }

                    this.EnemyList.Add(new Enemy(
                                           new ImageFile(files[index]),
                                           new TileImage(
                                               new ImageFile(niFiles[index]),
                                               new ImageFile(siFiles[index])
                                               ),
                                           name,
                                           reader.ReadBlock()
                                           ));
                }
            }

            BusyWin.SetMessage("フィールドマップを読み込んでいます...");

            {
                ResourceData backTable  = new ResourceData(Consts.DATA_DIR + "\\WallData.txt");
                ResourceData frontTable = new ResourceData(Consts.DATA_DIR + "\\StageData.txt");

                DC.I.FieldMap = new FieldTable(backTable, frontTable);
            }

            BusyWin.SetMessage("初期化を続行しています...");

            {
                ResourceData reader = new ResourceData(Consts.DATA_DIR + "\\Settings.txt");

                DC.I.FieldScrollMax = Tools.ParseInt(reader.ReadValue(), -1, Consts.FIELDMAP_W_MIN, Consts.FIELDMAP_W_MAX);
            }
        }
Exemplo n.º 6
0
        public void AddTileSheet(TileSheet sheet)
        {
            const int MAX_COLS = 4;

            // Create Grid
            int numTiles = sheet.GetNumTiles();
            int numRows  = numTiles / MAX_COLS;

            if (numTiles % MAX_COLS > 0)
            {
                ++numRows;
            }

            Grid sheetGrid = new Grid();

            // Add Rows
            for (int index = 0; index < numRows; ++index)
            {
                RowDefinition row = new RowDefinition();
                row.Height = GridLength.Auto;
                sheetGrid.RowDefinitions.Add(row);
            }
            // Add Cols
            for (int index = 0; index < MAX_COLS; ++index)
            {
                ColumnDefinition col = new ColumnDefinition();
                col.Width = GridLength.Auto;
                sheetGrid.ColumnDefinitions.Add(col);
            }

            // Add Images
            int currCol = 0;
            int currRow = 0;

            Int32Rect         srcRect = new Int32Rect(0, 0, TileSheet.TILE_DISPLAY_SIZE, TileSheet.TILE_DISPLAY_SIZE);
            BitmapSizeOptions opts    = BitmapSizeOptions.FromEmptyOptions();

            for (int index = 0; index < numTiles; ++index)
            {
                IntPtr srcBits = (sheet.GetTileSourceAt(index));
                if (srcBits == IntPtr.Zero)
                {
                    UpdateSysMsg("Error loading Image Source for Sheet: " + sheet.GetFileName() + " Index: " + index.ToString());
                    continue;
                }
                var       bmpSrc  = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(srcBits, IntPtr.Zero, srcRect, opts);
                TileImage nextImg = new TileImage(sheet.GetID(), index);
                nextImg.Margin             = new Thickness(3);
                nextImg.Source             = bmpSrc;
                nextImg.MouseLeftButtonUp += TileButtonClicked;

                sheetGrid.Children.Add(nextImg);
                Grid.SetRow(nextImg, currRow);
                Grid.SetColumn(nextImg, currCol);

                ++currCol;

                if (currCol >= MAX_COLS)
                {
                    currCol = 0;
                    ++currRow;
                }
            }

            // Create Expander
            Expander sheetExpander = new Expander();

            sheetExpander.Header  = sheet.GetFileName();
            sheetExpander.Content = sheetGrid;

            tileStackPanel.Children.Add(sheetExpander);
        }