Xamarin Forms:如何为标签添加拖动事件?-单词搜索游戏 [英] Xamarin Forms: How to add dragging event for labels? - Word Search Game

查看:110
本文介绍了Xamarin Forms:如何为标签添加拖动事件?-单词搜索游戏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我的项目实施单词搜索游戏.我已经使用网格和标签(使用视频以获取清晰的想法.我还添加了一个示例项目此处供参考.我需要做以下事情:

  1. 在网格内拖动标签的事件.

  2. 将背景颜色更改为橙​​色(开始拖动时)和绿色(当单词在列表中时).

  3. 找到的单词的勾号.

  4. 捕获总尝试次数,错误尝试次数和正确尝试次数.

解决方案

通过按钮的单击功能实现了单词搜索游戏.使用点击功能时,我们需要检查图案是否正确.我已经在此处上传了一个示例项目,希望对您有所帮助.>

该示例包含以下功能:

  1. 带有从左到右,从右到左,从上到下,从下到上或对角线排列的单词的信箱.此外,隐藏的单词也会在页面底部列出.
  2. 单击字母时,将背景色更改为橙​​色.如果我们按上述任何一种机制单击字母,它将继续将背景色更改为橙​​色.
  3. 找到该单词时,背景颜色变为绿色.如果我们更改图案,我将删除背景色.
  4. 更改颜色并为找到的单词添加刻度线.
  5. 找到所有单词后,添加重新启动选项.

参考:

https://github.com/neetfreek/word-search-generator/blob/master/WordSearch/WordSearch.cs

Xamarin形式:如何为网格中的单击按钮添加背景色(Word搜索游戏)

Xamarin形式:单击时网格按钮UI中断重新启动按钮

I am trying to implement a word search game for my project. I have created the word search letterbox using the grid and label (using this blog). Each letterbox has some words and that words are listed under the letterbox. I need to select the word hidden in the letterbox by dragging the labels. When start dragging the background color changed to orange. If the dragged word is in the words list, change the background color to green. Also, I need to capture the total, right and wrong attempts.

Please watch this video for getting a clear idea. I have also added a sample project here for the reference. I need to do the below things:

  1. Dragging event for labels inside the grid.

  2. Change the background color to orange(when starts dragging) and green(when the word is in the list).

  3. A tickmark for found words.

  4. Capture the total attempts, wrong attempts, and correct attempts.

解决方案

Implemented the word search game with the clicked feature of the button. When using the clicked feature we need to check the pattern is correct or not. I have uploaded a sample project here, hope this will help someone.

The sample contains the following features:

  1. Letterbox with words arranged from left to right, right to left, top to bottom, bottom to top, or diagonally. Also, hidden words are listed on the bottom of the page.
  2. Changing the background color to orange, when clicking a letter. If we click the letters in any of the above mechanisms, it will continue changing the background color to orange.
  3. When the word is found the background color is changing to green. If we change the pattern, I will remove the background color.
  4. Changing the color and adding a tick mark for found words.
  5. When all the words are found, added a restart option.

References:

https://github.com/neetfreek/word-search-generator/blob/master/WordSearch/WordSearch.cs

Xamarin Forms: How to add background color for clicked button inside grid(Word Search Game)

Xamarin Forms: Grid button UI breaks when click restart button

这篇关于Xamarin Forms:如何为标签添加拖动事件?-单词搜索游戏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆