public UINeighborhoodHouseButton(int houseNumber, Action<int> selectionCallback, float scale)
        {
            AlphaTime = 0;
            var house = Content.Get().Neighborhood.GetHouse(houseNumber);
            HouseTex = house.Get<BMP>(513).GetTexture(GameFacade.GraphicsDevice);
            HouseOpenTex = house.Get<BMP>(512).GetTexture(GameFacade.GraphicsDevice);
            HouseScale = scale;
            Offsets = house.Get<THMB>(512); //get offsets before scaling

            var w = (int)(HouseTex.Width / HouseScale);
            var h = (int)(HouseTex.Height / HouseScale);
            var clickHandler =
                ListenForMouse(new Rectangle(w / -2, h / -2, w, h), (evt, state) =>
                {
                    switch (evt)
                    {
                        case UIMouseEventType.MouseUp:
                            Console.WriteLine("mup");
                            HITVM.Get().PlaySoundEvent(FSO.Client.UI.Model.UISounds.NeighborhoodClick);
                            selectionCallback(houseNumber); break;
                        case UIMouseEventType.MouseOver:
                            GameFacade.Screens.Tween.To(this, 0.5f, new Dictionary<string, float>() { { "AlphaTime", 1f } });
                            HITVM.Get().PlaySoundEvent(FSO.Client.UI.Model.UISounds.NeighborhoodRollover);
                            Hovered = true; break;
                        case UIMouseEventType.MouseOut:
                            Console.WriteLine("mout");
                            GameFacade.Screens.Tween.To(this, 0.5f, new Dictionary<string, float>() { { "AlphaTime", 0f } });
                            Hovered = false; break;
                    }
                });
        }
Exemple #2
0
        public HITTVOn(uint id, HITVM vm, bool IDMode)
        {
            this.VM = vm;
            Station = "";

            if (id == 5)
            {
                //loadloop. load direct sound...
                var sfx = Content.GameContent.Get.Audio.GetSFX(new Patch(0x00004f85));
                if (sfx == null)
                {
                    return;
                }
                SFXCache.Add("loadloop", sfx);
                Instance          = new SFXDecor(sfx.CreateInstance());
                Instance.Volume   = GetVolFactor();
                Instance.IsLooped = true;
                Instance.Play();
            }
            else
            {
                var aud = Content.GameContent.Get.Audio;
                if (aud.MusicModes.TryGetValue((int)id, out Station))
                {
                    if (aud.StationPaths.ContainsKey(Station))
                    {
                        LoadStation(CleanPath(aud.StationPaths[Station]));
                    }
                }
            }
        }
Exemple #3
0
        void PieButtonHover(UIElement button)
        {
            int index = m_PieButtons.IndexOf((UIButton)button);

            //todo, make sim look at button
            HITVM.Get().PlaySoundEvent(UISounds.PieMenuHighlight);
        }
Exemple #4
0
        void ChangeVolume(UIElement slider)
        {
            UISlider elm = (UISlider)slider;

            if (elm == FXSlider)
            {
                GlobalSettings.Default.FXVolume = (byte)elm.Value;
            }
            else if (elm == MusicSlider)
            {
                GlobalSettings.Default.MusicVolume = (byte)elm.Value;
            }
            else if (elm == VoxSlider)
            {
                GlobalSettings.Default.VoxVolume = (byte)elm.Value;
            }
            else if (elm == AmbienceSlider)
            {
                GlobalSettings.Default.AmbienceVolume = (byte)elm.Value;
            }

            var hit = HITVM.Get();

            hit.SetMasterVolume(HITVolumeGroup.FX, GlobalSettings.Default.FXVolume / 10f);
            hit.SetMasterVolume(HITVolumeGroup.MUSIC, GlobalSettings.Default.MusicVolume / 10f);
            hit.SetMasterVolume(HITVolumeGroup.VOX, GlobalSettings.Default.VoxVolume / 10f);
            hit.SetMasterVolume(HITVolumeGroup.AMBIENCE, GlobalSettings.Default.AmbienceVolume / 10f);

            GlobalSettings.Default.Save();
        }
Exemple #5
0
        private void OnMouseEvent(UIMouseEventType type, UpdateState state)
        {
            switch (type)
            {
            case UIMouseEventType.MouseOver:
                m_isOver = true;
                break;

            case UIMouseEventType.MouseOut:
                m_isOver = false;
                break;

            case UIMouseEventType.MouseDown:
                m_isDown = true;
                break;

            case UIMouseEventType.MouseUp:
                if (m_isDown)
                {
                    OnButtonClick();
                    HITVM.Get().PlaySoundEvent(UISounds.Click);
                }
                m_isDown = false;
                break;
            }
        }
        public void MouseUp(UpdateState state)
        {
            MouseIsDown = false;
            if (Holding != null && Holding.Clicked)
            {
                if (Holding.CanPlace == VMPlacementError.Success)
                {
                    //ExecuteEntryPoint(11); //User Placement
                    var putDown = Holding;
                    var pos = Holding.Group.BaseObject.Position;
                    var badCategory = ((Holding.Group.BaseObject as VMGameObject)?.Disabled ?? 0).HasFlag(VMGameObjectDisableFlags.LotCategoryWrong);
                    if (Holding.IsBought)
                    {
                        HITVM.Get().PlaySoundEvent(UISounds.ObjectMovePlace);
                        vm.SendCommand(new VMNetMoveObjectCmd
                        {
                            ObjectID = Holding.MoveTarget,
                            dir = Holding.Dir,
                            level = pos.Level,
                            x = pos.x,
                            y = pos.y
                        });
                    }
                    else {
                        if (badCategory)
                        {
                            Locked = true;
                            UIAlert.YesNo(GameFacade.Strings.GetString("245", "5"), GameFacade.Strings.GetString("245", (Holding.InventoryPID > 0)?"7":"6"), true,
                                (confirm) =>
                                {
                                    Locked = false;
                                    if (!confirm) return;
                                    HITVM.Get().PlaySoundEvent(UISounds.ObjectPlace);
                                    if (Holding.InventoryPID > 0) InventoryPlaceHolding();
                                    else BuyHolding();
                                    ClearSelected();
                                    OnPutDown?.Invoke(putDown, state); //call this after so that buy mode etc can produce more.
                                });
                            return;
                        } else
                        {
                            HITVM.Get().PlaySoundEvent(UISounds.ObjectPlace);
                            if (Holding.InventoryPID > 0) InventoryPlaceHolding();
                            else BuyHolding();
                        }
                        
                    }
                    ClearSelected();
                    OnPutDown?.Invoke(putDown, state); //call this after so that buy mode etc can produce more.
                }
                else
                {
                    
                }
            }

            state.UIState.TooltipProperties.Show = false;
            state.UIState.TooltipProperties.Opacity = 0;
            ShowTooltip = false;
        }
        public void MouseUp(UpdateState state)
        {
            MouseIsDown = false;
            if (Holding != null && Holding.Clicked)
            {
                if (Holding.CanPlace == VMPlacementError.Success)
                {
                    HITVM.Get().PlaySoundEvent((Holding.IsBought) ? UISounds.ObjectMovePlace : UISounds.ObjectPlace);
                    //ExecuteEntryPoint(11); //User Placement
                    var putDown = Holding;
                    var pos     = Holding.Group.BaseObject.Position;
                    if (Holding.IsBought)
                    {
                        vm.SendCommand(new VMNetMoveObjectCmd
                        {
                            ObjectID = Holding.MoveTarget,
                            dir      = Holding.Dir,
                            level    = pos.Level,
                            x        = pos.x,
                            y        = pos.y
                        });
                    }
                    else if (Holding.InventoryPID > 0)
                    {
                        vm.SendCommand(new VMNetPlaceInventoryCmd
                        {
                            ObjectPID = Holding.InventoryPID,
                            dir       = Holding.Dir,
                            level     = pos.Level,
                            x         = pos.x,
                            y         = pos.y
                        });
                    }
                    else
                    {
                        var GUID = (Holding.Group.MultiTile)? Holding.Group.BaseObject.MasterDefinition.GUID : Holding.Group.BaseObject.Object.OBJ.GUID;
                        vm.SendCommand(new VMNetBuyObjectCmd
                        {
                            GUID  = GUID,
                            dir   = Holding.Dir,
                            level = pos.Level,
                            x     = pos.x,
                            y     = pos.y
                        });
                    }
                    ClearSelected();
                    if (OnPutDown != null)
                    {
                        OnPutDown(putDown, state);                    //call this after so that buy mode etc can produce more.
                    }
                }
                else
                {
                }
            }

            state.UIState.TooltipProperties.Show    = false;
            state.UIState.TooltipProperties.Opacity = 0;
            ShowTooltip = false;
        }
Exemple #8
0
        private void InteractionClicked(UIElement ui)
        {
            if (QueueOwner == null)
            {
                return;
            }
            UIInteraction item   = (UIInteraction)ui;
            var           itemui = item.ParentEntry;
            var           queue  = QueueOwner.Thread.Queue;

            for (int i = 0; i < queue.Count; i++)
            {
                if (queue[i] == itemui.Interaction)
                {
                    HITVM.Get().PlaySoundEvent(UISounds.QueueDelete);
                    var priority = GetElemPriority(itemui.Interaction, i);
                    if (!(itemui.Interaction.NotifyIdle && priority <= 0))
                    {
                        vm.SendCommand(new VMNetInteractionCancelCmd
                        {
                            ActionUID = itemui.Interaction.UID,
                            ActorUID  = QueueOwner.PersistID
                        });
                    }
                    break;
                }
            }
        }
        private void InteractionResult(UIElement ui, bool accepted)
        {
            if (QueueOwner == null)
            {
                return;
            }
            UIInteraction item   = (UIInteraction)ui;
            var           itemui = item.ParentEntry;
            var           queue  = QueueOwner.Thread.Queue;

            for (int i = 0; i < queue.Count; i++)
            {
                if (queue[i] == itemui.Interaction)
                {
                    HITVM.Get().PlaySoundEvent(UISounds.CallSend);
                    if (!(itemui.Interaction.Cancelled && itemui.Interaction.Priority <= 0))
                    {
                        vm.SendCommand(new VMNetInteractionResultCmd
                        {
                            ActionUID = itemui.Interaction.UID,
                            ActorUID  = QueueOwner.PersistID,
                            Accepted  = accepted
                        });
                    }
                    break;
                }
            }
        }
        /// <summary>
        /// Display an IM message in its currently open window. If there is no window, this will create a new one.
        /// </summary>
        public void PassMessage(MessageAuthor Sender, string Message)
        {
            UIMessageGroup group = GetMessageGroup(Sender.Author, UIMessageType.IM);

            if (group == null)
            {
                group = new UIMessageGroup(UIMessageType.IM, Sender, this);
                MessageWindows.Add(group);
                this.Add(group);
                ReorderIcons();
                group.Show(null);

                if (Message != null)
                {
                    HITVM.Get().PlaySoundEvent(UISounds.CallRecieveFirst);
                }
            }
            else
            {
                HITVM.Get().PlaySoundEvent((soundAlt) ? UISounds.CallRecieve : UISounds.CallRecieveNext);
                soundAlt = !soundAlt;
            }

            if (Message != null)
            {
                group.AddMessage(Message);
            }
        }
Exemple #11
0
 public void SellBack(UIElement button)
 {
     if (Holding == null || !Roommate)
     {
         return;
     }
     if (Holding.IsBought)
     {
         if (Holding.CanDelete)
         {
             vm.SendCommand(new VMNetDeleteObjectCmd
             {
                 ObjectID   = Holding.MoveTarget,
                 CleanupAll = true
             });
             HITVM.Get().PlaySoundEvent(UISounds.MoneyBack);
         }
         else
         {
             ShowErrorAtMouse(LastState, VMPlacementError.CannotDeleteObject);
             return;
         }
     }
     OnDelete?.Invoke(Holding, null); //TODO: cleanup callbacks which don't need updatestate into another delegate.
     ClearSelected();
 }
Exemple #12
0
        private void CheckPreloadLabel()
        {
            /** Have we preloaded the correct percent? **/
            var percentDone           = ContentManager.PreloadProgress;
            var percentUntilNextLabel = ((float)(CurrentPreloadLabel + 1)) / ((float)PreloadLabels.Length);

            //System.Diagnostics.Debug.WriteLine(percentDone);

            if (percentDone >= percentUntilNextLabel)
            {
                if (!InTween)
                {
                    if (CurrentPreloadLabel + 1 < PreloadLabels.Length)
                    {
                        CurrentPreloadLabel++;
                        AnimateLabel(PreloadLabels[CurrentPreloadLabel - 1], PreloadLabels[CurrentPreloadLabel]);
                    }
                    else
                    {
                        /** No more labels to show! Preload must be complete :) **/
                        CheckProgressTimer.Stop();
                        //init audio now
                        HITVM.Init();
                        GameFacade.Controller.ShowPersonCreation(new ProtocolAbstractionLibraryD.CityInfo(false));
                    }
                }
            }
        }
Exemple #13
0
        public void RotateObject(int notches)
        {
            Direction newDir;

            if (notches > 0)
            {
                var dir = (int)Holding.Dir << notches;
                if (dir > 255)
                {
                    dir >>= 8;
                }
                newDir = (Direction)dir;
            }
            else
            {
                var dir = ((int)Holding.Dir << 8) >> (-notches);
                if (dir > 255)
                {
                    dir >>= 8;
                }
                newDir = (Direction)dir;
            }
            HITVM.Get().PlaySoundEvent(UISounds.ObjectRotate);
            Holding.Dir = newDir;
            DirChanged  = true;
        }
Exemple #14
0
        public LoadingScreen() : base()
        {
            HITVM.Get().PlaySoundEvent(UIMusic.LoadLoop);

            Background = new UISetupBackground();

            //TODO: Letter spacing is a bit wrong on this label
            var lbl = new UILabel();

            lbl.Caption = GameFacade.Strings.GetString("154", "5");
            lbl.X       = 0;
            lbl.Size    = new Microsoft.Xna.Framework.Vector2(800, 100);
            lbl.Y       = 508;

            var style = lbl.CaptionStyle.Clone();

            style.Size       = 17;
            lbl.CaptionStyle = style;
            Background.BackgroundCtnr.Add(lbl);
            this.Add(Background);

            ProgressLabel1 = new UILabel
            {
                X            = 0,
                Y            = 550,
                Size         = new Microsoft.Xna.Framework.Vector2(800, 100),
                CaptionStyle = style
            };

            ProgressLabel2 = new UILabel
            {
                X            = 0,
                Y            = 550,
                Size         = new Microsoft.Xna.Framework.Vector2(800, 100),
                CaptionStyle = style
            };

            Background.BackgroundCtnr.Add(ProgressLabel1);
            Background.BackgroundCtnr.Add(ProgressLabel2);

            PreloadLabels = new string[] {
                GameFacade.Strings.GetString("155", "6"),
                GameFacade.Strings.GetString("155", "7"),
                GameFacade.Strings.GetString("155", "8"),
                GameFacade.Strings.GetString("155", "9")
            };

            CurrentPreloadLabel = 0;
            AnimateLabel("", PreloadLabels[0]);

            CheckProgressTimer          = new Timer();
            CheckProgressTimer.Interval = 5;
            CheckProgressTimer.Elapsed += new ElapsedEventHandler(CheckProgressTimer_Elapsed);
            CheckProgressTimer.Start();

            //GameFacade.Screens.Tween.To(rect, 10.0f, new Dictionary<string, float>() {
            //    {"X", 500.0f}
            //}, TweenQuad.EaseInOut);
        }
 private void OnMouse(UIMouseEventType type, UpdateState state)
 {
     if (type == UIMouseEventType.MouseOver)
     {
         MouseIsOn = true;
     }
     else if (type == UIMouseEventType.MouseOut)
     {
         MouseIsOn = false;
         Tooltip   = null;
     }
     else if (type == UIMouseEventType.MouseDown)
     {
         if (PieMenu == null)
         {
             //get new pie menu, make new pie menu panel for it
             if (ObjectHover != 0)
             {
                 if (InteractionsAvailable)
                 {
                     HITVM.Get().PlaySoundEvent(UISounds.PieMenuAppear);
                     var obj  = vm.GetObjectById(ObjectHover);
                     var menu = obj.GetPieMenu(vm, ActiveEntity);
                     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);
                     GameFacade.Screens.TooltipProperties.Show     = true;
                     GameFacade.Screens.TooltipProperties.Opacity  = 1;
                     GameFacade.Screens.TooltipProperties.Position = new Vector2(state.MouseState.X,
                                                                                 state.MouseState.Y);
                     GameFacade.Screens.Tooltip = GameFacade.Strings.GetString("159", "0");
                     GameFacade.Screens.TooltipProperties.UpdateDead = false;
                     ShowTooltip = true;
                 }
             }
         }
         else
         {
             PieMenu.RemoveSimScene();
             this.Remove(PieMenu);
             PieMenu = null;
         }
     }
     else if (type == UIMouseEventType.MouseUp)
     {
         GameFacade.Screens.TooltipProperties.Show    = false;
         GameFacade.Screens.TooltipProperties.Opacity = 0;
         ShowTooltip = false;
     }
 }
        public void PopulateScreen(ushort mode)
        {
            var childClone = new List<UIElement>(Children);
            var config = Neighborhoods[mode - 1];
            foreach (var child in childClone) Remove(child);

            var shad = new UIImage(Content.Get().CustomUI.Get("ngbh_outline.png").Get(GameFacade.GraphicsDevice))
                .With9Slice(24, 24, 24, 24);
            shad.SetSize(800 + 48, 600 + 48);
            shad.Position = new Vector2(-24);
            Add(shad);

            var bg = new UIImage(((ITextureRef)Provider.Get(config.Graphic)).Get(GameFacade.GraphicsDevice));
            Add(bg);
            bg.ListenForMouse((evt, state) =>
            {
                if (evt == UIMouseEventType.MouseDown) ResetZoom();
            });

            HousePositions = new Dictionary<int, Vector2>();
            var locationIff = Content.Get().Neighborhood.LotLocations;
            var locations = locationIff.Get<STR>(mode);
            if (locations == null) return;

            var buttons = new List<UINeighborhoodHouseButton>();

            for (int i = 0; i < locations.Length; i++)
            {
                Console.WriteLine(locations.GetString(i));
                var loc = locations.GetString(i).Split(',');
                var num = int.Parse(loc[0].TrimStart());
                var button = new UINeighborhoodHouseButton(num, SelectHouse, config.Scale);
                button.Position = new Vector2(int.Parse(loc[1].TrimStart()), int.Parse(loc[2].TrimStart()));
                HousePositions[num] = button.Position;
                buttons.Add(button);
            }

            var ordered = buttons.OrderBy(x => x.Y);
            foreach (var btn in ordered) Add(btn);

            foreach (var layer in config.FullImageAnimations)
            {
                var lelem = new UINeighborhoodAnimationLayer(layer, config.Pulsate, config.FrameDuration);
                lelem.Position = layer.Position;
                Add(lelem);
            }

            BgSound?.RemoveOwner(-25);
            if (config.Music != null) FSO.HIT.HITVM.Get().PlaySoundEvent(config.Music);
            if (config.BGSound != null)
            {
                BgSound = HITVM.Get().PlaySoundEvent(config.BGSound);
                BgSound.AddOwner(-25);
            }
            Mode = mode;
            Zoom = Zoom;
            CenterPositionX = CenterPositionX;
            CenterPositionY = CenterPositionY;
        }
Exemple #17
0
 /// <summary>
 /// Fires OnSendMessage event with the passed message.
 /// </summary>
 public void SendMessage(string message, string GUID)
 {
     HITVM.Get().PlaySoundEvent(UISounds.CallSend);
     if (OnSendMessage != null)
     {
         OnSendMessage(message, GUID);
     }
 }
Exemple #18
0
        void PieButtonHover(UIElement button)
        {
            var uiB   = (UIButton)button;
            int index = m_PieButtons.IndexOf(uiB);

            currentTarget = button.Position + new Vector2(uiB.Width / 2f, uiB.Size.Y / 2f);
            HITVM.Get().PlaySoundEvent(UISounds.PieMenuHighlight);
        }
Exemple #19
0
 /// <summary>
 /// Fires OnSendLetter event with the passed letter.
 /// </summary>
 public void SendLetter(string message, string subject, string destinationUser)
 {
     HITVM.Get().PlaySoundEvent(UISounds.LetterSend);
     if (OnSendLetter != null)
     {
         OnSendLetter(message, subject, destinationUser);
     }
 }
        public void PopulateScreen(ushort mode)
        {
            var childClone = new List <UIElement>(Children);
            var config     = Neighborhoods[mode - 1];

            foreach (var child in childClone)
            {
                Remove(child);
            }

            var bg = new UIImage(((ITextureRef)Provider.Get(config.Graphic)).Get(GameFacade.GraphicsDevice));

            Add(bg);
            bg.BlockInput();
            var locationIff = Content.Content.Get().Neighborhood.LotLocations;
            var locations   = locationIff.Get <STR>(mode);

            if (locations == null)
            {
                return;
            }

            var buttons = new List <UINeighborhoodHouseButton>();

            for (int i = 0; i < locations.Length; i++)
            {
                var loc    = locations.GetString(i).Split(',');
                var button = new UINeighborhoodHouseButton(int.Parse(loc[0].TrimStart()), SelectHouse, config.Scale);
                button.Position = new Vector2(int.Parse(loc[1].TrimStart()), int.Parse(loc[2].TrimStart()));
                buttons.Add(button);
            }

            var ordered = buttons.OrderBy(x => x.Y);

            foreach (var btn in ordered)
            {
                Add(btn);
            }

            foreach (var layer in config.FullImageAnimations)
            {
                var lelem = new UINeighborhoodAnimationLayer(layer, config.Pulsate, config.FrameDuration);
                lelem.Position = layer.Position;
                Add(lelem);
            }

            BgSound?.RemoveOwner(-25);
            if (config.Music != null)
            {
                HIT.HITVM.Get().PlaySoundEvent(config.Music);
            }
            if (config.BGSound != null)
            {
                BgSound = HITVM.Get().PlaySoundEvent(config.BGSound);
                BgSound.AddOwner(-25);
            }
        }
Exemple #21
0
 public override void Update(UpdateState state)
 {
     if (!PlayedLoadLoop && ((Audio)Content.Content.Get().Audio).Initialized)
     {
         HITVM.Get().PlaySoundEvent(UIMusic.LoadLoop);
         PlayedLoadLoop = true;
     }
     base.Update(state);
 }
Exemple #22
0
        protected void OnMouseEvent(UIMouseEventType type, UpdateState state)
        {
            if ((m_Disabled || Opacity < 1f) && type != UIMouseEventType.MouseOut)
            {
                return;
            }
            Invalidate();
            switch (type)
            {
            case UIMouseEventType.MouseOver:
                m_isOver = true;
                if (!m_isDown)
                {
                    CurrentFrame = 2;
                    if (OnButtonHover != null)
                    {
                        OnButtonHover(this);
                    }
                }
                break;

            case UIMouseEventType.MouseOut:
                m_isOver = false;
                if (!m_isDown)
                {
                    CurrentFrame = 0;
                    if (OnButtonExit != null)
                    {
                        OnButtonExit(this);
                    }
                }
                break;

            case UIMouseEventType.MouseDown:
                m_isDown     = true;
                CurrentFrame = 1;
                if (OnButtonDown != null)
                {
                    OnButtonDown(this);
                }
                break;

            case UIMouseEventType.MouseUp:
                if (m_isDown)
                {
                    if (OnButtonClick != null)
                    {
                        OnButtonClick(this);
                        HITVM.Get().PlaySoundEvent(UISounds.Click);
                    }
                }
                m_isDown     = false;
                CurrentFrame = m_isOver ? 2 : 0;
                break;
            }
        }
Exemple #23
0
        public override void MouseUp(UpdateState state)
        {
            if (Drawing)
            {
                var cmds = new List <VMArchitectureCommand>();

                if (Modifiers.HasFlag(UILotControlModifiers.SHIFT))
                {
                    if (StartPosition != EndPosition)
                    {
                        int smallX = Math.Min(StartPosition.X, EndPosition.X);
                        int smallY = Math.Min(StartPosition.Y, EndPosition.Y);
                        int bigX   = Math.Max(StartPosition.X, EndPosition.X);
                        int bigY   = Math.Max(StartPosition.Y, EndPosition.Y);

                        cmds.Add(new VMArchitectureCommand
                        {
                            Type    = VMArchitectureCommandType.WALL_RECT,
                            level   = World.State.Level,
                            pattern = Pattern,
                            style   = Style,
                            x       = smallX,
                            y       = smallY,
                            x2      = bigX - smallX,
                            y2      = bigY - smallY
                        });
                    }
                }
                else
                {
                    if (DrawLength > 0)
                    {
                        cmds.Add(new VMArchitectureCommand {
                            Type = (Modifiers.HasFlag(UILotControlModifiers.CTRL)) ?
                                   VMArchitectureCommandType.WALL_DELETE:VMArchitectureCommandType.WALL_LINE,
                            level = World.State.Level, pattern = Pattern, style = Style, x = StartPosition.X, y = StartPosition.Y, x2 = DrawLength, y2 = DrawDir
                        });
                    }
                }
                if (cmds.Count > 0 && (Parent.ActiveEntity == null || vm.Context.Architecture.LastTestCost <= Parent.Budget))
                {
                    vm.SendCommand(new VMNetArchitectureCmd
                    {
                        Commands = new List <VMArchitectureCommand>(cmds)
                    });

                    //vm.Context.Architecture.RunCommands(cmds);
                    HITVM.Get().PlaySoundEvent(UISounds.BuildDragToolPlace);
                }
                else
                {
                    HITVM.Get().PlaySoundEvent(UISounds.BuildDragToolUp);
                }
            }
            Drawing = false;
        }
 public void MouseDown(UpdateState state)
 {
     if (!Drawing)
     {
         HITVM.Get().PlaySoundEvent(UISounds.BuildDragToolDown);
         Drawing = true;
         var tilePos = World.EstTileAtPosWithScroll(Parent.GetScaledPoint(state.MouseState.Position).ToVector2());
         StartPosition = new Point((int)Math.Round(tilePos.X), (int)Math.Round(tilePos.Y));
     }
 }
Exemple #25
0
 public override void MouseDown(UpdateState state)
 {
     if (!Drawing)
     {
         HITVM.Get().PlaySoundEvent(UISounds.BuildDragToolDown);
         Drawing = true;
         var tilePos = World.EstTileAtPosWithScroll(new Vector2(MousePosition.X, MousePosition.Y));
         StartPosition = new Point((int)Math.Round(tilePos.X), (int)Math.Round(tilePos.Y));
     }
 }
Exemple #26
0
 public void MouseDown(UpdateState state)
 {
     if (!Drawing)
     {
         HITVM.Get().PlaySoundEvent(UISounds.BuildDragToolDown);
         Drawing = true;
         var tilePos = World.State.WorldSpace.GetTileAtPosWithScroll(new Vector2(state.MouseState.X, state.MouseState.Y) / FSOEnvironment.DPIScaleFactor);
         StartPosition = new Point((int)Math.Round(tilePos.X), (int)Math.Round(tilePos.Y));
     }
 }
Exemple #27
0
 void BackButtonPress(UIElement button)
 {
     if (m_CurrentItem.Parent == null)
     {
         return;                               //shouldn't ever be...
     }
     m_CurrentItem = m_CurrentItem.Parent;
     HITVM.Get().PlaySoundEvent(UISounds.PieMenuSelect);
     RenderMenu();
 }
Exemple #28
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            NetworkFacade.Client.ProcessPackets();
            if (HITVM.Get() != null)
            {
                HITVM.Get().Tick();
            }

            base.Update(gameTime);
        }
Exemple #29
0
 private void ShowErrorAtMouse(UpdateState state, VMPlacementError error, Point pos)
 {
     state.UIState.TooltipProperties.Show     = true;
     state.UIState.TooltipProperties.Color    = Color.Black;
     state.UIState.TooltipProperties.Opacity  = 1;
     state.UIState.TooltipProperties.Position = pos.ToVector2();
     state.UIState.Tooltip = GameFacade.Strings.GetString("137", "kPErr" + error.ToString());
     state.UIState.TooltipProperties.UpdateDead = false;
     HITVM.Get().PlaySoundEvent(UISounds.Error);
 }
Exemple #30
0
 private void PurchaseLotSize(UIElement button)
 {
     LotControl.vm.SendCommand(new VMNetChangeLotSizeCmd
     {
         LotSize    = (byte)UpdateSizeTarget,
         LotStories = (byte)UpdateFloorsTarget
     });
     HITVM.Get().PlaySoundEvent(UISounds.ObjectPlace);
     AcceptButton.Disabled = true;
 }