Compare commits

...

4 Commits

Author SHA1 Message Date
杨号敬
3fc9ada793 Merge branch 'main' of http://shu.sheziwanglo.cn:3000/shurongsen/Cute_demon_attacks 2025-01-08 17:58:32 +08:00
杨号敬
b2c07eb511 钓手PK 2025-01-08 17:58:22 +08:00
杨号敬
86c7ff0128 Merge branch 'main' of http://shu.sheziwanglo.cn:3000/shurongsen/Cute_demon_attacks 2025-01-08 14:09:49 +08:00
杨号敬
4333b516d1 钓手PK 2025-01-08 14:08:48 +08:00
6 changed files with 1488 additions and 35 deletions

File diff suppressed because it is too large Load Diff

View File

@ -92,7 +92,7 @@ public class SkillUp : Fun
private void Awake()
{
description = "更新后的萌耀使用方法xxxxxxxx";
//description = "更新后的萌耀使用方法xxxxxxxx";
}
public void Up(string mengyao_id,string skill_id,string level)

View File

@ -0,0 +1,94 @@
using System.Collections;
using UnityEngine;
using DG.Tweening;
using System.Threading.Tasks;
public class PhotoMovement : MonoBehaviour
{
// 存储路径点的位置和旋转角度
[System.Serializable]
public class PathPoint
{
public Vector3 position; // 路径点的位置
public Vector3 rotation; // 路径点的旋转角度(欧拉角)
}
public GameObject image;
public PathPoint[] pathPoints; // 路径点数组
public float moveDuration = 1f; // 每次移动的持续时间
public int currentPathIndex = 0; // 当前路径点的索引
public GameObject daiji;
public GameObject shuaigan;
public GameObject shougan;
public bool type=false;
private void Start()
{
image.gameObject.SetActive(false);
}
public void changetype()
{
while(type)
{
To1();
}
}
public async void To1()
{
shuaigan.gameObject.SetActive(true);
var time=shuaigan.GetComponent<SpriteAniation>().sprites.Count * shuaigan.GetComponent<SpriteAniation>().Aintime;
await Task.Delay((int)time);
daiji.gameObject.SetActive(true);
shuaigan.gameObject.SetActive(false);
await Task.Delay(1000);
daiji.gameObject.SetActive(false);
shougan.gameObject.SetActive(true);
var time1 = shougan.GetComponent<SpriteAniation>().sprites.Count * shougan.GetComponent<SpriteAniation>().Aintime;
StartCoroutine(MoveAlongPath());
currentPathIndex = 0;
image.gameObject.SetActive(true);
await Task.Delay((int)time1);
Del1();
}
public void Del1()
{
image.gameObject.SetActive(false);
shuaigan.gameObject.SetActive(false);
daiji.gameObject.SetActive(false) ;
shougan.gameObject .SetActive(false) ;
currentPathIndex = 0;
}
public async void To2()
{
shuaigan.gameObject.SetActive(true);
var time = shuaigan.GetComponent<SpriteAniation>().sprites.Count * shuaigan.GetComponent<SpriteAniation>().Aintime;
await Task.Delay((int)time);
daiji.gameObject.SetActive(true);
shuaigan.gameObject.SetActive(false);
}
private IEnumerator MoveAlongPath()
{
// 持续沿着路径点移动
while (currentPathIndex < pathPoints.Length)
{
PathPoint currentPoint = pathPoints[currentPathIndex];
// 移动到当前路径点的位置,并旋转到对应的角度
yield return image.transform.DOLocalMove(currentPoint.position, moveDuration)
.OnStart(() => image.transform.DOLocalRotate(currentPoint.rotation, moveDuration))
.WaitForCompletion(); // 等待移动和旋转完成
// 移动到下一个路径点
currentPathIndex++;
}
image.gameObject.SetActive(false);
shougan.gameObject.SetActive(false);
}
public void change()
{
StartCoroutine(MoveAlongPath());
currentPathIndex = 0;
image.gameObject.SetActive(true);
}
}

View File

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

View File

@ -21,19 +21,61 @@ public class WebFishingPK : MonoBehaviour
float remainingTime = 0f;
public Text TimeText;
private float interval = 1f; // 每秒调用一次
/// <summary>
/// 文本描述
/// </summary>、
public Text introtext;
/// <summary>
/// 左右金币
/// </summary>
public Text lefttext;
public Text righttext;
public Button TouruBtn;
public Button selleftbtn;
public Button selrightbtn;
public Dropdown Dropdown;
int pos = 0;
private UnityEngine.Color normalColor = UnityEngine.Color.white; // 默认颜色
private UnityEngine.Color selectedColor = UnityEngine.Color.blue; // 选中时的颜色
/// <summary>
/// 钓鱼
/// </summary>
///
public PhotoMovement photoMovement;
private async void Start()
{
TimeText.gameObject.SetActive(false);
Debug.Log(PlayerPrefs.GetString("UserToken"));
AuthorizationValue = PlayerPrefs.GetString("UserToken");
await ConnectWebSocket();
selleftbtn.onClick.AddListener(() =>
{
pos = 1;
ChangeButtonColor(selleftbtn, selectedColor);
ChangeButtonColor(selrightbtn, normalColor); // 恢复右侧按钮颜色
});
// 为右侧按钮添加点击监听器
selrightbtn.onClick.AddListener(() =>
{
pos = 2;
ChangeButtonColor(selrightbtn, selectedColor);
ChangeButtonColor(selleftbtn, normalColor); // 恢复左侧按钮颜色
});
// 调用发送方法
await SendJsonMessage("{ \"code\": \"FISHING_PK\", \"content\": \"{\\\"action\\\":\\\"INFO\\\"}\" }");
//await SendJsonMessage(30, 1);
}
TouruBtn.onClick.AddListener(async() =>
{
await SendJsonMessage(int.Parse(Dropdown.options[Dropdown.value].text), pos);
});
}
private void ChangeButtonColor(Button btn, UnityEngine.Color color)
{
btn.gameObject.GetComponent<Image>().color = color;
}
private async Task ConnectWebSocket()
{
_webSocket = new ClientWebSocket();
@ -77,7 +119,7 @@ public class WebFishingPK : MonoBehaviour
Debug.Log($"接收到消息:{message}");
var baseResponse = JsonConvert.DeserializeObject<BaseResponse>(message);
Promptmgr.Instance.PromptBubble(baseResponse.message);
//Promptmgr.Instance.PromptBubble(baseResponse.message);
if (baseResponse != null)
{
switch (baseResponse.code)
@ -91,12 +133,26 @@ public class WebFishingPK : MonoBehaviour
{
Debug.Log(fishResponse.data.balance);
Debug.Log(fishResponse.data.intro_text);
introtext.text = fishResponse.data.intro_text;
Debug.Log(fishResponse.data.countdown);
TimeText.gameObject.SetActive(true);
remainingTime = (float)fishResponse.data.countdown;
Debug.Log(fishResponse.data.countdown_type);
if(fishResponse.data.countdown_type==0)
{
photoMovement.Del1();
photoMovement.To1();
}
else
{
photoMovement.Del1();
photoMovement.To2();
}
Debug.Log(fishResponse.data.amount_left);
lefttext.text= fishResponse.data.amount_left.ToString();
Debug.Log(fishResponse.data.amount_right);
righttext.text= fishResponse.data.amount_right.ToString();
}
break;
@ -127,8 +183,20 @@ public class WebFishingPK : MonoBehaviour
Debug.Log(fishResponse2.data.countdown);
remainingTime = (float)fishResponse2.data.countdown;
Debug.Log(fishResponse2.data.countdown_type);
if (fishResponse2.data.countdown_type == 0)
{
photoMovement.Del1();
photoMovement.To1();
}
else
{
photoMovement.Del1();
photoMovement.To2();
}
Debug.Log(fishResponse2.data.amount_left);
Debug.Log(fishResponse2.data.amount_right);
lefttext.text = fishResponse2.data.amount_left.ToString();
righttext.text = fishResponse2.data.amount_right.ToString();
}
else
{

View File

@ -6,6 +6,8 @@ public class shougou : MonoBehaviour
{
public SpriteAniation SpriteAniation;
public GameObject daiji;
public int count;
// Start is called before the first frame update
void Start()
{
@ -15,10 +17,11 @@ public class shougou : MonoBehaviour
// Update is called once per frame
void Update()
{
if(SpriteAniation.index>=24)
if(SpriteAniation.index>= count)
{
this.gameObject.SetActive(false);
daiji.gameObject.SetActive(true);
daiji.GetComponentInParent<PhotoMovement>().change();
SpriteAniation.index = 0;
}
}