public bool AddDressObject(string id, GameObject go)
        {
            if (m_DressObjectDic.ContainsKey(id))
            {
                return(false);
            }

            CocoLoad.SetParent(go, transform);
            RebindModelBone(go);
            m_DressObjectDic.Add(id, go);
            return(true);
        }
Exemple #2
0
        public TModule AddModule <TModule> (CocoModuleBase module, object moduleId = null) where TModule : CocoModuleBase
        {
            Dictionary <object, CocoModuleBase> moduleDic = GetModuleDic <TModule> ();
            string moduleKey = GetModuleKeyById(ref moduleId);

            if (moduleDic.ContainsKey(moduleKey))
            {
                Debug.LogErrorFormat("{0}->AddModule: can NOT add module [{1}<{2}>], because the one with same id already exists!", GetType(), moduleId, module.GetType().Name);
                return(null);
            }

            if (module.transform.parent != transform)
            {
                CocoLoad.SetParent(module, transform);
            }

            // init module
            CocoRoot.BindValue <TModule> ((TModule)module, moduleId);
            module.Init(moduleId);
            moduleDic.Add(moduleKey, module);

            return((TModule)module);
        }