private string __get_text_at_textmanager(NTextManager kTextManager, string strTextGroupKeyPipeTextKey) { string text = strTextGroupKeyPipeTextKey; if (kTextManager != null) { string[] separator = new string[] { "|" }; string[] array = text.Split(separator, StringSplitOptions.RemoveEmptyEntries); if (array.Length != 2) { this.__output_error(string.Format("텍스트키 대체 오류! - 텍스트키값이 잘못되었습니다. {0}", text)); } else { text = kTextManager.GetText(array[0], array[1], string.Empty); if (text == null) { text = strTextGroupKeyPipeTextKey; } } } else { this.__output_error(string.Format("텍스트키 대체 오류! - TextManager 가 설정되지 않았습니다! - {0}", text)); } return(text); }
public static void _OutPutDelegate(string stroutput) { if (NTextManager._onOutputline != null) { NTextManager._onOutputline(stroutput); } }
public string ParseParamString(string strParamString, NTextManager kTextManager = null) { NDataReader nDataReader = new NDataReader(); this.Clear(); this.m_sb_ParamString.Append("(ParamStringError)"); if (nDataReader.LoadFrom(strParamString)) { if (nDataReader.BeginSection(this.SECTION_FORMAT)) { this.m_sb_ParamString.Length = 0; foreach (NDataReader.Row row in nDataReader.CurrentSection) { if (this.TXTKEY.Equals(row[0])) { string text = row[1]; text = this.__get_text_at_textmanager(kTextManager, text); this.m_sb_ParamString.Append(text); break; } this.m_sb_ParamString.Append(row.ToDataString()); this.m_sb_ParamString.AppendFormat("{0}", this.LINE); } } if (nDataReader.BeginSection(this.SECTION_PARAMS)) { foreach (NDataReader.Row row2 in nDataReader.CurrentSection) { string oldValue = row2[0]; string text2 = row2[1]; if (this.TXTKEY.Equals(text2)) { text2 = row2.GetColumn(2); text2 = this.__get_text_at_textmanager(kTextManager, text2); } this.m_sb_ParamString = this.m_sb_ParamString.Replace(oldValue, text2); } this.m_sb_ParamString = this.m_sb_ParamString.Replace("{\\r\\n}", "\r\n"); } else { this.__output_error(string.Format("{0} 섹션이 없습니다.", this.SECTION_PARAMS)); } } else { this.__output_error("Load Failed!"); } return(this.m_sb_ParamString.ToString()); }
public static NTextManager NTextManager_LoadFromGroupList() { Example.NTextManager_MakeSampleDataFiles(); NTextManager nTextManager = new NTextManager(); bool flag = nTextManager.LoadFromGroupList("D:\\TextGroupList.ndt", false, "[TextFiles]"); if (flag) { Console.WriteLine(nTextManager.ToString()); Console.WriteLine("Item1 => " + nTextManager.GetText("item", "item1", "아이템1")); Console.WriteLine("Item1 => " + nTextManager.GetText("[[item:item1]]")); Console.WriteLine("Quest1 => " + nTextManager["quest"]["quest1"]); Console.WriteLine("Quest2 => " + nTextManager["quest", "quest2"]); } nTextManager.Reload(); return(nTextManager); }
public static void NParamString_Make_and_Parse1() { NParamString nParamString = new NParamString(); nParamString.SetFormat("@title@\r\n@castle@ 에서 @itemname@ 이 @itemnum@ 개 지급되었습니다."); nParamString.AddParam("@title@", "textgroup", "textkey"); nParamString.AddParam("@castle@", "강릉성"); nParamString.AddParam("@itemname@", "쌀"); nParamString.AddParam("@itemnum@", 10); string text = string.Empty; text = nParamString.ToString(); NTextManager nTextManager = new NTextManager(); nTextManager.RegistTextGroup("textgroup", false); nTextManager.SetText("textgroup", "textkey", "아이템지급!"); NParamString nParamString2 = new NParamString(); }
public virtual string GetText(string strTextKey, string srcText) { try { string text = string.Empty; string result; if (this.m_TextTable.TryGetValue(strTextKey, out text)) { if (this.m_owner.CRLFReplaceTime == NTextManager.CRLFReplaceTimeType.GETTING) { text = text.Replace("{\\r\\n}", "\r\n").Replace("{\\t}", "\\t"); } result = text; return(result); } string text2 = strTextKey.Replace("\r", "\\r"); text2 = text2.Replace("\r\n", "◀┘"); text2 = text2.Replace("\n", "\\n"); text2 = text2.Replace("\t", "\\t"); string text3 = this.m_strName; text3 = text3.Replace("\r", "\\r"); text3 = text3.Replace("\r\n", "◀┘"); text3 = text3.Replace("\n", "\\n"); text3 = text3.Replace("\t", "\\t"); if (NTextManager._onOutputline != null) { string msg = string.Format("(notext! TextKey: \"{0}\" - (Group: {1} (texts:{2}))", text2, text3, this.Count); NTextManager._onOutputline(msg); } this._OutputDebugLine(string.Format("(notext! TextKey: \"{0}\" - (Group: {1} ({2}))", text2, text3, srcText)); result = string.Empty; return(result); } catch (Exception output) { this._OutputDebugLine(output); } return("(Exception)"); }
public NTextGroup(NTextManager owner, string groupName, bool useFileNameEncryption) { this.m_owner = owner; this.m_strName = groupName; this.m_UseFileNameEncryption = useFileNameEncryption; }
public NTextGroup(NTextManager owner, string groupName) { this.m_owner = owner; this.m_strName = groupName; }
private void _OutDebugLineGUI(string strout) { NTextManager._OutPutDelegate(strout); }