public static void LoadBank(string name) { AkBankHandle handle = null; if (!m_BankHandles.TryGetValue(name, out handle)) { handle = new AkBankHandle(name); m_BankHandles.Add(name, handle); handle.LoadBank(); } }
public void AddToResourceMap(DictionaryView <string, ListView <CResourcePackerInfo> > map) { for (int i = 0; i < this.m_resourceInfos.Count; i++) { stResourceInfo info = this.m_resourceInfos[i]; string key = info.m_fullPathInResourcesWithoutExtension.ToLower(); stResourceInfo info2 = this.m_resourceInfos[i]; if (info2.m_isRenamed) { if (this.m_renameMap == null) { this.m_renameMap = new Dictionary <string, string>(); } stResourceInfo info3 = this.m_resourceInfos[i]; this.m_renameMap.Add(key, info3.m_fullPathInResourcesWithoutExtension_Renamed.ToLower()); } ListView <CResourcePackerInfo> view = null; if (!map.TryGetValue(key, out view)) { view = new ListView <CResourcePackerInfo>(); map.Add(key, view); } view.Add(this); } }
public void AddCommand(ICheatCommand InCommand, int HierarchiesIndex) { DebugHelper.Assert(InCommand != null); string[] GroupHierarchies = InCommand.command.groupHierarchies; DebugHelper.Assert(GroupHierarchies != null); if (HierarchiesIndex < GroupHierarchies.Length) { // should add to children group CheatCommandGroup Groups = null; if (!ChildrenGroups.TryGetValue(GroupHierarchies[HierarchiesIndex], out Groups)) { Groups = new CheatCommandGroup(); ChildrenGroups.Add(GroupHierarchies[HierarchiesIndex], Groups); } DebugHelper.Assert(Groups != null); Groups.AddCommand(InCommand, HierarchiesIndex + 1); } else { // add to this group Commands.Add(InCommand.command.baseName, InCommand); } }
public static void LoadBank(string name) { m_Mutex.WaitOne(); AkBankHandle handle = null; if (!m_BankHandles.TryGetValue(name, out handle)) { handle = new AkBankHandle(name); m_BankHandles.Add(name, handle); m_Mutex.ReleaseMutex(); handle.LoadBank(); } else { m_Mutex.ReleaseMutex(); } }
public ResInBatMsgHeroActCfg GetHeroActCfg(uint heroid, uint actID) { DictionaryView <uint, ResInBatMsgHeroActCfg> view = null; this.heroActData.TryGetValue(heroid, out view); if (view == null) { return(null); } ResInBatMsgHeroActCfg cfg = null; view.TryGetValue(actID, out cfg); return(cfg); }
public ResInBatMsgHeroActCfg GetHeroActCfg(uint heroid, uint actID) { DictionaryView <uint, ResInBatMsgHeroActCfg> dictionaryView = null; this.heroActData.TryGetValue(heroid, ref dictionaryView); if (dictionaryView == null) { return(null); } ResInBatMsgHeroActCfg result = null; dictionaryView.TryGetValue(actID, ref result); return(result); }
public void AddToResourceMap(DictionaryView <string, ListView <CResourcePackerInfo> > map) { for (int i = 0; i < this.m_resourceInfos.Count; i++) { stResourceInfo info = this.m_resourceInfos[i]; string key = info.m_fullPathInResourcesWithoutExtension.ToLower(); ListView <CResourcePackerInfo> view = null; if (!map.TryGetValue(key, out view)) { view = new ListView <CResourcePackerInfo>(); map.Add(key, view); } view.Add(this); } }
public static ResHeroSkin GetHeroSkin(uint heroId, uint skinId) { ListView <ResHeroSkin> view = null; s_heroSkinDic.TryGetValue(heroId, out view); if (view != null) { for (int i = 0; i < view.Count; i++) { if (((view[i] != null) && (view[i].dwHeroID == heroId)) && (view[i].dwSkinID == skinId)) { return(view[i]); } } } return(GetHeroSkin((heroId * 100) + skinId)); }
private void OnEnable() { if (this.multiPositionTypeLabel == MultiPositionTypeLabel.Simple_Mode) { AkGameObj[] components = base.gameObject.GetComponents <AkGameObj>(); for (int i = 0; i < components.Length; i++) { components[i].enabled = true; } } else if (this.multiPositionTypeLabel == MultiPositionTypeLabel.Large_Mode) { AkGameObj[] objArray2 = base.gameObject.GetComponents <AkGameObj>(); for (int j = 0; j < objArray2.Length; j++) { objArray2[j].enabled = false; } AkPositionArray array = this.BuildAkPositionArray(); AkSoundEngine.SetMultiplePositions(base.gameObject, array, (ushort)array.Count, MultiPositionType.MultiPositionType_MultiSources); } else if (this.multiPositionTypeLabel == MultiPositionTypeLabel.MultiPosition_Mode) { AkMultiPosEvent event2; AkGameObj[] objArray3 = base.gameObject.GetComponents <AkGameObj>(); for (int k = 0; k < objArray3.Length; k++) { objArray3[k].enabled = false; } if (multiPosEventTree.TryGetValue(base.eventID, out event2)) { if (!event2.list.Contains(this)) { event2.list.Add(this); } } else { event2 = new AkMultiPosEvent(); event2.list.Add(this); multiPosEventTree.Add(base.eventID, event2); } AkPositionArray array2 = this.BuildMultiDirectionArray(ref event2); AkSoundEngine.SetMultiplePositions(event2.list[0].gameObject, array2, (ushort)array2.Count, MultiPositionType.MultiPositionType_MultiSources); } }
public void RegisterCommand(ICheatCommand InCommand) { // 1. DebugHelper.Assert(InCommand != null && !HasCommand(InCommand.command.baseName)); GeneralRepositories.Commands[InCommand.command.baseName.ToLower()] = InCommand; // 2. string[] GroupHierarchies = InCommand.command.groupHierarchies; DebugHelper.Assert(GroupHierarchies != null); string BaseGroup = GroupHierarchies[0]; CheatCommandGroup Groups = null; if (!Repositories.TryGetValue(BaseGroup, out Groups)) { Groups = new CheatCommandGroup(); Repositories[BaseGroup] = Groups; } Groups.AddCommand(InCommand, 1); }
private void GenerateNodes(Vector3[] vectorVertices, int[] triangles, out Vector3[] originalVertices, out VInt3[] vertices) { if (vectorVertices.Length == 0 || triangles.Length == 0) { originalVertices = vectorVertices; vertices = new VInt3[0]; this.nodes = new TriangleMeshNode[0]; return; } vertices = new VInt3[vectorVertices.Length]; int num = 0; for (int i = 0; i < vertices.Length; i++) { vertices[i] = (VInt3)this.matrix.MultiplyPoint3x4(vectorVertices[i]); } Dictionary<VInt3, int> dictionary = new Dictionary<VInt3, int>(); int[] array = new int[vertices.Length]; for (int j = 0; j < vertices.Length; j++) { if (!dictionary.ContainsKey(vertices[j])) { array[num] = j; dictionary.Add(vertices[j], num); num++; } } for (int k = 0; k < triangles.Length; k++) { VInt3 vInt = vertices[triangles[k]]; triangles[k] = dictionary.get_Item(vInt); } VInt3[] array2 = vertices; vertices = new VInt3[num]; originalVertices = new Vector3[num]; for (int l = 0; l < num; l++) { vertices[l] = array2[array[l]]; originalVertices[l] = vectorVertices[array[l]]; } this.nodes = new TriangleMeshNode[triangles.Length / 3]; int graphIndex = this.active.astarData.GetGraphIndex(this); for (int m = 0; m < this.nodes.Length; m++) { this.nodes[m] = new TriangleMeshNode(this.active); TriangleMeshNode triangleMeshNode = this.nodes[m]; triangleMeshNode.GraphIndex = (uint)graphIndex; triangleMeshNode.Penalty = this.initialPenalty; triangleMeshNode.Walkable = true; triangleMeshNode.v0 = triangles[m * 3]; triangleMeshNode.v1 = triangles[m * 3 + 1]; triangleMeshNode.v2 = triangles[m * 3 + 2]; if (!Polygon.IsClockwise(vertices[triangleMeshNode.v0], vertices[triangleMeshNode.v1], vertices[triangleMeshNode.v2])) { int v = triangleMeshNode.v0; triangleMeshNode.v0 = triangleMeshNode.v2; triangleMeshNode.v2 = v; } if (Polygon.IsColinear(vertices[triangleMeshNode.v0], vertices[triangleMeshNode.v1], vertices[triangleMeshNode.v2])) { Debug.DrawLine((Vector3)vertices[triangleMeshNode.v0], (Vector3)vertices[triangleMeshNode.v1], Color.red); Debug.DrawLine((Vector3)vertices[triangleMeshNode.v1], (Vector3)vertices[triangleMeshNode.v2], Color.red); Debug.DrawLine((Vector3)vertices[triangleMeshNode.v2], (Vector3)vertices[triangleMeshNode.v0], Color.red); } triangleMeshNode.UpdatePositionFromVertices(); } DictionaryView<VInt2, TriangleMeshNode> dictionaryView = new DictionaryView<VInt2, TriangleMeshNode>(); int n = 0; int num2 = 0; while (n < triangles.Length) { dictionaryView[new VInt2(triangles[n], triangles[n + 1])] = this.nodes[num2]; dictionaryView[new VInt2(triangles[n + 1], triangles[n + 2])] = this.nodes[num2]; dictionaryView[new VInt2(triangles[n + 2], triangles[n])] = this.nodes[num2]; num2++; n += 3; } ListLinqView<MeshNode> listLinqView = new ListLinqView<MeshNode>(); List<uint> list = new List<uint>(); int num3 = 0; int num4 = 0; int num5 = 0; while (num4 < triangles.Length) { listLinqView.Clear(); list.Clear(); TriangleMeshNode triangleMeshNode2 = this.nodes[num5]; for (int num6 = 0; num6 < 3; num6++) { TriangleMeshNode triangleMeshNode3; if (dictionaryView.TryGetValue(new VInt2(triangles[num4 + (num6 + 1) % 3], triangles[num4 + num6]), out triangleMeshNode3)) { listLinqView.Add(triangleMeshNode3); list.Add((uint)(triangleMeshNode2.position - triangleMeshNode3.position).costMagnitude); } } triangleMeshNode2.connections = listLinqView.ToArray(); triangleMeshNode2.connectionCosts = list.ToArray(); num5++; num4 += 3; } if (num3 > 0) { Debug.LogError("One or more triangles are identical to other triangles, this is not a good thing to have in a navmesh\nIncreasing the scale of the mesh might help\nNumber of triangles with error: " + num3 + "\n"); } NavMeshGraph.RebuildBBTree(this); }
private void GenerateNodes(Vector3[] vectorVertices, int[] triangles, out Vector3[] originalVertices, out VInt3[] vertices) { if ((vectorVertices.Length == 0) || (triangles.Length == 0)) { originalVertices = vectorVertices; vertices = new VInt3[0]; this.nodes = new TriangleMeshNode[0]; } else { vertices = new VInt3[vectorVertices.Length]; int index = 0; for (int i = 0; i < vertices.Length; i++) { vertices[i] = (VInt3)this.matrix.MultiplyPoint3x4(vectorVertices[i]); } Dictionary <VInt3, int> dictionary = new Dictionary <VInt3, int>(); int[] numArray = new int[vertices.Length]; for (int j = 0; j < vertices.Length; j++) { if (!dictionary.ContainsKey(vertices[j])) { numArray[index] = j; dictionary.Add(vertices[j], index); index++; } } for (int k = 0; k < triangles.Length; k++) { VInt3 num5 = vertices[triangles[k]]; triangles[k] = dictionary[num5]; } VInt3[] numArray2 = vertices; vertices = new VInt3[index]; originalVertices = new Vector3[index]; for (int m = 0; m < index; m++) { vertices[m] = numArray2[numArray[m]]; originalVertices[m] = vectorVertices[numArray[m]]; } this.nodes = new TriangleMeshNode[triangles.Length / 3]; int graphIndex = base.active.astarData.GetGraphIndex(this); for (int n = 0; n < this.nodes.Length; n++) { this.nodes[n] = new TriangleMeshNode(base.active); TriangleMeshNode node = this.nodes[n]; node.GraphIndex = (uint)graphIndex; node.Penalty = base.initialPenalty; node.Walkable = true; node.v0 = triangles[n * 3]; node.v1 = triangles[(n * 3) + 1]; node.v2 = triangles[(n * 3) + 2]; if (!Polygon.IsClockwise(vertices[node.v0], vertices[node.v1], vertices[node.v2])) { int num9 = node.v0; node.v0 = node.v2; node.v2 = num9; } if (Polygon.IsColinear(vertices[node.v0], vertices[node.v1], vertices[node.v2])) { Debug.DrawLine((Vector3)vertices[node.v0], (Vector3)vertices[node.v1], Color.red); Debug.DrawLine((Vector3)vertices[node.v1], (Vector3)vertices[node.v2], Color.red); Debug.DrawLine((Vector3)vertices[node.v2], (Vector3)vertices[node.v0], Color.red); } node.UpdatePositionFromVertices(); } DictionaryView <VInt2, TriangleMeshNode> view = new DictionaryView <VInt2, TriangleMeshNode>(); int num10 = 0; int num11 = 0; while (num10 < triangles.Length) { view[new VInt2(triangles[num10], triangles[num10 + 1])] = this.nodes[num11]; view[new VInt2(triangles[num10 + 1], triangles[num10 + 2])] = this.nodes[num11]; view[new VInt2(triangles[num10 + 2], triangles[num10])] = this.nodes[num11]; num11++; num10 += 3; } ListLinqView <MeshNode> view2 = new ListLinqView <MeshNode>(); List <uint> list = new List <uint>(); int num12 = 0; int num13 = 0; int num14 = 0; while (num13 < triangles.Length) { view2.Clear(); list.Clear(); TriangleMeshNode node2 = this.nodes[num14]; for (int num15 = 0; num15 < 3; num15++) { TriangleMeshNode node3; if (view.TryGetValue(new VInt2(triangles[num13 + ((num15 + 1) % 3)], triangles[num13 + num15]), out node3)) { view2.Add(node3); VInt3 num16 = node2.position - node3.position; list.Add((uint)num16.costMagnitude); } } node2.connections = view2.ToArray(); node2.connectionCosts = list.ToArray(); num14++; num13 += 3; } if (num12 > 0) { Debug.LogError("One or more triangles are identical to other triangles, this is not a good thing to have in a navmesh\nIncreasing the scale of the mesh might help\nNumber of triangles with error: " + num12 + "\n"); } RebuildBBTree(this); } }