2024-01-22 15:38:06 +08:00
|
|
|
|
using cfg.ActorCfg;
|
|
|
|
|
|
using Code.Scripts.Gameplay.Game;
|
2024-01-19 17:05:59 +08:00
|
|
|
|
using Cysharp.Threading.Tasks;
|
2024-01-22 15:38:06 +08:00
|
|
|
|
using Framework;
|
|
|
|
|
|
using Gameplay;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
using Gameplay.Character;
|
2024-01-19 17:05:59 +08:00
|
|
|
|
using Gameplay.Net;
|
2023-12-13 16:20:41 +08:00
|
|
|
|
using Gameplay.Unit;
|
|
|
|
|
|
using Gameplay.Unit.Data;
|
2024-01-19 17:05:59 +08:00
|
|
|
|
using System.ComponentModel;
|
2024-01-22 15:38:06 +08:00
|
|
|
|
using System.Drawing.Text;
|
2024-10-18 14:53:50 +08:00
|
|
|
|
using Gameplay.Common;
|
2025-04-21 14:15:00 +08:00
|
|
|
|
using UnityEngine;
|
2024-04-15 12:48:19 +08:00
|
|
|
|
using YooAsset;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
|
|
|
|
|
|
public partial class SROptions
|
|
|
|
|
|
{
|
2025-02-20 20:02:12 +08:00
|
|
|
|
//[Category("GM"), DisplayName("机器人数据初始化")] 25/2/20 关闭DEBUGGER功能
|
|
|
|
|
|
//public void SendRobotTestInit()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// if (UnityEngine.Application.isPlaying)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// Gameplay.Net.NetHelper.RobotTestInit();
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
//[Category("GM"), DisplayName("测试剧情ID")] 25/2/20 关闭DEBUGGER功能
|
|
|
|
|
|
//public string testStoryId
|
|
|
|
|
|
//{
|
|
|
|
|
|
// get;
|
|
|
|
|
|
// set;
|
|
|
|
|
|
//} = "0_1_1";
|
|
|
|
|
|
//
|
|
|
|
|
|
//[Category("GM"), DisplayName("进入测试剧情")] 25/2/20 关闭DEBUGGER功能
|
|
|
|
|
|
//public void EnterStory()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// GameStateManager.Instance.ChangeState(new GameStateStory(testStoryId));
|
|
|
|
|
|
//}
|
2023-10-19 15:00:19 +08:00
|
|
|
|
|
2023-12-13 15:14:52 +08:00
|
|
|
|
|
2023-10-19 15:00:19 +08:00
|
|
|
|
private string gc;
|
|
|
|
|
|
|
2025-02-20 20:02:12 +08:00
|
|
|
|
//[Category("礼包兑换")] 25/2/20 关闭DEBUGGER功能
|
|
|
|
|
|
//public string GiftCode
|
|
|
|
|
|
//{
|
|
|
|
|
|
// get { return gc; }
|
|
|
|
|
|
// set { gc = value; }
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
//[Category("礼包兑换")] 25/2/20 关闭DEBUGGER功能
|
|
|
|
|
|
//public void DoGiftCode()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// if (UnityEngine.Application.isPlaying)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// Gameplay.Net.NetHelper.GiftCode(GiftCode);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
2024-01-22 15:38:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
2024-01-19 17:05:59 +08:00
|
|
|
|
private int _itemId;
|
|
|
|
|
|
|
2025-02-20 20:02:12 +08:00
|
|
|
|
//[Category("GM增加物品"), DisplayName("物品ID")] 25/2/20 关闭DEBUGGER功能
|
|
|
|
|
|
//public int ItemId
|
|
|
|
|
|
//{
|
|
|
|
|
|
// get { return _itemId; }
|
|
|
|
|
|
// set
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (_itemId.Equals(value)) return;
|
|
|
|
|
|
// SetItemId(value);
|
|
|
|
|
|
// _itemId = value;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
2024-01-22 15:38:06 +08:00
|
|
|
|
|
|
|
|
|
|
private void SetItemId(int id)
|
|
|
|
|
|
{
|
|
|
|
|
|
DataItem dataItem = TableManager.Instance.Tables.Item.Get(id);
|
2025-04-21 14:15:00 +08:00
|
|
|
|
if (dataItem == null)
|
2024-01-22 15:38:06 +08:00
|
|
|
|
{
|
|
|
|
|
|
SRDebug.Instance.ShowBugReportSheet(descriptionContent: "此ID不在item表里,查一下是不是填错了");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-04-21 14:15:00 +08:00
|
|
|
|
|
2024-01-22 15:38:06 +08:00
|
|
|
|
_itemId = id;
|
|
|
|
|
|
}
|
2025-04-21 14:15:00 +08:00
|
|
|
|
|
|
|
|
|
|
private int _itemsCount = 1;
|
|
|
|
|
|
|
2025-02-20 20:02:12 +08:00
|
|
|
|
//[Category("GM增加物品"), DisplayName("物品个数")] 25/2/20 关闭DEBUGGER功能
|
|
|
|
|
|
//public int ItemsCount
|
|
|
|
|
|
//{
|
|
|
|
|
|
// get { return _itemsCount; }
|
|
|
|
|
|
// set
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (_itemsCount.Equals(value)) return;
|
|
|
|
|
|
// _itemsCount = value;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
2024-01-19 17:05:59 +08:00
|
|
|
|
private string GMToken = "phxh666";
|
|
|
|
|
|
|
2025-02-20 20:02:12 +08:00
|
|
|
|
//[Category("GM增加物品"), DisplayName("增加指定物品")] 25/2/20 关闭DEBUGGER功能
|
|
|
|
|
|
//public async void AddItem()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// if(_itemsCount==0)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
//
|
|
|
|
|
|
// string url = GetURL(GMToken, GetIp(), Actor.Instance.Base.GetProp(NLDPB.ActorProp.ActorId).ToString());
|
|
|
|
|
|
// var request = UnityEngine.Networking.UnityWebRequest.Get(url);
|
|
|
|
|
|
// await request.SendWebRequest();
|
|
|
|
|
|
// //DebugUtil.LogError("gm新错" + request.downloadHandler.text);
|
|
|
|
|
|
//
|
|
|
|
|
|
//
|
|
|
|
|
|
//}
|
2025-04-21 14:15:00 +08:00
|
|
|
|
|
2025-03-13 13:03:15 +08:00
|
|
|
|
[Category("IAP内购"), DisplayName("客户端验证")]
|
2024-05-22 15:44:31 +08:00
|
|
|
|
public bool ClientVerify
|
|
|
|
|
|
{
|
2024-06-06 15:44:06 +08:00
|
|
|
|
get { return IAPManager.Instance.ClientVerify; }
|
|
|
|
|
|
set { IAPManager.Instance.ClientVerify = value; }
|
2024-05-22 15:44:31 +08:00
|
|
|
|
}
|
2025-04-21 14:15:00 +08:00
|
|
|
|
|
2025-03-13 13:03:15 +08:00
|
|
|
|
[Category("IAP内购"), DisplayName("初始化IAP")]
|
2024-05-27 19:37:13 +08:00
|
|
|
|
public void InitIAP()
|
|
|
|
|
|
{
|
2024-06-06 15:44:06 +08:00
|
|
|
|
IAPManager.Instance.ReLoad();
|
2024-05-27 19:37:13 +08:00
|
|
|
|
}
|
2025-04-21 14:15:00 +08:00
|
|
|
|
|
2025-03-13 13:03:15 +08:00
|
|
|
|
[Category("IAP内购"), DisplayName("完成所有交易")]
|
2024-06-11 15:58:47 +08:00
|
|
|
|
public void ConfirmPending()
|
|
|
|
|
|
{
|
|
|
|
|
|
IAPManager.Instance.ConfirmPending();
|
|
|
|
|
|
}
|
2025-04-21 14:15:00 +08:00
|
|
|
|
|
2025-03-13 13:03:15 +08:00
|
|
|
|
[Category("IAP内购"), DisplayName("跳过真实支付")]
|
|
|
|
|
|
public bool SkipRealPay
|
|
|
|
|
|
{
|
|
|
|
|
|
get => IAPManager.Instance.SkipRealPay;
|
|
|
|
|
|
set => IAPManager.Instance.SkipRealPay = value;
|
|
|
|
|
|
}
|
2024-01-19 17:05:59 +08:00
|
|
|
|
|
2025-02-20 20:02:12 +08:00
|
|
|
|
[Category("用户数据"), DisplayName("删除本地缓存数据")]
|
2024-05-22 17:21:54 +08:00
|
|
|
|
public void DeleteData()
|
|
|
|
|
|
{
|
|
|
|
|
|
StorageMgr.Instance.DeleteSaveData();
|
2024-12-16 17:19:05 +08:00
|
|
|
|
CrossDayChecker.Instance.DeleteSaveData = true;
|
2024-05-22 17:21:54 +08:00
|
|
|
|
}
|
2024-01-19 17:05:59 +08:00
|
|
|
|
|
|
|
|
|
|
private string GetURL(string token, string ip, string actor)
|
|
|
|
|
|
{
|
|
|
|
|
|
string param = "";
|
|
|
|
|
|
|
|
|
|
|
|
if (_itemId <= 0 || _itemsCount <= 0)
|
|
|
|
|
|
return null;
|
|
|
|
|
|
param = $"{_itemId},{_itemsCount}";
|
2025-04-21 14:15:00 +08:00
|
|
|
|
|
2024-01-19 17:05:59 +08:00
|
|
|
|
return $"http://{ip}/gm?actor_id={actor}&command=AddItem&gm_token={token}¶m={param}";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private string GetIp()
|
|
|
|
|
|
{
|
|
|
|
|
|
var serverInfo = AppConfig.Instance.GetCurrent();
|
|
|
|
|
|
return serverInfo.addrs[0].ip + ":8080";
|
2025-04-21 14:15:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 从所有加载的场景中查找节点
|
|
|
|
|
|
private GameObject[] FindGameObjectsInAllScenes(string name)
|
|
|
|
|
|
{
|
|
|
|
|
|
int sceneCount = UnityEngine.SceneManagement.SceneManager.sceneCount;
|
|
|
|
|
|
System.Collections.Generic.List<GameObject> foundObjects = new System.Collections.Generic.List<GameObject>();
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < sceneCount; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
var scene = UnityEngine.SceneManagement.SceneManager.GetSceneAt(i);
|
|
|
|
|
|
if (scene.isLoaded)
|
|
|
|
|
|
{
|
|
|
|
|
|
Debug.Log($"在场景 {scene.name} 中查找 {name}");
|
|
|
|
|
|
|
|
|
|
|
|
// 获取场景中的所有根游戏对象
|
|
|
|
|
|
var rootObjects = scene.GetRootGameObjects();
|
|
|
|
|
|
foreach (var rootObject in rootObjects)
|
|
|
|
|
|
{
|
|
|
|
|
|
// 搜索根对象
|
|
|
|
|
|
if (rootObject.name == name)
|
|
|
|
|
|
{
|
|
|
|
|
|
foundObjects.Add(rootObject);
|
|
|
|
|
|
Debug.Log($"在场景 {scene.name} 的根节点中找到 {name}");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 搜索子对象
|
|
|
|
|
|
var childObjects = rootObject.GetComponentsInChildren<Transform>(true);
|
|
|
|
|
|
foreach (var child in childObjects)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (child.gameObject.name == name)
|
|
|
|
|
|
{
|
|
|
|
|
|
foundObjects.Add(child.gameObject);
|
|
|
|
|
|
Debug.Log($"在场景 {scene.name} 的节点 {rootObject.name} 下找到 {name}");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return foundObjects.ToArray();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Category("场景节点")]
|
|
|
|
|
|
[Sort(1)]
|
|
|
|
|
|
[DisplayName("启用Art节点(禁用Art_Old)")]
|
|
|
|
|
|
public void EnableArtDisableArtOld()
|
|
|
|
|
|
{
|
|
|
|
|
|
Debug.Log("正在查找和切换Art节点...");
|
|
|
|
|
|
var artNodes = FindGameObjectsInAllScenes("Art");
|
|
|
|
|
|
var artOldNodes = FindGameObjectsInAllScenes("Art_Old");
|
|
|
|
|
|
|
|
|
|
|
|
if (artNodes.Length == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Debug.LogError("在所有场景中找不到Art节点!");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (artOldNodes.Length == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Debug.LogError("在所有场景中找不到Art_Old节点!");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var artNode in artNodes)
|
|
|
|
|
|
{
|
|
|
|
|
|
artNode.SetActive(true);
|
|
|
|
|
|
Debug.Log($"已启用Art节点: {GetGameObjectPath(artNode)}");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var artOldNode in artOldNodes)
|
|
|
|
|
|
{
|
|
|
|
|
|
artOldNode.SetActive(false);
|
|
|
|
|
|
Debug.Log($"已禁用Art_Old节点: {GetGameObjectPath(artOldNode)}");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Debug.Log($"总共处理 {artNodes.Length} 个Art节点和 {artOldNodes.Length} 个Art_Old节点");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Category("场景节点")]
|
|
|
|
|
|
[Sort(2)]
|
|
|
|
|
|
[DisplayName("启用Art_Old节点(禁用Art)")]
|
|
|
|
|
|
public void EnableArtOldDisableArt()
|
|
|
|
|
|
{
|
|
|
|
|
|
Debug.Log("正在查找和切换Art_Old节点...");
|
|
|
|
|
|
var artNodes = FindGameObjectsInAllScenes("Art");
|
|
|
|
|
|
var artOldNodes = FindGameObjectsInAllScenes("Art_Old");
|
|
|
|
|
|
|
|
|
|
|
|
if (artNodes.Length == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Debug.LogError("在所有场景中找不到Art节点!");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (artOldNodes.Length == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Debug.LogError("在所有场景中找不到Art_Old节点!");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var artNode in artNodes)
|
|
|
|
|
|
{
|
|
|
|
|
|
artNode.SetActive(false);
|
|
|
|
|
|
Debug.Log($"已禁用Art节点: {GetGameObjectPath(artNode)}");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var artOldNode in artOldNodes)
|
|
|
|
|
|
{
|
|
|
|
|
|
artOldNode.SetActive(true);
|
|
|
|
|
|
Debug.Log($"已启用Art_Old节点: {GetGameObjectPath(artOldNode)}");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Debug.Log($"总共处理 {artNodes.Length} 个Art节点和 {artOldNodes.Length} 个Art_Old节点");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Category("场景节点")]
|
|
|
|
|
|
[Sort(3)]
|
|
|
|
|
|
[DisplayName("获取Art节点状态")]
|
|
|
|
|
|
public void CheckArtNodesStatus()
|
|
|
|
|
|
{
|
|
|
|
|
|
var artNodes = FindGameObjectsInAllScenes("Art");
|
|
|
|
|
|
var artOldNodes = FindGameObjectsInAllScenes("Art_Old");
|
|
|
|
|
|
|
|
|
|
|
|
Debug.Log($"找到 {artNodes.Length} 个Art节点和 {artOldNodes.Length} 个Art_Old节点");
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var artNode in artNodes)
|
|
|
|
|
|
{
|
|
|
|
|
|
Debug.Log($"Art节点状态: {(artNode.activeSelf ? "启用" : "禁用")}, 路径: {GetGameObjectPath(artNode)}");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var artOldNode in artOldNodes)
|
|
|
|
|
|
{
|
|
|
|
|
|
Debug.Log($"Art_Old节点状态: {(artOldNode.activeSelf ? "启用" : "禁用")}, 路径: {GetGameObjectPath(artOldNode)}");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (artNodes.Length == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Debug.LogWarning("在所有场景中都不存在Art节点");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (artOldNodes.Length == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Debug.LogWarning("在所有场景中都不存在Art_Old节点");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取游戏对象的完整路径
|
|
|
|
|
|
private string GetGameObjectPath(GameObject obj)
|
|
|
|
|
|
{
|
|
|
|
|
|
string path = obj.name;
|
|
|
|
|
|
Transform parent = obj.transform.parent;
|
|
|
|
|
|
|
|
|
|
|
|
while (parent != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
path = parent.name + "/" + path;
|
|
|
|
|
|
parent = parent.parent;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 添加场景名称
|
|
|
|
|
|
var sceneName = obj.scene.name;
|
|
|
|
|
|
path = sceneName + ":" + path;
|
2024-01-19 17:05:59 +08:00
|
|
|
|
|
2025-04-21 14:15:00 +08:00
|
|
|
|
return path;
|
2024-01-19 17:05:59 +08:00
|
|
|
|
}
|
2025-04-21 14:15:00 +08:00
|
|
|
|
}
|