示例#1
0
        public List <ProtoRoleFightResult> GetServiceEndData()
        {
            List <ProtoRoleFightResult> list = new List <ProtoRoleFightResult>();

            int buildTotal = War.scene.GetBuilds().Count;

            foreach (var kvp in legionDict)
            {
                LegionData           legionData = kvp.Value.legionData;
                int                  legionId   = legionData.legionId;
                ProtoRoleFightResult result     = new ProtoRoleFightResult();
                result.roleId      = legionData.roleId;
                result.star        = War.overType == OverType.Draw ? 1 :  kvp.Value.GetSuccessStars().Length;
                result.build_count = War.scene.GetBuilds(legionId).Count;
                result.build_total = buildTotal;
                result.team_id     = legionId;



                Debug.LogFormat("GetServiceEndData legionId={0}, result.roleId={1}, type={2}, star={3}, build_count={4}", legionId, result.roleId, legionData.type, result.star, result.build_count);
                if (War.GetRelationType(kvp.Value.legionData.legionId) != RelationType.Enemy)
                {
                    result.end_type = (int)War.overType;
                }
                else
                {
                    OverType overType = OverType.Draw;
                    switch (War.overType)
                    {
                    case OverType.Draw:
                        overType = OverType.Draw;
                        break;

                    case OverType.Lose:
                        overType = OverType.Win;
                        break;

                    case OverType.Win:
                        overType = OverType.Lose;
                        break;
                    }


                    result.end_type = (int)overType;
                }

                list.Add(result);

                //TODO Test
                //result.star = 3;
            }

            return(list);
        }
示例#2
0
        public List <WarOverLegionData> GetOverData()
        {
            List <WarOverLegionData> list = new List <WarOverLegionData>();

            int buildTotal = War.scene.GetBuilds().Count;

            foreach (var kvp in legionDict)
            {
                LegionData        legionData = kvp.Value.legionData;
                int               legionId   = legionData.legionId;
                WarOverLegionData result     = new WarOverLegionData();
                result.legionId   = legionData.legionId;
                result.roleId     = legionData.roleId;
                result.starCount  = kvp.Value.GetSuccessStars().Length;
                result.buildCount = War.scene.GetBuilds(legionId).Count;
                result.buildTotal = buildTotal;
                Debug.LogFormat("GetOverData legionId={0}, result.roleId={1}, type={2}, starCount={3},  buildCount={4}", legionId, result.roleId, legionData.type, result.starCount, result.buildCount);


                if (War.GetRelationType(kvp.Value.legionData.legionId) != RelationType.Enemy)
                {
                    result.overType = War.overType;
                }
                else
                {
                    OverType overType = OverType.Draw;
                    switch (War.overType)
                    {
                    case OverType.Draw:
                        overType = OverType.Draw;
                        break;

                    case OverType.Lose:
                        overType = OverType.Win;
                        break;

                    case OverType.Win:
                        overType = OverType.Lose;
                        break;
                    }


                    result.overType = overType;
                }

                list.Add(result);


                //TODO Test
                //result.starCount = 3;
            }

            return(list);
        }