Ejemplo n.º 1
0
 private static string GetFieldValueString(object o)
 {
     if (o == null)
     {
         return("nil");
     }
     else
     {
         System.Type type = o.GetType();
         if (type == typeof(string))
         {
             //return DialogueLua.DoubleQuotesToSingle(string.Format("\"{0}\"", new System.Object[] { o.ToString().Replace("\n", "\\n") }));
             //return string.Format("\"{0}\"", new System.Object[] { o.ToString().Replace("\n", "\\n") });
             return(string.Format("\"{0}\"", new System.Object[] { DialogueLua.DoubleQuotesToSingle(o.ToString().Replace("\n", "\\n")) }));
         }
         else if (type == typeof(bool))
         {
             return(o.ToString().ToLower());
         }
         else
         {
             return(o.ToString());
         }
     }
 }
        private string GetPositionString()
        {
            string optionalLevelName = recordCurrentLevel ? DialogueLua.DoubleQuotesToSingle("," + Tools.loadedLevelName) : string.Empty;

            return(string.Format("{0},{1},{2},{3},{4},{5},{6}{7}",
                                 new System.Object[] { transform.position.x, transform.position.y, transform.position.z,
                                                       transform.rotation.x, transform.rotation.y, transform.rotation.z, transform.rotation.w,
                                                       optionalLevelName }));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Adds a quest to the Lua Item[] table.
 /// </summary>
 /// <param name='title'>
 /// Title of the quest.
 /// </param>
 /// <param name='description'>
 /// Description of the quest.
 /// </param>
 /// <param name='state'>
 /// Quest state.
 /// </param>
 /// <example>
 /// QuestLog.AddQuest("Kill 5 Rats", "The baker asked me to bring 5 rat corpses.", QuestState.Unassigned);
 /// </example>
 public static void AddQuest(string title, string description, QuestState state)
 {
     if (!string.IsNullOrEmpty(title))
     {
         Lua.Run(string.Format("Item[\"{0}\"] = {{ Name = \"{1}\", Description = \"{2}\", State = \"{3}\" }}",
                               new System.Object[] { DialogueLua.StringToTableIndex(title),
                                                     DialogueLua.DoubleQuotesToSingle(title),
                                                     DialogueLua.DoubleQuotesToSingle(description),
                                                     StateToString(state) }),
                 DialogueDebug.LogInfo);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Adds a quest entry to a quest.
        /// </summary>
        /// <param name="questTitle">Title of the quest.</param>
        /// <param name="entryNumber">Entry number.</param>
        /// <param name="description">The quest entry description.</param>
        public static void AddQuestEntry(string questTitle, string description)
        {
            int entryCount = GetQuestEntryCount(questTitle);

            entryCount++;
            DialogueLua.SetQuestField(questTitle, "Entry_Count", entryCount);
            string entryFieldName = GetEntryFieldName(entryCount);

            DialogueLua.SetQuestField(questTitle, entryFieldName, DialogueLua.DoubleQuotesToSingle(description));
            string entryStateFieldName = GetEntryStateFieldName(entryCount);

            DialogueLua.SetQuestField(questTitle, entryStateFieldName, "unassigned");
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Sets the localized quest entry description.
        /// </summary>
        /// <param name="questTitle">Title of the quest.</param>
        /// <param name="entryNumber">Entry number.</param>
        /// <param name="description">The quest entry description.</param>
        public static void SetQuestEntry(string questTitle, int entryNumber, string description)
        {
            string entryFieldName = GetEntryFieldName(entryNumber);

            DialogueLua.SetLocalizedQuestField(questTitle, entryFieldName, DialogueLua.DoubleQuotesToSingle(description));
        }