97 lines
2.2 KiB
C#
97 lines
2.2 KiB
C#
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
|
||
public class Shoot122Manager : MonoBehaviour
|
||
{
|
||
public static Shoot122Manager Instance { get; private set; }
|
||
|
||
public Animation animation_122;
|
||
public GameObject rawImage_122;
|
||
public GameObject penguan;
|
||
public List<string> chooseShoot=new List<string>();
|
||
public Dictionary<string,int> choosedValue=new Dictionary<string,int>();
|
||
public Control3DModelBt 保险;
|
||
|
||
public bool isShootReady;
|
||
|
||
|
||
public Control3DModelBt autoBtn1;
|
||
public Control3DModelBt autoBtn2;
|
||
public Control3DModelBt usedOpen;
|
||
private void Awake()
|
||
{
|
||
|
||
Instance = this;
|
||
isShoot = false;
|
||
isShootReady = false;
|
||
}
|
||
|
||
public bool isShoot;
|
||
// Start is called before the first frame update
|
||
|
||
|
||
|
||
private void Update()
|
||
{
|
||
if (autoBtn1.Get3DBtnState() && autoBtn2.Get3DBtnState() && usedOpen.Get3DBtnState())
|
||
{
|
||
isShootReady = true;
|
||
}
|
||
else {
|
||
|
||
isShootReady = false;
|
||
}
|
||
}
|
||
|
||
|
||
public void AddOrUpdate(string key, int value)
|
||
{
|
||
if (choosedValue.ContainsKey(key))
|
||
{
|
||
// 键已存在,更新值
|
||
choosedValue[key] = value;
|
||
}
|
||
else
|
||
{
|
||
// 键不存在,添加新元素
|
||
choosedValue.Add(key, value);
|
||
}
|
||
if (GameObject.FindObjectOfType<PaoZhangMainPage>() != null)
|
||
{
|
||
FindObjectOfType<PaoZhangMainPage>().SetOneState(int.Parse(key), value);
|
||
}
|
||
}
|
||
|
||
public bool RemoveByKey(string key)
|
||
{
|
||
if (choosedValue.ContainsKey(key))
|
||
{
|
||
choosedValue.Remove(key);
|
||
return true; // 删除成功
|
||
}
|
||
return false; // key不存在,删除失败
|
||
}
|
||
|
||
public void Jifa()
|
||
{
|
||
if (isShoot|| !保险.isInit)
|
||
return;
|
||
rawImage_122.SetActive(true);
|
||
isShoot =true;
|
||
animation_122.Play();
|
||
penguan.SetActive(true);
|
||
for (int i = 0; i < chooseShoot.Count; i++)
|
||
{
|
||
AddOrUpdate(chooseShoot[i].ToString(), 3);
|
||
}
|
||
|
||
}
|
||
|
||
public void DiaoPaoOver()
|
||
{
|
||
if (Manager122Base.instance != null)
|
||
Manager122Base.instance.Show122DwonMsg("高低到位,方位到位");
|
||
}
|
||
}
|