收集水滴接口的接入

This commit is contained in:
liuliang 2024-12-20 21:03:36 +08:00
parent bfd3ffcd8d
commit b563233d2f
5 changed files with 361 additions and 241 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,27 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ManurePanel : MonoBehaviour
{
public GameObject[] DropArrays;
async void Start()
{
TreeInfo info = await Scene_main_jiekou.instance.TreeInfoS();
for (int i = 0; i < info.Data.Rewards.Count; i++)
{
if (info.Data.Rewards[i].Show ==0)
{
DropArrays[i].gameObject.SetActive(false);
}
}
}
// Update is called once per frame
void Update()
{
}
}

View File

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

View File

@ -41,6 +41,7 @@ public class Tree_team : MonoBehaviour
for (int i=0;i< response.Data.Pages.total_count; i++)
{
GameObject obj = GameObject.Instantiate(item,parent);
obj.transform.position= Vector3.zero;
obj.GetComponent<Tree_team_item>().itemName.text = response.Data.List[i].Nickname;
obj.GetComponent<Tree_team_item>().itemID.text ="id:"+ response.Data.List[i].Uid;
obj.GetComponent<Tree_team_item>().itemTeamCount.text ="ÍŶÓÈËÊý"+ response.Data.List[i].team_count;

View File

@ -10,28 +10,55 @@ public class WaterDrop : MonoBehaviour
public Transform targetPosition; // 目标位置
public float flyDuration = 1f; // 飞行持续时间
public int id;
string trans_id;
void Start()
{
DropBtn = GetComponent<Button>();
DropBtn.onClick.AddListener(DropClick);
}
async void DropClick()
{
bool succefful = await Scene_main_jiekou.instance.TreeGetWaters(id, "string");
trans_id = GenerateRandomString(6);
bool succefful = await Scene_main_jiekou.instance.TreeGetWaters(id, trans_id);
if (succefful)
{
TreeInfo info = await Scene_main_jiekou.instance.TreeInfoS();
transform.DOMove(targetPosition.position, flyDuration)
.OnComplete(() =>
Destroy(this.gameObject)
);
.OnComplete(async () => {
WaterPanel.instance.Updated_water(info);
Destroy(this.gameObject);
});
}
else
{
}
}
public string GenerateRandomString(int length)
{
System.Random random = new System.Random(); // 创建一个新的随机数生成器
const string chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; // 可用字符
char[] stringChars = new char[length]; // 用来存储生成的字符
for (int i = 0; i < length; i++)
{
stringChars[i] = chars[random.Next(chars.Length)]; // 随机选择一个字符
}
return new string(stringChars); // 将字符数组转换为字符串
}
// Update is called once per frame
void Update()
{