コード例 #1
0
        /// <summary>
        /// Closes the panel by destroying the object (removing any ongoing UI overhead).
        /// </summary>
        internal static void Close()
        {
            // Store previous position.
            lastX = _panel.relativePosition.x;
            lastY = _panel.relativePosition.y;

            // Destroy game objects.
            GameObject.Destroy(_panel);
            GameObject.Destroy(uiGameObject);

            // Let the garbage collector do its work (and also let us know that we've closed the object).
            _panel       = null;
            uiGameObject = null;
        }
コード例 #2
0
        /// <summary>
        /// Creates the panel object in-game and displays it.
        /// </summary>
        internal static void Create()
        {
            try
            {
                // If no instance already set, create one.
                if (uiGameObject == null)
                {
                    uiGameObject = new GameObject("BOBPackPanel");
                    uiGameObject.transform.parent = UIView.GetAView().transform;

                    _panel = uiGameObject.AddComponent <BOBPackPanel>();
                }
            }
            catch (Exception e)
            {
                Logging.LogException(e, "exception creating PackPanel");
            }
        }