public bool HasLocale(LocaleCode code) { for (int i = 0; i < availableLocale.Length; i++) { if (availableLocale[i] == code) { return(true); } } return(false); }
public void OnLocaleUpdate(LocaleCode _code) { LocaleTextProperty property = content.GetContent(_code); if (property != null) { text.font = property.font; text.fontSize = property.size; text.lineSpacing = property.lineSpacing; } }
public LocaleUILabelProperty GetContent(LocaleCode _code) { if (properties == null || properties.Length == 0) { return(null); } for (int i = 0; i < properties.Length; i++) { if (properties[i].code == _code) { return(properties[i]); } } return(null); }
public XElement Serialize() { return(new XElement(UblNames.Cac + nameof(DocumentReference), ID.Serialize(nameof(ID)), CopyIndicator.Serialize(nameof(CopyIndicator)), UUID.Serialize(nameof(UUID)), IssueDate.Serialize(nameof(IssueDate)), IssueTime.Serialize(nameof(IssueTime)), DocumentTypeCode.Serialize(nameof(DocumentTypeCode)), DocumentType.Serialize(nameof(DocumentType)), XPath.Serialize(nameof(XPath)), LanguageID.Serialize(nameof(LanguageID)), LocaleCode.Serialize(nameof(LocaleCode)), VersionID.Serialize(nameof(VersionID)), DocumentStatusCode.Serialize(nameof(DocumentStatusCode)), DocumentDescription.Serialize(nameof(DocumentDescription)), Attachment?.Serialize(), ValidityPeriod?.Serialize(nameof(ValidityPeriod)), IssuerParty?.Serialize(nameof(IssuerParty)) )); }
public void OnLocaleUpdate(LocaleCode _code) { LocaleUILabelProperty property = content.GetContent(_code); if (property != null) { text.trueTypeFont = property.trueTypeFont; text.bitmapFont = property.nguiFont; text.fontSize = property.size; text.useFloatSpacing = property.useFloatSpacing; if (text.useFloatSpacing) { text.floatSpacingX = property.floatSpacing.x; text.floatSpacingY = property.floatSpacing.y; } else { text.spacingX = 0; text.spacingX = 0; } } }
public static void LoadLocale(LocaleCode code) { if (currentLocale == code) { return; } if (settings.HasLocale(code)) { currentLocale = code; PlayerPrefs.SetString(prefsLocaleLanguage, currentLocale.ToString()); StringBuilder s = new StringBuilder(); s.Append(defaultResourcePath); s.Append('/'); s.Append(currentLocale.ToString()); LocaleData[] _list = Resources.LoadAll <LocaleData>(s.ToString()); foreach (KeyValuePair <string, LocaleData> r in preloadLocaleData) { Resources.UnloadAsset(r.Value); } preloadLocaleData.Clear(); foreach (LocaleData data in _list) { if (preloadLocaleData.ContainsKey(data.name)) { preloadLocaleData[data.name] = data; Debug.LogWarning("Found a duplicate locale data \'" + data.name + "\'. Please check from project resources folder and delete an duplicated locale data."); } else { preloadLocaleData.Add(data.name, data); } } UpdateLocaleComponent(); } else { Debug.LogWarning("Locale settings doesn't support for locale \'" + code.ToString() + "\'. Nothing changed."); } }
internal void Login(UserType typeCode, string UserID, string pwd, LocaleCode localeCode) { LoginPacket packet = new LoginPacket(); packet.m_typeCode = (byte)typeCode; packet.m_userID = UserID; packet.m_userPwd = pwd; packet.m_localeCode = (byte)localeCode; packet.m_isAlreadyLogined = 0; lock (m_lockSocket) { if (m_retryLoginPacket != null) m_retryLoginPacket.Dispose(); m_serverId = 0; m_retryLoginPacket = (LoginPacket)packet.Clone(); } m_isLoginPacketSync = false; PushPacketInQueue(packet); }
public static void BatchExport() { LocaleSettings _settings = GetLocaleSettings(); if (_settings == null) { EditorUtility.DisplayDialog("Error", "Cannot perform this action because the editor cannot find any \'LocalizationSettings\' in resource path.", "Okay"); Debug.LogError("Cannot find LocalizationSettings.asset"); return; } if (sourceCSV == null) { EditorUtility.DisplayDialog("Error", "Cannot perform this action because CSV source are null.", "Okay"); Debug.LogError("Source are null."); return; } if (string.IsNullOrEmpty(exportPath)) { string exportPath = EditorUtility.OpenFolderPanel("Select localization for export XML file.", Application.dataPath, ""); if (string.IsNullOrEmpty(exportPath)) { exportPath = ""; return; } else { EditorPrefs.SetString("LocaleExportPath", exportPath); } } TextAsset textAssetCSV = sourceCSV as TextAsset; string fileName = textAssetCSV.name; string[][] table = CSVTextAsset(textAssetCSV); if (table == null) { return; } List <LocaleSheetData> sheets = new List <LocaleSheetData>(); for (int c = 1; c < table[0].Length; c++) { LocaleSheetData sheet = new LocaleSheetData(); sheet.LocaleName = table[0][c]; sheet.List = new LocaleKey[table.Length - 1]; for (int r = 1; r < table.GetLength(0); r++) { sheet.List[r - 1] = new LocaleKey(table[r][0], table[r][c]); } sheets.Add(sheet); } List <LocaleCode> availableLocale; if (_settings.availableLocale != null) { availableLocale = new List <LocaleCode>(_settings.availableLocale); } else { availableLocale = new List <LocaleCode>(); } foreach (LocaleSheetData sheet in sheets) { try { LocaleCode code = LocaleCode.Null; LocaleData localeData = null; code = (LocaleCode)System.Enum.Parse(typeof(LocaleCode), sheet.LocaleName); #if LOCALE_DATATH if (code == LocaleCode.TH) { localeData = CreateAsset <LocaleDataTH>(exportPath + "/" + sheet.LocaleName, fileName); } else { localeData = CreateAsset <LocaleData>(exportPath + "/" + sheet.LocaleName, fileName); } #else localeData = CreateAsset <LocaleData>(exportPath + "/" + sheet.LocaleName, fileName); #endif localeData.list = sheet.List; if (code != LocaleCode.Null && !availableLocale.Contains(code)) { availableLocale.Add(code); } EditorUtility.SetDirty(localeData); } catch { EditorUtility.DisplayDialog("Error", "Cannot parse \'" + sheet.LocaleName + "\' into \'LocaleCode\' enum. Please check your LocaleCode in CSV.", "Okay"); } } _settings.availableLocale = availableLocale.ToArray(); if (isPreload) { List <string> sheetTitle; if (_settings.availableLocale != null) { sheetTitle = new List <string>(_settings.sheetTitles); } else { sheetTitle = new List <string>(); } if (!sheetTitle.Contains(fileName)) { sheetTitle.Add(fileName); } _settings.sheetTitles = sheetTitle.ToArray(); EditorUtility.SetDirty(_settings); } AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }
/// <summary> /// 클래스를 초기화한다. 실제 서버와 연결을 시도하는 것은 아니고, 연결 정보를 저장하고 초기화한다.<br/> /// keepAliveTimeout의 값이 0이면 KeepAlive 패킷을 전송하지 않는다.<br/> /// <br/> /// ProxyServer 클래스의 정적인 데이터는 외부에 따로 저장할 수가 있는데, /// 클라이언트는 ProxyServer.Uninitialize() 메소드 호출을 통해서 얻은 정적인 데이터를 ProxyServer.Initialize() 호출시에 다시 설정할 수 있다. /// </summary> /// <param name="serverIp">Server IP</param> /// <param name="serverPort">Server Port</param> /// <param name="methodTimeout">Method의 타임아웃. milliseconds</param> /// <param name="keepAliveTimeout">KeepAlive 패킷 전송 간격. milliseconds</param> /// <param name="isTestVer">클라이언트의 테스트 버전 여부.</param> /// <param name="isPaidVer">클라이언트의 유료 버전 여부.</param> /// <param name="marketCode">클라이언트의 마켓 코드.</param> /// <param name="localeCode">클라이언트의 로케일 코드.</param> /// <param name="configData">단말기에 저장되어 있는 캐싱 데이터 스트림. 데이터가 없으면 null을 세팅한다.</param> /// <returns>0이면 성공, 이외의 값은 에러</returns> public uint Initialize(string serverIp, int serverPort, int methodTimeout, int keepAliveTimeout, bool isTestVer, bool isPaidVer, MarketCode marketCode, LocaleCode localeCode, byte[] configData) { ErrCode errCode = ErrCode.Success; if (!m_isInitialized) { byte[] temp = null; Uninitialize(out temp); m_socketTimeout = methodTimeout; m_keepAliveTimeout = keepAliveTimeout; m_clientProductVer = (byte)((isTestVer ? 0x80 : 0x00) + (isPaidVer ? 0x40: 0x00) + (byte)marketCode); m_localeCode = localeCode; m_stageManager = new StageManager(); m_stageManager.SetServer(this); m_itemManager = new ItemManager(); m_itemManager.SetServer(this); if (configData != null) { try { NMCryptor.DecryptBuffer(configData, SentinelValues.DATA_ENCRYPT_SEED); SimpleStream stream = new SimpleStream(); stream.SetBuffer(configData, false); DeSerialize(stream); } catch (Exception e) { Log(string.Format("[PSVR] Initialize() : {0}", e.Message)); } } if (serverIp != m_serverIp || serverPort != m_serverPort) { m_lastConnectedServerIp = m_serverIp = serverIp; m_lastConnectedServerPort = m_serverPort = serverPort; } if (m_lastConnectedServerIp == null || m_lastConnectedServerIp.Length < 1) { m_lastConnectedServerIp = m_serverIp; m_lastConnectedServerPort = m_serverPort; } m_serverVal = new ValServer(); m_serverVal.NotifyHandler = OnNotifyHandler; m_serverVal.LogHandler = sm_logHandler; m_serverVal.Initialize(this); m_isInitialized = true; } return (uint)errCode; }