Exemplo n.º 1
0
        private int getMatchLevel(LobbyTemple item, LobbyTemple lobbyTmp)
        {
            int i = 0;

            //把會員的命盤資料與異性會員的資料轉換成陣列提供比對
            string[] pair1OppositeList = item.pair1.Split('.');
            string[] pair1MemberList   = lobbyTmp.pair1.Split('.');
            string[] pair2OppositeList = item.pair2.Split('.');
            string[] pair2MemberList   = lobbyTmp.pair2.Split('.');
            string[] pair3OppositeList = item.pair3.Split('.');
            string[] pair3MemberList   = lobbyTmp.pair3.Split('.');
            string[] pair4OppositeList = item.pair4.Split('.');
            string[] pair4MemberList   = lobbyTmp.pair4.Split('.');
            for (int j = 0; j < pair1OppositeList.Length; j++)
            {
                //比對命盤 並產生速配指數
                for (int k = 0; k < pair1OppositeList.Length; k++)
                {
                    if (pair1OppositeList[j] == pair1MemberList[k])
                    {
                        i++;
                    }
                    if (pair2OppositeList[j] == pair2MemberList[k])
                    {
                        i++;
                    }
                    if (pair3OppositeList[j] == pair3MemberList[k])
                    {
                        i++;
                    }
                    if (pair4OppositeList[j] == pair4MemberList[k])
                    {
                        i++;
                    }
                }
            }
            return(i);
        }
Exemplo n.º 2
0
        private List <LobbyTemple> setMatchLevel(string fid, List <LobbyTemple> list)
        {
            LobbyTemple lobbyTmp = new LobbyTemple();

            //讀取會員本人的資料提供比對
            foreach (var item in list)
            {
                if (item.id == fid)
                {
                    lobbyTmp = item;
                }
            }
            //把會員本人資料去除
            list.Remove(lobbyTmp);
            //比對會員與其他異性會員的速配等級
            foreach (var item in list)
            {
                if (item.id != fid)
                {
                    item.matchLevel = getMatchLevel(item, lobbyTmp);
                }
            }
            return(list);
        }