示例#1
0
            //------------------------------------------------------------------------/
            // Initialization
            //------------------------------------------------------------------------/
            /// <summary>
            /// Initializes the LinkInterface, subscribing to all link navigation
            /// events, registering the link controller, etc...
            /// </summary>
            void Awake()
            {
                this.gameObject.Connect <Link.NavigateEvent>(this.OnNavigateEvent);
                this.gameObject.Connect <Link.ConfirmEvent>(this.OnConfirmEvent);
                this.gameObject.Connect <Link.CancelEvent>(this.OnCancelEvent);
                this.gameObject.Connect <Link.OpenedEvent>(this.OnLinkOpenedEvent);
                this.gameObject.Connect <Link.ClosedEvent>(this.OnLinkClosedEvent);
                this.gameObject.Connect <Link.SelectEvent>(this.OnLinkSelectEvent);

                // Look for the LinkController among the children
                Controller = GetComponentInChildren <LinkController>();
                if (Controller)
                {
                    Controller.Connect(this);
                }

                // Initialize the interface subclass
                this.OnInterfaceInitialize();

                // If it's already active, open it
                if (Active)
                {
                    this.Open();
                }
                // Otherwise hide everyhting
                else
                {
                    ToggleGraphics(false);
                    ToggleControls(false, true);
                }
            }