NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Framework/BI/BI.cs

220 lines
5.4 KiB
C#
Raw Normal View History

2024-05-14 15:29:31 +08:00
using System.Collections.Generic;
2025-05-13 15:27:38 +08:00
using UnityEngine;
using PhxhSDK;
using PhxhSDK.AOT.VersionUpdate;
2025-05-14 15:11:09 +08:00
#if UNITY_EDITOR
using UnityEditor;
#endif
2024-05-14 15:29:31 +08:00
/// <summary>
/// BI事件 用于本地缓存一次性事件
/// </summary>
public class StorageEvent
{
public List<string> EventList { get; set; }
public StorageEvent()
{
EventList = new List<string>();
}
public StorageEvent(List<string> eventStringList)
{
EventList = eventStringList;
}
}
/// <summary>
/// BI 需要上报的关卡内信息
/// </summary>
public class BILevelInfo
{
2025-04-22 15:39:26 +08:00
public int level_id { get; set; }
2024-05-14 15:29:31 +08:00
2025-04-22 15:39:26 +08:00
// 0主线 / 1资源 / 2 剧情 / 3 战役 / 4 非法值
public int level_type { get; set; } = 4;
// 0无难度区分 / 1 简单 / 2 困难
public int difficulty { get; set; }
// 0开始 /1 成功 / 2 :失败 / 3 中途退出
public int level_event { get; set; }
// 1标识开启扫荡
2025-05-13 15:27:38 +08:00
public int param0 { get; set; }
2025-04-22 15:39:26 +08:00
// 标识扫荡次数
public int param1 { get; set; }
2025-05-14 15:11:09 +08:00
2024-05-14 15:29:31 +08:00
public BILevelInfo()
{
}
2025-05-13 15:27:38 +08:00
public BILevelInfo(int levelID, int levelType, int difficulty, int levelEvent, int param0, int param1, int param2)
2025-04-22 15:39:26 +08:00
{
level_id = levelID;
level_type = levelType;
this.difficulty = difficulty;
level_event = levelEvent;
2025-05-13 15:27:38 +08:00
this.param0 = param0;
2025-04-22 15:39:26 +08:00
this.param1 = param1;
}
public void Clone(BILevelInfo biLevelInfo)
2024-05-14 15:29:31 +08:00
{
2025-04-22 15:39:26 +08:00
level_id = biLevelInfo.level_id;
level_type = biLevelInfo.level_type;
difficulty = biLevelInfo.difficulty;
level_event = biLevelInfo.level_event;
2025-05-13 15:27:38 +08:00
param0 = biLevelInfo.param0;
2025-04-22 15:39:26 +08:00
param1 = biLevelInfo.param1;
2024-05-14 15:29:31 +08:00
}
2025-05-13 15:27:38 +08:00
}
/// <summary>
/// BI 需要上报的关卡内信息
/// </summary>
public class BIBaseInfo
{
/// <summary>
/// 游戏ID
/// </summary>
2025-06-11 16:12:05 +08:00
public string app_name;
2025-05-13 15:27:38 +08:00
/// <summary>
/// 渠道
/// </summary>
public string channel;
/// <summary>
/// 设备型号
/// </summary>
public string model;
/// <summary>
/// 设备ID
/// </summary>
public string uuid;
/// <summary>
/// 分辨率
/// </summary>
public string resolution;
/// <summary>
2025-05-14 15:11:09 +08:00
/// 操作系统 安卓 ios
2025-05-13 15:27:38 +08:00
/// </summary>
public string platform;
2025-05-14 15:11:09 +08:00
/// <summary>
/// 操作系统
/// </summary>
public string os;
2025-05-13 15:27:38 +08:00
/// <summary>
/// 系统内存
/// </summary>
public string storage_info;
/// <summary>
/// 客户端版本
/// </summary>
public string version;
/// <summary>
/// build code
/// </summary>
public string build_code;
/// <summary>
/// 资源版本
/// </summary>
public string assets_version;
/// <summary>
/// 游戏语言
/// </summary>
public string language;
/// <summary>
/// 玩家id
/// </summary>
public string actor_id;
/// <summary>
/// 第三方账号源
/// </summary>
public string third_platform;
/// <summary>
/// 第三方id
/// </summary>
public string third_id;
2025-06-11 16:12:05 +08:00
/// <summary>
/// 中台access key
/// </summary>
public string access_key;
2025-05-13 15:27:38 +08:00
public BIBaseInfo()
{
// TODO gameid获取
2025-06-11 16:12:05 +08:00
app_name = "nld";
2025-05-26 19:26:29 +08:00
channel = PackDataInst.Inst.localInfo.workSpace;
2025-06-11 16:12:05 +08:00
access_key = PackDataInst.Inst.localInfo.httpAccessKey;
2025-05-13 15:27:38 +08:00
model = SystemInfo.deviceModel;
uuid = SystemInfo.deviceUniqueIdentifier;
resolution = Screen.width + "x" + Screen.height;
2025-05-14 15:11:09 +08:00
#if UNITY_EDITOR
if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android)
platform = "Android";
else if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS)
platform = "iOS";
else
platform = "Editor";
#else
platform = Application.platform == RuntimePlatform.Android ? "Android" :
Application.platform == RuntimePlatform.IPhonePlayer ? "iOS" : "Other";
#endif
os = SystemInfo.operatingSystem;
2025-05-13 15:27:38 +08:00
storage_info = SystemInfo.systemMemorySize.ToString();
version = Application.version;
2025-05-26 19:26:29 +08:00
build_code = PackDataInst.Inst.localInfo.buildCode;
assets_version = PackDataInst.Inst.localInfo.localFullVersion;
2025-05-13 15:27:38 +08:00
language = LanguageManager.CurLanguage.ToString();
}
public void SetUserInfo()
{
actor_id = SDKManager.Instance.ApplicationUserID;
third_platform = SDKManager.Instance.ThirdPartyPlatform;
third_id = SDKManager.Instance.ThirdPartyUserID;
}
/// <summary>
/// 打印所有属性值到控制台
/// </summary>
public void PrintAllValues()
{
2025-05-13 15:28:53 +08:00
Debug.Log("===== BIBaseInfo 所有属性值 =====");
2025-06-11 16:12:05 +08:00
Debug.Log($"app_name: {app_name}");
2025-05-13 15:28:53 +08:00
Debug.Log($"channel: {channel}");
Debug.Log($"model: {model}");
Debug.Log($"uuid: {uuid}");
Debug.Log($"resolution: {resolution}");
Debug.Log($"platform: {platform}");
2025-05-14 15:11:09 +08:00
Debug.Log($"os: {os}");
2025-05-13 15:28:53 +08:00
Debug.Log($"version: {version}");
Debug.Log($"build_code: {build_code}");
Debug.Log($"assets_version: {assets_version}");
Debug.Log($"language: {language}");
Debug.Log($"actor_id: {actor_id}");
Debug.Log($"third_platform: {third_platform}");
Debug.Log($"third_id: {third_id}");
Debug.Log($"storage_info: {storage_info}");
Debug.Log("================================");
2025-05-13 15:27:38 +08:00
}
2024-05-14 15:29:31 +08:00
}