feat: 添加国家选择组件与设备统计上报功能

1. 新增国家选择UI组件与相关配置文件
2. 新增多语言国家列表支持与获取接口
3. 新增设备统计数据上报定时任务
4. 修复固件版本号计算的索引错误
5. 添加新的多语言提示文案
This commit is contained in:
“虞渠成” 2026-07-10 16:11:09 +08:00
parent 4f6399f0b0
commit be9d69f6eb
11 changed files with 2209 additions and 2 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6f081b83564ce6a42ac50aa5549bd454
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1513,6 +1513,11 @@
"key": "100303",
"zh": "获取到{0}条消杀数据,正在上传,请稍后",
"en": "Uploading {0} elimination records,please wait..."
},
{
"key": "100304",
"zh": "请选择国家/地区",
"en": "Select country/region"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,127 @@
fileFormatVersion: 2
guid: 3c656d13373f4534e80407d7f22b3455
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -499,6 +499,13 @@ namespace Kill.Managers
public float distance;
}
public class PostStatisticsData
{
public string device_sn;
public uint kill_count;
public uint total_work_time;
}
public class FileRequest
{
public byte[] file;

View File

@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
using Newtonsoft.Json;
using UnityEngine;
@ -17,8 +18,16 @@ namespace Kill.Managers
public string zh;
public string en;
}
[System.Serializable]
public struct Country
{
public string code;
public string name_zh;
public string name_en;
}
List<Language> languageList;
public List<Country> countryList;
[System.Serializable]
public enum LanguageType
@ -80,6 +89,9 @@ namespace Kill.Managers
{
TextAsset textAsset = await LoadRes.Instance.LoadAssetAsync<TextAsset>("language", "language.json");
languageList = JsonConvert.DeserializeObject<List<Language>>(textAsset.text);
TextAsset countryAsset = await LoadRes.Instance.LoadAssetAsync<TextAsset>("language", "country.json");
countryList = JsonConvert.DeserializeObject<List<Country>>(countryAsset.text);
Debug.Log(countryList[0].name_zh);
}
public string GetLanguage(string key)
{
@ -91,5 +103,9 @@ namespace Kill.Managers
else
return languageList[index].en;
}
public Country GetCountry(string code)
{
return countryList.Find((x)=>x.code==code);
}
}
}

View File

@ -0,0 +1,15 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Kill.Managers;
public class SelectCountry : MonoBehaviour
{
public GameObject countryPrefab;
public Transform countryParent;
LanguageManager.Country selectCountry;
public void Init(string code)
{
}
}

View File

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

View File

@ -57,12 +57,12 @@ namespace Kill.UI.Pages
string[] nowVersionParts = nowVersion.Split('.');
int nowversionNum = 0;
int versionNum = 0;
int index=0;
int index=1;
for(int i=nowVersionParts.Length-1;i>=0;i--)
{
nowversionNum += int.Parse(nowVersionParts[i]) * 10*index++;
}
index = 0;
index = 1;
for (int i = versionParts.Length - 1; i >= 0; i--)
{
versionNum += int.Parse(versionParts[i]) * 10 * index++;

View File

@ -1241,6 +1241,7 @@ namespace Kill.UI.Pages
while(hasBluetooth)
{
GetDeviceStatus();
UploadStatisticsData();
yield return new WaitForSeconds(30);
}
}
@ -1395,6 +1396,30 @@ namespace Kill.UI.Pages
waitTime = 0;
homePageChartsCtrl.Init();
}
/// <summary>
/// 读取设备统计数据并上传到服务器
/// </summary>
public async void UploadStatisticsData()
{
if (!hasBluetooth || selectedDevice == null) return;
BLECommunicationManager.Instance.ReadStatisticsData((stats) =>
{
Loom.QueueOnMainThread(async () =>
{
var postData = new PostStatisticsData
{
device_sn = selectedDevice.ble_mac,
kill_count = stats.EliminateCount,
total_work_time = stats.TotalWorkTime,
};
var response = await NetworkCtrl.Instance.Post<NoDataResponse>("/api/v1/device/stats", postData);
ResponseCodeHandler.HandleResponse(response, null, null);
Debug.Log($"[HomePageCtrl] 上传统计数据: 灭虫={stats.EliminateCount}, 总工时={stats.TotalWorkTime}s");
});
});
}
List<MosquitoData> mosquitoDatas;
int aimMosquitoDataCount=0;
Coroutine waitToPostMosquitoDatas=null;