Esempio n. 1
0
 private void Compare(CompareResultDto dto)
 {
     transform.DOScale(Vector3.one, 0.3f).OnComplete(() => {
         StartCoroutine(Delay());
     });
     // 显示牌
     for (int i = 0; i < dto.winDto.cardLidt.Count; i++)
     {
         win.imgCardArr[i].sprite = ResourcesManager.LoadCardSprite(dto.winDto.cardLidt[i].Name);
     }
     win.txtName.text = dto.winDto.name;
     for (int i = 0; i < dto.loseDto.cardLidt.Count; i++)
     {
         lose.imgCardArr[i].sprite = ResourcesManager.LoadCardSprite(dto.loseDto.cardLidt[i].Name);
     }
     lose.txtName.text = dto.loseDto.name;
 }
    private void Compare(CompareResultDto dto)
    {
        GetComponent <RectTransform>().DOScale(Vector3.one, 0.3f).OnComplete(() =>
        {
            StartCoroutine(Dealy());
        });
        for (int i = 0; i < dto.winDto.cardList.Count; i++)
        {
            m_Win.cards[i].sprite = ResourcesManager.LoadCardSprite(dto.winDto.cardList[i].CardName);
        }
        m_Win.txt_UserName.text = dto.winDto.userName;

        for (int i = 0; i < dto.loseDto.cardList.Count; i++)
        {
            m_Lose.cards[i].sprite = ResourcesManager.LoadCardSprite(dto.loseDto.cardList[i].CardName);
        }
        m_Lose.txt_UserName.text = dto.loseDto.userName;
    }
Esempio n. 3
0
        /// <summary>
        /// Compares the data that was stored based on the request id that is provided.
        /// </summary>
        /// <param name="id">Request id.</param>
        /// <returns><see cref="CompareResultDto"/> containt information about the differences between two sides.</returns>
        public async Task <CompareResultDto> Compare(int id)
        {
            CompareDto dto = await GetAsync(id);

            if (dto.Left == null || dto.Right == null)
            {
                return(new CompareResultDto {
                    Status = Status.Unknown
                });
            }

            if (dto.Left.Length > dto.Right.Length)
            {
                return(new CompareResultDto {
                    Status = Status.Left
                });
            }

            if (dto.Right.Length > dto.Left.Length)
            {
                return(new CompareResultDto {
                    Status = Status.Right
                });
            }

            byte[] left  = Convert.FromBase64String(dto.Left);
            byte[] right = Convert.FromBase64String(dto.Right);

            CompareResultDto result = new CompareResultDto {
                Status = Status.Equal
            };

            for (int i = 0; i < left.Length; i++)
            {
                if (left[i] != right[i])
                {
                    result.Offsets.Add(i);
                }
            }

            return(result);
        }
        public async Task <CompareResultDto <Character> > CompareAsync()
        {
            var compareResultDto = new CompareResultDto <Character>();
            var sqlData          = await this._sqlCharacterRepository.GetByFamily("華山派");

            var esData = await this._esCharacterRepository.GetByFamily("華山派");

            var compareDetail = new CompareDetailDto <Character>()
            {
                Method            = nameof(ICharacterRepository.GetByFamily),
                Description       = "找出所有華山派的人物",
                SqlData           = sqlData,
                ElasticSearchData = esData,
                IsSame            = IsSame(sqlData, esData)
            };

            compareResultDto.Details.Add(compareDetail);

            return(compareResultDto);
        }