public void DrawAcModules() { GUILayout.BeginVertical(GUILayout.Width(ACStyles.ModuleViewWidth)); GUILayout.Label("MODULES " + _childModules.Count); _moduleScrollPos = GUILayout.BeginScrollView(_moduleScrollPos); TryInitDrawAcModulesParams(); for (int i = 0; i < _childModules.Count; i++) { var childModule = _childModules[i]; bool lastToggle = _moduleToggleStates[i]; _moduleToggleStates[i] = GUILayout.Toggle(_moduleToggleStates[i], childModule.Name, ACWindow.ACStyles.ModuleButton); if (!lastToggle && _moduleToggleStates[i]) { EditorWindowHelper.ResetToggleStates(_moduleToggleStates, i); _curSelectModule = childModule; } } GUILayout.EndScrollView(); GUILayout.EndVertical(); if (_curSelectModule != null) { _curSelectModule.DrawAcPrefabs(); } }
private void TryInitDrawAcModulesParams() { if (_moduleToggleStates.Count == 0) { int moduleConut = _childModules.Count; if (moduleConut > 0) { _curSelectModule = _childModules[0]; _moduleToggleStates = EditorWindowHelper.InitToggleStates(moduleConut); } } }
public ACPrefab(string file, ACModule parentModule) { File = file; AssetFile = EditorWindowHelper.DataPathToAssetPath(file); ParentModule = parentModule; string fileName = Path.GetFileName(file); { fileName = Regex.Replace(fileName, ".*?_", "", RegexOptions.IgnoreCase); Name = Regex.Replace(fileName, ".prefab", "", RegexOptions.IgnoreCase); } }
private void CollectAllPrefabs(ACModule acModel) { if (acModel.ModuleType == ModuleType.Single) { ACSingleModule acSingleModule = acModel as ACSingleModule; if (acSingleModule != null) { _allAcPrefabs.Add(acSingleModule.ChildPrefab); } } else { ACMultiMoudle acMultiMoudle = acModel as ACMultiMoudle; if (acMultiMoudle != null) { _allAcPrefabs.AddRange(acMultiMoudle.ChildPrefabs); } } }
private void AddAcModule(ACModule acModule) { _childModules.Add(acModule); }