예제 #1
0
        public override void OnGUI(Rect rect)
        {
            GUILayout.Label("载入行为图", Utility.GetGuiStyle("Title"));
            GUILayout.Space(10);

            List <GraphBaseInfo> graphBaseInfoList = PersistenceTool.LoadGraphBaseInfoList();

            if (graphBaseInfoList == null || graphBaseInfoList.Count == 0)
            {
                GUILayout.Label("没有图可以载入", Utility.GetGuiStyle("LoadSkillHint"));
                return;
            }

            scrollPosition = GUILayout.BeginScrollView(scrollPosition);
            for (int i = 0; i < graphBaseInfoList.Count; i++)
            {
                GraphBaseInfo graphBaseInfo = graphBaseInfoList[i];
                if (GUILayout.Button(string.Format("{0}.{1}    {2}", graphBaseInfo.graphId, graphBaseInfo.graphName,
                                                   graphBaseInfo.graphDescription)))
                {
                    if (loadCallback != null)
                    {
                        loadCallback(graphBaseInfo.graphId);

                        if (EditorWindow.focusedWindow != null)
                        {
                            editorWindow.Close();
                        }
                        break;
                    }
                }
            }

            GUILayout.EndScrollView();
        }
예제 #2
0
        public override void OnGUI(Rect rect)
        {
            GUILayout.Label("删除行为图", Utility.GetGuiStyle("DeleteFileTitle"));
            GUILayout.Space(10);

            List <GraphBaseInfo> graphBaseInfoList = PersistenceTool.LoadGraphBaseInfoList();

            if (graphBaseInfoList == null)
            {
                GUILayout.Label("没有图可以删除", Utility.GetGuiStyle("LoadSkillHint"));
                return;
            }

            scrollPosition = GUILayout.BeginScrollView(scrollPosition);
            for (int i = 0; i < graphBaseInfoList.Count; i++)
            {
                GraphBaseInfo graphBaseInfo = graphBaseInfoList[i];
                if (GUILayout.Button(string.Format("删除   {0}.{1}    {2}", graphBaseInfo.graphId, graphBaseInfo.graphName,
                                                   graphBaseInfo.graphDescription)))
                {
                    if (EditorUtility.DisplayDialog("删除行为图",
                                                    string.Format("是否删除行为图 {0}:{1} \n 描述:{2}", graphBaseInfo.graphId, graphBaseInfo.graphName,
                                                                  graphBaseInfo.graphDescription), "ok"))
                    {
                        if (deleteCallback != null)
                        {
                            deleteCallback(graphBaseInfo.graphId);

                            if (EditorWindow.focusedWindow != null)
                            {
                                editorWindow.Close();
                            }

                            break;
                        }
                    }
                }
            }

            GUILayout.EndScrollView();
        }