/* * Functions */ public Form Build(Vector2 rootPosition) { if (_sim == null) { _sim = new Simulator(); _sim.Init(); } else { _sim.Clear(); } if (_treeInfo == null) { _treeInfo = new TreeInfo(); } else { _treeInfo.Clear(); } var p = _sim.MakeParticle(rootPosition); MakeBranch(p, baseBranchLength + branchLength.random, 90f, maxDepth); return(_sim.ExportForm()); }
/// <summary> /// Replaces a map tree. /// </summary> /// <param name="target">Tree to replace</param> /// <param name="replacement">Replacement tree</param> private void ReplaceTrees(TreeInfo target, TreeInfo replacement) { // Check for valid parameters. if (target != null && replacement != null) { // Local references. TreeManager treeManager = Singleton <TreeManager> .instance; TreeInstance[] trees = treeManager.m_trees.m_buffer; Logging.Message("replacing tree ", target.name, " with ", replacement.name); // Iterate through each tree in map. for (uint treeIndex = 0; treeIndex < trees.Length; ++treeIndex) { // Local reference. TreeInstance tree = trees[treeIndex]; // Skip non-existent trees (those with no flags). if (tree.m_flags == (ushort)TreeInstance.Flags.None) { continue; } // If tree matches, replace! if (tree.Info == target) { trees[treeIndex].Info = replacement; // Refresh tree render (to update LOD). treeManager.UpdateTreeRenderer(treeIndex, true); } } } }
public static void LoadSites(TreeInfo oldTreeInfo, List <int> siteIdList, List <string> tableNameListForContent, List <string> tableNameListForGovPublic, List <string> tableNameListForGovInteract, List <string> tableNameListForJob) { foreach (string oldSiteTableName in TableSite.OldTableNames) { var siteMetadataFilePath = oldTreeInfo.GetTableMetadataFilePath(oldSiteTableName); if (FileUtils.IsFileExists(siteMetadataFilePath)) { var siteTableInfo = TranslateUtils.JsonDeserialize <TableInfo>(FileUtils.ReadText(siteMetadataFilePath, Encoding.UTF8)); foreach (var fileName in siteTableInfo.RowFiles) { var filePath = oldTreeInfo.GetTableContentFilePath(oldSiteTableName, fileName); var rows = TranslateUtils.JsonDeserialize <List <JObject> >(FileUtils.ReadText(filePath, Encoding.UTF8)); foreach (var row in rows) { var dict = TranslateUtils.ToDictionaryIgnoreCase(row); if (dict.ContainsKey(nameof(TableSite.PublishmentSystemId))) { var value = Convert.ToInt32(dict[nameof(TableSite.PublishmentSystemId)]); if (value > 0 && !siteIdList.Contains(value)) { siteIdList.Add(value); } } if (dict.ContainsKey(nameof(TableSite.AuxiliaryTableForContent))) { var value = Convert.ToString(dict[nameof(TableSite.AuxiliaryTableForContent)]); if (!string.IsNullOrEmpty(value) && !tableNameListForContent.Contains(value)) { tableNameListForContent.Add(value); } } if (dict.ContainsKey(nameof(TableSite.AuxiliaryTableForGovInteract))) { var value = Convert.ToString(dict[nameof(TableSite.AuxiliaryTableForGovInteract)]); if (!string.IsNullOrEmpty(value) && !tableNameListForGovInteract.Contains(value)) { tableNameListForGovInteract.Add(value); } } if (dict.ContainsKey(nameof(TableSite.AuxiliaryTableForGovPublic))) { var value = Convert.ToString(dict[nameof(TableSite.AuxiliaryTableForGovPublic)]); if (!string.IsNullOrEmpty(value) && !tableNameListForGovPublic.Contains(value)) { tableNameListForGovPublic.Add(value); } } if (dict.ContainsKey(nameof(TableSite.AuxiliaryTableForJob))) { var value = Convert.ToString(dict[nameof(TableSite.AuxiliaryTableForJob)]); if (!string.IsNullOrEmpty(value) && !tableNameListForJob.Contains(value)) { tableNameListForJob.Add(value); } } } } } } }
/// <summary> /// Deserializes the list of random trees from XML. /// </summary> internal static void DeserializeRandomTrees(List <BOBRandomPrefab> randomPrefabList) { // Iterate through random prefab list. foreach (BOBRandomPrefab randomPrefab in randomPrefabList) { // Create new prop. TreeInfo randomTree = NewRandomTree(randomPrefab.name); // Don't do anything more with this one if we had a creation error. if (randomTree == null) { continue; } // Deserialize variations. randomTree.m_variations = new TreeInfo.Variation[randomPrefab.variations.Count]; for (int i = 0; i < randomPrefab.variations.Count; ++i) { randomTree.m_variations[i] = new TreeInfo.Variation { m_finalTree = PrefabCollection <TreeInfo> .FindLoaded(randomPrefab.variations[i].name), m_probability = randomPrefab.variations[i].probability }; } } }
/// <summary> /// Replaces a map tree. /// </summary> /// <param name="target">Tree to replace</param> /// <param name="replacement">Replacement tree</param> private void ReplaceTrees(TreeInfo target, TreeInfo replacement) { // Check for valid parameters. if (target != null && replacement != null) { // Local references. TreeManager treeManager = Singleton <TreeManager> .instance; TreeInstance[] trees = treeManager.m_trees.m_buffer; // Iterate through each tree in map. for (uint treeIndex = 0; treeIndex < trees.Length; ++treeIndex) { // Local reference. TreeInstance tree = trees[treeIndex]; // Skip non-existent trees (those with no flags). if (tree.m_flags == (ushort)TreeInstance.Flags.None) { continue; } // If tree matches, replace! if (tree.Info == target) { trees[treeIndex].Info = replacement; // Update tree render (to update LOD) via simulation thread, creating local treeID reference to avoid race condition. uint treeID = treeIndex; Singleton <SimulationManager> .instance.AddAction(delegate { Singleton <TreeManager> .instance.UpdateTreeRenderer(treeID, true); }); } } } }
private string CopyTypeTree() { TreeInfo info = (TreeInfo)DumpListView.Items[DumpListView.SelectedIndex]; TreeDump typeTree = Dump.TypeTrees.FirstOrDefault(t => t.ClassID == info.ID); if (typeTree == null) { return(string.Empty); } // header StringBuilder sb = new StringBuilder(); sb.Append("// classID{").Append(typeTree.ClassID).Append("}: ").Append(typeTree.ClassName); for (int i = 0; i < typeTree.Inheritance.Count; i++) { sb.Append(" <- "); sb.Append(typeTree.Inheritance[i]); } sb.AppendLine(); // nodes CopyTypeTreeNode(typeTree, 0, sb); sb.Length -= Environment.NewLine.Length; return(sb.ToString()); }
protected override void OnButtonClicked(UIComponent comp) { object objectUserData = comp.objectUserData; BuildingInfo buildingInfo = objectUserData as BuildingInfo; NetInfo netInfo = objectUserData as NetInfo; TreeInfo treeInfo = objectUserData as TreeInfo; PropInfo propInfo = objectUserData as PropInfo; if (buildingInfo != null) { BuildingTool buildingTool = ToolsModifierControl.SetTool <BuildingTool>(); if (buildingTool != null) { if (base.pathsOptionPanel != null) { base.pathsOptionPanel.Hide(); } buildingTool.m_prefab = buildingInfo; buildingTool.m_relocate = 0; } } if (netInfo != null) { NetToolFine netTool = ToolsModifierControl.SetTool <NetToolFine>(); if (netTool != null) { if (base.pathsOptionPanel != null) { base.pathsOptionPanel.Show(); } netTool.m_prefab = netInfo; } } if (treeInfo != null) { TreeTool treeTool = ToolsModifierControl.SetTool <TreeTool>(); if (treeTool != null) { if (base.pathsOptionPanel != null) { base.pathsOptionPanel.Hide(); } treeTool.m_prefab = treeInfo; treeTool.m_mode = TreeTool.Mode.Single; } } if (propInfo != null) { PropTool propTool = ToolsModifierControl.SetTool <PropTool>(); if (propTool != null) { if (base.pathsOptionPanel != null) { base.pathsOptionPanel.Hide(); } propTool.m_prefab = propInfo; propTool.m_mode = PropTool.Mode.Single; } } }
/// <summary> /// Creates a new random tree prefab. /// </summary> /// <param name="propName">Name of prefab</param> /// <returns>New tree prefab</returns> internal static TreeInfo NewRandomTree(string treeName) { // Need valid name. if (treeName == null) { Logging.Error("null tree name for random tree"); return(null); } // Need unique name. if (DuplicateTreeName(treeName)) { Logging.Error("duplicate tree name for random tree"); return(null); } // Instantiate existing tree and use as base for new tree. GameObject treeInstance = Object.Instantiate(PrefabCollection <TreeInfo> .FindLoaded("Tree2variant").gameObject); treeInstance.name = treeName; TreeInfo randomTree = treeInstance.GetComponent <TreeInfo>(); treeInstance.SetActive(false); randomTree.m_prefabInitialized = false; randomTree.InitializePrefab(); // Add new tree to list and return direct reference. randomTrees.Add(randomTree); return(randomTree); }
public override void RenderCloneOverlay(InstanceState instanceState, ref Matrix4x4 matrix4x, Vector3 deltaPosition, float deltaAngle, Vector3 center, bool followTerrain, RenderManager.CameraInfo cameraInfo, Color toolColor) { if (MoveItTool.m_isLowSensitivity) { return; } TreeState state = instanceState as TreeState; TreeInfo info = state.Info.Prefab as TreeInfo; Randomizer randomizer = new Randomizer(state.instance.id.Tree); float scale = info.m_minScale + (float)randomizer.Int32(10000u) * (info.m_maxScale - info.m_minScale) * 0.0001f; //float brightness = info.m_minBrightness + (float)randomizer.Int32(10000u) * (info.m_maxBrightness - info.m_minBrightness) * 0.0001f; Vector3 newPosition = matrix4x.MultiplyPoint(state.position - center); newPosition.y = state.position.y + deltaPosition.y; if (followTerrain) { newPosition.y = newPosition.y - state.terrainHeight + TerrainManager.instance.SampleOriginalRawHeightSmooth(newPosition); } TreeTool.RenderOverlay(cameraInfo, info, newPosition, scale, toolColor); }
public RestTemplate GetTreeInfo([FromBody] NodeDto root) { BSTree tree = new BSTree(toEntity(root, NodeFactoryImpl.getInstance())); TreeInfo treeInfo = new TreeInfo(); treeInfo.NumberOfLeaves = tree.numberOfLeaves(); NumberOfNodesWrapper wrapper = new NumberOfNodesWrapper(); wrapper.All = tree.numberOfNodes(NodeState.ALL); wrapper.HavingOneChild = tree.numberOfNodes(NodeState.HAVING_ONLY_ONE_CHILD); wrapper.HavingOnlyOneLeftChild = tree.numberOfNodes(NodeState.HAVING_ONLY_LEFT_CHILD); wrapper.HavingOnlyOneRightChild = tree.numberOfNodes(NodeState.HAVING_ONLY_RIGHT_CHILD); wrapper.HavingBothChildren = tree.numberOfNodes(NodeState.HAVING_BOTH_CHILDREN); treeInfo.NumberOfNodes = wrapper; int[] LevelAndNodeCount = new int[tree.findHeight()]; for (int i = 0; i < tree.findHeight(); i++) { LevelAndNodeCount[i] = tree.numberOfNodesAtLevel(i); } treeInfo.AtLevel = LevelAndNodeCount; treeInfo.Height = tree.findHeight(); treeInfo.Min = tree.minimum(); treeInfo.Max = tree.maximum(); treeInfo.MinOfRightChild = tree.minimumOfRightChild(); treeInfo.MaxOfLeftChild = tree.maximumOfLeftChild(); return(new RestTemplate((int)HttpStatusCode.OK, treeInfo, "")); }
public void SetPage(FolderTree tree, bool setHeader = true) { if (History.Count > 0 && History.Peek() == tree) { return; } History.Push(tree); SetBackButtonVisibility(); TreeInfo info = tree.Info; SetText(info, setHeader); if (IsBackToMusicPage(info)) { LocalNavigationView.SelectedItem = LocalSongsItem; LocalFrame.Navigate(typeof(LocalMusicPage), tree); SetLocalGridView(Settings.settings.LocalMusicGridView); } else if (info.Folders > 0) { LocalNavigationView.SelectedItem = LocalFoldersItem; LocalFrame.Navigate(typeof(LocalFoldersPage), tree); SetLocalGridView(Settings.settings.LocalFolderGridView); } else { LocalNavigationView.SelectedItem = null; } }
public void SetSliderValue(TreeInfo treeInfo, float sValue) { if (treeInfo == mOpTree) { mProgressBar.sliderValue = sValue; } }
/// <summary> /// Deserialise tree scaling. /// </summary> /// <param name="elements">List of tree scaling elements to deserialise.</param> internal void DeserializeTrees(List <BOBScalingElement> elements) { foreach (BOBScalingElement element in elements) { try { // Add record to dictionary (to retain records of any prefabs not found). treeScales.Add(element.prefabName, element); // Try to find prefab in loaded collection, and if so, apply the recorded scaling. TreeInfo thisTree = PrefabCollection <TreeInfo> .FindLoaded(element.prefabName); if (thisTree != null) { // Found it - record original values. element.prefab = thisTree; element.originalMin = thisTree.m_minScale; element.originalMax = thisTree.m_maxScale; // Apply new values. thisTree.m_minScale = element.minScale; thisTree.m_maxScale = element.maxScale; } } catch (Exception e) { // Don't let a single failure stop us. Logging.LogException(e, "exception deserializing tree scaling element"); } } }
public void SetNavText(TreeInfo info) { LocalFoldersItem.Content = Helper.LocalizeMessage("Folders", info.Folders); LocalFoldersItem.IsEnabled = info.Folders != 0; LocalSongsItem.Content = Helper.LocalizeMessage("Songs", info.Songs); LocalSongsItem.IsEnabled = info.Songs != 0; }
private void Callback(object obj) { TreeInfo info = obj as TreeInfo; try { // TODO: //Debugger.Log(info.XmlLocalPath); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(info.XmlLocalPath); DecisionTreeNode tree = CreateNode(xmlDoc.FirstChild, info.MethodContainer); // TODO: //Debugger.Log("first node: " + xmlDoc.FirstChild.LocalName); //Debugger.Log("Loaded bh tree: " + tree + " - doc: " + xmlDoc); info.ResultHanlder.Invoke(tree); } catch (Exception e) { Debugger.Log(e); } }
public void UpdateTool(string brushName) { UserMod.Settings.SelectBrush(brushName); TreeInfos = new List <TreeInfo>(); foreach (var tree in Brush.Trees) { if (!ForestBrush.Instance.Trees.TryGetValue(tree.Name, out TreeInfo treeInfo)) { continue; } if (treeInfo == null) { continue; } TreeInfos.Add(treeInfo); } Container = CreateBrushPrefab(Brush.Trees); ForestBrush.Instance.ForestBrushPanel.LoadBrush(Brush); UserMod.SaveSettings(); }
private static void UpdateData(TreeManager tm, SimulationManager.UpdateMode mode) { Singleton<LoadingManager>.instance.m_loadingProfilerSimulation.BeginLoading("TreeManager.UpdateData"); if (TreeUnlimiter.Mod.DEBUG_LOG_ON == true) { Debug.Log("[TreeUnlimiter::LimitTreeManager::UpdateData()] calling Ensure Init"); } LimitTreeManager.Helper.EnsureInit(3); for (int i = 1; i < LimitTreeManager.Helper.TreeLimit; i++) { if (tm.m_trees.m_buffer[i].m_flags != 0 && tm.m_trees.m_buffer[i].Info == null) { tm.ReleaseTree((uint)i); } } int num = PrefabCollection<TreeInfo>.PrefabCount(); int num1 = 1; while (num1 * num1 < num) { num1++; } for (int j = 0; j < num; j++) { TreeInfo prefab = PrefabCollection<TreeInfo>.GetPrefab((uint)j); if (prefab != null) { prefab.SetRenderParameters(j, num1); } } ColossalFramework.Threading.ThreadHelper.dispatcher.Dispatch(() => { tm.GetType().GetField("m_lastShadowRotation", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(tm, new Quaternion()); tm.GetType().GetField("m_lastCameraRotation", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(tm, new Quaternion()); }); tm.m_infoCount = num; Singleton<LoadingManager>.instance.m_loadingProfilerSimulation.EndLoading(); }
/// <summary> /// Add building tree to the list to be highlighted. /// </summary> /// <param name="index">Tree index</param> /// <param name="tree">Tree info</param> /// <param name="building">Building data</param> /// <param name="position">Tree position</param> public static void HighlightBuildingTree(int index, TreeInfo tree, ref Building building, Vector3 position) { if (CurrentIndex < 0 || (CurrentIndex == index) && (CurrentBuilding == null || CurrentBuilding == building.Info)) { HighlightTree(tree, position); } }
public UniqueTree(TreeInfo newInfo, string oldName, string newName, string newDescription) { UniqueName = newName; UniqueDescription = newDescription; OriginalName = oldName; UniqueInfo = new UniqueTreeInfo(newInfo); }
private static void CalculateAreaHeight(TreeManager tm, float minX, float minZ, float maxX, float maxZ, out int num, out float min, out float avg, out float max) { unsafe { int num1 = Mathf.Max((int)(((double)minX - 8) / 32 + 270), 0); int num2 = Mathf.Max((int)(((double)minZ - 8) / 32 + 270), 0); int num3 = Mathf.Min((int)(((double)maxX + 8) / 32 + 270), 539); int num4 = Mathf.Min((int)(((double)maxZ + 8) / 32 + 270), 539); num = 0; min = 1024f; avg = 0f; max = 0f; for (int i = num2; i <= num4; i++) { for (int j = num1; j <= num3; j++) { uint mTreeGrid = tm.m_treeGrid[i * 540 + j]; int num5 = 0; while (mTreeGrid != 0) { Vector3 position = tm.m_trees.m_buffer[mTreeGrid].Position; if ((double)Mathf.Max(Mathf.Max(minX - 8f - position.x, minZ - 8f - position.z), Mathf.Max((float)((double)position.x - (double)maxX - 8), (float)((double)position.z - (double)maxZ - 8))) < 0) { TreeInfo info = tm.m_trees.m_buffer[mTreeGrid].Info; if (info != null) { Randomizer randomizer = new Randomizer(mTreeGrid); float mMinScale = info.m_minScale + (float)((double)randomizer.Int32(10000) * ((double)info.m_maxScale - (double)info.m_minScale) * 9.99999974737875E-05); float mSize = position.y + (float)((double)info.m_generatedInfo.m_size.y * (double)mMinScale * 2); if ((double)mSize < (double)min) { min = mSize; } avg = avg + mSize; if ((double)mSize > (double)max) { max = mSize; } num = num + 1; } } mTreeGrid = tm.m_trees.m_buffer[mTreeGrid].m_nextGridTree; int num6 = num5 + 1; num5 = num6; if (num6 < LimitTreeManager.Helper.TreeLimit) { continue; } CODebugBase<LogChannel>.Error(LogChannel.Core, string.Concat("Invalid list detected!\n", Environment.StackTrace)); break; } } } if ((double)avg == 0) { return; } avg = avg / (float)num; } }
/// <summary> /// Applies scaling to trees and updates the dictionary records. /// </summary> /// <param name="prop">Tree prefab</param> /// <param name="minScale">Minimum scale</param> /// <param name="maxScale">Maximum scale</param> private void TreeScale(TreeInfo tree, float minScale, float maxScale) { // If we don't have an existing record, create one. if (!treeScales.ContainsKey(tree.name)) { // Record original values. treeScales.Add(tree.name, new BOBScalingElement { prefabName = tree.name, prefab = tree, originalMin = tree.m_minScale, originalMax = tree.m_maxScale }); } // Local reference. BOBScalingElement element = treeScales[tree.name]; // Update record with new scale values. element.minScale = minScale; element.maxScale = maxScale; // Remove record if minimum and maximum scales both match the default. if (element.minScale == element.originalMin && element.maxScale == element.originalMax) { propScales.Remove(tree.name); } // Apply new scales and save updated configuration. tree.m_minScale = minScale; tree.m_maxScale = maxScale; ConfigurationUtils.SaveConfig(); }
/// <summary> /// Creates a new random tree prefab. /// </summary> /// <param name="propName">Name of prefab</param> /// <returns>New random tree prefab, or null if creation failed</returns> internal static BOBRandomPrefab NewRandomTree(string treeName) { // Need unique name. if (DuplicateTreeName(treeName)) { Logging.Error("duplicate tree name for random tree"); return(null); } TreeInfo newTree = InstantiateTree(treeName); if (newTree != null) { BOBRandomPrefab newPrefab = new BOBRandomPrefab { name = treeName, tree = newTree }; // Add new tree to list and return direct reference. RandomTrees.Add(newPrefab); return(newPrefab); } // If we got here, something went wrong; return null. return(null); }
/// <summary> /// The original C/O code to loop though the tree array and update m_infoIndex /// on all treeinstances with non-null .Info's with updated m_prefabDataIndex values. /// </summary> public static void DoOriginal() { TreeManager instance = Singleton <TreeManager> .instance; TreeInstance[] buffer = instance.m_trees.m_buffer; int num = buffer.Length; for (int i = 1; i < num; i++) { if (buffer[i].m_flags != 0) { TreeInfo info = buffer[i].Info; if (info != null) { buffer[i].m_infoIndex = (ushort)info.m_prefabDataIndex; } if (buffer[i].GrowState != 0) { DistrictManager instance2 = Singleton <DistrictManager> .instance; byte park = instance2.GetPark(buffer[i].Position); ++instance2.m_parks.m_buffer[(int)park].m_treeCount; } } } }
public static List <GlobalTreeInfo> Picking(IntVector3 position, bool includeTrees) { if (s_Instance == null) { return(picklist); } ClearTreeinfo(); ipos.x = position.x; ipos.y = position.y; ipos.z = position.z; List <TreeInfo> list_currcell = s_Instance.TreesAtPos(ipos); for (int i = 0; i < list_currcell.Count; ++i) { TreeInfo _ti = list_currcell[i]; if (HasCollider(_ti.m_protoTypeIdx) && !includeTrees) { continue; } GlobalTreeInfo gti = GetGlobalTreeInfo(); gti._terrainIndex = -1; gti._treeInfo = _ti; picklist.Add(gti); } return(picklist); }
/// <summary> /// Instantiates a new TreeInfo prefab. /// </summary> /// <param name="treeName">Name to instantiate</param> /// <returns>New tree prefab, or null if instantiation fialed</returns> private static TreeInfo InstantiateTree(string treeName) { // Need valid name. if (treeName == null) { Logging.Error("null tree name for random tree"); return(null); } // Instantiate tree template and use as base for new tree. if (PrefabLists.RandomTreeTemplate != null) { GameObject treeInstance = UnityEngine.Object.Instantiate(PrefabLists.RandomTreeTemplate.gameObject); treeInstance.name = treeName; TreeInfo randomTree = treeInstance.GetComponent <TreeInfo>(); treeInstance.SetActive(false); randomTree.m_isCustomContent = true; randomTree.m_prefabInitialized = false; randomTree.InitializePrefab(); randomTree.m_prefabInitialized = true; return(randomTree); } // If we got here, then we weren't able to find the random tree template. Logging.Error("random tree template not found"); return(null); }
public void Dispose() { _sortInfo = null; _treeInfo1 = null; _treeInfo2 = null; _treeInfo3 = null; }
internal void PropTreeTrailerImpl(string packageName, Package.Asset data) { try { string name = AssetName(data.name); LoadingManager.instance.m_loadingProfilerCustomAsset.BeginLoading(name); // CODebugBase<LogChannel>.Log(LogChannel.Modding, string.Concat("Loading custom asset ", assetMetaData.name, " from ", asset)); GameObject go = data.Instantiate <GameObject>(); go.name = packageName + "." + go.name; go.SetActive(false); PrefabInfo info = go.GetComponent <PrefabInfo>(); info.m_isCustomContent = true; if (info.m_Atlas != null && info.m_InfoTooltipThumbnail != null && info.m_InfoTooltipThumbnail != string.Empty && info.m_Atlas[info.m_InfoTooltipThumbnail] != null) { info.m_InfoTooltipAtlas = info.m_Atlas; } PropInfo pi = go.GetComponent <PropInfo>(); if (pi != null) { if (pi.m_lodObject != null) { pi.m_lodObject.SetActive(false); } PrefabCollection <PropInfo> .InitializePrefabs("Custom Assets", pi, null); propsCount++; } TreeInfo ti = go.GetComponent <TreeInfo>(); if (ti != null) { PrefabCollection <TreeInfo> .InitializePrefabs("Custom Assets", ti, null); treeCount++; } // Trailers, this way. VehicleInfo vi = go.GetComponent <VehicleInfo>(); if (vi != null) { PrefabCollection <VehicleInfo> .InitializePrefabs("Custom Assets", vi, null); if (vi.m_lodObject != null) { vi.m_lodObject.SetActive(false); } } } finally { LoadingManager.instance.m_loadingProfilerCustomAsset.EndLoading(); } }
public void Release() { _dataLen = 0; if (m_mapTrees != null) { m_mapTrees.Clear(); } if (m_listTrees != null) { TreeInfo.FreeTIs(m_listTrees); m_listTrees.Clear(); } if (LSubTerrainMgr.Instance != null) { for (int i = 0; i < LSubTerrainMgr.Instance.Layers.Count; ++i) { LSubTerrainMgr.Instance.LayerCreators[i].DelTreeBatch(Index); } for (int i = X * 8; i < X * 8 + 8; i++) { for (int j = Z * 8; j < Z * 8 + 8; j++) { int tmpKey = LSubTerrUtils.Tree32PosTo32Key(i, j); LSubTerrainMgr.Instance.m_map32Trees.Remove(tmpKey); } } } }
protected override object GetProvidedValue() { if (Mode == BindingMode.Default && TreeInfo.IsEmptyBackExpr() && Calculator.Operands.Count() == 0) { ActualMode = BindingMode.OneWay; } if ((ActualMode == BindingMode.TwoWay || ActualMode == BindingMode.OneWayToSource) && TreeInfo.IsEmptyBackExpr()) { if (TreeInfo.IsSimpleExpr()) { Calculator.Operands.FirstOrDefault().Do(x => x.SetMode(true)); } else { ErrorHandler.Throw(ErrorHelper.Err101_TwoWay(), null); } } if (IsInSetter(TargetProvider) || TargetPropertyType == typeof(BindingBase)) { return(CreateBinding()); } return(CreateBinding().ProvideValue(ServiceProvider)); }
public void Remove(TreeInfo treeInfo) { var name = treeInfo.name; Tree tree = Trees.Find(t => t.Name == name); Trees.Remove(tree); }
internal override boolean study(TreeInfo info) { info.minLength += buffer.Length; info.maxValid = false; return next.study(info); }
internal override boolean study(TreeInfo info) { atom.study(info); info.maxValid = false; info.deterministic = false; return next.study(info); }
internal override boolean study(TreeInfo info) { info.maxValid = false; info.deterministic = false; return false; }
internal override boolean study(TreeInfo info) { info.maxValid = false; return next.study(info); }
internal override boolean study(TreeInfo info) { int minL = info.minLength; int maxL = info.maxLength; boolean maxV = info.maxValid; info.reset(); yes.study(info); int minL2 = info.minLength; int maxL2 = info.maxLength; boolean maxV2 = info.maxValid; info.reset(); not.study(info); info.minLength = minL + Math.min(minL2, info.minLength); info.maxLength = maxL + Math.max(maxL2, info.maxLength); info.maxValid = (maxV & maxV2 & info.maxValid); info.deterministic = false; return next.study(info); }
public long CalculateMainLeafId(TreeInfo current, TreeInfo root, Trees trees) { if (current.LastProgenitorId == current.Id) current.MainLeafId = current.Id; else { TreeInfo next = trees.get(current.Id - root.Id + 1); current.MainLeafId = CalculateMainLeafId(next, root, trees); while(next.LastProgenitorId < current.LastProgenitorId) { next = trees.get(next.LastProgenitorId-root.Id+1); CalculateMainLeafId(next, root, trees); } } return current.MainLeafId; }
internal override boolean study(TreeInfo info) { int minL = info.minLength; int maxL = info.maxLength; boolean maxV = info.maxValid; int minL2 = Integer.MAX_VALUE; //arbitrary large enough num int maxL2 = -1; for (int n = 0; n < size; n++) { info.reset(); if (atoms[n] != null) atoms[n].study(info); minL2 = Math.min(minL2, info.minLength); maxL2 = Math.max(maxL2, info.maxLength); maxV = (maxV & info.maxValid); } minL += minL2; maxL += maxL2; info.reset(); conn.next.study(info); info.minLength += minL; info.maxLength += maxL; info.maxValid &= maxV; info.deterministic = false; return false; }
internal override boolean study(TreeInfo info) { // Save original info int minL = info.minLength; int maxL = info.maxLength; boolean maxV = info.maxValid; boolean detm = info.deterministic; info.reset(); atom.study(info); int temp = info.minLength * cmin + minL; if (temp < minL) { temp = 0xFFFFFFF; // Arbitrary large number } info.minLength = temp; if (maxV & info.maxValid) { temp = info.maxLength * cmax + maxL; info.maxLength = temp; if (temp < maxL) { info.maxValid = false; } } else { info.maxValid = false; } if (info.deterministic && cmin == cmax) { info.deterministic = detm; } else { info.deterministic = false; } return next.study(info); }
internal override boolean study(TreeInfo info) { return loop.study(info); }
internal override boolean study(TreeInfo info) { info.minLength++; info.maxLength++; return next.study(info); }
internal override boolean study(TreeInfo info) { return info.deterministic; }
internal virtual boolean study(TreeInfo info) { if (next != null) { return next.study(info); } else { return info.deterministic; } }
internal override boolean study(TreeInfo info) { if (type != INDEPENDENT) { int minL = info.minLength; atom.study(info); info.minLength = minL; info.deterministic = false; return next.study(info); } else { atom.study(info); return next.study(info); } }
private bool IsPlacementRelevant(TreeInfo info) { throw new NotImplementedException("IsPlacementRelevant is target of redirection and is not implemented."); }
internal Start(Node node) { this.next = node; TreeInfo info = new TreeInfo(); next.study(info); minLength = info.minLength; }
public void SetTree(NetInfo prefab, LanePosition position, TreeInfo tree) { var newSegmentData = new SegmentData(SegmentDataManager.Instance.GetActiveOptions(prefab)); if (tree != GetDefaultTree(prefab, position)) { newSegmentData.SetPrefabFeature(position.ToTreeFeatureFlag(), tree); } else { newSegmentData.UnsetFeature(position.ToTreeFeatureFlag()); } SegmentDataManager.Instance.SetActiveOptions(prefab, newSegmentData); }
private Node group0() { boolean capturingGroup = false; Node head = null; Node tail = null; int save = _flags; root = null; int ch = next(); if (ch == '?') { ch = skip(); switch (ch) { case ':': // (?:xxx) pure group head = createGroup(true); tail = root; head.next = expr(tail); break; case '=': // (?=xxx) and (?!xxx) lookahead case '!': head = createGroup(true); tail = root; head.next = expr(tail); if (ch == '=') { head = tail = new Pos(head); } else { head = tail = new Neg(head); } break; case '>': // (?>xxx) independent group head = createGroup(true); tail = root; head.next = expr(tail); head = tail = new Ques(head, INDEPENDENT); break; case '<': // (?<xxx) look behind ch = read(); if (ASCII.isLower(ch) || ASCII.isUpper(ch)) { // named captured group String name = groupname(ch); if (namedGroups().containsKey(name)) throw error(new String("Named capturing group <" + name + "> is already defined")); capturingGroup = true; head = createGroup(false); tail = root; namedGroups().put(name, new Integer(capturingGroupCount-1)); head.next = expr(tail); break; } int start = _cursor; head = createGroup(true); tail = root; head.next = expr(tail); tail.next = lookbehindEnd; TreeInfo info = new TreeInfo(); head.study(info); if (info.maxValid == false) { throw error(new String("Look-behind group does not have " + "an obvious maximum length")); } boolean hasSupplementary = findSupplementary(start, patternLength); if (ch == '=') { head = tail = (hasSupplementary ? new BehindS(head, info.maxLength, info.minLength) : new Behind(head, info.maxLength, info.minLength)); } else if (ch == '!') { head = tail = (hasSupplementary ? new NotBehindS(head, info.maxLength, info.minLength) : new NotBehind(head, info.maxLength, info.minLength)); } else { throw error(new String("Unknown look-behind group")); } break; case '$': case '@': throw error(new String("Unknown group type")); default: // (?xxx:) inlined match flags unread(); addFlag(); ch = read(); if (ch == ')') { return null; // Inline modifier only } if (ch != ':') { throw error(new String("Unknown inline modifier")); } head = createGroup(true); tail = root; head.next = expr(tail); break; } } else { // (xxx) a regular group capturingGroup = true; head = createGroup(false); tail = root; head.next = expr(tail); } accept(')', new String("Unclosed group")); _flags = save; // Check for quantifiers Node node = closure(head); if (node == head) { // No closure root = tail; return node; // Dual return } if (head == tail) { // Zero length assertion root = node; return node; // Dual return } if (node is Ques) { Ques ques = (Ques) node; if (ques.type == POSSESSIVE) { root = node; return node; } tail.next = new BranchConn(); tail = tail.next; if (ques.type == GREEDY) { head = new Branch(head, null, tail); } else { // Reluctant quantifier head = new Branch(null, head, tail); } root = tail; return head; } else if (node is Curly) { Curly curly = (Curly) node; if (curly.type == POSSESSIVE) { root = node; return node; } // Discover if the group is deterministic TreeInfo info = new TreeInfo(); if (head.study(info)) { // Deterministic GroupTail temp = (GroupTail) tail; head = root = new GroupCurly(head.next, curly.cmin, curly.cmax, curly.type, ((GroupTail)tail).localIndex, ((GroupTail)tail).groupIndex, capturingGroup); return head; } else { // Non-deterministic int temp = ((GroupHead) head).localIndex; Loop loop; if (curly.type == GREEDY) loop = new Loop(this.localCount, temp); else // Reluctant Curly loop = new LazyLoop(this.localCount, temp); Prolog prolog = new Prolog(loop); this.localCount += 1; loop.cmin = curly.cmin; loop.cmax = curly.cmax; loop.body = head; tail.next = loop; root = loop; return prolog; // Dual return } } throw error(new String("Internal logic error")); }