From bbd7bbe9ed3a1eae6cd9ca45ca149cc7f882daa2 Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期二, 18 九月 2018 15:01:26 +0800
Subject: [PATCH] 3243 【开发】开服限时活动定制
---
System/Debug/DebugUtility.cs | 209 +++++++++++++++++++++++++++++++++------------------
1 files changed, 134 insertions(+), 75 deletions(-)
diff --git a/System/Debug/DebugUtility.cs b/System/Debug/DebugUtility.cs
index 9a35cba..bbd1f73 100644
--- a/System/Debug/DebugUtility.cs
+++ b/System/Debug/DebugUtility.cs
@@ -1,75 +1,134 @@
-锘縰sing System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-using Snxxz.UI;
-using LitJson;
-
-public class DebugUtility : Singleton<DebugUtility>
-{
- const string url = "http://pub.game.secondworld.net.cn:11000/dbg_player/?";
-
- GameObject debugRoot;
-
- bool m_DebugAccount = false;
- public bool debugAccount {
- get { return m_DebugAccount; }
- private set {
- if (m_DebugAccount != value)
- {
- m_DebugAccount = value;
- if (debugAccount)
- {
- RunTimeExceptionUtility.Instance.Init();
- }
- }
- }
- }
-
- public void Init()
- {
- if (VersionConfig.Get().debugVersion)
- {
- debugAccount = true;
- }
- else
- {
- debugAccount = false;
- }
- }
-
- public void CreateDebugRoot()
- {
- if (debugRoot == null)
- {
- var prefab = Resources.Load<GameObject>("UI/Prefabs/UIRootDebug");
- debugRoot = GameObject.Instantiate(prefab);
- MonoBehaviour.DontDestroyOnLoad(debugRoot);
- debugRoot.name = "UIRootDebug";
- }
- }
-
- public void RequestDebugAuthority(string _account)
- {
- debugAccount = false;
- var tables = new Dictionary<string, string>();
- tables["channel"] = VersionConfig.Get().appId;
- tables["player"] = ModelCenter.Instance.GetModel<LoginModel>().sdkLoginResult.account;
-
- HttpRequest.Instance.RequestHttpGet(StringUtility.Contact(url, HttpRequest.HashtablaToString(tables)), HttpRequest.defaultHttpContentType, 1, OnDebugAuthority);
- }
-
- private void OnDebugAuthority(bool _ok, string _result)
- {
- if (_ok)
- {
- var debugAuthority = JsonMapper.ToObject<DebugAuthority>(_result);
- debugAccount = debugAuthority.dbg == 1;
- }
- }
-
- struct DebugAuthority
- {
- public int dbg;
- }
-
-}
+锘縰sing System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using Snxxz.UI;
+using LitJson;
+using System.IO;
+
+public class DebugUtility : Singleton<DebugUtility>
+{
+ const string url = "http://pub.game.2460web.com:11000/dbg_player/?";
+
+ GameObject debugRoot;
+
+ bool m_DebugAccount = false;
+ public bool debugAccount
+ {
+ get { return m_DebugAccount; }
+ private set
+ {
+ if (m_DebugAccount != value)
+ {
+ m_DebugAccount = value;
+ if (debugAccount)
+ {
+ RunTimeExceptionUtility.Instance.Init();
+ }
+ }
+ }
+ }
+
+ public int debugBranch = -1;
+
+ public void Init()
+ {
+ if (VersionConfig.Get().debugVersion)
+ {
+ debugAccount = true;
+ }
+ else
+ {
+ var parentDirectory = Directory.GetParent(Application.persistentDataPath);
+ debugAccount = File.Exists(parentDirectory + "/Debug");
+
+ if (debugAccount)
+ {
+ var content = File.ReadAllText(parentDirectory + "/Debug");
+ if (!string.IsNullOrEmpty(content))
+ {
+ var json = JsonMapper.ToObject<DebugBranch>(File.ReadAllText(parentDirectory + "/Debug"));
+ debugBranch = json.branch;
+ }
+ }
+ }
+
+ if (debugAccount)
+ {
+ DebugEx.EnableLog = LocalSave.GetBool("DesignEnableLog", true);
+ DebugEx.EnableLogWarning = LocalSave.GetBool("DesignEnableLogWarning", true);
+ DebugEx.EnableLogError = LocalSave.GetBool("DesignEnableLogError", true);
+ DebugEx.EnableNetLog = false;
+ }
+ else
+ {
+ DebugEx.EnableLog = false;
+ DebugEx.EnableLogWarning = false;
+ DebugEx.EnableLogError = false;
+ DebugEx.EnableNetLog = false;
+ }
+ }
+
+ public void CreateDebugRoot()
+ {
+ if (debugRoot == null)
+ {
+ var prefab = Resources.Load<GameObject>("UI/Prefabs/UIRootDebug");
+ debugRoot = GameObject.Instantiate(prefab);
+ MonoBehaviour.DontDestroyOnLoad(debugRoot);
+ debugRoot.name = "UIRootDebug";
+ }
+ }
+
+ public void RequestDebugAuthority(string _account)
+ {
+ debugAccount = false;
+ var tables = new Dictionary<string, string>();
+ tables["channel"] = VersionConfig.Get().appId;
+ tables["player"] = ModelCenter.Instance.GetModel<LoginModel>().sdkLoginResult.account;
+
+ HttpRequest.Instance.RequestHttpGet(StringUtility.Contact(url, HttpRequest.HashtablaToString(tables)), HttpRequest.defaultHttpContentType, 1, OnDebugAuthority);
+ }
+
+ private void OnDebugAuthority(bool _ok, string _result)
+ {
+ if (_ok)
+ {
+ var debugAuthority = JsonMapper.ToObject<DebugAuthority>(_result);
+ debugAccount = debugAuthority.dbg == 1;
+ }
+ }
+
+ public static void SetLogAble(bool _able)
+ {
+ LocalSave.SetBool("DesignEnableLog", _able);
+ DebugEx.EnableLog = _able;
+ }
+
+ public static void SetLogWarningAble(bool _able)
+ {
+ LocalSave.SetBool("DesignEnableLogWarning", _able);
+ DebugEx.EnableLogWarning = _able;
+ }
+
+ public static void SetLogErrorAble(bool _able)
+ {
+ LocalSave.SetBool("DesignEnableLogError", _able);
+ DebugEx.EnableLogError = _able;
+ }
+
+ public static void SetLogNetAble(bool _able)
+ {
+ DebugEx.EnableNetLog = _able;
+ }
+
+ struct DebugAuthority
+ {
+ public int dbg;
+ }
+
+ public class DebugBranch
+ {
+ public int branch = -1;
+ }
+
+}
--
Gitblit v1.8.0