public static void Prefix(BreakDown __instance, GameObject go) { if (BetterPlacing.IsStackableGearItem(go)) { BetterPlacing.AddGearItemsToPhysicalCollisionMask(); } }
protected override bool Prepare(GameObject gameObject) { Renderer renderer = Utils.GetLargestBoundsRenderer(gameObject); if (renderer == null) { return(false); } gameObject.AddComponent <CorpseRemover>(); BreakDown breakDown = gameObject.AddComponent <BreakDown>(); breakDown.enabled = false; breakDown.m_YieldObject = new GameObject[0]; breakDown.m_YieldObjectUnits = new int[0]; breakDown.m_TimeCostHours = 3; breakDown.m_BreakDownAudio = "PLAY_REMOVECORPSE"; breakDown.m_LocalizedDisplayName = new LocalizedString() { m_LocalizationID = "GAMEPLAY_Corpse" }; breakDown.m_UsableTools = new GameObject[0]; return(true); }
private static void Postfix(Panel_BreakDown __instance, bool enable) { if (!enable) { return; } BreakDown breakDown = __instance.m_BreakDown; if (breakDown == null) { return; } string breakDownName = breakDown.m_LocalizedDisplayName.m_LocalizationID; if (rememberedToolIDs.ContainsKey(breakDownName)) { Use(__instance, rememberedToolIDs[breakDownName]); } else { Use(__instance, lastUsedID); } __instance.m_FramesInPanel = 0; __instance.Update(); }
private static bool Prefix(BreakDown __instance, string text) { if (text == null || !BetterPlacing.IsPlacableFurniture(__instance)) { return(true); } ModBreakDownSaveData saveData = Utils.DeserializeObject <ModBreakDownSaveData>(text); if (saveData.m_HasBeenBrokenDown) { return(true); } __instance.gameObject.SetActive(true); BetterPlacing.PreparePlacableFurniture(__instance.gameObject); GameObject root = BetterPlacing.getFurnitureRoot(__instance.gameObject); root.transform.position = saveData.m_Position; if (saveData.m_Rotation.x != 0 || saveData.m_Rotation.y != 0 || saveData.m_Rotation.z != 0) { root.transform.rotation = Quaternion.Euler(saveData.m_Rotation); } return(false); }
/// <summary> /// 根据任何筛选条件得到故障们的信息 /// </summary> /// <param name="pclsCache"></param> /// <param name="BreakId"></param> /// <param name="BreakTimeS"></param> /// <param name="BreakTimeE"></param> /// <param name="BreakEquip"></param> /// <param name="BreakPara"></param> /// <param name="BreakValue"></param> /// <param name="BreakReason"></param> /// <param name="ResponseTimeS"></param> /// <param name="ResponseTimeE"></param> /// <param name="GetBreakTime"></param> /// <param name="GetBreakEquip"></param> /// <param name="GetBreakPara"></param> /// <param name="GetBreakValue"></param> /// <param name="GetBreakReason"></param> /// <param name="GetResponseTime"></param> /// <returns></returns> public List <BreakDown> BreakDownGetBreakDownsByAnyProperty(DataConnection pclsCache, string BreakId, string BreakTimeS, string BreakTimeE, string BreakEquip, string BreakPara, string BreakValue, string BreakReason, string ResponseTimeS, string ResponseTimeE, int GetBreakTime, int GetBreakEquip, int GetBreakPara, int GetBreakValue, int GetBreakReason, int GetResponseTime) { List <BreakDown> list = new List <BreakDown>(); try { if (!pclsCache.Connect()) { return(list); } InterSystems.Data.CacheTypes.CacheSysList Result = Rs.BreakDown.GetBreakDownsByAnyProperty(pclsCache.CacheConnectionObject, BreakId, BreakTimeS, BreakTimeE, BreakEquip, BreakPara, BreakValue, BreakReason, ResponseTimeS, ResponseTimeE, GetBreakTime, GetBreakEquip, GetBreakPara, GetBreakValue, GetBreakReason, GetResponseTime); int count = Result.Count; int i = 1; while (i < count) { string[] ret = Result[i].Split('|'); BreakDown breakDown = new BreakDown(); if (ret[0] != "") { breakDown.BreakId = ret[0]; } if (ret[1] != "") { breakDown.BreakTime = Convert.ToDateTime(ret[1]); } if (ret[2] != "") { breakDown.BreakEquip = ret[2]; } if (ret[3] != "") { breakDown.BreakPara = ret[3]; } if (ret[4] != "") { breakDown.BreakValue = ret[4]; } if (ret[5] != "") { breakDown.BreakReason = ret[5]; } if (ret[6] != "") { breakDown.ResponseTime = Convert.ToDateTime(ret[6]); } list.Add(breakDown); i++; } return(list); } catch (Exception ex) { HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "ResultMethod.BreakDownGetBreakDownsByAnyProperty", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace); return(list); } finally { pclsCache.DisConnect(); } }
protected override bool Prepare(GameObject gameObject) { Renderer renderer = Utils.GetLargestBoundsRenderer(gameObject); if (renderer == null) { return(false); } if (gameObject.name.StartsWith("Decal-")) { gameObject.transform.localRotation = Quaternion.identity; } Collider collider = gameObject.GetComponentInChildren <Collider>(); if (collider != null) { gameObject = collider.gameObject; } GameObject collisionObject = new GameObject("PaperDecalRemover-" + gameObject.name); collisionObject.transform.parent = gameObject.transform.parent; collisionObject.transform.position = gameObject.transform.position; gameObject.transform.parent = collisionObject.transform; gameObject = collisionObject; if (collider == null) { Bounds bounds = renderer.bounds; BoxCollider boxCollider = gameObject.AddComponent <BoxCollider>(); boxCollider.size = bounds.size; boxCollider.center = bounds.center - gameObject.transform.position; } BreakDown breakDown = gameObject.AddComponent <BreakDown>(); breakDown.m_YieldObject = new GameObject[] { Resources.Load("GEAR_CrumpledPaper") as GameObject }; breakDown.m_YieldObjectUnits = new int[] { 1 }; breakDown.m_TimeCostHours = 1f / 60; breakDown.m_BreakDownAudio = "PLAY_HARVESTINGPAPER"; breakDown.m_LocalizedDisplayName = new LocalizedString() { m_LocalizationID = "GAMEPLAY_Paper" }; breakDown.m_UsableTools = new GameObject[0]; ChangeLayer changeLayer = gameObject.AddComponent <ChangeLayer>(); changeLayer.Layer = vp_Layer.InteractivePropNoCollideGear; changeLayer.Recursively = true; return(true); }
internal static bool IsCookware(BreakDown breakDown) { if (!breakDown) { return(false); } return(breakDown.m_LocalizedDisplayName.m_LocalizationID == "GAMEPLAY_MetalPot" || breakDown.m_LocalizedDisplayName.m_LocalizationID == "GAMEPLAY_MetalPan"); }
public static bool Prefix(BreakDown __instance, ref bool __result) { if (BetterPlacing.IsBlockedFromAbove(__instance.gameObject)) { BetterPlacing.SignalItemBlocked(); __result = false; return(false); } return(true); }
internal static void RestoreFurnitureLayers(GameObject furniture) { vp_Layer.Set(furniture, vp_Layer.Default, true); BreakDown breakDown = furniture.GetComponentInChildren <BreakDown>(); if (breakDown != null) { vp_Layer.Set(breakDown.gameObject, vp_Layer.InteractiveProp); } }
static void Postfix(BreakDown __instance) { // Branches take 5 mins instead of 10 if (__instance.m_DisplayName == "Branch") { __instance.m_TimeCostHours *= Settings.options.BreakBranchTimeMultiplier; } // Limbs take 30 mins base (15 mins with hatchet) instead of 90 mins base (45 mins with hatchet) if (__instance.m_DisplayName.EndsWith("Limb")) { __instance.m_TimeCostHours *= Settings.options.BreakLimbTimeMultiplier; } }
static void Postfix(BreakDown __instance) { // Branches take 5 mins instead of 10 if (__instance.m_DisplayName == "Branch") { __instance.m_TimeCostHours /= 2f; } // Limbs take 30 mins base (15 mins with hatchet) instead of 90 mins base (45 mins with hatchet) if (__instance.m_DisplayName.EndsWith("Limb")) { __instance.m_TimeCostHours /= 3f; } }
internal static void SetCurrentBreakDown(BreakDown breakDown) { CurrentBreakDown = breakDown; CurrentBreakDownReplacement = null; if (CurrentBreakDown != null) { GameObject prefab = Resources.Load(GetCurrentReplacementName()) as GameObject; if (prefab != null) { CurrentBreakDownReplacement = Object.Instantiate(prefab).GetComponent <GearItem>(); CurrentBreakDownReplacement.name = prefab.name; } } }
public static void Prefix(BreakDown __instance) { Il2CppSystem.Collections.Generic.List <BreakDown> okItems = new Il2CppSystem.Collections.Generic.List <BreakDown>(); for (int i = 0; i < BreakDown.m_BreakDownObjects.Count; i++) { BreakDown breakDown = BreakDown.m_BreakDownObjects[i]; if (breakDown != null) { okItems.Add(breakDown); } } BreakDown.m_BreakDownObjects = okItems; }
private static void Prefix(Panel_BreakDown __instance) { BreakDown breakDown = __instance.m_BreakDown; if (breakDown == null) { return; } string breakDownName = breakDown.m_LocalizedDisplayName.m_LocalizationID; GearItem selectedTool = __instance.GetSelectedTool(); int instanceId = (selectedTool == null) ? 0 : selectedTool.m_InstanceID; rememberedToolIDs[breakDownName] = instanceId; lastUsedID = instanceId; }
public object BreakDownSetData(BreakDown breakDown) { string token = Request.Headers.Authorization.ToString(); int valid = new ExceptionHandler().TokenCheck(token); if (valid == 0) { return("Token has expired"); } if (valid == -1) { return("Token has invalid signature"); } int ret = repository.BreakDownSetData(pclsCache, breakDown.BreakId, breakDown.BreakTime, breakDown.BreakEquip, breakDown.BreakPara, breakDown.BreakValue, breakDown.BreakReason, breakDown.ResponseTime); return(new ExceptionHandler().SetData(Request, ret)); }
static void Prefix(Panel_BreakDown __instance) { BreakDown breakDown = __instance.m_BreakDown; if (breakDown == null) { return; } string breakDownName = breakDown.m_LocalizedDisplayName.m_LocalizationID; GearItem selectedTool = (GearItem)AccessTools.Method(typeof(Panel_BreakDown), "GetSelectedTool").Invoke(__instance, new object[0]); int instanceId = (selectedTool == null) ? 0 : selectedTool.m_InstanceID; string toolName = (selectedTool == null) ? "<hands>" : selectedTool.m_DisplayName; rememberedToolIDs[breakDownName] = instanceId; lastUsedID = instanceId; }
public static bool Prefix(BreakDown __instance, ref string __result) { if (!BetterPlacing.IsPlacableFurniture(__instance)) { return(true); } ModBreakDownSaveData saveData = new ModBreakDownSaveData(); saveData.m_Position = __instance.transform.position; saveData.m_Rotation = __instance.transform.rotation.eulerAngles; saveData.m_HasBeenBrokenDown = !__instance.gameObject.activeSelf; saveData.m_Guid = Utils.GetGuidFromGameObject(__instance.gameObject); __result = Utils.SerializeObject(saveData); return(false); }
public static bool Prefix(BreakDown __instance, ref bool __result) { if (!__instance.gameObject.activeSelf) { return(true); } if (Cooking.IsCookware(__instance)) { GameAudioManager.PlayGUIMenuOpen(); InterfaceManager.m_Panel_BreakDown.m_BreakDown = __instance; InterfaceManager.m_Panel_BreakDown.Enable(true); return(false); } return(true); }
static void Postfix(Panel_BreakDown __instance) { BreakDown breakDown = __instance.m_BreakDown; if (breakDown == null) { return; } string breakDownName = breakDown.m_LocalizedDisplayName.m_LocalizationID; if (rememberedToolIDs.ContainsKey(breakDownName)) { Use(__instance, rememberedToolIDs[breakDownName]); } else { Use(__instance, lastUsedID); } }
public BreakDown Create(ref Car car, ref Project project) { Console.WriteLine("Введите описание поломки"); string description = Console.ReadLine(); Console.WriteLine("Введите рекомендации по починке"); string recommends = Console.ReadLine(); user: Console.WriteLine("Введите логин пользователя, который проводил осмотр "); string login = Console.ReadLine(); User user = new User(); if (project.Users != null) { bool isUser = false; foreach (User us in project.Users) { if (us.Login == login) { user = us; isUser = true; } } if (isUser == false) { Console.WriteLine("Такого пользователя не существует в этом проекте"); goto user; } } BreakDown breakDown = new BreakDown() { Car = car, DateOfIssue = DateTime.Now, DescriptionOfBreakDown = description, RecommendationsForRepeiring = recommends, User = user, Project = project }; return(breakDown); }
public BreakDown Create(ref Car car, ref Project project, ref User user) { Console.WriteLine("Введите описание поломки"); string description = Console.ReadLine(); Console.WriteLine("Введите рекомендации по починке"); string recommends = Console.ReadLine(); BreakDown breakDown = new BreakDown() { Car = car, DateOfIssue = DateTime.Now, DescriptionOfBreakDown = description, RecommendationsForRepeiring = recommends, User = user, Project = project }; return(breakDown); }
public static void Postfix(SaveGameSystem __instance, string name, string sceneSaveName) { if (InterfaceManager.IsMainMenuActive() || (GameManager.IsOutDoorsScene(GameManager.m_ActiveScene) && !RemoveClutter.notReallyOutdoors.Contains(GameManager.m_ActiveScene))) { Debug.Log("[remove-clutter] " + GameManager.m_ActiveScene + " is outdoor scene, mod disabled."); return; } string text = SaveGameSlots.LoadDataFromSlot(name, sceneSaveName); SceneSaveGameFormat saveGameFormat = Utils.DeserializeObject <SceneSaveGameFormat>(text); RemoveClutter.sceneBreakDownData = saveGameFormat.m_BreakDownObjectsSerialized; //Debug.Log(RemoveClutter.sceneBreakDownData); RemoveClutter.PatchSceneObjects(); RemoveClutter.PatchSceneDecals(); BreakDown.DeserializeAllAdditive(RemoveClutter.sceneBreakDownData); }
private BreakDownModel LocalizeBreakDownModel(BreakDownModel model, BreakDown breakDown, int languageId) { if (breakDown.Category == null || breakDown.Conference == null || breakDown.Team == null) { breakDown = _breakDownRepository .Set() .Include(bd => bd.Category).ThenInclude(c => c.CategoryLocalizations) .Include(bd => bd.Conference).ThenInclude(c => c.ConferenceLocalizations) .Include(bd => bd.Team).ThenInclude(t => t.TeamLocalizations) .FirstOrDefault(bd => bd.Id == breakDown.Id); } if (breakDown.Category != null) { model.CategoryId = breakDown.Category?.Id; model.CategoryName = breakDown.Category? .CategoryLocalizations.FirstOrDefault(cl => cl.LanguageId == languageId)?.Name ?? breakDown.Category.CategoryLocalizations.FirstOrDefault(cl => cl.LanguageId == 1 /*english*/)?.Name; } //TODO: English language default id in call if (breakDown.Conference != null) { //TODO: English language default id in call model.ConferenceId = breakDown.Conference?.Id; model.ConferenceName = breakDown.Conference? .ConferenceLocalizations.FirstOrDefault(cl => cl.LanguageId == languageId)?.Name ?? breakDown.Conference.ConferenceLocalizations.FirstOrDefault(cl => cl.LanguageId == 1 /*english*/)?.Name; } //TODO: English language default id in call if (breakDown.Team != null) { model.TeamId = breakDown.Team?.Id; model.TeamName = breakDown.Team? .TeamLocalizations.FirstOrDefault(cl => cl.LanguageId == languageId)?.Name ?? breakDown.Team.TeamLocalizations.FirstOrDefault(cl => cl.LanguageId == 1 /*english*/)?.Name; } return(model); }
public BreakDownModel GenerateBreakDownModel(BreakDown breakDown, int languageId) { if (breakDown == null) { throw new ArgumentNullException(nameof(breakDown)); } var language = _languageRepository.GetById(languageId); if (language == null) { throw new Exception($"language {languageId} not found"); } var model = new BreakDownModel { Id = breakDown.Id, Show = breakDown.Show, Languageid = languageId }; return(LocalizeBreakDownModel(model, breakDown, languageId)); }
void Start() { CreatePoints(); functionReader = gameObject.GetComponent <BreakDown>(); }
public void Start() { functionReader = gameObject.GetComponent<BreakDown>(); }
internal static bool IsPlacableFurniture(BreakDown breakDown) { return(IsPlaceableFurniture(breakDown == null ? null : breakDown.gameObject)); }
public static List <BreakdownByDepartmentModel> GetBreakdownByDepartment(out string error) { LUSSISEntities entities = new LUSSISEntities(); // Initializing the error variable to return only blank if there is no error error = ""; List <BreakdownByDepartmentModel> ois = new List <BreakdownByDepartmentModel>(); try { List <int> itemids = entities.disbursementdetails.Where(p => p.disbursement.requisition.status == ConRequisition.Status.REQUESTPENDING).Select(x => x.itemid).Distinct().ToList(); foreach (int itemid in itemids) { var data = entities.disbursementdetails.Where(p => p.itemid == itemid && p.disbursement.requisition.status == ConRequisition.Status.REQUESTPENDING) .GroupBy(x => x.disbursement.requisition.department) .Select(y => new { Department = y.Key, Quantity = y.Sum(x => x.qty) }); int totalqty = entities.disbursementdetails.Where(p => p.itemid == itemid && p.disbursement.requisition.status == ConRequisition.Status.REQUESTPENDING) .Sum(x => x.qty); List <BreakDown> bds = new List <BreakDown>(); foreach (var item in data) { BreakDown bd = new BreakDown(); bd.DeptID = item.Department.deptid; bd.DeptName = item.Department.deptname; bd.Qty = item.Quantity; bds.Add(bd); } BreakdownByDepartmentModel bddm = new BreakdownByDepartmentModel(); bddm.TotalQty = totalqty; bddm.ItemID = itemid; bddm.ItemDescription = ItemRepo.GetItemByItemid(itemid, out error).Description; bddm.BDList = bds; ois.Add(bddm); } } // if department not found, will throw NOTFOUND exception catch (NullReferenceException) { // if there is NULL Exception error, error will be 404 error = ConError.Status.NOTFOUND; } catch (Exception e) { // for other exceptions error = e.Message; } //returning the list return(ois); }
internal static void AddBreakDownComponent(GameObject gameObject, BreakDownDefinition objDef) { BreakDown breakDown = gameObject.AddComponent <BreakDown>(); BreakDown.m_BreakDownObjects.Add(breakDown); RCUtils.SetLayer(gameObject, vp_Layer.InteractiveProp); //Object yields if (objDef.yield != null && objDef.yield.Length > 0 && Settings.options.objectYields) { List <GameObject> itemYields = new List <GameObject>(); List <int> numYield = new List <int>(); foreach (BreakDownYield yield in objDef.yield) { if (yield.item.Trim() != "") { //GameObject yieldItem = Resources.Load("GEAR_" + yield.item).Cast<GameObject>(); GameObject yieldItem = null; UnityEngine.Object yieldItemObj = Resources.Load("GEAR_" + yield.item); if (yieldItemObj != null) { yieldItem = yieldItemObj.Cast <GameObject>(); itemYields.Add(yieldItem); numYield.Add(yield.num); } else { Debug.Log("[remove-clutter] Yield GEAR_" + yield.item + " couldn't be loaded."); } } } breakDown.m_YieldObject = itemYields.ToArray(); breakDown.m_YieldObjectUnits = numYield.ToArray(); } else { breakDown.m_YieldObject = new GameObject[0]; breakDown.m_YieldObjectUnits = new int[0]; } //Time to harvest if (objDef.minutesToHarvest > 0 && !Settings.options.fastBreakDown) { breakDown.m_TimeCostHours = objDef.minutesToHarvest / 60; } else { breakDown.m_TimeCostHours = 1f / 60; } //Harvest sound /*MetalSaw * WoodSaw * Outerwear * MeatlSmall * Generic * Metal * MeatlMed * Cardboard * WoodCedar * NylonCloth * Plants * Paper * Wood * Wool * Leather * WoodReclaimedNoAxe * WoodReclaimed * Cloth * MeatLarge * WoodSmall * WoodFir * WoodAxe */ if (objDef.sound.Trim() != "" && objDef.sound != null) { breakDown.m_BreakDownAudio = "Play_Harvesting" + objDef.sound; } else { breakDown.m_BreakDownAudio = "Play_HarvestingGeneric"; } //Display name if (Settings.options.showObjectNames) { String rawName = objDef.filter.Replace("_", string.Empty); String[] objWords = Regex.Split(rawName, @"(?<!^)(?=[A-Z])"); String objName = String.Join(" ", objWords); breakDown.m_LocalizedDisplayName = new LocalizedString() { m_LocalizationID = objName }; } else { breakDown.m_LocalizedDisplayName = new LocalizedString() { m_LocalizationID = "GAMEPLAY_BreakDown" }; } //Required Tools if (objDef.requireTool == true && Settings.options.toolsNeeded) { breakDown.m_RequiresTool = true; } if (objDef.tools != null && objDef.tools.Length > 0 && Settings.options.toolsNeeded) { Il2CppSystem.Collections.Generic.List <GameObject> itemTools = new Il2CppSystem.Collections.Generic.List <GameObject>(); foreach (String tool in objDef.tools) { GameObject selectedTool = null; if (tool.ToLower() == "knife") { selectedTool = Resources.Load("GEAR_Knife").Cast <GameObject>(); } else if (tool.ToLower() == "hacksaw") { selectedTool = Resources.Load("GEAR_Hacksaw").Cast <GameObject>(); } else if (tool.ToLower() == "hatchet") { selectedTool = Resources.Load("GEAR_Hatchet").Cast <GameObject>(); } else if (tool.ToLower() == "hammer") { selectedTool = Resources.Load("GEAR_Hammer").Cast <GameObject>(); } if (selectedTool != null) { itemTools.Add(selectedTool); } else { Debug.Log("[remove-clutter] Tool " + tool + " couldn't be loaded or doesn't exist."); } } UnhollowerBaseLib.Il2CppReferenceArray <GameObject> toolsArray = new UnhollowerBaseLib.Il2CppReferenceArray <GameObject>(itemTools.ToArray()); if (toolsArray.Length > 0) { breakDown.m_UsableTools = toolsArray; } else { Debug.Log("[remove-clutter] Tools array is empty."); breakDown.m_RequiresTool = false; breakDown.m_UsableTools = new GameObject[0]; } } else { breakDown.m_UsableTools = new GameObject[0]; } }
public void Start() { functionReader = gameObject.GetComponent <BreakDown>(); }
public override void Execute() { BreakDown breakDown = this.gameObject.GetComponent <BreakDown>(); breakDown.ProcessInteraction(); }
void Start() { CreatePoints(); functionReader = gameObject.GetComponent<BreakDown>(); }