Exemplo n.º 1
0
    static void Init()
    {
        soundData = ScriptableObject.CreateInstance <SoundData>();
        soundData.LoadData();
        SoundTool window = (SoundTool)EditorWindow.GetWindow <SoundTool>(false, "Sound Tool");

        window.Show();
    }
Exemplo n.º 2
0
    static void Int()
    {
        soundData = CreateInstance <SoundData>();
        soundData.LoadData();

        SoundTool window = GetWindow <SoundTool>(false, "Sound Tool");

        window.Show();
    }
Exemplo n.º 3
0
 public static SoundData SoundData()
 {
     if (soundData == null)
     {
         soundData = ScriptableObject.CreateInstance <SoundData>();
         soundData.LoadData();
     }
     return(soundData);
 }
    static void init()
    {
        soundData = ScriptableObject.CreateInstance <SoundData>();
        soundData.LoadData();

        //EffectTool 클래스를 생성하여 보여줌
        SoundTool window = GetWindow <SoundTool>(false, "Sound Tool");

        window.Show();
    }
Exemplo n.º 5
0
 // Start is called before the first frame update
 void Start()
 {
     if (effectData == null)
     {
         effectData = ScriptableObject.CreateInstance <EffectData>();
         effectData.LoadData();
     }
     if (soundData == null)
     {
         soundData = ScriptableObject.CreateInstance <SoundData>();
         soundData.LoadData();
     }
 }
Exemplo n.º 6
0
    private void Start()
    {
        entityData = (EntityTable)Resources.Load("Data/EntityTable");

        foreach (EntityTable.Sheet sheet in entityData.sheets)
        {
            foreach (EntityTable.Param param in sheet.list)
            {
                Debug.Log(param.ToString());
                entityTable.Add(param.ID, new EntityModel(param.ID, param.HP));
            }
        }

        if (soundData == null)
        {
            soundData = ScriptableObject.CreateInstance <SoundData>();
            soundData.LoadData();
        }
    }
Exemplo n.º 7
0
    private void Start()
    {
        entityTable = (EntityTable)Resources.Load("Data/EntityTable");
        int i = 0;

        foreach (EntityTable.Sheet s in entityTable.sheets)
        {
            foreach (EntityTable.Param p in s.list)
            {
                Debug.LogWarning(i + " /  " + p.ID + " / " + p.EntityCategory.ToString() + " / " + p.EntityType.ToString() + "/" + p.Prefab);
                entityData.Add(p.ID, new EntityData(p.ID, p.EntityCategory, p.EntityType, p.HP, p.Level, p.AttackPower, p.SearchRange, p.AttackSpeed, p.Prefab));
                i++;
            }
        }

        if (soundData == null)
        {
            soundData = ScriptableObject.CreateInstance <SoundData>();
            soundData.LoadData();
        }
    }
Exemplo n.º 8
0
    private void OnGUI()
    {
        if (soundData == null)
        {
            return;
        }
        EditorGUILayout.BeginVertical();
        {
            UnityObject source = soundSource;
            EditorHelper.EditorToolTopLayer(soundData, ref selection, ref source, uiWidthMiddle);
            soundSource = (AudioClip)source;

            EditorGUILayout.BeginHorizontal();
            {
                EditorHelper.EditorToolListLayer(ref SP1, soundData, ref selection, ref source, uiWidthMiddle);
                //SoundClip sound = soundData.soundClips[selection];
                soundSource = (AudioClip)source;

                EditorGUILayout.BeginVertical();
                {
                    this.SP2 = EditorGUILayout.BeginScrollView(this.SP2);
                    {
                        if (soundData.GetDataCount() > 0)
                        {
                            EditorGUILayout.BeginVertical();
                            {
                                EditorGUILayout.Separator();
                                SoundClip sound = soundData.soundClips[selection];
                                EditorGUILayout.LabelField("ID", selection.ToString(), GUILayout.Width(uiWidthLarge));
                                soundData.names[selection] = EditorGUILayout.TextField("Name", soundData.names[selection], GUILayout.Width(uiWidthLarge));
                                sound.playType             = (SoundPlayType)EditorGUILayout.EnumPopup("PlayType", sound.playType, GUILayout.Width(uiWidthLarge));
                                sound.maxVolume            = EditorGUILayout.FloatField("Max Volume", sound.maxVolume, GUILayout.Width(uiWidthLarge));
                                sound.isLoop = EditorGUILayout.Toggle("LoopClip", sound.isLoop, GUILayout.Width(uiWidthLarge));
                                EditorGUILayout.Separator();

                                if (this.soundSource == null && sound.soundName != string.Empty)
                                {
                                    this.soundSource = Resources.Load(sound.soundPath + sound.soundName) as AudioClip;
                                }
                                this.soundSource = (AudioClip)EditorGUILayout.ObjectField("Audio Clip", this.soundSource, typeof(AudioClip), false, GUILayout.Width(uiWidthLarge));
                                if (soundSource != null)
                                {
                                    sound.soundPath    = EditorHelper.GetPath(soundSource);
                                    sound.soundName    = soundSource.name;
                                    sound.pitch        = EditorGUILayout.Slider("pitch", sound.pitch, -3.0f, 3.0f, GUILayout.Width(uiWidthLarge));
                                    sound.dopplerLevel = EditorGUILayout.Slider("doppler", sound.dopplerLevel, 0.0f, 5.0f, GUILayout.Width(uiWidthLarge));
                                    sound.rolloffMode  = (AudioRolloffMode)EditorGUILayout.EnumPopup("volume Rolloff", sound.rolloffMode, GUILayout.Width(uiWidthLarge));
                                    sound.minDistance  = EditorGUILayout.FloatField("min Distance", sound.minDistance, GUILayout.Width(uiWidthLarge));
                                    sound.maxDistance  = EditorGUILayout.FloatField("max Distance", sound.maxDistance, GUILayout.Width(uiWidthLarge));
                                    sound.spatialBlend = EditorGUILayout.Slider("PanLever", sound.spatialBlend, 0.0f, 1.0f, GUILayout.Width(uiWidthLarge));
                                }
                                else
                                {
                                    sound.soundName = string.Empty;
                                    sound.soundPath = string.Empty;
                                }
                                EditorGUILayout.Separator();
                                if (GUILayout.Button("Add Loop", GUILayout.Width(uiWidthMiddle)))
                                {
                                    soundData.soundClips[selection].AddLoop();
                                }
                                for (int i = 0; i < soundData.soundClips[selection].checkTime.Length; i++)
                                {
                                    EditorGUILayout.BeginVertical("box");
                                    {
                                        GUILayout.Label("Loop step " + i, EditorStyles.boldLabel);
                                        if (GUILayout.Button("Remove", GUILayout.Width(uiWidthMiddle)))
                                        {
                                            soundData.soundClips[selection].RemoveLoop(i);
                                            return;
                                        }

                                        sound.checkTime[i] = EditorGUILayout.FloatField("check Time", sound.checkTime[i], GUILayout.Width(uiWidthMiddle));
                                        sound.setTime[i]   = EditorGUILayout.FloatField("Set Time", sound.setTime[i], GUILayout.Width(uiWidthMiddle));
                                    }
                                    EditorGUILayout.EndVertical();
                                }
                            }
                            EditorGUILayout.EndVertical();
                        }
                    }
                    EditorGUILayout.EndScrollView();////////////
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndHorizontal();
        }
        EditorGUILayout.EndVertical();

        EditorGUILayout.Separator();
        //
        EditorGUILayout.BeginHorizontal();
        {
            if (GUILayout.Button("Reload"))
            {
                soundData = CreateInstance <SoundData>();
                soundData.LoadData();
                selection        = 0;
                this.soundSource = null;
            }
            if (GUILayout.Button("Save"))
            {
                soundData.SaveData();
                CreateEnumStructure();
                AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
            }
        }
        EditorGUILayout.EndHorizontal();
    }
Exemplo n.º 9
0
    private void OnGUI()
    {
        if (SoundTool.soundData == null)
        {
            return;
        }

        EditorGUILayout.BeginVertical();
        {
            //Add, Copy, Remove 버튼 영역
            EditorGUILayout.BeginHorizontal();
            {
                //200 pixel add button
                if (GUILayout.Button("Add", GUILayout.Width(WidthMiddle)))
                {
                    SoundTool.soundData.AddSound("NewSound");
                    this.selection   = SoundTool.soundData.GetDataCount() - 1;
                    this.soundSource = null;
                    GUI.FocusControl("ID");
                }
                GUI.SetNextControlName("Copy");
                if (GUILayout.Button("Copy", GUILayout.Width(WidthMiddle)))
                {
                    GUI.FocusControl("Copy");
                    SoundTool.soundData.CopyData(this.selection);
                    this.soundSource = null;
                    this.selection   = SoundTool.soundData.GetDataCount() - 1;
                }
                if (SoundTool.soundData.GetDataCount() > 1)
                {
                    GUI.SetNextControlName("Remove");
                    if (GUILayout.Button("Remove", GUILayout.Width(WidthMiddle)))
                    {
                        GUI.FocusControl("Remove");
                        this.soundSource = null;
                        SoundTool.soundData.RemoveData(this.selection);
                    }
                }
            }
            EditorGUILayout.EndHorizontal();

            //가운데부분 UI 영역
            EditorGUILayout.BeginHorizontal();
            {
                //data list -> selection grid...
                EditorGUILayout.BeginVertical(GUILayout.Width(WidthLarge));
                {
                    EditorGUILayout.Separator();
                    EditorGUILayout.BeginVertical("box");
                    {
                        this.ScrollPoint1 = EditorGUILayout.BeginScrollView(this.ScrollPoint1);
                        {
                            if (SoundTool.soundData.GetDataCount() > 0)
                            {
                                int prevSelection = this.selection;
                                this.selection = GUILayout.SelectionGrid(this.selection, SoundTool.soundData.GetNameList(true), 1);
                                if (prevSelection != selection)
                                {
                                    this.soundSource = null;
                                }
                            }
                        }
                        EditorGUILayout.EndScrollView();
                    }
                    EditorGUILayout.EndVertical();
                }
                EditorGUILayout.EndVertical();

                //상세 설정 수정하는 UI 영역
                EditorGUILayout.BeginVertical();
                {
                    this.ScrollPoint2 = EditorGUILayout.BeginScrollView(this.ScrollPoint2);
                    {
                        if (SoundTool.soundData.GetDataCount() > 0)
                        {
                            EditorGUILayout.BeginVertical();
                            {
                                EditorGUILayout.Separator();
                                GUI.SetNextControlName("ID");
                                EditorGUILayout.LabelField("ID", this.selection.ToString(), GUILayout.Width(WidthLarge));
                                SoundTool.soundData.names[selection] = EditorGUILayout.TextField("Name", SoundTool.soundData.names[selection], GUILayout.Width(WidthXLarge));
                                SoundTool.soundData.soundClips[selection].PlayType  = (SoundPlayType)EditorGUILayout.EnumPopup("PlayType", SoundTool.soundData.soundClips[selection].PlayType, GUILayout.Width(WidthLarge));
                                SoundTool.soundData.soundClips[selection].MaxVolume = EditorGUILayout.FloatField("Volume", SoundTool.soundData.soundClips[selection].MaxVolume, GUILayout.Width(WidthXLarge));
                                SoundTool.soundData.soundClips[selection].IsLoop    = EditorGUILayout.Toggle("Loop Clip", SoundTool.soundData.soundClips[selection].IsLoop, GUILayout.Width(WidthLarge));

                                EditorGUILayout.Separator();
                                if (soundSource == null && SoundTool.soundData.soundClips[selection].ClipName != string.Empty)
                                {
                                    soundSource = SoundTool.soundData.soundClips[selection].GetClip();
                                }
                                soundSource = (AudioClip)EditorGUILayout.ObjectField("Audio Clip", this.soundSource, typeof(AudioClip), false, GUILayout.Width(WidthLarge));
                                if (soundSource != null)
                                {
                                    SoundTool.soundData.soundClips[selection].ClipPath         = EditorHelper.GetPath(this.soundSource);
                                    SoundTool.soundData.soundClips[selection].ClipName         = this.soundSource.name;
                                    SoundTool.soundData.soundClips[selection].Pitch            = EditorGUILayout.Slider("Pitch", SoundTool.soundData.soundClips[selection].Pitch, -3.0f, 3.0f, GUILayout.Width(WidthXLarge));
                                    SoundTool.soundData.soundClips[selection].DopplerLevel     = EditorGUILayout.Slider("DopplerLevel", SoundTool.soundData.soundClips[selection].DopplerLevel, 0.0f, 5.0f, GUILayout.Width(WidthXLarge));
                                    SoundTool.soundData.soundClips[selection].audioRolloffMode = (AudioRolloffMode)EditorGUILayout.EnumPopup("RollOffMode", SoundTool.soundData.soundClips[selection].audioRolloffMode, GUILayout.Width(WidthXLarge));
                                    SoundTool.soundData.soundClips[selection].MinDistance      = EditorGUILayout.FloatField("MinDistance", SoundTool.soundData.soundClips[selection].MinDistance, GUILayout.Width(WidthXLarge));
                                    SoundTool.soundData.soundClips[selection].MaxDistance      = EditorGUILayout.FloatField("MaxDistance", SoundTool.soundData.soundClips[selection].MaxDistance, GUILayout.Width(WidthXLarge));
                                    SoundTool.soundData.soundClips[selection].SpatialBlend     = EditorGUILayout.Slider("Spatial Blend", SoundTool.soundData.soundClips[selection].SpatialBlend, 0.0f, 1.0f, GUILayout.Width(WidthXLarge));
                                }
                                else
                                {
                                    SoundTool.soundData.soundClips[selection].ClipName = string.Empty;
                                    SoundTool.soundData.soundClips[selection].ClipPath = string.Empty;
                                }
                                EditorGUILayout.Separator();
                                if (GUILayout.Button("Add Loop", GUILayout.Width(WidthLarge)))
                                {
                                    SoundTool.soundData.soundClips[selection].AddLoop();
                                }
                                for (int i = 0; i < SoundTool.soundData.soundClips[selection].CheckTime.Length; i++)
                                {
                                    EditorGUILayout.BeginVertical("box");
                                    {
                                        GUILayout.Label("Loop Step" + i, EditorStyles.boldLabel);
                                        if (GUILayout.Button("Remove", GUILayout.Width(WidthMiddle)))
                                        {
                                            SoundTool.soundData.soundClips[selection].RemoveLoop(i);
                                            return;
                                        }
                                        SoundTool.soundData.soundClips[selection].CheckTime[i] = EditorGUILayout.FloatField("CheckTime" + i.ToString(), SoundTool.soundData.soundClips[selection].CheckTime[i], GUILayout.Width(WidthXLarge));
                                        SoundTool.soundData.soundClips[selection].SetTime[i]   = EditorGUILayout.FloatField("SetTime" + i.ToString(), SoundTool.soundData.soundClips[selection].SetTime[i], GUILayout.Width(WidthXLarge));
                                    }
                                    EditorGUILayout.EndVertical();
                                }
                            }
                            EditorGUILayout.EndVertical();
                        }
                    }
                    EditorGUILayout.EndScrollView();
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndHorizontal();
        }
        EditorGUILayout.EndVertical();

        //하단 버튼 영역.
        EditorGUILayout.Separator();
        EditorGUILayout.BeginHorizontal();
        {
            GUI.SetNextControlName("Reload");
            if (GUILayout.Button("Reload"))
            {
                GUI.FocusControl("Reload");
                soundData = ScriptableObject.CreateInstance <SoundData>();
                soundData.LoadData();
                selection        = 0;
                this.soundSource = null;
            }
            GUI.SetNextControlName("Save");
            if (GUILayout.Button("Save"))
            {
                GUI.FocusControl("Save");
                SoundTool.soundData.SaveData();
                AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
            }
            if (SoundTool.soundData.soundClips.Length > 1)
            {
                GUI.SetNextControlName("Import");
                if (GUILayout.Button("Import"))
                {
                    GUI.FocusControl("Import");
                    CreateEnumStructure();
                    AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
                }
            }
        }
        EditorGUILayout.EndHorizontal();
    }