Exemple #1
0
    public void OnLoadLevel(long level_id_)
    {
        CartoonTemplate temp = this.CreateLevelObj(level_id_);

        CartoonItemJson json = CartoonJsonUtil.LoadLevelJsonData(level_id_);

        CartoonItemWithClips clips = this.ConvertVideoNameToClip(json);

        temp.LoadVideos(clips);

        this.ShowNotification(new GUIContent("请用鼠标选中漫画编辑器"));
    }
Exemple #2
0
    public void CalcNewLevelName()
    {
        List <string> names = CartoonJsonUtil.GetLevelJsonFileNamesWithoutEx();

        m_level_json_max_name_dict = new Dictionary <long, long>();

        foreach (string name in names)
        {
            long name_id = long.Parse(name);
            long key_id  = name_id / 1000;

            if (!m_level_json_max_name_dict.ContainsKey(key_id) || name_id > m_level_json_max_name_dict[key_id])
            {
                m_level_json_max_name_dict[key_id] = name_id;
            }
        }
    }
Exemple #3
0
    private void SaveLevelJson()
    {
        if (null != m_cartoon_root)
        {
            CartoonTemplate[] cartoons = m_cartoon_root.GetComponentsInChildren <CartoonTemplate>(true);

            if (null != cartoons && 1 == cartoons.Length)
            {
                CartoonTemplate editing_item = cartoons[0];

                long key_id = editing_item.m_template_id / 1000;

                if (null == this.m_level_json_max_name_dict)
                {
                    this.CalcNewLevelName();
                }

                if (!this.m_level_json_max_name_dict.ContainsKey(key_id) || this.m_level_json_max_name_dict[key_id] < editing_item.m_template_id)
                {
                    this.m_level_json_max_name_dict[key_id] = editing_item.m_template_id;

                    CartoonJsonUtil.SaveLevelJsonData(editing_item);
                }
                else
                {
                    CartoonJsonUtil.SaveLevelJsonData(editing_item);
                }

                this.ShowNotification(new GUIContent("提示: 保存成功"));
            }
            else
            {
                EditorGUILayout.HelpBox("场景内没有,或者有多余的漫画模板", MessageType.Error);
                this.ShowNotification(new GUIContent("错误: 场景内没有,或者有多余的漫画模板"));
                return;
            }
        }
        else
        {
            EditorGUILayout.HelpBox("重新打开漫画编辑器", MessageType.Error);
            this.ShowNotification(new GUIContent("错误: 重新打开漫画编辑器"));
            return;
        }
    }
Exemple #4
0
    void OnGUI()
    {
        if (string.IsNullOrEmpty(sceneName))
        {
            EditorGUILayout.HelpBox("未打开场景" + SCENE_NAME, MessageType.Error);
            return;
        }

        if (sceneName != SCENE_NAME)
        {
            EditorGUILayout.HelpBox("请选择场景" + SCENE_NAME, MessageType.Error);
            return;
        }

        EditorGUILayout.BeginVertical();
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("当前场景名称:" + sceneName);
        EditorGUILayout.EndHorizontal();


        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("当前关卡名称:" + m_cur_editor_cartoon_level_id);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Space();

        EditorGUILayout.BeginHorizontal();

        if (GUILayout.Button("创建漫画"))
        {
            this.CreateNewLevel();
            EditorUtility.SetDirty(this);
            this.ShowNotification(new GUIContent("请用鼠标选中漫画编辑器"));
        }

        if (null != m_template_names)
        {
            m_selected_template_id = EditorGUILayout.IntPopup("模板id", m_selected_template_id, m_template_names, m_template_ids);
        }


        //if(EditorGUILayout.IntPopup)

        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Space();

        EditorGUILayout.BeginHorizontal();

        if (GUILayout.Button("保存当前漫画"))
        {
            this.SaveLevelJson();
            EditorUtility.SetDirty(this);
        }

        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Space();

        EditorGUILayout.BeginHorizontal();

        if (GUILayout.Button("加载指定漫画"))
        {
            CartoonLevelWindow level_win = CartoonLevelWindow.CreateWindow();
            level_win.OnLevelSelected = OnLoadLevel;
            EditorUtility.SetDirty(this);
        }

        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Space();
        EditorGUILayout.Space();
        EditorGUILayout.Space();
        EditorGUILayout.Space();

        EditorGUILayout.BeginHorizontal();

        if (GUILayout.Button("导出全部数据(程序用)"))
        {
            CartoonJsonUtil.SaveAllJsonData();
            this.ShowNotification(new GUIContent("全部数据导出完毕"));
        }

        EditorGUILayout.EndHorizontal();

        //if (GUILayout.Button("添加分页"))
        //{
        //    AddDataPage();
        //}
        //if (GUILayout.Button("删除分页"))
        //{
        //    RemoveDataPage();
        //}

        //EditorGUILayout.EndHorizontal();

        //EditorGUILayout.BeginHorizontal();
        //if (GUILayout.Button("添加物品"))
        //{
        //    AddItem();
        //}
        //if (GUILayout.Button("添加节点"))
        //{
        //    AddItemNode();
        //}
        //if (GUILayout.Button("移除物品"))
        //{
        //    RemoveItem();
        //}
        //if (GUILayout.Button("输出"))
        //{
        //    SaveItem();
        //}

        //if (GUILayout.Button("提取场景光照"))
        //{
        //    SceneBake();
        //}

        //EditorGUILayout.EndHorizontal();

        //#region 具体物品
        //EditorGUILayout.BeginHorizontal();

        //EditorGUILayout.BeginVertical();
        //itemBeginScroll = EditorGUILayout.BeginScrollView(itemBeginScroll, GUILayout.Width(250), GUILayout.Height(580));
        //InitItem();
        //EditorGUILayout.EndScrollView();
        //EditorGUILayout.EndVertical();

        //GUILayout.BeginVertical();
        //itemInfoBenginScroll = EditorGUILayout.BeginScrollView(itemInfoBenginScroll, GUILayout.Width(550), GUILayout.Height(580));
        //ItemClick(selectItem);
        //EditorGUILayout.EndScrollView();
        //GUILayout.EndVertical();

        //EditorGUILayout.EndHorizontal();
        //#endregion
        EditorGUILayout.EndVertical();
    }
Exemple #5
0
 void Init()
 {
     m_names = CartoonJsonUtil.GetLevelJsonFileNamesWithoutEx();
 }