private void LoadLangs() { var f = new FileStream(NWResourceManager.GetAppPath() + LANGS_XML, FileMode.Open); try { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(f); XmlNode root = xmlDocument.DocumentElement; if (!root.Name.Equals("langs")) { throw new Exception("Its not langs file!"); } XmlNodeList nl = root.SelectNodes("lang"); for (int i = 0; i < nl.Count; i++) { XmlNode el = nl[i]; try { string name = (el.Attributes["name"].InnerText); string prefix = (el.Attributes["prefix"].InnerText); fLangs.Add(new LangRec(name, prefix)); } catch (Exception ex) { Logger.Write("Locale.loadLangs.1(): " + ex.Message); } } } catch (Exception ex) { Logger.Write("Locale.loadLangs(): " + ex.Message); } }
public static void Load() { fInstance = new NWResourceManager(); string appPath = GetAppPath(); string arc = appPath + "Ragnarok.rfa"; if (File.Exists(arc)) { FArchive = new Archive(arc); FArchive.Unpack(); } else { FArchive = null; } }
public bool SetLang(string name) { int idx = FindLang(name); if (idx < 0) { return(false); } else { try { string prefix = LANGS_FOLDER + fLangs[idx].Prefix; string f = NWResourceManager.GetAppPath() + prefix; LoadLangDB(f + "_db.xml"); LoadLangTexts(f + "_texts.xml"); LoadLangDialogs(f); return(true); } catch (Exception) { return(false); } } }
public void SfxPlay(string fileName, int kind, ExtPoint player, ExtPoint sound) { if (GlobalVars.Debug_Silent) { return; } if (!fSndReady) { Logger.Write("SFX kernel not initialized"); return; } if (fSndVolume[kind] != 0) { fileName = NWResourceManager.GetAppPath() + fileName; //fileName = AuxUtils.ConvertPath(fileName); if (!File.Exists(fileName)) { Logger.Write(string.Format("Media file \"{0}\" not exists", new object[] { fileName })); } else { if (fSndCount == MaxSounds) { Logger.Write(string.Format("Limit of {0:D} songs reached", new object[] { MaxSounds })); } else { int aPos = -1; int num = fSndCount; for (int idx = 0; idx < num; idx++) { if (fSndList[idx].Kind == kind) { bool isplaying = false; fSndList[idx].Channel.isPlaying(ref isplaying); if (kind == sk_Song || kind == sk_Ambient || (kind == sk_Sound && !isplaying)) { fSndList[idx].Channel.stop(); fSndList[idx].Channel = null; fSndList[idx].Stream.release(); fSndList[idx].Stream = null; aPos = idx; break; } } } MODE mode = MODE.SOFTWARE | MODE._3D; // | MODE.UNICODE if (kind == sk_Sound) { mode |= MODE.LOOP_OFF; } else if (kind == sk_Song || kind == sk_Ambient) { mode |= MODE.LOOP_NORMAL; } Sound stream = null; RESULT res = fSystem.createStream(fileName, mode, ref stream); if (res != RESULT.OK || stream == null) { Logger.Write(Error.String(res)); } else { if (aPos == -1) { aPos = fSndCount; fSndCount++; } Channel channel = null; res = fSystem.playSound(CHANNELINDEX.FREE, stream, false, ref channel); if (res != RESULT.OK || channel == null) { Logger.Write(Error.String(res)); } else { SoundData soundData = fSndList[aPos]; soundData.Kind = kind; soundData.Stream = stream; soundData.Channel = channel; soundData.Channel.setVolume((float)(fSndVolume[kind] / 255.0f)); soundData.Channel.set3DMinMaxDistance(0, 80); if (kind == sk_Sound) { Set3DProps(soundData.Channel, player, sound); } } } } } } }