Example #1
0
        public static bool Start()
        {
            GameObject gameObject = GameObject.Find(MemoryMonitor._GAME_OBJECT_NAME);

            if (gameObject == null)
            {
                gameObject = new GameObject(MemoryMonitor._GAME_OBJECT_NAME);
                UnityEngine.Object.DontDestroyOnLoad(gameObject);
                MemoryMonitorBehaviour memoryMonitorBehaviour = gameObject.AddComponent <MemoryMonitorBehaviour>();
                GameObject             gameObject2            = ResourceCache.LoadFromResourcesImmediate(MemoryMonitor._RES_NAME) as GameObject;
                if (gameObject2 != null)
                {
                    GameObject gameObject3 = UnityEngine.Object.Instantiate(gameObject2) as GameObject;
                    if (gameObject3)
                    {
                        gameObject3.transform.parent   = gameObject.transform;
                        memoryMonitorBehaviour.RedRing = gameObject3.GetComponent <GUITexture>();
                        return(true);
                    }
                }
                else
                {
                    TsLog.LogWarning("[Memory] \"{0}\" 리소스를 읽어들이지 못 했습니다.", new object[]
                    {
                        MemoryMonitor._RES_NAME
                    });
                }
            }
            return(false);
        }
Example #2
0
        public static bool Show(float displaySec = 0f)
        {
            GameObject gameObject = GameObject.Find(MemoryMonitor._GAME_OBJECT_NAME);

            if (gameObject != null)
            {
                MemoryMonitorBehaviour component = gameObject.GetComponent <MemoryMonitorBehaviour>();
                if (component != null)
                {
                    if (displaySec == 0f)
                    {
                        component.ShowAlert(30f);
                    }
                    else
                    {
                        component.ShowAlert(displaySec);
                    }
                    return(true);
                }
            }
            return(false);
        }