This commit is contained in:
GL 2024-12-20 11:58:05 +08:00
commit cd38bca734
12 changed files with 112 additions and 90 deletions

View File

@ -132,11 +132,6 @@ public class BaoshiRoomcontroller : MonoBehaviour
{
add_fish();
}
else
{
Promptmgr.Instance.PromptBubble("ź¤ťîʧ°Ü");
}
}
public void add_fish(string timerStr = null)//Éú³É´¬Ö»
@ -145,7 +140,7 @@ public class BaoshiRoomcontroller : MonoBehaviour
if (timerStr != null)
{
musk.gameObject.SetActive(false);
fishMan = GameObject.Instantiate(fishManPrefab, this.transform);
fishMan.transform.position = endPos.position;
fishManShipContorl = fishMan.GetComponent<minerControl>();
@ -163,8 +158,6 @@ public class BaoshiRoomcontroller : MonoBehaviour
fishMan.transform.position = startPos.position;
fishManShipContorl = fishMan.GetComponent<minerControl>();
fishManShipContorl.init(this.paths, this.pathsNeedTimer, this.fishingNeedTimer, this.restTimer, this.startPos, this.endPos);
}

View File

@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
public class Scene_baoshidao : MonoBehaviour
@ -27,16 +28,20 @@ public class Scene_baoshidao : MonoBehaviour
{
baoshidao_contorl go = lands[index].GetComponent<baoshidao_contorl>();
go.RoomId = info.Id;
go.daoyuName.text = info.Name;
go.ActivateValue = info.Price;
go.goldNumerTextPro.text = info.Price.ToString("f0");
go.RoomId = info.id;
go.daoyuName.text = info.name;
go.ActivateValue = info.price;
go.goldNumerTextPro.text = info.price.ToString("f0");
go.shipNumberTextPro.text = info.activate_count.ToString() + "/" + info.activate_limit;
if (info.activate_count > 0)
{
for (int temp = info.activate_count; temp > 0; temp--)
{
go.OnClick();
go.add_fish("1");
await Task.Delay(100);
}
}

View File

@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
public class Scene_baoshikuang : MonoBehaviour
@ -28,15 +29,17 @@ public class Scene_baoshikuang : MonoBehaviour
{
BaoshiRoomcontroller roomController = lands[index].GetComponent<BaoshiRoomcontroller>();
// 更新 RoomId
roomController.RoomId = info.Id;
roomController.RoomId = info.id;
roomController.shipNumberTextPro.text = info.activate_count.ToString() + "/" + info.activate_limit;
// 如果 ActivateCount 大于 0则调用 OnClick 方法
if (info.activate_count > 0)
{
for (int temp = 0; temp < info.activate_count; temp++) // 使用更常见的循环方式
for (int temp = 0; temp < info.activate_count; temp++)
{
roomController.OnClick();
roomController.add_fish("1");
await Task.Delay(100);
}
}

View File

@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
public class Scene_jinbikuang : MonoBehaviour
@ -26,14 +27,17 @@ public class Scene_jinbikuang : MonoBehaviour
foreach (MinngConfigData info in infos)
{
roomcontroller go = lands[index].GetComponent<roomcontroller>();
go.RoomId = info.Id;
go.ActivateValue = info.Price;
go.RoomId = info.id;
go.ActivateValue = info.price;
go.shipNumberTextPro.text = info.activate_count.ToString() + "/" + info.activate_limit;
if (info.activate_count > 0)
{
for (int temp = info.activate_count; temp > 0; temp--)
{
go.add_fish();
go.add_fish("1");
await Task.Delay(100);
}
}

View File

@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
public class scene_jingshadao : MonoBehaviour
@ -26,20 +27,20 @@ public class scene_jingshadao : MonoBehaviour
foreach (MinngConfigData info in infos)
{
jishadao_contorl go = lands[index].GetComponent<jishadao_contorl>();
go.RoomId = info.Id;
go.daoyuName.text = info.Name;
go.RoomId = info.id;
go.daoyuName.text = info.name;
go.ActivateValue = info.Price;
go.goldNumerTextPro.text = info.Price.ToString("f0");
go.shipNumberTextPro.text =info.activate_count.ToString() + "/" + info.ActivateLimit;
Debug.LogError("!!!!!!!!!!info.ActivateCount" + info.activate_count);
go.ActivateValue = info.price;
go.goldNumerTextPro.text = info.price.ToString("f0");
go.shipNumberTextPro.text =info.activate_count.ToString() + "/" + info.activate_limit;
if (info.activate_count > 0)
{
Debug.LogError("22222222info.ActivateCount"+ info.activate_count);
for (int temp = 0; temp < info.activate_count; temp++)
{
go.OnClick();
go.add_fish("1");
await Task.Delay(100);
}
}

View File

@ -18,7 +18,7 @@ public class scene_Main_Init : MonoBehaviour
index= PlayerPrefs.GetInt("SceneStatus");
if(index==-1)
{
Debug.LogError("index==0");
Debug.LogWarning("index==0");
return;
}

View File

@ -150,10 +150,7 @@ public class baoshidao_contorl : MonoBehaviour
ScaleAni(OnBtnAni);
add_fish();
}
else
{
Promptmgr.Instance.PromptBubble("ź¤ťîʧ°Ü");
}

View File

@ -1,10 +1,12 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Diagnostics;
using UnityEngine;
using DG.Tweening;
using Debug = UnityEngine.Debug;
public enum minerState
public enum minerState
{
stand,
move,
@ -64,7 +66,19 @@ public class minerControl : MonoBehaviour
this.restTimer = restTimer;
this.startPos = startPos;
this.endPos = endPos;
MoveToFishingPos();
if (Vector3.Distance(this.transform.position, startPos.position) <= 0.01f)
{
//Debug.LogWarning("11111111111111");
MoveToFishingPos();
}
else
{
// Debug.LogWarning("22222222222222222");
dig();
}
}
public void SetState(minerState newState)

View File

@ -129,54 +129,34 @@ public class roomcontroller : MonoBehaviour
public async void OnClick()
{
if (!canClick)
{
return;
}
if (!canClick)
{
return;
}
if (fishMan == null)
{
Promptmgr.Instance.PromptBubble("还没有买", Color.black, Color.red);
return;
}
// Debug.Log("OnClick");
if (fishMan == null)
{
Promptmgr.Instance.PromptBubble("还没有买", Color.black, Color.red);
return;
}
Promptmgr.Instance.PromptBubble("激活成功");
add_fish();
}
public async void add_fish(string timerStr = null)//生成船只
{
if (await ActivationRoom())
{
Promptmgr.Instance.PromptBubble("激活成功");
add_fish();
}
else
{
Promptmgr.Instance.PromptBubble("激活失败");
}
}
public void StartAddfish(string timerStr = null)
public async void add_fish(string timerStr = null)//生成船只
{
if (timerStr != null)
{
musk.gameObject.SetActive(false);
fishMan = GameObject.Instantiate(fishManPrefab, this.transform);
fishMan.transform.position = endPos.position;
fishManShipContorl = fishMan.GetComponent<minerControl>();
fishManShipContorl.init(this.paths, this.pathsNeedTimer, this.fishingNeedTimer, this.restTimer, this.startPos, this.endPos);
Debug.Log("更新船时间");
return;
@ -190,6 +170,8 @@ public class roomcontroller : MonoBehaviour
fishManShipContorl.init(this.paths, this.pathsNeedTimer, this.fishingNeedTimer, this.restTimer, this.startPos, this.endPos);
}
//更新精灵数量显示
public void UpdateShipNumberTextPro(string str)

View File

@ -155,26 +155,21 @@ public class jishadao_contorl : MonoBehaviour
return;
}
add_fish();
}
public async void add_fish(string timerStr = null)//生成船只
{
if (await ActivationRoom())
{
ScaleAni(OnBtnAni);
StartAddFish(timerStr);
}
else
{
Promptmgr.Instance.PromptBubble("激活失败");
add_fish();
}
}
void StartAddFish(string timerStr = null)
public async void add_fish(string timerStr = null)//生成船只
{
if (fishMan != null)
{
@ -202,6 +197,32 @@ public class jishadao_contorl : MonoBehaviour
fishManShipContorl = fishMan.GetComponent<SpriteAniationpro>();
MoveToFishingPos(); if (fishMan != null)
{
Promptmgr.Instance.PromptBubble("已经有船了", Color.black, Color.red);
Debug.Log("更新船");
return;
}
if (timerStr != null)
{
fishMan = GameObject.Instantiate(fishManPrefab, this.transform);
fishMan.transform.position = endPos.position;
fishManShipContorl = fishMan.GetComponent<SpriteAniationpro>();
// Debug.Log("更新船时间");
fish();
return;
}
fishMan = GameObject.Instantiate(fishManPrefab, this.transform);
fishMan.transform.position = startPos.position;
fishManShipContorl = fishMan.GetComponent<SpriteAniationpro>();
MoveToFishingPos();
}

View File

@ -41,6 +41,8 @@ public class miningActivate : MonoBehaviour
isSucceed = false;
}
Promptmgr.Instance.PromptBubble(miningActivateResponse.message);
return isSucceed;
}
}

View File

@ -38,13 +38,13 @@ public class MiningConfigResponse:myResponse
public class MinngConfigData
{
public int Id { get; set; }
public int Type { get; set; }
public string Name { get; set; }
public int Level { get; set; }
public float Price { get; set; }
public float Yield { get; set; }
public int YieldCycle { get; set; }
public int ActivateLimit { get; set; }
public int id { get; set; }
public int type { get; set; }
public string name { get; set; }
public int level { get; set; }
public float price { get; set; }
public float yield { get; set; }
public int yield_cycle { get; set; }
public int activate_limit { get; set; }
public int activate_count { get; set; }
}