using System.Collections.Generic; using Blue; namespace Blue { /// /// 场景IOC容器,用于存储对象、物体 /// public class SceneIOCContainer : BlueSingleton { private Dictionary objContainer = new Dictionary(); 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; } } }