private void InitializePrefab(BuildingInfo prefab, PrivateBuildingAI ai, String aiClass) { prefab.m_buildingAI = ai; ai.m_constructionTime = 0; prefab.m_buildingAI.m_info = prefab; prefab.InitializePrefab(); prefab.m_class = ItemClassCollection.FindClass(aiClass); }
private void Awake() { if (this.IsIgnored()) { Destroy(this); return; } ItemClassCollection.InitializeClasses(this.m_classes); }
public void Reload() { ItemClassCollection items = new ItemClassCollection(); items.LoadConfig(MotionConfiguration.Instance.ItemSettings); items.SetGroup(this); foreach (ItemClass i in items.Values) { this.Add(i); } }
/// <summary> /// Applies settings to a BuildingInfo prefab. /// </summary> /// <param name="prefab">The prefab to modify.</param> /// <param name="ai">The building AI to apply.</param> /// <param name="aiClass">The AI class string to apply.</param> /// <param name="growable">Whether the prefab should be growable.</param> private void InitializePrefab(BuildingInfo prefab, BuildingAI ai, String aiClass, bool growable) { // Non-zero construction time important for other mods (Real Time, Real Construction) - only for private building AIs. if (ai is PrivateBuildingAI) { ((PrivateBuildingAI)ai).m_constructionTime = 30; } prefab.m_buildingAI = ai; prefab.m_buildingAI.m_info = prefab; prefab.m_class = ItemClassCollection.FindClass(aiClass); prefab.m_placementStyle = growable ? ItemClass.Placement.Automatic : ItemClass.Placement.Manual; prefab.m_autoRemove = false; }
/// <summary> /// Applies settings to a BuildingInfo prefab. /// </summary> /// <param name="prefab">The prefab to modify.</param> /// <param name="ai">The building AI to apply.</param> /// <param name="aiClass">The AI class string to apply.</param> /// <param name="growable">Whether the prefab should be growable.</param> private void InitializePrefab(BuildingInfo prefab, BuildingAI ai, String aiClass, bool growable) { // Non-zero construction time important for other mods (Real Time, Real Construction) - only for private building AIs. if (ai is PrivateBuildingAI privateBuildingAI) { privateBuildingAI.m_constructionTime = 30; } // Assign required fields. prefab.m_buildingAI = ai; prefab.m_buildingAI.m_info = prefab; prefab.m_class = ItemClassCollection.FindClass(aiClass); prefab.m_placementStyle = growable ? ItemClass.Placement.Automatic : ItemClass.Placement.Manual; prefab.m_autoRemove = growable || !ModSettings.warnBulldoze; }
public static ItemClassCollection GetbyUser(string CreatedUser) { ItemClassCollection collection = new ItemClassCollection(); ItemClass obj; using (var reader = SqlHelper.ExecuteReader("tblItemClass_GetAll_byUser", new SqlParameter("@CreatedUser", CreatedUser))) { while (reader.Read()) { obj = GetItemFromReader(reader); collection.Add(obj); } } return(collection); }
public static ItemClassCollection GetAllItem() { ItemClassCollection collection = new ItemClassCollection(); using (var reader = SqlHelper.ExecuteReader("tblItemClass_GetAll", null)) { while (reader.Read()) { ItemClass obj = new ItemClass(); obj = GetItemFromReader(reader); collection.Add(obj); } } return(collection); }
public static void AssignServiceClass() { for (uint i = 0; i < PrefabCollection <BuildingInfo> .LoadedCount(); i++) { var prefab = PrefabCollection <BuildingInfo> .GetLoaded(i); if (prefab.m_buildingAI is PloppableRICO.PloppableExtractor || prefab.m_buildingAI is PloppableResidential || prefab.m_buildingAI is PloppableOffice || prefab.m_buildingAI is PloppableCommercial || prefab.m_buildingAI is PloppableIndustrial) { // Just assign any RICO prefab a ploppable ItemClass so it will reload. It gets set back once the mod loads. prefab.m_class = ItemClassCollection.FindClass("Beautification Item"); prefab.InitializePrefab(); } } }
void RefreshItemClasses() { if (itemClasses == null) { itemClasses = new List <string>(); } itemClasses.Clear(); ItemClassCollection classCollection = FindObjectOfType <ItemClassCollection>(); if (classCollection == null) { return; } foreach (var item in classCollection.m_classes) { itemClasses.Add(item.name); ModDebug.Log(item.name); } }
public static void InitializePrefab(BuildingInfo prefab, PrivateBuildingAI ai, String aiClass) { prefab.m_buildingAI = ai; ai.m_constructionTime = 30; prefab.m_buildingAI.m_info = prefab; try { prefab.InitializePrefab(); } catch { Debug.Log("InitPrefab Failed" + prefab.name); } prefab.m_class = ItemClassCollection.FindClass(aiClass); prefab.m_placementStyle = ItemClass.Placement.Manual; prefab.m_autoRemove = true; //prefab.m_dontSpawnNormally = false; }
private void FillGrid(ItemClassCollection its) { if (its == null) { return; } foreach (ItemClass i in its.Values) { CameraClass c = i as CameraClass; if (c != null) { this.FillGrid(c); } else { GroupClass g = i as GroupClass; if (g != null) { this.FillGrid(g.Children); } } } }
private void PopulateTreeView(ItemClassCollection items, TreeNode parentNode) { foreach (ItemClass item in items.Values) { if (this.AtTheEdge()) { break; } CameraTreeNode n = new CameraTreeNode(item); if (parentNode == null) { this.treeViewCamera.Nodes.Add(n); } else { parentNode.Nodes.Add(n); } GroupClass g = item as GroupClass; if (g != null) { PopulateTreeView(g.Children, n); } } }
public virtual void LoadConfig(IConfigSetting s) { this.ID = s["id"].Value; this.Name = s["name"].Value; this.mChildren = new ItemClassCollection(s, this); }