修复蜗牛骑士UI

This commit is contained in:
GL 2024-11-27 22:24:11 +08:00
parent 06e0e9e427
commit 6189bc8807
7 changed files with 2476 additions and 24 deletions

View File

@ -271,7 +271,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 76, y: 10.223022}
m_SizeDelta: {x: -326.27603, y: -75.27033}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &15724800
MonoBehaviour:
@ -610,7 +610,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 55.7, y: 0.000002861023}
m_SizeDelta: {x: 70, y: 28}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &46327286
MonoBehaviour:
@ -3130,7 +3130,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 78.29999}
m_SizeDelta: {x: 84, y: 32}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &260803675
MonoBehaviour:
@ -5116,7 +5116,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &394840204
RectTransform:
m_ObjectHideFlags: 0
@ -5163,9 +5163,38 @@ MonoBehaviour:
m_GameObject: {fileID: 394840203}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8ac9b3977dc52bf479932b58736e30cb, type: 3}
m_Script: {fileID: 11500000, guid: 24c99a049dd7420439581192697ef997, type: 3}
m_Name:
m_EditorClassIdentifier:
btnHelp: {fileID: 0}
btnPut: {fileID: 0}
btnFirst: {fileID: 0}
btnTask: {fileID: 0}
btnClose: {fileID: 0}
btnMei: {fileID: 1842293128}
btnPig: {fileID: 1936380315}
btnDu: {fileID: 1210943764}
btnGang: {fileID: 68346901}
btnBian: {fileID: 64044008}
btnChao: {fileID: 1654813682}
btnLei: {fileID: 1047739254}
btnMie: {fileID: 1842293128}
imgMei: {fileID: 698011691}
imgPig: {fileID: 988505458}
imgDu: {fileID: 887239059}
imgGang: {fileID: 1997931880}
imgBian: {fileID: 781828505}
imgChao: {fileID: 268503738}
imgLei: {fileID: 1223546705}
imgMie: {fileID: 1643329531}
imgMeiQ: {fileID: 1103898572}
imgPigQ: {fileID: 1098833081}
imgDuQ: {fileID: 601459103}
imgGangQ: {fileID: 990496901}
imgBianQ: {fileID: 1381749172}
imgChaoQ: {fileID: 1050191267}
imgLeiQ: {fileID: 356122228}
imgMieQ: {fileID: 2085566819}
--- !u!1 &400264655
GameObject:
m_ObjectHideFlags: 0
@ -5204,7 +5233,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 78.29999}
m_SizeDelta: {x: 84, y: 32}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &400264657
MonoBehaviour:
@ -5579,7 +5608,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 78.29999}
m_SizeDelta: {x: 84, y: 32}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &426538940
MonoBehaviour:
@ -7577,7 +7606,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 78.29999}
m_SizeDelta: {x: 84, y: 32}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &668427515
MonoBehaviour:
@ -7877,7 +7906,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -57, y: 10.223022}
m_SizeDelta: {x: -426.27603, y: -50.270332}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &691726532
MonoBehaviour:
@ -12460,7 +12489,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 55.7, y: 0.000002861023}
m_SizeDelta: {x: 70, y: 28}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1106311624
MonoBehaviour:
@ -12668,7 +12697,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -120.2, y: 0.00009918213}
m_SizeDelta: {x: 64, y: 77}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1109017569
MonoBehaviour:
@ -13380,7 +13409,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 78.29999}
m_SizeDelta: {x: 84, y: 32}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1153843291
MonoBehaviour:
@ -13870,7 +13899,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 55.7, y: 0.000002861023}
m_SizeDelta: {x: 70, y: 28}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1186497991
MonoBehaviour:
@ -14588,7 +14617,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 55.7, y: 0.000002861023}
m_SizeDelta: {x: 70, y: 28}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1235189132
MonoBehaviour:
@ -16194,7 +16223,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 55.7, y: 0.000002861023}
m_SizeDelta: {x: 70, y: 28}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1413792589
MonoBehaviour:
@ -16684,7 +16713,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 38.3, y: -3.9}
m_SizeDelta: {x: 240, y: 45}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1433070521
MonoBehaviour:
@ -16932,7 +16961,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 78.29999}
m_SizeDelta: {x: 84, y: 32}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1476546208
MonoBehaviour:
@ -17777,7 +17806,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 51.19999, y: -39.600098}
m_SizeDelta: {x: 302.89, y: 112}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!114 &1536229429
MonoBehaviour:
@ -18172,7 +18201,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 55.7, y: 0.000002861023}
m_SizeDelta: {x: 70, y: 28}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1553476817
MonoBehaviour:
@ -20283,7 +20312,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 78.29999}
m_SizeDelta: {x: 84, y: 32}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1692645522
MonoBehaviour:
@ -20613,7 +20642,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 55.7, y: 0.000002861023}
m_SizeDelta: {x: 70, y: 28}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1702042053
MonoBehaviour:
@ -22615,7 +22644,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 78.29999}
m_SizeDelta: {x: 84, y: 32}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1898600950
MonoBehaviour:
@ -22756,7 +22785,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 157.70007, y: -158.03}
m_SizeDelta: {x: 200.94, y: 67.04}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!114 &1927887917
MonoBehaviour:
@ -22938,7 +22967,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 55.7, y: 0.000002861023}
m_SizeDelta: {x: 70, y: 28}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1931260876
MonoBehaviour:

View File

@ -0,0 +1,51 @@
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;
public class BetBtn : MonoBehaviour
{
public static BetBtn instance;
public GameObject BetList;
public Button NumBtn;
public Text BetText;
public float BetValue;//投注的值
public float AllBetValue;//投注总值
public Button BetButton;//投注的按钮
// Start is called before the first frame update
void Start()
{
instance = this;
BetList.SetActive(false);
NumBtn.onClick.AddListener(OnClickNumBtn);
BetValue = 50;//默认50
SetBet();
}
// Update is called once per frame
void Update()
{
}
void OnClickNumBtn()
{
BetList.SetActive(true);
}
void SetBet()
{
// 获取所有的Button组件
Button[] buttons = BetList.GetComponentsInChildren<Button>();
// 遍历每一个Button添加点击事件
foreach (Button button in buttons)
{
button.onClick.AddListener(() => {
BetText.text = button.transform.GetComponentInChildren<Text>().text;
BetValue = float.Parse(BetText.text);
BetList.SetActive(false);
});
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f9a6dd727fa0d0341a230e5f9ad4f394
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,143 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class RacingPanel : MonoBehaviour
{
//帮助
public Button btnHelp;
//投入蜗蛋
public Button btnPut;
//冠军记录
public Button btnFirst;
//任务
public Button btnTask;
//关闭
public Button btnClose;
//美队
public Button btnMei;
//蜘蛛侠
public Button btnPig;
//毒液
public Button btnDu;
//钢铁侠
public Button btnGang;
//蝙蝠侠
public Button btnBian;
//超人
public Button btnChao;
//雷神
public Button btnLei;
//灭霸
public Button btnMie;
public RectTransform imgMei;
public RectTransform imgPig;
public RectTransform imgDu;
public RectTransform imgGang;
public RectTransform imgBian;
public RectTransform imgChao;
public RectTransform imgLei;
public RectTransform imgMie;
//当前选中的图片位置
private RectTransform nowImg;
public GameObject imgMeiQ;
public GameObject imgPigQ;
public GameObject imgDuQ;
public GameObject imgGangQ;
public GameObject imgBianQ;
public GameObject imgChaoQ;
public GameObject imgLeiQ;
public GameObject imgMieQ;
//当前选中蜗牛的钱
private GameObject nowObj;
// Start is called before the first frame update
void Start()
{
//美队
btnMei.onClick.AddListener(() =>
{
//更新按钮图片上滑
ImgUpward(imgMei, imgMeiQ);
//当前选中的蜗牛
});
//蜘蛛侠
btnPig.onClick.AddListener(() =>
{
ImgUpward(imgPig, imgPigQ);
});
//毒液
btnDu.onClick.AddListener(() =>
{
ImgUpward(imgDu, imgDuQ);
});
//钢铁侠
btnGang.onClick.AddListener(() =>
{
ImgUpward(imgGang, imgGangQ);
});
//蝙蝠侠
btnBian.onClick.AddListener(() =>
{
ImgUpward(imgBian, imgBianQ);
});
//超人
btnChao.onClick.AddListener(() =>
{
ImgUpward(imgChao, imgChaoQ);
});
//雷神
btnLei.onClick.AddListener(() =>
{
ImgUpward(imgLei, imgLeiQ);
});
//灭霸
btnMie.onClick.AddListener(() =>
{
ImgUpward(imgMie, imgMieQ);
});
}
// Update is called once per frame
void Update()
{
}
private void ImgUpward(RectTransform rec,GameObject obj)
{
//首先判断当前图片是否为空 不为空才处理
if (nowImg!=null)
{
nowImg.localPosition = Vector3.zero;
}
//判断当前选中的游戏对象是否为空 不为空才处理
if (nowObj!=null)
{
nowObj.SetActive(false);
}
//判断是否点击的是同一个按钮
if (nowObj == obj && nowImg == rec)
{
nowImg = null;
nowObj = null;
return;
}
rec.localPosition = new Vector3(0,50,0);
obj.SetActive(true);
//重新赋值
nowImg=rec;
nowObj=obj;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 24c99a049dd7420439581192697ef997
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ca890c8fc56ec5447bffb4df7172807c
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: