public void Add( BTree tree ) { if( this.m_mapTree.ContainsKey(tree.m_strName)) { // Debug.LogError("The tree id is exist."); #if UNITY_EDITOR UnityEditor.EditorUtility.DisplayDialog("Error" ,"The tree named " + tree.m_strName + " is already exist.","ok"); #endif return; } this.m_mapTree.Add(tree.m_strName , tree); }
//load data public void Load(string jsontxt) { JsonData json = JsonMapper.ToObject(jsontxt); json = json["trees"]; int count = json.Count; for(int i = 0 ; i<count ; i++) { BTree bt = new BTree(); JsonData data = json[i]; bt.ReadJson(data); this.m_mapTree.Add(bt.m_strName , bt); } }
public void Remove(BTree tree) { if(tree == null ) return; if( this.m_mapTree.ContainsKey(tree.m_strName)) this.m_mapTree.Remove(tree.m_strName); else Debug.LogError("The tree id is not exist."); return; }