void Start() { resourceDict.Add("Food", 2f); resourceDict.Add("Science", 4.33f); resourceDict.Add("flugegeheimen", 1f); //Debug.Log("Записи в справочнике"); //foreach (KeyValuePair<string, float> resource in resourceDict) //{ // Debug.Log(resource.Key + " " + resource.Value); //} BuildingsDictionary buildDictionary = BuildingsDictionary.GetInstance(); //foreach(Building building in buildDictionary.dict) //{ // buildingKeyList.Add(building.key); //} //Debug.Log("отправлено сообщение"); Messenger <Dictionary <string, float> > .Broadcast(GameEvents.GUIGameEvent.UPDATE_RESOURCES, resourceDict); //Отправляем список ключей доступных построек //Messenger<List<string>>.Broadcast(GameEvents.CityGUIGameEvent.UPDATE_BUIDING_LIST, buildingKeyList); }
//private BuildingsDictionary() { } public static BuildingsDictionary GetInstance() { if (instance == null) { lock (syncRoot) { if (instance == null) { instance = new BuildingsDictionary(); } } } return(instance); }