private static void TestDebugModule() { //Test log DebugMgr.Log("1"); DebugMgr.LogWarning("2"); DebugMgr.LogError("3"); }
public static void SecondMethod(RunningTotal param) { DebugMgr.start(10, "ExMethodCall.SecondMethod"); param.IncrementValue(); DebugMgr.output(10, "During RunningTotal.value = " + param.GetValue()); DebugMgr.end(10); }
// Constructor is made private so that only // the class can instantiate itself private Reference() { DebugMgr.start(9, "Reference.Reference"); NameValueCollection pluginConfig = (NameValueCollection)ConfigurationSettings.GetConfig("settings/plugin"); if (pluginConfig["dir"] == null) { throw(new ConfigurationException("Incorrect Plugin Directory")); } else { _path = pluginConfig["dir"]; DebugMgr.outputVar(9, "Plugin directory", _path); _pluginEntries = Directory.GetFileSystemEntries(_path, "*.dll"); OperatingSystem os = System.Environment.OSVersion; DebugMgr.outputVar(9, "Operating System", os.Platform); foreach (string path in _pluginEntries) { DebugMgr.outputVar(9, "assembly", path); Assembly assembly; if ((int)os.Platform == 128) { // This is Linux assembly = Assembly.LoadFrom(path); } else { // This is everything else assembly = Assembly.Load(AssemblyName.GetAssemblyName(path)); } _assemblies.Add(assembly); } } DebugMgr.end(9); }
private static Animal CreateCurrentDogInstance() { DebugMgr.start(10, "TestInheritance.CreateCurrentDogInstance"); DebugMgr.end(10); return(new EnglishBulldog()); // return new Dog(); Original version }
public static void DoIt() { DebugMgr.start(10, "RunExamples.DoIt"); SimpleOldContainer(); SimpleNewContainer(); DebugMgr.end(10); }
public Object GetUnknownTypeObject(string prefix, string resource, string view) { Object retval = null; DebugMgr.start(9, "Reference.GetUnknownTypeObject"); foreach (Assembly assembly in _assemblies) { Object @object; IImplementations implementations = (IImplementations)assembly.CreateInstance("Reference.Implementation"); if (implementations != null) { @object = implementations.GetResource(prefix, resource, view); if (@object != null) { DebugMgr.output(9, "Found Object"); retval = @object; break; } } else { DebugMgr.outputVar(9, "Did not implement", assembly.FullName); } } DebugMgr.end(9); return(retval); }
private static void TimeProofPolymorphicInheritance() { DebugMgr.start(10, "TestInheritance.TimeProofPolymorphicInheritance"); Animal animal = CreateCurrentDogInstance(); animal.WhatAmI(); DebugMgr.end(10); }
public static void Main(string[] args) { DebugMgr.assignDebugFlags(10); Chap01SecAll.RunExamples.DoIt(); Chap01SecInheritanceAndStructs.RunExamples.DoIt(); Chap01SecGenerics.RunExamples.DoIt(); Chap01SecAsynchronous.RunExamples.DoIt(); }
public static void DoIt() { DebugMgr.start(10, "RunExamples.DoIt"); ReceiveMessage receiver = new ReceiveMessage(); DoItNow myDelegate = new DoItNow(receiver.MethodToDoItNow); myDelegate("do something"); DebugMgr.end(10); }
public static void SecondMethod(ExStruct param1, ExClass param2) { DebugMgr.start(10, "ExMethodCall.SecondMethod"); param1.value++; param2.value++; DebugMgr.output(10, "During ExStruct.value = " + param1.value); DebugMgr.output(10, "During ExClass.value = " + param2.value); DebugMgr.end(10); }
private void OnRankingCallback(ActionResult actionResult) { Response1001Pack pack = actionResult.GetValue <Response1001Pack>(); if (pack == null) { return; } DebugMgr.Log(pack.PageCount); }
private void OnMonsterBtn() { Dropdown dd = PassDropdown.gameObject.GetComponent <Dropdown>(); string monsterId = dd.captionText.text.Split('.')[0]; if (int.TryParse(monsterId, out DebugMgr.GetInstance().MonsterId)) { Global.gApp.gMsgDispatcher.Broadcast <string>(MsgIds.ShowGameTipsByStr, string.Format("成功设置所有关卡的怪都为{0}", dd.captionText.text)); } }
private void GenerateCreateInfo() { m_CreateInfo.Capacity = Mathf.Min(m_CreateInfo.Capacity, m_MonsterCount); m_Monsters.Capacity = Mathf.Max(m_Monsters.Capacity, m_MonsterCount / 2); EZ.Data.Monster monsterData = Global.gApp.gGameData.MosterData; if (m_RandomType == RandomType.RandCreateInfo) { int countIndex = 0; foreach (int enemyId in m_WaveData.enemyID) { int eId = enemyId; if (DebugMgr.GetInstance().MonsterId > 0) { eId = DebugMgr.GetInstance().MonsterId; } MonsterItem monsterItem = monsterData.Get(eId); if (monsterItem == null) { Debug.LogError("EnemyId " + eId + " does not exist!"); continue; } var count = Mathf.CeilToInt(m_WaveData.enemyNum[countIndex] * Game.PlayerDataMgr.singleton.StageWaveFactor); for (int i = 0; i < count; i++) { m_CreateInfo.Add(monsterItem); } m_WaveMgr.CacheMonster(eId, count); countIndex++; } } else if (m_RandomType == RandomType.RandMonster) { int enemyIdCount = m_WaveData.enemyID.Length; int enemyCount = Mathf.CeilToInt(m_WaveData.enemyNum[0] * Game.PlayerDataMgr.singleton.StageWaveFactor); for (int i = 0; i < enemyCount; i++) { int enemyIndex = Random.Range(0, enemyIdCount); int enemyId = m_WaveData.enemyID[enemyIndex]; if (DebugMgr.GetInstance().MonsterId > 0) { enemyId = DebugMgr.GetInstance().MonsterId; } MonsterItem monsterItem = monsterData.Get(enemyId); if (monsterItem == null) { Debug.LogError("EnemyId " + enemyId + " does not exist!"); continue; } m_CreateInfo.Add(monsterItem); m_WaveMgr.CacheMonster(enemyId, 1); } } //CacheMonster(); }
public static void SimpleOldContainer() { DebugMgr.start(10, "RunExamples.SimpleOldContainer"); OldContainer container = new OldContainer(); container.MyProperty = 2; int value = (int)container.MyProperty; DebugMgr.output(10, "Value is " + value); DebugMgr.end(10); }
private static void SimpleInheritance() { DebugMgr.start(10, "TestInheritance.SimpleInheritance"); Subclassed subcls = new Subclassed(); subcls.SimpleMethod(); DebugMgr.output(10, "Now assigning to type BaseClass"); BaseClass basecls = subcls; basecls.SimpleMethod(); DebugMgr.end(10); }
public static void Main(string[] args) { DebugMgr.assignDebugFlags(10); DebugMgr.start(8, "Main"); try { RunDynamic(); } catch (Exception ex) { DebugMgr.output(1, "!!! " + ex.Message + " !!!"); } DebugMgr.end(8); }
public void greetings() { DebugMgr.start(10, "InAssembly2Class.greetings"); InAssembly1Class cls = new InAssembly1Class(); cls.greetings(); // cls.greetingsProtected(); // This method cannot be access due to protected measures // cls.greetingsInternal(); // This method cannot be accessed outside the assembly // InAssembly1Class2 cls2 = new InAssembly1Class2(); // Cannot be accessed DebugMgr.end(10); }
public static void SimpleNewContainer() { DebugMgr.start(10, "RunExamples.SimpleNewContainer"); #if GenericsSupported NewContainer <int> container = new NewContainer <int>(); container.MyProperty = 2; int value = container.MyProperty; DebugMgr.output(10, "Value is " + value); #else DebugMgr.output(10, "Not Implemented"); #endif DebugMgr.end(10); }
private static void PolymorphicInheritance() { DebugMgr.start(10, "TestInheritance.PolymorphicInheritance"); DebugMgr.output(10, "Created Human and assigned to Animal"); Animal animal1 = new Human(); animal1.WhatAmI(); DebugMgr.output(10, "Created Dog and assigned to Animal"); Animal animal2 = new Dog(); animal2.WhatAmI(); DebugMgr.end(10); }
public static void FirstMethod() { DebugMgr.start(10, "ExMethodCall.FirstMethod"); ExStruct cls1 = new ExStruct(); ExClass cls2 = new ExClass(); DebugMgr.output(10, "Before ExStruct.value = " + cls1.value); DebugMgr.output(10, "Before ExClass.value = " + cls2.value); SecondMethod(cls1, cls2); DebugMgr.output(10, "After ExStruct.value = " + cls1.value); DebugMgr.output(10, "After ExClass.value = " + cls2.value); DebugMgr.end(10); }
private static void MultipleInheritance() { DebugMgr.start(10, "TestInheritance.MultipleInheritance"); DebugMgr.output(10, "Created NewVersionSubclassed, and assigned to type BaseClass"); BaseClass baseCls = new NewVersionSubclassed(); baseCls.VirtualMethod(); DebugMgr.output(10, "Now assigning to type NewVersion"); NewVersion newVer = (NewVersion)baseCls; newVer.VirtualMethod(); DebugMgr.end(10); }
public static void FirstMethod() { DebugMgr.start(10, "ExMethodCall.FirstMethod"); ExStruct2 cls1 = new ExStruct2(); ExClass2 cls2 = new ExClass2(); DebugMgr.output(10, "Before ExStruct2.value = " + cls1.GetValue()); DebugMgr.output(10, "Before ExClass2.value = " + cls2.GetValue()); SecondMethod(cls1); SecondMethod(cls2); DebugMgr.output(10, "After ExStruct2.value = " + cls1.GetValue()); DebugMgr.output(10, "After ExClass2.value = " + cls2.GetValue()); DebugMgr.end(10); }
public static void RunResource() { IOperations operations = (IOperations)(Reference.Instance().GetUnknownTypeObject("DB", "cgross", "XML")); if (operations == null) { DebugMgr.output(1, "!!! Operations is a null object !!!"); } IUser user = operations.LoadUser("some.identifier"); DebugMgr.outputVar(8, "name", user.name); DebugMgr.outputVar(8, "street", user.street); DebugMgr.outputVar(8, "city", user.city); DebugMgr.outputVar(8, "country", user.country); }
public UserReference.IUser LoadUser(string reference) { DebugMgr.start(9, "XMLUserImpl.Operations.LoadUser"); DebugMgr.outputVar(9, "Reference", reference); GetLocalDirectory(); UserReference.IUser user = null; if (reference == "some.identifier") { user = new User(); XmlSerializer reader = new XmlSerializer(user.GetType()); StreamReader file = new StreamReader(Directory.GetCurrentDirectory() + "/some.identifier.xml"); user = (User)reader.Deserialize(file); } DebugMgr.end(9); return(user); }
// Notice how the Operations object is responsible for loading the // User object. Classical OO dictates elsewise, but component // engineering prefers separation. public UserReference.IUser LoadUser(string reference) { DebugMgr.start(9, "DbUserImpl.Operations.LoadUser"); DebugMgr.outputVar(9, "reference", reference); GetLocalDirectory(); UserReference.IUser user = null; if (reference == "some.identifier") { user = new User(); StreamReader sr = new StreamReader(Directory.GetCurrentDirectory() + "/some.identifier.txt"); user.name = sr.ReadLine(); user.street = sr.ReadLine(); user.city = sr.ReadLine(); user.country = sr.ReadLine(); } DebugMgr.end(9); return(user); }
public static void RunIt() { DebugMgr.start(10, "TestExternalreference.RunIt"); InAssembly2Class2 cls = new InAssembly2Class2(); cls.greetings(); //cls.greetingsProtected(); cls.greetingsInternal(); cls.greetingsInternalVirtual(); DebugMgr.output(10, "-----------"); InAssembly1Class cls2 = cls; cls2.greetings(); //cls2.greetingsInternal(); cls2.CallTheInternalMethod(); DebugMgr.end(10); }
public static void RunDynamic() { string @class = ConfigurationSettings.AppSettings["classload"]; DebugMgr.outputVar(8, "class to load", @class); IOperations operations = (IOperations)(Reference.Instance().GetObject(@class)); if (operations == null) { DebugMgr.output(1, "!!! Operations is a null object !!!"); } IUser user = operations.LoadUser("some.identifier"); DebugMgr.outputVar(8, "name", user.name); DebugMgr.outputVar(8, "street", user.street); DebugMgr.outputVar(8, "city", user.city); DebugMgr.outputVar(8, "country", user.country); }
private static void TestResModule() { //Test 资源加载 ResMgr.S.LoadAsset("Assets/GameRes/Prefabs/TestRes.prefab", typeof(GameObject), (success, asset) => { DebugMgr.Log("加载测试prefab成功?" + success); GameObject a = GameObject.Instantiate(asset) as GameObject; a.transform.position = new Vector3(1, 2, 3); DebugMgr.Log("设置" + a.name + "位置:" + a.transform.position); } ); ResMgr.S.LoadAsset("Assets/GameRes/Prefabs/TestRes.prefab", typeof(GameObject), (success, asset) => { DebugMgr.Log("第二次加载测试prefab成功?" + success); GameObject a = GameObject.Instantiate(asset) as GameObject; a.transform.position = new Vector3(3, 3, 3); DebugMgr.Log("设置" + a.name + "位置:" + a.transform.position); } ); }
public Object GetObject(string @class) { Object retval = null; DebugMgr.start(9, "Reference.GetObject"); DebugMgr.outputVar(9, "Class to instantiate", @class); foreach (Assembly assembly in _assemblies) { Object @object; @object = assembly.CreateInstance(@class); if (@object != null) { DebugMgr.outputVar(9, "loaded object", @class); retval = @object; break; } } DebugMgr.end(9); return(retval); }
void Awake() { I = this; _sbLine = new StringBuilder(); //gameObject.AddComponent<FrameShow>(); #if UNITY_EDITOR _defaultFontSize = 20; _defaultLineHeight = 30; _lineHeight = 20; _debugMode = DebugMode.StatsAndDebug; #else _defaultFontSize = 20; _defaultLineHeight = 30; _lineHeight = 30; _debugMode = DebugMode.StatsAndDebug; #endif //控制台类型 string[] types = { "main", "log", "command", }; //对应控制台类型的窗口绘制函数 GUI.WindowFunction[] cFunc = { Console_Main, Console_Log, Console_Command, }; _consoleType = types; _consoleFunc = cFunc; _eventSystem = GameObject.Find("EventSystem"); }