示例#1
0
        public void SetScore(EntityBase loopObj)
        {
            var loop  = (GameLoop)loopObj;
            var maps  = GameHelper.GetLoopMapList(loop.Id);
            var order = GameHelper.GetGameOrder(loop.OrderId);

            loop.Fen1   = 0;
            loop.Fen2   = 0;
            loop.Game1  = 0;
            loop.Game2  = 0;
            loop.Score1 = 0;
            loop.Score2 = 0;
            loop.Team1  = 0;
            loop.Team2  = 0;

            foreach (var item in maps)
            {
                var obj = item as GameLoopMap;
                if (obj != null && (obj.Fen1 > 0 || obj.Fen2 > 0))
                {
                    loop.Fen1  += obj.Fen1;
                    loop.Fen2  += obj.Fen2;
                    loop.Game1 += obj.Game1;
                    loop.Game2 += obj.Game2;
                    if (obj.Game1 > obj.Game2)
                    {
                        loop.Team1++;
                    }
                    else
                    {
                        loop.Team2++;
                    }
                }
            }
            //爱米模式
            if (order.TeamScoreMode == TeamScoreMode.SINGLE_RACE.Id)
            {
                loop.Score1 = order.TeamScoreMode == TeamScoreMode.SINGLE_RACE.Id ? loop.Team1 : Globals.TT_SCORE_WIN;
                loop.Score2 = order.TeamScoreMode == TeamScoreMode.SINGLE_RACE.Id ? loop.Team2 : Globals.TT_SCORE_FAIL;
            }
            else
            {
                if (loop.Team1 > loop.Team2)
                {
                    loop.Score1 = Globals.TT_SCORE_WIN;
                    loop.Score2 = Globals.TT_SCORE_FAIL;
                }
                else if (loop.Team1 < loop.Team2)
                {
                    loop.Score1 = Globals.TT_SCORE_FAIL;
                    loop.Score2 = Globals.TT_SCORE_WIN;
                }
            }
        }