2024-11-15 22:44:04 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
using DG.Tweening;
|
|
|
|
|
using TMPro;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
public class roomcontroller : MonoBehaviour
|
|
|
|
|
{
|
2024-12-18 23:42:07 +08:00
|
|
|
|
[Header("id")]
|
|
|
|
|
public int RoomId;
|
|
|
|
|
|
|
|
|
|
public Text RoomName;
|
|
|
|
|
|
|
|
|
|
|
2024-11-15 22:44:04 +08:00
|
|
|
|
[Header("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>")]
|
|
|
|
|
public GameObject fishManPrefab;
|
|
|
|
|
[Header("<22><><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")]
|
|
|
|
|
public List<VoucherItem> listItem = new List<VoucherItem>();
|
|
|
|
|
private GameObject fishMan;//<2F><><EFBFBD>ɵ<EFBFBD><C9B5>洬
|
2024-11-18 15:46:45 +08:00
|
|
|
|
private minerControl fishManShipContorl;//<2F>洬<EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD>
|
2024-11-15 22:44:04 +08:00
|
|
|
|
|
|
|
|
|
[Header("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD>")]
|
|
|
|
|
public Transform startPos;
|
|
|
|
|
[Header("<22><><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD>")]
|
|
|
|
|
public Transform endPos;
|
|
|
|
|
|
|
|
|
|
[Header("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͱ<EFBFBD><CDB1><EFBFBD>")]
|
|
|
|
|
public int type;
|
|
|
|
|
|
|
|
|
|
public float ActivateValue = 0;
|
|
|
|
|
public int Num = 0;
|
|
|
|
|
public int Type = 0;
|
|
|
|
|
|
|
|
|
|
[Header("<22><><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD>㼯<EFBFBD><E3BCAF>")]
|
|
|
|
|
public List<Path> paths;
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
[Header("<22><>·ʱ<C2B7><CAB1>")]
|
|
|
|
|
public float pathsNeedTimer = 30f;
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
[Header("<22>ڿ<EFBFBD>ʱ<EFBFBD><CAB1>")]
|
|
|
|
|
public float fishingNeedTimer = 30f;
|
|
|
|
|
//<2F><>Ϣʱ<CFA2><CAB1>
|
|
|
|
|
[Header("<22><>Ϣʱ<CFA2><CAB1>")]
|
|
|
|
|
public float restTimer = 5f;
|
|
|
|
|
|
2024-12-26 22:59:03 +08:00
|
|
|
|
[Header("<22><><EFBFBD>澫<EFBFBD><E6BEAB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")]
|
|
|
|
|
List<GameObject> fishManlist = new List<GameObject>();
|
2024-11-15 22:44:04 +08:00
|
|
|
|
|
|
|
|
|
[Header("<22><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")]
|
|
|
|
|
public Text shipNumberTextPro;
|
2024-12-20 15:56:43 +08:00
|
|
|
|
public int shipNumber;
|
|
|
|
|
public int MaxShipNumber = 10;
|
|
|
|
|
|
|
|
|
|
public int ShipNumber
|
|
|
|
|
{
|
|
|
|
|
get => shipNumber;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
shipNumber = value;
|
|
|
|
|
shipNumberTextPro.text = shipNumber.ToString() + "/" + MaxShipNumber.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-11-15 22:44:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Header("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч")]
|
|
|
|
|
public GameObject effectPrefab;//<2F><>Ч
|
|
|
|
|
|
|
|
|
|
[Header("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť<EFBFBD><C5A5><EFBFBD>ֵĶ<D6B5><C4B6><EFBFBD>")]
|
|
|
|
|
public Transform OnBtnAni;
|
|
|
|
|
|
|
|
|
|
public float FishPrice;
|
|
|
|
|
|
|
|
|
|
public GameObject map;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static bool canClick = true;
|
|
|
|
|
|
|
|
|
|
public List<string> ids = new List<string>();
|
|
|
|
|
|
2024-12-20 15:56:43 +08:00
|
|
|
|
//public int number;
|
2024-11-16 01:20:28 +08:00
|
|
|
|
|
|
|
|
|
public GameObject musk;
|
2024-11-15 22:44:04 +08:00
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
private void Awake()
|
|
|
|
|
{
|
|
|
|
|
listItem = new List<VoucherItem>();
|
2024-11-15 23:57:06 +08:00
|
|
|
|
|
2024-11-15 22:44:04 +08:00
|
|
|
|
}
|
2024-12-20 15:56:43 +08:00
|
|
|
|
|
2024-11-15 23:57:06 +08:00
|
|
|
|
|
2024-11-15 22:44:04 +08:00
|
|
|
|
|
2024-12-20 15:56:43 +08:00
|
|
|
|
|
2024-11-15 22:44:04 +08:00
|
|
|
|
|
2024-12-18 23:42:07 +08:00
|
|
|
|
public async void OnClick()
|
2024-11-15 22:44:04 +08:00
|
|
|
|
{
|
2024-12-20 11:33:06 +08:00
|
|
|
|
if (!canClick)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
2024-11-15 22:44:04 +08:00
|
|
|
|
|
2024-12-20 11:33:06 +08:00
|
|
|
|
if (fishMan == null)
|
|
|
|
|
{
|
2024-12-20 15:56:43 +08:00
|
|
|
|
//Promptmgr.Instance.PromptBubble("<22><>û<EFBFBD><C3BB><EFBFBD><EFBFBD>", Color.black, Color.red);
|
2024-12-20 11:33:06 +08:00
|
|
|
|
return;
|
|
|
|
|
}
|
2024-12-20 12:03:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public async void BuyActivation()
|
|
|
|
|
{
|
|
|
|
|
|
2024-12-18 23:52:41 +08:00
|
|
|
|
if (await ActivationRoom())
|
|
|
|
|
{
|
|
|
|
|
add_fish();
|
2024-12-20 15:56:43 +08:00
|
|
|
|
this.ShipNumber += 1;
|
2024-12-18 23:42:07 +08:00
|
|
|
|
}
|
2024-11-15 22:44:04 +08:00
|
|
|
|
}
|
2024-12-20 12:03:29 +08:00
|
|
|
|
|
|
|
|
|
|
2024-12-20 11:33:06 +08:00
|
|
|
|
public async void add_fish(string timerStr = null)//<2F><><EFBFBD>ɴ<EFBFBD>ֻ
|
2024-12-18 23:52:41 +08:00
|
|
|
|
{
|
2024-11-15 22:44:04 +08:00
|
|
|
|
if (timerStr != null)
|
|
|
|
|
{
|
2024-12-20 11:33:06 +08:00
|
|
|
|
musk.gameObject.SetActive(false);
|
2024-11-15 22:44:04 +08:00
|
|
|
|
fishMan = GameObject.Instantiate(fishManPrefab, this.transform);
|
2024-12-26 22:59:03 +08:00
|
|
|
|
fishManlist.Add(fishMan);
|
2025-01-06 16:49:54 +08:00
|
|
|
|
|
2025-01-06 17:13:12 +08:00
|
|
|
|
/*Vector3 pos = new Vector3(Random.Range((endPos.position.x-startPos.position.x)/2, endPos.position.x), endPos.position.y, endPos.position.z);
|
|
|
|
|
fishMan.transform.position = pos;*/
|
|
|
|
|
|
|
|
|
|
fishMan.transform.position = endPos.position;
|
2025-01-06 16:49:54 +08:00
|
|
|
|
|
2024-11-18 15:46:45 +08:00
|
|
|
|
fishManShipContorl = fishMan.GetComponent<minerControl>();
|
|
|
|
|
fishManShipContorl.init(this.paths, this.pathsNeedTimer, this.fishingNeedTimer, this.restTimer, this.startPos, this.endPos);
|
2024-12-18 23:52:41 +08:00
|
|
|
|
|
2024-11-15 22:44:04 +08:00
|
|
|
|
Debug.Log("<22><><EFBFBD>´<EFBFBD>ʱ<EFBFBD><CAB1>");
|
2024-12-18 23:52:41 +08:00
|
|
|
|
|
2024-11-15 22:44:04 +08:00
|
|
|
|
return;
|
|
|
|
|
}
|
2024-11-16 01:20:28 +08:00
|
|
|
|
musk.gameObject.SetActive(false);
|
2024-11-15 22:44:04 +08:00
|
|
|
|
fishMan = GameObject.Instantiate(fishManPrefab, this.transform);
|
2024-12-30 12:49:29 +08:00
|
|
|
|
fishManlist.Add(fishMan);
|
2024-11-15 22:44:04 +08:00
|
|
|
|
fishMan.transform.position = startPos.position;
|
2024-11-18 15:46:45 +08:00
|
|
|
|
fishManShipContorl = fishMan.GetComponent<minerControl>();
|
2024-12-18 23:52:41 +08:00
|
|
|
|
fishManShipContorl.init(this.paths, this.pathsNeedTimer, this.fishingNeedTimer, this.restTimer, this.startPos, this.endPos);
|
2024-11-15 22:44:04 +08:00
|
|
|
|
}
|
2024-12-18 23:42:07 +08:00
|
|
|
|
public async Task<bool> ActivationRoom()
|
2024-11-15 22:44:04 +08:00
|
|
|
|
{
|
2024-12-18 23:42:07 +08:00
|
|
|
|
return await miner_jiekou.instance.MiningActivate(this.RoomId);
|
|
|
|
|
}
|
2024-12-26 22:59:03 +08:00
|
|
|
|
|
|
|
|
|
private void OnDisable()
|
|
|
|
|
{
|
|
|
|
|
foreach (GameObject obj in fishManlist)
|
|
|
|
|
{
|
|
|
|
|
Destroy(obj);
|
|
|
|
|
}
|
|
|
|
|
fishManlist.Clear();
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-15 22:44:04 +08:00
|
|
|
|
}
|