private static string GetObjectType(AkWwiseProjectData.WwiseObjectType item) { switch (item) { case AkWwiseProjectData.WwiseObjectType.AUXBUS: return("AuxBus"); case AkWwiseProjectData.WwiseObjectType.EVENT: return("Event"); case AkWwiseProjectData.WwiseObjectType.SOUNDBANK: return("Bank"); case AkWwiseProjectData.WwiseObjectType.STATE: return("State"); case AkWwiseProjectData.WwiseObjectType.SWITCH: return("Switch"); case AkWwiseProjectData.WwiseObjectType.GAMEPARAMETER: return("GameParameter"); case AkWwiseProjectData.WwiseObjectType.ACOUSTICTEXTURE: return("AcousticTexture"); default: return("undefined"); } }
string GetObjectType(AkWwiseProjectData.WwiseObjectType item) { string type = "undefined"; switch (item) { case AkWwiseProjectData.WwiseObjectType.AUXBUS: type = "AuxBus"; break; case AkWwiseProjectData.WwiseObjectType.EVENT: type = "Event"; break; case AkWwiseProjectData.WwiseObjectType.SOUNDBANK: type = "Bank"; break; case AkWwiseProjectData.WwiseObjectType.STATE: type = "State"; break; case AkWwiseProjectData.WwiseObjectType.SWITCH: type = "Switch"; break; } return(type); }
public void SetRootItem(string Header, AkWwiseProjectData.WwiseObjectType ObjType) { RootItem.Items.Clear(); RootItem.Header = Header; RootItem.DataContext = new AkTreeInfo(0, ObjType); AddHandlerEvents(RootItem); RootItem.IsExpanded = GetExpansionStatus("/" + RootItem.Header); }
string GetObjectType(AkWwiseProjectData.WwiseObjectType item) { string type = "undefined"; switch (item) { case AkWwiseProjectData.WwiseObjectType.AUXBUS: type = "AuxBus"; break; case AkWwiseProjectData.WwiseObjectType.EVENT: type = "Event"; break; case AkWwiseProjectData.WwiseObjectType.SOUNDBANK: type = "Bank"; break; case AkWwiseProjectData.WwiseObjectType.STATE: type = "State"; break; case AkWwiseProjectData.WwiseObjectType.SWITCH: type = "Switch"; break; case AkWwiseProjectData.WwiseObjectType.GAMEPARAMETER: type = "GameParameter"; break; case AkWwiseProjectData.WwiseObjectType.ACOUSTICTEXTURE: type = "AcousticTexture"; break; } return(type); }
public AkTreeInfo(int id, byte[] guid, AkWwiseProjectData.WwiseObjectType objType) { ID = id; ObjectType = objType; Guid = guid; }
public AkTreeInfo(int id, AkWwiseProjectData.WwiseObjectType objType) { ID = id; ObjectType = objType; }
public static void Create(AkWwiseProjectData.WwiseObjectType in_type, UnityEditor.SerializedProperty[] in_guid, UnityEditor.SerializedProperty[] in_ID, UnityEditor.SerializedObject in_serializedObject, UnityEngine.Rect in_pos) { if (s_componentPicker == null) { s_componentPicker = CreateInstance <AkWwiseComponentPicker>(); //position the window below the button var pos = new UnityEngine.Rect(in_pos.x, in_pos.yMax, 0, 0); //If the window gets out of the screen, we place it on top of the button instead if (in_pos.yMax > UnityEngine.Screen.currentResolution.height / 2) { pos.y = in_pos.y - UnityEngine.Screen.currentResolution.height / 2; } //We show a drop down window which is automatically destroyed when focus is lost s_componentPicker.ShowAsDropDown(pos, new UnityEngine.Vector2(in_pos.width >= 250 ? in_pos.width : 250, UnityEngine.Screen.currentResolution.height / 2)); s_componentPicker.m_selectedItemGuid = in_guid; s_componentPicker.m_selectedItemID = in_ID; s_componentPicker.m_serializedObject = in_serializedObject; s_componentPicker.m_type = in_type; //Make a backup of the tree's expansion status and replace it with an empty list to make sure nothing will get expanded //when we populate the tree var expandedItemsBackUp = AkWwiseProjectInfo.GetData().ExpandedItems; AkWwiseProjectInfo.GetData().ExpandedItems = new System.Collections.Generic.List <string>(); s_componentPicker.m_treeView.AssignDefaults(); s_componentPicker.m_treeView.SetRootItem( System.IO.Path.GetFileNameWithoutExtension(WwiseSetupWizard.Settings.WwiseProjectPath), AkWwiseProjectData.WwiseObjectType.PROJECT); //Populate the tree with the correct type if (in_type == AkWwiseProjectData.WwiseObjectType.EVENT) { s_componentPicker.m_treeView.PopulateItem(s_componentPicker.m_treeView.RootItem, "Events", AkWwiseProjectInfo.GetData().EventWwu); } else if (in_type == AkWwiseProjectData.WwiseObjectType.SWITCH) { s_componentPicker.m_treeView.PopulateItem(s_componentPicker.m_treeView.RootItem, "Switches", AkWwiseProjectInfo.GetData().SwitchWwu); } else if (in_type == AkWwiseProjectData.WwiseObjectType.STATE) { s_componentPicker.m_treeView.PopulateItem(s_componentPicker.m_treeView.RootItem, "States", AkWwiseProjectInfo.GetData().StateWwu); } else if (in_type == AkWwiseProjectData.WwiseObjectType.SOUNDBANK) { s_componentPicker.m_treeView.PopulateItem(s_componentPicker.m_treeView.RootItem, "Banks", AkWwiseProjectInfo.GetData().BankWwu); } else if (in_type == AkWwiseProjectData.WwiseObjectType.AUXBUS) { s_componentPicker.m_treeView.PopulateItem(s_componentPicker.m_treeView.RootItem, "Auxiliary Busses", AkWwiseProjectInfo.GetData().AuxBusWwu); } else if (in_type == AkWwiseProjectData.WwiseObjectType.GAMEPARAMETER) { s_componentPicker.m_treeView.PopulateItem(s_componentPicker.m_treeView.RootItem, "Game Parameters", AkWwiseProjectInfo.GetData().RtpcWwu); } else if (in_type == AkWwiseProjectData.WwiseObjectType.TRIGGER) { s_componentPicker.m_treeView.PopulateItem(s_componentPicker.m_treeView.RootItem, "Triggers", AkWwiseProjectInfo.GetData().TriggerWwu); } else if (in_type == AkWwiseProjectData.WwiseObjectType.ACOUSTICTEXTURE) { s_componentPicker.m_treeView.PopulateItem(s_componentPicker.m_treeView.RootItem, "Virtual Acoustics", AkWwiseProjectInfo.GetData().AcousticTextureWwu); } AK.Wwise.TreeView.TreeViewItem item = null; var byteArray = AkUtilities.GetByteArrayProperty(in_guid[0]); if (byteArray != null) { item = s_componentPicker.m_treeView.GetItemByGuid(new System.Guid(byteArray)); } if (item != null) { item.ParentControl.SelectedItem = item; var itemIndexFromRoot = 0; //Expand all the parents of the selected item. //Count the number of items that are displayed before the selected item while (true) { item.IsExpanded = true; if (item.Parent != null) { itemIndexFromRoot += item.Parent.Items.IndexOf(item) + 1; item = item.Parent; } else { break; } } //Scroll down the window to make sure that the selected item is always visible when the window opens var itemHeight = item.ParentControl.m_skinSelected.button.CalcSize(new UnityEngine.GUIContent(item.Header)).y + 2.0f; //there seems to be 1 pixel between each item so we add 2 pixels(top and bottom) s_componentPicker.m_treeView.SetScrollViewPosition(new UnityEngine.Vector2(0.0f, itemHeight * itemIndexFromRoot - UnityEngine.Screen.currentResolution.height / 4)); } //Restore the tree's expansion status AkWwiseProjectInfo.GetData().ExpandedItems = expandedItemsBackUp; } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { // Using BeginProperty / EndProperty on the parent property means that // prefab override logic works on the entire property. EditorGUI.BeginProperty(position, label, property); SetupSerializedProperties(property); ID = property.FindPropertyRelative("ID"); // Draw label position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label); /************************************************Update Properties**************************************************/ Guid[] componentGuid = new Guid[m_guidProperty.Length]; for (int i = 0; i < componentGuid.Length; i++) { byte[] guidBytes = AkUtilities.GetByteArrayProperty(m_guidProperty[i]); componentGuid[i] = guidBytes == null ? Guid.Empty : new Guid(guidBytes); } string componentName = UpdateIds(componentGuid); /*******************************************************************************************************************/ /********************************************Draw GUI***************************************************************/ var style = new GUIStyle(GUI.skin.button); style.alignment = TextAnchor.MiddleLeft; style.fontStyle = FontStyle.Normal; if (componentName.Equals(String.Empty)) { componentName = "No " + m_typeName + " is currently selected"; style.normal.textColor = Color.red; } if (GUI.Button(position, componentName, style)) { s_pressedPosition = position; s_buttonWasPressed = true; // We don't want to set object as dirty only because we clicked the button. // It will be set as dirty if the wwise object has been changed by the tree view. GUI.changed = false; } var currentEvent = UnityEngine.Event.current; if (currentEvent.type == EventType.Repaint) { if (s_buttonWasPressed && s_pressedPosition.Equals(position)) { s_serializedObject = property.serializedObject; s_pickerPos = GetLastRectAbsolute(); s_guidProperty = m_guidProperty; s_objectType = m_objectType; EditorApplication.delayCall += DelayCreateCall; s_buttonWasPressed = false; } } HandleDragAndDrop(currentEvent, position); EditorGUI.EndProperty(); }