找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 625|回复: 0

DTA让玩家和电脑不能选相同颜色开游戏

[复制链接]
发表于 2024-5-19 15:00:18 | 显示全部楼层 |阅读模式
目前的dta直接拿来编译的话 是可以用相同颜色进游戏的 玩家和玩家不能相同颜色 但是和电脑可以


MultiplayerGameLobby.cs

这个只需要把AIPlayers也加到列表里

           foreach (PlayerInfo player in Players)改为

           foreach (PlayerInfo player in Players.Concat(AIPlayers))


SkirmishLobby.cs

                IEnumerable<PlayerInfo> concatList = Players.Concat(AIPlayers);
                foreach (PlayerInfo pInfo in concatList)
                {
                    //如果位置和颜色都是随机 那么跳过后边的
                    if (pInfo.ColorId == 0 && pInfo.StartingLocation == 0)
                    {
                        continue;
                    }
                //下边这一句可能能简化
                    if ((concatList.Count(p => p.StartingLocation == pInfo.StartingLocation) > 1 && (pInfo.StartingLocation != 0) && concatList.Count(p => p.ColorId == pInfo.ColorId) > 1 && pInfo.ColorId != 0))
                    {
                    //如果位置和颜色都有重复且不是随机 那么提示
                    //英文不好  自己翻译吧

                        return "players 需要选用不同 starting location 及 color.".L10N("Client:Main:StartLocationOccupiedColors");
                    }

                    if (concatList.Count(p => p.StartingLocation == pInfo.StartingLocation) > 1 && pInfo.StartingLocation != 0)
                    {
                    //如果有位置重复且不是随机 那么提示
                        return "players cannot share the same starting location on the selected map.".L10N("Client:Main:StartLocationOccupied");
                    }
                    if (concatList.Count(p => p.ColorId == pInfo.ColorId) > 1 && pInfo.ColorId != 0)
                    {
                    //如果有颜色重复且不是随机 那么提示
                        return "players cannot share the same color.".L10N("Client:Main:SharedColorsNotification");
                    }
                }



您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|Archiver|手机版|管理员邮箱|红警DIY论坛

GMT+8, 2025-1-17 21:54 , Processed in 0.059266 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表