Files
ft/Client/Assets/Scripts/DebugFunc.cs
2026-06-29 21:18:33 +08:00

943 lines
34 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using asap.core;
using game;
using GameCore;
using IngameDebugConsole;
using System;
using System.Linq;
using UI.HookWheel;
using UniRx;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
using UnityEngine.SceneManagement;
public class DebugFunc
{
public static void Init()
{
var config = GContext.container.Resolve<IConfig>();
if (config != null && (config.Get("DEBUG", "0") == "1" || config.Get("GM", "0") == "1"))
{
DebugLogConsole.AddCommand<string, string>("Go.show", "Shows a GameObject", ShowGO);
DebugLogConsole.AddCommand<string, string>("Go.hide", "Shows a GameObject", HideGO);
DebugLogConsole.AddCommand<int, string>("Render.quality", "change quality", SetQuality);
DebugLogConsole.AddCommand<float, string>("Render.scale", "Set render scale [0.1-2]", SetRendererScale);
DebugLogConsole.AddCommand<int, string>("Render.aa", "anti aliasing", SetAntiAliasing);
DebugLogConsole.AddCommand<string>("Render.ShadowToggle", "Toggle Shadow", ToggleShadow);
DebugLogConsole.AddCommand<string, string>("Render.Pipline", "light num", SetRenderPipline);
DebugLogConsole.AddCommand<string>("info.GPU", "GPU Info", GpuInfo);
DebugLogConsole.AddCommand<string>("info.CPU", "CPU Info", CpuInfo);
DebugLogConsole.AddCommand<string>("info.Support", "Device Support", SupportInfo);
DebugLogConsole.AddCommand("FPS", "Toggle FPS", Fps);
DebugLogConsole.AddCommand("LTPL", "开关 Leviathan Timeline 性能日志(不影响 FPS 浮层)", ToggleLeviathanTimelinePerf);
DebugLogConsole.AddCommand<int>("LTCW", "设置 CatchUp 消费等待(ms) 1~50", SetLeviathanCatchUpWaitMs);
DebugLogConsole.AddCommand("LTCW?", "查询 CatchUp 消费等待(ms)", GetLeviathanCatchUpWaitMs);
DebugLogConsole.AddCommand<int>("Render.antiAliasing", "change antiAliasing", SetRTAntiAliasing);
DebugLogConsole.AddCommand<string>("T.hotupdate", "hot update test", HotUpdateTest);
DebugLogConsole.AddCommand<string, string>("UI.hide", "Hide UI", ToggleUI);
DebugLogConsole.AddCommand<int, string>("Misc.tg", "Hide misc", ToggleMisc);
DebugLogConsole.AddCommand("aihelp", "open aihelp", OpenAIHelp);
DebugLogConsole.AddCommand("review", "open review", OpenReview);
DebugLogConsole.AddCommand("Pay.sku", "sku list", GetSKUs);
DebugLogConsole.AddCommand("ad.debug", "Active Ad Debug", ActiveAdDebug);
DebugLogConsole.AddCommand("ad.media", "Active Ad Media Debug", ActiveAdMedia);
DebugLogConsole.AddCommand("notify.send", "Local Notify Test", NotifyTest);
DebugLogConsole.AddCommand("notify.setting", " Notify set", NotifySettingTest);
DebugLogConsole.AddCommand<string>("notify.status", " Notify Status", NotificationStatus);
DebugLogConsole.AddCommand<string>("notify.time", "Notify at certain time", NotifyAtTime);
DebugLogConsole.AddCommand("mail.status", "Print cache mail", PrintMail);
DebugLogConsole.AddCommand("mail.fetch", "fetch mail to cache", FetchMail);
DebugLogConsole.AddCommand("rt.test", "test realtime", RtTest);
DebugLogConsole.AddCommand<int>("account.loginTime", "login time - 1day", LoginTime);
DebugLogConsole.AddCommand("account.info", "account info", AccoutInfo);
DebugLogConsole.AddCommand("account.authortest", "author test", AuthorTest);
DebugLogConsole.AddCommand("aihelp.test", "aihelp test", AIHelpTest);
DebugLogConsole.AddCommand("open.washing", "Open Washing Activity", OpenWashingActivity);
DebugLogConsole.AddCommand("deeplink.test", "Test if deeplink connects. If so, returns pid and uid.", TestDeepLink);
DebugLogConsole.AddCommand<int>("PotionGoTo", "Potion Go To", PotionGoTo);
DebugLogConsole.AddCommand("potion.clear", "Potion Go To", PotionClear);
DebugLogConsole.AddCommand("pinball.clear", "Clear Pinball Data", PinballDataClear);
DebugLogConsole.AddCommand<float>("pinball.fire", "Launch Pinball Pellet", PinballFirePellet);
DebugLogConsole.AddCommand("scratch.clear", "Clear Scratch Ticket Data", ScratchTicketDataClear);
DebugLogConsole.AddCommand<int>("shooting.go", "Goto", ShootingRangeDebug);
DebugLogConsole.AddCommand("eventpartner.activate", "Activate a temp event", EventPartnerDebugActivate);
DebugLogConsole.AddCommand("bingo.ts", "OpenTestScene", ShowTestBingoPanel);
DebugLogConsole.AddCommand("bingo.seeds", "TestBingoSeedPickingRng", TestBingoSeedPickingRng);
DebugLogConsole.AddCommand("bingo.instant", "Instant Bingo.", TestBingoInstantBingo);
DebugLogConsole.AddCommand("srp.fswave", "toggle fullscreen wave", ToggleFSWave);
DebugLogConsole.AddCommand<int>("ib.lvl", "infinitebuilding level", SetInfiniteBuildLvl);
DebugLogConsole.AddCommand("srp.fsblur", "toggle fullscreen blur", ToggleFSBlur);
DebugLogConsole.AddCommand<string>("stash", "test reward stash service", TestRewardStashService);
DebugLogConsole.AddCommand("guide.clear", "clear guide data", ClearGuide);
DebugLogConsole.AddCommand("pinataAct", "load pinata Act", LoadPinataAct);
DebugLogConsole.AddCommand("lastpayment.clear", "Clear Last Payment Time", ClearLastPaymentTime);
DebugLogConsole.AddCommand("HookWheelForecActive", "Hook Wheel Forec Active", HookWheelForecActive);
DebugLogConsole.AddCommand("eps.invitecount", "GetInvitationCount", PrintEventPartnerStatueInvitationCount);
DebugLogConsole.AddCommand("eps.sendbot", "Start recommending bots", EventPartnerStatueActivateBotInvitation);
DebugLogConsole.AddCommand("eps.bot", "Peek Robot Data", EventPartnerStatuePeekRobot);
DebugLogConsole.AddCommand("eps.pool", "Peek Player Info Pool", EventPartnerStatuePeekPlayerInfoPool);
DebugLogConsole.AddCommand("eps.score", "Peek Score", EventPartnerStatuePeekScore);
DebugLogConsole.AddCommand<int>("eps.rt", "Test rt", EventPartnerStatueTestRt);
DebugLogConsole.AddCommand("eps.i", "Peek inflationrate", EventPartnerStatuePeekInflationRate);
DebugLogConsole.AddCommand<int>("sr.set", "Set Social Rush Progress", SocialRushTest);
DebugLogConsole.AddCommand("sr.reset", "Reset Social Rush", SocialRushReset);
DebugLogConsole.AddCommand("sr.peek", "Peek Social Rush", SocialRushPeek);
DebugLogConsole.AddCommand("mft.guide", "Mow For Treasure Clear Guide", EventMowForTreasureGuideClear);
DebugLogConsole.AddCommand("osc.peek", "Peek Offer Story Chain", OfferStoryChainPeek);
DebugLogConsole.AddCommand("osc.reset", "Reset Offer Story Chain", OfferStoryChainReset);
DebugLogConsole.AddCommand("ota.peek", "Peek Offer treasure ascent", OfferTreasureAscentPeek);
DebugLogConsole.AddCommand("ota.reset", "Reset Offer treasure ascent", OfferTreasureAscentReset);
DebugLogConsole.AddCommand<int>("pu.bk", "Block Pinball Kick if input is not 0. If input is 0, unblock.", PinballUncountableBlockKick);
}
}
private static void TestDeepLink()
{
var res = AFHelper.Instance.GetDLReferer(out var pid, out var uid);
Debug.Log($"DidReceiveDeepLink: {AFHelper.Instance.DidReceivedDeepLink}");
Debug.Log($"IsFirstLaunch: {AFHelper.Instance.IsFirstLaunch}");
if (AFHelper.Instance.DeepLinkParamsDictionary is not null)
{
Debug.Log($"DeepLinkParamsDic:");
foreach (var kvp in AFHelper.Instance.DeepLinkParamsDictionary)
{
Debug.Log($"{kvp.Key}: {kvp.Value}");
}
}
else
{
Debug.Log($"DeepLinkParamsDic: Empty.");
}
var message = res ? $"Deeplink success with pid: {pid}, uid: {uid}" : "Deeplink fail.";
Debug.Log(message);
}
private static void NotifyAtTime(string time)
{
var now = ZZTimeHelper.UtcNow();
var fireTime = DateTime.SpecifyKind(DateTime.Parse(time), DateTimeKind.Utc);
fireTime = fireTime.AddDays(now <= fireTime ? 0 : 1);
var service = GContext.container.Resolve<ILocalNotificationService>();
service.ScheduleOneTimeNotification(434200, fireTime.ToLocalTime(), "Test Note at Time",
$"Test Notification @ {fireTime}.");
}
private static void NotifyTest()
{
ILocalNotificationService service = GContext.container.Resolve<ILocalNotificationService>();
service.ScheduleOneTimeNotification(434200, DateTime.Now + TimeSpan.FromSeconds(3), "Notification",
"Test Notification ");
}
private static void NotifySettingTest()
{
ILocalNotificationService service = GContext.container.Resolve<ILocalNotificationService>();
service.OpenSettings();
}
private static string NotificationStatus()
{
#if UNITY_ANDROID
return Unity.Notifications.Android.AndroidNotificationCenter.UserPermissionToPost.ToString();
#else
return Unity.Notifications.iOS.iOSNotificationCenter.GetNotificationSettings().AuthorizationStatus.ToString();
#endif
}
private static string HotUpdateTest()
{
return "hot update test Ver 0.6 - 2024-03-26:1434";
}
private static string ToggleUI(string path)
{
GameObject homePanelGo = UIManager.Instance.gameObject.transform.Find("HomePanel").gameObject;
if (homePanelGo == null)
{
return "UI not found.";
}
GameObject go = homePanelGo.transform.Find(path).gameObject;
if (go == null)
{
return "path not found";
}
go.SetActive(!go.activeSelf);
return $"UI {go} toggled to {go.activeSelf}.";
}
private static string ToggleMisc(int idx)
{
GameObject go = GetGOFromPath("Env_101(Clone)/Misc");
int childCount = go.transform.childCount;
if (idx >= childCount)
return $"index {idx} exceeds children count{childCount}";
var child = go.transform.GetChild(idx).gameObject;
if (child == null)
return $"child {idx} not found";
child.SetActive(!child.activeSelf);
return $"{child} toggled to {child.activeSelf}.";
}
private static void OpenAIHelp()
{
AIHelp.AIHelpSupport.Show("E001");
}
private static void OpenReview()
{
var config = GContext.container.Resolve<IConfig>();
tysdk.AppRequestReview.RequestReview(config.Get(GConstant.K_APP_Store_URL, string.Empty));
}
private static string ShowGO(string path)
{
GameObject go = GetGOFromPath(path);
if (go != null)
{
go.SetActive(true);
}
return $"GameObject not found";
}
private static string HideGO(string path)
{
GameObject go = GetGOFromPath(path);
if (go != null)
{
go.SetActive(false);
return $"{go.name} has been hidden";
}
return $"GameObject not found";
}
private static string SetQuality(int level)
{
QualityManager.ChangeQuality(level);
zzwater.URPHelper.RendererFeatureSetActive(false, "FSBlur");
zzwater.URPHelper.RendererFeatureSetActive(false, "FSWave");
return $"quality set to {QualitySettings.names[QualitySettings.GetQualityLevel()]}";
}
private static void SetRTAntiAliasing(int level)
{
var rt = new RenderTexture((int)125, (int)125, 24, RenderTextureFormat.ARGB32);
rt.antiAliasing = level;
}
private static string SetRendererScale(float ratio)
{
if (ratio == 0)
{
return $"Render scale {CurrentRenderPipeline.renderScale}";
}
ratio = Mathf.Clamp(ratio, 0.1f, 2f);
var uprAsset = CurrentRenderPipeline;
if (uprAsset == null) return "No UniversalRenderPipelineAsset";
var preValue = uprAsset.renderScale;
uprAsset.renderScale = ratio;
return $"Render scale {preValue} set to {ratio}";
}
private static string SetAntiAliasing(int count)
{
var uprAsset = CurrentRenderPipeline;
if (uprAsset == null) return "No UniversalRenderPipelineAsset";
var preValue = uprAsset.msaaSampleCount;
uprAsset.msaaSampleCount = count;
return $"Render scale {preValue} set to {count}";
}
private static string SetRenderPipline(string name)
{
var currentPiplineName = GraphicsSettings.currentRenderPipeline.name;
if (name == "?")
{
return $"Pipline set to {currentPiplineName}";
}
else if (name == "-")
{
QualitySettings.renderPipeline = null;
}
else
{
var pipelineAsset = Addressables.LoadAssetAsync<RenderPipelineAsset>(name).WaitForCompletion();
QualitySettings.renderPipeline = pipelineAsset;
}
var newPipelineName = GraphicsSettings.currentRenderPipeline.name;
return $"{currentPiplineName} set to {newPipelineName}";
}
private static string ToggleShadow()
{
var cam = Camera.main;
if (cam != null)
{
var comp = cam.GetComponent<UniversalAdditionalCameraData>();
var preValue = comp.renderShadows;
comp.renderShadows = !preValue;
return $"Shadow {preValue} set to {comp.renderShadows}";
}
return "Camera not found";
}
private static string CpuInfo()
{
var props = typeof(SystemInfo).GetProperties()
.Where(x => x.Name.StartsWith("processor"));
var sb = new System.Text.StringBuilder();
sb.AppendLine();
foreach (var prop in props)
{
sb.AppendLine($"{prop.Name}: {prop.GetValue(null)}");
}
return sb.ToString();
}
private static string GpuInfo()
{
var props = typeof(SystemInfo).GetProperties()
.Where(x => x.Name.StartsWith("graphics"));
var sb = new System.Text.StringBuilder();
sb.AppendLine();
foreach (var prop in props)
{
sb.AppendLine($"{prop.Name}: {prop.GetValue(null)}");
}
return sb.ToString();
}
private static string SupportInfo()
{
var props = typeof(SystemInfo).GetProperties()
.Where(x => x.Name.StartsWith("support"));
var sb = new System.Text.StringBuilder();
sb.AppendLine();
foreach (var prop in props)
{
sb.AppendLine($"{prop.Name}: {prop.GetValue(null)}");
}
return sb.ToString();
}
private static void Fps()
{
game.RootCtx.showFPS = !game.RootCtx.showFPS;
}
private static void ToggleLeviathanTimelinePerf()
{
var on = !LeviathanLogConfig.EnableTimelineVideoPerfLog;
LeviathanLogConfig.EnableTimelineVideoPerfLog = on;
PlayerPrefs.SetInt("LeviathanTimelinePerf", on ? 1 : 0);
PlayerPrefs.Save();
UnityEngine.Debug.Log($"[Debug] Leviathan Timeline 性能日志 = {on}Logcat 搜 LeviathanTimeline");
}
private static void SetLeviathanCatchUpWaitMs(int ms)
{
var decoders = UnityEngine.Object.FindObjectsOfType<LeviathanVideoDecoderBase>(true);
if (decoders == null || decoders.Length == 0)
{
UnityEngine.Debug.Log("[Debug] LTCW: 未找到活跃的 LeviathanVideoDecoderBase 实例");
return;
}
foreach (var d in decoders)
{
d.CatchUpConsumePerFrameWaitMs = ms;
}
UnityEngine.Debug.Log($"[Debug] LTCW: 已将 {decoders.Length} 个解码器 CatchUpConsumePerFrameWaitMs 设为 {ms}ms");
}
private static void GetLeviathanCatchUpWaitMs()
{
var decoders = UnityEngine.Object.FindObjectsOfType<LeviathanVideoDecoderBase>();
if (decoders == null || decoders.Length == 0)
{
UnityEngine.Debug.Log("[Debug] LTCW?: 未找到活跃的 LeviathanVideoDecoderBase 实例");
return;
}
foreach (var d in decoders)
{
UnityEngine.Debug.Log($"[Debug] LTCW? {d.name}: CatchUpConsumePerFrameWaitMs={d.CatchUpConsumePerFrameWaitMs}ms");
}
}
private static UniversalRenderPipelineAsset CurrentRenderPipeline
{
get
{
return GraphicsSettings.currentRenderPipeline as UniversalRenderPipelineAsset;
//return (UniversalRenderPipelineAsset) QualitySettings.renderPipeline;
}
}
private static async void GetSKUs()
{
var iapService = GContext.container.Resolve<game.IIAPService>();
if (iapService == null)
{
UnityEngine.Debug.Log("iapService is null");
;
return;
}
var sb = new System.Text.StringBuilder();
sb.AppendLine();
var skus = await iapService.GetSKUs();
foreach (var sku in skus)
{
sb.AppendLine();
sb.Append($" {sku.price} code {sku.price_currency_code} ");
sb.AppendLine();
}
UnityEngine.Debug.Log(sb.ToString());
}
private static void ActiveAdDebug()
{
MaxSdk.SetVerboseLogging(true);
MaxSdk.ShowCreativeDebugger();
}
private static void ActiveAdMedia()
{
MaxSdk.ShowMediationDebugger();
}
private static GameObject GetGOFromPath(string path)
{
var root = SceneManager.GetActiveScene().GetRootGameObjects();
var splitPath = path.Split('/');
var rootName = splitPath[0];
var rootGo = root.FirstOrDefault(x => x.name == rootName);
if (rootGo == null) return null;
if (splitPath.Length == 1) return rootGo;
var childPath = string.Join("/", splitPath.Skip(1));
return rootGo.transform.Find(childPath)?.gameObject;
}
private static void PrintMail()
{
var mailService = GContext.container.Resolve<IInGameMailService>() as InGameMailService;
mailService.PrintCacheMail();
}
private static void FetchMail()
{
GContext.container.Resolve<IInGameMailService>().FetchMail();
}
private static void RtTest()
{
var rtService = GContext.container.Resolve<IRTService>() as SignalRService;
rtService.Test();
}
private static void LoginTime(int hours)
{
var userService = GContext.container.Resolve<game.IUserService>() as game.PlayFabUserService;
if (userService == null) return;
var loginTime = userService.LoginTime;
var newLoginTime = loginTime.AddHours(hours);
var prop = userService.GetType().GetProperty("LoginTime");
prop.SetValue(userService, newLoginTime);
Debug.Log($"loginTime: {loginTime} newLoginTime: {newLoginTime} prop: {userService.LoginTime}");
}
private static void AccoutInfo()
{
var userService = GContext.container.Resolve<game.IUserService>() as game.PlayFabUserService;
if (userService == null) return;
Debug.Log($"pfid: {userService.UserId} tyid: {userService.CustomId} lastLogin: {userService.LoginTime}");
if (PlayerPrefs.HasKey("KEY_ACCOUNT_INFO"))
{
Debug.Log("Saved account info: " + PlayerPrefs.GetString("KEY_ACCOUNT_INFO"));
}
else
{
Debug.Log("No saved account info");
}
}
private static async void AuthorTest()
{
var svr = GContext.container.Resolve<ICustomServerMgr>();
var result = await svr.GetStringAsync("account/authortest");
Debug.Log($"AuthorTest {result}");
}
private static void AIHelpTest()
{
RedPointManager.Instance.SetRedPointState(RedPointName.AIHelp_Msg, true, 1);
}
private static void OpenWashingActivity()
{
ToggleUI("safearea/RightPanel/layout/btn_washing");
}
private static void PotionClear()
{
GContext.container.Resolve<EventPotionDataManager>().ClearPotionData();
Debug.Log("--- Potion Clear ok");
}
private static void PotionGoTo(int levelID)
{
GContext.container.Resolve<EventPotionDataManager>().GoToPotionLevel(levelID);
Debug.Log("--- PotionGoTo levelID:" + levelID + ", ok");
}
private static void PinballDataClear()
{
GContext.container.Resolve<EventPinballDataManager>().ClearData();
Debug.Log("--- PinballDataClear ok");
}
private static void PinballFirePellet(float force)
{
FishingPinballAct.Publish(new EventPinballLaunchPelletData()
{
Force = force
});
Debug.Log("--- PinballFirePellet ok, force:" + force);
}
private static void ScratchTicketDataClear()
{
GContext.container.Resolve<EventScratchTicketDataManager>().ClearData();
Debug.Log("--- Scratch Ticket Data Clear ok");
}
private static void ShootingRangeDebug(int n)
{
GContext.Publish(new EventShootingRangeDebug { StageIdx = n });
Debug.Log($"Switch to {n}.");
}
private static void EventPartnerDebugActivate()
{
// var d = GContext.container.Resolve<EventPartnerData>();
// if (d is null)
// {
// Debug.Log( $"<color=#2d7cee>[EventPartner] No data found, cannot activate.</color>");
// return;
// }
// _ = d.LoadDataDebug();
Debug.Log($"<color=#2d7cee>[EventPartner] This function is obsoleted for now.</color>");
}
private static void ToggleFSWave()
{
var feature = zzwater.URPHelper.FindAndCacheRendererFeature("FSWave");
if (feature == null)
Debug.LogError($"Feature FSWave not found");
else
feature.SetActive(!feature.isActive);
}
private static void SetInfiniteBuildLvl(int level)
{
var s = GContext.container.Resolve<PlayerData>().InfiniteBuildingData;
if (s == null)
{
Debug.LogError($"No ib data found.");
return;
}
var data = new InfiniteBuildingData();
data.Deserialize(s);
var delta = level - data.Lvl;
data.Lvl = level;
for (int i = 0; i < data.Record.Count; i++)
{
var r = data.Record[i];
r.Pos += Vector2.up * delta;
data.Record[i] = r;
}
data.UploadData();
Debug.Log($"Done.");
}
private static void ToggleFSBlur()
{
var feature = zzwater.URPHelper.FindAndCacheRendererFeature("FSBlur");
if (feature == null)
Debug.LogError($"Feature FSWave not found");
else
feature.SetActive(!feature.isActive);
}
private static void ShowTestBingoPanel()
{
GContext.container.Register<EventBingoModel>().AsSingleton();
GContext.container.Resolve<EventBingoModel>().InitTest();
GContext.Publish(new UnloadActToNextAct { actId = "EventBingoAct", TransitionPanel = UITypes.CloudTransitionPanel });
}
private static void TestBingoSeedPickingRng()
{
var dataList = GContext.container.Resolve<cfg.Tables>().TbEventBingoMain.DataList;
var tc = new EventBingoTableContext(40701);
int[] stat = { 0, 0, 0, 0 };
int seed, statCount = 10000;
var sb = new System.Text.StringBuilder();
for (int i = 0; i < statCount; i++)
{
seed = tc.PickSeed(roundCount: 10086);
for (int j = 0; j < 4; j++)
{
if (dataList[j].SeedID.Contains(seed))
{
stat[j]++;
break;
}
}
sb.AppendLine($"{seed}, ");
}
Debug.Log($"[EventBingo] Test Result:\n1Bingo:{stat[0] / (float)statCount * 100}%,\n2Bingo: {stat[1] / (float)statCount * 100}%,\n3Bingo: {stat[2] / (float)statCount * 100}%,\n4Bingo: {stat[3] / (float)statCount * 100}%");
Debug.Log("[EventBingo] Seeds: \n" + sb.ToString());
}
private static void TestBingoInstantBingo()
{
var model = GContext.container.Resolve<EventBingoModel>();
if (model == null)
{
Debug.Log("[EventBingo] Bingo model not found!");
return;
}
model.ActivateInstantBingo();
Debug.Log("[EventBingo] Instant Bingo activated.");
}
private static void TestRewardStashService(string cmd)
{
const string reset = "reset", upload = "upload", load = "load", flush = "flush", add = "add";
var service = GContext.container.Resolve<IDeferredRewardStashService>();
switch (cmd)
{
case reset:
service.Reset();
Debug.Log("Reset Done.");
break;
case upload:
service.UploadData();
Debug.Log("Upload Done.");
break;
case load:
service.LoadData();
Debug.Log("Load Done.");
break;
case flush:
service.Flush();
Debug.Log("Flush Done.");
break;
case add:
GContext.Publish(new DeferredRewardStashService.EventStashItem
{
Item = new ItemData(1001, 100)
});
Debug.Log("Add Done.");
break;
default:
Debug.Log("Invalid command. Available commands:\n" +
"- reset: Clear all stash data\n" +
"- add: Add 1001 * 100\n" +
"- upload: Upload stash data to playfab\n" +
"- load: Load stash data from playfab\n" +
"- flush: Process and clear all pending rewards");
break;
}
}
static void ClearGuide()
{
GContext.container.Resolve<GuideDataCenter>().GMClearGuide();
UIManager.Instance.DestroyUI(UITypes.GuidancePanel);
}
static void LoadPinataAct()
{
GContext.Publish(new UnloadActToNextAct { actId = "PinataPackAct_Pony" });
GContext.OnEvent<ActLoadedEvent>().Subscribe((actLoadedEvent) =>
{
var Act = GContext.container.ResolveAct("PinataPackAct_Pony");
if (Act is PinataPackAct pinataPackAct)
{
Debug.Log($"jsd Act is PinataPackAct pinataPackAct");
var rigidBody = pinataPackAct.GetComponentsInChildren<Rigidbody>();
foreach (var r in rigidBody)
{
r.useGravity = false;
}
var gameObject = GetGOFromPath("PinataPackAct_Pony(Clone)/Stage1");
gameObject.transform.localPosition = new Vector3(0, 0, 0.2f);
gameObject.transform.localRotation = Quaternion.Euler(-21, 0, 0);
}
var ui = UIManager.Instance.GetContainedUI(UITypes.PinataPack_PonySettlementPanel);
ui.FindChildGameObject("btn_scene")?.SetActive(false);
ui.FindChildGameObject("btn_close")?.SetActive(true);
});
}
static void ClearLastPaymentTime()
{
PlayFabMgr.Instance.UpdateUserDataValue("LastPaymentTime", "");
}
static void HookWheelForecActive()
{
GContext.container.Resolve<HookWheelManager>()?.ForceActive();
}
static void PrintEventPartnerStatueInvitationCount()
{
var arc = GContext.container.Resolve<EventPartnerStatueArc>();
if (arc == null)
{
Debug.Log("EventPartnerStatueArc not found");
return;
}
Debug.Log($"InvitationCount: {arc.InvitationData.InvitationCount}, DoRecommendBot: {arc.InvitationData.DoRecommendBot}");
}
static void EventPartnerStatueActivateBotInvitation()
{
var arc = GContext.container.Resolve<EventPartnerStatueArc>();
if (arc == null)
{
Debug.Log("EventPartnerStatueArc not found");
return;
}
arc.InvitationData.SetInvitationCount(1999);
Debug.Log($"Bot invitation count set to 1999");
}
// static void EventPartnerStatueRefreshInvitation()
// {
// var arc = GContext.container.Resolve<EventPartnerStatueArc>();
// if (arc == null)
// {
// Debug.Log("EventPartnerStatueArc not found");
// return;
// }
// arc.InvitationData.RefreshInvitation();
// Debug.Log("RefreshInvitation Done");
// }
static void EventPartnerStatuePeekRobot()
{
var arc = GContext.container.Resolve<EventPartnerStatueArc>();
if (arc == null)
{
Debug.Log("EventPartnerStatueArc not found");
return;
}
var str = Newtonsoft.Json.JsonConvert.SerializeObject(arc.RobotData.RobotInvitationBuffer);
Debug.Log("RobotBuffer: " + str);
str = Newtonsoft.Json.JsonConvert.SerializeObject(arc.RobotData.RobotList.Select(kv => kv.Value.ActionQ));
Debug.Log("RobotActionQ: " + str);
}
static void EventPartnerStatuePeekPlayerInfoPool()
{
var arc = GContext.container.Resolve<EventPartnerStatueArc>();
if (arc == null)
{
Debug.Log("EventPartnerStatueArc not found");
return;
}
var bufferStr = Newtonsoft.Json.JsonConvert.SerializeObject(arc.PlayerInfoPool.PlayerInfoDic);
Debug.Log("PlayerInfoCache:" + bufferStr);
}
static void EventPartnerStatuePeekScore()
{
var arc = GContext.container.Resolve<EventPartnerStatueArc>();
if (arc == null)
{
Debug.Log("EventPartnerStatueArc not found");
return;
}
var s = new System.Text.StringBuilder();
foreach (var c in arc.Model.ComponentList)
{
s.AppendLine($"Partner{c.PartnerId}: self display:{c.ScoreSelfDisplay}, self actual:{c.ScoreSelfActual}, partner display:{c.ScorePartnerDisplay}, partner actual:{c.ScorePartnerActual}\n");
}
Debug.Log(s.ToString());
}
static void EventPartnerStatueTestRt(int scoreAdd)
{
var arc = GContext.container.Resolve<EventPartnerStatueArc>();
if (arc == null)
{
Debug.Log("EventPartnerStatueArc not found");
return;
}
var partnerId = arc.Model.ComponentList[0].PartnerId;
var newScore = arc.Model.ComponentList[0].ScorePartnerActual + scoreAdd;
var se = new EventPartnerGatherRequests.EventPartnerGatherScoreEvt
{
PartnerId = partnerId,
Score = newScore,
};
var pe = new EventPartnerGatherRequests.EventPartnerGatherPartnerEvt
{
PartnerInfo = new PlayerInfo
{
AvatarUrl = "",
DisplayName = "TestRt",
Level = 1,
PlayFabId = "TestRt",
},
EvtType = 0,
SlotId = 1
};
arc.RtSystem.TestRt(se, pe);
}
static void EventPartnerStatuePeekInflationRate()
{
var arc = GContext.container.Resolve<EventPartnerStatueArc>();
if (arc == null)
{
Debug.Log("EventPartnerStatueArc not found");
return;
}
Debug.Log($"InflationRate: {arc.Model.LureInflationRate}");
}
static void SocialRushTest(int progress)
{
var arc = GContext.container.Resolve<Assets.Scripts.UI.SocialRush.SocialRushArchitecture>();
if (arc == null)
{
Debug.Log("SocialRushArchitechture not found");
return;
}
arc.Model.SetProgress(progress);
Debug.Log($"[SocialRush]Actual progress set to {progress}");
}
static void SocialRushReset()
{
var arc = GContext.container.Resolve<Assets.Scripts.UI.SocialRush.SocialRushArchitecture>();
if (arc == null)
{
Debug.Log("SocialRushArchitechture not found");
return;
}
arc.Model.Reset();
Debug.Log($"[SocialRush]Reset Done.");
}
static void SocialRushPeek()
{
var arc = GContext.container.Resolve<Assets.Scripts.UI.SocialRush.SocialRushArchitecture>();
if (arc == null)
{
Debug.Log("SocialRushArchitechture not found");
return;
}
Debug.Log($"[SocialRush] Display: {arc.Model.ProgressDisplay}, Actual {arc.Model.ProgressActual}, inflation rate: {arc.Model.InflationRate}, event Id: {arc.EventId}");
}
static void EventMowForTreasureGuideClear()
{
GContext.container.Resolve<EventMowForTreasure.EventMowForTreasureManager>()?.ClearGuide();
}
static void OfferStoryChainReset()
{
var manager = GContext.container.Resolve<OfferStoryChain.Manager>();
if (manager == null)
{
Debug.Log("OfferStoryChain.Manager not found");
return;
}
manager.Reset();
}
static void OfferStoryChainPeek()
{
var manager = GContext.container.Resolve<OfferStoryChain.Manager>();
if (manager == null)
{
Debug.Log("OfferStoryChain.Manager not found");
return;
}
var str = "EventId: " + manager.EventId + "\n" + "Progress: " + manager.Progress + "\n" + "VipLevel: " + manager.VipLevel + "\n" + "RoundCount: " + manager.RoundCount;
Debug.Log("OfferStoryChain.Manager:" + str);
}
static void OfferTreasureAscentPeek()
{
var manager = GContext.container.Resolve<OfferTreasureAscent.Manager>();
if (manager == null)
{
Debug.Log("OfferTreasureAscent.Manager not found");
return;
}
Debug.Log($"[OfferTreasureAscent] eventId: {manager.EventId}, status: {manager.Status}, roundCount: {manager.RoundCount}");
}
static void OfferTreasureAscentReset()
{
var manager = GContext.container.Resolve<OfferTreasureAscent.Manager>();
if (manager == null)
{
Debug.Log("OfferTreasureAscent.Manager not found");
return;
}
manager.Reset();
Debug.Log($"[OfferTreasureAscent] Reset Done.");
}
static void PinballUncountableBlockKick(int block)
{
var manager = GContext.container.Resolve<PinballUncountable.Manager>();
if (manager == null)
{
Debug.Log("PinballUncountable.Manager not found");
return;
}
manager.EventAggregator.Publish(new PinballUncountable.EventBlockKick { Block = block != 0 });
}
}