This commit is contained in:
hyskai 2024-10-29 16:57:55 +08:00
parent cf2bfa2893
commit cc65145114
17 changed files with 215 additions and 385 deletions

View File

@ -1,87 +0,0 @@
using System.Collections;
using System.Net.Sockets;
using UnityEngine;
using UnityEngine.Networking;
public class RegisterUser : MonoBehaviour
{
// 注册 API 地址
private string registerUrl = "http://47.109.133.52/Player/Register"; // 使用你提供的IP地址
// 模拟注册数据
private string phone = "88888888888";
private string code = "123456";
private void Start()
{
Register();
}
// 注册按钮调用的函数
public void Register()
{
// 构造请求数据
StartCoroutine(RegisterCoroutine(phone, code));
}
// 协程用于发送POST请求并处理返回
IEnumerator RegisterCoroutine(string phone, string code)
{
// 创建POST请求的数据
string jsonData = JsonUtility.ToJson(new RegisterData(phone, code));
// 构造UnityWebRequest请求
using (UnityWebRequest request = new UnityWebRequest(registerUrl, "POST"))
{
byte[] bodyRaw = System.Text.Encoding.UTF8.GetBytes(jsonData);
request.uploadHandler = new UploadHandlerRaw(bodyRaw);
request.downloadHandler = new DownloadHandlerBuffer();
request.SetRequestHeader("Content-Type", "application/json");
// 发送请求并等待响应
yield return request.SendWebRequest();
// 检查请求是否出错
if (request.result == UnityWebRequest.Result.Success)
{
// 解析返回数据
string responseText = request.downloadHandler.text;
RegisterResponse response = JsonUtility.FromJson<RegisterResponse>(responseText);
Debug.Log("error code:"+response.ErrorCode+"\nerror message:"+response.ErrorMessage);
// 根据服务器返回的数据进行处理
if (response.ErrorCode == 0)
{
Debug.Log("注册成功");
}
else if (response.ErrorCode == 3)
{
Debug.Log("账号已经存在: " + response.ErrorMessage);
}
}
else
{
Debug.LogError("请求失败: " + request.error);
}
} // using 语句会自动调用 Dispose() 方法
}
}
// 注册请求数据类
[System.Serializable]
public class RegisterData
{
public string Phone;
public string Code;
public RegisterData(string phone, string code)
{
this.Phone = phone;
this.Code = code;
}
}
// 注册返回数据类
[System.Serializable]
public class RegisterResponse
{
public int ErrorCode;
public string ErrorMessage;
}

View File

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

View File

@ -4668,10 +4668,18 @@ PrefabInstance:
propertyPath: m_AnchorMin.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1309263783, guid: bcc7c174ff2f25442aff6e479fe3d954, type: 3}
propertyPath: m_SizeDelta.x
value: 717.92
objectReference: {fileID: 0}
- target: {fileID: 1309263783, guid: bcc7c174ff2f25442aff6e479fe3d954, type: 3}
propertyPath: m_SizeDelta.y
value: 236.8071
objectReference: {fileID: 0}
- target: {fileID: 1309263783, guid: bcc7c174ff2f25442aff6e479fe3d954, type: 3}
propertyPath: m_AnchoredPosition.x
value: 358.96
objectReference: {fileID: 0}
- target: {fileID: 1309263783, guid: bcc7c174ff2f25442aff6e479fe3d954, type: 3}
propertyPath: m_AnchoredPosition.y
value: -1105.632
@ -4684,10 +4692,18 @@ PrefabInstance:
propertyPath: m_AnchorMin.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1323663683, guid: bcc7c174ff2f25442aff6e479fe3d954, type: 3}
propertyPath: m_SizeDelta.x
value: 717.92
objectReference: {fileID: 0}
- target: {fileID: 1323663683, guid: bcc7c174ff2f25442aff6e479fe3d954, type: 3}
propertyPath: m_SizeDelta.y
value: 236.8071
objectReference: {fileID: 0}
- target: {fileID: 1323663683, guid: bcc7c174ff2f25442aff6e479fe3d954, type: 3}
propertyPath: m_AnchoredPosition.x
value: 358.96
objectReference: {fileID: 0}
- target: {fileID: 1323663683, guid: bcc7c174ff2f25442aff6e479fe3d954, type: 3}
propertyPath: m_AnchoredPosition.y
value: -858.8248
@ -4700,10 +4716,18 @@ PrefabInstance:
propertyPath: m_AnchorMin.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1370749644, guid: bcc7c174ff2f25442aff6e479fe3d954, type: 3}
propertyPath: m_SizeDelta.x
value: 717.92
objectReference: {fileID: 0}
- target: {fileID: 1370749644, guid: bcc7c174ff2f25442aff6e479fe3d954, type: 3}
propertyPath: m_SizeDelta.y
value: 236.8071
objectReference: {fileID: 0}
- target: {fileID: 1370749644, guid: bcc7c174ff2f25442aff6e479fe3d954, type: 3}
propertyPath: m_AnchoredPosition.x
value: 358.96
objectReference: {fileID: 0}
- target: {fileID: 1370749644, guid: bcc7c174ff2f25442aff6e479fe3d954, type: 3}
propertyPath: m_AnchoredPosition.y
value: -612.01776
@ -4852,10 +4876,18 @@ PrefabInstance:
propertyPath: m_AnchorMin.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 772119012549100884, guid: bcc7c174ff2f25442aff6e479fe3d954, type: 3}
propertyPath: m_SizeDelta.x
value: 717.92
objectReference: {fileID: 0}
- target: {fileID: 772119012549100884, guid: bcc7c174ff2f25442aff6e479fe3d954, type: 3}
propertyPath: m_SizeDelta.y
value: 236.8071
objectReference: {fileID: 0}
- target: {fileID: 772119012549100884, guid: bcc7c174ff2f25442aff6e479fe3d954, type: 3}
propertyPath: m_AnchoredPosition.x
value: 358.96
objectReference: {fileID: 0}
- target: {fileID: 772119012549100884, guid: bcc7c174ff2f25442aff6e479fe3d954, type: 3}
propertyPath: m_AnchoredPosition.y
value: -118.40355
@ -5176,10 +5208,18 @@ PrefabInstance:
propertyPath: m_AnchorMin.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8404034800197096179, guid: bcc7c174ff2f25442aff6e479fe3d954, type: 3}
propertyPath: m_SizeDelta.x
value: 717.92
objectReference: {fileID: 0}
- target: {fileID: 8404034800197096179, guid: bcc7c174ff2f25442aff6e479fe3d954, type: 3}
propertyPath: m_SizeDelta.y
value: 236.8071
objectReference: {fileID: 0}
- target: {fileID: 8404034800197096179, guid: bcc7c174ff2f25442aff6e479fe3d954, type: 3}
propertyPath: m_AnchoredPosition.x
value: 358.96
objectReference: {fileID: 0}
- target: {fileID: 8404034800197096179, guid: bcc7c174ff2f25442aff6e479fe3d954, type: 3}
propertyPath: m_AnchoredPosition.y
value: -365.21063

View File

@ -1030,6 +1030,8 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 559443431}
- component: {fileID: 559443433}
- component: {fileID: 559443432}
m_Layer: 0
m_Name: top1
m_TagString: Untagged
@ -1055,6 +1057,128 @@ Transform:
m_Father: {fileID: 787643888}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &559443432
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 559443430}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9aea6b85491b20b4ea34c75ad09c4ec9, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!61 &559443433
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 559443430}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 1
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: -0.07494098, y: -0.02869153}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0, y: 0}
oldSize: {x: 0, y: 0}
newSize: {x: 0, y: 0}
adaptiveTilingThreshold: 0
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 3.5458484, y: 3.319406}
m_EdgeRadius: 0
--- !u!1 &732952406
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 732952408}
- component: {fileID: 732952407}
m_Layer: 0
m_Name: cuizhi
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!212 &732952407
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 732952406}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: f6884187fb833964ea9e632b9d5a8252, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 0.87, y: 0.93}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!4 &732952408
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 732952406}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -3.32, y: 4.46, z: -8}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &733512739
GameObject:
m_ObjectHideFlags: 0

View File

@ -1,27 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEditor.PackageManager;
using UnityEngine;
using UnityEngine.UI;
public class UpdateChiclPosition : MonoBehaviour
{
short previousChildCount;
// Start is called before the first frame update
void Start()
{
previousChildCount = (short)transform.childCount;
}
// Update is called once per frame
void Update()
{
if (transform.childCount>previousChildCount)
{
previousChildCount = (short)transform.childCount;
;
}
}
}

View File

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

View File

@ -1,87 +0,0 @@
fileFormatVersion: 2
guid: d14a2fc7584e340489c8de3662c07f57
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,87 +0,0 @@
fileFormatVersion: 2
guid: 889b99946f04eff448e4e5c5193428cd
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings: []
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -29,9 +29,7 @@ public class room : MonoBehaviour
public GameObject Boom;
// Start is called before the first frame update
void Start()
{
/*haveNumber_text.text = haveNumber.ToString() + "/" + maxNumer.ToString();
toolsNumber_text.text = toolsNumber.ToString() + "/" + maxNumer.ToString(); */
{
if (toolsNumber_text==null)
{
toolsNumber = 10;
@ -58,6 +56,29 @@ public class room : MonoBehaviour
}
private async void OnTouch()
{
if (haveNumber < 1 || toolsNumber < 1)
{
Promptmgr.Instance.PromptBubble("ÈËÊý»ò¹¤¾ß²»×ã", Color.black, Color.red);
return;
}
haveNumber--;
toolsNumber--;
UpdateShowCazhi();
ChangeTextPro();
//Vector3
GameObject.Instantiate(Boom, new Vector3(startPos.position.x, startPos.position.y + 0.5f, startPos.position.z - 1f), Quaternion.identity);
await Task.Delay(500);
GameObject newMiner = GameObject.Instantiate(minerPrefab);
newMiner.transform.SetParent(startPos);
newMiner.transform.position = startPos.position;
}
private async void OnMouseDown()
{
if (haveNumber<1||toolsNumber<1)

View File

@ -1,6 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
public class landContorl : MonoBehaviour
{
@ -15,4 +16,9 @@ public class landContorl : MonoBehaviour
{
}
private void OnMouseDown()
{
}
}

View File

@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
public class shipcontorl : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: f368307b2ff693c4a8ad9b8b29920664
guid: 8ed7be4c620c11047bd3ae8a4b7fe15e
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -1,37 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class text : MonoBehaviour
{
public event Action TimeEnd;
private float tim = 0f;
public Image img;
bool is_time_ing = true;
float time_max = 0;
public void upadte_time(float times)
{
tim = times;
time_max = times;
is_time_ing = false;
}
// Update is called once per frame
void Update()
{
if (tim > 0)
{
tim -= Time.deltaTime;
img.fillAmount = tim / time_max;
}
else if (!is_time_ing)
{
is_time_ing = true;
TimeEnd.Invoke();
}
}
}

View File

@ -1,23 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class text_1 : MonoBehaviour
{
private text t1;
// Start is called before the first frame update
void Start()
{
t1 = this.GetComponent<text>();
t1.TimeEnd += test;
t1.upadte_time(1);
}
void test()
{
Debug.Log("计时器完成了!");
}
}

View File

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