Inheritance: FSO.Client.UI.Framework.UIContainer
コード例 #1
0
 public void ClosePie()
 {
     if (PieMenu != null)
     {
         PieMenu.RemoveSimScene();
         Queue.PieMenuClickPos = PieMenu.Position;
         this.Remove(PieMenu);
         PieMenu = null;
     }
 }
コード例 #2
0
        public void ShowPieMenu(Point pt, UpdateState state)
        {
            if (!LiveMode)
            {
                if (CustomControl != null)
                {
                    CustomControl.MouseDown(state);
                }
                else
                {
                    ObjectHolder.MouseDown(state);
                }
                return;
            }
            if (PieMenu == null && ActiveEntity != null)
            {
                VMEntity obj;
                //get new pie menu, make new pie menu panel for it
                var tilePos = World.EstTileAtPosWithScroll(new Vector2(pt.X, pt.Y) / FSOEnvironment.DPIScaleFactor);

                LotTilePos targetPos = LotTilePos.FromBigTile((short)tilePos.X, (short)tilePos.Y, World.State.Level);
                if (vm.Context.SolidToAvatars(targetPos).Solid)
                {
                    targetPos = LotTilePos.OUT_OF_WORLD;
                }

                GotoObject.SetPosition(targetPos, Direction.NORTH, vm.Context);

                var newHover = World.GetObjectIDAtScreenPos(pt.X,
                                                            pt.Y,
                                                            GameFacade.GraphicsDevice);

                ObjectHover = newHover;

                bool objSelected = ObjectHover > 0;
                if (objSelected || (GotoObject.Position != LotTilePos.OUT_OF_WORLD && ObjectHover <= 0))
                {
                    if (objSelected)
                    {
                        obj = vm.GetObjectById(ObjectHover);
                    }
                    else
                    {
                        obj = GotoObject;
                    }
                    if (obj != null)
                    {
                        obj = obj.MultitileGroup.GetInteractionGroupLeader(obj);
                        if (obj is VMGameObject && ((VMGameObject)obj).Disabled > 0)
                        {
                            var flags = ((VMGameObject)obj).Disabled;

                            if ((flags & VMGameObjectDisableFlags.ForSale) > 0)
                            {
                                //for sale
                                //try to get catalog price
                                var guid = obj.MasterDefinition?.GUID ?? obj.Object.OBJ.GUID;
                                var item = Content.Content.Get().WorldCatalog.GetItemByGUID(guid);

                                var retailPrice = (int?)(item?.Price) ?? obj.MultitileGroup.Price;
                                var salePrice   = obj.MultitileGroup.SalePrice;
                                ShowErrorTooltip(state, 22, true, "$" + retailPrice.ToString("##,#0"), "$" + salePrice.ToString("##,#0"));
                            }
                            else if ((flags & VMGameObjectDisableFlags.LotCategoryWrong) > 0)
                            {
                                ShowErrorTooltip(state, 21, true); //category wrong
                            }
                            else if ((flags & VMGameObjectDisableFlags.TransactionIncomplete) > 0)
                            {
                                ShowErrorTooltip(state, 27, true); //transaction not yet complete
                            }
                            else if ((flags & VMGameObjectDisableFlags.ObjectLimitExceeded) > 0)
                            {
                                ShowErrorTooltip(state, 24, true); //object is temporarily disabled... todo: something more helpful
                            }
                            else if ((flags & VMGameObjectDisableFlags.PendingRoommateDeletion) > 0)
                            {
                                ShowErrorTooltip(state, 16, true); //pending roommate deletion
                            }
                        }
                        else
                        {
                            var menu = obj.GetPieMenu(vm, ActiveEntity, false, true);
                            if (menu.Count != 0)
                            {
                                HITVM.Get().PlaySoundEvent(UISounds.PieMenuAppear);
                                PieMenu = new UIPieMenu(menu, obj, ActiveEntity, this);
                                this.Add(PieMenu);
                                PieMenu.X = state.MouseState.X / FSOEnvironment.DPIScaleFactor;
                                PieMenu.Y = state.MouseState.Y / FSOEnvironment.DPIScaleFactor;
                                PieMenu.UpdateHeadPosition(state.MouseState.X, state.MouseState.Y);
                            }
                            else
                            {
                                ShowErrorTooltip(state, 0, true);
                            }
                        }
                    }
                }
                else
                {
                    ShowErrorTooltip(state, 0, true);
                }
            }
            else
            {
                if (PieMenu != null)
                {
                    PieMenu.RemoveSimScene();
                }
                this.Remove(PieMenu);
                PieMenu = null;
            }
        }
コード例 #3
0
        private void OnMouse(UIMouseEventType type, UpdateState state)
        {
            if (!vm.Ready)
            {
                return;
            }

            if (type == UIMouseEventType.MouseOver)
            {
                if (QueryPanel.Mode == 1)
                {
                    QueryPanel.Active = false;
                }
                MouseIsOn = true;
            }
            else if (type == UIMouseEventType.MouseOut)
            {
                MouseIsOn = false;
                Tooltip   = null;
            }
            else if (type == UIMouseEventType.MouseDown)
            {
                if (!LiveMode)
                {
                    if (CustomControl != null)
                    {
                        CustomControl.MouseDown(state);
                    }
                    else
                    {
                        ObjectHolder.MouseDown(state);
                    }
                    return;
                }
                if (PieMenu == null && ActiveEntity != null)
                {
                    VMEntity obj;
                    //get new pie menu, make new pie menu panel for it
                    var tilePos = World.State.WorldSpace.GetTileAtPosWithScroll(new Vector2(state.MouseState.X, state.MouseState.Y));

                    LotTilePos targetPos = LotTilePos.FromBigTile((short)tilePos.X, (short)tilePos.Y, World.State.Level);
                    if (vm.Context.SolidToAvatars(targetPos).Solid)
                    {
                        targetPos = LotTilePos.OUT_OF_WORLD;
                    }

                    GotoObject.SetPosition(targetPos, Direction.NORTH, vm.Context);

                    bool objSelected = ObjectHover > 0 && InteractionsAvailable;
                    if (objSelected || (GotoObject.Position != LotTilePos.OUT_OF_WORLD && ObjectHover <= 0))
                    {
                        HITVM.Get().PlaySoundEvent(UISounds.PieMenuAppear);
                        if (objSelected)
                        {
                            obj = vm.GetObjectById(ObjectHover);
                        }
                        else
                        {
                            obj = GotoObject;
                        }
                        obj = obj.MultitileGroup.GetInteractionGroupLeader(obj);

                        var menu = obj.GetPieMenu(vm, ActiveEntity, false);
                        if (menu.Count != 0)
                        {
                            PieMenu = new UIPieMenu(menu, obj, ActiveEntity, this);
                            this.Add(PieMenu);
                            PieMenu.X = state.MouseState.X;
                            PieMenu.Y = state.MouseState.Y;
                            PieMenu.UpdateHeadPosition(state.MouseState.X, state.MouseState.Y);
                        }
                    }
                    else
                    {
                        HITVM.Get().PlaySoundEvent(UISounds.Error);
                        state.UIState.TooltipProperties.Show     = true;
                        state.UIState.TooltipProperties.Color    = Color.Black;
                        state.UIState.TooltipProperties.Opacity  = 1;
                        state.UIState.TooltipProperties.Position = new Vector2(state.MouseState.X,
                                                                               state.MouseState.Y);
                        state.UIState.Tooltip = GameFacade.Strings.GetString("159", "0");
                        state.UIState.TooltipProperties.UpdateDead = false;
                        ShowTooltip = true;
                        TipIsError  = true;
                    }
                }
                else
                {
                    if (PieMenu != null)
                    {
                        PieMenu.RemoveSimScene();
                    }
                    this.Remove(PieMenu);
                    PieMenu = null;
                }
            }
            else if (type == UIMouseEventType.MouseUp)
            {
                if (!LiveMode)
                {
                    if (CustomControl != null)
                    {
                        CustomControl.MouseUp(state);
                    }
                    else
                    {
                        ObjectHolder.MouseUp(state);
                    }
                    return;
                }
                state.UIState.TooltipProperties.Show    = false;
                state.UIState.TooltipProperties.Opacity = 0;
                ShowTooltip = false;
                TipIsError  = false;
            }
        }
コード例 #4
0
ファイル: UILotControl.cs プロジェクト: fourks/FreeSO
        private void OnMouse(UIMouseEventType type, UpdateState state)
        {
            if (!vm.Ready)
            {
                return;
            }

            if (type == UIMouseEventType.MouseOver)
            {
                if (QueryPanel.Mode == 1)
                {
                    QueryPanel.Active = false;
                }
                MouseIsOn = true;
            }
            else if (type == UIMouseEventType.MouseOut)
            {
                MouseIsOn = false;
                GameFacade.Cursor.SetCursor(CursorType.Normal);
                Tooltip = null;
            }
            else if (type == UIMouseEventType.MouseDown)
            {
                if (!LiveMode)
                {
                    if (CustomControl != null)
                    {
                        CustomControl.MouseDown(state);
                    }
                    else
                    {
                        ObjectHolder.MouseDown(state);
                    }
                    return;
                }
                if (PieMenu == null && ActiveEntity != null)
                {
                    VMEntity obj;
                    //get new pie menu, make new pie menu panel for it
                    var tilePos = World.State.WorldSpace.GetTileAtPosWithScroll(new Vector2(state.MouseState.X, state.MouseState.Y) / FSOEnvironment.DPIScaleFactor);

                    LotTilePos targetPos = LotTilePos.FromBigTile((short)tilePos.X, (short)tilePos.Y, World.State.Level);
                    if (vm.Context.SolidToAvatars(targetPos).Solid)
                    {
                        targetPos = LotTilePos.OUT_OF_WORLD;
                    }

                    GotoObject.SetPosition(targetPos, Direction.NORTH, vm.Context);

                    bool objSelected = ObjectHover > 0 && InteractionsAvailable;
                    if (objSelected || (GotoObject.Position != LotTilePos.OUT_OF_WORLD && ObjectHover <= 0))
                    {
                        if (objSelected)
                        {
                            obj = vm.GetObjectById(ObjectHover);
                        }
                        else
                        {
                            obj = GotoObject;
                        }
                        if (obj != null)
                        {
                            obj = obj.MultitileGroup.GetInteractionGroupLeader(obj);
                            if (obj is VMGameObject && ((VMGameObject)obj).Disabled > 0)
                            {
                                var flags = ((VMGameObject)obj).Disabled;

                                if ((flags & VMGameObjectDisableFlags.ForSale) > 0)
                                {
                                    //for sale
                                    var retailPrice = obj.MultitileGroup.Price; //wrong... should get this from catalog
                                    var salePrice   = obj.MultitileGroup.SalePrice;
                                    ShowErrorTooltip(state, 22, true, "$" + retailPrice.ToString("##,#0"), "$" + salePrice.ToString("##,#0"));
                                }
                                else if ((flags & VMGameObjectDisableFlags.LotCategoryWrong) > 0)
                                {
                                    ShowErrorTooltip(state, 21, true); //category wrong
                                }
                                else if ((flags & VMGameObjectDisableFlags.TransactionIncomplete) > 0)
                                {
                                    ShowErrorTooltip(state, 27, true); //transaction not yet complete
                                }
                                else if ((flags & VMGameObjectDisableFlags.ObjectLimitExceeded) > 0)
                                {
                                    ShowErrorTooltip(state, 24, true); //object is temporarily disabled... todo: something more helpful
                                }
                                else if ((flags & VMGameObjectDisableFlags.PendingRoommateDeletion) > 0)
                                {
                                    ShowErrorTooltip(state, 16, true); //pending roommate deletion
                                }
                            }
                            else
                            {
                                HITVM.Get().PlaySoundEvent(UISounds.PieMenuAppear);
                                var menu = obj.GetPieMenu(vm, ActiveEntity, false, true);
                                if (menu.Count != 0)
                                {
                                    PieMenu = new UIPieMenu(menu, obj, ActiveEntity, this);
                                    this.Add(PieMenu);
                                    PieMenu.X = state.MouseState.X / FSOEnvironment.DPIScaleFactor;
                                    PieMenu.Y = state.MouseState.Y / FSOEnvironment.DPIScaleFactor;
                                    PieMenu.UpdateHeadPosition(state.MouseState.X, state.MouseState.Y);
                                }
                            }
                        }
                    }
                    else
                    {
                        ShowErrorTooltip(state, 0, true);
                    }
                }
                else
                {
                    if (PieMenu != null)
                    {
                        PieMenu.RemoveSimScene();
                    }
                    this.Remove(PieMenu);
                    PieMenu = null;
                }
            }
            else if (type == UIMouseEventType.MouseUp)
            {
                if (!LiveMode)
                {
                    if (CustomControl != null)
                    {
                        CustomControl.MouseUp(state);
                    }
                    else
                    {
                        ObjectHolder.MouseUp(state);
                    }
                    return;
                }
                state.UIState.TooltipProperties.Show    = false;
                state.UIState.TooltipProperties.Opacity = 0;
                ShowTooltip = false;
                TipIsError  = false;
            }
        }
コード例 #5
0
ファイル: UILotControl.cs プロジェクト: RHY3756547/FreeSO
        private void OnMouse(UIMouseEventType type, UpdateState state)
        {
            if (!vm.Ready) return;

            if (type == UIMouseEventType.MouseOver)
            {
                if (QueryPanel.Mode == 1) QueryPanel.Active = false;
                MouseIsOn = true;
            }
            else if (type == UIMouseEventType.MouseOut)
            {
                MouseIsOn = false;
                Tooltip = null;
            }
            else if (type == UIMouseEventType.MouseDown)
            {
                if (!LiveMode)
                {
                    if (CustomControl != null) CustomControl.MouseDown(state);
                    else ObjectHolder.MouseDown(state);
                    return;
                }
                if (PieMenu == null && ActiveEntity != null)
                {
                    VMEntity obj;
                    //get new pie menu, make new pie menu panel for it
                    var tilePos = World.State.WorldSpace.GetTileAtPosWithScroll(new Vector2(state.MouseState.X, state.MouseState.Y) / FSOEnvironment.DPIScaleFactor);

                    LotTilePos targetPos = LotTilePos.FromBigTile((short)tilePos.X, (short)tilePos.Y, World.State.Level);
                    if (vm.Context.SolidToAvatars(targetPos).Solid) targetPos = LotTilePos.OUT_OF_WORLD;

                    GotoObject.SetPosition(targetPos, Direction.NORTH, vm.Context);

                    bool objSelected = ObjectHover > 0 && InteractionsAvailable;
                    if (objSelected || (GotoObject.Position != LotTilePos.OUT_OF_WORLD && ObjectHover <= 0))
                    {
                        HITVM.Get().PlaySoundEvent(UISounds.PieMenuAppear);
                        if (objSelected)
                        {
                            obj = vm.GetObjectById(ObjectHover);
                        } else
                        {
                            obj = GotoObject;
                        }
                        obj = obj.MultitileGroup.GetInteractionGroupLeader(obj);

                        var menu = obj.GetPieMenu(vm, ActiveEntity, false);
                        if (menu.Count != 0)
                        {
                            PieMenu = new UIPieMenu(menu, obj, ActiveEntity, this);
                            this.Add(PieMenu);
                            PieMenu.X = state.MouseState.X / FSOEnvironment.DPIScaleFactor;
                            PieMenu.Y = state.MouseState.Y / FSOEnvironment.DPIScaleFactor;
                            PieMenu.UpdateHeadPosition(state.MouseState.X, state.MouseState.Y);
                        }
                    }
                    else
                    {
                        HITVM.Get().PlaySoundEvent(UISounds.Error);
                        state.UIState.TooltipProperties.Show = true;
                        state.UIState.TooltipProperties.Color = Color.Black;
                        state.UIState.TooltipProperties.Opacity = 1;
                        state.UIState.TooltipProperties.Position = new Vector2(state.MouseState.X,
                            state.MouseState.Y);
                        state.UIState.Tooltip = GameFacade.Strings.GetString("159", "0");
                        state.UIState.TooltipProperties.UpdateDead = false;
                        ShowTooltip = true;
                        TipIsError = true;
                    }
                }
                else
                {
                    if (PieMenu != null) PieMenu.RemoveSimScene();
                    this.Remove(PieMenu);
                    PieMenu = null;
                }
            }
            else if (type == UIMouseEventType.MouseUp)
            {
                if (!LiveMode)
                {
                    if (CustomControl != null) CustomControl.MouseUp(state);
                    else ObjectHolder.MouseUp(state);
                    return;
                }
                state.UIState.TooltipProperties.Show = false;
                state.UIState.TooltipProperties.Opacity = 0;
                ShowTooltip = false;
                TipIsError = false;
            }
        }
コード例 #6
0
ファイル: UILotControl.cs プロジェクト: RHY3756547/FreeSO
 public void ClosePie()
 {
     if (PieMenu != null)
     {
         PieMenu.RemoveSimScene();
         Queue.PieMenuClickPos = PieMenu.Position;
         this.Remove(PieMenu);
         PieMenu = null;
     }
 }