public void RefreshData(bool hardRefresh = true) { ClearEditor(); EditMode = false; dataReader = new ViewSystemDataReaderV2(this); isInit = dataReader.Init(); saveData = ((ViewSystemDataReaderV2)dataReader).GetSaveData(); inspector = new ViewSystemNodeInspector(this); //ViewControllerRoot = ((ViewSystemDataReaderV2)dataReader).GetViewControllerRoot(); globalSettingWindow = new ViewSystemGlobalSettingWindow("Global Setting", this, (ViewSystemDataReaderV2)dataReader); viewPageOrderWindow = new ViewPageOrderWindow("Overlay Order", this, (ViewSystemDataReaderV2)dataReader); overridePopupWindow = new OverridePopupWindow("Override", this, inspector); navigationWindow = new ViewPageNavigationWindow("Navigation Setting", this); viewSystemVerifier = new ViewSystemVerifier(this, saveData); breakpointWindow = new ViewBreakpointWindow("Break Point Setting", this); viewStatesPopup.Add("All"); viewStatesPopup.Add("Overlay Only"); viewStatesPopup.AddRange(viewStateList.Select(m => m.viewState.name)); if (hardRefresh == false && lastSelectNode != null) { inspector.SetCurrentSelectItem(lastSelectNode); } dataReader.EditEnd(); CanEnterEditMode = true; }
public bool Init() { CheckAndCreateResourceFolder(); data = CheckOrReadSaveData(); // 整理 Editor 資料 List <ViewPageNode> viewPageNodes = new List <ViewPageNode>(); //先整理 ViewPage Node foreach (var item in data.viewPages) { var isOverlay = item.viewPage.viewPageType == ViewPage.ViewPageType.Overlay; var node = editor.AddViewPageNode(item.nodePosition, isOverlay, item.viewPage); viewPageNodes.Add(node); } //在整理 ViewState Node foreach (var item in data.viewStates) { var vp_of_vs = viewPageNodes.Where(m => m.viewPage.viewState == item.viewState.name); var node = editor.AddViewStateNode(item.nodePosition, item.viewState); editor.CreateConnection(node); } isInit = data ? true : false; return(isInit); }
public ViewSystemVerifier(ViewSystemVisualEditor editor, ViewSystemSaveData saveData) { this.saveData = saveData; this.editor = editor; windowStyle = new GUIStyle(Drawer.windowStyle); RectOffset padding = windowStyle.padding; padding.left = 0; padding.right = 1; padding.bottom = 0; }
ViewSystemSaveData CheckOrReadSaveData() { ViewSystemSaveData result = null; var filePath = ViewSystemResourceFolder + ViewSystemSaveDataFileName; if (!File.Exists(filePath)) { result = ScriptableObject.CreateInstance <ViewSystemSaveData>(); AssetDatabase.CreateAsset(result, filePath); AssetImporter.GetAtPath(filePath); AssetDatabase.Refresh(); return(result); } result = AssetDatabase.LoadAssetAtPath <ViewSystemSaveData>(filePath); return(result); }
public void SetData(List <string> propertyCannotBeFound, IEnumerable <ViewSystemComponentData> allComponentDatas, ViewSystemSaveData saveData, Action OnComplete) { titleContent = new GUIContent("Missing property fixer"); this.allComponentDatas = allComponentDatas; this.icon = EditorGUIUtility.FindTexture("MetaFile Icon"); this.lable = "Select the property your wish to fix"; fixerDatas = propertyCannotBeFound.Select( m => { var x = m.Split(','); return(new { componentName = x[0], propertyName = x[1] }); } ).GroupBy(m => m.componentName).ToDictionary(o => o.Key, o => o.Select(r => new FixerData(r.propertyName)).ToList()); foreach (var item in fixerDatas) { var type = MacacaGames.Utility.GetType(item.Key); var fis = type.GetFields(ViewSystemVerifier.bindingFlags).Select(m => new CMEditorLayout.GroupedPopupData { name = m.Name, group = "Filed" }); var pis = type.GetProperties(ViewSystemVerifier.bindingFlags).Select(m => new CMEditorLayout.GroupedPopupData { name = m.Name, group = "Property" }); List <CMEditorLayout.GroupedPopupData> gList = new List <CMEditorLayout.GroupedPopupData>(); gList.AddRange(pis); gList.AddRange(fis); fieldsInComponents.Add(item.Key, gList); } OnAllClick += () => { fixerDatas.All(x => { x.Value.All( r => { r.fix = true; return(true); } ); return(true); }); }; OnNoneClick += () => { fixerDatas.All(x => { x.Value.All( r => { r.fix = false; return(true); } ); return(true); }); }; OnCancelClick += () => { }; OnApplyClick += () => { foreach (var item in fixerDatas) { var ac = allComponentDatas.Where(m => m.targetComponentType == item.Key); foreach (var item2 in item.Value) { if (item2.delete && item2.fix == true) { foreach (var vp in saveData.viewPages) { foreach (var vpi in vp.viewPage.viewPageItems) { vpi.overrideDatas.RemoveAll(m => m.targetComponentType == item.Key && m.targetPropertyName == item2.originalPropertyName); } } foreach (var vs in saveData.viewStates) { foreach (var vpi in vs.viewState.viewPageItems) { vpi.overrideDatas.RemoveAll(m => m.targetComponentType == item.Key && m.targetPropertyName == item2.originalPropertyName); } } continue; } if (string.IsNullOrEmpty(item2.modifiedPropertyName)) { continue; } if (item2.fix == false) { continue; } ac.Where(m => m.targetPropertyName == item2.originalPropertyName).All( x => { x.targetPropertyName = item2.modifiedPropertyName; return(true); } ); } } }; }
public void SetData(IEnumerable <ViewSystemVerifier.ViewSystemGameObjectMissingData> originalNotFoundItems, ViewSystemSaveData saveData, Action OnComplete) { titleContent = new GUIContent("Missing GameObject fixer"); this.icon = EditorGUIUtility.FindTexture("MetaFile Icon"); this.lable = "Select the GameObject Path your wish to fix"; fixerDatas = originalNotFoundItems.Select(m => new FixerData { originalNotFoundItem = m, tempPath = m.viewSystemComponent.targetTransformPath }).ToList(); OnAllClick += () => { fixerDatas.All(x => { x.fix = true; return(true); }); }; OnNoneClick += () => { fixerDatas.All(x => { x.fix = false; return(true); }); }; OnCancelClick += () => { }; OnApplyClick += () => { foreach (var item in fixerDatas) { if (item.fix == false) { continue; } if (item.delete == true) { foreach (var vp in saveData.viewPages) { foreach (var vpi in vp.viewPage.viewPageItems.Where(m => m.viewElement == item.originalNotFoundItem.viewElement)) { vpi.overrideDatas.RemoveAll( m => m.targetTransformPath == item.originalNotFoundItem.viewSystemComponent.targetTransformPath); } } foreach (var vs in saveData.viewStates) { // foreach (var vpi in vs.viewState.viewPageItems) // { // vpi.overrideDatas.RemoveAll(m => m.targetComponentType == item.Key && m.targetPropertyName == item2.originalPropertyName); // } foreach (var vpi in vs.viewState.viewPageItems.Where(m => m.viewElement == item.originalNotFoundItem.viewElement)) { vpi.overrideDatas.RemoveAll( m => m.targetTransformPath == item.originalNotFoundItem.viewSystemComponent.targetTransformPath); } } continue; } item.originalNotFoundItem.viewSystemComponent.targetTransformPath = item.tempPath; } // var f = fixerDatas.Where(m => m.fix); // foreach (var item in f) // { // } // var d = fixerDatas.Where(m => m.delete); // foreach (var item in d) // { // item.originalNotFoundItem.viewSystemComponent.targetTransformPath = item.tempPath; // } }; }