Files
Main/Assets/Code/Logic/_Required/ClientGM/ClientGMSystem.cs
2025-01-25 04:38:09 +08:00

214 lines
8.9 KiB
C#

using Thousandto.Code.Center;
using Thousandto.Core.Asset;
using Thousandto.Core.Framework;
using Thousandto.Core.Base;
using Thousandto.Plugins.Common;
using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
using Thousandto.Core.Support;
namespace Thousandto.Code.Logic
{
/// <summary>
/// 客户单GM命令系统
/// </summary>
public class ClientGMSystem
{
#region//变量
//临时功能,用于屏蔽通过GM命令来升级导致的新功能开启问题
//是否是等级改变的GM命令 -- 用于屏蔽新功能弹出窗体
private bool _testNewFunction = false;
//新功能窗体显示的控制变量
private bool _isNewFunctionShow = true;
#endregion
#region//属性
public bool IsNewFunctionShow
{
get { return _isNewFunctionShow; }
set { _isNewFunctionShow = value; }
}
//暂停GameCenter的Update
public bool PauseGameCenterUpdate { get; private set; }
//暂停GameCenter的LateUpdate
public bool PauseGameCenterLateUpdate { get; private set; }
#endregion
#region //公共接口
//我是GM
public void MyGM()
{
GameCenter.ChatSystem.Send("&tt", 0, ChatChanelType.SYSTEM);
}
//客户端GM命令 --用于执行客户端的一些操作
public bool IsClientGM(string cmd)
{
if (cmd.Length > 4 && cmd.StartsWith("@@") && cmd.EndsWith("@@"))
{
switch (cmd.ToLower())
{
case "@@m@@":
GameCenter.ChatSystem.AddSystemChat(FrameMonitor.Infomation());
GameCenter.ChatSystem.AddSystemChat(MemoryMonitor.Infomation());
return true;
case "@@assetbundle@@":
GameCenter.ChatSystem.AddSystemChat(ResourcesEx.QueueManager.Information());
return true;
case "@@texture@@":
GameCenter.ChatSystem.AddSystemChat(GameCenter.TextureManager.Infomation());
return true;
case "@@assetlog@@":
FAssetBase.EnableDebugLog = !FAssetBase.EnableDebugLog;
return true;
case "@@prefabpool@@":
GameCenter.ChatSystem.AddSystemChat(GameCenter.SpawnPoolManager.Infomation());
return true;
case "@@profilerstart@@":
//ProfilerManager.Begin("abc.log");
return true;
case "@@profiler@@":
// GameCenter.ChatSystem.AddSystemChat(ProfilerManager.Infomation());
// GameCenter.ChatSystem.AddSystemChat("LocalPlayer:"+ProfilerManager.GetObjectRuntimeMemory(GameCenter.GameSceneSystem.GetLocalPlayer().Skin.RootGameObject));
return true;
case "@@profilerend@@":
//GameCenter.ChatSystem.AddSystemChat(ProfilerManager.Infomation());
// ProfilerManager.End();
return true;
case "@@gc@@":
Resources.UnloadUnusedAssets();
GC.Collect();
return true;
case "@@testnewfun@@":
_testNewFunction = true;
_isNewFunctionShow = true;
return true;
case "@@entity@@":
GameCenter.ChatSystem.AddSystemChat(GameCenter.GameSceneSystem.Infomation());
return true;
case "@@material@@":
//GameCenter.ChatSystem.AddSystemChat(ShaderEffect.Infomation());
return true;
case "@@exit@@":
GameCenter.GameSceneSystem.ReturnToLogin();
return true;
case "@@cameratool@@": //打开摄像机调试工具
//GameCenter.PushFixEvent((int)UIEventDefine.UI_CAMERA_TOOL_TOGGLE);
return true;
case "@@resetsendcnt@@": //重置网络消息
Networker.ReInitSocketCounter();
return true;
case "@@sendcnt@@": //获取网络详细数量
GameCenter.ChatSystem.AddSystemChat(Networker.GetMsgCount().ToString());
return true;
case "@@pfasset@@":
ProfilerSystem.ShowAssetProfiler();
return true;
case "@@showfps@@":
ProfilerSystem.ShowFPS();
return true;
case "@@showphoneinfo@@":
ProfilerSystem.ShowPhoneInfo();
return true;
case "@@gm@@":
GameCenter.PushFixEvent((int)UIEventDefine.UIGMForm_OPEN);
return true;
case "@@fps@@":
GameCenter.PushFixEvent(Global.LogicEventDefine.EID_EVENT_SHOW_MAINFPS);
return true;
case "@@pcu@@":
PauseGameCenterUpdate = true;
return true;
case "@@pclu@@":
PauseGameCenterLateUpdate = true;
return true;
case "@@autopet@@":
GameCenter.PushFixEvent((int)Global.LogicEventDefine.EID_EVENT_GM_AUTO_CATCH);
return true;
case "@@petauto@@":
GameCenter.PushFixEvent((int)Global.LogicEventDefine.EID_EVENT_GM_AUTO_CATCH);
return true;
case "@@printdc@@":
#if UNITY_EDITOR
UIDrawCall.PrintCache();
#endif
return true;
case "@@alphaset@@":
GameCenter.PushFixEvent(UIEventDefine.UIGlobalAlphaSetForm_OPEN);
return true;
case "@@changemodel@@":
GameCenter.MainFunctionSystem.DoFunctionCallBack(Cfg.Data.FunctionStartIdCode.XMFightCar, null);
return true;
case "@@sibd@@":
GameCenter.UpdateSystem.InitialBackDownload();
return true;
case "@@changecamera@@":
if (GameCenter.CameraControlUtil.GetCamearLockState())
{
GameCenter.GameSetting.SetSetting(GameSettingKeyCode.EnableFreeCameraView, 1);
GameCenter.CameraControlUtil.ChangeCamearLockState(false);
}
else
{
GameCenter.GameSetting.SetSetting(GameSettingKeyCode.EnableFreeCameraView, 0);
GameCenter.CameraControlUtil.ChangeCamearLockState(true);
}
return true;
case "@@printdrop@@":
GameCenter.ChatSystem.printSystemMsg = true;
return true;
case "@@nguicache@@":
GameCenter.PushFixEvent(Global.LogicEventDefine.EID_NGUI_PRINTCACHE_INFO);
return true;
case "@@hideallui@@":
GameCenter.PushFixEvent(Global.LogicEventDefine.EID_EVENT_HIDEALLUI);
return true;
case "@@clearevaluate@@":
PlayerPrefs.DeleteKey("IsPopupEvaluate");
return true;
default:
if (GameCenter.LuaSystem.Adaptor.OnClientGM(cmd))
{
return true;
}
GameCenter.ChatSystem.AddSystemChat(string.Format("dont fount gm command :{0}", cmd));
break;
}
}
if (cmd.IndexOf("@@cinematic@@") == 0)
{
string cinematic = cmd.Substring(cmd.LastIndexOf("@@") + 2);
//GameCenter.CinematicSystem.Play(cinematic, null, null);
return true;
}
return false;
}
//判断是否等级改变的GM
public bool IsLevelChangedGM(string cmd)
{
if (!_testNewFunction)
{
if (cmd.StartsWith("&setlevel") || cmd.StartsWith("&tt"))
{
_isNewFunctionShow = false;
return true;
}
}
return false;
}
#endregion
}
}