/**
         * <summary>Creates a new instance of the 'Hotspot: Rename' Action</summary>
         * <param name = "hotspotToRename">The Hotspot to rename</param>
         * <param name = "newName">If Hotspot's new name</param>
         * <param name = "translationID">The new name's translation ID number, as generated by the Speech Manager</param>
         * <returns>The generated Action</returns>
         */
        public static ActionRename CreateNew(Hotspot hotspotToRename, string newName, int translationID = -1)
        {
            ActionRename newAction = (ActionRename)CreateInstance <ActionRename>();

            newAction.hotspot = hotspotToRename;
            newAction.newName = newName;
            newAction.lineID  = translationID;
            return(newAction);
        }
Exemplo n.º 2
0
        private void ExtractHotspotName(ActionRename action, bool onlySeekNew, bool isInScene)
        {
            if (action.newName != "")
            {
                string _scene = "";
                if (isInScene)
                {
                    _scene = UnityVersionHandler.GetCurrentSceneName ();
                }

                if (onlySeekNew && action.lineID == -1)
                {
                    // Assign a new ID on creation
                    SpeechLine newLine = new SpeechLine (GetIDArray(), _scene, action.newName, languages.Count - 1, AC_TextType.Hotspot);

                    action.lineID = newLine.lineID;
                    lines.Add (newLine);
                }

                else if (!onlySeekNew && action.lineID > -1)
                {
                    // Already has an ID, so don't replace
                    SpeechLine existingLine = new SpeechLine (action.lineID, _scene, action.newName, languages.Count - 1, AC_TextType.Hotspot);

                    int lineID = SmartAddLine (existingLine);
                    if (lineID >= 0) action.lineID = lineID;
                }
            }
            else
            {
                // Remove from SpeechManager
                action.lineID = -1;
            }
        }