using System.Collections.Generic; using Blue; namespace GHZLangChao { /// <summary> /// 场景IOC容器,用于存储对象、物体 /// </summary> public class SceneIOCContainer : BlueSingleton<SceneIOCContainer> { private Dictionary<string, object> objContainer = new Dictionary<string, object>(); public void Push(string objName, object obj) { if (objContainer.ContainsKey(objName)) { objContainer[objName] = obj; } else { objContainer.Add(objName, obj); } } public object Pull(string objName) { if (objContainer.ContainsKey(objName)) { return objContainer[objName]; } return null; } } }