/// <summary> /// Проверяет эквивалентны ли два корпуса. /// </summary> /// Описание входных параметров. /// <param name="first_housing"></param> /// <param name="second_housing"></param> private void AreEqualHousing(HousingItem first_housing, HousingItem second_housing) { Assert.AreEqual(first_housing.Id, second_housing.Id); Assert.AreEqual(first_housing.Number, second_housing.Number); Assert.AreEqual(first_housing.Name, second_housing.Name); Assert.AreEqual(first_housing.Level, second_housing.Level); Assert.AreEqual(first_housing.Memo, second_housing.Memo); }
private void DrawRow(int i, HousingItem housingItem, int childIndex = -1) { ImGui.Text($"{housingItem.X:N3}"); ImGui.NextColumn(); ImGui.Text($"{housingItem.Y:N3}"); ImGui.NextColumn(); ImGui.Text($"{housingItem.Z:N3}"); ImGui.NextColumn(); ImGui.Text($"{housingItem.Rotate:N3}"); ImGui.NextColumn(); string uniqueID = childIndex == -1 ? i.ToString() : i.ToString() + "_" + childIndex.ToString(); if (Config.BDTH) { if (ImGui.Button(_localizer.Localize("Set") + "##" + uniqueID)) { BDTHSet(i, housingItem); } ImGui.NextColumn(); } if (Config.Grouping) { var index = Config.GroupingList.IndexOf(i); var buttonText = housingItem.children.Count == 0 ? (index == -1 ? "Add" : "Del") : "Disband"; if (childIndex == -1 && ImGui.Button(_localizer.Localize(buttonText) + "##Group_" + uniqueID)) { if (buttonText == "Add") { Config.GroupingList.Add(i); } else if (buttonText == "Del") { Config.GroupingList.RemoveAt(index); } else if (buttonText == "Disband") { for (int j = 0; j < housingItem.children.Count; j++) { Config.HousingItemList.Add(housingItem.children[j]); } housingItem.children.Clear(); Config.Save(); } } ImGui.NextColumn(); } if (Config.SingleExport) { if (ImGui.Button(_localizer.Localize("Export") + "##Single_" + uniqueID)) { List <HousingItem> tempList = new List <HousingItem>(); tempList.Add(housingItem); string str = JsonConvert.SerializeObject(tempList); Win32Clipboard.CopyTextToClipboard(str); Plugin.Log(String.Format(_localizer.Localize("Exported {0} items to your clipboard."), tempList.Count)); } ImGui.NextColumn(); } }
public void SetUp() { _housingRepository = Mock.Of <IHousingRepository>(); _housingService = new HousingService(_housingRepository); _housing = new HousingItem() { Id = 1, Name = "test", Memo = "Описание" }; }
/// <summary> /// Создает корпус. /// </summary> /// <param name="housing">Корпус.</param> /// <returns>Идентификаторо созданного корпуса.</returns> public int Create(HousingItem housing) { if (string.IsNullOrWhiteSpace(housing.Name)) { throw new Exception("Поле 'Name' не должно быть пустым."); } if (string.IsNullOrWhiteSpace(housing.Memo)) { throw new Exception("Поле 'Memo' не должно быть пустым."); } return(_housingRepository.Create(housing)); }
/// <summary> /// Обновляет данные по корпусу. /// </summary> /// <param name="housing">Корпус.</param> public void Update(HousingItem housing) { using (var sqlh = new SqlHelper()) { sqlh.ExecNoQuery(@" update Auditory.housing set number = @Number, name = @Name, level = @Level, memo = @Memo where housing = @Id", housing); } }
private void BDTHSet(int i, HousingItem housingItem) { Config.SelectedItemIndex = i; Config.PlaceX = housingItem.X; Config.PlaceY = housingItem.Y; Config.PlaceZ = housingItem.Z; Config.PlaceRotate = housingItem.Rotate; Plugin.CommandManager.ProcessCommand($"/bdth {housingItem.X} {housingItem.Y} {housingItem.Z} {housingItem.Rotate}"); if (housingItem.children.Count > 0) { housingItem.ReCalcChildrenPos(); } Config.Save(); }
public bool AddWallDecoration(int slot, HousingItem xItem) { if (!this.CanAddWallDecoration(slot, xItem.iItemWidth)) { return false; } ushort iUniqueID; this.iHousingItemIDPool = Convert.ToUInt16((iUniqueID = Convert.ToUInt16(this.iHousingItemIDPool)) + 1); xItem.iUniqueID = iUniqueID; this.dixLoadedHousingItems.Add(xItem.iUniqueID, xItem); for (int x = 0; x < xItem.iItemWidth; x++) { this.axWallDecorations[slot + x].liFurniture.Add(xItem.iUniqueID); } return true; }
public bool AddItem(Point slot, HousingItem xItem) { if (!this.CanAddItem(slot, xItem.iItemWidth, xItem.iItemHeight)) { return false; } ushort iUniqueID; this.iHousingItemIDPool = Convert.ToUInt16((iUniqueID = Convert.ToUInt16(this.iHousingItemIDPool)) + 1); xItem.iUniqueID = iUniqueID; this.dixLoadedHousingItems.Add(xItem.iUniqueID, xItem); for (int x = 0; x < xItem.iItemWidth; x++) { for (int y = 0; y < xItem.iItemHeight; y++) { this.GetSlot(new Point(slot.X + x, slot.Y + y)).liFurniture.Add(xItem.iUniqueID); } } return true; }
/// <summary> /// Измененяет данные о корпусе. /// </summary> /// <param name="housing">Корпус.</param> public void Update(HousingItem housing) { if (string.IsNullOrWhiteSpace(housing.Name)) { throw new Exception("Поле 'Name' не должно быть пустым."); } if (string.IsNullOrWhiteSpace(housing.Memo)) { throw new Exception("Поле 'Memo' не должно быть пустым."); } if (GetById(housing.Id) == null) { throw new Exception("Корпус не найден."); } _housingRepository.Update(housing); }
private void BDTHSet(int i, HousingItem housingItem) { Config.SelectedItemIndex = i; Config.PlaceX = housingItem.X; Config.PlaceY = housingItem.Y; Config.PlaceZ = housingItem.Z; Config.PlaceRotate = housingItem.Rotate; string bdthCommand = "/bdth"; bdthCommand += $" {housingItem.X.ToString(CultureInfo.InvariantCulture)}"; bdthCommand += $" {housingItem.Y.ToString(CultureInfo.InvariantCulture)}"; bdthCommand += $" {housingItem.Z.ToString(CultureInfo.InvariantCulture)}"; bdthCommand += $" {housingItem.Rotate.ToString(CultureInfo.InvariantCulture)}"; Plugin.CommandManager.ProcessCommand(bdthCommand); if (housingItem.children.Count > 0) { housingItem.ReCalcChildrenPos(); } Config.Save(); }
public void SetUp() { _transactionScope = new TransactionScope(); _housingRepository = new HousingRepository(); _housing = new HousingItem() { Id = 1, Number = 12, Name = "Odin", Level = 2, Memo = "Для уроков рисования" }; _housingNew = new HousingItem() { Id = 2, Number = 13, Name = "Tor", Level = 3, Memo = "Для уроков русского языка" }; }
/// <summary> /// Создает новый корпус. /// </summary> /// <param name="housing">Корпус.</param> /// <returns>Идентификатор созданного корпуса.</returns> public int Create(HousingItem housing) { using (var sqlh = new SqlHelper()) { return(sqlh.ExecScalar <int>(@" insert into Auditory.housing ( number, name, level, memo ) values ( @Number, @Name, @Level, @Memo ) select scope_identity()", housing)); } }
public static HousingItem GetBasicInstance(ItemCodex.ItemTypes enType) { Vector2 arg_05_0 = Vector2.Zero; Vector2 v2SMOff = new Vector2(-10f, 10f); HousingItem ret; if (enType == ItemCodex.ItemTypes._Misc_Furniture_Table_BasicLongBlack) { ret = new DynamicHousingItem(); DynamicEnvironment x = ret.xEntity as DynamicEnvironment; x.xRenderComponent.dixAnimations[1] = new Animation(1, 1, CAS.RegionContent.Load<Texture2D>("Sprites/Environment/PlayerHome/Surfaces/Surfaces_TableLongBlack"), new Vector2(0f, 29f) - v2SMOff, 4, 1, 60, 29, 0, 0, 12, Animation.LoopSettings.Clamp, Animation.CancelOptions.IgnoreIfPlaying, true, true, new AnimationInstruction[0]); x.xRenderComponent.dixAnimations[2] = new Animation(2, 2, CAS.RegionContent.Load<Texture2D>("Sprites/Environment/PlayerHome/Surfaces/Surfaces_TableLongBlack02"), new Vector2(0f, 32f) - v2SMOff, 4, 1, 20, 66, 0, 0, 12, Animation.LoopSettings.Clamp, Animation.CancelOptions.IgnoreIfPlaying, true, true, new AnimationInstruction[0]); x.xRenderComponent.SwitchAnimation(1, Animation.CancelOptions.RestartIfPlaying); x.xRenderComponent.xTransform = x.xTransform; ret.fHeight = 12f; ret.iItemWidth = 3; ret.iItemHeight = 1; ret.bIsSurface = true; ret.bCanRotate = true; } else if (enType == ItemCodex.ItemTypes._Misc_Furniture_Table_BasicLongWhite) { ret = new DynamicHousingItem(); DynamicEnvironment x2 = ret.xEntity as DynamicEnvironment; x2.xRenderComponent.dixAnimations[1] = new Animation(1, 1, CAS.RegionContent.Load<Texture2D>("Sprites/Environment/PlayerHome/Surfaces/Surfaces_TableLongWhite"), new Vector2(0f, 29f) - v2SMOff, 4, 1, 60, 29, 0, 0, 12, Animation.LoopSettings.Clamp, Animation.CancelOptions.IgnoreIfPlaying, true, true, new AnimationInstruction[0]); x2.xRenderComponent.dixAnimations[2] = new Animation(2, 2, CAS.RegionContent.Load<Texture2D>("Sprites/Environment/PlayerHome/Surfaces/Surfaces_TableLongWhite02"), new Vector2(0f, 32f) - v2SMOff, 4, 1, 20, 66, 0, 0, 12, Animation.LoopSettings.Clamp, Animation.CancelOptions.IgnoreIfPlaying, true, true, new AnimationInstruction[0]); x2.xRenderComponent.SwitchAnimation(1, Animation.CancelOptions.RestartIfPlaying); x2.xRenderComponent.xTransform = x2.xTransform; ret.fHeight = 12f; ret.iItemWidth = 3; ret.iItemHeight = 1; ret.bIsSurface = true; ret.bCanRotate = true; } else if (enType == ItemCodex.ItemTypes._Misc_Furniture_Table_BasicLongWood) { ret = new DynamicHousingItem(); DynamicEnvironment x3 = ret.xEntity as DynamicEnvironment; x3.xRenderComponent.dixAnimations[1] = new Animation(1, 1, CAS.RegionContent.Load<Texture2D>("Sprites/Environment/PlayerHome/Surfaces/Surfaces_TableLongWood"), new Vector2(0f, 29f) - v2SMOff, 4, 1, 60, 29, 0, 0, 12, Animation.LoopSettings.Clamp, Animation.CancelOptions.IgnoreIfPlaying, true, true, new AnimationInstruction[0]); x3.xRenderComponent.dixAnimations[2] = new Animation(2, 2, CAS.RegionContent.Load<Texture2D>("Sprites/Environment/PlayerHome/Surfaces/Surfaces_TableLongWood02"), new Vector2(0f, 29f) - v2SMOff, 4, 1, 20, 66, 0, 0, 12, Animation.LoopSettings.Clamp, Animation.CancelOptions.IgnoreIfPlaying, true, true, new AnimationInstruction[0]); x3.xRenderComponent.SwitchAnimation(1, Animation.CancelOptions.RestartIfPlaying); x3.xRenderComponent.xTransform = x3.xTransform; ret.fHeight = 12f; ret.iItemWidth = 3; ret.iItemHeight = 1; ret.bIsSurface = true; ret.bCanRotate = true; } else if (enType == ItemCodex.ItemTypes._Misc_Furniture_Table_BasicRoundDark) { ret = new DynamicHousingItem(); DynamicEnvironment x4 = ret.xEntity as DynamicEnvironment; x4.xRenderComponent.dixAnimations[0] = new Animation(1, 1, CAS.RegionContent.Load<Texture2D>("Sprites/Environment/PlayerHome/Surfaces/Surfaces_TableRoundBlack"), new Vector2(-10f, 9f) - v2SMOff, 4, 1, 40, 35, 0, 0, 12, Animation.LoopSettings.Clamp, Animation.CancelOptions.IgnoreIfPlaying, true, true, new AnimationInstruction[0]); x4.xRenderComponent.SwitchAnimation(0, Animation.CancelOptions.RestartIfPlaying); x4.xRenderComponent.xTransform = x4.xTransform; ret.fHeight = 12f; ret.abAllowedSurfaceSpaces = new bool[3, 3]; ret.abAllowedSurfaceSpaces[1, 1] = true; ret.iItemWidth = 3; ret.iItemHeight = 3; ret.bIsSurface = true; ret.bCanRotate = false; } else if (enType == ItemCodex.ItemTypes._Misc_Furniture_Chair_BasicWhite) { ret = new DynamicHousingItem(); DynamicEnvironment x5 = ret.xEntity as DynamicEnvironment; x5.xRenderComponent.dixAnimations[1] = new Animation(1, 1, CAS.RegionContent.Load<Texture2D>("Sprites/Environment/PlayerHome/Chairs/Chairs_BasicWhite02"), new Vector2(-1f, 29f) - v2SMOff, 4, 1, 16, 27, 0, 0, 12, Animation.LoopSettings.Clamp, Animation.CancelOptions.IgnoreIfPlaying, true, true, new AnimationInstruction[0]); x5.xRenderComponent.dixAnimations[2] = new Animation(2, 2, CAS.RegionContent.Load<Texture2D>("Sprites/Environment/PlayerHome/Chairs/Chairs_BasicWhite"), new Vector2(-3f, 29f) - v2SMOff, 4, 1, 14, 27, 0, 0, 12, Animation.LoopSettings.Clamp, Animation.CancelOptions.IgnoreIfPlaying, true, true, new AnimationInstruction[0]); x5.xRenderComponent.dixAnimations[3] = new Animation(3, 3, CAS.RegionContent.Load<Texture2D>("Sprites/Environment/PlayerHome/Chairs/Chairs_BasicWhite02"), new Vector2(-3f, 29f) - v2SMOff, 4, 1, 16, 27, 0, 0, 12, Animation.LoopSettings.Clamp, Animation.CancelOptions.IgnoreIfPlaying, true, true, new AnimationInstruction[0]); x5.xRenderComponent.dixAnimations[3].enSpriteEffect = SpriteEffects.FlipHorizontally; x5.xRenderComponent.SwitchAnimation(2, Animation.CancelOptions.RestartIfPlaying); x5.xRenderComponent.xTransform = x5.xTransform; ret.fHeight = 12f; ret.iItemWidth = 1; ret.iItemHeight = 1; ret.bIsSurface = false; ret.bCanRotate = true; } else if (enType == ItemCodex.ItemTypes._Misc_Furniture_Carpet_MasterHQBlue) { ret = new CarpetHousingItem(); ret.xRenderComponent = new HousingCarpetsRC(); HousingCarpetsRC xRC = ret.xRenderComponent as HousingCarpetsRC; xRC.xTransform = ret.xEntity.xTransform; xRC.LoadTextures(CAS.RegionContent, "Sprites/Environment/PlayerHome/Carpets/Carpets_MasterHQBlue"); xRC.iWidth = 2; xRC.iHeight = 2; ret.iItemWidth = 2; ret.iItemHeight = 2; ret.bPlacementOffset = false; } else if (enType == ItemCodex.ItemTypes._Misc_Furniture_Carpet_MasterHQRed) { ret = new StaticHousingItem(); StaticEnvironment x6 = ret.xEntity as StaticEnvironment; x6.xRenderComponent = new StaticRenderComponent(CAS.RegionContent.Load<Texture2D>("Bkg/ZoneX2_Housing/Carpets/green_3x3"), new TransformComponent(Vector2.Zero)); x6.xRenderComponent.xTransform = x6.xTransform; x6.xRenderComponent.v2Offset = Vector2.Zero; ret.fHeight = 0f; ret.iItemWidth = 3; ret.iItemHeight = 3; ret.bPlacementOffset = false; } else if (enType == ItemCodex.ItemTypes._Misc_Furniture_Carpet_MasterHQGreen) { ret = new StaticHousingItem(); StaticEnvironment x7 = ret.xEntity as StaticEnvironment; x7.xRenderComponent = new StaticRenderComponent(CAS.RegionContent.Load<Texture2D>("Bkg/ZoneX2_Housing/Carpets/brown_3x5"), new TransformComponent(Vector2.Zero)); x7.xRenderComponent.xTransform = x7.xTransform; x7.xRenderComponent.v2Offset = Vector2.Zero; ret.fHeight = 0f; ret.iItemWidth = 3; ret.iItemHeight = 5; ret.bPlacementOffset = false; } else if (enType == ItemCodex.ItemTypes._Misc_Furniture_FlyingFortressPainting) { ret = new StaticHousingItem(); StaticEnvironment x8 = ret.xEntity as StaticEnvironment; x8.xRenderComponent = new StaticRenderComponent(CAS.RegionContent.Load<Texture2D>("Bkg/ZoneX2_Housing/WallDecorations/Painting_FlyingTemple"), new TransformComponent(Vector2.Zero)); x8.xRenderComponent.xTransform = x8.xTransform; x8.xRenderComponent.v2Offset = new Vector2(0f, 17f); ret.fHeight = 0f; ret.bIsOnWall = true; ret.iItemWidth = 2; ret.iItemHeight = 1; ret.bPlacementOffset = false; } else { ret = new HousingItem(); } if (!ret.bIsSurface) { ret.fHeight = 0f; } if (ret.xRenderComponent is StaticRenderComponent) { Vector2 arg_7DA_0 = (ret.xRenderComponent as StaticRenderComponent).v2Offset; } ret.enType = enType; return ret; }
public ActionResult Update(HousingItem housing) { Access.CheckAccess("Housing.Updater"); _housingService.Update(housing); return(RedirectToAction("Index", new { id = housing.Id })); }
public ActionResult Create(HousingItem housing) { Access.CheckAccess("Housing.Creator"); return(RedirectToAction("Index", new { id = _housingService.Create(housing) })); }