钓手动画
This commit is contained in:
parent
5b904e8bfa
commit
acb4d90826
File diff suppressed because it is too large
Load Diff
@ -2,6 +2,7 @@ using System.Collections;
|
||||
using UnityEngine;
|
||||
using DG.Tweening;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class PhotoMovement : MonoBehaviour
|
||||
{
|
||||
@ -20,33 +21,37 @@ public class PhotoMovement : MonoBehaviour
|
||||
public GameObject shuaigan;
|
||||
public GameObject shougan;
|
||||
public bool type=false;
|
||||
public Sprite[] sprites;
|
||||
int count = 0;
|
||||
private void Start()
|
||||
{
|
||||
image.gameObject.SetActive(false);
|
||||
}
|
||||
public void changetype()
|
||||
|
||||
public async void To1()
|
||||
{
|
||||
while(type)
|
||||
if (type == true)
|
||||
{
|
||||
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);
|
||||
//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);
|
||||
image.GetComponent<Image>().sprite = sprites[count% sprites.Length];
|
||||
count++;
|
||||
await Task.Delay((int)time1-100);
|
||||
Del1();
|
||||
|
||||
|
||||
}
|
||||
public void Del1()
|
||||
{
|
||||
@ -83,6 +88,7 @@ public class PhotoMovement : MonoBehaviour
|
||||
}
|
||||
image.gameObject.SetActive(false);
|
||||
shougan.gameObject.SetActive(false);
|
||||
image.transform.localPosition=new Vector3 (467, -144, 0);
|
||||
|
||||
}
|
||||
public void change()
|
||||
@ -91,4 +97,8 @@ public class PhotoMovement : MonoBehaviour
|
||||
currentPathIndex = 0;
|
||||
image.gameObject.SetActive(true);
|
||||
}
|
||||
public void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -38,12 +38,13 @@ public class WebFishingPK : MonoBehaviour
|
||||
private UnityEngine.Color normalColor = UnityEngine.Color.white; // 默认颜色
|
||||
private UnityEngine.Color selectedColor = UnityEngine.Color.blue; // 选中时的颜色
|
||||
|
||||
|
||||
public Button returnbtn;
|
||||
/// <summary>
|
||||
/// 钓鱼
|
||||
/// </summary>
|
||||
///
|
||||
public PhotoMovement photoMovement;
|
||||
public PhotoMovement photoMovement1;
|
||||
private async void Start()
|
||||
{
|
||||
TimeText.gameObject.SetActive(false);
|
||||
@ -70,6 +71,10 @@ public class WebFishingPK : MonoBehaviour
|
||||
{
|
||||
await SendJsonMessage(int.Parse(Dropdown.options[Dropdown.value].text), pos);
|
||||
});
|
||||
returnbtn.onClick.AddListener(async () =>
|
||||
{
|
||||
await SendJsonMessage("{ \"code\": \"FISHING_PK\", \"content\": \"{\\\"action\\\":\\\"LEAVE\\\"}\" }");
|
||||
});
|
||||
|
||||
}
|
||||
private void ChangeButtonColor(Button btn, UnityEngine.Color color)
|
||||
@ -140,13 +145,24 @@ public class WebFishingPK : MonoBehaviour
|
||||
Debug.Log(fishResponse.data.countdown_type);
|
||||
if(fishResponse.data.countdown_type==0)
|
||||
{
|
||||
photoMovement.type = true;
|
||||
photoMovement.Del1();
|
||||
photoMovement.To1();
|
||||
photoMovement1.type = true;
|
||||
photoMovement1.Del1();
|
||||
photoMovement1.To1();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
photoMovement.Del1();
|
||||
photoMovement.type = false;
|
||||
|
||||
photoMovement.To2();
|
||||
photoMovement1.Del1();
|
||||
photoMovement1.type = false;
|
||||
|
||||
photoMovement1.To2();
|
||||
|
||||
}
|
||||
Debug.Log(fishResponse.data.amount_left);
|
||||
@ -185,13 +201,23 @@ public class WebFishingPK : MonoBehaviour
|
||||
Debug.Log(fishResponse2.data.countdown_type);
|
||||
if (fishResponse2.data.countdown_type == 0)
|
||||
{
|
||||
photoMovement.type = true;
|
||||
photoMovement.Del1();
|
||||
photoMovement.To1();
|
||||
photoMovement1.type = true;
|
||||
photoMovement1.Del1();
|
||||
photoMovement1.To1();
|
||||
}
|
||||
else
|
||||
{
|
||||
photoMovement.Del1();
|
||||
photoMovement.type = false;
|
||||
|
||||
photoMovement.To2();
|
||||
photoMovement1.Del1();
|
||||
photoMovement1.type = false;
|
||||
|
||||
photoMovement1.To2();
|
||||
}
|
||||
Debug.Log(fishResponse2.data.amount_left);
|
||||
Debug.Log(fishResponse2.data.amount_right);
|
||||
|
@ -37,6 +37,7 @@ public class WebJoinroom : MonoBehaviour
|
||||
public Animator animator;
|
||||
public GameObject yupanel;
|
||||
public Image zhanshiyu;
|
||||
public Button returnbtn;
|
||||
private async void Start()
|
||||
{
|
||||
yupanel.SetActive(false);
|
||||
@ -45,7 +46,10 @@ public class WebJoinroom : MonoBehaviour
|
||||
AuthorizationValue = PlayerPrefs.GetString("UserToken");
|
||||
|
||||
await ConnectWebSocket();
|
||||
|
||||
returnbtn.onClick.AddListener(async () =>
|
||||
{
|
||||
await SendJsonMessage("{ \"code\": \"FISHING\", \"content\": \"{\\\"action\\\":\\\"LEAVE\\\"}\" }");
|
||||
});
|
||||
Tourubtn.onClick.AddListener(async () =>
|
||||
{
|
||||
await SendJsonMessage(1);
|
||||
|
Loading…
Reference in New Issue
Block a user