Beispiel #1
0
        public void Can_Retrieve_Image_Data()
        {
            // Организация - создание объекта Game с данными изображения
            Furniture furniture = new Furniture
            {
                Id = 2,
                Name = "Мебель1",
                Description = "Описание",
                Section = "Раздел",
                Price = 200,
                ImageData = new byte[] { },
                ImageMimeType = "image/png"
            };

            // Организация - создание имитированного хранилища
            Mock<IFurnitureRepository> mock = new Mock<IFurnitureRepository>();
            mock.Setup(m => m.Furnitures).Returns(new List<Furniture>
            {
            new Furniture { Id = 1, Name = "Мебель1", Description = "Описание", Section = "Раздел", Price = 100 ,
                ImageData = new byte[] { }, ImageMimeType = "image/png"},
            new Furniture { Id = 2, Name = "Мебель2", Description = "Описание", Section = "Раздел", Price = 100,
                ImageData = new byte[] { }, ImageMimeType = "image/png"},
            });

            // Организация - создание контроллера
            FurnitureController controller = new FurnitureController(mock.Object);

            // Действие - вызов метода действия GetImage()
            ActionResult result = controller.GetImage(2);

            // Утверждение
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(FileResult));
            Assert.AreEqual(furniture.ImageMimeType, ((FileResult)result).ContentType);
        }
Beispiel #2
0
        public void Can_Delete_Valid_Furnitures()
        {
            // Организация - создание объекта Game
            Furniture furniture = new Furniture { Id = 1, Name = "Мебель1", Description = "Описание", Section = "Раздел", Price = 100 };

            // Организация - создание имитированного хранилища данных
            Mock<IFurnitureRepository> mock = new Mock<IFurnitureRepository>();
            mock.Setup(m => m.Furnitures).Returns(new List<Furniture>
            {
            new Furniture { Id = 1, Name = "Мебель1", Description = "Описание", Section = "Раздел", Price = 100},
            new Furniture { Id = 2, Name = "Мебель2", Description = "Описание", Section = "Раздел", Price = 100},
            new Furniture { Id = 3, Name = "Мебель3", Description = "Описание", Section = "Раздел", Price = 100},
            new Furniture { Id = 4, Name = "Мебель4", Description = "Описание", Section = "Раздел", Price = 100},
            new Furniture { Id = 5, Name = "Мебель5", Description = "Описание", Section = "Раздел", Price = 100},
            });

            // Организация - создание контроллера
            AdminController controller = new AdminController(mock.Object);

            // Действие - удаление игры
            controller.Delete(furniture);

            // Утверждение - проверка того, что метод удаления в хранилище
            // вызывается для корректного объекта Game
            mock.Verify(m => m.DeleteFurniture(furniture));
        }
    public FurnitureButton(string assetPath, Rect position, Furniture furniture, GUIStyle style,  GUIStyle infoStyle, params GUILayoutOption[] options)
        : base(assetPath, style, infoStyle, position, options)
    {
        this.furniture = furniture;
        this.infoStyle = infoStyle;

        textRect = ScaledRect.Rect(120, 4, 166, position.height);
        imageRect = ScaledRect.Rect(6, 6, furniture.GetImage().height, furniture.GetImage().height);
        buttonRect = new Rect(0,0, position.width, position.height);

        shadowStyle = new GUIStyle();
        shadowStyle.normal.background = (Texture2D)Resources.Load(baseDir + "TAB_Shadow_04");
        shadowStyle.border = new RectOffset(-10,-10,-10,-10);

        //textStyle = new GUIStyle(optionsSkin.label);
        textStyle = new GUIStyle();
        textStyle.alignment = TextAnchor.UpperLeft;
        textStyle.font = Startup.Font_vsmall;
        textStyle.wordWrap = true;
        textStyle.normal.textColor = new Color(0.75f, 0.75f, 0.75f);
        textStyle.active.textColor = new Color(0.75f, 0.75f, 0.75f);
        textStyle.padding.top = 5;

        counterTextStyle = new GUIStyle(style);
        counterTextStyle.alignment = TextAnchor.MiddleRight;
        counterTextStyle.padding.right = 10;
    }
 public void CreateFurniture(Furniture furniture)
 {
     using (ITransaction transaction = session.BeginTransaction())
     {
         session.Save(furniture);
         transaction.Commit();
     }
 }
 public ActionResult Delete(Furniture furniture)
 {
     Furniture deletedFurniture = repository.DeleteFurniture(furniture);
     if (deletedFurniture != null)
     {
         TempData["message"] = string.Format("Товар \"{0}\" был удален",
             deletedFurniture.Name);
     }
     return RedirectToAction("Index");
 }
 public void SetStrings(Furniture furn)
 {
     string Name = "Name:  " +  furn.GetDisplayName();
     string DesignerName = "Designer Name:  " + furn.GetCategoryString();
     string Description = "Description:\n" + furn.GetDescription();
     string Dimensions = "Dimensions:\n" + furn.GetDimensions();
     currentString = Name + "\n\n" + DesignerName + "\n\n" + Description + "\n\n" + Dimensions;
     currentFurniture = furn;
     showGUI = true;
 }
    //Sets for Lists
    public static void AddToFurnitureList(Furniture furn)
    {
        //Initialize the list
        if(FurnitureList == null){ FurnitureList = new List<Furniture>(); }
        if(CategoryList == null){ CategoryList = new List<string>(); }
        //Add Furniture Objects
        FurnitureList.Add(furn);

        if(!CategoryList.Contains(furn.GetCategoryString())){
            CategoryList.Add(furn.GetCategoryString());
            CategoryList.Sort();
        }
    }
        public Furniture DeleteFurniture(Furniture furniture)
        {
            using (ITransaction transaction = session.BeginTransaction())
            {
                Furniture deleteFurniture = session.Get<Furniture>(furniture.Id);
                if (deleteFurniture != null)
                {
                    session.Delete(deleteFurniture);
                    transaction.Commit();
                }
                return deleteFurniture;

            }
        }
        /// <summary>
        /// Initializes the packet. All data parsing must be done here.
        /// </summary>
        public override void Init()
        {
            Position = 0;

            houseOid = ReadShort();        // 0x00
            count = ReadByte();            // 0x02
            decorationCode = ReadByte();   // 0x03
            m_furnitures = new Furniture[count];
            for (int i = 0; i < count; i++)
            {
                Furniture furniture = new Furniture();

                furniture.index = ReadByte(); // 0x04
                furniture.flagRemove = false;
                if ((Position + 1 )< Length)
                {
                    furniture.type = ReadByte();
                    furniture.model = ReadShort();
                    if ((furniture.type & 1) == 1)
                        furniture.color = ReadByte(); // color <= 0xFF
                    else if ((furniture.type & 6) == 2) // old emblem
                        furniture.color = ReadShort();
                    else if ((furniture.type & 6) == 6) // new emblem
                        furniture.color = ReadShort();
                    furniture.x = (short)ReadShort();
                    furniture.y = (short)ReadShort();
                    furniture.angle = ReadShort();
                    if ((furniture.type & 8) == 8) // size
                        furniture.size = ReadByte();
                    furniture.surface = ReadByte();
                    furniture.place = ReadByte();
                    if (furniture.model == 0 && furniture.type == 0) // Remove
                    {
                        furniture.flagRemove = true;
                        Skip(4);
                    }
                }
                else
                {
                    furniture.flagRemove = true;
                    Skip(1);
                }

                m_furnitures[i] = furniture;
            }
        }
Beispiel #10
0
        public void AddItem(Furniture furniture, int quantity)
        {
            CartLine line = lineCollection
                .Where(f => f.Furniture.Id == furniture.Id)
                .FirstOrDefault();

            if (line == null)
            {
                lineCollection.Add(new CartLine
                {
                    Furniture = furniture,
                    Quantity = quantity
                });
            }
            else
            {
                line.Quantity += quantity;
            }
        }
        public void UpdateFurniture(Furniture furniture)
        {
            using (ITransaction transaction = session.BeginTransaction())
            {
                Furniture updateFurniture = session.Get<Furniture>(furniture.Id);

                if (updateFurniture != null)
                {
                    updateFurniture.Name = furniture.Name;
                    updateFurniture.Description = furniture.Description;
                    updateFurniture.Price = furniture.Price;
                    updateFurniture.Section = furniture.Section;
                    updateFurniture.ImageData = furniture.ImageData;
                    updateFurniture.ImageMimeType = furniture.ImageMimeType;
                }
                session.SaveOrUpdate(updateFurniture);
                transaction.Commit();

            }
        }
Beispiel #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
		if (!this.IsPostBack)
		{
			// Create Furniture objects.
			Furniture piece1 = new Furniture("Econo Sofa",
				"Acme Inc.", 74.99M);
			Furniture piece2 = new Furniture("Pioneer Table",
				"Heritage Unit", 866.75M);
			Furniture piece3 = new Furniture("Retro Cabinet",
				"Sixties Ltd.", 300.11M);

			// Add objects to session state.
			Session["Furniture1"] = piece1;
			Session["Furniture2"] = piece2;
			Session["Furniture3"] = piece3;

			// Add rows to list control.
			lstItems.Items.Clear();
			lstItems.Items.Add(piece1.Name);
			lstItems.Items.Add(piece2.Name);
			lstItems.Items.Add(piece3.Name);
		}

		// Display some basic information about the session.
		// This is useful for testing configuration settings.
		lblSession.Text = "Session ID: " + Session.SessionID;
		lblSession.Text += "<br>Number of Objects: ";
		lblSession.Text += Session.Count.ToString();
		lblSession.Text += "<br>Mode: " + Session.Mode.ToString();
		lblSession.Text += "<br>Is Cookieless: ";
		lblSession.Text += Session.IsCookieless.ToString();
		lblSession.Text += "<br>Is New: ";
		lblSession.Text += Session.IsNewSession.ToString();
		lblSession.Text += "<br>Timeout (minutes): ";
		lblSession.Text += Session.Timeout.ToString();

    }
        public ActionResult Edit(Furniture furniture, HttpPostedFileBase image = null)
        {
            if (ModelState.IsValid)
            {
                if (image != null)
                {
                    furniture.ImageMimeType = image.ContentType;
                    furniture.ImageData = new byte[image.ContentLength];
                    image.InputStream.Read(furniture.ImageData, 0, image.ContentLength);
                }

                if (furniture.Id != 0)
                    repository.UpdateFurniture(furniture);
                else
                    repository.CreateFurniture(furniture);
                TempData["message"] = string.Format("Изменения в товаре \"{0}\" были сохранены", furniture.Name);
                return RedirectToAction("Index");
            }
            else
            {
                return View(furniture);
            }
        }
Beispiel #14
0
        public void Cannot_Save_Invalid_Changes()
        {
            // Организация - создание имитированного хранилища данных
            Mock<IFurnitureRepository> mock = new Mock<IFurnitureRepository>();

            // Организация - создание контроллера
            AdminController controller = new AdminController(mock.Object);

            // Организация - создание объекта Game
            Furniture furniture = new Furniture { Id = 1, Name = "Мебель1", Description = "Описание", Section = "Раздел", Price = 100 };

            // Организация - добавление ошибки в состояние модели
            controller.ModelState.AddModelError("error", "error");

            // Действие - попытка сохранения товара
            ActionResult result = controller.Edit(furniture);

            // Утверждение - проверка того, что обращение к хранилищу НЕ производится
            mock.Verify(m => m.UpdateFurniture(It.IsAny<Furniture>()), Times.Never());

            // Утверждение - проверка типа результата метода
            Assert.IsInstanceOfType(result, typeof(ViewResult));
        }
Beispiel #15
0
    /// <summary>
    /// Copy Construtor -- don't call this directly unless we never do any subclassing instead use clone() which is more virtual
    /// </summary>
    /// <param name="other"> the OTHER furniture you would like to copy</param>
    protected Furniture(Furniture other)
    {
        this.objectType          = other.objectType;
        this.movementCost        = other.movementCost;
        this.roomEnclosure       = other.roomEnclosure;
        this.width               = other.width;
        this.height              = other.height;
        this.tint                = other.tint;
        this.linksToNeighbour    = other.linksToNeighbour;
        this.furnitureParamaters = new Dictionary <string, float>(other.furnitureParamaters);
        jobs = new List <Job>();

        if (other.updateActions != null)
        {
            this.updateActions = (Action <Furniture, float>)other.updateActions.Clone();
        }

        if (other.funcPositionValidation != null)
        {
            this.funcPositionValidation = (Func <Tile, bool>)other.funcPositionValidation.Clone();
        }

        this.isEnterable = other.isEnterable;
    }
        public void BuildSubRooms()
        {
            Room toilet = new Room("toilet");

            _bigRoom.AddSubRoom(toilet);

            Room      bedRoom = new Room("bedroom");
            Furniture bed     = new Furniture("bed");

            bedRoom.AddFurniture(bed);

            Furniture closet = new Furniture("closet");

            bedRoom.AddFurniture(closet);

            _bigRoom.AddSubRoom(bedRoom);

            Room      dinerRoom = new Room("dinerroom");
            Furniture table     = new Furniture("table");

            dinerRoom.AddFurniture(table);

            _bigRoom.AddSubRoom(dinerRoom);
        }
    // Use this for initialization
    private void Start()
    {
        BuildModeController bmc = WorldController.Instance.buildModeController;

        // For each furniture prototype in our world, create one instance
        // of the button to be clicked!
        foreach (string s in PrototypeManager.Furniture.Keys)
        {
            GameObject go = (GameObject)Instantiate(buildFurnitureButtonPrefab);
            go.transform.SetParent(this.transform);

            Furniture proto    = PrototypeManager.Furniture.GetPrototype(s);
            string    objectId = s;

            go.name = "Button - Build " + objectId;

            go.transform.GetComponentInChildren <TextLocalizer>().formatValues = new string[] { LocalizationTable.GetLocalization(proto.LocalizationCode) };

            Button b = go.GetComponent <Button>();

            b.onClick.AddListener(delegate
            {
                bmc.SetMode_BuildFurniture(objectId);
                this.gameObject.SetActive(false);
            });

            // http://stackoverflow.com/questions/1757112/anonymous-c-sharp-delegate-within-a-loop
            string furn = s;
            LocalizationTable.CBLocalizationFilesChanged += delegate
            {
                go.transform.GetComponentInChildren <TextLocalizer>().formatValues = new string[] { LocalizationTable.GetLocalization(PrototypeManager.Furniture.GetPrototype(furn).LocalizationCode) };
            };
        }

        lastLanguage = LocalizationTable.currentLanguage;
    }
Beispiel #18
0
    public Furniture PlaceFurniture(string furnitureType, Tile tile, bool doRoomFloodFill = true)
    {
        //1x1 tile
        if (!furniturePrototypes.ContainsKey(furnitureType))
        {
            Debug.LogError("FurniturePrototype doesn't contain key " + furnitureType);
            return(null);
        }
        //Debug.Log (furnitureType);
        Furniture furniture = Furniture.PlaceInstance(furniturePrototypes [furnitureType], tile);

        if (furniture == null)
        {
            return(null);
        }

        furniture.RegisterOnRemovedCallback(OnFurnitureRemoved);
        furnitures.Add(furniture);

        if (doRoomFloodFill && furniture.roomEnclosure)
        {
            Room.DoRoomFloodFill(furniture.tile);
        }

        if (furnitureCreatedCallback != null)
        {
            furnitureCreatedCallback(furniture);

            if (furniture.movementCostMultiplier != 1)
            {
                invalidateTileGraph();
            }
        }

        return(furniture);
    }
Beispiel #19
0
    bool IsLineUp(Vector2Int pos, Furniture furniture)
    {
        //      if ()

        for (int i = 0; i < sideCount; i++)
        {
            Vector2Int sidePos = new Vector2Int(pos.x + SideToVector((Side)i).x, pos.y + SideToVector((Side)i).y);
            if (IsFurnitureOfTypeOnTile(furniture, sidePos))
            {
                Vector2Int currentPos;
                //Check tiles on right and left sides, than check that there's is no furniture of this type in front of this tile
                for (int k = 0; k < 3; k++)
                {
                    currentPos = new Vector2Int
                                     ((sidePos.x) + (SideToVector(LeftSide((Side)i)).x) + (k * SideToVector(AdjacentSide((Side)i)).x),
                                     (sidePos.y) + (SideToVector(LeftSide((Side)i)).y) + (k * SideToVector(AdjacentSide((Side)i)).y));
                    if (IsFurnitureOfTypeOnTile(furniture, currentPos))
                    {
                        return(false);
                    }
                }

                for (int k = 0; k < 3; k++)
                {
                    currentPos = new Vector2Int
                                     ((sidePos.x) + (SideToVector(RightSide((Side)i)).x) + (k * SideToVector(AdjacentSide((Side)i)).x),
                                     (sidePos.y) + (SideToVector(RightSide((Side)i)).y) + (k * SideToVector(AdjacentSide((Side)i)).y));
                    if (IsFurnitureOfTypeOnTile(furniture, currentPos))
                    {
                        return(false);
                    }
                }
            }
        }
        return(true);
    }
    void OnLevelStart()
    {
        List <Furniture> prefablist = levelprefablists[Globals.gCurrentLevel - 1].furniturelist;

        queuelength = prefablist.Count;
        for (int i = 0; i < queuelength; ++i)
        {
            int       r         = Random.Range(0, prefablist.Count);
            Vector3   offscreen = new Vector3(10000f, 10000f, 0f);
            Furniture instance  = GameObject.Instantiate(prefablist[r], offscreen, Quaternion.identity);

            // -- show next 3 (first one is active)
            if (i < movingtruckspawn.Length)
            {
                instance.transform.position = movingtruckspawn[i].position;
            }

            levelqueue.Add(instance);

            prefablist.RemoveAt(r);
        }
        clocktimeticks      = levelclocktimeseconds[Globals.gCurrentLevel - 1] * 60;
        this.scoretext.text = "SCORE: " + Globals.gCurrentScore.ToString();
    }
Beispiel #21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            // Create Furniture objects.
            Furniture piece1 = new Furniture("Econo Sofa",
                                             "Acme Inc.", 74.99M);
            Furniture piece2 = new Furniture("Pioneer Table",
                                             "Heritage Unit", 866.75M);
            Furniture piece3 = new Furniture("Retro Cabinet",
                                             "Sixties Ltd.", 300.11M);

            // Add objects to session state.
            Session["Furniture1"] = piece1;
            Session["Furniture2"] = piece2;
            Session["Furniture3"] = piece3;

            // Add rows to list control.
            lstItems.Items.Add(piece1.Name);
            lstItems.Items.Add(piece2.Name);
            lstItems.Items.Add(piece3.Name);
        }

        // Display some basic information about the session.
        // This is useful for testing configuration settings.
        lblSession.Text  = "Session ID: " + Session.SessionID;
        lblSession.Text += "<br />Number of Objects: ";
        lblSession.Text += Session.Count.ToString();
        lblSession.Text += "<br />Mode: " + Session.Mode.ToString();
        lblSession.Text += "<br />Is Cookieless: ";
        lblSession.Text += Session.IsCookieless.ToString();
        lblSession.Text += "<br />Is New: ";
        lblSession.Text += Session.IsNewSession.ToString();
        lblSession.Text += "<br />Timeout (minutes): ";
        lblSession.Text += Session.Timeout.ToString();
    }
Beispiel #22
0
        protected virtual void removeQueuedFurniture(Guid guid)
        {
            Farmer who = Game1.player;

            if (!furniture.ContainsGuid(guid))
            {
                return;
            }
            Furniture furnitureItem = furniture[guid];

            if (!who.couldInventoryAcceptThisItem(furnitureItem))
            {
                return;
            }
            furnitureItem.performRemoveAction(furnitureItem.tileLocation, this);
            furniture.Remove(guid);
            bool foundInToolbar = false;

            for (int i = 0; i < 12; i++)
            {
                if (who.items[i] == null)
                {
                    who.items[i]         = furnitureItem;
                    who.CurrentToolIndex = i;
                    foundInToolbar       = true;
                    break;
                }
            }
            if (!foundInToolbar)
            {
                Item item = who.addItemToInventory(furnitureItem, 11);
                who.addItemToInventory(item);
                who.CurrentToolIndex = 11;
            }
            localSound("coin");
        }
 private static bool PrefixCanBePlacedHere(Furniture __instance, GameLocation l, Vector2 tile, ref bool __result)
 {
     try
     {
         if (!ModEntry.Config.Enabled || !ModEntry.Config.CanPlaceRugsUnder ||
             !__instance.furniture_type.Value.Equals(Furniture.rug) ||
             __instance.placementRestriction != 0 || // someone requested a custom placement restriction, respect that.
             l.CanPlaceThisFurnitureHere(__instance)
             /*|| __instance.GetAdditionalFurniturePlacementStatus(l, (int)tile.X * 64, (int)tile.Y * 64) != 0*/)
         {
             return(true);
         }
         Rectangle bounds = __instance.boundingBox.Value;
         (int tileX, int tileY) = tile.ToPoint();
         for (int x = 0; x < bounds.Width / 64; x++)
         {
             for (int y = 0; y < bounds.Height / 64; y++)
             {
                 Vector2 currentTile = new(tileX + x, tileY + y);
                 if ((l.terrainFeatures.TryGetValue(currentTile, out TerrainFeature possibletree) && possibletree is Tree) ||
                     l.isTerrainFeatureAt((int)currentTile.X, (int)currentTile.Y))
                 {
                     __result = false;
                     return(false);
                 }
             }
         }
         __result = true;
         return(false);
     }
     catch (Exception ex)
     {
         ModEntry.ModMonitor.Log($"Ran into errors in PrefixCanBePlacedHere for {__instance.Name} at {l.NameOrUniqueName} ({tile.X}, {tile.Y})\n\n{ex}", LogLevel.Error);
     }
     return(true);
 }
Beispiel #24
0
    void ShowFurnitureSpriteAtTile(string furnitureType, Tile tile)
    {
        go = new GameObject();
        go.transform.SetParent(this.transform, true);
        dragCursors.Add(go);

        SpriteRenderer sr = go.AddComponent <SpriteRenderer> ();

        sr.sprite           = furnitureSpriteController.GetSpriteForFurniture(furnitureType);
        sr.sortingLayerName = "Jobs";

        if (WorldController.Instance.world.IsFurniturePlacementValid(furnitureType, tile))
        {
            sr.color = new Color(0.5f, 1f, 0.5f, 0.25f);
        }
        else
        {
            sr.color = new Color(1f, 0.5f, 0.5f, 0.25f);
        }

        Furniture furniturePrototype = World.worldInstance.GetFurniturePrototype(furnitureType);

        go.transform.position = new Vector3(tile.X + ((furniturePrototype.width - 1) / 2f), tile.Y + ((furniturePrototype.height - 1) / 2f), 0);
    }
Beispiel #25
0
    public static void DoorUpdateAction(Furniture furn, float deltaTime)
    {
        //Debug.Log("Door_UpdateAction: " + furn.furnParameters["openness"]);

        if (furn.furnParameters["is_opening"] >= 1)
        {
            furn.furnParameters["openness"] = furn.furnParameters["openness"] + (deltaTime * 4);   // FIXME: Maybe a door open speed parameter?
            if (furn.furnParameters["openness"] >= 1)
            {
                furn.furnParameters["is_opening"] = 0;
            }
        }
        else
        {
            furn.furnParameters["openness"] = furn.furnParameters["openness"] - (deltaTime * 4);
        }

        furn.furnParameters["openness"] = Mathf.Clamp01(furn.furnParameters["openness"]);

        if (furn.cbOnChanged != null)
        {
            furn.cbOnChanged(furn);
        }
    }
Beispiel #26
0
    public void PlaceFurniture(string objectType, Tile t)
    {
        //Debug.Log("PlaceInstalledObject");
        // TODO: This function assumes 1x1 tiles -- change this later!

        if (furniturePrototypes.ContainsKey(objectType) == false)
        {
            Debug.LogError("furniturePrototypes doesn't contain a proto for key: " + objectType);
            return;
        }

        Furniture obj = Furniture.PlaceInstance(furniturePrototypes[objectType], t);

        if (obj == null)
        {
            // Failed to place object -- most likely there was already something there.
            return;
        }

        if (cbFurnitureCreated != null)
        {
            cbFurnitureCreated(obj);
        }
    }
    void ReadXml_Furnitures(XmlReader reader)
    {
        Debug.Log("ReadXml_Furnitures");

        if (reader.ReadToDescendant("Furniture"))
        {
            do
            {
                int x = int.Parse(reader.GetAttribute("X"));
                int y = int.Parse(reader.GetAttribute("Y"));

                Furniture furn = PlaceFurniture(reader.GetAttribute("objectType"), tiles[x, y], false);
                furn.ReadXml(reader);
            } while (reader.ReadToNextSibling("Furniture"));

/*			We don't need to do a flood fill on load, because we're getting room info
 *                      from the save file
 *
 *                      foreach(Furniture furn in furnitures) {
 *                              Room.DoRoomFloodFill( furn.tile, true );
 *                      }
 */
        }
    }
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            int  quant     = Int32.Parse(cbQuantity.Text);
            bool firstTime = true;

            foreach (var f in Project.Instance.Bill.FurnitureForSaleList)
            {
                var price = f.Price;
                if (f.PriceOnSale != 0)
                {
                    price = f.PriceOnSale;
                }
                if (furniture.ID == f.ID)
                {
                    firstTime  = false;
                    f.Quantity = f.Quantity + quant;
                    Project.Instance.Bill.FullPrice = Project.Instance.Bill.FullPrice + (price * quant);
                }
            }
            if (firstTime)
            {
                Furniture selledFurniture = (Furniture)furniture.Clone();
                selledFurniture.Quantity = quant;
                Project.Instance.Bill.FurnitureForSaleList.Add(selledFurniture);
                foreach (var f in Project.Instance.Bill.FurnitureForSaleList)
                {
                    var price = f.Price;
                    if (f.PriceOnSale != 0)
                    {
                        price = f.PriceOnSale;
                        Project.Instance.Bill.FullPrice = Project.Instance.Bill.FullPrice + (price * quant);
                    }
                }
            }
            this.Close();
        }
Beispiel #29
0
    void Update()
    {
        m_cam = Camera.main.transform;
        RaycastHit hit;

        //If the player isnt hiding it will restrict player movement when 'e' is pressed
        if(!m_isHiding)
        {
            if(Physics.Raycast(m_cam.position, m_cam.TransformDirection(Vector3.forward), out hit, interactionDistance))
            {
                if(hit.transform.tag == "furniture")
                {
                    if(Input.GetKeyDown("e"))
                    {
                        furnitureScript = hit.transform.GetComponentInChildren<Furniture>();
                        if(furnitureScript.setHider(transform))
                        {
                            m_isHiding = true;
                        }
                        //set player movement restrictions
                    }
                }
            }
        }
        //If the player is hiding, pressing 'e' will release player movement
        else
        {
            if(Input.GetKeyDown("e"))
            {
                stopHiding();
        //				transform.rigidbody.constraints = RigidbodyConstraints.FreezeAll;
                //GetComponent<Rigidbody>().constraints
                furnitureScript.releaseHider();
            }
        }
    }
Beispiel #30
0
        public IActionResult UpdateFurnitureById([FromBody] Furniture newFurniture)
        {
            if (newFurniture == null)
            {
                return(BadRequest());
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            if (!_furnitureInfoRepository.FurnitureExists(newFurniture.FurnitureId))
            {
                return(NotFound($"No furniture with the id: {newFurniture.FurnitureId} was found"));
            }

            // if IsFurnitureSet is true then add that row in the DB
            if (newFurniture.IsFurnitureSet == true)
            {
            }

            _furnitureInfoRepository.updateFurnitureByFurnitureId(newFurniture);

            return(Ok(newFurniture));
        }
Beispiel #31
0
        /// <summary>
        /// Searches for furniture by serial number
        /// </summary>
        /// <param name="serialNumber">serial number</param>
        /// <returns>furniture that matches that serial number</returns>
        public List <Furniture> GetFurnitureBySerialNumber(string serialNumber)
        {
            Furniture        chosenFurniture = new Furniture();
            List <Furniture> furnitureList   = new List <Furniture>();

            chosenFurniture.SerialNumber = serialNumber;

            string selectStatement = "SELECT furniture.furniture_id as FurnitureID, serial_no AS 'Serial Number', furniture.description AS Item, furniture_style.description AS Style, total_available AS 'Total Available', daily_rental_rate AS 'Daily Rental Rate' " +
                                     "FROM furniture JOIN furniture_style ON furniture.style_id = furniture_style.style_id JOIN inventory ON furniture.furniture_id = inventory.furniture_id WHERE furniture.serial_no = @SerialNumber";

            ;

            using (SqlConnection connection = FurnitureRentalsDBConnection.GetConnection())
            {
                connection.Open();

                using (SqlCommand selectCommand = new SqlCommand(selectStatement, connection))
                {
                    selectCommand.Parameters.AddWithValue("@SerialNumber", chosenFurniture.SerialNumber);
                    using (SqlDataReader reader = selectCommand.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            chosenFurniture.FurnitureID     = (int)reader["FurnitureID"];
                            chosenFurniture.SerialNumber    = reader["Serial Number"].ToString();
                            chosenFurniture.ItemDescription = reader["Item"].ToString();
                            chosenFurniture.FurnitureStyle  = reader["Style"].ToString();
                            chosenFurniture.Quantity        = (int)reader["Total Available"];
                            chosenFurniture.DailyRentalRate = (decimal)reader["Daily Rental Rate"];
                            furnitureList.Add(chosenFurniture);
                        }
                    }
                }
            }
            return(furnitureList);
        }
Beispiel #32
0
        private static void UsingReflection()
        {
            Console.WriteLine(WorkWithReflection.GetCurrentMethod());

            Furniture furniture = new Furniture {
                Id = 1, Name = "CHAIR", Price = 1.23
            };

            Console.WriteLine("Ex 1 Dump an object:");
            WorkWithReflection.DumpObject(furniture);
            Console.WriteLine();

            Console.WriteLine("Ex 2 Invoke methods:");
            WorkWithReflection.InvokeMethods(furniture);
            Console.WriteLine();

            List <Employee> employees = new List <Employee>()
            {
                new Employee()
                {
                    Name = "Lou", Category = 12
                },
                new Employee()
                {
                    Name = "Wayne", Category = 8
                },
            };

            Console.WriteLine("Ex 3 Invoke other methods:");
            WorkWithReflection.InvokeMethodNoArgument(employees[0], employees[1], "CompareTo", typeof(Employee));
            Console.WriteLine();

            WorkWithReflection.CompanyTestAttribute();

            WorkWithReflection.GetFolderClasses();
        }
        public void Handler_Should_Be_Invalid_When_Payment_Invalid()
        {
            var repAcommodation = new AcommodationRepository();
            var repFurniture    = new FurnitureRepository();
            var payService      = new PaymentService();

            var handler = new FurnitureReservationHandler(repFurniture, repAcommodation, payService);

            var user      = new User("Matheus barbosa", "*****@*****.**", new Adress("Rua x", "123", "SÃO PAULO"));
            var furniture = new Furniture("Descriçao", new Adress("Rua y", "321", "SÃO PAULO"));

            var payment = new Payment(500, 200);



            var commandRequest = new FurnitureReservationRequest()
            {
                User = user, Furniture = furniture, Payment = payment, Checkin = DateTime.Now, Checkout = DateTime.Now.AddDays(3)
            };
            var res = handler.Handle(commandRequest, new System.Threading.CancellationToken());


            Assert.True(handler.Contract.Invalid);
        }
Beispiel #34
0
    public bool placeFurniture(Furniture furnitureInstance)
    {
        if (furnitureInstance == null)
        {
            return(UnplaceFurniture());
        }

        if (!furnitureInstance.isValidPosition(this))
        {
            Debug.LogError("placeFurniture - Trying to assing a furniture to a uneligible one");
            return(false);
        }

        for (int x_off = X; x_off < (X + furnitureInstance.width); x_off++)
        {
            for (int y_off = Y; y_off < (Y + furnitureInstance.height); y_off++)
            {
                Tile tile = World.worldInstance.getTileAt(x_off, y_off);
                tile.furniture = furnitureInstance;
            }
        }

        return(true);
    }
    public void selectFurniture()
    {
        if (current != null)
        {
            if (current.GetComponent <Creator>() == null)
            {
                current.removeHighlight();
            }
        }

        if (furnitures.Count > 0)
        {
            selected = null;
            float minDistance = 1000f;

            foreach (Furniture furniture in furnitures)
            {
                float distance = Vector3.Distance(transform.position, furniture.transform.position);
                if (distance < minDistance)
                {
                    minDistance = distance;
                    selected    = furniture;
                }
            }

            if (selected != null)
            {
                if (selected.GetComponent <Creator>() == null)
                {
                    //Debug.Log("El mas cercano es: " + selected.name);
                    selected.Highlight();
                    current = selected;
                }
            }
        }
    }
Beispiel #36
0
    public bool PlaceFurniture(Furniture objInstance)
    {
        if (objInstance == null)
        {
            return(UnplaceFurniture());
        }

        if (objInstance.IsValidPosition(this) == false)
        {
            Debug.ULogErrorChannel("Tile", "Trying to assign a furniture to a tile that isn't valid!");
            return(false);
        }

        for (int x_off = X; x_off < X + objInstance.Width; x_off++)
        {
            for (int y_off = Y; y_off < Y + objInstance.Height; y_off++)
            {
                Tile t = World.Current.GetTileAt(x_off, y_off, Z);
                t.Furniture = objInstance;
            }
        }

        return(true);
    }
Beispiel #37
0
    /// <summary>
    /// Deconstructs the furniture.
    /// </summary>
    public void Deconstruct()
    {
        int    x                = Tile.X;
        int    y                = Tile.Y;
        int    fwidth           = 1;
        int    fheight          = 1;
        string linksToNeighbour = string.Empty;

        if (Tile.Furniture != null)
        {
            Furniture furniture = Tile.Furniture;
            fwidth           = furniture.Width;
            fheight          = furniture.Height;
            linksToNeighbour = furniture.LinksToNeighbour;
            furniture.Jobs.CancelAll();
        }

        // We call lua to decostruct
        EventActions.Trigger("OnUninstall", this);

        // Update thermalDiffusifity to default value
        World.Current.temperature.SetThermalDiffusivity(Tile.X, Tile.Y, Tile.Z, Temperature.defaultThermalDiffusivity);

        // Let our workspot tile know it is no longer reserved for us
        World.Current.UnreserveTileAsWorkSpot(this);

        Tile.UnplaceFurniture();

        if (deconstructInventory != null)
        {
            foreach (Inventory inv in deconstructInventory)
            {
                inv.MaxStackSize = PrototypeManager.Inventory.Get(inv.Type).maxStackSize;
                World.Current.InventoryManager.PlaceInventoryAround(Tile, inv.Clone());
            }
        }

        if (Removed != null)
        {
            Removed(this);
        }

        // Do we need to recalculate our rooms?
        if (RoomEnclosure)
        {
            World.Current.RoomManager.DoRoomFloodFill(Tile, false);
        }

        ////World.current.InvalidateTileGraph();

        if (World.Current.tileGraph != null)
        {
            World.Current.tileGraph.RegenerateGraphAtTile(Tile);
        }

        // We should inform our neighbours that they have just lost a
        // neighbour regardless of type.
        // Just trigger their OnChangedCallback.
        if (linksToNeighbour != string.Empty)
        {
            for (int xpos = x - 1; xpos < x + fwidth + 1; xpos++)
            {
                for (int ypos = y - 1; ypos < y + fheight + 1; ypos++)
                {
                    Tile t = World.Current.GetTileAt(xpos, ypos, Tile.Z);
                    if (t != null && t.Furniture != null && t.Furniture.Changed != null)
                    {
                        t.Furniture.Changed(t.Furniture);
                    }
                }
            }
        }

        // At this point, no DATA structures should be pointing to us, so we
        // should get garbage-collected.
    }
Beispiel #38
0
    //assigns string for iPhone generation
    public static void InitializeFurniture()
    {
        if(iPhone.generation == iPhoneGeneration.iPad2Gen ||
            iPhone.generation == iPhoneGeneration.iPadMini1Gen){
            deviceGeneration = "iPad2";
        }
        else if(iPhone.generation == iPhoneGeneration.iPad3Gen ||
            iPhone.generation == iPhoneGeneration.iPad4Gen){
            deviceGeneration = "iPad4";
        }

        welcomeScreen = (GameObject)Instantiate(Resources.Load("Prefabs/WelcomeScreen"));
        welcomeScreen.GetComponent<WelcomeScreen>().InitCenter();

        //Hides iOS keyboard input field
        TouchScreenKeyboard.hideInput = true;

        //Creates Furniture Objects

        //Test Cabinet
        /*Texture2D CabinetTex = (Texture2D)Resources.Load(ThumbnailFolder + "Aeron_Round_01");
        Furniture Cabinet = new Furniture("Cabinet_Proxy", "Cabinet", false, CabinetTex);
        FurnitureCollection.AddToFurnitureList(Cabinet);*/

        #region Designer Furniture
        //Order of load is important for display

        //Eames
        Texture2D EamesShellChairTex = (Texture2D)Resources.Load(ThumbnailFolder + "Eames_Shell_tn_Round");
        Furniture EamesShellChair = new Furniture("Shell", "Eames",
            "Fiberglass Side Shell Dimensions: 18W x 1H x 16D\n" +
            "Eiffel Dimensions: 19W x 17H x 17D",
            "The Case Study Fiberglass Eiffel Chair is a classic icon and its name holds no enigma. " +
            "Pick your shell and choose the wire-frame in either chrome-plated steel or black powder-coated steel " +
            "for a visually satisfying chair.",
            false, EamesShellChairTex);
        FurnitureCollection.AddToFurnitureList(EamesShellChair);

        Texture2D EamesChairTex = (Texture2D)Resources.Load(ThumbnailFolder + "Eames_LCM_tn_Round");
        Furniture EamesChair = new Furniture("LCM", "Eames",
            "26.5H x 22H x 24.5D Seat H 15.5",
            "The iconic LCM (1946) began as an experiment in the Eameses apartment, where they were molding " +
            "plywood in what they called the Kazam! Machine. The machine pressed thin sheets of wood veneer " +
            "against a heated membrane that was inflated by a bicycle pump.",
            false, EamesChairTex);
        FurnitureCollection.AddToFurnitureList(EamesChair);

        Texture2D EamesWireTex = (Texture2D)Resources.Load(ThumbnailFolder + "Eames_Wire_tn_Round");
        Furniture EamesWire = new Furniture("Wire", "Eames",
            "H 32.75 W 19 D 21.25 Seat H 18.5",
            "After refining their molded plastic chairs, Charles and Ray Eames began experimenting with a " +
            "chair made of welded wire.",
            false, EamesWireTex);
        FurnitureCollection.AddToFurnitureList(EamesWire);

        Texture2D EamesRockerTex = (Texture2D)Resources.Load(ThumbnailFolder + "Eames_Rocker_tn_Round");
        Furniture EamesRocker = new Furniture("Rocker", "Eames",
            "Fiberglass Arm Shell Dimensions: 25W x 18H x 18D\n" + "Rocker Dimensions: 15.5W x 14H 27D",
            "The Case Study Fiberglass Rocking Chair is an essential for the modern home and with so many options, it " +
            "is possible to create your own one-of-a-kind chair.",
            false, EamesRockerTex);
        FurnitureCollection.AddToFurnitureList(EamesRocker);

        Texture2D LaChaiseEamesTex = (Texture2D)Resources.Load(ThumbnailFolder + "Eames_La_Chaise_tn_Round");
        Furniture LaChaiseEames = new Furniture("La_Chaise", "Eames",
            "H 34.5 W 59 D 35.5 Seat H 15.5",
            "The voluptuous organic form of the Eames La Chaise was an evolution of plywood chairs developed a " +
            "year earlier in collaboration with architect Eero Saarinen for the Organic Design in Home Furnishings" +
            "competition at the Museum of Modern Art, New York.",
            false, LaChaiseEamesTex);
        FurnitureCollection.AddToFurnitureList(LaChaiseEames);

        Texture2D EamesLoungeChairOttomanTex = (Texture2D)Resources.Load(ThumbnailFolder + "Eames_Lounge_Set_tn_Round");
        Furniture EamesLoungeChairOttoman = new Furniture("Lounge_and_Ottoman", "Eames",
            "Chair: H 32 W 32.75 D 32.75 Seat H 15\nOttoman: H 17.25 W 26 D 21.5",
            "Their iconic Eames Lounge Chair (1956) began with a desire to create a chair with the warm, receptive " +
            "look of a well-used first basemans mitt. In continuous production since its introduction in 1956, the " +
            "Eames Lounge Chair is widely considered one of the most significant designs of the 20th century.",
            false, EamesLoungeChairOttomanTex);
        FurnitureCollection.AddToFurnitureList(EamesLoungeChairOttoman);

        //Nelson
        Texture2D NelsonPretzelTex = (Texture2D)Resources.Load(ThumbnailFolder + "Nelson_Pretzel_tn_Round");
        Furniture NelsonPretzel = new Furniture("Pretzel", "Nelson",
            "733 x 675 x 479 mm",
            "In 1952, predating the famous Coconut Chair or the Marshmallow Sofa, he designed a chair made " +
            "of moulded plywood originally referred to simply as the Laminated Chair. The bold and elegant curve " +
            "of the seat back and armrest soon earned it the nickname Pretzel Chair. ",
            false, NelsonPretzelTex);
        FurnitureCollection.AddToFurnitureList(NelsonPretzel);

        Texture2D NelsonMarshmellowTex = (Texture2D)Resources.Load(ThumbnailFolder + "Nelson_Marshmellow_tn_Round");
        Furniture NelsonMarshmellow = new Furniture("Marshmellow", "Nelson",
            "H 31 W 52 D 29",
            "The Marshmallow sofa brightens a room and makes a playful or dramatic statement, depending upon the " +
            "materials and colors you choose. Its whimsical design comprises 18 round, comfortable cushions that seem " +
            "to float on the brushed tubular steel frame. The sofa's unique appearance and eye-catching appeal led the " +
            "way into the pop art style of the 1960s.",
            false, NelsonMarshmellowTex);
        FurnitureCollection.AddToFurnitureList(NelsonMarshmellow);

        Texture2D NelsonVitraTrayTex = (Texture2D)Resources.Load(ThumbnailFolder + "Nelson_Vitra_Tray_tn_Round");
        Furniture NelsonVitraTray = new Furniture("Vitra_Tray", "Nelson",
            "H 19.5 - 27.25 W 15.25 D 15.25",
            "The Vitra Tray Table from George Nelson is characterized by its simple, classic elegance and intricate individual elements.",
            false, NelsonVitraTrayTex);
        FurnitureCollection.AddToFurnitureList(NelsonVitraTray);

        //Saarinen
        Texture2D SaarinenTulipChairTex = (Texture2D)Resources.Load(ThumbnailFolder + "Saarinen_Tulip_Chair_tn_Round");
        Furniture SaarinenTulipChair = new Furniture("Tulip_Chair", "Saarinen",
            "H 32 W 20 D 21.25 Seat H 18.5",
            "Eero Saarinen vowed to address the ugly, confusing, unrestful world he observed underneath chairs and tables " +
            "-- the so-called slum of legs. A five-year design investigation led him to the revolutionary Pedestal Collection, " +
            "including the Tulip Chair, introduced in 1958.",
            false, SaarinenTulipChairTex);
        FurnitureCollection.AddToFurnitureList(SaarinenTulipChair);

        Texture2D SaarinenTulipArmchairTex = (Texture2D)Resources.Load(ThumbnailFolder + "Saarinen_Tulip_ArmChair_tn_Round");
        Furniture SaarinenTulipArmchair = new Furniture("Tulip_Armchair", "Saarinen",
            "31 1/2 x 25 1/4 x 23 1/2",
            "The Tulip Armchair, which resembles the flower but also a stemmed wineglass, is part of Saarinen's last furniture series.",
            false, SaarinenTulipArmchairTex);
        FurnitureCollection.AddToFurnitureList(SaarinenTulipArmchair);

        Texture2D SaarinenBallChairTex = (Texture2D)Resources.Load(ThumbnailFolder + "Saarinen_Ball_tn_Round");
        Furniture SaarinenBallChair = new Furniture("Ball", "Saarinen",
            "N/A",
            "Due to its unusual shape Ball Chair sticks in your mind and is one of the most memorable examples of furniture design of the 1960s.",
            false, SaarinenBallChairTex);
        FurnitureCollection.AddToFurnitureList(SaarinenBallChair);

        Texture2D SaarinenWombChairStoolTex = (Texture2D)Resources.Load(ThumbnailFolder + "Saarinen_Womb_Set_tn_Round");
        Furniture SaarinenWombChairStool = new Furniture("Womb_Chair_and_Stool", "Saarinen",
            "Chair: H 35.5 W 40 D 34 Seat H 16\nStool: H 16 W 25.5 D 20",
            "Eero Saarinen designed the groundbreaking Womb Chair at Florence Knoll request for a chair that was like a " +
            "basket full of pillows - something I could really curl up in. The fiberglass design supported multiple sitting " +
            "postures and provided a comforting sense of security - hence the name. ",
            false, SaarinenWombChairStoolTex);
        FurnitureCollection.AddToFurnitureList(SaarinenWombChairStool);

        Texture2D SaarinenTulipTableATex = (Texture2D)Resources.Load(ThumbnailFolder + "Saarinen_Tulip_Table_A_tn_Round");
        Furniture SaarinenTulipTableA = new Furniture("Tulip_Table_A", "Saarinen",
            "H 29.5 W 80.5 L 52.3",
            "N/A",
            false, SaarinenTulipTableATex);
        FurnitureCollection.AddToFurnitureList(SaarinenTulipTableA);

        Texture2D SaarinenTulipTableFTex = (Texture2D)Resources.Load(ThumbnailFolder + "Saarinen_Tulip_Table_F_tn_Round");
        Furniture SaarinenTulipTableF = new Furniture("Tulip_Table_F", "Saarinen",
            "H 29.5 W 71 L 71",
            "N/A",
            false, SaarinenTulipTableFTex);
        FurnitureCollection.AddToFurnitureList(SaarinenTulipTableF);

        Texture2D SaarinenTulipTableCTex = (Texture2D)Resources.Load(ThumbnailFolder + "Saarinen_Tulip_Table_C_tn_Round");
        Furniture SaarinenTulipTableC = new Furniture("Tulip_Table_C", "Saarinen",
            "H 20 W 17 L 17",
            "N/A",
            false, SaarinenTulipTableCTex);
        FurnitureCollection.AddToFurnitureList(SaarinenTulipTableC);

        Texture2D SaarinenTulipTableETex = (Texture2D)Resources.Load(ThumbnailFolder + "Saarinen_Tulip_Table_E_tn_Round");
        Furniture SaarinenTulipTableE = new Furniture("Tulip_Table_E", "Saarinen",
            "H 20 W 20.5 L 20.5",
            "N/A",
            false, SaarinenTulipTableETex);
        FurnitureCollection.AddToFurnitureList(SaarinenTulipTableE);

        Texture2D SaarinenTulipTableBTex = (Texture2D)Resources.Load(ThumbnailFolder + "Saarinen_Tulip_Table_B_tn_Round");
        Furniture SaarinenTulipTableB = new Furniture("Tulip_Table_B", "Saarinen",
            "H 20 W 23 L 16",
            "N/A",
            false, SaarinenTulipTableBTex);
        FurnitureCollection.AddToFurnitureList(SaarinenTulipTableB);

        Texture2D SaarinenTulipTableDTex = (Texture2D)Resources.Load(ThumbnailFolder + "Saarinen_Tulip_Table_D_tn_Round");
        Furniture SaarinenTulipTableD = new Furniture("Tulip_Table_D", "Saarinen",
            "H 15.5 W 23 L 23",
            "N/A",
            false, SaarinenTulipTableDTex);
        FurnitureCollection.AddToFurnitureList(SaarinenTulipTableD);

        //Wegner - Main Category
        Texture2D PPMobler62Tex = (Texture2D)Resources.Load(ThumbnailFolder + "PP_Mobler_62_tn_Round");
        Furniture PPMobler62 = new Furniture("PP62", "Wegner",
            "H 66 W 58 D 48 Seat H 43",
            "pp62 is a versatile chair with many interesting solutions. The back draws attention due to its " +
            "organic idiom, creating an interesting geometrical structure. As always with Wegner, the point of " +
            "departure is pragmatic. He thus combines solid and laminated wood into the top rail.",
            false, PPMobler62Tex);
        FurnitureCollection.AddToFurnitureList(PPMobler62);

        Texture2D PPMobler68Tex = (Texture2D)Resources.Load(ThumbnailFolder + "PP_Mobler_68_tn_Round");
        Furniture PPMobler68 = new Furniture("PP68", "Wegner",
            "H 71 W 58 D 48",
            "In 1987, 73 years old, Hans J. Wegner designed the pp68 as his final basic chair. Genuine in all aspects " +
            "- comfortable, practical, strong, durable and affordable. ",
            false, PPMobler68Tex);
        FurnitureCollection.AddToFurnitureList(PPMobler68);

        Texture2D PPMoblerCowHornChairTex = (Texture2D)Resources.Load(ThumbnailFolder + "PP_Mobler_Cow_Horn_tn_Round");
        Furniture PPMoblerCowHornChair = new Furniture("Cow_Horn", "Wegner",
            "H 71 W 59 D 45 Seat H 42",
            "Designed in 1952 the Cow Horn Chair is the immediate follow up on the breakthrough of Wegner's carrier, " +
            "the Round Chair, and the continuity in shape and philosophy is obvious. But serving a different purpose " +
            "Wegner created a chair that was to play an important role in his following line of works.",
            false, PPMoblerCowHornChairTex);
        FurnitureCollection.AddToFurnitureList(PPMoblerCowHornChair);

        Texture2D WegnerValetChairTex = (Texture2D)Resources.Load(ThumbnailFolder + "Wegner_Valet_tn_Round");
        Furniture WegnerValetChair = new Furniture("Valet", "Wegner",
            "H 95 W 51 D 50 Seat H 45",
            "Fun often plays a major part in Wegner's work. And this is perhaps most obvious in The Valet Chair. " +
            "The idea for the chair was conceived in 1951 after a long talk with Professor of Architecture Steen Eiler " +
            "Rasmussen and designer Bo Bojesen about the problems in folding clothes in the most practical manner at bedtime.",
            false, WegnerValetChairTex);
        FurnitureCollection.AddToFurnitureList(WegnerValetChair);

        Texture2D CarlHansen33Tex = (Texture2D)Resources.Load(ThumbnailFolder + "Carl_Hansen_33_tn_Round");
        Furniture CarlHansen33 = new Furniture("CH33", "Wegner",
            "H 74 W 55 D 48 Seat H 44",
            "The CH33 chair has been designed by Hans J. Wegner in 1957. Carl Hansen proposed a contemporary twist on the original design.",
            false, CarlHansen33Tex);
        FurnitureCollection.AddToFurnitureList(CarlHansen33);

        Texture2D CarlHansenShellChairTex = (Texture2D)Resources.Load(ThumbnailFolder + "Carl_Hansen_Shell_tn_Round");
        Furniture CarlHansenShellChair = new Furniture("CH07", "Wegner",
            "H 83 W 92 D 83 Seat H 35",
            "Shell chair is one of the most original chairs designed by Hans J. Wegner. ",
            false, CarlHansenShellChairTex);
        FurnitureCollection.AddToFurnitureList(CarlHansenShellChair);

        Texture2D CarlHansen25Tex = (Texture2D)Resources.Load(ThumbnailFolder + "Carl_Hansen_25_tn_Round");
        Furniture CarlHansen25 = new Furniture("CH25", "Wegner",
            "H 73 W 71 D 73 Seat H 35",
            "Hans J. Wegners oblique back legs give a very characteristic look to the CH25, both calm and dynamic.",
            false, CarlHansen25Tex);
        FurnitureCollection.AddToFurnitureList(CarlHansen25);

        Texture2D PPMoblerCircleChairTex = (Texture2D)Resources.Load(ThumbnailFolder + "PP_Mobler_Circle_tn_Round");
        Furniture PPMoblerCircleChair = new Furniture("Circle", "Wegner",
            "H 97 W 112 D 94 Seat H 42",
            "In 1986 PP Mobler initiated the production of this remarkable chair, which Wegner designed for the workshop. " +
            "Like the Flag Halyard Chair, the Circle Chair's design appears unconnected with both historical predecessors " +
            "and Wegner's remaining production.",
            false, PPMoblerCircleChairTex);
        FurnitureCollection.AddToFurnitureList(PPMoblerCircleChair);

        Texture2D CarlHansenWingChairTex = (Texture2D)Resources.Load(ThumbnailFolder + "Carl_Hansen_Wing_tn_Round");
        Furniture CarlHansenWingChair = new Furniture("Wing", "Wegner",
            "H 103 W 90 D 90 Seat H 60",
            "Hans J. Wegner designed the wing chair in 1960.",
            false, CarlHansenWingChairTex);
        FurnitureCollection.AddToFurnitureList(CarlHansenWingChair);

        Texture2D ErikJoergensenOxchairTex = (Texture2D)Resources.Load(ThumbnailFolder + "Erik_Jeorgensen_Oxchair_tn_Round");
        Furniture ErikJoergensenOxchair = new Furniture("Oxchair", "Wegner",
            "H 35.5 W 39 D 39 Seat H 14",
            "Wegner's fascination with Picasso inspired him to do this sculptural and powerful chair.",
            false, ErikJoergensenOxchairTex);
        FurnitureCollection.AddToFurnitureList(ErikJoergensenOxchair);

        Texture2D PPMoblerTeddyChairStoolTex = (Texture2D)Resources.Load(ThumbnailFolder + "PP_Mobler_Teddy_Bear_Set_tn_Round");
        Furniture PPMoblerTeddyChairStool = new Furniture("Teddy_Chair_and_Footstool", "Wegner",
            "Chair: H 101 W 90 D 95 Seat H 42\nStool: H 43 W 65 D 40",
            "Be embraced by the great bear paws of this all time maximum comfort easy chair. " +
            "Consider it an investment for life, and along comes at least two weeks of thorough work of Danish craftsmen. ",
            false, PPMoblerTeddyChairStoolTex);
        FurnitureCollection.AddToFurnitureList(PPMoblerTeddyChairStool);

        Texture2D CarlHansen103Tex = (Texture2D)Resources.Load(ThumbnailFolder + "Carl_Hansen_103_tn_Round");
        Furniture CarlHansen103 = new Furniture("CH103", "Wegner",
            "H 28 W 85.5 D 30 Seat H 16.5",
            "Hans J. Wegner designed this series in the early 70s with the Danish firm Johannes Hansen, " +
            "producing a limited number at that time.",
            false, CarlHansen103Tex);
        FurnitureCollection.AddToFurnitureList(CarlHansen103);

        Texture2D PPMobler75Tex = (Texture2D)Resources.Load(ThumbnailFolder + "PP_Mobler_75_tn_Round");
        Furniture PPMobler75 = new Furniture("PP75", "Wegner",
            "H 70 W 140 D 140",
            "The table was designed by Hans J. Wegner in 1982 for PP Mobler. pp75 is an exiting table from Wegner's hand. " +
            "Especially noticeable is the frame, where we see Wegner's preoccupation with triangles.",
            false, PPMobler75Tex);
        FurnitureCollection.AddToFurnitureList(PPMobler75);

        Texture2D PPMoblerTondernTable01Tex = (Texture2D)Resources.Load(ThumbnailFolder + "PP_Mobler_Tondern_Table_01_tn_Round");
        Furniture PPMoblerTeddyTondernTable01 = new Furniture("Tondern_Table_01", "Wegner",
            "H 71 W 180 D 86",
            "N/A",
            false, PPMoblerTondernTable01Tex);
        FurnitureCollection.AddToFurnitureList(PPMoblerTeddyTondernTable01);

        Texture2D PPMoblerTondernTable02Tex = (Texture2D)Resources.Load(ThumbnailFolder + "PP_Mobler_Tondern_Table_02_tn_Round");
        Furniture PPMoblerTeddyTondernTable02 = new Furniture("Tondern_Table_02", "Wegner",
            "H 71 W 160 D 86",
            "N/A",
            false, PPMoblerTondernTable02Tex);
        FurnitureCollection.AddToFurnitureList(PPMoblerTeddyTondernTable02);
        #endregion Designer Furniture
    }
Beispiel #39
0
 void showInfo(Furniture furniture)
 {
     overlay.SetStrings(furniture);
     showOverlay = true;
 }
Beispiel #40
0
 void spawnFurniture(Furniture furniture)
 {
     Camera.mainCamera.GetComponent<MainInterface>().PickFurniture(furniture);
     sideMenu.Reset();
     upperMenu.resetSearchBar();
 }
Beispiel #41
0
 public void RemoveLine(Furniture furniture)
 {
     lineCollection.RemoveAll(l => l.Furniture.Id == furniture.Id);
 }
Beispiel #42
0
    public bool PlaceFurniture(Furniture objInstance)
    {
        if(objInstance == null) {
            // We are uninstalling whatever was here before.
            furniture = null;
            return true;
        }

        // objInstance isn't null

        if(furniture != null) {
            Debug.LogError("Trying to assign a furniture to a tile that already has one!");
            return false;
        }

        // At this point, everything's fine!

        furniture = objInstance;
        return true;
    }
    /**
     * Hook from interface.
     *
     * Adds furniture from Resources folder to marker origin.
     *
     * Tracks furniture in active list.
     *
     */
    public void PickFurniture(Furniture furniture)
    {
        if (ActiveFurn.Count > MaxFurniture - 1) return;

        GameObject furnPrefab = Resources.Load ("Prefab Models/" + furniture.GetName()) as GameObject;

        GameObject furn = null;

        if (furnPrefab != null) {
            furn = Instantiate(furnPrefab) as GameObject;
            int furnitureLayer = 11; //FOR TESTING
            //furn.layer = LayerMask.NameToLayer("Furniture");
            furn.layer = furnitureLayer;
        }

        if (furn != null) {
            ActiveFurn.Add (furn);
            markerID = (int)camManager.currentMarkerInfo.imageID;
            furn.transform.localScale *= markerScale[markerID];
            furn.transform.localScale = furn.transform.localScale * 1.2f;  //Scale correction
            furn.SetActiveRecursively(true);

            furn.GetComponent<FurnitureData>().furniture = furniture;

            furn.rigidbody.isKinematic = true;

            furn.AddComponent<EmptySpotDropper>();
            //furn.AddComponent<CollisionCheck>();

            AmountFurniture(ActiveFurn.Count);

        } else Debug.LogError("Received invalid furniture name: "+name);
    }
        /// <summary>
        /// Method that adds an return item to the cart
        /// </summary>
        /// <param name="rentalId">rental id of the returning item</param>
        /// <param name="rentalItemId">rental item id of the returning item</param>
        /// <param name="furnitureId">furniture id of the returning item</param>
        /// <param name="returnQuantity">return quantity of the returning item"></param>
        public void addReturn(int rentalId, int rentalItemId, int furnitureId, int returnQuantity)
        {
            Furniture furniture = this.furnitureController.GetFurnitureByID(furnitureId);

            RentalTransaction rentalTransaction = this.rentalTransactionController.GetRentalTransactionsByID(rentalId);

            decimal dailyRentalRate = furniture.DailyRentalRate;
            decimal dailyFineRate   = furniture.DailyFineRate;

            DateTime rentedOn = rentalTransaction.RentalDate;
            DateTime dueDate  = rentalTransaction.DueDate;


            ReturnCart returnCartItem = new ReturnCart();

            returnCartItem.RentalID     = rentalId;
            returnCartItem.RentalItemID = rentalItemId;
            returnCartItem.FurnitureID  = furniture.FurnitureID;
            returnCartItem.SerialNo     = furniture.SerialNumber;
            returnCartItem.ItemRented   = furniture.ItemDescription;
            returnCartItem.Style        = furniture.FurnitureStyle;
            returnCartItem.Quantity     = returnQuantity;
            returnCartItem.LateFee      = 0;
            returnCartItem.Refund       = 0;

            int  totalQuantity      = returnQuantity;
            bool itemNotFoundInCart = true;

            foreach (ReturnCart returnItem in returnCartItemList)
            {
                if (returnItem.RentalID == rentalId && returnItem.FurnitureID == furnitureId)
                {
                    returnItem.Quantity += returnQuantity;
                    totalQuantity        = returnItem.Quantity;
                    itemNotFoundInCart   = false;

                    if (dueDate > DateTime.Now) // refund amount
                    {
                        int days = (dueDate - DateTime.Now).Days;
                        returnItem.Refund = (dailyRentalRate * days * totalQuantity);
                    }
                    else if (dueDate < DateTime.Now) // late fee
                    {
                        int days = (DateTime.Now - dueDate).Days;
                        returnItem.LateFee = (dailyFineRate * days * totalQuantity);
                    }
                }
            }


            if (itemNotFoundInCart)
            {
                if (dueDate > DateTime.Now) // refund amount
                {
                    int days = (dueDate - DateTime.Now).Days;
                    returnCartItem.Refund = (dailyRentalRate * days * totalQuantity);
                }
                else if (dueDate < DateTime.Now) // late fee
                {
                    int days = (DateTime.Now - dueDate).Days;
                    returnCartItem.LateFee = (dailyFineRate * days * totalQuantity);
                }

                returnCartItemList.Add(returnCartItem);
            }

            returnTransaction.LateFee      = CalculateLateFee();
            returnTransaction.RefundAmount = CalculateRefundAmount();

            txtLateFee.Text     = Convert.ToString(returnTransaction.LateFee);
            txtRefundTotal.Text = Convert.ToString(returnTransaction.RefundAmount);

            returnItemBindingSource.DataSource = null;
            returnItemBindingSource.DataSource = this.returnCartItemList;
        }
Beispiel #45
0
    public void Deconstruct()
    {
        int  x                = Tile.X;
        int  y                = Tile.Y;
        int  fwidth           = 1;
        int  fheight          = 1;
        bool linksToNeighbour = false;

        if (Tile.Furniture != null)
        {
            Furniture furniture = Tile.Furniture;
            fwidth           = furniture.Width;
            fheight          = furniture.Height;
            linksToNeighbour = furniture.LinksToNeighbour;
            furniture.CancelJobs();
        }

        // We call lua to decostruct
        EventActions.Trigger("OnUninstall", this);

        // Update thermalDiffusifity to default value
        World.Current.temperature.SetThermalDiffusivity(Tile.X, Tile.Y, Temperature.defaultThermalDiffusivity);

        Tile.UnplaceFurniture();

        if (Removed != null)
        {
            Removed(this);
        }

        // Do we need to recalculate our rooms?
        if (RoomEnclosure)
        {
            Room.DoRoomFloodFill(Tile);
        }

        ////World.current.InvalidateTileGraph();

        if (World.Current.tileGraph != null)
        {
            World.Current.tileGraph.RegenerateGraphAtTile(Tile);
        }

        // We should inform our neighbours that they have just lost a
        // neighbour regardless of objectType.
        // Just trigger their OnChangedCallback.
        if (linksToNeighbour == true)
        {
            for (int xpos = x - 1; xpos < x + fwidth + 1; xpos++)
            {
                for (int ypos = y - 1; ypos < y + fheight + 1; ypos++)
                {
                    Tile t = World.Current.GetTileAt(xpos, ypos);
                    if (t != null && t.Furniture != null && t.Furniture.Changed != null)
                    {
                        t.Furniture.Changed(t.Furniture);
                    }
                }
            }
        }

        // At this point, no DATA structures should be pointing to us, so we
        // should get garbage-collected.
    }
Beispiel #46
0
    static public Furniture PlaceInstance(Furniture proto, Tile tile)
    {
        if (proto.funcPositionValidation(tile) == false)
        {
            Debug.LogError("PlaceInstance -- Position Validity Function returned FALSE.");
            return(null);
        }

        // We know our placement destination is valid.


        Furniture obj = new Furniture();

        obj.objectType       = proto.objectType;
        obj.movementCost     = proto.movementCost;
        obj.width            = proto.width;
        obj.height           = proto.height;
        obj.linksToNeighbour = proto.linksToNeighbour;

        obj.tile = tile;

        // FIXME: This assumes we are 1x1!
        if (tile.PlaceFurniture(obj) == false)
        {
            // For some reason, we weren't able to place our object in this tile.
            // (Probably it was already occupied.)

            // Do NOT return our newly instantiated object.
            // (It will be garbage collected.)
            return(null);
        }

        if (obj.linksToNeighbour)
        {
            // This type of furniture links itself to its neighbours,
            // so we should inform our neighbours that they have a new
            // buddy.  Just trigger their OnChangedCallback.

            Tile t;
            int  x = tile.X;
            int  y = tile.Y;

            t = tile.world.GetTileAt(x, y + 1);
            if (t != null && t.furniture != null && t.furniture.objectType == obj.objectType)
            {
                // We have a Northern Neighbour with the same object type as us, so
                // tell it that it has changed by firing is callback.
                t.furniture.cbOnChanged(t.furniture);
            }
            t = tile.world.GetTileAt(x + 1, y);
            if (t != null && t.furniture != null && t.furniture.objectType == obj.objectType)
            {
                t.furniture.cbOnChanged(t.furniture);
            }
            t = tile.world.GetTileAt(x, y - 1);
            if (t != null && t.furniture != null && t.furniture.objectType == obj.objectType)
            {
                t.furniture.cbOnChanged(t.furniture);
            }
            t = tile.world.GetTileAt(x - 1, y);
            if (t != null && t.furniture != null && t.furniture.objectType == obj.objectType)
            {
                t.furniture.cbOnChanged(t.furniture);
            }
        }

        return(obj);
    }
Beispiel #47
0
    /// <summary>
    /// Used to place furniture in a certain position.
    /// </summary>
    /// <param name="proto">The prototype furniture to place.</param>
    /// <param name="tile">The base tile to place the furniture on, The tile will be the bottom left corner of the furniture (to check).</param>
    /// <returns>Furniture object.</returns>
    public static Furniture PlaceInstance(Furniture proto, Tile tile)
    {
        if (proto.IsValidPosition(tile) == false)
        {
            Debug.ULogWarningChannel("Furniture", "PlaceInstance :: Position Validity Function returned FALSE. " + proto.Name + " " + tile.X + ", " + tile.Y + ", " + tile.Z);
            return(null);
        }

        // We know our placement destination is valid.
        Furniture furnObj = proto.Clone();

        furnObj.Tile = tile;

        if (tile.PlaceFurniture(furnObj) == false)
        {
            // For some reason, we weren't able to place our object in this tile.
            // (Probably it was already occupied.)

            // Do NOT return our newly instantiated object.
            // (It will be garbage collected.)
            return(null);
        }

        // need to update reference to furniture and call Initialize (so components can place hooks on events there)
        foreach (BuildableComponent component in furnObj.components)
        {
            component.Initialize(furnObj);
        }

        if (furnObj.LinksToNeighbour != string.Empty)
        {
            // This type of furniture links itself to its neighbours,
            // so we should inform our neighbours that they have a new
            // buddy.  Just trigger their OnChangedCallback.
            int x = tile.X;
            int y = tile.Y;

            for (int xpos = x - 1; xpos < x + proto.Width + 1; xpos++)
            {
                for (int ypos = y - 1; ypos < y + proto.Height + 1; ypos++)
                {
                    Tile tileAt = World.Current.GetTileAt(xpos, ypos, tile.Z);
                    if (tileAt != null && tileAt.Furniture != null && tileAt.Furniture.Changed != null)
                    {
                        tileAt.Furniture.Changed(tileAt.Furniture);
                    }
                }
            }
        }

        // Let our workspot tile know it is reserved for us
        World.Current.ReserveTileAsWorkSpot(furnObj);

        // Call LUA install scripts
        furnObj.EventActions.Trigger("OnInstall", furnObj);

        // Update thermalDiffusivity using coefficient
        float thermalDiffusivity = Temperature.defaultThermalDiffusivity;

        if (furnObj.Parameters.ContainsKey("thermal_diffusivity"))
        {
            thermalDiffusivity = furnObj.Parameters["thermal_diffusivity"].ToFloat();
        }

        World.Current.temperature.SetThermalDiffusivity(tile.X, tile.Y, tile.Z, thermalDiffusivity);

        return(furnObj);
    }
 public UnitOfWork()
 {
     context = new Furniture();
     context.Database.Log = Console.WriteLine;
 }
Beispiel #49
0
    /// <summary>
    /// Copy Constructor -- don't call this directly, unless we never
    /// do ANY sub-classing. Instead use Clone(), which is more virtual.
    /// </summary>
    private Furniture(Furniture other)
    {
        Type                 = other.Type;
        Name                 = other.Name;
        typeTags             = new HashSet <string>(other.typeTags);
        description          = other.description;
        MovementCost         = other.MovementCost;
        PathfindingModifier  = other.PathfindingModifier;
        PathfindingWeight    = other.PathfindingWeight;
        RoomEnclosure        = other.RoomEnclosure;
        Width                = other.Width;
        Height               = other.Height;
        CanRotate            = other.CanRotate;
        Rotation             = other.Rotation;
        Tint                 = other.Tint;
        LinksToNeighbour     = other.LinksToNeighbour;
        deconstructInventory = other.deconstructInventory;
        health               = other.health;

        Parameters = new Parameter(other.Parameters);
        Jobs       = new BuildableJobs(this, other.Jobs);

        // don't need to clone here, as all are prototype things (not changing)
        components = new HashSet <BuildableComponent>();
        foreach (BuildableComponent component in other.components)
        {
            components.Add(component.Clone());
        }

        if (other.Animation != null)
        {
            Animation = other.Animation.Clone();
        }

        if (other.EventActions != null)
        {
            EventActions = other.EventActions.Clone();
        }

        if (other.contextMenuLuaActions != null)
        {
            contextMenuLuaActions = new List <ContextMenuLuaAction>(other.contextMenuLuaActions);
        }

        if (other.ReplaceableFurniture != null)
        {
            replaceableFurniture = other.ReplaceableFurniture;
        }

        isEnterableAction = other.isEnterableAction;

        getProgressInfoNameAction = other.getProgressInfoNameAction;

        tileTypeBuildPermissions = new HashSet <string>(other.tileTypeBuildPermissions);

        LocalizationCode       = other.LocalizationCode;
        UnlocalizedDescription = other.UnlocalizedDescription;

        // force true as default, to trigger OnIsOperatingChange (to sync the furniture icons after initialization)
        IsOperating = true;
    }
Beispiel #50
0
        public void Can_Save_Valid_Changes()
        {
            // Организация - создание имитированного хранилища данных
            Mock<IFurnitureRepository> mock = new Mock<IFurnitureRepository>();

            // Организация - создание контроллера
            AdminController controller = new AdminController(mock.Object);

            // Организация - создание объекта Game
            Furniture furniture = new Furniture
                    { Id = 1, Name = "Мебель1", Description = "Описание", Section = "Раздел", Price = 100 };

            // Действие - попытка сохранения товара
            ActionResult result = controller.Edit(furniture);

            // Утверждение - проверка того, что к хранилищу производится обращение
            mock.Verify(m => m.UpdateFurniture(furniture));

            // Утверждение - проверка типа результата метода
            Assert.IsNotInstanceOfType(result, typeof(ViewResult));
        }
Beispiel #51
0
 public void Start()
 {
     Item.RegisterItems();
     Furniture.RegisterAll();
     Pawn.RegisterPawns();
 }
        public List<RoomState> GetRoomsStates(DateTime date)
        {
            SQLiteCommand cmd = DbConnection.CreateCommand();
            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "SELECT r.Name as RoomName, f.Name as FurnitureName, SUM(Count) as Count " +
                              "FROM History as h " +
                              "JOIN Room as r ON r.Id = h.RoomId " +
                              "JOIN Furniture as f ON f.Id = h.FurnitureId " +
                              "WHERE OperationId = @operationId AND Date <= @date " +
                              "GROUP BY RoomId, f.Id";

            cmd.Parameters.Add(new SQLiteParameter("@operationId", (int)HistoryOperationNameEnum.DeltaFurniture));
            cmd.Parameters.Add(new SQLiteParameter("@date", date));
            var result = cmd.ExecuteReader();

            var dic = new Dictionary<string, RoomState>();

            if (!result.HasRows)
                return new List<RoomState>();

            while (result.Read())
            {
                var name = result.GetString(0);
                var fur = new Furniture
                {
                    Name = result.GetString(1),
                    Count = result.GetInt32(2)
                };

                if (fur.Count > 0)
                    if (dic.ContainsKey(name))
                        dic[name].Furniture.Add(fur);
                    else
                        dic.Add(name, new RoomState(date) { RoomName = name, Furniture = new List<Furniture> { fur } });
            }

            return dic.Values.ToList();
        }
    public float SetParentRelativeRotation(Vector3 position, Furniture parent)
    {
        Vector3 parentCenter = parent.Center();

        rotation = 0f;
        int             lookDirectionIndex = alignTo.IndexOf(parent.type);
        FacingDirection direction          = relativeLookDirection[lookDirectionIndex];

        switch (direction)
        {
        case FacingDirection.Toward:
            if (position.x >= parent.FrontRight().x)
            {
                rotation = 270f;
            }
            if (position.z >= parent.FrontRight().z)
            {
                rotation = 180f;
            }
            if (position.x < parent.FrontLeft().x)
            {
                rotation = 90f;
            }
            break;

        case FacingDirection.Away:
            if (position.x >= parent.FrontRight().x)
            {
                rotation = 90f;
            }
            if (position.z < parent.BottomLeft().z)
            {
                rotation = 180f;
            }
            if (position.x < parent.BottomLeft().x)
            {
                rotation = 270f;
            }
            break;

        case FacingDirection.Forward:
            rotation = parent.rotation;
            break;

        case FacingDirection.Right:
            rotation = parent.rotation + 90f;
            break;

        case FacingDirection.Backward:
            rotation = parent.rotation + 180f;
            break;

        case FacingDirection.Left:
            rotation = parent.rotation + 270f;
            break;

        default:
            break;
        }

        if (rotation >= 360)
        {
            rotation -= 360f;
        }

        return(rotation);
    }
        public List<Furniture> GetRoomFurnitureBetweenDates(int roomId, DateTime startDate, DateTime endDate)
        {
            SQLiteCommand cmd = DbConnection.CreateCommand();
            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "SELECT Count(*) " +
                              "FROM History " +
                              "WHERE RoomId = @roomId AND OperationId = @operationId " +
                              "AND Date BETWEEN @startDate AND @endDate ";

            cmd.Parameters.Add(new SQLiteParameter("@roomId", roomId));
            cmd.Parameters.Add(new SQLiteParameter("@operationId", (int)HistoryOperationNameEnum.DeltaFurniture));
            cmd.Parameters.Add(new SQLiteParameter("@startDate", startDate));
            cmd.Parameters.Add(new SQLiteParameter("@endDate", endDate));

            int rowCount = Convert.ToInt32(cmd.ExecuteScalar());

            cmd.CommandText = "SELECT f.Id, f.Name, SUM(h.Count) as Count " +
                              "FROM History AS h JOIN Furniture AS f ON h.FurnitureId = f.Id " +
                              "WHERE RoomId = @roomId AND OperationId = @operationId " +
                              "AND Date BETWEEN @startDate AND @endDate ";

            var result = cmd.ExecuteReader();

            var list = new List<Furniture>();

            if (rowCount < 1)
                return list;

            while (result.Read())
            {
                var furniture = new Furniture
                {
                    Id = result.GetInt32(0),
                    Name = result.GetString(1),
                    Count = result.GetInt32(2)
                };
                if(furniture.Count > 0)
                    list.Add(furniture);
            }

            return list;
        }
Beispiel #55
0
 private void WorkshopRemoved(Furniture furniture)
 {
     // unlock all inventories at input if there is something left
     UnlockInventoryAtInput(ParentFurniture);
 }
        /// <summary>
        /// Initializes the packet. All data parsing must be done here.
        /// </summary>
        public override void Init()
        {
            Position = 0;

            houseOid = ReadShort();
            count = ReadByte();
            decorationCode = ReadByte();
            m_furnitures = new Furniture[count];
            for (int i = 0; i < count; i++)
            {
                Furniture furniture = new Furniture();
                furniture.flagRemove = false;
                furniture.index = ReadByte();
                if (Position < Length)
                {
                    furniture.model = ReadShort();
                    furniture.color = ReadShort();
                    furniture.type = ReadByte();
                    furniture.unk1 = ReadByte();
                    furniture.x = (short)ReadShort();
                    furniture.y = (short)ReadShort();
                    furniture.angle = ReadShort();
                    furniture.size = ReadByte();
                    furniture.surface = ReadByte();
                    furniture.place = ReadByte();
                }
                else
                    furniture.flagRemove = true;
                m_furnitures[i] = furniture;
            }
        }