找回丢失的代码

This commit is contained in:
shenjianxing 2025-05-09 11:13:54 +08:00
parent eccf12950d
commit 53d493d88a
3 changed files with 8 additions and 5 deletions

View File

@ -72,6 +72,9 @@ namespace QFramework.Example
foreach (var item in row.items) foreach (var item in row.items)
{ {
var rightObj = GameObject.Instantiate(RightItem, itemContent); var rightObj = GameObject.Instantiate(RightItem, itemContent);
var nameText = rightObj.transform.Find("Name").GetComponent<TextMeshProUGUI>();
nameText.text = item.name;
nameText.color = Color.white;
rightObj.name = item.pic; rightObj.name = item.pic;
rightObj.transform.Find("PicBg/Pic").GetComponent<Image>().color = new Color(1, 1, 1, 0); rightObj.transform.Find("PicBg/Pic").GetComponent<Image>().color = new Color(1, 1, 1, 0);
rightObj.OnPointerEnterEvent(RightOnEnter); rightObj.OnPointerEnterEvent(RightOnEnter);
@ -121,7 +124,7 @@ namespace QFramework.Example
trans.GetComponent<Image>().color = Color.white; trans.GetComponent<Image>().color = Color.white;
trans.Find("PicBg/Pic").GetComponent<Image>().color = new Color(1, 1, 1, 0); trans.Find("PicBg/Pic").GetComponent<Image>().color = new Color(1, 1, 1, 0);
enterRight.transform.Find("Name").GetComponent<TextMeshProUGUI>().text = string.Empty; enterRight.transform.Find("Name").GetComponent<TextMeshProUGUI>().color = Color.white;
leftAndRightMap.Remove(trans.gameObject); leftAndRightMap.Remove(trans.gameObject);
} }
@ -170,7 +173,7 @@ namespace QFramework.Example
Image img = enterRight.transform.Find("PicBg/Pic").GetComponent<Image>(); Image img = enterRight.transform.Find("PicBg/Pic").GetComponent<Image>();
img.sprite = moveObj.GetComponent<Image>().sprite; img.sprite = moveObj.GetComponent<Image>().sprite;
img.color = Color.white; img.color = Color.white;
nameText.text = itemDatas[leftDragObj].name; //nameText.text = itemDatas[leftDragObj].name;
leftAndRightMap.Add(enterRight, new RightDataItem() { rightObj = leftDragObj, isRight = isRight }); leftAndRightMap.Add(enterRight, new RightDataItem() { rightObj = leftDragObj, isRight = isRight });
leftDragObj.SetActive(false); leftDragObj.SetActive(false);

View File

@ -16,7 +16,7 @@
<Action type="ImageSelectMap" <Action type="ImageSelectMap"
random="false" random="true"
scoreName="" scoreName=""
totalScore="" totalScore=""
rightScore="" rightScore=""
@ -60,7 +60,7 @@
<Row name="紫色"> <Row name="紫色">
<Item name="查罗石" pic="baoshi/查罗石.png"></Item> <Item name="查罗石" pic="baoshi/查罗石.png"></Item>
<Item name="方柱石" pic="baoshi/方柱石.png"></Item> <Item name="方柱石" pic="baoshi/方柱石.png"></Item>
<Item name="合成蓝宝石" pic="baoshi/合成蓝宝石.png"></Item> <Item name="合成蓝宝石(紫)" pic="baoshi/合成蓝宝石(紫).png"></Item>
<Item name="紫晶" pic="baoshi/紫晶.png"></Item> <Item name="紫晶" pic="baoshi/紫晶.png"></Item>
</Row> </Row>
</Action> </Action>

View File

@ -14,7 +14,7 @@
<Enter> <Enter>
<Action type="Sequence"> <Action type="Sequence">
<Action type="ImageSelectMap" <Action type="ImageSelectMap"
random="false" random="true"
scoreName="" scoreName=""
totalScore="" totalScore=""
rightScore="" rightScore=""