Ejemplo n.º 1
0
 private static void ParseMagicManyTimeDmage(Dictionary <int, List <ManyTimeDmageItem> > dict, int id, string manyTimeDmage)
 {
     manyTimeDmage = manyTimeDmage.Trim();
     if (!string.IsNullOrEmpty(manyTimeDmage))
     {
         List <ManyTimeDmageItem> manyTimeDmageItemsList = MagicsManyTimeDmageCachingMgr.ParseItems(id, manyTimeDmage);
         dict[id] = manyTimeDmageItemsList;
     }
 }
Ejemplo n.º 2
0
        public static void ParseManyTimeDmageItems(SystemXmlItems systemMagicMgr)
        {
            Dictionary <int, List <ManyTimeDmageItem> > manyTimeDmageItemsDict = new Dictionary <int, List <ManyTimeDmageItem> >();

            foreach (int key in systemMagicMgr.SystemXmlItemDict.Keys)
            {
                string manyTimeDmage = systemMagicMgr.SystemXmlItemDict[key].GetStringValue("ManyTimeDmage");
                if (null != manyTimeDmage)
                {
                    MagicsManyTimeDmageCachingMgr.ParseMagicManyTimeDmage(manyTimeDmageItemsDict, key, manyTimeDmage);
                }
            }
            MagicsManyTimeDmageCachingMgr.ManyTimeDmageCachingDict = manyTimeDmageItemsDict;
        }
Ejemplo n.º 3
0
        public bool AddManyTimeDmageQueueItemEx(int enemy, int enemyX, int enemyY, int realEnemyX, int realEnemyY, int magicCode)
        {
            Lazy <long> startTicks = new Lazy <long>(() => TimeUtil.NOW());
            Lazy <List <ManyTimeDmageItem> > lazyList = new Lazy <List <ManyTimeDmageItem> >(() => MagicsManyTimeDmageCachingMgr.GetManyTimeDmageItems(magicCode));

            ManyTimeDmageMagicItem itemStatic;
            ManyTimeDmageMagicItem item;

            lock (mutex)
            {
                if (manyTimeDmageQueueItemDict.TryGetValue(magicCode, out item))
                {
                    if (item.itemList == null)
                    {
                        return(false);
                    }
                    else
                    {
                        if (item.Start(startTicks.Value, magicCode, enemy, enemyX, enemyY, realEnemyX, realEnemyY))
                        {
                            execItemDict.Add(item);
                        }

                        return(true);
                    }
                }

                if (!manyTimeDmageQueueItemStaticDict.TryGetValue(magicCode, out itemStatic))
                {
                    itemStatic          = new ManyTimeDmageMagicItem();
                    itemStatic.itemList = lazyList.Value;
                    manyTimeDmageQueueItemStaticDict[magicCode] = itemStatic;
                }

                //如果本对象还未缓存,则先构建一个,并从静态全局字典中查询
                if (!manyTimeDmageQueueItemDict.TryGetValue(magicCode, out item))
                {
                    item          = new ManyTimeDmageMagicItem();
                    item.itemList = itemStatic.itemList;
                    manyTimeDmageQueueItemDict[magicCode] = item;
                }

                if (item.itemList == null)
                {
                    return(false);
                }

                if (item.Start(startTicks.Value, magicCode, enemy, enemyX, enemyY, realEnemyX, realEnemyY))
                {
                    execItemDict.Add(item);
                }

                return(true);
            }
        }
        public bool AddManyTimeDmageQueueItemEx(int enemy, int enemyX, int enemyY, int realEnemyX, int realEnemyY, int magicCode)
        {
            Lazy <long> startTicks = new Lazy <long>(() => TimeUtil.NOW());
            Lazy <List <ManyTimeDmageItem> > lazyList = new Lazy <List <ManyTimeDmageItem> >(() => MagicsManyTimeDmageCachingMgr.GetManyTimeDmageItems(magicCode));
            bool result;

            lock (this.mutex)
            {
                ManyTimeDmageMagicItem item;
                if (this.manyTimeDmageQueueItemDict.TryGetValue(magicCode, out item))
                {
                    if (item.itemList == null)
                    {
                        result = false;
                    }
                    else
                    {
                        if (item.Start(startTicks.Value, magicCode, enemy, enemyX, enemyY, realEnemyX, realEnemyY))
                        {
                            this.execItemDict.Add(item);
                        }
                        result = true;
                    }
                }
                else
                {
                    ManyTimeDmageMagicItem itemStatic;
                    if (!MagicsManyTimeDmageQueue.manyTimeDmageQueueItemStaticDict.TryGetValue(magicCode, out itemStatic))
                    {
                        itemStatic          = new ManyTimeDmageMagicItem();
                        itemStatic.itemList = lazyList.Value;
                        MagicsManyTimeDmageQueue.manyTimeDmageQueueItemStaticDict[magicCode] = itemStatic;
                    }
                    if (!this.manyTimeDmageQueueItemDict.TryGetValue(magicCode, out item))
                    {
                        item          = new ManyTimeDmageMagicItem();
                        item.itemList = itemStatic.itemList;
                        this.manyTimeDmageQueueItemDict[magicCode] = item;
                    }
                    if (item.itemList == null)
                    {
                        result = false;
                    }
                    else
                    {
                        if (item.Start(startTicks.Value, magicCode, enemy, enemyX, enemyY, realEnemyX, realEnemyY))
                        {
                            this.execItemDict.Add(item);
                        }
                        result = true;
                    }
                }
            }
            return(result);
        }