Пример #1
0
        public static bool Init()
        {
            bool result;

            try
            {
                PetMgr._configs        = new Dictionary <string, PetConfig>();
                PetMgr._levels         = new Dictionary <int, PetLevel>();
                PetMgr._skillElements  = new Dictionary <int, PetSkillElementInfo>();
                PetMgr._skills         = new Dictionary <int, PetSkillInfo>();
                PetMgr._skillTemplates = new Dictionary <int, PetSkillTemplateInfo>();
                PetMgr._templateIds    = new Dictionary <int, PetTemplateInfo>();
                PetMgr.m_lock          = new ReaderWriterLock();
                PetMgr.rand            = new ThreadSafeRandom();
                result = PetMgr.LoadPetMgr(PetMgr._configs, PetMgr._levels, PetMgr._skillElements, PetMgr._skills, PetMgr._skillTemplates, PetMgr._templateIds);
            }
            catch (Exception exception)
            {
                if (PetMgr.log.IsErrorEnabled)
                {
                    PetMgr.log.Error("PetInfoMgr", exception);
                }
                result = false;
            }
            return(result);
        }
Пример #2
0
 public static bool ReLoad()
 {
     try
     {
         Dictionary <string, PetConfig>         dictionary  = new Dictionary <string, PetConfig>();
         Dictionary <int, PetLevel>             dictionary2 = new Dictionary <int, PetLevel>();
         Dictionary <int, PetSkillElementInfo>  dictionary3 = new Dictionary <int, PetSkillElementInfo>();
         Dictionary <int, PetSkillInfo>         dictionary4 = new Dictionary <int, PetSkillInfo>();
         Dictionary <int, PetSkillTemplateInfo> dictionary5 = new Dictionary <int, PetSkillTemplateInfo>();
         new Dictionary <int, PetTemplateInfo>();
         Dictionary <int, PetTemplateInfo> dictionary6 = new Dictionary <int, PetTemplateInfo>();
         if (PetMgr.LoadPetMgr(dictionary, dictionary2, dictionary3, dictionary4, dictionary5, dictionary6))
         {
             PetMgr.m_lock.AcquireWriterLock(15000);
             try
             {
                 PetMgr._configs        = dictionary;
                 PetMgr._levels         = dictionary2;
                 PetMgr._skillElements  = dictionary3;
                 PetMgr._skills         = dictionary4;
                 PetMgr._skillTemplates = dictionary5;
                 PetMgr._templateIds    = dictionary6;
                 return(true);
             }
             catch
             {
             }
             finally
             {
                 PetMgr.m_lock.ReleaseWriterLock();
             }
         }
     }
     catch (Exception exception)
     {
         if (PetMgr.log.IsErrorEnabled)
         {
             PetMgr.log.Error("PetMgr", exception);
         }
     }
     return(false);
 }