示例#1
0
        private void DeleteVoxels(IEnumerable <Voxel> refs)
        {
            foreach (Voxel v in refs.Select(r => r).Where(v => !v.IsEmpty))
            {
                if (IsBuildDesignation(v))
                {
                    BuildVoxelOrder vox = GetBuildDesignation(v);
                    vox.ToBuild.Destroy();
                    BuildDesignations.Remove(vox.Order);
                }
                else if (IsInRoom(v))
                {
                    Room existingRoom = GetMostLikelyRoom(v);

                    if (existingRoom == null)
                    {
                        continue;
                    }

                    World.NewGui.ShowDialog(new NewGui.Confirm
                    {
                        Text    = "Do you want to destroy this" + existingRoom.RoomData.Name + "?",
                        OnClose = (sender) => destroyDialog_OnClosed((sender as NewGui.Confirm).DialogResult, existingRoom)
                    });

                    break;
                }
            }
        }
示例#2
0
        private void DeleteVoxels(IEnumerable <Voxel> refs)
        {
            foreach (Voxel v in refs.Select(r => r).Where(v => !v.IsEmpty))
            {
                if (IsBuildDesignation(v))
                {
                    BuildVoxelOrder vox = GetBuildDesignation(v);
                    vox.ToBuild.Destroy();
                    BuildDesignations.Remove(vox.Order);
                }
                else if (IsInRoom(v))
                {
                    Room existingRoom = GetMostLikelyRoom(v);

                    if (existingRoom == null)
                    {
                        continue;
                    }

                    Dialog destroyDialog = Dialog.Popup(PlayState.GUI, "Destroy room?",
                                                        "Do you want to destroy this " + existingRoom.RoomData.Name + "?", Dialog.ButtonType.OkAndCancel);
                    destroyDialog.OnClosed += (status) => destroyDialog_OnClosed(status, existingRoom);
                    break;
                }
            }
        }
示例#3
0
        public void CheckRemovals()
        {
            List <BuildRoomOrder> toRemove = BuildDesignations.Where(build => build.IsBuilt).ToList();

            foreach (BuildRoomOrder build in toRemove)
            {
                BuildDesignations.Remove(build);
            }
        }
示例#4
0
        public void CheckRemovals()
        {
            List <BuildRoomOrder> toRemove = BuildDesignations.Where(build => build.IsBuilt).ToList();

            foreach (BuildRoomOrder build in toRemove)
            {
                if (build.DisplayWidget != null)
                {
                    World.Gui.DestroyWidget(build.DisplayWidget);
                }
                BuildDesignations.Remove(build);
            }
        }
示例#5
0
        void destroyDialog_OnClosed(Dialog.ReturnStatus status, Room room)
        {
            if (status == Dialog.ReturnStatus.Ok)
            {
                DesignatedRooms.Remove(room);

                List <BuildVoxelOrder> existingDesignations = GetDesignationsAssociatedWithRoom(room);
                BuildRoomOrder         buildRoomDes         = null;
                foreach (BuildVoxelOrder des in existingDesignations)
                {
                    des.Order.VoxelOrders.Remove(des);
                    buildRoomDes = des.Order;
                }

                BuildDesignations.Remove(buildRoomDes);

                room.Destroy();
            }
        }
示例#6
0
        void destroyDialog_OnClosed(NewGui.Confirm.Result status, Room room)
        {
            if (status == NewGui.Confirm.Result.OKAY)
            {
                DesignatedRooms.Remove(room);

                List <BuildVoxelOrder> existingDesignations = GetDesignationsAssociatedWithRoom(room);
                BuildRoomOrder         buildRoomDes         = null;
                foreach (BuildVoxelOrder des in existingDesignations)
                {
                    des.Order.VoxelOrders.Remove(des);
                    buildRoomDes = des.Order;
                }

                BuildDesignations.Remove(buildRoomDes);

                room.Destroy();
            }
        }
示例#7
0
        private void DeleteVoxels(IEnumerable <VoxelHandle> Voxels)
        {
            if (Voxels == null)
            {
                return;
            }

            foreach (var v in Voxels.Where(v => v.IsValid && !v.IsEmpty))
            {
                if (IsBuildDesignation(v))
                {
                    BuildVoxelOrder vox = GetBuildDesignation(v);
                    if (vox != null && vox.Order != null)
                    {
                        vox.Order.Destroy();
                        if (vox.Order.DisplayWidget != null)
                        {
                            World.Gui.DestroyWidget(vox.Order.DisplayWidget);
                        }
                        BuildDesignations.Remove(vox.Order);
                        DesignatedRooms.Remove(vox.Order.ToBuild);
                    }
                }
                else if (IsInRoom(v))
                {
                    Room existingRoom = GetMostLikelyRoom(v);

                    if (existingRoom == null)
                    {
                        continue;
                    }

                    World.Gui.ShowModalPopup(new Gui.Widgets.Confirm
                    {
                        Text    = "Do you want to destroy this " + existingRoom.RoomData.Name + "?",
                        OnClose = (sender) => destroyDialog_OnClosed((sender as Gui.Widgets.Confirm).DialogResult, existingRoom)
                    });

                    break;
                }
            }
        }
示例#8
0
        void destroyDialog_OnClosed(Gui.Widgets.Confirm.Result status, Room room)
        {
            if (status == Gui.Widgets.Confirm.Result.OKAY)
            {
                DesignatedRooms.Remove(room);

                List <BuildVoxelOrder> existingDesignations = GetDesignationsAssociatedWithRoom(room);
                BuildRoomOrder         buildRoomDes         = null;
                foreach (BuildVoxelOrder des in existingDesignations)
                {
                    des.Order.VoxelOrders.Remove(des);
                    buildRoomDes = des.Order;
                }
                if (buildRoomDes != null && buildRoomDes.DisplayWidget != null)
                {
                    World.Gui.DestroyWidget(buildRoomDes.DisplayWidget);
                }
                BuildDesignations.Remove(buildRoomDes);

                room.Destroy();
            }
        }