internal void SetMoveGhostItem(Meubi meubi) { meubi.Hide(); ghostMeubi = new GhostMeubi(_content, meubi.GetItemId(), meubi.GetData().id, () => { ghostMeubi = null; meubi.Show(); }, () => { RetroEnvironment.GetGame().GetClientManager().SendPacket(new MoveObjectEvent(ghostMeubi.GetItemId(), (int)floorDesign.GetMouseTile(roomOffset).GetCoordinate().X, (int)floorDesign.GetMouseTile(roomOffset).GetCoordinate().Z, ghostMeubi.GetRotation())); ghostMeubi = null; }); placeDelay.Start(); }
public FurniManager(ContentManager content) { minimiumSize = new Vector2i(190, 160); size = minimiumSize; buyOne = false; hasRights = false; selectedItem = null; baseItems = new Dictionary <int, BaseItem>(); delay = new System.Timers.Timer(200); delay.Elapsed += Delay_Elapsed; useBtn = new HoverButton(content, "Menu/Furni/button", new Vector2i(3, 1), () => { SelectItem(selectedItem); }, Color.White); pickupBtn = new HoverButton(content, "Menu/Furni/button", new Vector2i(3, 1), () => { RetroEnvironment.GetGame().GetClientManager().SendPacket(new PickupObjectEvent(selectedItem.GetItemId())); SelectItem(null); }, Color.White); rotateBtn = new HoverButton(content, "Menu/Furni/button", new Vector2i(3, 1), () => { SelectItem(selectedItem); RetroEnvironment.GetGame().GetClientManager().SendPacket(new MoveObjectEvent(selectedItem.GetItemId(), (int)selectedItem.GetCoordinate().X, (int)selectedItem.GetCoordinate().Z, (selectedItem.GetRotation() * 2) + 2)); }, Color.White); moveBtn = new HoverButton(content, "Menu/Furni/button", new Vector2i(3, 1), () => { GameScreenManager.Instance.GetRoomManager().SetMoveGhostItem(selectedItem); SelectItem(null); }, Color.White); close = new Button(content, "Menu/Furni/close", new Vector2i(1, 1), () => { SelectItem(null); }); crnLT = new Image(content, "Menu/Furni/crn", Vector2.Zero, 1, 0, SpriteEffects.None); crnLB = new Image(content, "Menu/Furni/crnB", Vector2.Zero, 1, 0, SpriteEffects.None); crnRT = new Image(content, "Menu/Furni/crn", Vector2.Zero, 1, 0, SpriteEffects.FlipHorizontally); crnRB = new Image(content, "Menu/Furni/crnB", Vector2.Zero, 1, 0, SpriteEffects.FlipHorizontally); edgeT = new Image(content, "Menu/Furni/backdrop", new Vector2(minimiumSize.X - (2 * crnLT.SourceRect.Width), 6)); edgeB = new Image(content, "Menu/Furni/backdrop", new Vector2(minimiumSize.X - (2 * crnLT.SourceRect.Width), 6)); backdrop = new Image(content, "Menu/Furni/backdrop", new Vector2(minimiumSize.X, minimiumSize.Y - (2 * edgeT.SourceRect.Height))); divider1 = new Image(content, "Menu/Furni/divider", new Vector2(minimiumSize.X - 20, 1)); userProfile = new Image(content, "Menu/Furni/user", Vector2.Zero); divider2 = divider1.Clone() as Image; divider3 = divider1.Clone() as Image; titleFnt = new Font(content, "Fonts/Furni/title", "N/A", Color.White); descFnt = new Font(content, "Fonts/Furni/desc", "N/A", Color.White); userFnt = new Font(content, "Fonts/Furni/user", "N/A", Color.White); useFnt = new Font(content, "Fonts/Furni/button", "furni.button.use", Color.White); pickupFnt = new Font(content, "Fonts/Furni/button", "furni.button.remove", Color.White); rotateFnt = new Font(content, "Fonts/Furni/button", "furni.button.rotate", Color.White); moveFnt = new Font(content, "Fonts/Furni/button", "furni.button.move", Color.White); }
public void SelectItem(Meubi meubi) { if (!delay.Enabled) { selectedItem = meubi; } if (meubi != null) { delay.Start(); } Update(); }
internal void UpdateMeubi(Coordinate cord, int itemId, int spriteId, int rotation) { Meubi meubi = GetMeubiByCoord(cord); if (meubi == null) { return; } if (!idSortedMeubis.ContainsKey(itemId)) { idSortedMeubis.Add(itemId, meubi); } meubi.SetItemId(itemId); meubi.SetBaseItem(GameScreenManager.Instance.GetFurniManager().RegisterFurni(spriteId).Clone() as BaseItem); meubi.SetRotationState(rotation); }
public bool GetMeubiByItemId(int itemId, out Meubi meubi) { return(idSortedMeubis.TryGetValue(itemId, out meubi)); }