Ejemplo n.º 1
0
        public static int getNeedExp(int Exp, int level)
        {
            StrengThenExpInfo strengThenExpInfo = StrengthenMgr.FindStrengthenExpInfo(level + 1);

            if (strengThenExpInfo == null)
            {
                return(0);
            }
            return(strengThenExpInfo.Exp - Exp);
        }
Ejemplo n.º 2
0
        public static bool Init()
        {
            bool result;

            try
            {
                StrengthenMgr.m_lock                 = new ReaderWriterLock();
                StrengthenMgr._strengthens           = new Dictionary <int, StrengthenInfo>();
                StrengthenMgr.m_Refinery_Strengthens = new Dictionary <int, StrengthenInfo>();
                StrengthenMgr.Strengthens_Goods      = new Dictionary <int, StrengthenGoodsInfo>();
                result = StrengthenMgr.LoadStrengthen(StrengthenMgr._strengthens, StrengthenMgr.m_Refinery_Strengthens);
            }
            catch (Exception e)
            {
                //if (StrengthenMgr.log.IsErrorEnabled)
                {
                    StrengthenMgr.log.Error("StrengthenMgr", e);
                }
                result = false;
            }
            return(result);
        }
Ejemplo n.º 3
0
        public static bool ReLoad()
        {
            bool result;

            try
            {
                Dictionary <int, StrengthenInfo>      tempStrengthens          = new Dictionary <int, StrengthenInfo>();
                Dictionary <int, StrengthenInfo>      tempRefineryStrengthens  = new Dictionary <int, StrengthenInfo>();
                Dictionary <int, StrengthenGoodsInfo> tempStrengthenGoodsInfos = new Dictionary <int, StrengthenGoodsInfo>();
                if (StrengthenMgr.LoadStrengthen(tempStrengthens, tempRefineryStrengthens))
                {
                    StrengthenMgr.m_lock.AcquireWriterLock(-1);
                    try
                    {
                        StrengthenMgr._strengthens           = tempStrengthens;
                        StrengthenMgr.m_Refinery_Strengthens = tempRefineryStrengthens;
                        StrengthenMgr.Strengthens_Goods      = tempStrengthenGoodsInfos;
                        result = true;
                        return(result);
                    }
                    catch
                    {
                    }
                    finally
                    {
                        StrengthenMgr.m_lock.ReleaseWriterLock();
                    }
                }
            }
            catch (Exception e)
            {
                //if (StrengthenMgr.log.IsErrorEnabled)
                {
                    StrengthenMgr.log.Error("StrengthenMgr", e);
                }
            }
            result = false;
            return(result);
        }
Ejemplo n.º 4
0
 public static bool ReLoad()
 {
     try
     {
         Dictionary <int, StrengthenInfo>      dictionary  = new Dictionary <int, StrengthenInfo>();
         Dictionary <int, StrengthenInfo>      dictionary2 = new Dictionary <int, StrengthenInfo>();
         Dictionary <int, StrengThenExpInfo>   dictionary3 = new Dictionary <int, StrengThenExpInfo>();
         Dictionary <int, StrengthenGoodsInfo> dictionary4 = new Dictionary <int, StrengthenGoodsInfo>();
         if (StrengthenMgr.LoadStrengthen(dictionary, dictionary2, dictionary3, dictionary4))
         {
             StrengthenMgr.m_lock.AcquireWriterLock(15000);
             try
             {
                 StrengthenMgr._strengthens          = dictionary;
                 StrengthenMgr._Refinery_Strengthens = dictionary2;
                 StrengthenMgr._Strengthens_Exps     = dictionary3;
                 StrengthenMgr._Strengthens_Goods    = dictionary4;
                 return(true);
             }
             catch
             {
             }
             finally
             {
                 StrengthenMgr.m_lock.ReleaseWriterLock();
             }
         }
     }
     catch (Exception exception)
     {
         if (StrengthenMgr.log.IsErrorEnabled)
         {
             StrengthenMgr.log.Error("StrengthenMgr", exception);
         }
     }
     return(false);
 }
Ejemplo n.º 5
0
        public static bool Init()
        {
            bool result;

            try
            {
                StrengthenMgr.m_lock                = new ReaderWriterLock();
                StrengthenMgr._strengthens          = new Dictionary <int, StrengthenInfo>();
                StrengthenMgr._Refinery_Strengthens = new Dictionary <int, StrengthenInfo>();
                StrengthenMgr._Strengthens_Goods    = new Dictionary <int, StrengthenGoodsInfo>();
                StrengthenMgr._Strengthens_Exps     = new Dictionary <int, StrengThenExpInfo>();
                StrengthenMgr.rand = new ThreadSafeRandom();
                result             = StrengthenMgr.LoadStrengthen(StrengthenMgr._strengthens, StrengthenMgr._Refinery_Strengthens, StrengthenMgr._Strengthens_Exps, StrengthenMgr._Strengthens_Goods);
            }
            catch (Exception exception)
            {
                if (StrengthenMgr.log.IsErrorEnabled)
                {
                    StrengthenMgr.log.Error("StrengthenMgr", exception);
                }
                result = false;
            }
            return(result);
        }
Ejemplo n.º 6
0
        public static bool canUpLv(int exp, int level)
        {
            StrengThenExpInfo strengThenExpInfo = StrengthenMgr.FindStrengthenExpInfo(level + 1);

            return(strengThenExpInfo != null && exp >= strengThenExpInfo.Exp);
        }