void RefreshFromSpriteFile()
        {
            if (EditorUtility.DisplayDialogComplex("RefreshFromSpriteFile",
                                                   "スプライトからCharaCellデータを再生しますか?",
                                                   "OK", "キャンセル", "") == 0)
            {
                Debug.Log("RefreshFromSpriteFile");
                var newCharCells = new CharaCellObject();

                // 現在のスプライトにあるものを抽出、ない場合は新たに作成
                for (int i = 0; i < m_bodySprites.Length; ++i)
                {
                    string    id   = CharaCell.ReplaceHyphen(m_bodySprites[i].name);
                    CharaCell item = m_charCells.param.FirstOrDefault(x => x.ID == id);
                    if (item == null)
                    {
                        item    = new CharaCell();
                        item.ID = id;
                    }

                    newCharCells.param.Add(item);
                }

                m_charCells = newCharCells;

                UpdateCharaCellDict();

                AssetDatabase.Refresh();
            }
        }
Exemplo n.º 2
0
        public CharaCellObject GetClone()
        {
            CharaCellObject res = CreateInstance <CharaCellObject>();

            foreach (var item in param)
            {
                res.param.Add(item.ShallowCopy());
            }
            return(res);
        }
        void LoadFile()
        {
            Debug.Log("LoadFile");
            m_isLoadData = true;
            var loadtips = AssetDatabase.LoadAssetAtPath <CharaCellObject>(ScriptableObjectFilePath);

            if (loadtips != null)
            {
                m_charCells = loadtips.GetClone();

                UpdateCharaCellDict();
            }
            else
            {
                EditorUtility.DisplayDialog("LoadFile", "読み込めませんでした。\n" + ScriptableObjectFilePath, "ok");
            }

            AssetDatabase.Refresh();
        }