Example #1
0
        public bool InitLocateSystem(LOCATE CurrentLocate)
        {
            locate          = CurrentLocate;
            ucsGameStr      = new LocateUCSFile("GameStrings.ucs", locate, LocateFileStorageType.Engine);
            ucsGameUI       = new LocateUCSFile("GameUI.ucs", locate, LocateFileStorageType.Engine);
            ucsGameQuickStr = new LocateUCSFile("GameQuickString.ucs", locate, LocateFileStorageType.Engine);
            isInit          = true;

            ucsGameStr.Prepare();
            ucsGameUI.Prepare();

            DirectoryInfo di = new DirectoryInfo("./locate/");

            FileSystemInfo[] fsi = di.GetFileSystemInfos();
            foreach (var dir in fsi)
            {
                if (File.Exists(string.Format(@"{0}\GameQuickString.ucs", dir.FullName)) &&
                    File.Exists(string.Format(@"{0}\GameStrings.ucs", dir.FullName)) &&
                    File.Exists(string.Format(@"{0}\GameUI.ucs", dir.FullName)))
                {
                    //valid locate directory
                    RegisterLocate(dir.Name);
                }
            }

            if (ucsGameStr.Process() && ucsGameUI.Process() && ucsGameQuickStr.Process())
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        public int CovertLocateInfoToIndex(LOCATE locate)
        {
            switch (locate)
            {
            case LOCATE.en:
                return(0);

            case LOCATE.cns:
                return(1);

            case LOCATE.cnt:
                return(2);

            case LOCATE.de:
                return(3);

            case LOCATE.fr:
                return(4);

            case LOCATE.ja:
                return(5);

            default:
                return(0);
            }
        }
Example #3
0
        public bool InitLocateSystem(LOCATE CurrentLocate)
        {
            locate          = CurrentLocate;
            ucsGameStr      = new LocateUCSFile("GameStrings.ucs", locate, LocateFileStorageType.Engine);
            ucsGameUI       = new LocateUCSFile("GameUI.ucs", locate, LocateFileStorageType.Engine);
            ucsGameQuickStr = new LocateUCSFile("GameQuickString.ucs", locate, LocateFileStorageType.Engine);
            isInit          = true;

            ucsGameStr.Prepare();
            ucsGameUI.Prepare();

            currentLanguage = supprotedLanguages.Where(o => o.ID == CurrentLocate.ToString()).FirstOrDefault();
            if (currentLanguage == null)
            {
                GameManager.Instance.log.LogMessage(
                    string.Format(
                        "The specific locate `{0}` isn't supported!",
                        CurrentLocate.ToString()),
                    LogMessage.LogType.Warning
                    );
            }

            DirectoryInfo di = new DirectoryInfo("./locate/");

            FileSystemInfo[] fsi = di.GetFileSystemInfos();
            foreach (var dir in fsi)
            {
                if (File.Exists(string.Format(@"{0}\GameQuickString.ucs", dir.FullName)) &&
                    File.Exists(string.Format(@"{0}\GameStrings.ucs", dir.FullName)) &&
                    File.Exists(string.Format(@"{0}\GameUI.ucs", dir.FullName)))
                {
                    //valid locate directory
                    RegisterLocate(dir.Name);
                }
            }

            if (ucsGameUI.Process() &&
                ucsGameStr.Process() &&
                ucsGameQuickStr.Process())
            {
                if (!modUCSFiles.ContainsKey("common"))
                {
                    modUCSFiles.Add("common", new List <LocateUCSFile>());
                }
                modUCSFiles["common"].Add(ucsGameUI);
                modUCSFiles["common"].Add(ucsGameStr);
                modUCSFiles["common"].Add(ucsGameQuickStr);

                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #4
0
 public LocateUCSFile(string fullPath, LOCATE currentLocate, LocateFileStorageType storageType)
 {
     this.storageType   = storageType;
     this.fullPath      = fullPath;
     this.currentLocate = currentLocate;
     ucsKeyValue        = new Dictionary <string, string>();
     if (storageType == LocateFileStorageType.Engine)
     {
         this.fullPath = string.Format("{0}{1}/{2}", PATH, currentLocate.ToString(), this.fullPath);
     }
 }
Example #5
0
        public LOCATE GetLanguageFromFile()
        {
            string locate;

            if (!File.Exists(path))
            {
                File.CreateText(path);
            }
            FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

            using (StreamReader sr = new StreamReader(fs))
            {
                locate = sr.ReadLine();
                sr.Close();
            }
            return(ConvertLocateShortStringToLocateInfo(locate));
        }
 private void LoadGameConfigure()
 {
     selectedlocate = LocateSystem.Instance.ConvertReadableStringToLocate(gameXmlConfig.LocateConfig.CurrentLocate);
     GameConfig.CurrentSelectedLocate = LocateSystem.Instance.ConvertLocateShortStringToReadableString(selectedlocate.ToString());
     GameConfig.IsEnableEditMode      = gameXmlConfig.CoreConfig.IsEnableEditMode;
 }
 private void LoadGameConfigure()
 {
     selectedlocate = LocateSystem.Singleton.ConvertLocateShortStringToLocateInfo(gameCfg["Localized"]["CurrentLocate"]);
     GameConfig.CurrentSelectedLocate = LocateSystem.Singleton.ConvertLocateShortStringToReadableString(selectedlocate.ToString());
     GameConfig.IsEnableEditMode      = gameCfg["Game"]["EditMode"] == "1" ? true : false;
 }
Example #8
0
 public LocateUCSFile(string fileName, LOCATE currentLocate)
 {
     this.fileName      = fileName;
     this.currentLocate = currentLocate;
     UCSValueTmp        = new Dictionary <string, string>();
 }