12345678910111213141516171819202122232425262728293031 |
- using System.Collections.Generic;
- using Blue;
- /// <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;
- }
- }
|