Beispiel #1
0
 public void OnEnable()
 {
     if (target)
     {
         table = (SoundTable)target;
         if (!Application.isPlaying)
         {
             table.Init();
         }
     }
 }
Beispiel #2
0
//	[Button("GetTable")] public string getTableBut = "";
    public static SoundTable GetTable(string p_name)
    {
        SoundTable _table = null;

        if (!tableDict.TryGetValue(p_name, out _table))
        {
            string _path = "SoundTable/" + p_name;
            _table = Resources.Load <SoundTable>(_path);
            if (_table != null)
            {
                string _configName = _table.config.name;
                if (!configDict.ContainsKey(_configName))
                {
                    GetConfig(_configName);
                }

                List <SoundTable> _tableList = _table.config.tableList;
                if (!tableInConfigDict.ContainsKey(_configName))
                {
                    tableInConfigDict.Add(_configName, _tableList);
                }

                Debug.Log("Load Sound Table [" + _table.name + "]");
                tableDict.Add(p_name, _table);

                _tableList.Add(_table);
                _table.Init();
            }
            else
            {
                Debug.LogError("No Sound Table : [Resources/" + _path + "]");
            }
        }

        return(_table);
    }