コード例 #1
0
        public string GetFullLabel(Hotspot _hotspot, int _language)
        {
            if (_hotspot == null)
            {
                return(string.Empty);
            }

            if (_hotspot.lookButton == this)
            {
                string prefix = KickStarter.cursorManager.GetLabelFromID(KickStarter.cursorManager.lookCursor_ID, _language);
                return(AdvGame.CombineLanguageString(prefix,
                                                     _hotspot.GetName(_language),
                                                     _language));
            }
            else if (_hotspot.useButtons.Contains(this))
            {
                string prefix = KickStarter.cursorManager.GetLabelFromID(iconID, _language);
                return(AdvGame.CombineLanguageString(prefix,
                                                     _hotspot.GetName(_language),
                                                     _language));
            }
            else if (_hotspot.invButtons.Contains(this))
            {
                InvItem item   = KickStarter.runtimeInventory.GetItem(invID);
                string  prefix = KickStarter.runtimeInventory.GetHotspotPrefixLabel(item, item.GetLabel(_language), _language);
                return(AdvGame.CombineLanguageString(prefix,
                                                     _hotspot.GetName(_language),
                                                     _language));
            }

            return(string.Empty);
        }
コード例 #2
0
        private void ShowHotspotGUI()
        {
            GUILayout.BeginVertical("Button");

            GUILayout.Label("Hotspots: " + sceneHotspots.Length + " found");
            if (GUILayout.Button("Select next"))
            {
                SetNextHotspot();
            }

            if (selectedHotspot != null)
            {
                GUILayout.Label("Selected Hotspot: " + selectedHotspot.GetName(0));

                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Deselect"))
                {
                    selectedHotspot = null;
                    KickStarter.playerInteraction.SetActiveHotspot(null);
                }
                if (GUILayout.Button("Use"))
                {
                    selectedHotspot.RunUseInteraction();
                }
                if (GUILayout.Button("Examine"))
                {
                    selectedHotspot.RunExamineInteraction();
                }
                GUILayout.EndHorizontal();
            }

            GUILayout.EndVertical();
        }
コード例 #3
0
        public override string SaveData()
        {
            HotspotData hotspotData = new HotspotData();

            hotspotData.objectID = constantID;

            if (gameObject.layer == LayerMask.NameToLayer(KickStarter.settingsManager.hotspotLayer))
            {
                hotspotData.isOn = true;
            }
            else
            {
                hotspotData.isOn = false;
            }

            if (GetComponent <Hotspot>())
            {
                Hotspot _hotspot = GetComponent <Hotspot>();
                hotspotData.buttonStates = ButtonStatesToString(_hotspot);

                hotspotData.hotspotName   = _hotspot.GetName(0);
                hotspotData.displayLineID = _hotspot.displayLineID;
            }

            return(Serializer.SaveScriptData <HotspotData> (hotspotData));
        }
コード例 #4
0
        public string GetFullLabel(Hotspot _hotspot, InvInstance invInstance, int _language)
        {
            if (_hotspot == null)
            {
                return(string.Empty);
            }

            if (_hotspot.lookButton == this)
            {
                string prefix      = KickStarter.cursorManager.GetLabelFromID(KickStarter.cursorManager.lookCursor_ID, _language);
                string hotspotName = _hotspot.GetName(_language);
                if (_hotspot.canBeLowerCase && !string.IsNullOrEmpty(prefix))
                {
                    hotspotName = hotspotName.ToLower();
                }

                return(AdvGame.CombineLanguageString(prefix, hotspotName, _language));
            }
            else if (_hotspot.useButtons.Contains(this))
            {
                string prefix      = KickStarter.cursorManager.GetLabelFromID(iconID, _language);
                string hotspotName = _hotspot.GetName(_language);
                if (_hotspot.canBeLowerCase && !string.IsNullOrEmpty(prefix))
                {
                    hotspotName = hotspotName.ToLower();
                }

                return(AdvGame.CombineLanguageString(prefix, hotspotName, _language));
            }
            else if (_hotspot.invButtons.Contains(this) && InvInstance.IsValid(invInstance))
            {
                string prefix      = invInstance.GetHotspotPrefixLabel(_language);
                string hotspotName = _hotspot.GetName(_language);
                if (_hotspot.canBeLowerCase && !string.IsNullOrEmpty(prefix))
                {
                    hotspotName = hotspotName.ToLower();
                }

                return(AdvGame.CombineLanguageString(prefix, hotspotName, _language));
            }

            return(string.Empty);
        }
コード例 #5
0
        /**
         * <summary>Generates a label that represents the name of the parameter's value, if appropriate<summary>
         * <returns>A label that represents the name of the parameter's value<summary>
         */
        public string GetLabel()
        {
            switch (parameterType)
            {
            case ParameterType.GameObject:
                if (gameObject != null)
                {
                    Hotspot _hotspot = gameObject.GetComponent <Hotspot>();
                    if (_hotspot)
                    {
                        return(_hotspot.GetName(Options.GetLanguage()));
                    }

                    Char _char = gameObject.GetComponent <Char>();
                    if (_char)
                    {
                        return(_char.GetName(Options.GetLanguage()));
                    }

                    return(gameObject.name);
                }
                return(string.Empty);

            case ParameterType.InventoryItem:
                InvItem invItem = KickStarter.inventoryManager.GetItem(intValue);
                if (invItem != null)
                {
                    return(invItem.GetLabel(Options.GetLanguage()));
                }
                return(GetSaveData());

            case ParameterType.GlobalVariable:
                GVar gVar = KickStarter.variablesManager.GetVariable(intValue);
                if (gVar != null)
                {
                    return(gVar.label);
                }
                return(GetSaveData());

            case ParameterType.LocalVariable:
                GVar lVar = LocalVariables.GetVariable(intValue);
                if (lVar != null)
                {
                    return(lVar.label);
                }
                return(GetSaveData());

            default:
                return(GetSaveData());
            }
        }
コード例 #6
0
        /**
         * <summary>Serialises appropriate GameObject values into a string.</summary>
         * <returns>The data, serialised as a string</returns>
         */
        public override string SaveData()
        {
            HotspotData hotspotData = new HotspotData();

            hotspotData.objectID = constantID;


            if (GetComponent <Hotspot>())
            {
                Hotspot _hotspot = GetComponent <Hotspot>();
                hotspotData.isOn         = _hotspot.IsOn();
                hotspotData.buttonStates = ButtonStatesToString(_hotspot);

                hotspotData.hotspotName   = _hotspot.GetName(0);
                hotspotData.displayLineID = _hotspot.displayLineID;
            }

            return(Serializer.SaveScriptData <HotspotData> (hotspotData));
        }
コード例 #7
0
        /**
         * <summary>Generates a label that represents the name of the parameter's value, if the parameterType = ParameterType.GameObject<summary>
         * <returns>A label that represents the name of the parameter's value, if the parameterType = ParameterType.GameObject<summary>
         */
        public string GetLabel()
        {
            if (parameterType == ParameterType.GameObject)
            {
                if (gameObject != null)
                {
                    Hotspot _hotspot = gameObject.GetComponent <Hotspot>();
                    if (_hotspot)
                    {
                        return(_hotspot.GetName(Options.GetLanguage()));
                    }

                    Char _char = gameObject.GetComponent <Char>();
                    if (_char)
                    {
                        return(_char.GetName(Options.GetLanguage()));
                    }

                    return(gameObject.name);
                }
                return("");
            }
            return(GetSaveData());
        }
コード例 #8
0
        /**
         * <summary>Generates a label that represents the name of the parameter's value, if appropriate<summary>
         * <returns>A label that represents the name of the parameter's value<summary>
         */
        public string GetLabel()
        {
            switch (parameterType)
            {
            case ParameterType.GameObject:
                if (gameObject != null)
                {
                    Hotspot _hotspot = gameObject.GetComponent <Hotspot> ();
                    if (_hotspot)
                    {
                        return(_hotspot.GetName(Options.GetLanguage()));
                    }

                    Char _char = gameObject.GetComponent <Char> ();
                    if (_char)
                    {
                        return(_char.GetName(Options.GetLanguage()));
                    }

                    return(gameObject.name);
                }
                return(string.Empty);

            case ParameterType.InventoryItem:
                InvItem invItem = KickStarter.inventoryManager.GetItem(intValue);
                if (invItem != null)
                {
                    return(invItem.GetLabel(Options.GetLanguage()));
                }
                return(GetSaveData());

            case ParameterType.Document:
                Document document = KickStarter.inventoryManager.GetDocument(intValue);
                if (document != null)
                {
                    return(KickStarter.runtimeLanguages.GetTranslation(document.title,
                                                                       document.titleLineID,
                                                                       Options.GetLanguage()));
                }
                return(GetSaveData());

            case ParameterType.GlobalVariable:
                GVar gVar = GetVariable();
                if (gVar != null)
                {
                    return(gVar.label);
                }
                return(GetSaveData());

            case ParameterType.LocalVariable:
                GVar lVar = GetVariable();
                if (lVar != null)
                {
                    return(lVar.label);
                }
                return(GetSaveData());

            case ParameterType.ComponentVariable:
                GVar cVar = GetVariable();
                if (cVar != null)
                {
                    return(cVar.label);
                }
                return(GetSaveData());

            default:
                return(GetSaveData());
            }
        }