void Start() { gm = GameManager.Instance; backgroundSrc = GameObject.Find("Background Audio Main").GetComponent <AudioSource> (); controller = FindObjectOfType <PlayerController> (); RegisterEvents(); if (windowsParent != null && windowsParent.Length != 0) { windows = new Window[windowsParent.Length]; for (int i = 0; i < windows.Length; i++) { var lT = windowsParent[i].GetChild(2).Find("Left"); var rT = windowsParent[i].GetChild(2).Find("Right"); var mT = windowsParent[i].GetChild(2).Find("Mid"); windows[i] = new Window(lT, rT, mT); } } if (balconiesParent != null && balconiesParent.Length != 0) { balconies = new Balcony[balconiesParent.Length]; for (int i = 0; i < balconies.Length; i++) { var startT = balconiesParent[i].GetChild(1).Find("Start"); var endT = balconiesParent[i].GetChild(1).Find("End"); balconies[i] = new Balcony(startT, endT); } } StartCoroutine(InitWaves()); }
private void SumCalculate() { string select = comboTypeBox.SelectedItem.ToString().ToLower().Split()[0]; string fullname = nameInputBox.Text.ToString().ToLower(); double discount = 1; double cost = 0; foreach (Client client in cashbox.GetClients()) { if (String.Equals(client.fullName.ToLower(), fullname)) { discount = client.discount; } } if (String.Equals(select, "партерр")) { cost = discount * Parterre.GetCost(); } else if (String.Equals(select, "балкон")) { cost = discount * Balcony.GetCost(); } else if (String.Equals(select, "ложа")) { cost = discount * Lodge.GetCost(); } sumTicketBox.Text = "Стоимость билета: " + cost + " руб."; }
/// <summary> /// получает объект для сохранения с уровня представления и создает по нему объект Apartment и сохраняет его в базу данных. /// </summary> /// <param name="appartmentDto"></param> public void MakeAdvert(ApartmentDTO appartmentDto) { Salesman salesman = Database.Salesmans.Get(appartmentDto.SalesmanId); // валидация if (salesman == null) { throw new ValidationException("Арендодатель не найден", ""); } // смотрим состояние проплаченных сервисов арендодателя bool salesmanPayedState = new SalesmanState(30.0).GetSalesmanPayedState(salesman.PayedDate); // применяем автомаппер для проекции HouseDTO на House Mapper.Initialize(cfg => cfg.CreateMap <HouseDTO, House>()); House house = Mapper.Map <HouseDTO, House>(appartmentDto.House); Mapper.Initialize(cfg => cfg.CreateMap <ToiletTypeDTO, ToiletType>()); ToiletType toiletType = Mapper.Map <ToiletTypeDTO, ToiletType>(appartmentDto.ToiletType); Mapper.Initialize(cfg => cfg.CreateMap <BalconyDTO, Balcony>()); Balcony balcony = Mapper.Map <BalconyDTO, Balcony>(appartmentDto.Balcony); Mapper.Initialize(cfg => cfg.CreateMap <RepairTypeDTO, RepairType>()); RepairType repairType = Mapper.Map <RepairTypeDTO, RepairType>(appartmentDto.RepairType); Mapper.Initialize(cfg => cfg.CreateMap <ElevatorDTO, Elevator>()); Elevator elevator = Mapper.Map <ElevatorDTO, Elevator>(appartmentDto.Elevator); // применяем автомаппер для проекции одной коллекции на другую Mapper.Initialize(cfg => cfg.CreateMap <ApartmentIncludeDTO, ApartmentInclude>()); var includes = Mapper.Map <IEnumerable <ApartmentIncludeDTO>, List <ApartmentInclude> >(appartmentDto.ApartmentIncludes); Mapper.Initialize(cfg => cfg.CreateMap <ImagesIncludeDTO, ImagesInclude>()); var images = Mapper.Map <IEnumerable <ImagesIncludeDTO>, List <ImagesInclude> >(appartmentDto.ImagesIncludes); Apartment apartment = new Apartment { PublishDate = DateTime.Now, Salesman = salesman, SalesmanPayedState = salesmanPayedState, Price = appartmentDto.Price, PriceInfo = appartmentDto.PriceInfo, Floor = appartmentDto.Floor, TotalArea = appartmentDto.TotalArea, LivingArea = appartmentDto.LivingArea, KitchenArea = appartmentDto.KitchenArea, OtherInfo = appartmentDto.OtherInfo, House = house, ToiletType = toiletType, Balcony = balcony, RepairType = repairType, Elevator = elevator, ApartmentIncludes = includes, ImagesIncludes = images }; Database.Apartments.Create(apartment); Database.Save(); }
public T ResolveHbEntity <T>(Balcony entity) where T : BaseDictionary { if (typeof(T) != typeof(Terrace)) { throw new Exception("Не верный тип."); } if (entity != null) { return(ResolveHbEntity <T>(entity.idBalcony)); } return(null); }
public void SetNewApartmentBalcony() { if (Controller.GetPresenter <Balcony>() == null) { var balcony = new Balcony(); balcony.OpenView(new Model.ApartmentBalcony() { Balcony = true, BalconyMeters = 10, Floor = 2, Meters = 55, Rooms = 2 }); } }
public async Task OnGet(string id) { Balcony = await _db.Balcony.FindAsync(id); }
static void BuildRestroom() { Restroom.Name = "洗手间和过道"; Restroom.Alias.Clear(); Restroom.Alias.AddRange(new[] { "洗手间", "过道" }); Restroom.LightDescription = "手电筒在镜子里映出一片光芒,几乎掩盖了你的模样。下面的黑色台面上有两个洗手池。镜子的墙后有两个蹲厕和一个淋浴间,没有门,所以夜里上厕所会很方便。在洗手池对面,你能透过移门看见阳台一角。"; Restroom.Description = "你的形象模模糊糊地映在黑暗的镜子里。洗手池和墙的后面是蹲厕和淋浴间。那里没有门,夜里可以方便地过去:就像现在。洗手池对面有一个移门,通往阳台。"; Restroom.IsLit = false; AObject Mirror = new AObject( "镜子", new[] { "镜面", "镜" }, desc: "黑暗的镜子里面模模糊糊的映出你的样子和移门后的阳台,但是看不清楚。", ldesc: "手电筒在镜子里映出一片光芒,几乎掩盖了你的模样,看不清什么东西。"); AObject Sink = new AObject( "洗手池", new[] { "洗手台", "台面", "池", "池子" }, desc: "黑色台面上两个白色洗手池,看起来就像两只空洞的眼睛。", ldesc: "黑色台面上的两个洗手池,在晚上使你想到白色的大眼睛,特别是在手电筒的光照下。"); AObject WaterTap = new AObject( "水龙头", new[] { "龙头" }, desc: "两个金属水龙头。", ldesc: "两个闪亮的金属水龙头。") { IsSwitch = true, SwitchState = false }; // it doesn't emit water for now, but in later stages of development I think I'll add support for it when I implement the chemistry module. AObject Toilet = new AObject( "蹲厕", new[] { "厕所", "便池" }, desc: "你现在并不想上厕所,也不想无缘无故地走进去看。又不是什么好玩的东西。", ldesc: "你现在并不想上厕所,也不想无缘无故地走进去看。又不是什么好玩的东西。"); AObject Bathroom = new AObject( "淋浴间", new[] { "浴室", "洗澡间" }, desc: "半夜里你不想踩进那又暗又滑的地方,更不可能洗澡。", ldesc: "半夜里你不想踩进那湿湿滑滑的地方,更不可能洗澡。"); AObject DormDoor = AObject.SimpleDoor( Dormitory12, "去寝室的门", new[] { "寝室门", "寝室", "门" }, desc: "通往寝室的门。", flopside: () => Dormitory12.FindObjectInternal("去洗手间过道的门")); AObject BalconyDoor = AObject.SimpleDoor( Balcony, "去阳台的移门", new[] { "阳台门", "阳台", "移门", "门" }, desc: "通往阳台的移门。", flopside: () => Balcony.FindObjectInternal("去洗手间过道的门")); Restroom.Objects.Clear(); Restroom.Objects.AddRange(new AObject[] { Mirror, Sink, WaterTap, Toilet, Bathroom, DormDoor, BalconyDoor }); Restroom.Objects.Add(new AObject("墙壁", new string[] { "墙壁", "墙", "地面", "地板", "地", "天花板" })); Restroom.PostCommand = (self, v, p) => { if (self.FindObjectInternal("水龙头").SwitchState) { Print("你身边传来水龙头的哗哗声。\n\n"); } return(HandleResult.Continue); }; }
/*************** CONSTRUCTORS ***************/ public BalconyFrame (Balcony parent) : base(parent) { }
// DropCreateDatabaseAlways <-> DropCreateDatabaseIfModelChanges protected override void Seed(RentContext db) { // Salesmans Salesman sale1 = new Salesman { RegisterDate = DateTime.Now.AddYears(-1), PayedDate = DateTime.Now.AddDays(-35), Name = "Иванов И.И.", Email = "*****@*****.**", PhoneNumber = "+7 926 750-00-88" }; Salesman sale2 = new Salesman { RegisterDate = DateTime.Now.AddMonths(-10), PayedDate = DateTime.Now.AddDays(-25), Name = "Петров П.П.", Email = "*****@*****.**", PhoneNumber = "+7 921 750-55-00" }; Salesman sale3 = new Salesman { RegisterDate = DateTime.Now.AddMonths(-2), PayedDate = DateTime.Now.AddDays(-15), Name = "Сидоров С.С.", Email = "*****@*****.**", PhoneNumber = "+7 926 760-33-33" }; db.Salesmans.AddRange(new List <Salesman> { sale1, sale2, sale3 }); db.SaveChanges(); // BuildingTypes BuildingType build1 = new BuildingType { Name = "кирпичный" }; BuildingType build2 = new BuildingType { Name = "панельный" }; BuildingType build3 = new BuildingType { Name = "монолитный" }; db.BuildingTypes.AddRange(new List <BuildingType> { build1, build2, build3 }); db.SaveChanges(); // Houses House house1 = new House { Address = "Сиреневый проезд 14К2", Year = 1969, Floors = 12, BuildingType = build1 }; House house2 = new House { Address = "Кирпичный переулок 18К5", Year = 1979, Floors = 10, BuildingType = build2 }; House house3 = new House { Address = "1-я Парковая 67", Year = 1988, Floors = 25, BuildingType = build3 }; db.Houses.AddRange(new List <House> { house1, house2, house3 }); db.SaveChanges(); // ToiletTypes ToiletType toilet1 = new ToiletType { Name = "совмещенный" }; ToiletType toilet2 = new ToiletType { Name = "раздельный" }; db.ToiletTypes.AddRange(new List <ToiletType> { toilet1, toilet2 }); db.SaveChanges(); // Balconies Balcony balcony1 = new Balcony { Name = "балкон" }; Balcony balcony2 = new Balcony { Name = "лоджия" }; Balcony balcony3 = new Balcony { Name = "балкон + лоджия" }; db.Balconies.AddRange(new List <Balcony> { balcony1, balcony2, balcony3 }); db.SaveChanges(); // RepairTypes RepairType repair1 = new RepairType { Name = "косметический" }; RepairType repair2 = new RepairType { Name = "евроремонт" }; RepairType repair3 = new RepairType { Name = "дизайнерский" }; RepairType repair4 = new RepairType { Name = "без ремонта" }; db.RepairTypes.AddRange(new List <RepairType> { repair1, repair2, repair3, repair4 }); db.SaveChanges(); // Elevator Elevator elevator1 = new Elevator { Name = "обычный" }; Elevator elevator2 = new Elevator { Name = "грузовой" }; Elevator elevator3 = new Elevator { Name = "обычный + грузовой" }; db.Elevators.AddRange(new List <Elevator> { elevator1, elevator2, elevator3 }); db.SaveChanges(); // ApartmentIncludes ApartmentInclude include1 = new ApartmentInclude { Name = "мебель" }; ApartmentInclude include2 = new ApartmentInclude { Name = "холодильник" }; ApartmentInclude include3 = new ApartmentInclude { Name = "стиральная машина" }; ApartmentInclude include4 = new ApartmentInclude { Name = "интернет" }; ApartmentInclude include5 = new ApartmentInclude { Name = "телевизор" }; ApartmentInclude include6 = new ApartmentInclude { Name = "кондиционер" }; ApartmentInclude include7 = new ApartmentInclude { Name = "посудомоечная машина" }; ApartmentInclude include8 = new ApartmentInclude { Name = "телефон" }; ApartmentInclude include9 = new ApartmentInclude { Name = "ванна" }; db.ApartmentIncludes.AddRange(new List <ApartmentInclude> { include1, include2, include3, include4, include5, include6, include7, include8, include9 }); db.SaveChanges(); // Images for apartments ImagesInclude img01 = new ImagesInclude { Name = "вид 1", Path = "..//Content//207-1.jpg" }; ImagesInclude img02 = new ImagesInclude { Name = "вид 2", Path = "..//Content//207-2.jpg" }; ImagesInclude img03 = new ImagesInclude { Name = "вид 3", Path = "..//Content//207-3.jpg" }; ImagesInclude img04 = new ImagesInclude { Name = "вид 1", Path = "..//Content//208-1.jpg" }; ImagesInclude img05 = new ImagesInclude { Name = "вид 2", Path = "..//Content//208-2.jpg" }; ImagesInclude img06 = new ImagesInclude { Name = "вид 3", Path = "..//Content//208-3.jpg" }; ImagesInclude img07 = new ImagesInclude { Name = "вид 4", Path = "..//Content//208-4.jpg" }; ImagesInclude img08 = new ImagesInclude { Name = "вид 1", Path = "..//Content//209-1.jpg" }; ImagesInclude img09 = new ImagesInclude { Name = "вид 2", Path = "..//Content//209-2.jpg" }; db.ImagesIncludes.AddRange(new List <ImagesInclude> { img01, img02, img03, img04, img05, img06, img07, img08, img09 }); db.SaveChanges(); // Apartments Apartment apt1 = new Apartment { PublishDate = DateTime.Now.AddDays(-2), Salesman = sale1, SalesmanPayedState = true, Price = 20000m, PriceInfo = "на длительный срок (от года), коммунальные платежи включены (кроме счетчиков)", Floor = 1, TotalArea = 36m, LivingArea = 20m, KitchenArea = 10m, OtherInfo = "Сдаётся квартира ПОСЛЕ КАЧЕСТВЕННОГО РЕМОНТА.", House = house1, ToiletType = toilet1, Balcony = balcony1, RepairType = repair1, Elevator = elevator1, ApartmentIncludes = new List <ApartmentInclude> { include1, include4, include9 }, ImagesIncludes = new List <ImagesInclude> { img01, img02, img03 } }; Apartment apt2 = new Apartment { PublishDate = DateTime.Now.AddDays(-1), Salesman = sale2, SalesmanPayedState = true, Price = 21000m, PriceInfo = "1 мес. предоплата + залог 10 000 руб., комиссия 25%", Floor = 10, TotalArea = 38m, LivingArea = 22m, KitchenArea = 9m, OtherInfo = "Укомплектована минимумом мебели. Быт техника в наличии.", House = house2, ToiletType = toilet2, Balcony = balcony2, RepairType = repair1, Elevator = elevator2, ApartmentIncludes = new List <ApartmentInclude> { include2, include5, include8 }, ImagesIncludes = new List <ImagesInclude> { img04, img05, img06, img07 } }; Apartment apt3 = new Apartment { PublishDate = DateTime.Now.AddHours(-10), Salesman = sale3, SalesmanPayedState = true, Price = 20000m, PriceInfo = "на длительный срок (от года)+ залог 20 000 руб., комиссия 50%", Floor = 12, TotalArea = 30m, LivingArea = 18m, KitchenArea = 8m, OtherInfo = "Санузел совмещен. Балкона нет. Сдадим приличным, платежеспособным.", House = house3, ToiletType = toilet1, Balcony = balcony3, RepairType = repair4, Elevator = elevator3, ApartmentIncludes = new List <ApartmentInclude> { include1, include3, include4, include7, include8 }, ImagesIncludes = new List <ImagesInclude> { img08, img09 } }; db.Apartments.AddRange(new List <Apartment> { apt1, apt2, apt3 }); db.SaveChanges(); }
public BalconyBody (Balcony parent) : base(parent) { }
public static void Day2Setting() { // Whoooooosh.... // A. reset BuildDormitory12(); BuildRestroom(); BuildBalcony(); BuildDormsHallway(); BuildLobbyNo8(); Dormitory12.Objects.Find((x) => x.Name == "床铺").Description = (_s, _v) => "在暗中看不清楚。"; // B. modify // B.1. dorm12 // remove the light of darkness Dormitory12.LightDescription = "这是你熟悉的寝室,闭上眼都能想象出它的样子。你能看见衣柜,桌子,床铺(四张:你睡在靠窗的下铺)以及通向走廊和洗手间过道的两扇门。"; Dormitory12.Description = "你只能在黑暗中看见大概的轮廓:衣柜,桌子,床铺(四张:你睡在靠窗的下铺),以及通向走廊和洗手间过道的两扇门。"; // add the light of sky Dormitory12.GetDescription = (self, v) => { if (self.IsLit) { return(Dormitory12.LightDescription + "\n\n窗帘拉开,外面的天空里滚动着紫红色的浓云。"); } else if (self.IsPlayerLit) { return(Dormitory12.LightDescription + "\n\n窗帘后什么地方透出一种红晕,但几乎被手电筒的强光掩盖了。"); } else { return(Dormitory12.Description + "\n\n有一种可爱的红晕穿透窗帘照进来。"); } }; Dormitory12.ReplaceObjectInternal("窗帘", new AObject(Dormitory12.FindObjectInternal("窗帘")) { Description = (_s, _v) => "从它后面什么地方照进来一种红色的光。", LightDescription = (_s, _v) => "从它后面什么地方照进来一种红色的光,但几乎被你手电筒的强光掩盖了。", OnOpening = (self, v) => { self.OpenState = true; self.Description = self.LightDescription = (_s, _v) => "窗帘被你拉开,缩在一边。"; v.currentRoom.FindObjectInternal("窗户").Description = v.currentRoom.FindObjectInternal("窗户").LightDescription = (_s, _v) => "窗外是对面的9#楼(高中男生寝室)和周围的人行道路。天空是紫红色的。"; if (!v.foundNoVoid2) { Print($"你拉开窗帘的一瞬间,紫红色的光涌入房间。它来自对面寝室楼后的天空。楼下的路灯沦为了暗暗的白点。地面也散发出紫色,与天空一起变幻着。在你眼中,有一秒钟时间,天空成了翻滚的海洋,而地面则是风中倒置的迷雾和森林。但是寂静……这片寂静使你惊异。现在甚至听不见外面风声,只有背景中若有若无的耳鸣。{(v.foundDarkness1 ? "你原先期望看到什么?黑暗?……紫色的黑暗?有点可笑。" : "")}\n\n"); v.foundNoVoid2 = true; } else { Print("你拉开窗帘时,紫红色的光涌入房间。\n\n"); } v.currentRoom.IsLit = true; return(HandleResult.FullManaged); }, OnClosing = (self, v) => { self.OpenState = false; self.Description = (_s, _v) => "从它后面什么地方照进来一种红晕。"; self.LightDescription = (_s, _v) => "从它后面什么地方照进来一种红晕,但几乎被你手电筒的强光掩盖了。"; v.currentRoom.FindObjectInternal("窗户").Description = (_s, _v) => "窗户被窗帘遮挡着,只从外面透进来一种红晕。"; v.currentRoom.FindObjectInternal("窗户").LightDescription = (_s, _v) => "窗帘没有拉开,你看不见外面的样子。"; Print("你拉上窗帘。室内恢复了原来的阴暗。\n\n"); return(HandleResult.FullManaged); } }); Dormitory12.ReplaceObjectInternal("窗户", new AObject(Dormitory12.FindObjectInternal("窗户")) { Description = (_s, _v) => "窗户被窗帘遮挡着,只从外面透进来一种红晕。", LightDescription = (_s, _v) => "窗帘没有拉开,你看不见外面的样子。" }); Dormitory12.BeforeCommand = (self, v, p) => { // convenience magic if (p == "xyzzy") { v.withClothes = true; v.currentRoom = Campus; Campus.CurrentArea = Campus.Areas.Find((x) => x.Name == "食堂和寝室楼之间"); Print("Flooooooooooosh!!\n\n"); return(HandleResult.FullManaged); } // TODO: move these to separate verbs if (p == "起床" || p == "起来") { if (self.CurrentArea.Name == "床上") { Print( "你推开被子,坐起来,摸索着穿上最近的一双拖鞋。\n\n"); self.CurrentArea = null; } else { Print("你并不在床上。\n\n"); } return(HandleResult.FullManaged); } else if ((p == "睡" || p == "睡觉")) { Print("现在你不想睡觉。\n\n"); return(HandleResult.FullManaged); } else { return(HandleResult.Continue); } }; // B.2. Restroom: Good. No changes... // B.3. Balcony // sky Balcony.GetDescription = (self, v) => $"阳台的瓷砖地面反射着{(self.IsPlayerLit ? "手电筒和" : "")}天空的色彩。天空在地面上投下你模模糊糊的影子,瓷砖的边缘泛起微光。虽然还没到能看书的地步,但你能注意到光照的亮度很不寻常。眼前漂浮在夜晚朦胧空气中的树和楼房奇怪地漂亮。你能听见风声了。"; Balcony.PostDescription = (self, v) => { if (!v.foundNoVoid2) { v.foundNoVoid2 = true; return($"房间里的红光就来自那天空,使楼下的路灯沦为了暗暗的白点。地面也散发出紫色,与天空一起变幻着。在你眼中,有一秒钟时间,天空成了翻滚的海洋,而地面则是风中倒置的迷雾和森林。但是寂静——这片寂静使你惊异,现在甚至听不见外面风声,只有背景中若有若无的耳鸣。{(v.foundDarkness1 ? "你原先期望看到什么?黑暗?……紫色的黑暗?有点可笑。" : "")}\n\n"); } else { return(""); } }; Balcony.IsLit = true; Balcony.Objects.Remove(Balcony.FindObjectInternal("黑暗")); Balcony.Objects.Add(new AObject("楼房", new[] { "楼房", "树", "树木", "房子", "寝室楼", "9#楼", "地面", "天空" }) { IsReachable = false }); // B.4. DormsHallway: No changes. // B.5. Lobby8 LobbyNo8.LightDescription = "灯光下是一个空荡的小门厅,墙上有一些花哨夸张的图案。楼梯向上通往二楼,另一侧是宿管老师值班的房间,没开灯,窗内黑洞洞的。一扇玻璃大门通向外面。"; // real door LobbyNo8.FindObjectInternal("外面").RoomTo = Campus; LobbyNo8.FindObjectInternal("外面").OnEntering = (self, v) => { Campus.ChangeArea("食堂和寝室楼之间"); return(HandleResult.Continue); }; LobbyNo8.FindObjectInternal("外面").LinkedSide = () => Campus.FindObjectInternal("去8#寝室楼大厅的门"); }