コード例 #1
0
        private void OnCommandStateChanged(UINavbarCommand i_Command)
        {
            if (i_Command == null)
            {
                return;
            }

            m_Dirty = true;
        }
コード例 #2
0
        private void Internal_RefreshView()
        {
            if (viewInstance == null)
            {
                return;
            }

            // Clear view.

            viewInstance.ClearAll();

            // Set new data.

            for (int index = 0; index < m_RegisteredEntries.Count; ++index)
            {
                List <UINavbarCommand> commands = m_RegisteredEntries[index];

                if (commands == null)
                {
                    continue;
                }

                UINavbarCommand targetCommand = null;

                // Find first not null command.

                for (int commandIndex = 0; commandIndex < commands.Count; ++commandIndex)
                {
                    UINavbarCommand current = commands[commandIndex];

                    if (current != null)
                    {
                        targetCommand = current;
                        break;
                    }
                }

                // Set command.

                viewInstance.SetElement(index, targetCommand);
            }
        }
コード例 #3
0
        private bool Internal_UnregisterCommand(UINavbarCommand i_Command)
        {
            if (i_Command == null)
            {
                return(false);
            }

            int index = i_Command.sortIndex;

            if (index < 0 || index >= m_RegisteredEntries.Count)
            {
                return(false);
            }

            i_Command.onCommandStateChanged -= OnCommandStateChanged;

            List <UINavbarCommand> entries = m_RegisteredEntries[index];

            return(entries.Remove(i_Command));
        }
コード例 #4
0
        private void OnFocusChanged(GameObject i_PrevFocus, GameObject i_CurrFocus)
        {
            if (i_PrevFocus != null)
            {
                UINavbarCommand[] commands = i_PrevFocus.GetComponents <UINavbarCommand>();
                for (int index = 0; index < commands.Length; ++index)
                {
                    UINavbarCommand command = commands[index];

                    if (command == null)
                    {
                        continue;
                    }

                    Internal_UnregisterCommand(command);
                }
            }

            if (i_CurrFocus != null)
            {
                UINavbarCommand[] commands = i_CurrFocus.GetComponents <UINavbarCommand>();
                for (int index = 0; index < commands.Length; ++index)
                {
                    UINavbarCommand command = commands[index];

                    if (command == null)
                    {
                        continue;
                    }

                    Internal_RegisterCommand(command);
                }
            }

            // Set as dirty.

            m_Dirty = true;
        }
        public void SetElement(int i_Index, UINavbarCommand i_Command)
        {
            if (m_NavbarElements == null)
            {
                return;
            }

            if (i_Index < 0 || i_Index >= m_NavbarElements.Length)
            {
                return;
            }

            UINavbarElement element = m_NavbarElements[i_Index];

            if (element == null)
            {
                return;
            }

            element.Clear();
            element.isVisible = false;

            if (i_Command == null)
            {
                return;
            }

            element.isVisible = true;

            Sprite sprite = Internal_GetSprite(i_Command.iconKey);

            element.SetIcon(sprite);

            element.SetText(i_Command.text);

            element.isActive = i_Command.isActive;
        }
コード例 #6
0
        private void OnTriggerRemoved(UIEventTrigger i_Trigger)
        {
            if (i_Trigger == null)
            {
                return;
            }

            UINavbarCommand[] commands = i_Trigger.GetComponents <UINavbarCommand>();
            for (int index = 0; index < commands.Length; ++index)
            {
                UINavbarCommand command = commands[index];

                if (command == null)
                {
                    continue;
                }

                Internal_UnregisterCommand(command);
            }

            // Set as dirty.

            m_Dirty = true;
        }