Beispiel #1
0
        public float GetDailyGoalPercent(int currentMission)
        {
            MissionInfo levelInfo = GetMissionInfoByMissionId(currentMission);

            if (levelInfo != null)
            {
                return(levelInfo.dailyGoalPercent);
            }
            return(0.34f);
        }
Beispiel #2
0
        public int GetAwardCoin(int currentMission)
        {
            MissionInfo levelInfo = GetMissionInfoByMissionId(currentMission);

            if (levelInfo != null)
            {
                return(levelInfo.AwardCoin);
            }
            return(0);
        }
Beispiel #3
0
        private void Parser(WWW www)
        {
            m_LoadOk = true;
            GuLog.Debug("MissionConfigPath WWW::" + www.error);

            if (www.isDone && (www.error == null || www.error.Length == 0))
            {
                SecurityParser xmlDoc = new SecurityParser();
                GuLog.Debug("MissionConfigPath" + www.text);

                xmlDoc.LoadXml(www.text);
                ArrayList worldXmlList = xmlDoc.ToXml().Children;

                foreach (SecurityElement xeWorld in worldXmlList)
                {
                    if (xeWorld.Tag == "World")
                    {
                        WorldInfo worldInfo = new WorldInfo();
                        worldInfo.ID   = Convert.ToInt32(xeWorld.Attribute("ID"));
                        worldInfo.Type = WorldInfo.WorldTypes.Normal;
                        int type = Convert.ToInt32(xeWorld.Attribute("Type"));
                        if (Enum.IsDefined(typeof(WorldInfo.WorldTypes), type))
                        {
                            worldInfo.Type = (WorldInfo.WorldTypes)type;
                        }
                        worldInfo.Name            = xeWorld.Attribute("Name");
                        worldInfo.Title           = xeWorld.Attribute("Title");
                        worldInfo.Photo           = xeWorld.Attribute("Photo");
                        worldInfo.Preview         = xeWorld.Attribute("Preview");
                        worldInfo.Unlock          = xeWorld.Attribute("Unlock");
                        worldInfo.SleepBackgournd = xeWorld.Attribute("SleepBackgournd");

                        ArrayList sceneXmlList = xeWorld.Children;
                        foreach (SecurityElement xeScene in sceneXmlList)
                        {
                            if (xeScene.Tag == "Scene")
                            {
                                SceneInfo sceneInfo = new SceneInfo();
                                sceneInfo.index      = Convert.ToInt32(xeScene.Attribute("Index"));
                                sceneInfo.strName    = xeScene.Attribute("Name");
                                sceneInfo.TitleBg    = xeScene.Attribute("TitleBg");
                                sceneInfo.TitleColor = xeScene.Attribute("TitleColor");
                                sceneInfo.Icon       = xeScene.Attribute("Icon");
                                sceneInfo.BoxType    = xeScene.Attribute("BoxType");
                                sceneInfo.Preview    = xeScene.Attribute("Preview");
                                sceneInfo.Unlock     = xeScene.Attribute("Unlock");

                                ArrayList storyXmlList = xeScene.Children;

                                foreach (SecurityElement xeMission in storyXmlList)
                                {
                                    if (xeMission.Tag == "Mission")
                                    {
                                        MissionInfo story = new MissionInfo();
                                        story.missionId        = Convert.ToInt32(xeMission.Attribute("Id"));
                                        story.QuestId          = Convert.ToInt32(xeMission.Attribute("QuestId"));
                                        story.strBackground    = xeMission.Attribute("Background");
                                        story.strModel         = xeMission.Attribute("Model");
                                        story.NimIcon          = xeMission.Attribute("NimIcon");
                                        story.MissionName      = xeMission.Attribute("Name");
                                        story.dailyGoalPercent = Convert.ToSingle(xeMission.Attribute("dailyGoalPercent"));
                                        story.AwardCoin        = Convert.ToInt32(xeMission.Attribute("AwardCoin"));
                                        story.Sound            = xeMission.Attribute("Sound");
                                        story.BGM            = xeMission.Attribute("BGM");
                                        story.WaterDrop      = xeMission.Attribute("WaterDrop");
                                        story.WaterDropAudio = xeMission.Attribute("WaterDropAudio");

                                        ArrayList treasureBoxXmlList = xeMission.Children;

                                        foreach (SecurityElement xeTreasure in treasureBoxXmlList)
                                        {
                                            if (xeTreasure.Tag == "TreasureBox")
                                            {
                                                MissionTreasureBox treasure = new MissionTreasureBox();
                                                treasure.BoxId  = Convert.ToInt32(xeTreasure.Attribute("BoxId"));
                                                treasure.Height = Convert.ToInt32(xeTreasure.Attribute("Height"));
                                                story.listTreasureBox.Add(treasure);
                                            }
                                        }

                                        sceneInfo.missionInfos.Add(story);
                                    }
                                }
                                worldInfo.SceneInfos.Add(sceneInfo);
                            }
                        }
                        worldInfos.Add(worldInfo);
                    }
                }
            }

            GuLog.Debug("LoadMissionConfig OK! World:" + worldInfos.Count);
            GuLog.Debug("SceneCount" + worldInfos[0].SceneInfos.Count);
            GuLog.Debug("MissionCount" + worldInfos[0].SceneInfos[0].missionInfos.Count);
        }