_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/RacingPanel/RacingPanel.cs

170 lines
3.9 KiB
C#
Raw Normal View History

2024-11-27 22:24:11 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class RacingPanel : MonoBehaviour
{
//<2F><><EFBFBD><EFBFBD>
public Button btnHelp;
//Ͷ<><CDB6><EFBFBD>ϵ<EFBFBD>
public Button btnPut;
//<2F>ھ<EFBFBD><DABE><EFBFBD>¼
public Button btnFirst;
//<2F><><EFBFBD><EFBFBD>
public Button btnTask;
//<2F>ر<EFBFBD>
public Button btnClose;
//<2F><><EFBFBD><EFBFBD>
public Button btnMei;
//֩<><D6A9><EFBFBD><EFBFBD>
public Button btnPig;
//<2F><>Һ
public Button btnDu;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public Button btnGang;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public Button btnBian;
//<2F><><EFBFBD><EFBFBD>
public Button btnChao;
//<2F><><EFBFBD><EFBFBD>
public Button btnLei;
//<2F><><EFBFBD><EFBFBD>
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;
//<2F><>ǰѡ<C7B0>е<EFBFBD>ͼƬλ<C6AC><CEBB>
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;
//<2F><>ǰѡ<C7B0><D1A1><EFBFBD><EFBFBD>ţ<EFBFBD><C5A3>Ǯ
private GameObject nowObj;
2024-11-27 23:40:28 +08:00
//<2F><>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͷ<EFBFBD><CDB6>Ǯ
public Text imgMeiT;
public Text imgPigT;
public Text imgDuT;
public Text imgGangT;
public Text imgBianT;
public Text imgChaoT;
public Text imgLeiT;
public Text imgMieT;
public Text AllimgMeiT;
public Text AllimgPigT;
public Text AllimgDuT;
public Text AllimgGangT;
public Text AllimgBianT;
public Text AllimgChaoT;
public Text AllimgLeiT;
public Text AllimgMieT;
2024-11-27 22:24:11 +08:00
// Start is called before the first frame update
void Start()
{
//<2F><><EFBFBD><EFBFBD>
btnMei.onClick.AddListener(() =>
{
//<2F><><EFBFBD>°<EFBFBD>ťͼƬ<CDBC>ϻ<EFBFBD>
ImgUpward(imgMei, imgMeiQ);
//<2F><>ǰѡ<C7B0>е<EFBFBD><D0B5><EFBFBD>ţ
2024-11-27 23:40:28 +08:00
BetBtn.instance.BetHorseId = 1;
2024-11-27 22:24:11 +08:00
});
//֩<><D6A9><EFBFBD><EFBFBD>
btnPig.onClick.AddListener(() =>
{
ImgUpward(imgPig, imgPigQ);
2024-11-27 23:40:28 +08:00
BetBtn.instance.BetHorseId = 2;
2024-11-27 22:24:11 +08:00
});
//<2F><>Һ
btnDu.onClick.AddListener(() =>
{
ImgUpward(imgDu, imgDuQ);
2024-11-27 23:40:28 +08:00
BetBtn.instance.BetHorseId = 3;
2024-11-27 22:24:11 +08:00
});
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
btnGang.onClick.AddListener(() =>
{
ImgUpward(imgGang, imgGangQ);
2024-11-27 23:40:28 +08:00
BetBtn.instance.BetHorseId = 4;
2024-11-27 22:24:11 +08:00
});
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
btnBian.onClick.AddListener(() =>
{
ImgUpward(imgBian, imgBianQ);
2024-11-27 23:40:28 +08:00
BetBtn.instance.BetHorseId = 5;
2024-11-27 22:24:11 +08:00
});
//<2F><><EFBFBD><EFBFBD>
btnChao.onClick.AddListener(() =>
{
ImgUpward(imgChao, imgChaoQ);
2024-11-27 23:40:28 +08:00
BetBtn.instance.BetHorseId = 6;
2024-11-27 22:24:11 +08:00
});
//<2F><><EFBFBD><EFBFBD>
btnLei.onClick.AddListener(() =>
{
ImgUpward(imgLei, imgLeiQ);
2024-11-27 23:40:28 +08:00
BetBtn.instance.BetHorseId = 7;
2024-11-27 22:24:11 +08:00
});
//<2F><><EFBFBD><EFBFBD>
btnMie.onClick.AddListener(() =>
{
ImgUpward(imgMie, imgMieQ);
2024-11-27 23:40:28 +08:00
BetBtn.instance.BetHorseId = 8;
2024-11-27 22:24:11 +08:00
});
}
// Update is called once per frame
void Update()
{
}
private void ImgUpward(RectTransform rec,GameObject obj)
{
//<2F><><EFBFBD><EFBFBD><EFBFBD>жϵ<D0B6>ǰͼƬ<CDBC>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA> <20><>Ϊ<EFBFBD>ղŴ<D5B2><C5B4><EFBFBD>
if (nowImg!=null)
{
nowImg.localPosition = Vector3.zero;
}
//<2F>жϵ<D0B6>ǰѡ<C7B0>е<EFBFBD><D0B5><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA> <20><>Ϊ<EFBFBD>ղŴ<D5B2><C5B4><EFBFBD>
if (nowObj!=null)
{
nowObj.SetActive(false);
}
//<2F>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬһ<CDAC><D2BB><EFBFBD><EFBFBD>ť
if (nowObj == obj && nowImg == rec)
{
nowImg = null;
nowObj = null;
return;
}
rec.localPosition = new Vector3(0,50,0);
obj.SetActive(true);
//<2F><><EFBFBD>¸<EFBFBD>ֵ
nowImg=rec;
nowObj=obj;
}
}