Exemplo n.º 1
0
    static void SortValues(AkWwiseProjectData.GroupValue groupToSort)
    {
        if (groupToSort.values.Count > 0)
        {
            tmpData[] listToSort = new tmpData[groupToSort.values.Count];
            for (int i = 0; i < groupToSort.values.Count; i++)
            {
                listToSort[i]           = new tmpData();
                listToSort[i].valueName = groupToSort.values[i];
                listToSort[i].pathElem  = groupToSort.ValueIcons[i];
                listToSort[i].ID        = groupToSort.valueIDs[i];
                listToSort[i].Guid      = groupToSort.ValueGuids[i];
            }

            Array.Sort(listToSort, s_comparetmpDataByName);

            for (int i = 0; i < groupToSort.values.Count; i++)
            {
                groupToSort.values[i]     = listToSort[i].valueName;
                groupToSort.ValueIcons[i] = listToSort[i].pathElem;
                groupToSort.valueIDs[i]   = listToSort[i].ID;
                groupToSort.ValueGuids[i] = listToSort[i].Guid;
            }
        }
    }
Exemplo n.º 2
0
    public override string UpdateIds(System.Guid[] in_guid)
    {
        string stateName = string.Empty;

        for (int i = 0; i < AkWwiseProjectInfo.GetData().StateWwu.Count; i++)
        {
            AkWwiseProjectData.GroupValue stateGroup = AkWwiseProjectInfo.GetData().StateWwu[i].List.Find(x => new System.Guid(x.Guid).Equals(in_guid[1]));

            if (stateGroup != null)
            {
                serializedObject.Update();

                stateName          = stateGroup.Name + "/";
                m_groupID.intValue = stateGroup.ID;

                int index = stateGroup.ValueGuids.FindIndex(x => new System.Guid(x.bytes).Equals(in_guid[0]));
                m_valueID.intValue = stateGroup.valueIDs[index];

                serializedObject.ApplyModifiedProperties();

                return(stateName + stateGroup.values[index]);
            }
        }

        return(string.Empty);
    }
Exemplo n.º 3
0
    public byte[][] GetSwitchGuidByName(string in_groupName, string in_valueName)
    {
        byte[][] guids = new byte[][] { new byte[16], new byte[16] };

        for (int i = 0; i < AkWwiseProjectInfo.GetData().SwitchWwu.Count; i++)
        {
            AkWwiseProjectData.GroupValue switchGroup = AkWwiseProjectInfo.GetData().SwitchWwu[i].List.Find(x => x.Name.Equals(in_groupName));

            if (switchGroup != null)
            {
                guids[0] = switchGroup.Guid;

                int index = switchGroup.values.FindIndex(x => x == in_valueName);
                guids[1] = switchGroup.ValueGuids[index].bytes;

                return(guids);
            }
        }

        return(null);
    }
Exemplo n.º 4
0
    static void AddElementToList(string in_currentPathInProj, XmlReader in_reader, AssetType in_type, LinkedList <AkWwiseProjectData.PathElement> in_pathAndIcons, int in_wwuIndex)
    {
        if (in_type.RootDirectoryName == "Events" || in_type.RootDirectoryName == "Master-Mixer Hierarchy" || in_type.RootDirectoryName == "SoundBanks")
        {
            AkWwiseProjectData.Event valueToAdd = new AkWwiseProjectData.Event();

            valueToAdd.Name         = in_reader.GetAttribute("Name");
            valueToAdd.Guid         = new Guid(in_reader.GetAttribute("ID")).ToByteArray();
            valueToAdd.ID           = (int)AkUtilities.ShortIDGenerator.Compute(valueToAdd.Name);
            valueToAdd.Path         = in_type.RootDirectoryName == "Master-Mixer Hierarchy" ? in_currentPathInProj : Path.Combine(in_currentPathInProj, valueToAdd.Name);
            valueToAdd.PathAndIcons = new List <AkWwiseProjectData.PathElement>(in_pathAndIcons);

            if (in_type.RootDirectoryName == "Events")
            {
                valueToAdd.PathAndIcons.Add(new AkWwiseProjectData.PathElement(valueToAdd.Name, AkWwiseProjectData.WwiseObjectType.EVENT));
                AkWwiseProjectInfo.GetData().EventWwu[in_wwuIndex].List.Add(valueToAdd);
            }
            else if (in_type.RootDirectoryName == "SoundBanks")
            {
                valueToAdd.PathAndIcons.Add(new AkWwiseProjectData.PathElement(valueToAdd.Name, AkWwiseProjectData.WwiseObjectType.SOUNDBANK));
                AkWwiseProjectInfo.GetData().BankWwu[in_wwuIndex].List.Add(valueToAdd);
            }
            else
            {
                AkWwiseProjectInfo.GetData().AuxBusWwu[in_wwuIndex].List.Add(valueToAdd);
            }

            in_reader.Read();
        }
        else if (in_type.RootDirectoryName == "States" || in_type.RootDirectoryName == "Switches")
        {
            var XmlElement = XNode.ReadFrom(in_reader) as XElement;

            AkWwiseProjectData.GroupValue      valueToAdd = new AkWwiseProjectData.GroupValue();
            AkWwiseProjectData.WwiseObjectType SubElemIcon;
            valueToAdd.Name         = XmlElement.Attribute("Name").Value;
            valueToAdd.Guid         = new Guid(XmlElement.Attribute("ID").Value).ToByteArray();
            valueToAdd.ID           = (int)AkUtilities.ShortIDGenerator.Compute(valueToAdd.Name);
            valueToAdd.Path         = Path.Combine(in_currentPathInProj, valueToAdd.Name);
            valueToAdd.PathAndIcons = new List <AkWwiseProjectData.PathElement>(in_pathAndIcons);

            if (in_type.RootDirectoryName == "States")
            {
                SubElemIcon = AkWwiseProjectData.WwiseObjectType.STATE;
                valueToAdd.PathAndIcons.Add(new AkWwiseProjectData.PathElement(valueToAdd.Name, AkWwiseProjectData.WwiseObjectType.STATEGROUP));
            }
            else
            {
                SubElemIcon = AkWwiseProjectData.WwiseObjectType.SWITCH;
                valueToAdd.PathAndIcons.Add(new AkWwiseProjectData.PathElement(valueToAdd.Name, AkWwiseProjectData.WwiseObjectType.SWITCHGROUP));
            }

            XName ChildrenList = XName.Get("ChildrenList");
            XName ChildElem    = XName.Get(in_type.ChildElementName);

            XElement ChildrenElement = XmlElement.Element(ChildrenList);
            if (ChildrenElement != null)
            {
                foreach (var element in ChildrenElement.Elements(ChildElem))
                {
                    if (element.Name == in_type.ChildElementName)
                    {
                        string elementName = element.Attribute("Name").Value;
                        valueToAdd.values.Add(elementName);
                        valueToAdd.ValueGuids.Add(new AkWwiseProjectData.ByteArrayWrapper(new Guid(element.Attribute("ID").Value).ToByteArray()));
                        valueToAdd.valueIDs.Add((int)AkUtilities.ShortIDGenerator.Compute(elementName));
                        valueToAdd.ValueIcons.Add(new AkWwiseProjectData.PathElement(elementName, SubElemIcon));
                    }
                }
            }

            if (in_type.RootDirectoryName == "States")
            {
                AkWwiseProjectInfo.GetData().StateWwu[in_wwuIndex].List.Add(valueToAdd);
            }
            else
            {
                AkWwiseProjectInfo.GetData().SwitchWwu[in_wwuIndex].List.Add(valueToAdd);
            }
        }
        else
        {
            Debug.LogError("WwiseUnity: Unknown asset type in WWU parser");
        }
    }
	static void AddElementToList(string in_currentPathInProj, XmlReader in_reader, AssetType in_type, LinkedList<AkWwiseProjectData.PathElement> in_pathAndIcons, int in_wwuIndex)
	{
		if (in_type.RootDirectoryName == "Events" || in_type.RootDirectoryName == "Master-Mixer Hierarchy" || in_type.RootDirectoryName == "SoundBanks")
		{
			AkWwiseProjectData.Event valueToAdd = new AkWwiseProjectData.Event();
			
			valueToAdd.Name = in_reader.GetAttribute("Name");
			valueToAdd.Guid = new Guid(in_reader.GetAttribute("ID")).ToByteArray();
			valueToAdd.ID = (int)AkUtilities.ShortIDGenerator.Compute(valueToAdd.Name);
			valueToAdd.Path = in_type.RootDirectoryName == "Master-Mixer Hierarchy" ? in_currentPathInProj : Path.Combine(in_currentPathInProj, valueToAdd.Name);
			valueToAdd.PathAndIcons = new List<AkWwiseProjectData.PathElement>(in_pathAndIcons);
			
			if (in_type.RootDirectoryName == "Events")
			{
				valueToAdd.PathAndIcons.Add(new AkWwiseProjectData.PathElement(valueToAdd.Name, AkWwiseProjectData.WwiseObjectType.EVENT));
				AkWwiseProjectInfo.GetData().EventWwu[in_wwuIndex].List.Add(valueToAdd);
			}
			else if (in_type.RootDirectoryName == "SoundBanks")
			{
				valueToAdd.PathAndIcons.Add(new AkWwiseProjectData.PathElement(valueToAdd.Name, AkWwiseProjectData.WwiseObjectType.SOUNDBANK));
				AkWwiseProjectInfo.GetData().BankWwu[in_wwuIndex].List.Add(valueToAdd);
			}
			else
			{
				AkWwiseProjectInfo.GetData().AuxBusWwu[in_wwuIndex].List.Add(valueToAdd);
			}
			
			in_reader.Read();
		}
		else if (in_type.RootDirectoryName == "States" || in_type.RootDirectoryName == "Switches")
		{
			var XmlElement = XNode.ReadFrom(in_reader) as XElement;
			
			AkWwiseProjectData.GroupValue valueToAdd = new AkWwiseProjectData.GroupValue();
			AkWwiseProjectData.WwiseObjectType SubElemIcon;
			valueToAdd.Name = XmlElement.Attribute("Name").Value;
			valueToAdd.Guid = new Guid(XmlElement.Attribute("ID").Value).ToByteArray();
			valueToAdd.ID = (int)AkUtilities.ShortIDGenerator.Compute(valueToAdd.Name);
			valueToAdd.Path = Path.Combine(in_currentPathInProj, valueToAdd.Name);
			valueToAdd.PathAndIcons = new List<AkWwiseProjectData.PathElement>(in_pathAndIcons);
			
			if (in_type.RootDirectoryName == "States")
			{
				SubElemIcon = AkWwiseProjectData.WwiseObjectType.STATE;
				valueToAdd.PathAndIcons.Add(new AkWwiseProjectData.PathElement(valueToAdd.Name, AkWwiseProjectData.WwiseObjectType.STATEGROUP));
			}
			else
			{
				SubElemIcon = AkWwiseProjectData.WwiseObjectType.SWITCH;
				valueToAdd.PathAndIcons.Add(new AkWwiseProjectData.PathElement(valueToAdd.Name, AkWwiseProjectData.WwiseObjectType.SWITCHGROUP));
			}
			
			XName ChildrenList = XName.Get("ChildrenList");
			XName ChildElem = XName.Get(in_type.ChildElementName);
			
			XElement ChildrenElement = XmlElement.Element(ChildrenList);
			if (ChildrenElement != null)
			{
				foreach (var element in ChildrenElement.Elements(ChildElem))
				{
					if (element.Name == in_type.ChildElementName)
					{
						string elementName = element.Attribute("Name").Value;
						valueToAdd.values.Add(elementName);
						valueToAdd.ValueGuids.Add(new AkWwiseProjectData.ByteArrayWrapper( new Guid(element.Attribute("ID").Value).ToByteArray()));
						valueToAdd.valueIDs.Add((int)AkUtilities.ShortIDGenerator.Compute(elementName));
						valueToAdd.ValueIcons.Add(new AkWwiseProjectData.PathElement(elementName, SubElemIcon));
					}
				}
			}
			
			if (in_type.RootDirectoryName == "States")
			{
				AkWwiseProjectInfo.GetData().StateWwu[in_wwuIndex].List.Add(valueToAdd);
			}
			else
			{
				AkWwiseProjectInfo.GetData().SwitchWwu[in_wwuIndex].List.Add(valueToAdd);
			}
		}
		else
		{
			Debug.LogError("WwiseUnity: Unknown asset type in WWU parser");
		}
	}    
Exemplo n.º 6
0
    private static void AddElementToList(string in_currentPathInProj, System.Xml.XmlReader in_reader, AssetType in_type,
                                         System.Collections.Generic.LinkedList <AkWwiseProjectData.PathElement> in_pathAndIcons, int in_wwuIndex, WwiseObjectType in_LeafType = WwiseObjectType.None)
    {
        switch (in_type.Type)
        {
        case WwiseObjectType.Folder:
        case WwiseObjectType.Bus:
        case WwiseObjectType.AuxBus:
        case WwiseObjectType.Event:
        case WwiseObjectType.Soundbank:
        case WwiseObjectType.GameParameter:
        case WwiseObjectType.Trigger:
        case WwiseObjectType.AcousticTexture:
        {
            var LeafType   = in_LeafType == WwiseObjectType.None ? in_type.Type : in_LeafType;
            var name       = in_reader.GetAttribute("Name");
            var valueToAdd = in_type.Type == WwiseObjectType.Event ? new AkWwiseProjectData.Event() : new AkWwiseProjectData.AkInformation();
            valueToAdd.Name         = name;
            valueToAdd.Guid         = new System.Guid(in_reader.GetAttribute("ID"));
            valueToAdd.PathAndIcons = new System.Collections.Generic.List <AkWwiseProjectData.PathElement>(in_pathAndIcons);

            FlagForInsertion(valueToAdd, in_type.Type);

            switch (LeafType)
            {
            case WwiseObjectType.AuxBus:
            case WwiseObjectType.Bus:
            case WwiseObjectType.Folder:
                valueToAdd.Path = in_currentPathInProj;
                break;

            default:
                valueToAdd.Path = System.IO.Path.Combine(in_currentPathInProj, name);
                valueToAdd.PathAndIcons.Add(new AkWwiseProjectData.PathElement(name, in_type.Type));
                break;
            }

            switch (in_type.Type)
            {
            case WwiseObjectType.AuxBus:
                AkWwiseProjectInfo.GetData().AuxBusWwu[in_wwuIndex].List.Add(valueToAdd);
                break;

            case WwiseObjectType.Event:
                AkWwiseProjectInfo.GetData().EventWwu[in_wwuIndex].List.Add(valueToAdd as AkWwiseProjectData.Event);
                break;

            case WwiseObjectType.Soundbank:
                AkWwiseProjectInfo.GetData().BankWwu[in_wwuIndex].List.Add(valueToAdd);
                break;

            case WwiseObjectType.GameParameter:
                AkWwiseProjectInfo.GetData().RtpcWwu[in_wwuIndex].List.Add(valueToAdd);
                break;

            case WwiseObjectType.Trigger:
                AkWwiseProjectInfo.GetData().TriggerWwu[in_wwuIndex].List.Add(valueToAdd);
                break;

            case WwiseObjectType.AcousticTexture:
                AkWwiseProjectInfo.GetData().AcousticTextureWwu[in_wwuIndex].List.Add(valueToAdd);
                break;
            }
        }

            in_reader.Read();
            break;

        case WwiseObjectType.StateGroup:
        case WwiseObjectType.SwitchGroup:
        {
            var valueToAdd = new AkWwiseProjectData.GroupValue();
            if (in_LeafType == WwiseObjectType.Folder)
            {
                valueToAdd.Name         = in_reader.GetAttribute("Name");
                valueToAdd.Guid         = new System.Guid(in_reader.GetAttribute("ID"));
                valueToAdd.PathAndIcons = new System.Collections.Generic.List <AkWwiseProjectData.PathElement>(in_pathAndIcons);
                valueToAdd.Path         = in_currentPathInProj;

                FlagForInsertion(valueToAdd, in_type.Type);
                in_reader.Read();
            }
            else
            {
                var XmlElement      = System.Xml.Linq.XNode.ReadFrom(in_reader) as System.Xml.Linq.XElement;
                var ChildrenList    = System.Xml.Linq.XName.Get("ChildrenList");
                var ChildrenElement = XmlElement.Element(ChildrenList);
                if (ChildrenElement != null)
                {
                    var name = XmlElement.Attribute("Name").Value;
                    valueToAdd.Name         = name;
                    valueToAdd.Guid         = new System.Guid(XmlElement.Attribute("ID").Value);
                    valueToAdd.Path         = System.IO.Path.Combine(in_currentPathInProj, name);
                    valueToAdd.PathAndIcons = new System.Collections.Generic.List <AkWwiseProjectData.PathElement>(in_pathAndIcons);
                    valueToAdd.PathAndIcons.Add(new AkWwiseProjectData.PathElement(name, in_type.Type));

                    FlagForInsertion(valueToAdd, in_type.Type);

                    var ChildElem = System.Xml.Linq.XName.Get(in_type.ChildElementName);
                    foreach (var element in ChildrenElement.Elements(ChildElem))
                    {
                        if (element.Name != in_type.ChildElementName)
                        {
                            continue;
                        }

                        var elementName = element.Attribute("Name").Value;
                        var childValue  = new AkWwiseProjectData.AkBaseInformation
                        {
                            Name = elementName,
                            Guid = new System.Guid(element.Attribute("ID").Value),
                        };
                        childValue.PathAndIcons.Add(new AkWwiseProjectData.PathElement(elementName, in_type.ChildType));
                        valueToAdd.values.Add(childValue);

                        FlagForInsertion(childValue, in_type.ChildType);
                    }
                }
                else
                {
                    valueToAdd = null;
                }
            }

            if (valueToAdd != null)
            {
                switch (in_type.Type)
                {
                case WwiseObjectType.StateGroup:
                    AkWwiseProjectInfo.GetData().StateWwu[in_wwuIndex].List.Add(valueToAdd);
                    break;

                case WwiseObjectType.SwitchGroup:
                    AkWwiseProjectInfo.GetData().SwitchWwu[in_wwuIndex].List.Add(valueToAdd);
                    break;
                }
            }
        }
        break;

        default:
            UnityEngine.Debug.LogError("WwiseUnity: Unknown asset type in WWU parser");
            break;
        }
    }
Exemplo n.º 7
0
    private static void AddElementToList(string in_currentPathInProj, System.Xml.XmlReader in_reader, AssetType in_type,
                                         System.Collections.Generic.LinkedList <AkWwiseProjectData.PathElement> in_pathAndIcons, int in_wwuIndex)
    {
        if (in_type.RootDirectoryName == "Events" || in_type.RootDirectoryName == "Master-Mixer Hierarchy" ||
            in_type.RootDirectoryName == "SoundBanks" || in_type.RootDirectoryName == "Game Parameters" ||
            in_type.RootDirectoryName == "Triggers" || in_type.RootDirectoryName == "Virtual Acoustics")
        {
            var valueToAdd = new AkWwiseProjectData.Event();

            valueToAdd.Name         = in_reader.GetAttribute("Name");
            valueToAdd.Guid         = new System.Guid(in_reader.GetAttribute("ID")).ToByteArray();
            valueToAdd.ID           = (int)AkUtilities.ShortIDGenerator.Compute(valueToAdd.Name);
            valueToAdd.PathAndIcons = new System.Collections.Generic.List <AkWwiseProjectData.PathElement>(in_pathAndIcons);

            switch (in_type.RootDirectoryName)
            {
            case "Events":
                valueToAdd.Path = System.IO.Path.Combine(in_currentPathInProj, valueToAdd.Name);
                valueToAdd.PathAndIcons.Add(
                    new AkWwiseProjectData.PathElement(valueToAdd.Name, AkWwiseProjectData.WwiseObjectType.EVENT));
                AkWwiseProjectInfo.GetData().EventWwu[in_wwuIndex].List.Add(valueToAdd);
                break;

            case "SoundBanks":
                valueToAdd.Path = System.IO.Path.Combine(in_currentPathInProj, valueToAdd.Name);
                valueToAdd.PathAndIcons.Add(
                    new AkWwiseProjectData.PathElement(valueToAdd.Name, AkWwiseProjectData.WwiseObjectType.SOUNDBANK));
                AkWwiseProjectInfo.GetData().BankWwu[in_wwuIndex].List.Add(valueToAdd);
                break;

            case "Master-Mixer Hierarchy":
                valueToAdd.Path = in_currentPathInProj;
                AkWwiseProjectInfo.GetData().AuxBusWwu[in_wwuIndex].List.Add(valueToAdd);
                break;

            case "Game Parameters":
                valueToAdd.Path = System.IO.Path.Combine(in_currentPathInProj, valueToAdd.Name);
                valueToAdd.PathAndIcons.Add(
                    new AkWwiseProjectData.PathElement(valueToAdd.Name, AkWwiseProjectData.WwiseObjectType.GAMEPARAMETER));
                AkWwiseProjectInfo.GetData().RtpcWwu[in_wwuIndex].List.Add(valueToAdd);
                break;

            case "Triggers":
                valueToAdd.Path = System.IO.Path.Combine(in_currentPathInProj, valueToAdd.Name);
                valueToAdd.PathAndIcons.Add(
                    new AkWwiseProjectData.PathElement(valueToAdd.Name, AkWwiseProjectData.WwiseObjectType.TRIGGER));
                AkWwiseProjectInfo.GetData().TriggerWwu[in_wwuIndex].List.Add(valueToAdd);
                break;

            case "Virtual Acoustics":
                valueToAdd.Path = System.IO.Path.Combine(in_currentPathInProj, valueToAdd.Name);
                valueToAdd.PathAndIcons.Add(new AkWwiseProjectData.PathElement(valueToAdd.Name,
                                                                               AkWwiseProjectData.WwiseObjectType.ACOUSTICTEXTURE));
                AkWwiseProjectInfo.GetData().AcousticTextureWwu[in_wwuIndex].List.Add(valueToAdd);
                break;
            }

            in_reader.Read();
        }
        else if (in_type.RootDirectoryName == "States" || in_type.RootDirectoryName == "Switches")
        {
            var XmlElement = System.Xml.Linq.XNode.ReadFrom(in_reader) as System.Xml.Linq.XElement;

            var valueToAdd = new AkWwiseProjectData.GroupValue();
            AkWwiseProjectData.WwiseObjectType SubElemIcon;
            valueToAdd.Name         = XmlElement.Attribute("Name").Value;
            valueToAdd.Guid         = new System.Guid(XmlElement.Attribute("ID").Value).ToByteArray();
            valueToAdd.ID           = (int)AkUtilities.ShortIDGenerator.Compute(valueToAdd.Name);
            valueToAdd.Path         = System.IO.Path.Combine(in_currentPathInProj, valueToAdd.Name);
            valueToAdd.PathAndIcons = new System.Collections.Generic.List <AkWwiseProjectData.PathElement>(in_pathAndIcons);

            if (in_type.RootDirectoryName == "States")
            {
                SubElemIcon = AkWwiseProjectData.WwiseObjectType.STATE;
                valueToAdd.PathAndIcons.Add(
                    new AkWwiseProjectData.PathElement(valueToAdd.Name, AkWwiseProjectData.WwiseObjectType.STATEGROUP));
            }
            else
            {
                SubElemIcon = AkWwiseProjectData.WwiseObjectType.SWITCH;
                valueToAdd.PathAndIcons.Add(
                    new AkWwiseProjectData.PathElement(valueToAdd.Name, AkWwiseProjectData.WwiseObjectType.SWITCHGROUP));
            }

            var ChildrenList = System.Xml.Linq.XName.Get("ChildrenList");
            var ChildElem    = System.Xml.Linq.XName.Get(in_type.ChildElementName);

            var ChildrenElement = XmlElement.Element(ChildrenList);
            if (ChildrenElement != null)
            {
                foreach (var element in ChildrenElement.Elements(ChildElem))
                {
                    if (element.Name == in_type.ChildElementName)
                    {
                        var elementName = element.Attribute("Name").Value;
                        valueToAdd.values.Add(elementName);
                        valueToAdd.ValueGuids.Add(
                            new AkWwiseProjectData.ByteArrayWrapper(new System.Guid(element.Attribute("ID").Value).ToByteArray()));
                        valueToAdd.valueIDs.Add((int)AkUtilities.ShortIDGenerator.Compute(elementName));
                        valueToAdd.ValueIcons.Add(new AkWwiseProjectData.PathElement(elementName, SubElemIcon));
                    }
                }
            }

            if (in_type.RootDirectoryName == "States")
            {
                AkWwiseProjectInfo.GetData().StateWwu[in_wwuIndex].List.Add(valueToAdd);
            }
            else
            {
                AkWwiseProjectInfo.GetData().SwitchWwu[in_wwuIndex].List.Add(valueToAdd);
            }
        }
        else
        {
            UnityEngine.Debug.LogError("WwiseUnity: Unknown asset type in WWU parser");
        }
    }