예제 #1
0
        public string GetImage(int id)
        {
            Item item = GetItemById(id);

            if (item == null)
            {
                return(string.Empty);
            }

            string image = string.Empty;

            switch (item.Type)
            {
            case 4:
                NimItem nimInfo = item as NimItem;
                if (nimInfo != null)
                {
                    image = nimInfo.GetImage;
                }
                break;

            case 6:
                PropsItem propsItem = item as PropsItem;
                if (propsItem != null)
                {
                    image = propsItem.GetImage;
                }
                break;
            }
            return(image);
        }
예제 #2
0
        private void Parser(WWW www)
        {
            m_LoadOk = true;

            if (www.isDone && (www.error == null || www.error.Length == 0))
            {
                SecurityParser xmlDoc = new SecurityParser();
                xmlDoc.LoadXml(www.text);
                ArrayList worldXmlList = xmlDoc.ToXml().Children;

                foreach (SecurityElement xeWorld in worldXmlList)
                {
                    if (xeWorld.Tag == "Items")
                    {
                        ArrayList sceneXmlList = xeWorld.Children;
                        foreach (SecurityElement xeScene in sceneXmlList)
                        {
                            if (xeScene.Tag == "Item")
                            {
                                Item sceneInfo = null;
                                int  type      = Convert.ToInt32(xeScene.Attribute("Type"));
                                switch (type)
                                {
                                case 4:
                                {
                                    NimItem nimInfo = new NimItem();
                                    nimInfo.ItemId   = Convert.ToInt32(xeScene.Attribute("Id"));
                                    nimInfo.Type     = type;
                                    nimInfo.Name     = xeScene.Attribute("Name");
                                    nimInfo.GetImage = xeScene.Attribute("getImage");

                                    nimInfo.PetType   = int.Parse(xeScene.Attribute("PetType"));
                                    nimInfo.Image     = xeScene.Attribute("Image");
                                    nimInfo.Audio     = xeScene.Attribute("Audio");
                                    nimInfo.Animation = xeScene.Attribute("Animation");
                                    nimInfo.Preview   = xeScene.Attribute("Preview");
                                    sceneInfo         = nimInfo;
                                }
                                break;

                                case 6:
                                {
                                    PropsItem propsItem = new PropsItem();
                                    propsItem.ItemId   = Convert.ToInt32(xeScene.Attribute("Id"));
                                    propsItem.Type     = type;
                                    propsItem.Name     = xeScene.Attribute("Name");
                                    propsItem.GetImage = xeScene.Attribute("getImage");
                                    sceneInfo          = propsItem;
                                }
                                break;

                                default:
                                {
                                    sceneInfo        = new Item();
                                    sceneInfo.ItemId = Convert.ToInt32(xeScene.Attribute("Id"));
                                    sceneInfo.Type   = type;
                                    sceneInfo.Name   = xeScene.Attribute("Name");
                                }
                                break;
                                }
                                missionInfo.Add(sceneInfo.ItemId, sceneInfo);
                            }
                        }
                    }
                }
            }
        }