| using System.Collections; | 
| using System.Collections.Generic; | 
| using UnityEngine; | 
| using UnityEditor; | 
| using Snxxz.UI; | 
| using UnityEngine.UI; | 
| using TableConfig; | 
|   | 
| public class NewBieGuideEditorWindow : EditorWindow  | 
| { | 
|     [MenuItem("程序/新手调试器")] | 
|     public static void Create()  | 
|     {  | 
|         var window = GetWindow(typeof(NewBieGuideEditorWindow), false, "新手调试器") as NewBieGuideEditorWindow;  | 
|         window.Show();  | 
|         window.autoRepaintOnSceneChange = true;  | 
|     }  | 
|   | 
|     UIRoot m_UIRoot;  | 
|     UIRoot uiroot {  | 
|         get { return m_UIRoot ?? (m_UIRoot = FindObjectOfType<UIRoot>()); }  | 
|         set { m_UIRoot = value; }  | 
|     }  | 
|   | 
|     string guideContent = string.Empty;  | 
|     Transform m_ClickTarget;  | 
|     NewBieGuideScriptableObject.ArrowPosition arrowPosition = NewBieGuideScriptableObject.ArrowPosition.None;  | 
|     NewBieGuideScriptableObject.SelectBoxPattern selectBox = NewBieGuideScriptableObject.SelectBoxPattern.Pattern1;  | 
|   | 
|     GameObject selectBoxGameObject;  | 
|   | 
|     GuideType guideType = GuideType.NewBie;  | 
|   | 
|     int stepId = 0;  | 
|     int guideId = 0;  | 
|   | 
|     GameObject newBieWin;  | 
|     Transform functionalUnLock;  | 
|     NewBieMask newbieMask;  | 
|     Transform newBiecontainerDialogue;  | 
|     Text newBieDialogueContent;  | 
|     RectTransform newBieImageHint;  | 
|     RectTransform newBieHintEffectContainer;  | 
|     RectTransform newBieContainerArrow;  | 
|     Image newBieArrowImage;  | 
|     RectTransform newbieUsherMMContainer;  | 
|   | 
|     int voice = 0;  | 
|     int effect2 = 0;  | 
|     int usherAction = 0;  | 
|     bool clickAnyWhereComplete = false;  | 
|     bool pointerDownComplete = false;  | 
|     NewBieGuideScriptableObject.UsherOrientation usherOrientation = NewBieGuideScriptableObject.UsherOrientation.Normal;  | 
|   | 
|     GameObject usherMM;  | 
|   | 
|     GameObject recommendWin;  | 
|     FunctionalGuideBehaviour recommendBehaviour;  | 
|     RectTransform recommendImageHint;  | 
|   | 
|     private void Update()  | 
|     {  | 
|         if (newbieMask != null && newBieImageHint != null)  | 
|         {  | 
|             newbieMask.mask.center = newBieImageHint.localPosition;  | 
|             newbieMask.mask.cell = newBieImageHint.sizeDelta;  | 
|         }  | 
|     }  | 
|   | 
|     private void OnGUI()  | 
|     {  | 
|   | 
|         EditorGUILayout.BeginVertical();  | 
|   | 
|         EditorGUILayout.BeginHorizontal();  | 
|         EditorGUILayout.Space();  | 
|         guideType = GUILayout.Toggle(guideType == GuideType.NewBie, "新手引导") ? GuideType.NewBie : GuideType.Recommend;  | 
|         guideType = GUILayout.Toggle(guideType == GuideType.Recommend, "功能推荐") ? GuideType.Recommend : GuideType.NewBie;  | 
|         EditorGUILayout.Space();  | 
|         EditorGUILayout.EndHorizontal();  | 
|   | 
|         GUILayout.Space(30);  | 
|   | 
|         EditorGUILayout.BeginHorizontal();  | 
|         stepId = EditorGUILayout.IntField("步骤ID", stepId);  | 
|         if (GUILayout.Button("导入"))  | 
|         {  | 
|             switch (guideType)  | 
|             {  | 
|                 case GuideType.NewBie:  | 
|                     ImportNewBieConfig();  | 
|                     break;  | 
|                 case GuideType.Recommend:  | 
|                     ImportRecommondConfig();  | 
|                     break;  | 
|             }  | 
|   | 
|         }  | 
|   | 
|         if (GUILayout.Button("保存"))  | 
|         {  | 
|             switch (guideType)  | 
|             {  | 
|                 case GuideType.NewBie:  | 
|                     ExportNewBieConfig();  | 
|                     break;  | 
|                 case GuideType.Recommend:  | 
|                     ExportRecommondConfig();  | 
|                     break;  | 
|             }  | 
|         }  | 
|   | 
|         EditorGUILayout.EndHorizontal();  | 
|         guideContent = EditorGUILayout.TextField("引导内容", guideContent);  | 
|         m_ClickTarget = (Transform)EditorGUILayout.ObjectField("点击目标", m_ClickTarget, typeof(Transform), true);  | 
|   | 
|         arrowPosition = (NewBieGuideScriptableObject.ArrowPosition)EditorGUILayout.EnumPopup("箭头方向", arrowPosition);  | 
|         selectBox = (NewBieGuideScriptableObject.SelectBoxPattern)EditorGUILayout.EnumPopup("选中框样式", selectBox);  | 
|   | 
|         voice = EditorGUILayout.IntField("音效", voice);  | 
|         effect2 = EditorGUILayout.IntField("特效2", effect2);  | 
|   | 
|         EditorGUILayout.BeginHorizontal();  | 
|   | 
|         usherAction = EditorGUILayout.IntField("引导MM动作", usherAction);  | 
|         usherOrientation = (NewBieGuideScriptableObject.UsherOrientation)EditorGUILayout.EnumPopup("引导MM方向", usherOrientation);  | 
|         EditorGUILayout.EndHorizontal();  | 
|   | 
|         clickAnyWhereComplete = EditorGUILayout.Toggle("点击任意位置完成引导", clickAnyWhereComplete);  | 
|         pointerDownComplete = EditorGUILayout.Toggle("鼠标按下即完成引导", pointerDownComplete);  | 
|   | 
|         EditorGUILayout.Space();  | 
|         EditorGUILayout.Space();  | 
|         EditorGUILayout.Space();  | 
|   | 
|         EditorGUILayout.BeginHorizontal();  | 
|   | 
|         if (GUILayout.Button("重置所有引导"))  | 
|         {  | 
|             NewBieCenter.Instance.ResetAllGuides();  | 
|         }  | 
|   | 
|         if (GUILayout.Button("结束所有引导"))  | 
|         {  | 
|             NewBieCenter.Instance.CompleteAllGuides();  | 
|         }  | 
|         EditorGUILayout.EndHorizontal();  | 
|   | 
|         switch (guideType)  | 
|         {  | 
|             case GuideType.NewBie:  | 
|                 DrawNewbieGuides();  | 
|                 break;  | 
|             case GuideType.Recommend:  | 
|                 DrawFunctionalGuides();  | 
|                 break;  | 
|         }  | 
|   | 
|         EditorGUILayout.EndVertical();  | 
|     } | 
|   | 
|     private void ImportNewBieConfig()  | 
|     {  | 
|         var fileName = StringUtility.Contact("NewBieGuideStep_", stepId, ".asset");  | 
|         var path = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath, "Refdata/ScriptableObject/SoNewBieGuide/", fileName);  | 
|         var so = AssetDatabase.LoadAssetAtPath<NewBieGuideScriptableObject>(path);  | 
|   | 
|         if (newBieWin == null)  | 
|         {  | 
|             var newBieWin = FindObjectOfType<NewBieWin>();  | 
|             this.newBieWin = newBieWin != null ? newBieWin.gameObject : null;  | 
|   | 
|             if (this.newBieWin == null)  | 
|             {  | 
|                 var prefab = UILoader.LoadWindow("NewBieWin");  | 
|                 this.newBieWin = GameObject.Instantiate(prefab) as GameObject;  | 
|                 this.newBieWin.name = "NewBieWin";  | 
|   | 
|                 if (this.newBieWin != null)  | 
|                 {  | 
|                     uiroot = GameObject.FindObjectOfType<UIRoot>();  | 
|                     if (uiroot == null)  | 
|                     {  | 
|                         var rootPrefab = Resources.Load<GameObject>("UI/Prefabs/UIRoot");  | 
|                         var root = GameObject.Instantiate(rootPrefab, Vector3.zero, Quaternion.identity);  | 
|                         root.name = "UIRoot";  | 
|                         uiroot = root.GetComponent<UIRoot>();  | 
|                     }  | 
|   | 
|                     var parent = uiroot.systemCanvas.transform;  | 
|                     (this.newBieWin.transform as RectTransform).MatchWhith(parent as RectTransform);  | 
|                     PrefabUtility.DisconnectPrefabInstance(this.recommendWin);  | 
|                 }  | 
|             }  | 
|   | 
|             Selection.activeGameObject = this.newBieWin;  | 
|             this.functionalUnLock = this.newBieWin.GetComponent<Transform>("Container_Function");  | 
|             this.functionalUnLock.gameObject.SetActive(false);  | 
|             this.newbieMask = this.newBieWin.GetComponent<NewBieMask>("Container_Guide/Mask");  | 
|             this.newBiecontainerDialogue = this.newBieWin.GetComponent<Transform>("Container_Guide/Container_Dialogue");  | 
|             this.newBieDialogueContent = this.newBieWin.GetComponent<Text>("Container_Guide/Container_Dialogue/Txt_Dialogue");  | 
|             this.newBieImageHint = this.newBieWin.GetComponent<RectTransform>("Container_Guide/Container_ClickHint");  | 
|             this.newBieHintEffectContainer = this.newBieWin.GetComponent<RectTransform>("Container_Guide/Container_ClickHint/Img_Effect");  | 
|             this.newBieContainerArrow = this.newBieWin.GetComponent<RectTransform>("Container_Guide/Container_ClickHint/Container_Arrow");  | 
|             this.newBieArrowImage = this.newBieWin.GetComponent<Image>("Container_Guide/Container_ClickHint/Container_Arrow/Img_Arrow");  | 
|             this.newbieUsherMMContainer = this.newBieWin.GetComponent<RectTransform>("Container_Guide/Img_UsherMM");  | 
|         }  | 
|   | 
|         if (so != null)  | 
|         {  | 
|             m_ClickTarget = uiroot.transform.Find(so.UIElementPath);  | 
|   | 
|             newbieMask.mask.center = so.clickPosition;  | 
|             newbieMask.mask.cell = so.clickSize;  | 
|             newBiecontainerDialogue.localPosition = so.tipPosition;  | 
|             newBieDialogueContent.text = so.tipContent;  | 
|             newBieImageHint.localPosition = so.clickPosition;  | 
|             newBieImageHint.sizeDelta = so.clickSize;  | 
|             var selectBosAssetName = so.selectBox == 0 ? "SelectBox1" : "SelectBox2";  | 
|             var selectBoxGameObject = UIUtility.CreateWidget(selectBosAssetName, selectBosAssetName);  | 
|             ((RectTransform)selectBoxGameObject.transform).MatchWhith(newBieHintEffectContainer);  | 
|             newbieUsherMMContainer.localPosition = so.usherPosition;  | 
|             newbieUsherMMContainer.localEulerAngles = new Vector3(0, so.usherOrientation == 0 ? 0 : 180, 0);  | 
|             voice = so.voice;  | 
|             clickAnyWhereComplete = so.clickAnyWhereComplete;  | 
|             pointerDownComplete = so.pointerDownComplete;  | 
|   | 
|             guideContent = so.tipContent;  | 
|   | 
|             arrowPosition = so.arrowPosition;  | 
|             selectBox = so.selectBox;  | 
|             usherAction = so.usherAction;  | 
|             usherOrientation = so.usherOrientation;  | 
|   | 
|             if (so.usherAction != 0)  | 
|             {  | 
|                 if (usherMM != null)  | 
|                 {  | 
|                     GameObject.DestroyImmediate(usherMM);  | 
|                 }  | 
|                 usherMM = GetUsherMM(so.usherAction);  | 
|                 usherMM.transform.SetParentEx(newbieUsherMMContainer, Vector3.zero, Vector3.zero, Vector3.one);  | 
|                 usherMM.SetActive(true);  | 
|             }  | 
|   | 
|             newBieContainerArrow.gameObject.SetActive(so.arrowPosition != NewBieGuideScriptableObject.ArrowPosition.None);  | 
|             if (so.arrowPosition != NewBieGuideScriptableObject.ArrowPosition.None)  | 
|             {  | 
|                 switch (so.arrowPosition)  | 
|                 {  | 
|                     case NewBieGuideScriptableObject.ArrowPosition.Left:  | 
|                         newBieContainerArrow.localPosition = so.clickPosition - new Vector2(so.clickSize.x * 0.5f + newBieContainerArrow.rect.width * 0.5f, 0f);  | 
|                         newBieArrowImage.transform.localEulerAngles = new Vector3(0, 0, 90);  | 
|                         break;  | 
|                     case NewBieGuideScriptableObject.ArrowPosition.Right:  | 
|                         newBieContainerArrow.localPosition = so.clickPosition + new Vector2(so.clickSize.x * 0.5f + newBieContainerArrow.rect.width * 0.5f, 0f);  | 
|                         newBieArrowImage.transform.localEulerAngles = new Vector3(0, 0, 270);  | 
|                         break;  | 
|                     case NewBieGuideScriptableObject.ArrowPosition.Top:  | 
|                         newBieContainerArrow.localPosition = so.clickPosition + new Vector2(0f, so.clickSize.y * 0.5f + newBieContainerArrow.rect.height * 0.5f);  | 
|                         newBieArrowImage.transform.localEulerAngles = new Vector3(0, 0, 0);  | 
|                         break;  | 
|                     case NewBieGuideScriptableObject.ArrowPosition.Bottom:  | 
|                         newBieContainerArrow.localPosition = so.clickPosition - new Vector2(0f, so.clickSize.y * 0.5f + newBieContainerArrow.rect.height * 0.5f);  | 
|                         newBieArrowImage.transform.localEulerAngles = new Vector3(0, 0, 180);  | 
|                         break;  | 
|                 }  | 
|             }  | 
|   | 
|         }  | 
|   | 
|         Repaint();  | 
|     } | 
|   | 
|     private void ExportNewBieConfig()  | 
|     {  | 
|         var fileName = StringUtility.Contact("NewBieGuideStep_", stepId, ".asset");  | 
|         var path = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath, "Refdata/ScriptableObject/SoNewBieGuide/", fileName);  | 
|         AssetDatabase.DeleteAsset(path);  | 
|   | 
|         var so = CreateInstance<NewBieGuideScriptableObject>();  | 
|         AssetDatabase.CreateAsset(so, path);  | 
|   | 
|         if (newBieWin != null)  | 
|         {  | 
|             so.stepId = stepId;  | 
|             so.clickPosition = newBieImageHint.transform.localPosition;  | 
|             so.clickSize = newBieImageHint.sizeDelta;  | 
|             so.tipPosition = newBiecontainerDialogue.localPosition;  | 
|             so.tipContent = newBieDialogueContent.text;  | 
|             so.arrowPosition = arrowPosition;  | 
|             so.selectBox = selectBox;  | 
|             so.usherOrientation = usherOrientation;  | 
|             so.effect2 = effect2;  | 
|             so.usherPosition = newbieUsherMMContainer.localPosition;  | 
|             so.usherAction = usherAction;  | 
|             so.voice = voice;  | 
|             so.clickAnyWhereComplete = clickAnyWhereComplete;  | 
|             so.pointerDownComplete = pointerDownComplete;  | 
|             so.tipContent = guideContent;  | 
|   | 
|             if (m_ClickTarget != null)  | 
|             {  | 
|                 so.UIElementPath = UIUtility.GetUIElementRelativePath(uiroot, m_ClickTarget);  | 
|             }  | 
|         }  | 
|   | 
|         AssetDatabase.Refresh();  | 
|         EditorUtility.SetDirty(so);  | 
|         AssetDatabase.SaveAssets();  | 
|     } | 
|   | 
|     private void ImportRecommondConfig()  | 
|     {  | 
|         var fileName = StringUtility.Contact("FunctionalGuideStep_", stepId, ".asset");  | 
|         var path = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath, "Refdata/ScriptableObject/SoNewBieGuide/", fileName);  | 
|         var so = AssetDatabase.LoadAssetAtPath<NewBieGuideScriptableObject>(path);  | 
|   | 
|         if (recommendWin == null)  | 
|         {  | 
|             var recommendWin = FindObjectOfType<FunctionalGuideWin>();  | 
|             this.recommendWin = recommendWin != null ? recommendWin.gameObject : null;  | 
|   | 
|             if (this.recommendWin == null)  | 
|             {  | 
|                 var prefab = UILoader.LoadWindow("FunctionalGuideWin");  | 
|                 this.recommendWin = GameObject.Instantiate(prefab) as GameObject;  | 
|                 this.recommendWin.name = "FunctionalGuideWin";  | 
|   | 
|                 if (this.recommendWin != null)  | 
|                 {  | 
|                     uiroot = GameObject.FindObjectOfType<UIRoot>();  | 
|                     if (uiroot == null)  | 
|                     {  | 
|                         var rootPrefab = Resources.Load<GameObject>("UI/Prefabs/UIRoot");  | 
|                         var root = GameObject.Instantiate(rootPrefab, Vector3.zero, Quaternion.identity);  | 
|                         root.name = "UIRoot";  | 
|                         uiroot = root.GetComponent<UIRoot>();  | 
|                     }  | 
|   | 
|                     var parent = uiroot.systemCanvas.transform;  | 
|                     (this.recommendWin.transform as RectTransform).MatchWhith(parent as RectTransform);  | 
|                     PrefabUtility.DisconnectPrefabInstance(this.recommendWin);  | 
|                 }  | 
|             }  | 
|   | 
|             Selection.activeGameObject = this.recommendWin;  | 
|             var instance = UIUtility.CreateWidget("FunctionalGuideBehaviour", "FunctionalGuideBehaviour");  | 
|             var behaviourRectTransform = (RectTransform)instance.transform;  | 
|             recommendBehaviour = instance.GetComponent<FunctionalGuideBehaviour>();  | 
|             this.recommendWin.gameObject.SetActive(true);  | 
|             behaviourRectTransform.MatchWhith(this.recommendWin.transform as RectTransform);  | 
|             recommendBehaviour.gameObject.SetActive(true);  | 
|   | 
|             this.recommendImageHint = this.recommendBehaviour.clickHintRoot;  | 
|         }  | 
|   | 
|         if (so != null)  | 
|         {  | 
|             m_ClickTarget = uiroot.transform.Find(so.UIElementPath);  | 
|             recommendImageHint.transform.localPosition = so.clickPosition;  | 
|             recommendImageHint.sizeDelta = so.clickSize;  | 
|             guideContent = so.tipContent;  | 
|             arrowPosition = so.arrowPosition;  | 
|             selectBox = so.selectBox;  | 
|             var selectBosAssetName = string.Empty;  | 
|             switch (so.selectBox)  | 
|             {  | 
|                 case NewBieGuideScriptableObject.SelectBoxPattern.Pattern1:  | 
|                     selectBosAssetName = "SelectBox1";  | 
|                     break;  | 
|                 case NewBieGuideScriptableObject.SelectBoxPattern.Pattern2:  | 
|                     selectBosAssetName = "SelectBox2";  | 
|                     break;  | 
|                 case NewBieGuideScriptableObject.SelectBoxPattern.None:  | 
|                     selectBosAssetName = string.Empty;  | 
|                     break;  | 
|             }  | 
|   | 
|             if (selectBoxGameObject != null)  | 
|             {  | 
|                 DestroyImmediate(selectBoxGameObject);  | 
|                 selectBoxGameObject = null;  | 
|             }  | 
|   | 
|             if (!string.IsNullOrEmpty(selectBosAssetName))  | 
|             {  | 
|                 selectBoxGameObject = UIUtility.CreateWidget(selectBosAssetName, selectBosAssetName);  | 
|                 ((RectTransform)selectBoxGameObject.transform).MatchWhith(recommendImageHint);  | 
|             }  | 
|         }  | 
|   | 
|         Repaint();  | 
|     } | 
|   | 
|     private void ExportRecommondConfig()  | 
|     {  | 
|         var fileName = StringUtility.Contact("FunctionalGuideStep_", stepId, ".asset");  | 
|         var path = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath, "Refdata/ScriptableObject/SoNewBieGuide/", fileName);  | 
|         AssetDatabase.DeleteAsset(path);  | 
|   | 
|         var so = CreateInstance<NewBieGuideScriptableObject>();  | 
|         AssetDatabase.CreateAsset(so, path);  | 
|   | 
|         if (recommendBehaviour != null)  | 
|         {  | 
|             so.stepId = stepId;  | 
|             so.clickPosition = recommendImageHint.transform.localPosition;  | 
|             so.clickSize = recommendImageHint.sizeDelta;  | 
|             so.tipContent = guideContent;  | 
|             so.arrowPosition = arrowPosition;  | 
|             so.selectBox = selectBox;  | 
|             if (m_ClickTarget != null)  | 
|             {  | 
|                 so.UIElementPath = UIUtility.GetUIElementRelativePath(uiroot, m_ClickTarget);  | 
|             }  | 
|         }  | 
|   | 
|         AssetDatabase.Refresh();  | 
|         EditorUtility.SetDirty(so);  | 
|         AssetDatabase.SaveAssets();  | 
|     } | 
|   | 
|     private void StartNewBieGuide()  | 
|     {  | 
|         NewBieCenter.Instance.currentGuide = guideId;  | 
|         NewBieCenter.Instance.StartNewBieGuide(guideId);  | 
|     } | 
|   | 
|     private void StartFunctionalGuide()  | 
|     {  | 
|         FunctionalGuideCenter.Instance.StartGuide(guideId);  | 
|     }  | 
|   | 
|     private GameObject GetUsherMM(int _action)  | 
|     {  | 
|         var instance = UIUtility.CreateWidget("GuideUsher", "GuideUsher");  | 
|   | 
|         return instance;  | 
|     } | 
|   | 
|     enum GuideType  | 
|     {  | 
|         NewBie,        //新手引导,半强制性的。  | 
|         Recommend,//功能性引导,推荐性的。  | 
|     } | 
|   | 
|     List<NewBieGuide> newbieGuides = null; | 
|     List<FunctionalGuide> functionalGuides = null;  | 
|     private Vector2 scrollPosition; | 
|   | 
|     void DrawNewbieGuides()  | 
|     {  | 
|         if (Config.Instance.inited && newbieGuides == null)  | 
|         {  | 
|             newbieGuides = new List<NewBieGuide>();  | 
|             var guides = Config.Instance.GetAllValues<GuideConfig>();  | 
|             foreach (var config in guides)  | 
|             {  | 
|                 if (config.Type == 1)  | 
|                 {  | 
|                     newbieGuides.Add(new NewBieGuide(config.ID));  | 
|                 }  | 
|             }  | 
|         }  | 
|   | 
|         if (newbieGuides != null)  | 
|         {  | 
|             scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false);  | 
|             foreach (var newbieGuide in newbieGuides)  | 
|             {  | 
|                 EditorGUILayout.Space();  | 
|                 EditorGUILayout.BeginHorizontal();  | 
|   | 
|                 EditorGUILayout.Space();  | 
|   | 
|                 EditorGUILayout.LabelField("半强制引导Id:" + newbieGuide.guideId);  | 
|   | 
|                 EditorGUILayout.Toggle("Completed", newbieGuide.completed);  | 
|   | 
|                 GUI.skin.button.normal.textColor = newbieGuide.guideId == NewBieCenter.Instance.currentGuide ? Color.red : Color.white;  | 
|   | 
|                 if (GUILayout.Button("开始"))  | 
|                 {  | 
|                     newbieGuide.Begin();  | 
|                 }  | 
|   | 
|                 GUI.skin.button.normal.textColor = Color.white;  | 
|                 if (GUILayout.Button("完成"))  | 
|                 {  | 
|                     newbieGuide.Finish();  | 
|                 }  | 
|   | 
|                 if (GUILayout.Button("重置"))  | 
|                 {  | 
|                     newbieGuide.Reset();  | 
|                 }  | 
|   | 
|                 EditorGUILayout.Space();  | 
|                 EditorGUILayout.EndHorizontal();  | 
|             }  | 
|   | 
|             GUILayout.EndScrollView();  | 
|         }  | 
|   | 
|     } | 
|   | 
|     void DrawFunctionalGuides()  | 
|     {  | 
|         if (Config.Instance.inited && functionalGuides == null)  | 
|         {  | 
|             functionalGuides = new List<FunctionalGuide>();  | 
|             var guides = Config.Instance.GetAllValues<GuideConfig>();  | 
|             foreach (var config in guides)  | 
|             {  | 
|                 if (config.Type == 2)  | 
|                 {  | 
|                     functionalGuides.Add(new FunctionalGuide(config.ID));  | 
|                 }  | 
|             }  | 
|         }  | 
|   | 
|         if (functionalGuides != null)  | 
|         {  | 
|             scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false);  | 
|             foreach (var guide in functionalGuides)  | 
|             {  | 
|                 EditorGUILayout.Space();  | 
|                 EditorGUILayout.BeginHorizontal();  | 
|   | 
|                 EditorGUILayout.Space();  | 
|   | 
|                 EditorGUILayout.LabelField("自由引导Id:" + guide.guideId);  | 
|                 EditorGUILayout.Toggle("Completed", guide.completed);  | 
|   | 
|                 GUI.skin.button.normal.textColor = FunctionalGuideCenter.Instance.GetUnderwayGuides().Contains(guide.guideId) ? Color.red : Color.white;  | 
|   | 
|                 if (GUILayout.Button("开始"))  | 
|                 {  | 
|                     guide.Begin();  | 
|                 }  | 
|   | 
|                 GUI.skin.button.normal.textColor = Color.white;  | 
|                 if (GUILayout.Button("完成"))  | 
|                 {  | 
|                     guide.Finish();  | 
|                 }  | 
|   | 
|                 EditorGUILayout.Space();  | 
|                 EditorGUILayout.EndHorizontal();  | 
|             }  | 
|   | 
|             GUILayout.EndScrollView();  | 
|         }  | 
|   | 
|   | 
|     } | 
|   | 
|     public class NewBieGuide  | 
|     {  | 
|         public int guideId;  | 
|         public bool completed { get { return NewBieCenter.Instance.completeGuidesBuf.Contains(guideId); } }  | 
|   | 
|         public NewBieGuide(int _guideId)  | 
|         {  | 
|             guideId = _guideId;  | 
|         }  | 
|   | 
|         public void Begin()  | 
|         {  | 
|             NewBieCenter.Instance.StartNewBieGuide(guideId);  | 
|         }  | 
|   | 
|         public void Finish()  | 
|         {  | 
|             NewBieCenter.Instance.FinishNewBieGuide(guideId);  | 
|         }  | 
|   | 
|         public void Reset()  | 
|         {  | 
|             NewBieCenter.Instance.ResetGuide(guideId);  | 
|         }  | 
|     } | 
|   | 
|     public class FunctionalGuide  | 
|     {  | 
|         public int guideId;  | 
|         public bool completed { get { return NewBieCenter.Instance.completeGuidesBuf.Contains(guideId); } }  | 
|   | 
|         public FunctionalGuide(int _guideId)  | 
|         {  | 
|             guideId = _guideId;  | 
|         }  | 
|   | 
|         public void Begin()  | 
|         {  | 
|             FunctionalGuideCenter.Instance.StartGuide(guideId);  | 
|         }  | 
|   | 
|         public void Finish()  | 
|         {  | 
|             FunctionalGuideCenter.Instance.RemoveGuide(guideId);  | 
|         }  | 
|   | 
|     } | 
|   | 
|   | 
|   | 
| } |