Exemplo n.º 1
0
        static private void Set()
        {
            string __airFileName = Path.Combine(Directories.AirClientFolder, _AirGeneratedContent);

            if (File.Exists(__airFileName))
            {
                _champions     = new ChampionsList();
                _runes         = new RunesList();
                _maps          = new MapsList();
                _featuredGames = new FeaturedGamesList();
                _spells        = new SpellsList();
                _items         = new GameItemList();
                Tools.Swf.SwfReader __swfReader = new Tools.Swf.SwfReader(__airFileName);
                __swfReader.DeCompile();
                if (__swfReader.CompilationUnit.IsValid)
                {
                    if (__swfReader.CompilationUnit.Symbols.Count > 0)
                    {
                        foreach (ISwfTag __iSwfTag in __swfReader.CompilationUnit.Tags)
                        {
                            if (__iSwfTag is DoABCTag)
                            {
                                DoABCTag _abctag = (DoABCTag)__iSwfTag;
                                foreach (KeyValuePair <uint, AS3_Class> __class in _abctag.Classes)
                                {
                                    if (__class.Value.classname is RTQName)
                                    {
                                        switch (((RTQName)__class.Value.classname).Name)
                                        {
                                        case "ChampionGeneratedData":
                                            foreach (KeyValuePair <uint, AS3_MethodInfo> __member in __class.Value.traits.methods)
                                            {
                                                List <object[]> __results = GetParams(__member.Value, "createChampion");
                                                if (__results.Count > 0)
                                                {
                                                    foreach (object[] __result in __results)
                                                    {
                                                        _champions.Add(new Champion(__result));
                                                    }
                                                }
                                            }
                                            break;

                                        case "RuneGeneratedData":
                                            foreach (KeyValuePair <uint, AS3_MethodInfo> __member in __class.Value.traits.methods)
                                            {
                                                List <object[]> __results = GetParams(__member.Value, "createRune");
                                                if (__results.Count > 0)
                                                {
                                                    foreach (object[] __result in __results)
                                                    {
                                                        _runes.Add(new Rune(__result));
                                                    }
                                                }
                                            }
                                            break;

                                        case "MapGeneratedData":
                                            foreach (KeyValuePair <uint, AS3_MethodInfo> __member in __class.Value.traits.methods)
                                            {
                                                List <object[]> __results = GetParams(__member.Value, "createMap");
                                                if (__results.Count > 0)
                                                {
                                                    foreach (object[] __result in __results)
                                                    {
                                                        _maps.Add(new Map(__result));
                                                    }
                                                }
                                            }
                                            break;

                                        case "FeaturedGameGeneratedData":
                                            foreach (KeyValuePair <uint, AS3_MethodInfo> __member in __class.Value.traits.methods)
                                            {
                                                List <object[]> __results = GetParams(__member.Value, "createFeaturedGame");
                                                if (__results.Count > 0)
                                                {
                                                    foreach (object[] __result in __results)
                                                    {
                                                        _featuredGames.Add(new FeaturedGame(__result));
                                                    }
                                                }
                                            }
                                            break;

                                        case "SpellGeneratedData":
                                            foreach (KeyValuePair <uint, AS3_MethodInfo> __member in __class.Value.traits.methods)
                                            {
                                                List <object[]> __results = GetParams(__member.Value, "createSpell");
                                                if (__results.Count > 0)
                                                {
                                                    foreach (object[] __result in __results)
                                                    {
                                                        _spells.Add(new Spell(__result));
                                                    }
                                                }
                                            }
                                            break;

                                        case "GameItemGeneratedData":
                                            foreach (KeyValuePair <uint, AS3_MethodInfo> __member in __class.Value.traits.methods)
                                            {
                                                List <object[]> __results = GetParams(__member.Value, "createGameItem");
                                                if (__results.Count > 0)
                                                {
                                                    foreach (object[] __result in __results)
                                                    {
                                                        _items.Add(new GameItem(__result));
                                                    }
                                                }
                                            }
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
    private void BuildFreshGameItemList(Dictionary <string, SlotSprite> slotTypes)
    {
        GameItemList.Clear();
        foreach (SlotSprite ss in slotTypes.Values)
        {
            for (int i = 0; i < ColumnCount; i++)
            {
                Item item = new Item();
                item.ItemIcon        = ss.sprite;
                item.ItemName        = ss.spriteName + i;
                item.ItemTile.sprite = item.ItemIcon;
                switch (ss.spriteName)
                {
                case "Bones":
                    item.ItemType = ItemType.Bones;
                    break;

                case "Book":
                    item.ItemType = ItemType.Book;
                    break;

                case "Cake":
                    item.ItemType = ItemType.Cake;
                    break;

                case "Chest":
                    item.ItemType = ItemType.Chest;
                    break;

                case "Compass":
                    item.ItemType = ItemType.Compass;
                    break;

                case "Gem":
                    item.ItemType = ItemType.Gem;
                    break;

                case "Heart":
                    item.ItemType = ItemType.Heart;
                    break;

                case "Hourglass":
                    item.ItemType = ItemType.Hourglass;
                    break;

                case "Key":
                    item.ItemType = ItemType.Key;
                    break;

                case "Pendant":
                    item.ItemType = ItemType.Pendant;
                    break;

                case "Potion":
                    item.ItemType = ItemType.Potion;
                    break;

                case "Present":
                    item.ItemType = ItemType.Present;
                    break;

                case "Scroll":
                    item.ItemType = ItemType.Scroll;
                    break;

                case "Star":
                    item.ItemType = ItemType.Star;
                    break;

                default:
                    Debug.LogError("Unknown item name/key: " + ss.spriteName);
                    break;
                }

                GameItemList.Add(item);
            }
        }
    }