Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EditGrhForm"/> class.
        /// </summary>
        /// <param name="gd">The <see cref="GrhData"/> to edit.</param>
        /// <param name="mapGrhWalls">The <see cref="MapGrhWalls"/> instance.</param>
        /// <param name="createWall">Delegate describing how to create wall instances.</param>
        /// <param name="deleteOnCancel">If the <see cref="GrhData"/> will be deleted if the editing is canceled.</param>
        /// <exception cref="ArgumentNullException"><paramref name="gd" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="mapGrhWalls" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="createWall" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentException">Cannot edit an <see cref="AutomaticAnimatedGrhData"/>.</exception>
        public EditGrhForm(GrhData gd, MapGrhWalls mapGrhWalls, CreateWallEntityHandler createWall, bool deleteOnCancel)
        {
            if (gd == null)
            {
                throw new ArgumentNullException("gd");
            }
            if (mapGrhWalls == null)
            {
                throw new ArgumentNullException("mapGrhWalls");
            }
            if (createWall == null)
            {
                throw new ArgumentNullException("createWall");
            }
            if (gd is AutomaticAnimatedGrhData)
            {
                throw new ArgumentException("Cannot edit an AutomaticAnimatedGrhData.", "gd");
            }

            DeleteOnCancel = deleteOnCancel;
            WasCanceled    = false;

            // Set the local members
            _createWall  = createWall;
            _gd          = gd;
            _mapGrhWalls = mapGrhWalls;

            _grh = new Grh(gd, AnimType.Loop, TickCount.Now);

            InitializeComponent();

            ShowGrhInfo();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EditGrhForm"/> class.
        /// </summary>
        /// <param name="gd">The <see cref="GrhData"/> to edit.</param>
        /// <param name="mapGrhWalls">The <see cref="MapGrhWalls"/> instance.</param>
        /// <param name="createWall">Delegate describing how to create wall instances.</param>
        /// <param name="deleteOnCancel">If the <see cref="GrhData"/> will be deleted if the editing is canceled.</param>
        /// <exception cref="ArgumentNullException"><paramref name="gd" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="mapGrhWalls" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="createWall" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentException">Cannot edit an <see cref="AutomaticAnimatedGrhData"/>.</exception>
        public EditGrhForm(GrhData gd, MapGrhWalls mapGrhWalls, CreateWallEntityHandler createWall, bool deleteOnCancel)
        {
            if (gd == null)
                throw new ArgumentNullException("gd");
            if (mapGrhWalls == null)
                throw new ArgumentNullException("mapGrhWalls");
            if (createWall == null)
                throw new ArgumentNullException("createWall");
            if (gd is AutomaticAnimatedGrhData)
                throw new ArgumentException("Cannot edit an AutomaticAnimatedGrhData.", "gd");

            DeleteOnCancel = deleteOnCancel;
            WasCanceled = false;

            // Set the local members
            _createWall = createWall;
            _gd = gd;
            _mapGrhWalls = mapGrhWalls;

            _grh = new Grh(gd, AnimType.Loop, TickCount.Now);

            InitializeComponent();

            ShowGrhInfo();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GlobalState"/> class.
        /// </summary>
        GlobalState()
        {
            ThreadAsserts.IsMainThread();

            // Load all sorts of stuff
            _contentManager = NetGore.Content.ContentManager.Create();

            var dbConnSettings = new DbConnectionSettings();
            _dbController =
                dbConnSettings.CreateDbControllerPromptEditWhenInvalid(x => new ServerDbController(x.GetMySqlConnectionString()),
                    x => dbConnSettings.PromptEditFileMessageBox(x));

            _defaultRenderFont = ContentManager.LoadFont("Font/Arial", 16, ContentLevel.Global);

            Character.NameFont = DefaultRenderFont;

            GrhInfo.Load(ContentPaths.Dev, ContentManager);
            AutomaticGrhDataSizeUpdater.Instance.UpdateSizes();

            _mapGrhWalls = new MapGrhWalls(ContentPaths.Dev, x => new WallEntity(x));

            // Load the child classes
            _mapState = new MapState(this);

            // Grab the audio manager instances, which will ensure that they are property initialized
            // before something that can't pass it an ContentManager tries to get an instance
            AudioManager.GetInstance(ContentManager);

            // Set the custom UITypeEditors
            CustomUITypeEditors.AddEditors(DbController);

            // Set up the timer
            _timer = new Timer { Interval = 1000 / 60 };
            _timer.Tick += _timer_Tick;
        }