Files
JJBB/Assets/Project/Script/Plugin/DebugHelper.cs
2024-08-23 15:49:34 +08:00

258 lines
11 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 Module.Log;
//using UnityEngine;
//
//public class DebugHelper : MonoBehaviour
//{
// private static GameObject helperInstance;
// public static bool m_bShowEffect = true;
// public static bool m_bShowDamageBoard = true;
// public static bool m_bEnableTestAccount = false;
// private float _heightValue = 100f;
//
// private float _widthValue = 150f;
// private bool m_bUseOtherFun = false;
//
// //private int m_PlayerCount;
//
// //private bool m_IsSetNameHeight = false;
// private string m_strSetNameHeight = "";
//
//
// //private GameObject sceneObj = null;
// private GameObject uiRoot = null;
//
// // Use this for initialization
// private void Start()
// {
// _widthValue = Screen.width * _widthValue / 2000f;
// _heightValue = Screen.height * _heightValue / 1000f;
// }
//
// public static void CreateDebugHelper()
// {
// if (!SdkControl.instance.IsDebugEnabled()) return;
// if (null == helperInstance) helperInstance = Instantiate(Resources.Load<GameObject>("DebugHelper"));
//
// if (null == helperInstance) LogModule.DebugLog("create debughelper fail");
// }
//
// //void OnGUI()
// // {
// // //OnGUIQuality();
//
// // //if (GUILayout.Button("功能", GUILayout.Height(_heightValue), GUILayout.Width(_widthValue)))
// // //{
// // // m_bUseOtherFun = !m_bUseOtherFun;
// // //}
//
// // if (m_bUseOtherFun)
// // {
// // // if (GUILayout.Button("HideUI", GUILayout.Height(_heightValue), GUILayout.Width(_widthValue)))
// // // {
// // // if (null == uiRoot)
// // // {
// // // uiRoot = GameObject.Find("UI Root");
// // // }
// // // uiRoot.SetActive(!uiRoot.activeSelf);
// // // }
//
// // //if (GUILayout.Button("DisConnect", GUILayout.Height(_heightValue), GUILayout.Width(_widthValue)))
// // //{
// // // NetWorkLogic.GetMe().DisconnectServer();
// // //}
//
// // // if (GUILayout.Button("PlayerSound", GUILayout.Height(_heightValue), GUILayout.Width(_widthValue)))
// // // {
// // // bool bEnable = SoundManager.m_EnableBGM;
// // // bEnable = !bEnable;
// // // SoundManager.m_EnableBGM = bEnable;
// // // SoundManager.m_EnableSFX = bEnable;
// // // }
//
// // // if (LoginData.m_bEnableTestAccount)
// // // {
// // // if (GUILayout.Button("Disable TestAccount", GUILayout.Height(_heightValue), GUILayout.Width(_widthValue)))
// // // {
// // // LoginData.m_bEnableTestAccount = false;
// // // }
//
// // // LoginData.m_strTestAccount = GUI.TextField(new Rect(Screen.width - 200, 0, 200, _heightValue), LoginData.m_strTestAccount, 15);
// // // }
// // // else
// // // {
// // // if (GUILayout.Button("Enable TestAccount", GUILayout.Height(_heightValue), GUILayout.Width(_widthValue)))
// // // {
// // // LoginData.m_bEnableTestAccount = true;
// // // }
// // // }
//
// // // if (GUILayout.Button("TerrainHeight", GUILayout.Height(_heightValue), GUILayout.Width(_widthValue)))
// // // {
// // // Obj_MainPlayer objMain = Singleton<ObjManager>.GetInstance().MainPlayer;
// // // if (null != objMain)
// // // {
// // // if (null != GameManager.gameManager.ActiveScene &&
// // // null != GameManager.gameManager.ActiveScene.TerrainData)
// // // {
// // // float height = GameManager.gameManager.ActiveScene.TerrainData.GetTerrianHeight(objMain.Position);
// // // LogModule.DebugLog("Terrain Heigt: " + height);
// // // return;
// // // }
// // // }
//
// // // LogModule.DebugLog("Get Terrain Height Error");
// // // }
//
// // // m_strSetNameHeight = GUI.TextField(new Rect(Screen.width - 200, _heightValue, 200, _heightValue), m_strSetNameHeight, 15);
// // // if (GUILayout.Button("ChangeNameHeight", GUILayout.Height(_heightValue), GUILayout.Width(_widthValue)))
// // // {
// // // if (Singleton<ObjManager>.Instance.MainPlayer)
// // // {
// // // float fNewHeight;
// // // bool bResult = float.TryParse(m_strSetNameHeight, out fNewHeight);
// // // if (bResult)
// // // {
// // // Obj_Character target = Singleton<ObjManager>.Instance.MainPlayer.SelectTarget;
// // // if (null != target)
// // // {
// // // BillBoard billboard = target.HeadInfoBoard.GetComponent<BillBoard>();
// // // if (billboard != null)
// // // {
// // // billboard.fDeltaHeight = fNewHeight;
// // // }
// // // }
//
// // // //m_IsSetNameHeight = false;
// // // }
//
// // // }
// // // }
//
// // // if (GUILayout.Button("Unload unuse", GUILayout.Height(_heightValue), GUILayout.Width(_widthValue)))
// // //{
// // // //BundleManager.DoUnloadUnuseBundle();
// // //}
//
//
// // }
// // }
//
//// /// <summary>
//// /// 创建测试用Obj
//// /// </summary>
//// /// <param name="szRootPrefab"></param>
//// /// Root的Prefab路径
//// /// <param name="szPrefab"></param>
//// /// 具体模型的Prefab路径
//// /// <param name="szAnimationPath"></param>
//// /// 如果需要动态加载动作,则输入路径
//// private void CreateTestObject(string szRootPrefab, string szPrefab, string szAnimationPath)
//// {
//// //Obj_Character mainPlayer = Singleton<ObjManager>.GetInstance().MainPlayer as Obj_Character;
//// //if (null != mainPlayer)
//// //{
//// // Vector3 newPos = mainPlayer.transform.position + new Vector3(Random.Range(-1.5f, 1.5f), 0, Random.Range(-1.5f, 1.5f));
//// // Vector3 rotate = new Vector3(0.0f, Random.Range(-180.0f, 180.0f), 0.0f);
////
//// // m_MainPlayer[m_PlayerCount] = ResourceManager.InstantiateResource(szRootPrefab, "Test Player" + m_PlayerCount) as GameObject;
//// // if (m_MainPlayer[m_PlayerCount])
//// // {
//// // Singleton<ObjManager>.GetInstance().ReloadModel(m_MainPlayer[m_PlayerCount], szPrefab);
//// // m_MainPlayer[m_PlayerCount].transform.Translate(newPos);
//// // m_MainPlayer[m_PlayerCount].transform.Rotate(rotate);
////
//// // Obj_NPC objScript = m_MainPlayer[m_PlayerCount].AddComponent<Obj_NPC>();
//// // if (null == objScript)
//// // {
//// // return;
//// // }
////
//// // if (m_MainPlayer[m_PlayerCount].GetComponent<AIController>() == null)
//// // {
//// // m_MainPlayer[m_PlayerCount].AddComponent<AIController>();
//// // }
//// // objScript.Controller = (AIController)m_MainPlayer[m_PlayerCount].GetComponent<AIController>();
////
//// // if (m_MainPlayer[m_PlayerCount].GetComponent<AI_Patrol>() == null)
//// // {
//// // m_MainPlayer[m_PlayerCount].AddComponent<AI_Patrol>();
//// // }
//// // objScript.Controller.NormalAI = m_MainPlayer[m_PlayerCount].GetComponent<AI_Patrol>();
////
//// // if (m_MainPlayer[m_PlayerCount].GetComponent<AI_BaseCombat>() == null)
//// // {
//// // m_MainPlayer[m_PlayerCount].AddComponent<AI_BaseCombat>();
//// // }
//// // objScript.Controller.CombatAI = m_MainPlayer[m_PlayerCount].GetComponent<AI_NpcCombat>();
////
//// // if (m_MainPlayer[m_PlayerCount].GetComponent<NavMeshAgent>() == null)
//// // {
//// // m_MainPlayer[m_PlayerCount].AddComponent<NavMeshAgent>();
//// // }
//// // NavMeshAgent naviAgent = m_MainPlayer[m_PlayerCount].GetComponent<NavMeshAgent>();
//// // if (naviAgent && 0 != m_MainPlayer[m_PlayerCount].transform.localScale.x)
//// // {
//// // //设置成0否则gameobject之间会互相碰撞
//// // naviAgent.radius = 0.0f;
//// // naviAgent.height = 2.0f / gameObject.transform.localScale.x;
//// // }
////
//// // if (m_MainPlayer[m_PlayerCount].GetComponent<AnimationLogic>() == null)
//// // {
//// // objScript.AnimLogic = m_MainPlayer[m_PlayerCount].AddComponent<AnimationLogic>();
//// // }
//// // objScript.AnimationFilePath = szAnimationPath;
//// // objScript.InitAnimation();
//// // objScript.AnimLogic.Play(1);
////
//// // if (m_MainPlayer[m_PlayerCount].GetComponent<EffectLogic>() == null)
//// // {
//// // m_MainPlayer[m_PlayerCount].AddComponent<EffectLogic>();
//// // }
//// // objScript.InitEffect();
////
//// // objScript.Controller.SwitchCurrentAI(objScript.Controller.NormalAI);
//// // }
////
//// // m_PlayerCount++;
//// // LogModule.DebugLog("Cur Main Player is: " + m_PlayerCount);
//// //}
//// }
//
// #region quality test
//
// private bool isShowQuality;
// private int qualitLevel;
//
// private float _QualitywidthValue = 150f;
// private float _QualityheightValue = 40f;
//
// private void OnGUIQuality()
// {
// if (GUI.Button(new Rect(150, 0, 150, 40), "品质:" + qualitLevel)) isShowQuality = !isShowQuality;
//
// if (isShowQuality)
// for (var i = 0; i < 7; ++i)
// if (i < 6)
// {
// if (GUI.Button(new Rect(150, 40 * (i + 1), 150, 40), i.ToString()))
// {
// qualitLevel = i;
// isShowQuality = !isShowQuality;
// QualitySettings.SetQualityLevel(qualitLevel);
// }
// }
// else if (i == 6)
// {
// if (GUI.Button(new Rect(150, 40 * (i + 1), 150, 40), "50"))
// {
// qualitLevel = i;
// isShowQuality = !isShowQuality;
// QualitySettings.SetQualityLevel(2);
// QualitySettings.pixelLightCount = 50;
// }
// }
// }
//
// #endregion
//}