public WelderViewType() { this.welder = new Welder(); this.welder.IsActive = true; CheckName(); CheckCertificate(); }
static void Main() { Car car = new Car { Make = "Scion", Model = "xD", Year = 2010 }; Mechanic mechanic = new Mechanic(); // Inject the dependency to Mechanic into the constructor AutoShop shop = new AutoShop(mechanic); shop.FixCar(car); Welder welder = new Welder(); // Inject the dependency to Welder into the constructor shop = new AutoShop(welder); shop.FixCar(car); shop = new AutoShop(); // Inject the dependency to Welder into the property shop.Worker = welder; shop.WeldCar(car); }
public ActionResult DeleteConfirmed(string id) { Welder welder = db.Welders.Find(id); db.Welders.Remove(welder); db.SaveChanges(); return(RedirectToAction("Index")); }
public static bool WelderVFXFix(Welder __instance) { if (__instance.fxControl != null) { __instance.fxControl.Stop(); } return(true); }
public ActionResult Edit(Welder welder) { if (ModelState.IsValid) { db.Entry(welder).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(welder)); }
public FabricatorDisplay(IMyTextSurface statusDisplay, IMyTextSurface mandatoryDisplay, IMyTextSurface otherDisplay, string name, Projector projector, Welder welder, InventoryManager invManager, IProcessSpawner spawner) { this.statusDisplay = new Display(statusDisplay); this.mandatoryDisplay = new Display(mandatoryDisplay); this.otherDisplay = new Display(otherDisplay); this.invManager = invManager; this.name = name; this.welder = welder; this.projector = projector; this.mainProcess = spawner.Spawn(p => this.updateDisplays(), "display-process", period: 30); }
// Token: 0x06000029 RID: 41 RVA: 0x0000300C File Offset: 0x0000120C public static bool Prefix(Welder __instance) { SkinnedMeshRenderer[] allComponentsInChildren = __instance.GetAllComponentsInChildren <SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer skinnedMeshRenderer in allComponentsInChildren) { bool flag = skinnedMeshRenderer.name.Contains("welder_geos"); if (flag) { skinnedMeshRenderer.material.color = new Color32(Convert.ToByte(MainPatch.config.weldervalue), Convert.ToByte(MainPatch.config.weldergvalue), Convert.ToByte(MainPatch.config.welderbvalue), 1); } } return(true); }
private static List <Vector2> GetWeldSquares() { // if (Welder.weldSquares != null) return weldSquares; List <Vector2> weldSquares = new List <Vector2>(); Action <Machine> addWeldSquare = (machine) => { if (machine is Welder) { Welder welder = (Welder)machine; weldSquares.Add(welder.xy + welder.direction); } }; Machines.ForEach(addWeldSquare); return(weldSquares); }
public Fabricator(MyIni ini, IMyGridTerminalSystem gts, ISaveManager manager, CommandLine command, Action <string> logger) { this.logger = logger; this.name = ini.GetThrow(SECTION, "name").ToString(); this.mainProcess = manager.Spawn(null, "fabricator-process", period: 100); this.projector = new Projector( AssertNonNull(gts.GetBlockWithName(this.name + " Projector Door") as IMyDoor, $"Could not find '{this.name + " Projector Door"}'"), AssertNonNull(gts.GetBlockWithName(this.name + " Projector Piston") as IMyPistonBase, $"Could not find '{this.name + " Projector Piston"}'"), AssertNonNull(gts.GetBlockWithName(this.name + " Projector") as IMyProjector, $"Could not find '{this.name + " Projector Projector"}'"), this.mainProcess, this.log); var pistons = new List <IMyPistonBase>(); gts.GetBlocksOfType(pistons, p => p.DisplayNameText == this.name + " Piston"); var welders = new List <IMyShipWelder>(); gts.GetBlocksOfType(welders, w => w.DisplayNameText == this.name + " Welder"); var lights = new List <IMyLightingBlock>(); gts.GetBlocksOfType(lights, l => l.DisplayNameText == this.name + " Light"); this.welder = new Welder( AssertNonEmpty(pistons, $"Could not find any '{this.name + " Piston"}'"), AssertNonNull(gts.GetBlockWithName(this.name + " Sensor") as IMySensorBlock, $"Could not find '{this.name + " Sensor"}'"), AssertNonEmpty(welders, $"Could not find any '{this.name + " Welder"}'"), AssertNonEmpty(lights, $"Could not find any '{this.name + " Light"}'"), ini.Get(SECTION, "position-multiplier").ToInt32(1), this.mainProcess); this.inventoryManager = new InventoryManager(this.mainProcess, c => this.containersGetter(c, gts)); this.display = new FabricatorDisplay( AssertNonNull(gts.GetBlockWithName(this.name + " Status Display") as IMyTextPanel, $"Could not find '{this.name + " Status Display"}'"), AssertNonNull(gts.GetBlockWithName(this.name + " Mandatory Display") as IMyTextPanel, $"Could not find '{this.name + " Mandatory Display"}'"), AssertNonNull(gts.GetBlockWithName(this.name + " Other Display") as IMyTextPanel, $"Could not find '{this.name + " Other Display"}'"), this.name, this.projector, this.welder, this.inventoryManager, this.mainProcess ); command.RegisterCommand(new Command("fab-deploy", Command.Wrap(this.deploy), "Deploys the blueprint dispenser")); command.RegisterCommand(new Command("fab-retract", Command.Wrap(this.retract), "Deploys the blueprint dispenser")); command.RegisterCommand(new Command("fab-step", Command.Wrap((Process p) => this.step(gts)), "Activates the welder")); }
static void Main() { Car car = new Car { Make = "Scion", Model = "xD", Year = 2010 }; Mechanic mechanic = new Mechanic(); AutoShop shop = new AutoShop(mechanic); shop.FixCar(car); Welder welder = new Welder(); shop = new AutoShop(welder); shop.FixCar(car); }
public ActionResult Create(Welder welder) { if (ModelState.IsValid) { db.Welders.Add(welder); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.WelderLevels = Enum <WelderLevel> .GetSelectList(); List <int> years = new List <int>(); for (int i = 1940; i < 2010; i++) { years.Add(i); } ViewBag.Years = new SelectList(years); return(View(welder)); }
public static float AddHealthOverride(LiveMixin live, float addHealth, Welder welder) { float result = 0f; if ((live.IsAlive() || live.canResurrect) && live.health < live.maxHealth) { float num = live.health; float newHealth = Math.Min(live.health + addHealth, live.maxHealth); result = newHealth - num; SimulationOwnership simulationOwnership = NitroxServiceLocator.LocateService <SimulationOwnership>(); NitroxId id = NitroxEntity.GetId(live.gameObject); // For now, we only control the LiveMixin for vehicles (not even repair nodes at a cyclops) // If we change that, this if should be removed! Vehicle vehicle = live.GetComponent <Vehicle>(); if (vehicle) { if (simulationOwnership.HasAnyLockType(id)) { result = live.AddHealth(addHealth); } else { // Another player simulates this entity. Send the weld info Log.Debug($"Broadcast weld action for {id}"); NitroxServiceLocator.LocateService <LocalPlayer>().BroadcastWeld(id, addHealth); } } else { result = live.AddHealth(addHealth); } } return(result); }
private bool DetermineTileAction(GameObject originator, Vector3 position, string hand) { metaTileMap = originator.GetComponentInParent <MetaTileMap>(); objectLayer = originator.GetComponentInParent <ObjectLayer>(); PlayerNetworkActions pna = originator.GetComponent <PlayerNetworkActions>(); Vector3Int pos = objectLayer.transform.InverseTransformPoint(position).RoundToInt(); pos.z = 0; Vector3Int cellPos = baseTileMap.WorldToCell(position); LayerTile tile = metaTileMap.GetTile(pos); GameObject handObj = UIManager.Hands.CurrentSlot.Item; // Nothing in hand, do nothing if (handObj == null) { return(false); } if (tile != null) { switch (tile.TileType) { case TileType.Table: { Vector3 targetPosition = position; targetPosition.z = -0.2f; pna.CmdPlaceItem(hand, targetPosition, originator, true); return(true); } case TileType.Floor: { //Crowbar if (handObj.GetComponent <CrowbarTrigger>()) { pna.CmdCrowBarRemoveFloorTile(originator, LayerType.Floors, new Vector2(cellPos.x, cellPos.y), position); return(true); } break; } case TileType.Base: { if (handObj.GetComponent <UniFloorTile>()) { pna.CmdPlaceFloorTile(originator, new Vector2(cellPos.x, cellPos.y), handObj); return(true); } break; } case TileType.Window: { //Check Melee: MeleeTrigger melee = windowTileMap.gameObject.GetComponent <MeleeTrigger>(); if (melee != null && melee.MeleeInteract(originator, hand)) { return(true); } break; } case TileType.Grill: { //Check Melee: MeleeTrigger melee = grillTileMap.gameObject.GetComponent <MeleeTrigger>(); if (melee != null && melee.MeleeInteract(originator, hand)) { return(true); } break; } case TileType.Wall: { Welder welder = handObj.GetComponent <Welder>(); if (welder) { if (welder.isOn) { //Request to deconstruct from the server: RequestTileDeconstructMessage.Send(originator, gameObject, TileType.Wall, cellPos, position); return(true); } } break; } } } return(false); }
// // GET: /Welder/Details/5 public ViewResult Details(string id) { Welder welder = db.Welders.Find(id); return(View(welder)); }
public WelderViewType(Welder welder) { this.welder = welder; }
// // GET: /Welder/Edit/5 public ActionResult Edit(string id) { Welder welder = db.Welders.Find(id); return(View(welder)); }
} //private void OnDraw() /* * Editor Button Draw */ private void OnWeldButton() { //Making sure the editor is not on softlock or no parts are selected if (EditorLogic.softLock || null == EditorLogic.SelectedPart) { GUI.Box(_editorButton, Constants.guiWeldLabel); } else { if (GUI.Button(_editorButton, Constants.guiWeldLabel)) { //Lock editor EditorLogic.fetch.Lock(true, true, true, "UBILOCK9213"); //process the welding #if (DEBUG) Debug.ClearDeveloperConsole(); #endif Debug.Log(string.Format("{0}{1}", Constants.logPrefix, Constants.logVersion)); Debug.Log(string.Format("{0}{1}", Constants.logPrefix, Constants.logStartWeld)); Part selectedPart = EditorLogic.fetch.PartSelected; bool warning = false; _welder = new Welder(); WeldingReturn ret = _welder.weldThisPart(selectedPart); if (0 > ret) { Debug.Log(string.Format("{0}{1}", Constants.logPrefix, Constants.logEndWeld)); _state = DisplayState.weldError; return; } else { warning = warning || (0 < ret); } Part[] children = selectedPart.FindChildParts <Part>(true); if (null != children) { foreach (Part child in children) { ret = _welder.weldThisPart(child); if (0 > ret) { Debug.Log(string.Format("{0}{1}", Constants.logPrefix, Constants.logEndWeld)); _state = DisplayState.weldError; return; } else { warning = warning || (0 < ret); } } } _welder.processNewCoM(); _scrollMod = Vector2.zero; _scrollRes = Vector2.zero; Debug.Log(string.Format("{0} {1}{2}", Constants.logPrefix, _welder.NbParts, Constants.logEndWeld)); Debug.Log(string.Format("{0}{1}", Constants.logPrefix, Constants.logEndWeld)); if (warning) { _state = DisplayState.weldWarning; } else { _catDropdown.SelectedItemIndex = (int)_welder.Category; _state = DisplayState.infoWindow; } } // if (GUI.Button(_editorButton, Constants.guiWeldLabel)) } // elsef if (EditorLogic.softLock || null == EditorLogic.SelectedPart) } //private void OnWeldButton()
/// <summary> /// Just like Create, but will auto-interrupt progress if the welder runs out of fuel. /// </summary> /// <param name="progressActionConfig"></param> /// <param name="onCompletion"></param> /// <returns></returns> public static StandardProgressAction CreateForWelder(StandardProgressActionConfig progressActionConfig, Action onCompletion, Welder welder) { return(new StandardProgressAction(progressActionConfig, onCompletion, welder)); }
public bool Interact(PositionalHandApply interaction) { if (!DefaultWillInteract.PositionalHandApply(interaction, NetworkSide.Client)) { return(false); } PlayerNetworkActions pna = interaction.Performer.GetComponent <PlayerNetworkActions>(); Vector3Int pos = objectLayer.transform.InverseTransformPoint(interaction.WorldPositionTarget).RoundToInt(); pos.z = 0; Vector3Int cellPos = baseLayer.WorldToCell(interaction.WorldPositionTarget); LayerTile tile = metaTileMap.GetTile(pos); if (tile != null) { switch (tile.TileType) { case TileType.Table: { Vector3 targetPosition = interaction.WorldPositionTarget; targetPosition.z = -0.2f; pna.CmdPlaceItem(interaction.HandSlot.equipSlot, targetPosition, interaction.Performer, true); return(true); } case TileType.Floor: { //Crowbar if (Validations.IsTool(interaction.HandObject, ToolType.Crowbar)) { pna.CmdCrowBarRemoveFloorTile(interaction.Performer, LayerType.Floors, new Vector2(cellPos.x, cellPos.y), interaction.WorldPositionTarget); return(true); } break; } case TileType.Base: { if (Validations.HasComponent <UniFloorTile>(interaction.HandObject)) { pna.CmdPlaceFloorTile(interaction.Performer, new Vector2(cellPos.x, cellPos.y), interaction.HandObject); return(true); } break; } case TileType.Window: { //Check Melee: Meleeable melee = windowLayer.gameObject.GetComponent <Meleeable>(); if (melee != null && melee.Interact(PositionalHandApply.ByLocalPlayer(gameObject))) { return(true); } break; } case TileType.Grill: { //Check Melee: Meleeable melee = grillTileMap.gameObject.GetComponent <Meleeable>(); if (melee != null && melee.Interact(PositionalHandApply.ByLocalPlayer(gameObject))) { return(true); } break; } case TileType.Wall: { Welder welder = interaction.HandObject != null?interaction.HandObject.GetComponent <Welder>() : null; if (welder != null) { if (welder.isOn) { //Request to deconstruct from the server: RequestTileDeconstructMessage.Send(interaction.Performer, gameObject, TileType.Wall, cellPos, interaction.WorldPositionTarget); return(true); } } break; } } } return(false); }
public override GameObject GetGameObject() { try { GameObject gun = techpistol.darktest.LoadAsset <GameObject>("techpistol.prefab"); MeshRenderer[] allshader = gun.FindChild("HandGun").GetComponentsInChildren <MeshRenderer>(); foreach (MeshRenderer setshader in allshader) { setshader.material.shader = Shader.Find("MarmosetUBER"); setshader.material.SetColor("_Emission", new Color(1f, 1f, 1f)); } gun.transform.Find("Cannonmode/shoot/shoo").gameObject.AgComponent <cool>(); gun.AgComponent <PrefabIdentifier>().ClassId = ClassID; gun.AgComponent <LargeWorldEntity>().cellLevel = LargeWorldEntity.CellLevel.Near; gun.AgComponent <Pickupable>().isPickupable = true;; gun.AgComponent <TechTag>().type = TechType; gun.AgComponent <Fixer>().techType = TechType; gun.AgComponent <Fixer>().ClassId = ClassID; WorldForces World = gun.AgComponent <WorldForces>(); Rigidbody body = gun.AgComponent <Rigidbody>(); World.underwaterGravity = 0; World.useRigidbody = body; EnergyMixin battery = gun.AgComponent <EnergyMixin>(); battery.storageRoot = gun.FindChild("BatteryRoot").AgComponent <ChildObjectIdentifier>(); battery.allowBatteryReplacement = true; battery.compatibleBatteries = new List <TechType> { TechType.PrecursorIonBattery, TechType.Battery, TechType.PrecursorIonPowerCell, TechType.PowerCell }; battery.batteryModels = new EnergyMixin.BatteryModels[] { new EnergyMixin.BatteryModels { techType = TechType.PrecursorIonPowerCell, model = gun.transform.Find("BatteryRoot/PrecursorIonPowerCell").gameObject }, new EnergyMixin.BatteryModels { techType = TechType.Battery, model = gun.transform.Find("BatteryRoot/Battery").gameObject }, new EnergyMixin.BatteryModels { techType = TechType.PrecursorIonBattery, model = gun.transform.Find("BatteryRoot/PrecursorIonBattery").gameObject }, new EnergyMixin.BatteryModels { techType = TechType.PowerCell, model = gun.transform.Find("BatteryRoot/PowerCell").gameObject } }; Gun biggun = gun.AgComponent <Gun>(); RepulsionCannon Boo = CraftData.InstantiateFromPrefab(TechType.RepulsionCannon).GetComponent <RepulsionCannon>(); StasisRifle Boo2 = CraftData.InstantiateFromPrefab(TechType.StasisRifle).GetComponent <StasisRifle>(); PropulsionCannon build = CraftData.InstantiateFromPrefab(TechType.PropulsionCannon).GetComponent <PropulsionCannon>(); Welder laserloop = CraftData.InstantiateFromPrefab(TechType.Welder).GetComponent <Welder>(); VFXFabricating vfxfabricating = gun.FindChild("HandGun").AgComponent <VFXFabricating>(); vfxfabricating.localMinY = -3f; vfxfabricating.localMaxY = 3f; vfxfabricating.posOffset = new Vector3(0f, 0, 0f); vfxfabricating.eulerOffset = new Vector3(0f, 90f, -90f); vfxfabricating.scaleFactor = 1f; biggun.shoot1 = Boo.shootSound; biggun.shoot2 = Boo2.fireSound; biggun.xulikai = Boo2.chargeBegin; biggun.modechang = build.shootSound; biggun.laseroopS = laserloop.weldSound; biggun.mainCollider = gun.GetComponent <BoxCollider>(); biggun.ikAimRightArm = true; biggun.useLeftAimTargetOnPlayer = true; UnityEngine.Object.Destroy(Boo2); UnityEngine.Object.Destroy(build); UnityEngine.Object.Destroy(Boo); UnityEngine.Object.Destroy(laserloop); return(gun); } catch { Console.WriteLine("初始化错误"); return(new GameObject()); } }
private bool SeedOptional() { firstSetupRepo.BeginTransaction(); #region PlateManufacturers PlateManufacturer[] plateManufacturers = { new PlateManufacturer { Name = "Алапаевский металлургический завод", IsActive = true }, new PlateManufacturer { Name = "Альметьевский трубный завод", IsActive = true }, new PlateManufacturer { Name = "Борский трубный завод", IsActive = true }, new PlateManufacturer { Name = "Волжский трубный завод", IsActive = true }, new PlateManufacturer { Name = "Волгоградский трубный завод", IsActive = true }, new PlateManufacturer { Name = "Гурьевский металлургический завод", IsActive = true }, new PlateManufacturer { Name = "Завод Точлит", IsActive = true } }; Array.ForEach(plateManufacturers, s => firstSetupRepo.PlateManRepo.Save(s)); #endregion firstSetupRepo.Commit(); firstSetupRepo.BeginTransaction(); #region Heat List <Heat> heats = new List <Heat>(); for (int i = 0; i < HEATCOUNT; i++) { heats.Add ( new Heat { Number = RndString(8), SteelGrade = RndString(6), PlateManufacturer = plateManufacturers[rnd.Next(plateManufacturers.Length - 1)], IsActive = true } ); firstSetupRepo.HeatRepo.Save(heats[i]); } #endregion firstSetupRepo.Commit(); firstSetupRepo.BeginTransaction(); #region PurchaseOrder List <PurchaseOrder> orders = new List <PurchaseOrder> { new PurchaseOrder { Number = RndString(5), Date = DateTime.Now.AddMonths(-rnd.Next(10)), IsActive = true }, new PurchaseOrder { Number = RndString(5), Date = DateTime.Now.AddMonths(-rnd.Next(10)), IsActive = true }, new PurchaseOrder { Number = RndString(5), Date = DateTime.Now.AddMonths(-rnd.Next(10)), IsActive = true }, new PurchaseOrder { Number = RndString(5), Date = DateTime.Now.AddMonths(-rnd.Next(10)), IsActive = true }, new PurchaseOrder { Number = RndString(5), Date = DateTime.Now.AddMonths(-rnd.Next(10)), IsActive = true } }; orders.ForEach(s => firstSetupRepo.PurchaseRepo.Save(s)); #endregion firstSetupRepo.Commit(); firstSetupRepo.BeginTransaction(); #region MillPipe List <Pipe> pipes = new List <Pipe>(); for (int i = 0; i < PIPECOUNT; i++) { var plate = new Plate { Number = RndString(8), Thickness = rnd.Next(2000), Heat = heats[rnd.Next(heats.Count - 1)], IsActive = true }; firstSetupRepo.PlateRepo.Save(plate); var pipe = new Pipe { Number = RndString(8), Plate = plate, Mill = viewModel.MillName, Diameter = types[0].Diameter, WallThickness = types[0].Thickness, Type = types[rnd.Next(1)], PurchaseOrder = orders[orders.Count - 1], Project = viewModel.Project, Status = PipeMillStatus.Produced, ProductionDate = DateTime.Now.AddDays(-rnd.Next(20)), ToExport = true, IsActive = true }; pipe.RecalculateWeight(); var results = new List <PipeTestResult>(); foreach (var item in tests.Where(x => x.pipeType == pipe.Type)) { var testResult = new PipeTestResult { Operation = item, Pipe = pipe, Status = PipeTestResultStatus.Scheduled }; results.Add(testResult); firstSetupRepo.PipeTestResultRepo.Save(testResult); } pipe.PipeTestResult = results; pipes.Add(pipe); if (pipes.Count % 4 == 0) { foreach (var item in pipe.PipeTestResult) { item.Status = PipeTestResultStatus.Passed; } pipe.Status = PipeMillStatus.Stocked; pipe.ConstructionStatus = PartConstructionStatus.Pending; pipe.IsAvailableToJoint = true; } firstSetupRepo.PipeRepo.Save(pipe); } ; #endregion firstSetupRepo.Commit(); firstSetupRepo.BeginTransaction(); #region Inspector List <Inspector> inspectors = new List <Inspector>(); for (int i = 0; i < INSPECTORCOUNT; i++) { var insp = new Inspector { Name = new PersonName { FirstName = RndName(fNames), LastName = RndName(lNames), MiddleName = RndName(mNames), }, IsActive = true }; insp.Certificates = CreateInspectorCertificates(insp, inspetorCertTypes); inspectors.Add(insp); firstSetupRepo.InspectorRepo.Save(insp); } #endregion firstSetupRepo.Commit(); firstSetupRepo.BeginTransaction(); #region Welder List <Welder> welders = new List <Welder>(); for (int i = 0; i < WELDERCOUNT; i++) { var welder = new Welder { Grade = rnd.Next(6), Name = new PersonName { FirstName = RndName(fNames), LastName = RndName(lNames), MiddleName = RndName(mNames), }, Stamp = RndString(12), Certificate = new Certificate { Number = RndString(14), ExpirationDate = DateTime.Now.AddDays(rnd.Next(60)), IsActive = true }, IsActive = true }; welders.Add(welder); firstSetupRepo.WelderRepo.Save(welder); } #endregion firstSetupRepo.Commit(); firstSetupRepo.BeginTransaction(); #region ComponentType ComponentType[] componentTypes = { new ComponentType { Name = "Заглушка", ConnectorsCount = 1, IsActive = true }, new ComponentType { Name = "Переходник", ConnectorsCount = 2, IsActive = true }, new ComponentType { Name = "Т - Соединение", ConnectorsCount = 3, IsActive = true }, new ComponentType { Name = "Тройник", ConnectorsCount = 3, IsActive = true } }; foreach (var item in componentTypes) { firstSetupRepo.ComponentTypeRepo.Save(item); } #endregion firstSetupRepo.Commit(); firstSetupRepo.BeginTransaction(); #region Component List <Domain.Entity.Construction.Component> components = new List <Domain.Entity.Construction.Component>(); foreach (var type in componentTypes) { for (int i = 0; i < COMPONENTCOUNT; i++) { var component = CreateComponent(type); firstSetupRepo.ComponentRepo.Save(component); components.Add(component); } } #endregion firstSetupRepo.Commit(); firstSetupRepo.BeginTransaction(); #region Release List <Prizm.Domain.Entity.Mill.ReleaseNote> releases = new List <Prizm.Domain.Entity.Mill.ReleaseNote>(); for (int i = 0; i < RELEASECOUNT; i++) { Prizm.Domain.Entity.Mill.ReleaseNote release = new Prizm.Domain.Entity.Mill.ReleaseNote { Number = RndString(10), Shipped = false, Date = DateTime.Now.AddDays(-rnd.Next(10)), IsActive = true }; release.Railcars = CreateRailcars(rnd.Next(2, 5)); firstSetupRepo.ReleaseRepo.Save(release); } #endregion firstSetupRepo.Commit(); return(false); }
} //private void OnDraw() private void weldPart(Part partToWeld) { //Lock editor EditorLogic.fetch.Lock(true, true, true, Constants.settingWeldingLock); //process the welding #if (DEBUG) Debug.ClearDeveloperConsole(); Debug.Log(string.Format("{0}{1}", Constants.logPrefix, Constants.logVersion)); Debug.Log(string.Format("{0}{1}", Constants.logPrefix, Constants.logStartWeld)); #endif bool warning = false; _welder = new Welder(); partToWeld.transform.eulerAngles = Vector3.up; WeldingReturn ret = _welder.weldThisPart(partToWeld); if (ret < 0) { #if (DEBUG) Debug.Log(string.Format("{0}{1}", Constants.logPrefix, Constants.logEndWeld)); #endif _state = DisplayState.weldError; return; } else { warning = warning || (0 < ret); } Part[] children = partToWeld.FindChildParts <Part>(true); if (children != null) { foreach (Part child in children) { ret = _welder.weldThisPart(child); if (ret < 0) { #if (DEBUG) Debug.Log(string.Format("{0}{1}", Constants.logPrefix, Constants.logEndWeld)); #endif _state = DisplayState.weldError; return; } else { warning = warning || (0 < ret); } } } _welder.processNewCoM(); _techDropdown = WeldingHelpers.initTechDropDown(_welder.techList, _catListStyle, _techDropdown); _scrollMod = Vector2.zero; _scrollRes = Vector2.zero; #if (DEBUG) Debug.Log(string.Format("{0} {1} | {2} Parts welded", Constants.logPrefix, Constants.logEndWeld, _welder.NbParts)); #endif if (warning) { Debug.Log(string.Format("{0} {1} | Warning", Constants.logPrefix, Constants.logEndWeld)); _state = DisplayState.weldWarning; } else { _catDropdown.SelectedItemIndex = (int)_welder.Category; _state = DisplayState.infoWindow; } }
private bool SeedOptional() { //Required seed hasn't been performed for Master worksration type, but data are used in optional seed if (viewModel.Project.WorkstationType == WorkstationType.Master) { SeedRequired(); } firstSetupRepo.BeginTransaction(); #region SeamTypes seamTypes = new List <SeamType> { new SeamType { Name = "Бесшовный", IsActive = true, IsNative = true, Project = viewModel.Project }, new SeamType { Name = "Прямой", IsActive = true, IsNative = true, Project = viewModel.Project }, new SeamType { Name = "Спиралевидный", IsActive = true, IsNative = true, Project = viewModel.Project }, }; foreach (var item in seamTypes) { firstSetupRepo.SeemTypeRepo.Save(item); } #endregion firstSetupRepo.Commit(); firstSetupRepo.BeginTransaction(); #region InspectorCertificateTypes inspetorCertTypes = new List <InspectorCertificateType> { new InspectorCertificateType { Name = "Покрытия (Coating)", IsActive = true }, new InspectorCertificateType { Name = "РК (RT)", IsActive = true }, new InspectorCertificateType { Name = "ВИК (VT)", IsActive = true }, new InspectorCertificateType { Name = "УК (UT)", IsActive = true }, new InspectorCertificateType { Name = "НАКС (Welding Engineer)", IsActive = true }, new InspectorCertificateType { Name = "МК (MT)", IsActive = true } }; inspetorCertTypes.ForEach(s => firstSetupRepo.CertificateTypeRepo.Save(s)); #endregion firstSetupRepo.Commit(); firstSetupRepo.BeginTransaction(); #region PipeMillSyzeType types = new List <PipeMillSizeType> { new PipeMillSizeType { Type = "1500 X 100500 X 50 - бесшовный", IsActive = true, Length = 9090, Diameter = 1212, Thickness = 12, SeamType = seamTypes[0], IsNative = true, Project = viewModel.Project }, new PipeMillSizeType { Type = "1500 X 100500 X 50 - Прямой", IsActive = true, Length = 9090, Diameter = 1212, Thickness = 12, SeamType = seamTypes[1], IsNative = true, Project = viewModel.Project }, }; types.ForEach(s => firstSetupRepo.SizeTypeRepo.Save(s)); #endregion firstSetupRepo.Commit(); firstSetupRepo.BeginTransaction(); #region PipeTestCategory categories = new List <Category> { #region creating pipe test category new Category { Name = "Категория - 1", Fixed = false, Type = FixedCategory.Undefined, IsActive = true }, new Category { Name = "Категория - 2", Fixed = false, Type = FixedCategory.Undefined, IsActive = true }, new Category { Name = "Измерение длины", IsActive = true, Fixed = true, ResultType = "int", Type = FixedCategory.Length }, new Category { Name = "Контроль сварки", IsActive = true, Fixed = true, ResultType = "int", Type = FixedCategory.Weld }, new Category { Name = "Контроль внешнего покрытия", IsActive = true, Fixed = true, ResultType = "int", Type = FixedCategory.ExternalCoat }, new Category { Name = "Контроль внутреннего покрытия", IsActive = true, Fixed = true, ResultType = "int", Type = FixedCategory.InternalCoat } #endregion }; foreach (var category in categories) { firstSetupRepo.CategoryRepo.Save(category); } #endregion firstSetupRepo.Commit(); firstSetupRepo.BeginTransaction(); #region PipeTest tests = new List <PipeTest> { #region creating pipetests for first pipe size type new PipeTest { Code = "01", Name = "Входной контроль листа", Category = categories[0], ControlType = PipeTestControlType.Monitor, ResultType = PipeTestResultType.Boolean, pipeType = types[0], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "02", Name = "Сварка технологического шва", Category = categories[3], ControlType = PipeTestControlType.Monitor, ResultType = PipeTestResultType.Boolean, pipeType = types[0], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "03", Name = "Сварка наружного шва", Category = categories[3], ControlType = PipeTestControlType.Monitor, ResultType = PipeTestResultType.Boolean, pipeType = types[0], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "04", Name = "Сварка внутреннего шва", Category = categories[3], ControlType = PipeTestControlType.Monitor, ResultType = PipeTestResultType.Boolean, pipeType = types[0], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "05", Name = "Экспандирование", Category = categories[0], ControlType = PipeTestControlType.Review, ResultType = PipeTestResultType.Boolean, pipeType = types[0], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "06", Name = "Обработка торцов", Category = categories[0], ControlType = PipeTestControlType.Monitor, ResultType = PipeTestResultType.Boolean, pipeType = types[0], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "07", Name = "Гидроиспытание", Category = categories[0], ControlType = PipeTestControlType.Witness, ResultType = PipeTestResultType.Boolean, pipeType = types[0], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "08", Name = "Рентген сварного шва", Category = categories[1], ControlType = PipeTestControlType.Witness, ResultType = PipeTestResultType.String, pipeType = types[0], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "09", Name = "АУЗК сварного шва", Category = categories[1], ControlType = PipeTestControlType.Witness, ResultType = PipeTestResultType.String, pipeType = types[0], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "10", Name = "РУЗК концов сварного шва", Category = categories[1], ControlType = PipeTestControlType.Witness, ResultType = PipeTestResultType.String, pipeType = types[0], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "11", Name = "МПК фаски", Category = categories[1], ControlType = PipeTestControlType.Monitor, ResultType = PipeTestResultType.String, pipeType = types[0], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "12", Name = "Наружный диаметр", Category = categories[1], ControlType = PipeTestControlType.Witness, ResultType = PipeTestResultType.Diapason, MinExpected = 1217, MaxExpected = 1221, pipeType = types[0], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "13", Name = "Длина трубы", Category = categories[2], ControlType = PipeTestControlType.Monitor, ResultType = PipeTestResultType.Diapason, MinExpected = 9000, MaxExpected = 12400, pipeType = types[0], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "21", Name = "Нанесение наружного покрытия", Category = categories[4], ControlType = PipeTestControlType.Monitor, ResultType = PipeTestResultType.Boolean, pipeType = types[0], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "31", Name = "Нанесение внутреннего покрытия", Category = categories[5], ControlType = PipeTestControlType.Monitor, ResultType = PipeTestResultType.Boolean, pipeType = types[0], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "41", Name = "Складирование", Category = categories[0], ControlType = PipeTestControlType.Monitor, ResultType = PipeTestResultType.Boolean, pipeType = types[0], IsActive = true, FrequencyType = InspectionFrequencyType.R }, #endregion #region creating pipetests for second pipe size type new PipeTest { Code = "01", Name = "Входной контроль листа", Category = categories[0], ControlType = PipeTestControlType.Monitor, ResultType = PipeTestResultType.Boolean, pipeType = types[1], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "02", Name = "Сварка технологического шва", Category = categories[3], ControlType = PipeTestControlType.Monitor, ResultType = PipeTestResultType.Boolean, pipeType = types[1], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "03", Name = "Сварка наружного шва", Category = categories[3], ControlType = PipeTestControlType.Monitor, ResultType = PipeTestResultType.Boolean, pipeType = types[1], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "04", Name = "Сварка внутреннего шва", Category = categories[3], ControlType = PipeTestControlType.Monitor, ResultType = PipeTestResultType.Boolean, pipeType = types[1], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "05", Name = "Экспандирование", Category = categories[0], ControlType = PipeTestControlType.Review, ResultType = PipeTestResultType.Boolean, pipeType = types[1], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "06", Name = "Обработка торцов", Category = categories[0], ControlType = PipeTestControlType.Monitor, ResultType = PipeTestResultType.Boolean, pipeType = types[1], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "07", Name = "Гидроиспытание", Category = categories[0], ControlType = PipeTestControlType.Witness, ResultType = PipeTestResultType.Boolean, pipeType = types[1], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "08", Name = "Рентген сварного шва", Category = categories[1], ControlType = PipeTestControlType.Witness, ResultType = PipeTestResultType.String, pipeType = types[1], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "09", Name = "АУЗК сварного шва", Category = categories[1], ControlType = PipeTestControlType.Witness, ResultType = PipeTestResultType.String, pipeType = types[1], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "10", Name = "РУЗК концов сварного шва", Category = categories[1], ControlType = PipeTestControlType.Witness, ResultType = PipeTestResultType.String, pipeType = types[1], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "11", Name = "МПК фаски", Category = categories[1], ControlType = PipeTestControlType.Monitor, ResultType = PipeTestResultType.String, pipeType = types[1], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "12", Name = "Наружный диаметр", Category = categories[1], ControlType = PipeTestControlType.Witness, ResultType = PipeTestResultType.Diapason, MinExpected = 1217, MaxExpected = 1221, pipeType = types[1], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "13", Name = "Длина трубы", Category = categories[2], ControlType = PipeTestControlType.Monitor, ResultType = PipeTestResultType.Diapason, MinExpected = 9000, MaxExpected = 12400, pipeType = types[1], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "21", Name = "Нанесение наружного покрытия", Category = categories[4], ControlType = PipeTestControlType.Monitor, ResultType = PipeTestResultType.Boolean, pipeType = types[1], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "31", Name = "Нанесение внутреннего покрытия", Category = categories[5], ControlType = PipeTestControlType.Monitor, ResultType = PipeTestResultType.Boolean, pipeType = types[1], IsActive = true, FrequencyType = InspectionFrequencyType.R }, new PipeTest { Code = "41", Name = "Складирование", Category = categories[0], ControlType = PipeTestControlType.Monitor, ResultType = PipeTestResultType.Boolean, pipeType = types[1], IsActive = true, FrequencyType = InspectionFrequencyType.R } #endregion }; foreach (var test in tests) { firstSetupRepo.TestRepo.Save(test); } #endregion firstSetupRepo.Commit(); firstSetupRepo.BeginTransaction(); #region PlateManufacturers PlateManufacturer[] plateManufacturers = { new PlateManufacturer { Name = "Алапаевский металлургический завод", IsActive = true, IsNative = true, Project = viewModel.Project }, new PlateManufacturer { Name = "Альметьевский трубный завод", IsActive = true, IsNative = true, Project = viewModel.Project }, new PlateManufacturer { Name = "Борский трубный завод", IsActive = true, IsNative = true, Project = viewModel.Project }, new PlateManufacturer { Name = "Волжский трубный завод", IsActive = true, IsNative = true, Project = viewModel.Project }, new PlateManufacturer { Name = "Волгоградский трубный завод", IsActive = true, IsNative = true, Project = viewModel.Project }, new PlateManufacturer { Name = "Гурьевский металлургический завод", IsActive = true, IsNative = true, Project = viewModel.Project }, new PlateManufacturer { Name = "Завод Точлит", IsActive = true } }; Array.ForEach(plateManufacturers, s => firstSetupRepo.PlateManRepo.Save(s)); #endregion firstSetupRepo.Commit(); firstSetupRepo.BeginTransaction(); #region Heat List <Heat> heats = new List <Heat>(); for (int i = 0; i < HEATCOUNT; i++) { heats.Add ( new Heat() { Number = RndString(8), SteelGrade = RndString(6), PlateManufacturer = plateManufacturers[rnd.Next(plateManufacturers.Length - 1)], IsActive = true } ); firstSetupRepo.HeatRepo.Save(heats[i]); } #endregion firstSetupRepo.Commit(); firstSetupRepo.BeginTransaction(); #region PurchaseOrder List <PurchaseOrder> orders = new List <PurchaseOrder> { new PurchaseOrder { Number = RndString(5), Date = DateTime.Now.AddMonths(-rnd.Next(10)), IsActive = true }, new PurchaseOrder { Number = RndString(5), Date = DateTime.Now.AddMonths(-rnd.Next(10)), IsActive = true }, new PurchaseOrder { Number = RndString(5), Date = DateTime.Now.AddMonths(-rnd.Next(10)), IsActive = true }, new PurchaseOrder { Number = RndString(5), Date = DateTime.Now.AddMonths(-rnd.Next(10)), IsActive = true }, new PurchaseOrder { Number = RndString(5), Date = DateTime.Now.AddMonths(-rnd.Next(10)), IsActive = true } }; orders.ForEach(s => firstSetupRepo.PurchaseRepo.Save(s)); #endregion firstSetupRepo.Commit(); firstSetupRepo.BeginTransaction(); #region MillPipe List <Pipe> pipes = new List <Pipe>(); for (int i = 0; i < PIPECOUNT; i++) { var plate = new Plate { Number = RndString(8), Thickness = rnd.Next(2000), Heat = heats[rnd.Next(heats.Count - 1)], IsActive = true }; firstSetupRepo.PlateRepo.Save(plate); var pipe = new Pipe { Number = RndString(8), Plate = plate, Mill = viewModel.MillName, Diameter = types[0].Diameter, WallThickness = types[0].Thickness, Type = types[rnd.Next(1)], PurchaseOrder = orders[orders.Count - 1], Project = viewModel.Project, Status = PipeMillStatus.Produced, ProductionDate = DateTime.Now.AddDays(-rnd.Next(20)), IsActive = true }; pipe.RecalculateWeight(); var results = new List <PipeTestResult>(); foreach (var item in tests.Where(x => x.pipeType == pipe.Type)) { var testResult = new PipeTestResult { Operation = item, Pipe = pipe, Status = PipeTestResultStatus.Scheduled }; results.Add(testResult); firstSetupRepo.PipeTestResultRepo.Save(testResult); } pipe.PipeTestResult = results; pipes.Add(pipe); if (pipes.Count % 2 == 0) { foreach (var item in pipe.PipeTestResult) { item.Status = PipeTestResultStatus.Accepted; if (item.Operation.Category.Type == FixedCategory.Length) { item.Value = PIPELENGHT.ToString(); } } pipe.Length = PIPELENGHT; pipe.Status = PipeMillStatus.Stocked; pipe.ConstructionStatus = PartConstructionStatus.Pending; pipe.IsAvailableToJoint = true; pipe.ToExport = true; pipe.WallThickness = 12; pipe.RecalculateWeight(); } firstSetupRepo.PipeRepo.Save(pipe); } ; #endregion firstSetupRepo.Commit(); firstSetupRepo.BeginTransaction(); #region Inspector List <Inspector> inspectors = new List <Inspector>(); for (int i = 0; i < INSPECTORCOUNT; i++) { var insp = new Inspector { Name = new PersonName { FirstName = RndName(fNames), LastName = RndName(lNames), MiddleName = RndName(mNames), }, IsActive = true }; insp.Certificates = CreateInspectorCertificates(insp, inspetorCertTypes); inspectors.Add(insp); firstSetupRepo.InspectorRepo.Save(insp); } #endregion firstSetupRepo.Commit(); firstSetupRepo.BeginTransaction(); #region Welder List <Welder> welders = new List <Welder>(); for (int i = 0; i < WELDERCOUNT; i++) { var welder = new Welder { Grade = rnd.Next(6), Name = new PersonName { FirstName = RndName(fNames), LastName = RndName(lNames), MiddleName = RndName(mNames), }, Stamp = RndString(12), Certificate = new Certificate { Number = RndString(14), ExpirationDate = DateTime.Now.AddDays(rnd.Next(60)), IsActive = true }, IsActive = true }; welders.Add(welder); firstSetupRepo.WelderRepo.Save(welder); } #endregion firstSetupRepo.Commit(); firstSetupRepo.BeginTransaction(); #region ComponentType ComponentType[] componentTypes = { new ComponentType { Name = "Заглушка", ConnectorsCount = 1, IsActive = true }, new ComponentType { Name = "Переходник", ConnectorsCount = 2, IsActive = true }, new ComponentType { Name = "Т - Соединение", ConnectorsCount = 3, IsActive = true }, new ComponentType { Name = "Тройник", ConnectorsCount = 3, IsActive = true } }; foreach (var item in componentTypes) { firstSetupRepo.ComponentTypeRepo.Save(item); } #endregion firstSetupRepo.Commit(); firstSetupRepo.BeginTransaction(); #region Component List <Domain.Entity.Construction.Component> components = new List <Domain.Entity.Construction.Component>(); foreach (var type in componentTypes) { for (int i = 0; i < COMPONENTCOUNT; i++) { var component = CreateComponent(type); firstSetupRepo.ComponentRepo.Save(component); components.Add(component); } } #endregion firstSetupRepo.Commit(); firstSetupRepo.BeginTransaction(); #region Release List <Prizm.Domain.Entity.Mill.ReleaseNote> releases = new List <Prizm.Domain.Entity.Mill.ReleaseNote>(); for (int i = 0; i < RELEASECOUNT; i++) { Prizm.Domain.Entity.Mill.ReleaseNote release = new Prizm.Domain.Entity.Mill.ReleaseNote { Number = RndString(10), Shipped = false, Date = DateTime.Now.AddDays(-rnd.Next(10)), IsActive = true }; release.Railcars = CreateRailcars(rnd.Next(2, 5)); firstSetupRepo.ReleaseRepo.Save(release); } #endregion firstSetupRepo.Commit(); return(false); }
private StandardProgressAction(StandardProgressActionConfig progressActionConfig, Action onCompletion, Welder welder = null) { this.progressActionConfig = progressActionConfig; this.onCompletion = onCompletion; this.welder = welder; }
public void TestSaveSettings() { var notify = new Mock <IUserNotify>(); var repoPipeSize = new Mock <IMillPipeSizeTypeRepository>(); var repoPipeTests = new Mock <IPipeTestRepository>(); var repoWelders = new Mock <IWelderRepository>(); var repoInspectors = new Mock <IInspectorRepository>(); var repoManufacturers = new Mock <IPlateManufacturerRepository>(); var repoProjectSetting = new Mock <IProjectRepository>(); var repoUsers = new Mock <IUserRepository>(); var repoRoles = new Mock <IRoleRepository>(); var repoPerms = new Mock <IPermissionRepository>(); var repoCategory = new Mock <ICategoryRepository>(); var repoJointOperation = new Mock <IJointOperationRepository>(); var repoCertificateType = new Mock <ICertificateTypeRepository>(); var repoComponentType = new Mock <IComponentTypeRepository>(); var repoSeamType = new Mock <ISeamTypeRepository>(); var testProjectSetting = new Project() { IsNative = true }; var testSizeType = new PipeMillSizeType(); var testWelder = new Welder(); var testManufacturer = new PlateManufacturer(); var testInspector = new Inspector(); var testUser = new User(); var testRole = new Role(); var testPerm = new Permission(); var modifiableView = new Mock <IModifiable>(); var jointOperations = new JointOperation(); var ctx = new Mock <ISecurityContext>(); repoPipeSize.Setup(_ => _.GetAll()).Returns(new List <PipeMillSizeType>() { testSizeType }); repoWelders.Setup(_ => _.GetAll()).Returns(new List <Welder>() { testWelder }); repoManufacturers.Setup(_ => _.GetAll()).Returns(new List <PlateManufacturer>() { testManufacturer }); repoProjectSetting.Setup(_ => _.GetSingle()).Returns(testProjectSetting); repoInspectors.Setup(_ => _.GetAll()).Returns(new List <Inspector>() { testInspector }); repoUsers.Setup(_ => _.GetAll()).Returns(new List <User>() { testUser }); repoRoles.Setup(_ => _.GetAll()).Returns(new List <Role>() { testRole }); repoPerms.Setup(_ => _.GetAll()).Returns(new List <Permission>() { testPerm }); repoJointOperation.Setup(_ => _.GetAll()).Returns(new List <JointOperation>() { jointOperations }); repoCategory.Setup(x => x.GetAll()).Returns(new List <Category>() { new Category() }); repoCertificateType.Setup(x => x.GetAll()).Returns(new List <InspectorCertificateType>() { new InspectorCertificateType() }); repoComponentType.Setup(x => x.GetAll()).Returns(new List <ComponentType>() { new ComponentType() }); Mock <ISettingsRepositories> settingsRepos = new Mock <ISettingsRepositories>(); settingsRepos.SetupGet(_ => _.PipeSizeTypeRepo).Returns(repoPipeSize.Object); settingsRepos.SetupGet(_ => _.PipeTestRepo).Returns(repoPipeTests.Object); settingsRepos.SetupGet(_ => _.WelderRepo).Returns(repoWelders.Object); settingsRepos.SetupGet(_ => _.PlateManufacturerRepo).Returns(repoManufacturers.Object); settingsRepos.SetupGet(_ => _.ProjectRepo).Returns(repoProjectSetting.Object); settingsRepos.SetupGet(_ => _.InspectorRepo).Returns(repoInspectors.Object); settingsRepos.SetupGet(_ => _.UserRepo).Returns(repoUsers.Object); settingsRepos.SetupGet(_ => _.RoleRepo).Returns(repoRoles.Object); settingsRepos.SetupGet(_ => _.PermissionRepo).Returns(repoPerms.Object); settingsRepos.SetupGet(_ => _.JointRepo).Returns(repoJointOperation.Object); settingsRepos.SetupGet(x => x.СategoryRepo).Returns(repoCategory.Object); settingsRepos.SetupGet(x => x.CertificateTypeRepo).Returns(repoCertificateType.Object); settingsRepos.SetupGet(x => x.ComponentTypeRepo).Returns(repoComponentType.Object); settingsRepos.SetupGet(x => x.SeamTypeRepo).Returns(repoSeamType.Object); var viewModel = new SettingsViewModel(settingsRepos.Object, notify.Object, ctx.Object); viewModel.ModifiableView = modifiableView.Object; viewModel.LoadData(); viewModel.ModifiableView = modifiableView.Object; var validatable = new Mock <IValidatable>(); validatable.Setup(x => x.Validate()).Returns(true); viewModel.validatableView = validatable.Object; var command = new SaveSettingsCommand(viewModel, settingsRepos.Object, notify.Object, ctx.Object); command.Execute(); settingsRepos.Verify(_ => _.BeginTransaction(), Times.Once()); repoPipeSize.Verify(_ => _.SaveOrUpdate(testSizeType), Times.Once()); settingsRepos.Verify(_ => _.Commit(), Times.Once()); repoPipeSize.Verify(_ => _.Evict(testSizeType), Times.Once()); repoWelders.Verify(_ => _.SaveOrUpdate(testWelder), Times.Once()); repoWelders.Verify(_ => _.Evict(testWelder), Times.Once()); repoManufacturers.Verify(_ => _.SaveOrUpdate(testManufacturer), Times.Once()); repoManufacturers.Verify(_ => _.Evict(testManufacturer), Times.Once()); repoProjectSetting.Verify(_ => _.SaveOrUpdate(testProjectSetting), Times.Once()); repoProjectSetting.Verify(_ => _.Evict(testProjectSetting), Times.Once()); repoInspectors.Verify(_ => _.SaveOrUpdate(testInspector), Times.Once()); repoInspectors.Verify(_ => _.Evict(testInspector), Times.Once()); repoUsers.Verify(_ => _.SaveOrUpdate(testUser), Times.Once()); repoUsers.Verify(_ => _.Evict(testUser), Times.Once()); repoRoles.Verify(_ => _.SaveOrUpdate(testRole), Times.Once()); repoRoles.Verify(_ => _.Evict(testRole), Times.Once()); }
} //private void OnDraw() private void weldPart(Part partToWeld) { //Lock editor EditorLockManager.lockEditor(Constants.settingWeldingLock); //process the welding #if (DEBUG) Debug.ClearDeveloperConsole(); Log.info("{0}", Constants.logVersion); Log.info("{0}", Constants.logStartWeld); #endif bool warning = false; _welder = new Welder(); _welder.init(); partToWeld.transform.eulerAngles = Vector3.zero; WeldingReturn ret = 0; if (!WeldingHelpers.DoesTextContainRegex(partToWeld.name, "strutConnector")) { ret = _welder.weldThisPart(partToWeld); } if (ret < 0) { Log.dbg("{0}", Constants.logEndWeld); this.state = DisplayState.weldError; return; } else { warning = warning || (0 < ret); } Part[] children = partToWeld.FindChildParts <Part>(true); if (children != null) { foreach (Part child in children) { if (!WeldingHelpers.DoesTextContainRegex(child.name, "strutConnector")) { ret = _welder.weldThisPart(child); } if (ret < 0) { Log.dbg("{0}", Constants.logEndWeld); this.state = DisplayState.weldError; return; } else { warning = warning || (0 < ret); } } } _welder.processNewCoM(); _welder.prepDecals(_welder.moduleList); if (_welder.isMeshSwitchRequired) { _welder.prepareWeldedMeshSwitchModule(_welder.moduleList); } _techDropdown = WeldingHelpers.initTechDropDown(_welder.techList, _guiStyle, _techDropdown); if (_welder.vesselTypeList.Count > 0) { _vesselTypeDropdown = WeldingHelpers.initVesselTypeDropDown(_welder.vesselTypeList, _guiStyle, _vesselTypeDropdown); } _scrollMod = Vector2.zero; _scrollRes = Vector2.zero; Log.dbg("| {0} Parts welded", _welder.NbParts); if (warning) { Log.dbg(Constants.logEndWeld); this.state = DisplayState.weldWarning; } else { Log.dbg("welder.Category: {0}", (int)_welder.Category); _catDropdown.SelectedItemIndex = (int)_welder.Category; this.state = DisplayState.infoWindow; } }
private void Start() { welder = GetComponent <Welder>(); }
private bool DetermineTileAction(GameObject originator, Vector3 position, string hand) { metaTileMap = originator.GetComponentInParent <MetaTileMap>(); objectLayer = originator.GetComponentInParent <ObjectLayer>(); PlayerNetworkActions pna = originator.GetComponent <PlayerNetworkActions>(); Vector3Int pos = objectLayer.transform.InverseTransformPoint(position).RoundToInt(); pos.z = 0; Vector3Int cellPos = baseTileMap.WorldToCell(position); LayerTile tile = metaTileMap.GetTile(pos); GameObject handObj; //if we are client, our pna.Inventory is always empty so we should get the hand item a different way if (!isServer) { if (originator != PlayerManager.LocalPlayer) { Logger.LogError("Client is attempting to determine the tile actions of a player other than" + " themselves. This should not happen and should be fixed. Client should only determine their own" + " actions."); return(false); } else { handObj = UIManager.InventorySlots[hand].Item; } } else { handObj = pna.Inventory[hand].Item; } // Nothing in hand, do nothing if (handObj == null) { return(false); } if (tile != null) { switch (tile.TileType) { case TileType.Table: { Vector3 targetPosition = position; targetPosition.z = -0.2f; pna.CmdPlaceItem(hand, targetPosition, originator, true); return(true); } case TileType.Floor: { //Crowbar if (handObj.GetComponent <CrowbarTrigger>()) { pna.CmdCrowBarRemoveFloorTile(originator, LayerType.Floors, new Vector2(cellPos.x, cellPos.y), position); return(true); } break; } case TileType.Base: { if (handObj.GetComponent <UniFloorTile>()) { pna.CmdPlaceFloorTile(originator, new Vector2(cellPos.x, cellPos.y), handObj); return(true); } break; } case TileType.Window: { //Check Melee: MeleeTrigger melee = windowTileMap.gameObject.GetComponent <MeleeTrigger>(); if (melee != null && melee.MeleeInteract(originator, hand)) { return(true); } break; } case TileType.Grill: { //Check Melee: MeleeTrigger melee = grillTileMap.gameObject.GetComponent <MeleeTrigger>(); if (melee != null && melee.MeleeInteract(originator, hand)) { return(true); } break; } case TileType.Wall: { Welder welder = handObj.GetComponent <Welder>(); if (welder) { if (welder.isOn) { //Request to deconstruct from the server: RequestTileDeconstructMessage.Send(originator, gameObject, TileType.Wall, cellPos, position); return(true); } } break; } } } return(false); }
public void TestJointNewEdit() { var modifiableView = new Mock <IModifiable>(); var notify = new Mock <IUserNotify>(); var repoJoint = new Mock <IJointRepository>(); var repoJointTestResult = new Mock <IJointTestResultRepository>(); var repoJointWeldResult = new Mock <IJointWeldResultRepository>(); var repoJointOperation = new Mock <IJointOperationRepository>(); var repoInspector = new Mock <IInspectorRepository>(); var repoWelder = new Mock <IWelderRepository>(); var repoAdo = new Mock <IMillReportsRepository>(); var securityCtx = new Mock <ISecurityContext>(); var repoSpool = new Mock <ISpoolRepository>(); var repoPipe = new Mock <IPipeRepository>(); var repoComponent = new Mock <IComponentRepository>(); var joint = new Prizm.Domain.Entity.Construction.Joint() { Status = Domain.Entity.Construction.JointStatus.Withdrawn }; BindingList <JointOperation> operations = new BindingList <JointOperation>(); Mock <IConstructionRepository> repoConstruction = new Mock <IConstructionRepository>(); repoConstruction.SetupGet(_ => _.RepoJoint).Returns(repoJoint.Object); repoConstruction.SetupGet(_ => _.RepoJointTestResult).Returns(repoJointTestResult.Object); repoConstruction.SetupGet(_ => _.RepoJointWeldResult).Returns(repoJointWeldResult.Object); repoConstruction.SetupGet(_ => _.RepoJointOperation).Returns(repoJointOperation.Object); repoConstruction.SetupGet(_ => _.RepoInspector).Returns(repoInspector.Object); repoConstruction.SetupGet(_ => _.RepoWelder).Returns(repoWelder.Object); repoConstruction.SetupGet(_ => _.RepoSpool).Returns(repoSpool.Object); repoConstruction.SetupGet(_ => _.RepoPipe).Returns(repoPipe.Object); repoConstruction.SetupGet(_ => _.RepoComponent).Returns(repoComponent.Object); repoJointOperation.Setup(_ => _.GetControlOperations()).Returns(operations); repoJointOperation.Setup(_ => _.GetRepairOperations()).Returns(operations); repoJoint.Setup(_ => _.GetActiveByNumber(joint)).Returns(new List <Prizm.Domain.Entity.Construction.Joint>()); repoSpool.Setup(_ => _.Get(It.IsAny <Guid>())).Returns(new Domain.Entity.Construction.Spool()); repoAdo.Setup(x => x.GetPipelineElements()).Returns(new System.Data.DataTable()); modifiableView.SetupGet(x => x.IsModified).Returns(false); var viewModel = new JointNewEditViewModel(repoConstruction.Object, notify.Object, Guid.Empty, repoAdo.Object, securityCtx.Object); viewModel.Joint = joint; viewModel.FirstElement = new PartData(); viewModel.SecondElement = new PartData(); viewModel.ModifiableView = modifiableView.Object; var validatable = new Mock <IValidatable>(); validatable.Setup(x => x.Validate()).Returns(true); viewModel.ValidatableView = validatable.Object; viewModel.Joint.LoweringDate = DateTime.Now; viewModel.Joint.Number = string.Empty; var welder = new Welder(); var weldResult = new JointWeldResult(); weldResult.Welders.Add(welder); weldResult.IsCompleted = true; viewModel.JointWeldResults.Add(weldResult); var command = new SaveJointCommand(repoConstruction.Object, viewModel, notify.Object, securityCtx.Object); command.Execute(); repoConstruction.Verify(_ => _.BeginTransaction(), Times.Once()); repoJoint.Verify(_ => _.SaveOrUpdate(It.IsAny <Prizm.Domain.Entity.Construction.Joint>()), Times.Once()); repoConstruction.Verify(_ => _.Commit(), Times.Once()); repoJoint.Verify(_ => _.Evict(It.IsAny <Prizm.Domain.Entity.Construction.Joint>()), Times.Once()); }