Esempio n. 1
0
        /**
         * <summary>Recalculates the element's size.
         * This should be called whenever a Menu's shape is changed.</summary>
         * <param name = "source">How the parent Menu is displayed (AdventureCreator, UnityUiPrefab, UnityUiInScene)</param>
         */
        public override void RecalculateSize(MenuSource source)
        {
            if (uiButton == null)
            {
                if (AdvGame.GetReferences().cursorManager)
                {
                    CursorIcon _icon = AdvGame.GetReferences().cursorManager.GetCursorIconFromID(iconID);
                    if (_icon != null)
                    {
                        icon  = _icon;
                        label = _icon.label;
                        icon.Reset();
                    }
                }

                base.RecalculateSize(source);
            }
            else
            {
                if (AdvGame.GetReferences().cursorManager)
                {
                    CursorIcon _icon = AdvGame.GetReferences().cursorManager.GetCursorIconFromID(iconID);
                    if (_icon != null)
                    {
                        label = _icon.label;
                    }
                }
            }
        }
        /**
         * <summary>Recalculates the element's size.
         * This should be called whenever a Menu's shape is changed.</summary>
         * <param name = "source">How the parent Menu is displayed (AdventureCreator, UnityUiPrefab, UnityUiInScene)</param>
         */
        public override void RecalculateSize(MenuSource source)
        {
            if (AdvGame.GetReferences().cursorManager)
            {
                CursorIcon _icon = AdvGame.GetReferences().cursorManager.GetCursorIconFromID(iconID);
                if (_icon != null)
                {
                    icon = _icon;
                    if (Application.isPlaying)
                    {
                        label = KickStarter.runtimeLanguages.GetTranslation(_icon.label, _icon.lineID, Options.GetLanguage());
                    }
                    else
                    {
                        label = _icon.label;
                    }
                    icon.Reset();
                }
            }

            base.RecalculateSize(source);
        }
Esempio n. 3
0
        /**
         * <summary>Recalculates the element's size.
         * This should be called whenever a Menu's shape is changed.</summary>
         * <param name = "source">How the parent Menu is displayed (AdventureCreator, UnityUiPrefab, UnityUiInScene)</param>
         */
        public override void RecalculateSize(MenuSource source)
        {
            if (uiButton == null)
            {
                if (AdvGame.GetReferences ().cursorManager)
                {
                    CursorIcon _icon = AdvGame.GetReferences ().cursorManager.GetCursorIconFromID (iconID);
                    if (_icon != null)
                    {
                        icon = _icon;
                        label = _icon.label;
                        icon.Reset ();
                    }
                }

                base.RecalculateSize (source);
            }
        }
		public override void RecalculateSize ()
		{
			if (AdvGame.GetReferences ().cursorManager)
			{
				CursorManager cursorManager = AdvGame.GetReferences ().cursorManager;
				CursorIcon _icon = cursorManager.GetCursorIconFromID (iconID);
				if (_icon != null)
				{
					icon = _icon;
					label = _icon.label;
					icon.Reset ();
				}
			}

			base.RecalculateSize ();
		}
Esempio n. 5
0
        public override void RecalculateSize(MenuSource source)
        {
            if (AdvGame.GetReferences().cursorManager)
            {
                if (fixedIcon)
                {
                    CursorIcon _icon = AdvGame.GetReferences().cursorManager.GetCursorIconFromID(iconID);
                    if (_icon != null)
                    {
                        labels = new string[1];
                        icon   = _icon;
                        if (Application.isPlaying)
                        {
                            labels[0] = KickStarter.runtimeLanguages.GetTranslation(_icon.label, _icon.lineID, Options.GetLanguage(), _icon.GetTranslationType(0));
                        }
                        else
                        {
                            labels[0] = _icon.label;
                        }
                        icon.Reset();
                    }
                }
                else
                {
                    List <int> _iconIDs = new List <int>();
                    if (!KickStarter.settingsManager.autoHideInteractionIcons || !Application.isPlaying)
                    {
                        foreach (CursorIcon icon in KickStarter.cursorManager.cursorIcons)
                        {
                            _iconIDs.Add(icon.id);
                        }
                    }
                    else if (parentMenu != null)
                    {
                        if (parentMenu.TargetHotspot != null)
                        {
                            foreach (Button button in parentMenu.TargetHotspot.useButtons)
                            {
                                if (!button.isDisabled)
                                {
                                    _iconIDs.Add(button.iconID);
                                }
                            }
                        }
                        else if (parentMenu.TargetInvItem != null)
                        {
                            foreach (InvInteraction interaction in parentMenu.TargetInvItem.interactions)
                            {
                                _iconIDs.Add(interaction.icon.id);
                            }
                        }
                    }

                    iconIDs = _iconIDs.ToArray();

                    labels = new string[iconIDs.Length];
                    for (int i = 0; i < iconIDs.Length; i++)
                    {
                        CursorIcon _icon = KickStarter.cursorManager.GetCursorIconFromID(iconIDs[i]);
                        if (Application.isPlaying)
                        {
                            labels[i] = (_icon != null) ? KickStarter.runtimeLanguages.GetTranslation(_icon.label, _icon.lineID, Options.GetLanguage(), _icon.GetTranslationType(0)) : string.Empty;
                        }
                        else
                        {
                            labels[i] = (icon != null) ? _icon.label : string.Empty;
                        }
                    }

                    if (Application.isPlaying)
                    {
                        numSlots = iconIDs.Length;
                        if (numSlots > maxSlots)
                        {
                            numSlots = maxSlots;
                        }
                    }

                    LimitOffset(iconIDs.Length);
                }
            }

            base.RecalculateSize(source);
        }