Exemplo n.º 1
0
        void ParseTeamGroup(string str)
        {
            string[] groupstrs = str.Split(',');
            int      groupId   = 0;

            foreach (string groupstr in groupstrs)
            {
                if (string.IsNullOrEmpty(groupstr))
                {
                    continue;
                }

                StageLegionGroupConfig groupConfig = new StageLegionGroupConfig();
                groupConfig.id = groupId++;
                legionGroups.Add(groupConfig);

                string[] teamstrs = groupstr.Split(':');
                foreach (string teamstr in teamstrs)
                {
                    if (string.IsNullOrEmpty(teamstr))
                    {
                        continue;
                    }

                    int teamId = teamstr.ToInt32();
                    if (!legionDict.ContainsKey(teamId))
                    {
                        StageLegionConfig teamConfig = new StageLegionConfig();
                        teamConfig.legionId = teamId;
                        teamConfig.groupId  = groupConfig.id;
                        legionDict.Add(teamConfig.legionId, teamConfig);
                        groupConfig.list.Add(teamConfig);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public StageConfig Clone()
        {
            StageConfig item = new StageConfig();

            item.id = id;
            /** 关卡等级 */
            item.level = level;
            /** 名称 */
            item.name = name;
            /** 描述 */
            item.description = description;
            /** 关卡类型 */
            item.type = type;
            /**  */
            item.nextStageId = nextStageId;
            /** 美术资源编号 */
            item.resource = resource;
            /** 胜利条件 */
            item.winId = winId;
            /** Lua */
            item.lua = lua;
            /** 消耗体力 */
            item.costStrength = costStrength;
            /** 限时 */
            item.time = time;
            /** sos */
            item.sos = sos;
            /** 是否显示血条 */
            item.showHP = showHP;
            /** 中立主公等级 */
            item.neutralRoleLevel = neutralRoleLevel;
            /** 星级评价 */
            item.stars = new List <int>(stars).ToArray();
            /** 掉落编号 */
            item.dropId = dropId;


            /** 势力列表 */
            foreach (var legionConfig in legionDict)
            {
                item.legionDict.Add(legionConfig.Key, legionConfig.Value.Clone());
            }


            /** 势力关系 */
            foreach (StageLegionGroupConfig source in legionGroups)
            {
                StageLegionGroupConfig dist = new StageLegionGroupConfig();
                dist.id = source.id;
                foreach (StageLegionConfig legionConfig in source.list)
                {
                    dist.list.Add(item.legionDict[legionConfig.legionId]);
                }

                item.legionGroups.Add(dist);
            }

            /** 建筑列表 */
            foreach (var positionConfig in buildDict)
            {
                item.buildDict.Add(positionConfig.Key, positionConfig.Value.Clone());
            }
            /** 墙列表 */

            foreach (var positionConfig in wallDict)
            {
                item.wallDict.Add(positionConfig.Key, positionConfig.Value.Clone());
            }

            /** 默认自己势力ID */
            item.defaultMyTeam = defaultMyTeam;


            return(item);
        }