private static STActivityInfo ConvertToSTActivity(mw.ActivityConfig config)
        {
            STActivityInfo act = new STActivityInfo();

            act.id = config.id;

            List <mw.AchieveConfig> listAchieve = GMTActivityMananger.GetAchieveConfigsByActivityId(act.id);

            if (listAchieve.Count == 0)
            {
                return(null);
            }

            int titleTextId = listAchieve[0].name;

            act.title = TextManager.GetText(titleTextId);

            int descTextId = listAchieve[0].txt;

            act.desc = TextManager.GetText(descTextId);

            act.firstmark = (config.NeedFlag == 1);
            act.order     = config.sortvalue;

            act.quests = new List <STQuestInfo>();

            foreach (var AchieveConfig in listAchieve)
            {
                STQuestInfo quest = ConvertToSTQuest(AchieveConfig);
                act.quests.Add(quest);
            }

            return(act);
        }
        public static bool LoadAcitvity4Client()
        {
            m_listActivity4Client.Clear();
            Dictionary <int, mw.ActivityConfig> dic = GMTActivityMananger.GetTableActivity();

            foreach (var config in dic.Values)
            {
                STActivityInfo act = ConvertToSTActivity(config);
                if (null != act)
                {
                    m_listActivity4Client.Add(act);
                }
            }

            return(true);
        }
        public static string AddNewActivity(string title, string desc, bool firstmark, int order, List <STQuestInfo> quests)
        {
            mw.ActivityConfig configActivity = null;
            if (quests.Count == 0)
            {
                CErrMgr.SetLastErrMsg(EErrType.ERR_ACTIVITY_ACHIEVE_ZERO);
                goto err;
            }

            configActivity = GMTActivityMananger.GetNewConfigActivity();
            if (null == configActivity)
            {
                goto err;
            }

            configActivity.NeedFlag  = (firstmark)?1:0;
            configActivity.sortvalue = order;

            List <mw.AchieveConfig> listAchieve = new List <mw.AchieveConfig>();
            List <mw.RewardConfig>  listReward  = new List <mw.RewardConfig>();

            if (!DoAddQuest(configActivity.id, quests, ref listAchieve, ref listReward))
            {
                goto err;
            }

            int titleTextId = 0;

            if (!string.IsNullOrEmpty(title))
            {
                titleTextId = TextManager.CreateText();
                TextManager.SetText(titleTextId, title);
            }

            int descTextId = 0;

            if (!string.IsNullOrEmpty(desc))
            {
                descTextId = TextManager.CreateText();
                TextManager.SetText(descTextId, desc);
            }

            foreach (var ach in listAchieve)
            {
                ach.name = titleTextId;
                ach.txt  = descTextId;
            }

            // 创建条件满足

            STActivityInfo stActivity = ConvertToSTActivity(configActivity);

            m_listActivity4Client.Add(stActivity);

            GMTActivityMananger.SaveTable();

            string res = JsonConvert.SerializeObject(stActivity);

            return("{\"error\":0, \"data\":" + res + "}");

            // 创建条件不满足, 上方textid 创建还没销毁, 后面补充
err:
            // 销毁 (还没写)
            if (null != configActivity)
            {
                GMTActivityMananger.RemoveActivityNode(configActivity.id);
            }
            return(CErrMgr.GetLastErrMsg());
        }