void OnEnable() { // Only one instance of debug console is allowed if (instance == null) { instance = this; pooledLogItems = new List <DebugLogItem>(); canvasTR = transform; // Associate sprites with log types logSpriteRepresentations = new Dictionary <LogType, Sprite>(); logSpriteRepresentations.Add(LogType.Log, infoLog); logSpriteRepresentations.Add(LogType.Warning, warningLog); logSpriteRepresentations.Add(LogType.Error, errorLog); logSpriteRepresentations.Add(LogType.Exception, errorLog); logSpriteRepresentations.Add(LogType.Assert, errorLog); // Initially, all log types are visible filterInfoButton.color = filterButtonsSelectedColor; filterWarningButton.color = filterButtonsSelectedColor; filterErrorButton.color = filterButtonsSelectedColor; // When collapse is disabled and all log types are visible (initial state), // the order of the debug entries to show on screen is the same as // the order they were intercepted collapsedLogEntries = new List <DebugLogEntry>(); uncollapsedLogEntriesIndices = new List <int>(); indicesOfListEntriesToShow = uncollapsedLogEntriesIndices; recycledListView.SetLogItemHeight(logItemPrefab.transformComponent.sizeDelta.y); recycledListView.SetCollapsedEntriesList(collapsedLogEntries); recycledListView.SetEntryIndicesList(indicesOfListEntriesToShow); // If it is a singleton object, don't destroy it between scene changes if (singleton) { DontDestroyOnLoad(gameObject); } } else if (this != instance) { Destroy(gameObject); return; } // Intercept debug entries Application.logMessageReceived -= ReceivedLog; Application.logMessageReceived += ReceivedLog; // Listen for entered commands commandInputField.onValidateInput -= OnValidateCommand; commandInputField.onValidateInput += OnValidateCommand; /*Debug.LogAssertion( "assert" ); * Debug.LogError( "error" ); * Debug.LogException( new System.IO.EndOfStreamException() ); * Debug.LogWarning( "warning" ); * Debug.Log( "log" );*/ }
protected void Awake() { transform.position = defaultCameraPosition; targetCameraPos = defaultCameraPosition; cam = GetComponent <Camera>(); debugConsole = FindObjectOfType <DebugLogManager>(); }
public void Initialize(DebugLogManager manager, List <DebugLogEntry> collapsedLogEntries, DebugLogIndexList indicesOfEntriesToShow, float logItemHeight) { this.manager = manager; this.collapsedLogEntries = collapsedLogEntries; this.indicesOfEntriesToShow = indicesOfEntriesToShow; this.logItemHeight = logItemHeight; _1OverLogItemHeight = 1f / logItemHeight; }
public override void LoadContent() { try { texture = GameLoop.gameInstance.Content.Load <Texture2D>("Sprites/" + assetName); } catch (Exception e1) { try { texture = GameLoop.gameInstance.Content.Load <Texture2D>(fullPath); } catch (Exception e2) { try { string p = Path.Combine(layer.level.contentPath, Path.GetFileName(fullPath)); //texture = TextureManager.Instance.LoadFromFile(p); texture = TextureManager.Instance.LoadFromFile(Path.Combine(Directory.GetCurrentDirectory(), "Content", "Sprites", assetName + Path.GetExtension(fullPath))); if (texture == null) { throw new Exception(); } } catch (Exception e3) { texture = TextureManager.Instance.LoadFromFile(fullPath); } } } if (texture != null) { origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / 2)); } else { DebugLogManager.writeToLogFile(@"Unable to load texture: " + assetName + @" . Using fallback!"); texture = GameLoop.gameInstance.Content.Load <Texture2D>(@"Sprites/fallback"); } this.ToFixture(); if (fixture != null) { fixture.Body.Rotation = rotation; } if (fixtures != null) { fixtures[0].Body.Rotation = rotation; } }
private void MakeSingleton() { if (instance == null) { instance = this; DontDestroyOnLoad(this.gameObject); } else { Destroy(this.gameObject); } }
public static Level LoadLevelFile(string levelPath) { try { FileStream file = FileManager.LoadLevelFile(levelPath); BinaryFormatter serializer = new BinaryFormatter(); Level level = (Level)serializer.Deserialize(file); file.Close(); return(level); } catch (Exception e) { DebugLogManager.writeToLogFile("LoadLevelFile Exception: " + e.Message); return(new Level()); } }
// Start is called before the first frame update void Start() { enemyList.Clear(); GameManager._instance.OnGoldChange += UpdateHeroGoldGUI; GameManager._instance.OnKillsChange += UpdateHeroKillsGUI; isHeroAlife = true; hasTurnEnded = true; loadingScreen.SetActive(true); debugLogManager = GetComponent <DebugLogManager>(); currentController = Controllers.gameLoading; StartCoroutine(GenerateRandom(GameManager._instance.CurrentLevel)); if (GameManager._instance.GetComponent <GameDataManager>().DebugConsoleEnabled == 0) { debugLogPanel.SetActive(false); } }
void Awake() { Debug.Log("Coo.Awake"); if (Coo.ID > 0) { Destroy(base.gameObject); return; } ID++; Coo.go = base.gameObject; Coo.monoBehaviour = this; GameObject cameraGO = GameObject.FindWithTag("UICamera"); if (cameraGO != null) { uiCamera = cameraGO.GetComponent <Camera>(); } debugLogManager = DebugLogManager.Instance; assetManager = AssetManager.Instance; configManager = ConfigManager.Instance; packetManager = PacketManager.Instance; soundManager = SoundManager.Instance; nativeManager = NativeCodeManager.Instance; //plotTalkManager = PlotTalkManager.Instance; callUtil = CallUtil.Instance; crashReporter = CrashReporter.Instance; luaManager = new LuaScriptMgr(); loadManager = gameObject.AddComponent <LoadManager>(); menuManager = gameObject.AddComponent <MenuManager>(); fps = gameObject.AddComponent <HUDFPS>(); fps.enabled = GameConst.VisiableFPS; ShakePhoneEvent shakePhoneEvent = GetComponent <ShakePhoneEvent>(); if (shakePhoneEvent == null) { shakePhoneEvent = base.gameObject.AddComponent <ShakePhoneEvent>(); } shakePhoneEvent.OnShake += OpenDebugLogPanel; GameObject.DontDestroyOnLoad(base.gameObject); }
public void loadContentInEditor(GraphicsDeviceManager graphicsM, GraphicsDevice graphics, ContentManager content) { particleRenderer = new ParticleRenderer(graphicsM); particleRenderer.particleRenderer.LoadContent(content); this._graphicsM = graphicsM; this._contentM = content; Rt = new RenderTarget2D(graphics, graphics.Viewport.Width, graphics.Viewport.Height); foreach (LevelObject lo in loList) { if (lo is DrawableLevelObject) { DrawableLevelObject dlo = (DrawableLevelObject)lo; try { dlo.loadContentInEditor(graphics); } catch (Exception e) { DebugLogManager.writeToLogFile("Wasn't able to load " + dlo.name + " in Layer " + this.name); } } else if (lo is ParticleObject) { ParticleObject p = (ParticleObject)lo; particleRenderer.addParticleObjectsInEditor(p, content); } } particleRenderer.initializeParticlesInEditor(content); if (Effects == null) { Effects = new List <EffectObject>(); } foreach (EffectObject eo in Effects) { //eo.Initialise(); eo.loadContentInEditor(graphics, content); } }
void OnEnable() { // Only one instance of debug console is allowed if (instance == null) { instance = this; pooledLogItems = new List <DebugLogItem>(); canvasTR = (RectTransform)transform; // Associate sprites with log types logSpriteRepresentations = new Dictionary <LogType, Sprite> { { LogType.Log, infoLog }, { LogType.Warning, warningLog }, { LogType.Error, errorLog }, { LogType.Exception, errorLog }, { LogType.Assert, errorLog } }; inputCommandHistory = new LinkedList <string>(); // Initially, all log types are visible filterInfoButton.color = buttonSelectedColor; filterWarningButton.color = buttonSelectedColor; filterErrorButton.color = buttonSelectedColor; collapsedLogEntries = new List <DebugLogEntry>(128); collapsedLogEntriesMap = new Dictionary <DebugLogEntry, int>(128); uncollapsedLogEntriesIndices = new DebugLogIndexList(); indicesOfListEntriesToShow = new DebugLogIndexList(); recycledListView.Initialize(this, collapsedLogEntries, indicesOfListEntriesToShow, logItemPrefab.Transform.sizeDelta.y); recycledListView.UpdateItemsInTheList(true); nullPointerEventData = new PointerEventData(null); //enumerate buttons SetupDebugButtons(); // If it is a singleton object, don't destroy it between scene changes if (singleton) { DontDestroyOnLoad(gameObject); } } else if (this != instance) { Destroy(gameObject); return; } // Intercept debug entries Application.logMessageReceived -= ReceivedLog; Application.logMessageReceived += ReceivedLog; if (receiveLogcatLogsInAndroid) { #if !UNITY_EDITOR && UNITY_ANDROID if (logcatListener == null) { logcatListener = new DebugLogLogcatListener(); } logcatListener.Start(logcatArguments); #endif } // Listen for entered commands commandInputField.onValidateInput -= OnValidateCommand; commandInputField.onValidateInput += OnValidateCommand; if (minimumHeight < 120f) { minimumHeight = 120f; } }
public InGameConsoleConfigurator(DebugLogManager debugLogManager) { _debugLogManager = debugLogManager; }
// This log item is clicked, show the debug entry's stack trace public void Clicked() { DebugLogManager.OnLogClicked(entryIndex); }
protected override void Awake() { base.Awake(); debugConsole = FindObjectOfType <DebugLogManager>(); }