public void Update(GameTime gameTime, GraphicsDevice graphicsDevice)
        {
            guiSystem.Update();

            // Update the Scrollable Lists


            ChallengeSelectionList.Update(gameTime);
        }
Esempio n. 2
0
        public override void Update(GameTime gameTime)
        {
            if (SimulationGame.IsWorldBuilderOpen)
            {
                base.Update(gameTime);

                setSelectedButtonColor();

                if (placementType != PlacementType.NoType && placementType != PlacementType.Inspect && placementType != PlacementType.WorldPartDetails)
                {
                    switch (placementMode)
                    {
                    case PlacementMode.Manage:
                        manageObjectList.Update(gameTime);

                        if (manageObjectList.SelectedElement != null)
                        {
                            editBtn.Update(gameTime);
                            createNewFromBtn.Update(gameTime);
                            removeBtn.Update(gameTime);
                        }
                        break;

                    case PlacementMode.ChooseTileset:
                        tilesetSelectionList.Update(gameTime);
                        break;

                    case PlacementMode.CreateFromTileset:
                        tileSetSelectionView.Update(gameTime);

                        if (tileSetSelectionView.SelectedSpritePosition != null)
                        {
                            createBtn.Update(gameTime);
                            createIfNotExistBtn.Update(gameTime);
                        }

                        break;
                    }

                    manageBtn.Update(gameTime);
                    createFromJsonBtn.Update(gameTime);

                    if (placementType != PlacementType.LivingEntityPlacement)
                    {
                        createFromTilesetBtn.Update(gameTime);
                    }
                }
                else if (placementType == PlacementType.WorldPartDetails)
                {
                    changePersistencyBtn.Update(gameTime);
                    createWorldLinkBtn.Update(gameTime);
                    createInteriorBtn.Update(gameTime);

                    if (SimulationGame.Player.InteriorID != Interior.Outside)
                    {
                        changeInteriorDimensionsBtn.Update(gameTime);
                        removeInteriorBtn.Update(gameTime);
                    }

                    var       player           = SimulationGame.Player;
                    WorldPart currentWorldPart = player.InteriorID == Interior.Outside ? (WorldPart)SimulationGame.World.GetFromRealPoint((int)player.Position.X, (int)player.Position.Y) : SimulationGame.World.InteriorManager.Get(player.InteriorID);

                    worldPartDetailsTextView.SetText(
                        "CurrentBlock: " + player.BlockPosition.X + "," + player.BlockPosition.Y + "\n" +
                        "IsPersistent: " + currentWorldPart.IsPersistent + "\n" +
                        "InteriorID: " + player.InteriorID + "\n" +
                        (player.InteriorID != Interior.Outside ? ("Dimensions: " + ((Interior)currentWorldPart).Dimensions + "\n") : "")
                        );
                    worldPartDetailsTextView.Update(gameTime);
                }
                else if (placementType == PlacementType.Inspect)
                {
                    if (inspectView.SelectedGameObjects.Count > 0)
                    {
                        selectedObjectDetailTextView.SetText(WorldObjectSerializer.Serialize(inspectView.SelectedGameObjects[0]).ToString(Formatting.Indented));

                        editInstanceBtn.Update(gameTime);
                        removeInstanceBtn.Update(gameTime);
                        showInstanceTypeBtn.Update(gameTime);
                    }
                    else if (inspectView.SelectedWorldLink != null)
                    {
                        selectedObjectDetailTextView.SetText(JToken.FromObject(inspectView.SelectedWorldLink, SerializationUtils.Serializer).ToString(Formatting.Indented));

                        editInstanceBtn.Update(gameTime);
                        removeInstanceBtn.Update(gameTime);
                    }

                    selectedObjectDetailTextView.Update(gameTime);
                }

                if ((placementMode == PlacementMode.Manage && manageObjectList.SelectedElement != null) ||
                    (placementMode == PlacementMode.CreateFromTileset && tileSetSelectionView.SelectedObject != null))
                {
                    placeView.Update(gameTime);
                }
                else
                {
                    inspectView.Update(gameTime);
                }
            }
        }