Esempio n. 1
0
        public override void Update(GameTime gameTime, bool isInForeground)
        {
            base.Update(gameTime, isInForeground);

            if (!isInForeground)
            {
                return;
            }

            panel.Update(gameTime);

            if (addTileButton.IsPressed())
            {
                if (!String.IsNullOrWhiteSpace(tileName.Text))
                {
                    Tile tile = Tile.GetTile(tileType.List[tileType.CurrentIndex], Resources.World);
                    Form form = tile.GetEditingForm();
                    currentFormScreen = new FormScreen(Manager, form, Resources.World);
                    currentTile       = tile;
                    Manager.OpenScreen(currentFormScreen);
                    return;
                }
            }
            if (currentFormScreen != null && currentFormScreen.IsSubmitted && currentTile != null)
            {
                if (currentTile is LocatedTile)
                {
                    currentTile.SubmitForm(currentFormScreen.Form);
                    currentFormScreen = null;
                    Manager.CloseScreen();
                }
                else
                {
                    currentTile.SubmitForm(currentFormScreen.Form);
                    if (!Tile.UnLocatedTile.ContainsKey(tileName.Text))
                    {
                        Tile.UnLocatedTile.Add(tileName.Text, currentTile);
                    }
                    currentFormScreen = null;
                    currentTile       = null;
                }
            }

            if (submitButton.IsPressed())
            {
                IsSubmitted = true;
                Manager.CloseScreen();
                return;
            }
        }
Esempio n. 2
0
        public override void Update(GameTime gameTime, bool isInForeground)
        {
            base.Update(gameTime, isInForeground);

            if (!isInForeground)
                return;

            panel.Update(gameTime);

            if (addTileButton.IsPressed())
            {
                if (!String.IsNullOrWhiteSpace(tileName.Text))
                {
                    Tile tile = Tile.GetTile(tileType.List[tileType.CurrentIndex], Resources.World);
                    Form form = tile.GetEditingForm();
                    currentFormScreen = new FormScreen(Manager, form, Resources.World);
                    currentTile = tile;
                    Manager.OpenScreen(currentFormScreen);
                    return;
                }
            }
            if (currentFormScreen != null && currentFormScreen.IsSubmitted && currentTile != null)
            {
                if (currentTile is LocatedTile)
                {
                    currentTile.SubmitForm(currentFormScreen.Form);
                    currentFormScreen = null;
                    Manager.CloseScreen();
                }
                else
                {
                    currentTile.SubmitForm(currentFormScreen.Form);
                    if (!Tile.UnLocatedTile.ContainsKey(tileName.Text))
                        Tile.UnLocatedTile.Add(tileName.Text, currentTile);
                    currentFormScreen = null;
                    currentTile = null;
                }
            }

            if (submitButton.IsPressed())
            {
                IsSubmitted = true;
                Manager.CloseScreen();
                return;
            }
        }