Merge branch 'main' of http://shu.sheziwanglo.cn:3000/shurongsen/Cute_demon_attacks
This commit is contained in:
commit
0018005456
1461
meng_yao/Assets/Prefabs/ui/MineSelection.prefab
Normal file
1461
meng_yao/Assets/Prefabs/ui/MineSelection.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
meng_yao/Assets/Prefabs/ui/MineSelection.prefab.meta
Normal file
7
meng_yao/Assets/Prefabs/ui/MineSelection.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 128d8e441f9e4a3498635470755d4087
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -787,7 +787,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: -763.3795, y: 0}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!114 &6480420811597574756
|
||||
MonoBehaviour:
|
||||
@ -1369,7 +1369,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!224 &6480420812643749074
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -57,7 +57,7 @@ public class Scene_main_jiekou :MonoBehaviour
|
||||
Islandownerbidding islandownerbidding=new Islandownerbidding();
|
||||
petdraw petdraw = new petdraw();
|
||||
treeachievement treeachievement = new treeachievement();
|
||||
|
||||
miningActivatelist miningActivatelist = new miningActivatelist();
|
||||
|
||||
public static Scene_main_jiekou instance;
|
||||
|
||||
@ -405,4 +405,10 @@ public class Scene_main_jiekou :MonoBehaviour
|
||||
{
|
||||
return await forgingdatalist.ForgingdatalistInfo(key);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<miningActivatelistResponse> MiningActivatelists(int type)//ÀàÐÍ 0:±¦Ê¯µº 1:±¦Ê¯¿ó³¡ 10:½ð±Òµº 11:½ð±Ò¿ó³¡
|
||||
{
|
||||
return await miningActivatelist.MiningActivatelist(type);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -140,10 +140,10 @@ public class FishingPK : 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();
|
||||
|
||||
@ -151,11 +151,11 @@ public class FishingPK : MonoBehaviour
|
||||
else
|
||||
{
|
||||
photoMovement.Del1();
|
||||
photoMovement.type = false;
|
||||
|
||||
|
||||
photoMovement.To2();
|
||||
photoMovement1.Del1();
|
||||
photoMovement1.type = false;
|
||||
|
||||
|
||||
photoMovement1.To2();
|
||||
|
||||
@ -196,21 +196,21 @@ public class FishingPK : 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();
|
||||
}
|
||||
|
@ -23,54 +23,92 @@ public class PhotoMovement : MonoBehaviour
|
||||
public bool type=false;
|
||||
public Sprite[] sprites;
|
||||
int count = 0;
|
||||
// 控制 To1 和 To2 的执行
|
||||
private bool isTo1Running = false; // 标识 To1 是否正在执行
|
||||
private bool isTo2Running = false; // 标识 To2 是否正在执行
|
||||
|
||||
private void Start()
|
||||
{
|
||||
image.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
|
||||
public async void To1()
|
||||
{
|
||||
if (type == true)
|
||||
{
|
||||
To1();
|
||||
}
|
||||
// 如果 To1 已经在执行,则返回,不执行新的 To1
|
||||
if (isTo1Running || isTo2Running)
|
||||
return;
|
||||
|
||||
isTo1Running = true; // 设置 To1 为正在执行状态
|
||||
|
||||
// 执行 To1 的操作
|
||||
shuaigan.gameObject.SetActive(true);
|
||||
var time=shuaigan.GetComponent<SpriteAniation>().sprites.Count * shuaigan.GetComponent<SpriteAniation>().Aintime;
|
||||
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);
|
||||
|
||||
// 延迟 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);
|
||||
image.GetComponent<Image>().sprite = sprites[count% sprites.Length];
|
||||
count++;
|
||||
await Task.Delay((int)time1-100);
|
||||
Del1();
|
||||
|
||||
|
||||
// 随机选择一个 sprite
|
||||
int randomIndex = Random.Range(0, sprites.Length); // 获取随机索引
|
||||
image.GetComponent<Image>().sprite = sprites[randomIndex]; // 使用随机的 sprite
|
||||
count++;
|
||||
|
||||
await Task.Delay((int)time1 - 100); // 延迟结束,准备执行下一个步骤
|
||||
|
||||
Del1(); // 结束当前操作
|
||||
isTo1Running = false; // 执行完 To1,恢复为未执行状态
|
||||
|
||||
// 如果没有正在执行 To2,则继续执行 To1
|
||||
if (!isTo2Running)
|
||||
{
|
||||
To1();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Del1()
|
||||
{
|
||||
image.gameObject.SetActive(false);
|
||||
shuaigan.gameObject.SetActive(false);
|
||||
daiji.gameObject.SetActive(false) ;
|
||||
shougan.gameObject .SetActive(false) ;
|
||||
daiji.gameObject.SetActive(false);
|
||||
shougan.gameObject.SetActive(false);
|
||||
currentPathIndex = 0;
|
||||
}
|
||||
|
||||
public async void To2()
|
||||
{
|
||||
// 如果 To1 正在执行,打断 To1 的执行
|
||||
isTo2Running = true; // 标记 To2 为正在执行
|
||||
|
||||
// 等待 To1 完成执行(如果 To1 正在执行)
|
||||
while (isTo1Running)
|
||||
{
|
||||
await Task.Delay(100); // 检查 To1 的执行状态
|
||||
}
|
||||
|
||||
// 执行 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);
|
||||
|
||||
|
||||
// 执行完 To2 后,恢复 To2 的标志为 false
|
||||
isTo2Running = false;
|
||||
}
|
||||
|
||||
private IEnumerator MoveAlongPath()
|
||||
{
|
||||
// 持续沿着路径点移动
|
||||
@ -86,19 +124,21 @@ public class PhotoMovement : MonoBehaviour
|
||||
// 移动到下一个路径点
|
||||
currentPathIndex++;
|
||||
}
|
||||
|
||||
image.gameObject.SetActive(false);
|
||||
shougan.gameObject.SetActive(false);
|
||||
image.transform.localPosition=new Vector3 (467, -144, 0);
|
||||
|
||||
image.transform.localPosition = new Vector3(467, -144, 0);
|
||||
}
|
||||
|
||||
public void change()
|
||||
{
|
||||
StartCoroutine(MoveAlongPath());
|
||||
currentPathIndex = 0;
|
||||
image.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ public class WebFishingPK : MonoBehaviour
|
||||
/// </summary>
|
||||
public Text lefttext;
|
||||
public Text righttext;
|
||||
public Text balance;
|
||||
public Button TouruBtn;
|
||||
public Button selleftbtn;
|
||||
public Button selrightbtn;
|
||||
@ -44,6 +45,12 @@ public class WebFishingPK : MonoBehaviour
|
||||
/// </summary>
|
||||
///
|
||||
public PhotoMovement photoMovement;
|
||||
public PhotoMovement photoMovement1;
|
||||
public Button returnbtn;
|
||||
private async void Awake()
|
||||
{
|
||||
///await ConnectWebSocket();
|
||||
}
|
||||
private async void Start()
|
||||
{
|
||||
TimeText.gameObject.SetActive(false);
|
||||
@ -70,7 +77,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)
|
||||
{
|
||||
@ -132,6 +142,7 @@ public class WebFishingPK : MonoBehaviour
|
||||
if (fishResponse?.data != null)
|
||||
{
|
||||
Debug.Log(fishResponse.data.balance);
|
||||
balance.text= fishResponse.data.balance.ToString();
|
||||
Debug.Log(fishResponse.data.intro_text);
|
||||
introtext.text = fishResponse.data.intro_text;
|
||||
Debug.Log(fishResponse.data.countdown);
|
||||
@ -142,11 +153,16 @@ public class WebFishingPK : MonoBehaviour
|
||||
{
|
||||
photoMovement.Del1();
|
||||
photoMovement.To1();
|
||||
photoMovement1.Del1();
|
||||
photoMovement1.To1();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
photoMovement.Del1();
|
||||
photoMovement.To2();
|
||||
photoMovement1.Del1();
|
||||
photoMovement1.To2();
|
||||
|
||||
}
|
||||
Debug.Log(fishResponse.data.amount_left);
|
||||
@ -165,6 +181,7 @@ public class WebFishingPK : MonoBehaviour
|
||||
if (fishResponse1 != null && fishResponse1.data != null)
|
||||
{
|
||||
Debug.Log(fishResponse1.data.balance);
|
||||
balance.text = fishResponse1.data.balance.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -187,11 +204,15 @@ public class WebFishingPK : MonoBehaviour
|
||||
{
|
||||
photoMovement.Del1();
|
||||
photoMovement.To1();
|
||||
photoMovement1.Del1();
|
||||
photoMovement1.To1();
|
||||
}
|
||||
else
|
||||
{
|
||||
photoMovement.Del1();
|
||||
photoMovement.To2();
|
||||
photoMovement1.Del1();
|
||||
photoMovement1.To2();
|
||||
}
|
||||
Debug.Log(fishResponse2.data.amount_left);
|
||||
Debug.Log(fishResponse2.data.amount_right);
|
||||
@ -210,6 +231,7 @@ public class WebFishingPK : MonoBehaviour
|
||||
if (fishResponse3 != null && fishResponse3.data != null)
|
||||
{
|
||||
Debug.Log(fishResponse3.data.balance);
|
||||
balance.text = fishResponse3.data.balance.ToString();
|
||||
Debug.Log(fishResponse3.data.status);
|
||||
Debug.Log(fishResponse3.data.amount);
|
||||
Debug.Log(fishResponse3.data.reward);
|
||||
|
@ -38,13 +38,16 @@ public class WebJoinroom : MonoBehaviour
|
||||
public GameObject yupanel;
|
||||
public Image zhanshiyu;
|
||||
public Button returnbtn;
|
||||
private async void Awake()
|
||||
{
|
||||
// await ConnectWebSocket();
|
||||
}
|
||||
private async void Start()
|
||||
{
|
||||
yupanel.SetActive(false);
|
||||
TimeText.gameObject.transform.parent.gameObject.SetActive(false);
|
||||
Debug.Log(PlayerPrefs.GetString("UserToken"));
|
||||
AuthorizationValue = PlayerPrefs.GetString("UserToken");
|
||||
|
||||
await ConnectWebSocket();
|
||||
returnbtn.onClick.AddListener(async () =>
|
||||
{
|
||||
|
@ -0,0 +1,360 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.WebSockets;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using Newtonsoft.Json;
|
||||
using System.Drawing;
|
||||
using UnityEngine.UI;
|
||||
using DG.Tweening;
|
||||
|
||||
public class Westerncowboy : MonoBehaviour
|
||||
{
|
||||
private ClientWebSocket _webSocket;
|
||||
private const string WebSocketUri = "ws://47.95.201.243:9527/api/ws";
|
||||
private string AuthorizationValue;
|
||||
|
||||
/// <summary>
|
||||
/// 界面元素
|
||||
/// </summary>
|
||||
public Text balance;
|
||||
public Text intro_text;
|
||||
public Text[] bettings;
|
||||
public Button Tourubtn;
|
||||
private float lastCallTime = 0f;
|
||||
float remainingTime = 0f;
|
||||
public Text TimeText;
|
||||
private float interval = 1f; // 每秒调用一次
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public Button returnbtn;
|
||||
private async void Awake()
|
||||
{
|
||||
//await ConnectWebSocket();
|
||||
}
|
||||
private async void Start()
|
||||
{
|
||||
|
||||
TimeText.gameObject.transform.parent.gameObject.SetActive(false);
|
||||
Debug.Log(PlayerPrefs.GetString("UserToken"));
|
||||
AuthorizationValue = PlayerPrefs.GetString("UserToken");
|
||||
await ConnectWebSocket();
|
||||
|
||||
returnbtn.onClick.AddListener(async () =>
|
||||
{
|
||||
await SendJsonMessage("{ \"code\": \"WEST_COWBOY\", \"content\": \"{\\\"action\\\":\\\"LEAVE\\\"}\" }");
|
||||
});
|
||||
Tourubtn.onClick.AddListener(async () =>
|
||||
{
|
||||
await SendJsonMessage(10,1);
|
||||
});
|
||||
// 调用发送方法
|
||||
await SendJsonMessage("{ \"code\": \"WEST_COWBOY\", \"content\": \"{\\\"action\\\":\\\"INFO\\\"}\" }");
|
||||
|
||||
|
||||
}
|
||||
|
||||
private async Task ConnectWebSocket()
|
||||
{
|
||||
_webSocket = new ClientWebSocket();
|
||||
|
||||
// 添加 Authorization 头
|
||||
_webSocket.Options.SetRequestHeader("Authorization", "Bearer " + AuthorizationValue);
|
||||
// _webSocket.Options.SetRequestHeader("client-info",);
|
||||
|
||||
try
|
||||
{
|
||||
Debug.Log("正在连接到 WebSocket...");
|
||||
await _webSocket.ConnectAsync(new Uri(WebSocketUri), CancellationToken.None);
|
||||
Debug.Log("WebSocket 连接成功!");
|
||||
|
||||
// 开始接收消息
|
||||
_ = ReceiveMessages();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError($"WebSocket 连接失败:{e.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ReceiveMessages()
|
||||
{
|
||||
var buffer = new byte[1024];
|
||||
|
||||
try
|
||||
{
|
||||
while (_webSocket.State == WebSocketState.Open)
|
||||
{
|
||||
var result = await _webSocket.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None);
|
||||
|
||||
if (result.MessageType == WebSocketMessageType.Close)
|
||||
{
|
||||
Debug.Log("WebSocket 连接已被服务器关闭。");
|
||||
await _webSocket.CloseAsync(WebSocketCloseStatus.NormalClosure, "关闭连接", CancellationToken.None);
|
||||
}
|
||||
else
|
||||
{
|
||||
var message = Encoding.UTF8.GetString(buffer, 0, result.Count);
|
||||
Debug.Log($"接收到消息:{message}");
|
||||
|
||||
var baseResponse = JsonConvert.DeserializeObject<BaseResponse>(message);
|
||||
Promptmgr.Instance.PromptBubble(baseResponse.message);
|
||||
if (baseResponse != null)
|
||||
{
|
||||
switch (baseResponse.code)
|
||||
{
|
||||
// 解析消息为 Fishresponse 对象
|
||||
case "WEST_COWBOY_INFO":
|
||||
// 解析为 FishJoinroomresponse 类型
|
||||
WesternInforesponse fishResponse = JsonConvert.DeserializeObject<WesternInforesponse>(message);
|
||||
|
||||
if (fishResponse?.data != null)
|
||||
{
|
||||
Debug.Log(fishResponse.data.balance);
|
||||
Debug.Log(fishResponse.data.intro_text);
|
||||
Debug.Log(fishResponse.data.countdown);
|
||||
Debug.Log(fishResponse.data.countdown_type);
|
||||
foreach (var item in fishResponse.data.betting_data)
|
||||
{
|
||||
Debug.Log(""+item.pos_8);
|
||||
Debug.Log("" + item.pos_7);
|
||||
Debug.Log("" + item.pos_6);
|
||||
Debug.Log("" + item.pos_5);
|
||||
Debug.Log("" + item.pos_4);
|
||||
Debug.Log("" + item.pos_3);
|
||||
Debug.Log("" + item.pos_2);
|
||||
Debug.Log("" + item.pos_1);
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
//西部牛仔离开房间
|
||||
case "WEST_COWBOY_LEAVE":
|
||||
Promptmgr.Instance.PromptBubble(baseResponse.message);
|
||||
// 检查是否成功反序列化
|
||||
break;
|
||||
// 牛仔投入
|
||||
case "WEST_COWBOY_BETTING":
|
||||
|
||||
|
||||
WesternBetesponse fishResponse2 = JsonConvert.DeserializeObject<WesternBetesponse>(message);
|
||||
//Promptmgr.Instance.PromptBubble(fishResponse2.message);
|
||||
// 检查是否成功反序列化
|
||||
if (fishResponse2 != null && fishResponse2.data != null)
|
||||
{
|
||||
Debug.Log(fishResponse2.data.balance);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("收到的消息无法解析为 Fishresponse 对象。");
|
||||
}
|
||||
break;
|
||||
case "WEST_COWBOY_COUNTDOWN":
|
||||
WesternInforesponse fishResponse3 = JsonConvert.DeserializeObject<WesternInforesponse>(message);
|
||||
|
||||
if (fishResponse3?.data != null)
|
||||
{
|
||||
Debug.Log(fishResponse3.data.balance);
|
||||
Debug.Log(fishResponse3.data.intro_text);
|
||||
Debug.Log(fishResponse3.data.countdown);
|
||||
Debug.Log(fishResponse3.data.countdown_type);
|
||||
foreach (var item in fishResponse3.data.betting_data)
|
||||
{
|
||||
Debug.Log("" + item.pos_8);
|
||||
Debug.Log("" + item.pos_7);
|
||||
Debug.Log("" + item.pos_6);
|
||||
Debug.Log("" + item.pos_5);
|
||||
Debug.Log("" + item.pos_4);
|
||||
Debug.Log("" + item.pos_3);
|
||||
Debug.Log("" + item.pos_2);
|
||||
Debug.Log("" + item.pos_1);
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError($"接收消息时出错:{e.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public async Task SendJsonMessage(int count,int pos)
|
||||
{
|
||||
if (_webSocket == null || _webSocket.State != WebSocketState.Open)
|
||||
{
|
||||
Debug.LogError("WebSocket 未连接,无法发送消息。");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var message = new
|
||||
{
|
||||
code = "WEST_COWBOY",
|
||||
content = $"{{\"action\":\"BETTING\",\"amount\":{count},\"count\":{pos}}}"
|
||||
};
|
||||
|
||||
// 将对象序列化为 JSON 字符串
|
||||
string jsonMessage = JsonConvert.SerializeObject(message);
|
||||
var encodedMessage = Encoding.UTF8.GetBytes(jsonMessage);
|
||||
var buffer = new ArraySegment<byte>(encodedMessage);
|
||||
|
||||
await _webSocket.SendAsync(buffer, WebSocketMessageType.Text, true, CancellationToken.None);
|
||||
Debug.Log($"已发送 JSON 消息:{jsonMessage}");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError($"发送消息时出错:{e.Message}");
|
||||
}
|
||||
}
|
||||
public async Task SendJsonMessage(string json)
|
||||
{
|
||||
if (_webSocket == null || _webSocket.State != WebSocketState.Open)
|
||||
{
|
||||
Debug.LogError("WebSocket 未连接,无法发送消息。");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var encodedMessage = Encoding.UTF8.GetBytes(json);
|
||||
var buffer = new ArraySegment<byte>(encodedMessage);
|
||||
|
||||
await _webSocket.SendAsync(buffer, WebSocketMessageType.Text, true, CancellationToken.None);
|
||||
Debug.Log($"已发送 JSON 消息:{json}");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError($"发送消息时出错:{e.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private async void OnApplicationQuit()
|
||||
{
|
||||
if (_webSocket != null && _webSocket.State == WebSocketState.Open)
|
||||
{
|
||||
await _webSocket.CloseAsync(WebSocketCloseStatus.NormalClosure, "应用程序退出", CancellationToken.None);
|
||||
_webSocket.Dispose();
|
||||
Debug.Log("WebSocket 连接已关闭。");
|
||||
}
|
||||
}
|
||||
|
||||
public void disbalance(float detail)
|
||||
{
|
||||
balance.text = detail.ToString();
|
||||
}
|
||||
|
||||
void UpdateCountdownText(float remainingTime)
|
||||
{
|
||||
|
||||
// 将剩余时间转换为小时、分钟和秒
|
||||
int hours = Mathf.FloorToInt(remainingTime / 3600);
|
||||
int minutes = Mathf.FloorToInt((remainingTime % 3600) / 60);
|
||||
int seconds = Mathf.FloorToInt(remainingTime % 60);
|
||||
|
||||
// 使用格式化字符串显示倒计时(00:00:00)
|
||||
TimeText.text = string.Format("{0:D2}:{1:D2}:{2:D2}", hours, minutes, seconds);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Time.time - lastCallTime >= interval)
|
||||
{
|
||||
// 每秒调用一次的代码
|
||||
if (remainingTime > 0)
|
||||
{
|
||||
remainingTime -= 1;
|
||||
UpdateCountdownText(remainingTime);
|
||||
Debug.Log("进入倒计时");
|
||||
}
|
||||
if (remainingTime <= 0)
|
||||
{
|
||||
TimeText.gameObject.transform.parent.gameObject.SetActive(false);
|
||||
}
|
||||
// 更新上次调用时间
|
||||
lastCallTime = Time.time;
|
||||
}
|
||||
}
|
||||
}
|
||||
public class WesternInforesponse
|
||||
{
|
||||
public string code { get; set; }
|
||||
public string message { get; set; }
|
||||
public FWesternInfoData data { get; set; }
|
||||
}
|
||||
|
||||
public class FWesternInfoData
|
||||
{
|
||||
public float balance { get; set; }
|
||||
|
||||
public string intro_text { get; set; }
|
||||
public int countdown { get; set; }
|
||||
public int countdown_type { get; set; }
|
||||
public List<FWesternInfo> betting_data { get; set; }
|
||||
}
|
||||
|
||||
public class FWesternInfo
|
||||
{
|
||||
public float pos_1;
|
||||
|
||||
public float pos_2;
|
||||
public float pos_3;
|
||||
public float pos_4;
|
||||
public float pos_5;
|
||||
public float pos_6;
|
||||
public float pos_7;
|
||||
public float pos_8;
|
||||
}
|
||||
public class WesternBetesponse
|
||||
{
|
||||
public string code { get; set; }
|
||||
public string message { get; set; }
|
||||
public WesternBetedata data { get; set; }
|
||||
}
|
||||
public class WesternBetedata
|
||||
{
|
||||
public float balance { get; set; }
|
||||
}
|
||||
public class WesternCDresponse
|
||||
{
|
||||
public string code { get; set; }
|
||||
public string message { get; set; }
|
||||
public FWesternInfoData data { get; set; }
|
||||
}
|
||||
|
||||
public class FWesternCDData
|
||||
{
|
||||
public int countdown { get; set; }
|
||||
public int countdown_type { get; set; }
|
||||
public List<FWesternInfo> betting_data { get; set; }
|
||||
}
|
||||
|
||||
public class FWesternCD
|
||||
{
|
||||
public float pos_1;
|
||||
|
||||
public float pos_2;
|
||||
public float pos_3;
|
||||
public float pos_4;
|
||||
public float pos_5;
|
||||
public float pos_6;
|
||||
public float pos_7;
|
||||
public float pos_8;
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9163bcd1e1639854aae4695bd6c798d4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -10,6 +10,8 @@ public class Scene_jinbikuang : MonoBehaviour
|
||||
|
||||
public List<GameObject> lands = new List<GameObject>();
|
||||
|
||||
List<roomcontroller> allroom = new List<roomcontroller>();
|
||||
|
||||
public GameObject Awaitmusk;
|
||||
void Awake()
|
||||
{
|
||||
@ -37,6 +39,7 @@ public class Scene_jinbikuang : MonoBehaviour
|
||||
foreach (MinngConfigData info in infos)
|
||||
{
|
||||
roomcontroller go = lands[index].GetComponent<roomcontroller>();
|
||||
allroom.Add(go);
|
||||
go.RoomId = info.id;
|
||||
go.ActivateValue = info.price;
|
||||
|
||||
@ -56,4 +59,7 @@ public class Scene_jinbikuang : MonoBehaviour
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,12 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public enum minerShip
|
||||
{
|
||||
miner,
|
||||
ship
|
||||
}
|
||||
public class Buyshipitem : MonoBehaviour
|
||||
{
|
||||
public Image head;
|
||||
@ -11,6 +17,10 @@ public class Buyshipitem : MonoBehaviour
|
||||
public Text prize;
|
||||
public Button Buybtn;
|
||||
public GameObject lands;
|
||||
public minerShip ship;
|
||||
|
||||
public jskPanel jsk;
|
||||
public jishadao_buy jishadao_Buy;
|
||||
void Start()
|
||||
{
|
||||
Buybtn.onClick.AddListener(BuyClick);
|
||||
@ -18,7 +28,17 @@ public class Buyshipitem : MonoBehaviour
|
||||
|
||||
void BuyClick()
|
||||
{
|
||||
lands.GetComponent<jishadao_contorl>().BuyActivation();
|
||||
if (ship == minerShip.ship)
|
||||
{
|
||||
lands.GetComponent<jishadao_contorl>().jsdbuy = this.jishadao_Buy;
|
||||
lands.GetComponent<jishadao_contorl>().BuyActivation();
|
||||
}
|
||||
else
|
||||
{
|
||||
lands.GetComponent<roomcontroller>().jsk = this.jsk;
|
||||
lands.GetComponent<roomcontroller>().BuyActivation();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
|
@ -14,9 +14,13 @@ public class jskPanel : mount
|
||||
|
||||
public List<GameObject> lands = new List<GameObject>();
|
||||
|
||||
public bool Generate1 = false;
|
||||
public bool Generate2 = false;
|
||||
public bool Generate3 = false;
|
||||
public GameObject MineSelection;
|
||||
public Transform Canvas;
|
||||
|
||||
public List<GameObject> itemlist = new List<GameObject>();
|
||||
public List<GameObject> mineritemlist = new List<GameObject>();
|
||||
|
||||
GameObject obj;
|
||||
public override void Awake()
|
||||
{
|
||||
instance = this;
|
||||
@ -24,87 +28,95 @@ public class jskPanel : mount
|
||||
|
||||
public async void buy_ship()
|
||||
{
|
||||
// Cinemachine_2dCon.SetCameraContorl(false);
|
||||
//Debug.LogError("禁用生成船只逻辑");
|
||||
jishadao_contorl.canClick = false;
|
||||
List<BoxType> boxTypes = new List<BoxType>();
|
||||
int index = 1;
|
||||
|
||||
obj = Instantiate(MineSelection, Canvas);
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
boxTypes.Add(new BoxType { Name = index.ToString() + "文本", prompt = "第" + ArabicToChineseNumberConverter.ConvertToChineseNumbers(index.ToString()) + "层", Type = 4, is_required = true });
|
||||
boxTypes.Add(new BoxType { Name = "捕鱼" + index.ToString(), prompt = "挖矿" + 1,prompt2 = "矿工"+(i+1),nametext1="剩余数量:"+ (lands[i].GetComponent<roomcontroller>().MaxShipNumber - lands[i].GetComponent<roomcontroller>().shipNumber), Type = 3, goldNumerobj = lands[i].GetComponent<roomcontroller>().ActivateValue.ToString(), icon = iconS[index - 1] });
|
||||
index++;
|
||||
GameObject ob = Instantiate(obj.GetComponent<ShipSelection>().Buyshipitem, obj.GetComponent<ShipSelection>().BuyshipConnact);
|
||||
itemlist.Add(ob);
|
||||
ob.GetComponent<Buyshipitem>().head.sprite = iconS[i];
|
||||
ob.GetComponent<Buyshipitem>().shipname.text = "矿工" + (i + 1);
|
||||
ob.GetComponent<Buyshipitem>().Layernumber.text = "第" + ArabicToChineseNumberConverter.ConvertToChineseNumbers((i + 1).ToString()) + "层";
|
||||
ob.GetComponent<Buyshipitem>().Buynumber.text = "剩余数量:" + (lands[i].GetComponent<roomcontroller>().MaxShipNumber - lands[i].GetComponent<roomcontroller>().shipNumber).ToString();
|
||||
ob.GetComponent<Buyshipitem>().prize.text = lands[i].GetComponent<roomcontroller>().ActivateValue.ToString();
|
||||
ob.GetComponent<Buyshipitem>().lands = lands[i];
|
||||
ob.GetComponent<Buyshipitem>().ship = minerShip.miner;
|
||||
ob.GetComponent<Buyshipitem>().jsk = this;
|
||||
}
|
||||
InitminerItem();
|
||||
}
|
||||
|
||||
|
||||
async void InitminerItem()
|
||||
{
|
||||
miningActivatelistResponse response = await Scene_main_jiekou.instance.MiningActivatelists(11);
|
||||
for (int i = 0; i < response.data.Length; i++)
|
||||
{
|
||||
GameObject item = Instantiate(obj.GetComponent<ShipSelection>().Myshipitem, obj.GetComponent<ShipSelection>().myshipConnact);
|
||||
mineritemlist.Add(item);
|
||||
switch (response.data[i].mining_level)
|
||||
{
|
||||
case 1:
|
||||
item.GetComponent<Myshipitem>().head.sprite = iconS[0];
|
||||
item.GetComponent<Myshipitem>().shipname.text = "矿工1";
|
||||
item.GetComponent<Myshipitem>().Layernumber.text = "第" + ArabicToChineseNumberConverter.ConvertToChineseNumbers((1).ToString()) + "层";
|
||||
item.GetComponent<Myshipitem>().Yieldnumber.text = response.data[i].surplus_yield.ToString();
|
||||
item.GetComponent<Myshipitem>().Daynumber.text = response.data[i].surplus_count.ToString() + "天";
|
||||
break;
|
||||
case 2:
|
||||
item.GetComponent<Myshipitem>().head.sprite = iconS[1];
|
||||
item.GetComponent<Myshipitem>().shipname.text = "矿工2";
|
||||
item.GetComponent<Myshipitem>().Layernumber.text = "第" + ArabicToChineseNumberConverter.ConvertToChineseNumbers((2).ToString()) + "层";
|
||||
item.GetComponent<Myshipitem>().Yieldnumber.text = response.data[i].surplus_yield.ToString();
|
||||
item.GetComponent<Myshipitem>().Daynumber.text = response.data[i].surplus_count.ToString() + "天";
|
||||
break;
|
||||
case 3:
|
||||
item.GetComponent<Myshipitem>().head.sprite = iconS[2];
|
||||
item.GetComponent<Myshipitem>().shipname.text = "矿工3";
|
||||
item.GetComponent<Myshipitem>().Layernumber.text = "第" + ArabicToChineseNumberConverter.ConvertToChineseNumbers((3).ToString()) + "层";
|
||||
item.GetComponent<Myshipitem>().Yieldnumber.text = response.data[i].surplus_yield.ToString();
|
||||
item.GetComponent<Myshipitem>().Daynumber.text = response.data[i].surplus_count.ToString() + "天";
|
||||
break;
|
||||
case 4:
|
||||
item.GetComponent<Myshipitem>().head.sprite = iconS[3];
|
||||
item.GetComponent<Myshipitem>().shipname.text = "矿工4";
|
||||
item.GetComponent<Myshipitem>().Layernumber.text = "第" + ArabicToChineseNumberConverter.ConvertToChineseNumbers((4).ToString()) + "层";
|
||||
item.GetComponent<Myshipitem>().Yieldnumber.text = response.data[i].surplus_yield.ToString();
|
||||
item.GetComponent<Myshipitem>().Daynumber.text = response.data[i].surplus_count.ToString() + "天";
|
||||
break;
|
||||
case 5:
|
||||
item.GetComponent<Myshipitem>().head.sprite = iconS[4];
|
||||
item.GetComponent<Myshipitem>().shipname.text = "矿工5";
|
||||
item.GetComponent<Myshipitem>().Layernumber.text = "第" + ArabicToChineseNumberConverter.ConvertToChineseNumbers((5).ToString()) + "层";
|
||||
item.GetComponent<Myshipitem>().Yieldnumber.text = response.data[i].surplus_yield.ToString();
|
||||
item.GetComponent<Myshipitem>().Daynumber.text = response.data[i].surplus_count.ToString() + "天";
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GameObject gameObject = add_pop_up();
|
||||
gameObject.GetComponent<input_box_pop_up_window>().minHeight = 800;//设置最低高度
|
||||
gameObject.GetComponent<input_box_pop_up_window>().setScrollMode(1);//设置滚动模式为滚动
|
||||
//gameObject.GetComponent<input_box_pop_up_window>().setScrollMode(0);//设置滚动模式为自动填充
|
||||
List<GameObject> gameObjects = gameObject.GetComponent<input_box_pop_up_window>().updateUI(boxTypes, "购买人才");//测试输入框回调处理
|
||||
|
||||
gameObject.GetComponent<input_box_pop_up_window>().OnEnd += () =>
|
||||
{
|
||||
//关闭摄像头逻辑
|
||||
// Cinemachine_2dCon.SetCameraContorl(true);
|
||||
jishadao_contorl.canClick = true;
|
||||
};
|
||||
|
||||
gameObjects[1].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
|
||||
{
|
||||
if (type == 1)
|
||||
{
|
||||
if (!Generate1)
|
||||
{
|
||||
lands[0].GetComponent<roomcontroller>().BuyActivation();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
gameObjects[3].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
|
||||
{
|
||||
if (type == 1)
|
||||
{
|
||||
if (!Generate1)
|
||||
{
|
||||
|
||||
lands[1].GetComponent<roomcontroller>().BuyActivation();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
gameObjects[5].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
|
||||
{
|
||||
if (type == 1)
|
||||
{
|
||||
if (!Generate1)
|
||||
{
|
||||
lands[2].GetComponent<roomcontroller>().BuyActivation();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
gameObjects[7].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
|
||||
{
|
||||
if (type == 1)
|
||||
{
|
||||
if (!Generate1)
|
||||
{
|
||||
lands[3].GetComponent<roomcontroller>().BuyActivation();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
gameObjects[9].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
|
||||
{
|
||||
if (type == 1)
|
||||
{
|
||||
if (!Generate1)
|
||||
{
|
||||
lands[4].GetComponent<roomcontroller>().BuyActivation();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void UpdateminerItem()
|
||||
{
|
||||
foreach (GameObject bj in mineritemlist)
|
||||
{
|
||||
Destroy(bj);
|
||||
}
|
||||
mineritemlist.Clear();
|
||||
|
||||
InitminerItem();
|
||||
}
|
||||
|
||||
public async void Updataitem()
|
||||
{
|
||||
List<MinngConfigData> infos = await miner_jiekou.instance.GetMinerInfo(11);
|
||||
|
||||
for (int i = 0; i < itemlist.Count; i++)
|
||||
{
|
||||
itemlist[i].GetComponent<Buyshipitem>().Buynumber.text = "剩余数量:" + (infos[i].activate_limit - infos[i].activate_count);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ public class roomcontroller : MonoBehaviour
|
||||
public int shipNumber;
|
||||
public int MaxShipNumber = 10;
|
||||
|
||||
public jskPanel jsk;
|
||||
public int ShipNumber
|
||||
{
|
||||
get => shipNumber;
|
||||
@ -117,6 +118,9 @@ public class roomcontroller : MonoBehaviour
|
||||
if (await ActivationRoom())
|
||||
{
|
||||
add_fish();
|
||||
|
||||
jsk.Updataitem();
|
||||
jsk.UpdateminerItem();
|
||||
this.ShipNumber += 1;
|
||||
}
|
||||
}
|
||||
|
@ -18,9 +18,10 @@ public class jishadao_buy :mount
|
||||
public GameObject shipSelection;
|
||||
public Transform Canvas;
|
||||
|
||||
public bool Generate1 = false;
|
||||
public bool Generate2 = false;
|
||||
public bool Generate3 = false;
|
||||
public List<GameObject> itemlist = new List<GameObject>();
|
||||
public List<GameObject> mineritemlist = new List<GameObject>();
|
||||
|
||||
GameObject obj;
|
||||
public override void Awake()
|
||||
{
|
||||
instance = this;
|
||||
@ -28,78 +29,82 @@ public class jishadao_buy :mount
|
||||
|
||||
public async void buy_ship()
|
||||
{
|
||||
//// Cinemachine_2dCon.SetCameraContorl(false);
|
||||
////Debug.LogError("禁用生成船只逻辑");
|
||||
//jishadao_contorl.canClick = false;
|
||||
//List<BoxType> boxTypes = new List<BoxType>();
|
||||
obj = Instantiate(shipSelection, Canvas);
|
||||
|
||||
//int index = 1;
|
||||
//for (int i = 0; i < 3; i++)
|
||||
//{
|
||||
// boxTypes.Add(new BoxType { Name = index.ToString() + "文本", prompt = "第" + ArabicToChineseNumberConverter.ConvertToChineseNumbers(index.ToString()) + "层", Type = 4, is_required = true });
|
||||
// boxTypes.Add(new BoxType { Name = "捕鱼" + index.ToString(), prompt = "捕鱼" + 1, prompt2 = "捕鱼船" + (i + 1), nametext1 = "剩余数量:" + (lands[i].GetComponent<jishadao_contorl>().MaxShipNumber - lands[i].GetComponent<jishadao_contorl>().shipNumber), Type = 3, goldNumerobj = lands[i].GetComponent<jishadao_contorl>().ActivateValue.ToString(), icon = iconS[index - 1] });
|
||||
// index++;
|
||||
//}
|
||||
|
||||
//GameObject gameObject = add_pop_up();
|
||||
//gameObject.GetComponent<input_box_pop_up_window>().minHeight = 800;//设置最低高度
|
||||
//gameObject.GetComponent<input_box_pop_up_window>().setScrollMode(1);//设置滚动模式为滚动
|
||||
////gameObject.GetComponent<input_box_pop_up_window>().setScrollMode(0);//设置滚动模式为自动填充
|
||||
//List<GameObject> gameObjects = gameObject.GetComponent<input_box_pop_up_window>().updateUI(boxTypes, "购买人才");//测试输入框回调处理
|
||||
|
||||
//gameObject.GetComponent<input_box_pop_up_window>().OnEnd += () =>
|
||||
//{
|
||||
// //关闭摄像头逻辑
|
||||
// // Cinemachine_2dCon.SetCameraContorl(true);
|
||||
// jishadao_contorl.canClick = true;
|
||||
//};
|
||||
GameObject obj = Instantiate(shipSelection, Canvas);
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
|
||||
GameObject ob = Instantiate(obj.GetComponent<ShipSelection>().Buyshipitem, obj.GetComponent<ShipSelection>().BuyshipConnact);
|
||||
itemlist.Add(ob);
|
||||
ob.GetComponent<Buyshipitem>().jishadao_Buy = this;
|
||||
ob.GetComponent<Buyshipitem>().head.sprite = iconS[i];
|
||||
ob.GetComponent<Buyshipitem>().shipname.text = "²¶Óã´¬" + (i + 1);
|
||||
ob.GetComponent<Buyshipitem>().Layernumber.text = "µÚ" + ArabicToChineseNumberConverter.ConvertToChineseNumbers((i + 1).ToString()) + "²ã";
|
||||
ob.GetComponent<Buyshipitem>().Buynumber.text ="Ê£ÓàÊýÁ¿:"+ (lands[i].GetComponent<jishadao_contorl>().MaxShipNumber - lands[i].GetComponent<jishadao_contorl>().shipNumber).ToString();
|
||||
ob.GetComponent<Buyshipitem>().prize.text = lands[i].GetComponent<jishadao_contorl>().ActivateValue.ToString();
|
||||
ob.GetComponent<Buyshipitem>().lands = lands[i];
|
||||
ob.GetComponent<Buyshipitem>().ship = minerShip.ship;
|
||||
}
|
||||
|
||||
|
||||
//gameObjects[1].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
|
||||
//{
|
||||
// if (type == 1)
|
||||
// {
|
||||
// if (!Generate1)
|
||||
// {
|
||||
// lands[0].GetComponent<jishadao_contorl>().BuyActivation();
|
||||
// }
|
||||
// }
|
||||
|
||||
//});
|
||||
//gameObjects[3].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
|
||||
//{
|
||||
// if (type == 1)
|
||||
// {
|
||||
// if (!Generate1)
|
||||
// {
|
||||
// lands[1].GetComponent<jishadao_contorl>().BuyActivation();
|
||||
// }
|
||||
// }
|
||||
|
||||
//});
|
||||
//gameObjects[5].GetComponent<input_box_pop_up_window_item>().register_click(async (BoxType boxType, int type) =>//登录确定或取消
|
||||
//{
|
||||
// if (type == 1)
|
||||
// {
|
||||
// if (!Generate1)
|
||||
// {
|
||||
// lands[2].GetComponent<jishadao_contorl>().BuyActivation();
|
||||
// }
|
||||
// }
|
||||
|
||||
//});
|
||||
InitminerItem();
|
||||
|
||||
}
|
||||
|
||||
async void InitminerItem()
|
||||
{
|
||||
miningActivatelistResponse response = await Scene_main_jiekou.instance.MiningActivatelists(10);
|
||||
for (int i = 0; i < response.data.Length; i++)
|
||||
{
|
||||
GameObject item = Instantiate(obj.GetComponent<ShipSelection>().Myshipitem, obj.GetComponent<ShipSelection>().myshipConnact);
|
||||
mineritemlist.Add(item);
|
||||
switch (response.data[i].mining_level)
|
||||
{
|
||||
case 1:
|
||||
item.GetComponent<Myshipitem>().head.sprite = iconS[0];
|
||||
item.GetComponent<Myshipitem>().shipname.text = "捕鱼船1";
|
||||
item.GetComponent<Myshipitem>().Layernumber.text = "第" + ArabicToChineseNumberConverter.ConvertToChineseNumbers((1).ToString()) + "层";
|
||||
item.GetComponent<Myshipitem>().Yieldnumber.text = response.data[i].surplus_yield.ToString();
|
||||
item.GetComponent<Myshipitem>().Daynumber.text = response.data[i].surplus_count.ToString() + "天";
|
||||
break;
|
||||
case 2:
|
||||
item.GetComponent<Myshipitem>().head.sprite = iconS[1];
|
||||
item.GetComponent<Myshipitem>().shipname.text = "捕鱼船2";
|
||||
item.GetComponent<Myshipitem>().Layernumber.text = "第" + ArabicToChineseNumberConverter.ConvertToChineseNumbers((2).ToString()) + "层";
|
||||
item.GetComponent<Myshipitem>().Yieldnumber.text = response.data[i].surplus_yield.ToString();
|
||||
item.GetComponent<Myshipitem>().Daynumber.text = response.data[i].surplus_count.ToString() + "天";
|
||||
break;
|
||||
case 3:
|
||||
item.GetComponent<Myshipitem>().head.sprite = iconS[2];
|
||||
item.GetComponent<Myshipitem>().shipname.text = "捕鱼船3";
|
||||
item.GetComponent<Myshipitem>().Layernumber.text = "第" + ArabicToChineseNumberConverter.ConvertToChineseNumbers((3).ToString()) + "层";
|
||||
item.GetComponent<Myshipitem>().Yieldnumber.text = response.data[i].surplus_yield.ToString();
|
||||
item.GetComponent<Myshipitem>().Daynumber.text = response.data[i].surplus_count.ToString() + "天";
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void UpdateminerItem()
|
||||
{
|
||||
foreach (GameObject bj in mineritemlist)
|
||||
{
|
||||
Destroy(bj);
|
||||
}
|
||||
mineritemlist.Clear();
|
||||
|
||||
InitminerItem();
|
||||
}
|
||||
|
||||
public async void Updataitem()
|
||||
{
|
||||
List<MinngConfigData> infos = await miner_jiekou.instance.GetMinerInfo(10);
|
||||
|
||||
for (int i = 0; i < infos.Count; i++)
|
||||
{
|
||||
itemlist[i].GetComponent<Buyshipitem>().Buynumber.text = "剩余数量:" + (infos[i].activate_limit - infos[i].activate_count);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -45,6 +45,8 @@ public class jishadao_contorl : MonoBehaviour
|
||||
public float restTimer = 5f;
|
||||
|
||||
|
||||
public jishadao_buy jsdbuy;
|
||||
|
||||
[Header("显示金币数量")]
|
||||
public Text goldNumerTextPro;
|
||||
[Header("显示船只数量")]
|
||||
@ -111,6 +113,9 @@ public class jishadao_contorl : MonoBehaviour
|
||||
if (await ActivationRoom())
|
||||
{
|
||||
add_fish();
|
||||
jsdbuy.Updataitem();
|
||||
jsdbuy.UpdateminerItem();
|
||||
|
||||
scene_jingshadao.instance.updatanumber();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,51 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
public class miningActivatelist : MonoBehaviour
|
||||
{
|
||||
public Dictionary<string, string> CreateHeaders()
|
||||
{
|
||||
if (string.IsNullOrEmpty(MyGlobal.global.loginResponse.Data.access_token))
|
||||
{
|
||||
Debug.LogWarning("尝试创建请求头时,token 未设置。");
|
||||
return new Dictionary<string, string>();
|
||||
}
|
||||
return new Dictionary<string, string>
|
||||
{
|
||||
|
||||
{ "Authorization","Bearer "+MyGlobal.global.loginResponse.Data.access_token },
|
||||
{ "client-info", "{\"platform\":\"ios\",\"phone_product\":\"apple\",\"phone_model\":\"iPhone_8\",\"system_version\":\"12.0\",\"screen_size\":\"750*1334\",\"device_no\":\"e3e277810fff9d955ebdd7037eff51a8\",\"version\":\"1.0.0\"}" }
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<miningActivatelistResponse> MiningActivatelist(int type)//类型 0:宝石岛 1:宝石矿场 10:金币岛 11:金币矿场
|
||||
{
|
||||
string response = await myWeb.SendRequest(myWeb.URL + "/api/mining/activate_list?type=" + type, "GET", "{}", CreateHeaders());
|
||||
Debug.Log("矿场激活列表" + response);
|
||||
miningActivatelistResponse miningActivatelistResponse = JsonConvert.DeserializeObject<miningActivatelistResponse>(response);
|
||||
return miningActivatelistResponse;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
[System.Serializable]
|
||||
public class miningActivatelistData
|
||||
{
|
||||
public int id;
|
||||
public int mining_id;
|
||||
public string mining_name;
|
||||
public int mining_level;
|
||||
public int mining_type;
|
||||
public int surplus_count;
|
||||
public float surplus_yield;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class miningActivatelistResponse:myResponse
|
||||
{
|
||||
public miningActivatelistData[] data;
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 002d2a46d16578d43b563973fb28263a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user