Example #1
0
        public void Switch <T>(params object[] args) where T : BasicProcess
        {
            if (_processes == null)
            {
                _processes = new Dictionary <string, BasicProcess>();
            }
            //----------------------------------------------------
            var name    = typeof(T).ToString();
            var process = GetProcess(name);

            if (process != null)
            {
                //close old
                if (_currectProcess != null)
                {
                    _currectProcess.EndProcess();
                }
                //----------------------------------------------------
                //open new
                //add by wwh,Look here,there must be wanna pass the args param...
                process.StartProcess(args);

                _currectProcess = process;
            }
        }
Example #2
0
        public void ReleaseAll()
        {
            if (_currectProcess != null)
            {
                _currectProcess = null;
            }

            foreach (var process in _processes)
            {
                process.Value.Release();
            }
            _processes.Clear();
        }
Example #3
0
        private BasicProcess GetProcess(string name)
        {
            BasicProcess process = null;

            if (!_processes.ContainsKey(name))
            {
                //process = Activator.CreateInstance(Type.GetType(string.Format("{0}.{1}", domain, name))) as BasicProcess;
                process = Activator.CreateInstance(Type.GetType(name)) as BasicProcess;
                if (process == null)
                {
                    Debug.LogError("Not Find Process: " + name);
                }
                process.Create();
                _processes.Add(name, process);
            }
            process = _processes[name];

            return(process);
        }