FSO.LotView.World.GetObjectThumb C# (CSharp) Method

GetObjectThumb() public method

Gets an object group's thumbnail provided an array of objects.
public GetObjectThumb ( ObjectComponent objects, Vector3 positions, GraphicsDevice gd ) : Texture2D
objects ObjectComponent The object components to draw.
positions Vector3
gd GraphicsDevice GraphicsDevice instance.
return Texture2D
        public Texture2D GetObjectThumb(ObjectComponent[] objects, Vector3[] positions, GraphicsDevice gd)
        {
            State._2D.Begin(this.State.Camera);
            return _2DWorld.GetObjectThumb(objects, positions, gd, State);
        }

Usage Example

Ejemplo n.º 1
0
        void vm_OnDialog(FSO.SimAntics.Model.VMDialogInfo info)
        {
            if (info != null && ((info.DialogID == LastDialogID && info.DialogID != 0 && info.Block)))
            {
                return;
            }
            //return if same dialog as before, or not ours
            if ((info == null || info.Block) && BlockingDialog != null)
            {
                //cancel current dialog because it's no longer valid
                UIScreen.RemoveDialog(BlockingDialog);
                LastDialogID   = 0;
                BlockingDialog = null;
            }
            if (info == null)
            {
                return;               //return if we're just clearing a dialog.
            }
            var options = new UIAlertOptions
            {
                Title     = info.Title,
                Message   = info.Message,
                Width     = 325 + (int)(info.Message.Length / 3.5f),
                Alignment = TextAlignment.Left,
                TextSize  = 12
            };

            var b0Event = (info.Block) ? new ButtonClickDelegate(DialogButton0) : null;
            var b1Event = (info.Block) ? new ButtonClickDelegate(DialogButton1) : null;
            var b2Event = (info.Block) ? new ButtonClickDelegate(DialogButton2) : null;

            VMDialogType type = (info.Operand == null) ? VMDialogType.Message : info.Operand.Type;

            switch (type)
            {
            default:
            case VMDialogType.Message:
                options.Buttons = new UIAlertButton[] { new UIAlertButton(UIAlertButtonType.OK, b0Event, info.Yes) };
                break;

            case VMDialogType.YesNo:
                options.Buttons = new UIAlertButton[]
                {
                    new UIAlertButton(UIAlertButtonType.Yes, b0Event, info.Yes),
                    new UIAlertButton(UIAlertButtonType.No, b1Event, info.No),
                };
                break;

            case VMDialogType.YesNoCancel:
                options.Buttons = new UIAlertButton[]
                {
                    new UIAlertButton(UIAlertButtonType.Yes, b0Event, info.Yes),
                    new UIAlertButton(UIAlertButtonType.No, b1Event, info.No),
                    new UIAlertButton(UIAlertButtonType.Cancel, b2Event, info.Cancel),
                };
                break;

            case VMDialogType.TextEntry:
                options.Buttons   = new UIAlertButton[] { new UIAlertButton(UIAlertButtonType.OK, b0Event, info.Yes) };
                options.TextEntry = true;
                break;

            case VMDialogType.NumericEntry:
                if (!vm.TS1)
                {
                    goto case VMDialogType.TextEntry;
                }
                else
                {
                    goto case VMDialogType.TS1Neighborhood;
                }

            case VMDialogType.TS1Vacation:
            case VMDialogType.TS1Neighborhood:
            case VMDialogType.TS1StudioTown:
            case VMDialogType.TS1Magictown:
                TS1NeighSelector = new UINeighborhoodSelectionPanel((ushort)VMDialogPrivateStrings.TypeToNeighID[type]);
                Parent.Add(TS1NeighSelector);
                ((TS1GameScreen)Parent).Bg.Visible         = true;
                ((TS1GameScreen)Parent).LotControl.Visible = false;
                TS1NeighSelector.OnHouseSelect            += HouseSelected;
                return;
            }

            var alert = new UIMobileAlert(options);

            UIScreen.GlobalShowDialog(alert, true);

            if (info.Block)
            {
                BlockingDialog = alert;
                LastDialogID   = info.DialogID;
            }

            var entity = info.Icon;

            if (entity is VMGameObject)
            {
                var objects = entity.MultitileGroup.Objects;
                ObjectComponent[] objComps = new ObjectComponent[objects.Count];
                for (int i = 0; i < objects.Count; i++)
                {
                    objComps[i] = (ObjectComponent)objects[i].WorldUI;
                }
                var thumb = World.GetObjectThumb(objComps, entity.MultitileGroup.GetBasePositions(), GameFacade.GraphicsDevice);
                alert.SetIcon(thumb, 256, 256);
            }
        }