コード例 #1
0
        public void Draw()
        {
            Logic.CurrentParty.MainParty.MyParty[0].SetViewToThisNPC(_screen);
            Logic.CurrentParty.MainParty.MyParty[0].CurMap.DrawMap(_screen);
            Logic.CurrentParty.MainParty.MyParty[0].CurMap.DrawSpawnBot(_screen);
            Logic.CurrentParty.MainParty.MyParty[0].CurMap.DrawNPC(_screen);
            int tempx = Logic.CurrentParty.MainParty.MyParty[0].LastX; int tempy = Logic.CurrentParty.MainParty.MyParty[0].LastY;

            for (int i = Logic.CurrentParty.MainParty.MyParty[0].PathfindingPath.Count - 1; i >= 0; i--)
            {
                switch (Logic.CurrentParty.MainParty.MyParty[0].PathfindingPath[i])
                {
                    case 0:
                        tempx--;
                        break;
                    case 1:
                        tempy--;
                        break;
                    case 2:
                        tempx++;
                        break;
                    case 3:
                        tempy++;
                        break;
                }
                _rect.Position = new Vector2f((tempx + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinX) * 16, (tempy + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinY) * 16);
                _screen.Draw(_rect);

            }

            Logic.CurrentParty.MainParty.MyParty[0].Draw(_screen);
            Logic.CurrentParty.MainParty.MyParty[0].CurMap.DrawSpawnFringe(_screen);

            _screen.SetView(new View(new FloatRect(0, 0, _screen.Size.X, _screen.Size.Y)));
            _rect.Position = new Vector2f(Mouse.GetPosition(_screen).X / 16 * 16, (Mouse.GetPosition(_screen).Y - 8) / 16 * 16 + 8);
            _screen.Draw(_rect);

            Logic.CurrentParty.MainParty.MyParty[0].SetViewToThisNPC(_screen);
            switch (ClickState)
            {
                case 0:
                    SpawnBuildable b = new SpawnBuildable(CurrentObjectIndex, -1, -1);
                    bool block = false;
                    for (int r = (int)(Mouse.GetPosition(_screen).Y + 8) / 16 + Logic.CurrentParty.MainParty.MyParty[0].Y - (int)_screen.Size.Y / 2 / 16 - 1 + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinY; r < (int)(Mouse.GetPosition(_screen).Y + 8) / 16 + Logic.CurrentParty.MainParty.MyParty[0].Y - (int)_screen.Size.Y / 2 / 16 - 1 + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinY + Program.Data.GetBuildableList()[CurrentObjectIndex].SizeY; r++)
                    {
                        for (int c = (int)Mouse.GetPosition(_screen).X / 16 + Logic.CurrentParty.MainParty.MyParty[0].X - (int)_screen.Size.X / 2 / 16 - 1 + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinX; c < (int)Mouse.GetPosition(_screen).X / 16 + Logic.CurrentParty.MainParty.MyParty[0].X - (int)_screen.Size.X / 2 / 16 - 1 + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinX + Program.Data.GetBuildableList()[CurrentObjectIndex].SizeX; c++)
                        {
                            if (Logic.BlockedAt(c, r, Logic.CurrentParty.MainParty.MyParty[0].CurMap, 1))
                            {
                                block = true;
                                break;
                            }
                        }
                    }
                    if (block)
                    {
                        b.DrawBot(_screen, (int)Mouse.GetPosition(_screen).X / 16 + Logic.CurrentParty.MainParty.MyParty[0].X - (int)_screen.Size.X / 2 / 16 - 1, (int)(Mouse.GetPosition(_screen).Y + 8) / 16 + Logic.CurrentParty.MainParty.MyParty[0].Y - (int)_screen.Size.Y / 2 / 16 - 1, true);
                        b.DrawTop(_screen, (int)Mouse.GetPosition(_screen).X / 16 + Logic.CurrentParty.MainParty.MyParty[0].X - (int)_screen.Size.X / 2 / 16 - 1, (int)(Mouse.GetPosition(_screen).Y + 8) / 16 + Logic.CurrentParty.MainParty.MyParty[0].Y - (int)_screen.Size.Y / 2 / 16 - 1, true);
                    }
                    else
                    {
                        b.DrawBot(_screen, (int)Mouse.GetPosition(_screen).X / 16 + Logic.CurrentParty.MainParty.MyParty[0].X - (int)_screen.Size.X / 2 / 16 - 1, (int)(Mouse.GetPosition(_screen).Y + 8) / 16 + Logic.CurrentParty.MainParty.MyParty[0].Y - (int)_screen.Size.Y / 2 / 16 - 1, false);
                        b.DrawTop(_screen, (int)Mouse.GetPosition(_screen).X / 16 + Logic.CurrentParty.MainParty.MyParty[0].X - (int)_screen.Size.X / 2 / 16 - 1, (int)(Mouse.GetPosition(_screen).Y + 8) / 16 + Logic.CurrentParty.MainParty.MyParty[0].Y - (int)_screen.Size.Y / 2 / 16 - 1, false);
                    }
                    break;
                default:
                    break;
            }

            foreach (GUI g in GameGUI)
            {
                if (g.Visibility)
                    g.Draw();
            }

            if (!GameGUI[4].Visibility)
                GameGUI[4].MyButton[5].Draw();

            Logic.CurrentParty.MainParty.MyParty[0].SetViewToThisNPC(_screen);
            Logic.CurrentParty.MainParty.MyParty[0].CurMap.DrawAnimation(_screen);
            Logic.CurrentParty.MainParty.MyParty[0].CurMap.DrawMiniText(_screen);
        }
コード例 #2
0
ファイル: Logic.cs プロジェクト: ComposerCookie/WanderingSoul
 public static SpawnBuildable GetBuildableTypeBasedOnID(int id, int x, int y, Map m)
 {
     SpawnBuildable b = new SpawnBuildable();
     if (Program.Data.GetBuildableList()[id] is BuildFire)
     {
         b = new SpawnBuildableFire(id, x, y, m);
     }
     return b;
 }