/// <summary>
        /// Constructor
        /// </summary>
        public RoadDisplay()
        {
            // create the display
            InitializeComponent();

            // make sure we're not in design mode
            if (!this.DesignMode)
            {
                // initialize the tranform before calling InitializeComponent so the OnResize method works properly
                transform = new WorldTransform();

                // set our style
                base.SetStyle(ControlStyles.UserPaint, true);
                base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
                base.SetStyle(ControlStyles.Opaque, true);
                base.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
                base.SetStyle(ControlStyles.ResizeRedraw, true);
                base.SetStyle(ControlStyles.Selectable, true);

                // set new display objects
                displayObjects = new List <IDisplayObject>();

                // display grid
                DisplayGrid = new GridDisplay();
                displayObjects.Add(DisplayGrid);

                // context menu
                this.vehicleContextMenuStrip1.Closing += new ToolStripDropDownClosingEventHandler(vehicleContextMenuStrip1_Closing);
            }
        }
        internal bool PlayTurn(Player player, Grid grid, GridDisplay gridDisplay)
        {
            gridDisplay.RenderGrid(grid);

            while (true)
            {
                int x = player.GetPosition('x');
                int y = player.GetPosition('y');

                if (x >= board.GetLength(0) || y >= board.GetLength(1))
                {
                    Console.WriteLine("Position off the board. Enter different position.");
                }
                else if (board[x, y] != ' ')
                {
                    Console.WriteLine("Position full. Enter different position.");
                }
                else
                {
                    grid.UpdateSquare(x, y, player.GetMove());
                    break;
                }
            }

            if (grid.CheckWin())
            {
                return(true);
            }

            return(false);
        }
Exemple #3
0
        public static GridDisplay GetDisplayForGrid(Grid grid)
        {
            GridDisplay result = null;

            result = new SquareDisplay();

            if (grid is PolarGrid)
            {
                result = new PolarDisplay();
            }

            if (grid is HexGrid)
            {
                result = new HexDisplay();
            }

            if (grid is TriangleGrid)
            {
                result = new TriangleDisplay();
            }

            if (grid is UpsilonGrid)
            {
                result = new UpsilonDisplay();
            }

            if (grid is WeaveGrid)
            {
                result = new WeaveDisplay();
            }

            result.InitGrid(grid);
            return(result);
        }
 /// <summary>
 /// Loads the display from a save point
 /// </summary>
 /// <param name="save"></param>
 public void LoadSave(DisplaySave save)
 {
     // set fields
     displayObjects        = save.displayObjects;
     transform.CenterPoint = save.center;
     transform.Scale       = save.scale;
     DisplayGrid           = save.DisplayGrid;
 }
Exemple #5
0
    void OnTriggerEnter(Collider collision)
    {
        Instantiate(TokenParticlePrefab, GameObj.transform.position, GameObj.transform.rotation);

        TokenSpawner.RemoveWithId(_id);

        Destroy(gameObject);

        GridDisplay.HitTokenUpdate(collision.gameObject.GetComponent <HoverMotor>().id, Metronome.CurTokenCycle, _tokenColour);
    }
    void Start()
    {
        _gameManager = GameManager.Instance();

        // Create empty grid data
        _gridData = new GridData(_gridWidth, _gridHeight);

        // Create the grid graphics
        _gridDisplay = GameObject.Find("Grid").GetComponent <GridDisplay>();
        _gridDisplay.CreateTiles(_gridData);
    }
Exemple #7
0
 public void Draw(GridDisplay grid)
 {
     foreach (Point position in Positions())
     {
         grid.Put(this[position].ToChar(), position.X, position.Y, new Color(255, 255, 255));
         if (this[position].Mob != null)
         {
             Console.WriteLine("Mob = {0} at x = {1} y = {2}", this[position].Mob.Name, position.X, position.Y);
             this[position].Mob.Draw();
         }
     }
 }
        public void LoadPreferences()
        {
            Directory.SetCurrentDirectory(m_filepath_root);

            //m_filepath_root = UserPrefs.GetString("filepath_root", m_filepath_root);
            m_filepath_decal_textures = UserPrefs.GetString("filepath_decal_textures", m_filepath_decal_textures);
            m_filepath_level_textures = UserPrefs.GetString("filepath_level_textures", m_filepath_level_textures);
            m_filepath_decals         = UserPrefs.GetString("filepath_decals", m_filepath_decals);

            m_grid_display = (GridDisplay)UserPrefs.GetInt("grid_display", (int)m_grid_display);
            m_grid_spacing = UserPrefs.GetFloat("grid_spacing", m_grid_spacing);
            SetGridLines();
            m_grid_snap = UserPrefs.GetFloat("grid_snap", m_grid_snap);

            m_extrude_length = UserPrefs.GetFloat("extrude_length", m_extrude_length);
            m_inset_pct      = UserPrefs.GetInt("inset_pct", m_inset_pct);
            m_inset_length   = UserPrefs.GetFloat("inset_length", m_inset_length);
            m_bevel_width    = UserPrefs.GetFloat("bevel_width", m_bevel_width);

            m_coplanar_tol = UserPrefs.GetInt("coplanar_tol", m_coplanar_tol);
            m_side_select  = (SideSelect)UserPrefs.GetInt("side_select", (int)m_side_select);
            m_drag_mode    = (DragMode)UserPrefs.GetInt("drag_mode", (int)m_drag_mode);

            m_view_mode_ortho = (ViewMode)UserPrefs.GetInt("view_mode_ortho", (int)m_view_mode_ortho);
            m_view_mode_persp = (ViewMode)UserPrefs.GetInt("view_mode_persp", (int)m_view_mode_persp);
            m_view_persp_fov  = UserPrefs.GetInt("view_persp_fov", m_view_persp_fov);
            m_view_layout     = (ViewLayout)UserPrefs.GetInt("view_layout", (int)m_view_layout);
            m_bg_color        = (BGColor)UserPrefs.GetInt("bg_color", (int)m_bg_color);
            m_gimbal_display  = (GimbalDisplay)UserPrefs.GetInt("gimbal_display", (int)m_gimbal_display);
            m_lighting_type   = (LightingType)UserPrefs.GetInt("lighting_type", (int)m_lighting_type);
            m_pivot_mode      = (PivotMode)UserPrefs.GetInt("pivot_mode", (int)m_pivot_mode);

            m_low_res_force = UserPrefs.GetBool("low_res_force", m_low_res_force);
            forceLowResTexturesToolStripMenuItem.Checked = m_low_res_force;

            m_tex_list_loc       = UserPrefs.GetPoint("tex_list_loc", texture_list.Location);
            m_tex_list_sz        = UserPrefs.GetPoint("tex_list_sz", (Point)texture_list.Size);
            m_tunnel_builder_loc = UserPrefs.GetPoint("tunnel_builder_loc", tunnel_builder.Location);
            texture_list.Size    = (Size)m_tex_list_sz;

            for (int i = 0; i < RECENT_NUM; i++)
            {
                m_recent_files[i] = UserPrefs.GetString("recent" + i.ToString(), m_recent_files[i]);
            }
            UpdateRecentFileMenu();
        }
        internal void Start()
        {
            Grid        grid        = new Grid(3, 3);
            GridDisplay gridDisplay = new GridDisplay();
            Player      playerOne   = new Player('O');
            Player      playerTwo   = new Player('X');
            string      winner      = "None";

            int i = 0;

            while (true)
            {
                if (grid.PlayTurn(playerOne, grid, gridDisplay))
                {
                    winner = "Player One";
                    break;
                }

                i++;

                if (i >= grid.spaces)
                {
                    break;
                }

                if (grid.PlayTurn(playerTwo, grid, gridDisplay))
                {
                    winner = "Player Two";
                    break;
                }

                i++;

                if (i >= grid.spaces)
                {
                    break;
                }
            }

            gridDisplay.RenderGrid(grid);

            Console.WriteLine("Winner: {0}", winner);
            Console.Write("Press any key to exit > ");
            Console.ReadKey();
        }
        /// <summary>
        /// Resets teh display
        /// </summary>
        public void Reset()
        {
            // set new display objects
            displayObjects = new List <IDisplayObject>();

            // display grid
            DisplayGrid = new GridDisplay();
            displayObjects.Add(DisplayGrid);

            // center transform
            transform.CenterPoint = new Coordinates(0, 0);

            // default zoom
            transform.Scale = 6.0f;

            // redraw
            this.Invalidate();
        }
Exemple #11
0
    public void Play()
    {
        // TODO :: make this use switch statements to chose exactly which track to play (actually better yet, use a different function.

        Metronome.BeatsInSection = 191;

        //Debug.Log("PLAYYINNNGGGGG SECTION");

        bool noMusic = true;

        // TODO: implement some kind of dictionary? maybe ["player"l.TrackEnabler[0]Counter
        if (GridDisplay.GetPlayerTokens(0) > 0)
        {
            //Debug.Log("Drums Play Again");

            IndexOne = getIndexFromColour(GridDisplay.GetPlayerTokenColour(0));

            Drums[IndexOne].time = 0.0f;
            Drums[IndexOne].Play();

            SoundOnePlay = true;
            noMusic      = false;
        }
        if (GridDisplay.GetPlayerTokens(1) > 0)
        {
            //Debug.Log("MelodyPlays Again");

            IndexTwo = getIndexFromColour(GridDisplay.GetPlayerTokenColour(1));

            Melody[IndexTwo].time = 0.0f;
            Melody[IndexTwo].Play();

            SoundTwoPlay = true;
            noMusic      = false;
        }

        if (noMusic && !(SoundOnePlay || SoundTwoPlay))
        {
            BasicClick.Play();
        }
    }
Exemple #12
0
        static void Main(string[] args)
        {
            Console.Clear();

            var p1 = GridDisplay.DrawGrid(s_HorizPadding, s_VertPadding);
            var p2 = GridDisplay.DrawGrid(p1.MaxX + s_HorizPadding, s_VertPadding);

            var setupInput = new SetupInput(p1.MaxY + s_VertPadding);

            if (!setupInput.RunSetup(p1))
            {
                return;
            }

            var playInput = new PlayInput(p1.MaxY + s_VertPadding);

            playInput.RunPlay(setupInput.SetupBoard, p1, p2);

#if DEBUG
            Console.SetCursorPosition(0, Console.CursorTop + 10);
#endif
        }
    void Start()
    {
        _gameManager = GameManager.Instance();

        // Create empty grid data
        _gridData = new GridData(_gridWidth, _gridHeight);

        // Create the grid graphics
        _gridDisplay = GameObject.Find("Grid").GetComponent<GridDisplay>();
        _gridDisplay.CreateTiles(_gridData);
    }
 public void CycleGridDisplay()
 {
     m_grid_display = (GridDisplay)(((int)m_grid_display + 1) % (int)GridDisplay.NUM);
     UpdateOptionLabels();
     this.Refresh();
 }
        public void LoadPreferences()
        {
            Directory.SetCurrentDirectory(m_filepath_root);

            m_grid_display = (GridDisplay)UserPrefs.GetInt("grid_display", (int)m_grid_display);
            m_grid_spacing = UserPrefs.GetInt("grid_spacing", m_grid_spacing);
            m_grid_snap    = UserPrefs.GetFloat("grid_snap", m_grid_snap);

            m_coplanar_tol   = UserPrefs.GetInt("coplanar_tol", m_coplanar_tol);
            m_rotate_angle   = UserPrefs.GetInt("rotate_angle", m_rotate_angle);
            m_side_select    = (SideSelect)UserPrefs.GetInt("side_select", (int)m_side_select);
            m_insert_advance = UserPrefs.GetBool("insert_advance", m_insert_advance);
            m_drag_mode      = (DragMode)UserPrefs.GetInt("drag_mode", (int)m_drag_mode);

            m_view_mode_ortho   = (ViewMode)UserPrefs.GetInt("view_mode_ortho", (int)m_view_mode_ortho);
            m_view_mode_persp   = (ViewMode)UserPrefs.GetInt("view_mode_persp", (int)m_view_mode_persp);
            m_view_persp_fov    = UserPrefs.GetInt("view_persp_fov", m_view_persp_fov);
            m_view_layout       = (ViewLayout)UserPrefs.GetInt("view_layout", (int)m_view_layout);
            m_bg_color          = (BGColor)UserPrefs.GetInt("bg_color", (int)m_bg_color);
            m_gimbal_display    = (GimbalDisplay)UserPrefs.GetInt("gimbal_display", (int)m_gimbal_display);
            m_lighting_type     = (LightingType)UserPrefs.GetInt("lighting_type", (int)m_lighting_type);
            m_cp_display        = (ClipPlaneDisplay)UserPrefs.GetInt("clip_decal", (int)m_cp_display);
            m_insert_decal      = (InsertDecal)UserPrefs.GetInt("insert_decal", (int)m_insert_decal);
            m_show_3d_text_type = (ShowTextType)UserPrefs.GetInt("show_segment_numbers", (int)m_show_3d_text_type);
            m_auto_center       = UserPrefs.GetBool("auto_center", m_auto_center);

            m_decal_list_loc       = UserPrefs.GetPoint("decal_list_loc", decal_list.Location);
            m_decal_list_sz        = UserPrefs.GetPoint("decal_list_sz", (Point)decal_list.Size);
            m_tex_list_loc         = UserPrefs.GetPoint("tex_list_loc", texture_list.Location);
            m_tex_list_sz          = UserPrefs.GetPoint("tex_list_sz", (Point)texture_list.Size);
            m_texture_set_list_loc = UserPrefs.GetPoint("texture_set_list_loc", texture_list.Location);
            m_texture_set_list_sz  = UserPrefs.GetPoint("texture_set_list_sz", (Point)texture_list.Size);
            m_uv_editor_loc        = UserPrefs.GetPoint("uv_editor_loc", uv_editor.Location);
            m_uv_editor_sz         = UserPrefs.GetPoint("uv_editor_sz", (Point)uv_editor.Size);

            decal_list.Size   = (Size)m_decal_list_sz;
            texture_list.Size = (Size)m_tex_list_sz;
            uv_editor.Size    = (Size)m_uv_editor_sz;

            for (int i = 0; i < NumRecentFiles; i++)
            {
                string recent_file = GetRecentFile(i);
                SetRecentFile(i, UserPrefs.GetString("recent" + i.ToString(), recent_file));
            }
            Shell.UpdateRecentFileMenu();

            m_pivot_mode = (PivotMode)UserPrefs.GetInt("entity_pivot", (int)m_pivot_mode);

            m_editor_layout = UserPrefs.GetString("layout", string.Empty);

            //Save whether pop-up windows are open at startup
            m_decal_list_visible       = UserPrefs.GetBool("decal_list_vis", false);
            m_texture_list_visible     = UserPrefs.GetBool("tex_list_vis", false);
            m_texture_set_list_visible = UserPrefs.GetBool("texture_set_list_vis", false);
            m_uv_editor_visible        = UserPrefs.GetBool("uv_editor_vis", false);

#if !PUBLIC_RELEASE
            Overload.Perforce.m_cached_username   = UserPrefs.GetString("m_cached_username", string.Empty);
            Overload.Perforce.m_cached_clientname = UserPrefs.GetString("m_cached_clientname", string.Empty);
#endif // !PUBLIC_RELEASE

            m_mm_edit_type = (EditMode)UserPrefs.GetInt("mm_edit_type", (int)m_mm_edit_type);
            m_mm_op_mode   = (OperationMode)UserPrefs.GetInt("mm_op_mode", (int)m_mm_op_mode);

            //Read texture collections
            int num_texture_collections = UserPrefs.GetInt("num_texture_collections", 0);
            for (int c = 0; c < num_texture_collections; c++)
            {
                TextureCollections.Add(new TextureCollection(UserPrefs.GetString("texture_collection_" + c), true));
            }
        }