public static void Load(Stream stream) { if (stream == null) { return; } CSVData data = CSVLoader.Load(stream); for (int i = 0; i < data.RowCount; ++i) { var row = data.GetRow(i); var id = row.GetInt(_ID); var background = row.GetString(_BackgroundURL); var des = row.GetString(_Des); var Jumpto = row.GetString(_Jumpto); var Priority = row.GetInt(_Priority); var EventIntervalEnd = row.GetString(_EventIntervalEnd); var EventIntervalStart = row.GetString(_EventIntervalStart); var placementKey = row.GetString(_PlacemetKey); var element = new PopElements(id, background, Priority, des, Jumpto, placementKey, EventIntervalStart, EventIntervalEnd); m_elements.Add(element); } }
private bool LoadAccessoryFromLocalFileSystem() { string text = Path.Combine(Application.dataPath, "Resources"); if (!Directory.Exists(text)) { Debug.LogError("ERROR, Fail to find directory for Resources"); return(false); } string text2 = Path.Combine(text, "Template/accessory.txt"); CSVLoader cSVLoader = new CSVLoader(); if (Application.platform == RuntimePlatform.WindowsEditor || !cSVLoader.SecuredLoad(text2)) { if (!cSVLoader.Load(text2)) { Debug.LogError("ERROR, Fail to load resource file" + text2); return(false); } if (!cSVLoader.SecuredSave(text2)) { Debug.LogError("ERROR, Load success " + text2 + " but save secured failed"); } } ParseAccessory(cSVLoader); return(true); }
private static Dictionary <string, AnimationClip> loadAnimClips(string name, ref string defaultAnimName) { var path = "Assets/Config/Animation/" + name + ".csv"; var loader = new CSVLoader(); var text = readAllText(path); if (!loader.Load(text)) { EditorUtility.DisplayDialog("错误", "加载动画表失败: " + path, "继续工作"); return(null); } var nameCol = loader.GetColumn("Name"); var fbxCol = loader.GetColumn("FBXPath"); var defaultCol = loader.GetColumn("IsDefault"); Dictionary <string, AnimationClip> clips = new Dictionary <string, AnimationClip>(); Dictionary <string, List <string> > infos = new Dictionary <string, List <string> >(); for (int row = 0; row < loader.RowCount(); row++) { var fbxPath = fbxCol.GetString(row); var aniClipName = nameCol.GetString(row); List <string> subAnimNames = null; if (!infos.TryGetValue(fbxPath, out subAnimNames)) { subAnimNames = new List <string>(); infos.Add(fbxPath, subAnimNames); } if (defaultAnimName == null || defaultCol.GetBoolean(row)) { defaultAnimName = aniClipName; } subAnimNames.Add(aniClipName); } foreach (var p in infos) { var animRootPath = AnimPath + "/" + p.Key; foreach (var pp in p.Value) { var animPath = animRootPath + "/" + pp + ".anim"; var clip = AssetDatabase.LoadAssetAtPath <AnimationClip>(animPath); if (clip == null) { EditorUtility.DisplayDialog("错误", "加载动画切片失败: " + animPath, "继续工作"); return(null); } clips.Add(pp, clip); } } return(clips); }
public void LoadInventoryFromDisk(string path = "Config\\Inventory.csv") { equipment.Clear(); csv = new CSVLoader(); csv.Load(path); if (csv._rows.Count >= maxItems) csv._rows.RemoveRange(maxItems, csv._rows.Count - maxItems); LoadInventoryFromMemory(); }
public void LoadConfigFromDisk(string path = "Config\\Config.csv") { csv = new CSVLoader(); csv.Load(path); ClientExtension.instance.hostIP = csv._rows[0][1]; ServerEmulator.instance.debugHandle = Convert.ToBoolean(csv._rows[1][1]); ServerEmulator.instance.debugSend = Convert.ToBoolean(csv._rows[2][1]); ServerEmulator.instance.debugPing = Convert.ToBoolean(csv._rows[3][1]); crosshairColor.r = Convert.ToSingle(csv._rows[4][1]); crosshairColor.g = Convert.ToSingle(csv._rows[5][1]); crosshairColor.b = Convert.ToSingle(csv._rows[6][1]); }
public static void Load(Stream stream) { if (stream == null) { return; } CSVData data = CSVLoader.Load(stream); for (int i = 0; i < data.RowCount; ++i) { var row = data.GetRow(i); m_elements.Add(row); } }
private void Start() { Reset(); languages = new LangOptManager.LANG_OPT[BuildOption.Instance.Props.supportLanguages.Length]; langTex = new Texture2D[BuildOption.Instance.Props.supportLanguages.Length]; for (int i = 0; i < languages.Length; i++) { languages[i] = BuildOption.Instance.Props.supportLanguages[i]; langTex[i] = LangOptManager.Instance.languages[(int)languages[i]]; } BuffManager.Instance.ExportBuffs(); TItemManager.Instance.ExportItems(); BrickManager.Instance.ExportBricks(); CSVLoader csv = new CSVLoader(); IPs = new List <HostIP>(); if (csv.Load("Config\\ServerIPS.csv")) { List <string> _added = new List <string>(); for (int row = 0; row < csv.Rows; row++) { if (!csv.ReadValue(0, row, "", out string ip)) { continue; } if (!csv.ReadValue(1, row, "", out string text)) { continue; } if (!_added.Contains(ip)) { IPs.Add(new HostIP(ip, text)); _added.Add(ip); } } IPs.Add(new HostIP(string.Empty, "Custom")); } else { // Create file and write default localhost shit to it File.AppendAllText("Config\\ServerIPS.csv", "IP\tString\n"); File.AppendAllText("Config\\ServerIPS.csv", "127.0.0.1\tLocalhost"); IPs.Add(new HostIP("127.0.0.1", "Localhost")); IPs.Add(new HostIP(string.Empty, "Custom")); } }
public static void Load(Stream stream) { if (stream == null) { return; } CSVData data = CSVLoader.Load(stream); for (int i = 0; i < data.RowCount; ++i) { var row = data.GetRow(i); var id = row.GetInt(_ID); var pic = row.GetString(_Pic); var cost = row.GetInt(_Cost); var tmprow = new shopElements(id, pic, cost); m_elements.Add(tmprow); } }
public static void Load(Stream stream) { if (stream == null) { return; } CSVData data = CSVLoader.Load(stream); for (int i = 0; i < data.RowCount; ++i) { var row = data.GetRow(i); var id = row.GetInt(_ID); var roleid = row.GetInt(_roleID); var lvMin = row.GetInt(_lvMin); var lvMax = row.GetInt(_lvMax); var tmprow = new levMonster(id, roleid, lvMin, lvMax); m_elements.Add(tmprow); } }
public void Load(Stream stream) { if (stream == null) { return; } CSVData data = CSVLoader.Load(stream); bool isPass = data.isAllColumnNameExists(m_colomuns); //检查所有列名是否都存在 for (int i = 0; i < data.RowCount; ++i) { var row = data.GetRow(i); int tmpID = row.GetInt(csID); if (tmpID > maxID) { maxID = tmpID; } m_elements.Add(row); } }
public static void Load(Stream stream) { if (stream == null) { return; } CSVData data = CSVLoader.Load(stream); for (int i = 0; i < data.RowCount; ++i) { var row = data.GetRow(i); var id = row.GetInt(_ID); var roleid = row.GetInt(_roleID); var atk = row.GetInt(_Atk); var def = row.GetInt(_Def); var hp = row.GetInt(_MaxHp); var ele = row.GetInt(_Ele); var tmprow = new rolePro(id, roleid, atk, def, hp, ele); m_elements.Add(tmprow); } }
private static void CreateActorPrefab() { var selected = Selection.activeObject; if (selected == null) { EditorUtility.DisplayDialog("错误", "请选中对应预制件配置表", "继续工作"); return; } var path = AssetDatabase.GetAssetPath(selected); //Assets/Config/Animation/mengjiang.csv if (!path.StartsWith("Assets/Config/Prefab") || !path.EndsWith(".csv")) { EditorUtility.DisplayDialog("错误", "请选中对应预制件配置表", "继续工作"); return; } var loader = new CSVLoader(); var text = readAllText(path); if (!loader.Load(text)) { EditorUtility.DisplayDialog("错误", "加载预制件配置失败: " + path, "继续工作"); return; } var nameCol = loader.GetColumn("Name"); var animCol = loader.GetColumn("Animation"); var matCol = loader.GetColumn("Material"); var meshCol = loader.GetColumn("Mesh"); Dictionary <string, Dictionary <string, AnimationClip> > allClips = new Dictionary <string, Dictionary <string, AnimationClip> >(); Dictionary <string, string> defaultClipNames = new Dictionary <string, string>(); for (int row = 0; row < loader.RowCount(); row++) { string animName = animCol.GetString(row); string defaultName = null; Dictionary <string, AnimationClip> clips = null; if (!allClips.TryGetValue(animName, out clips)) { clips = loadAnimClips(animName, ref defaultName); if (clips != null) { defaultClipNames.Add(animName, defaultName); allClips.Add(animName, clips); } else { EditorUtility.DisplayDialog("错误", "无法加载对应的动画切片: " + animName, "继续工作"); } } else { defaultClipNames.TryGetValue(animName, out defaultName); } _doCreateActorPrefab( nameCol.GetString(row), clips, defaultName, meshCol.GetString(row), matCol.GetString(row) ); } EditorUtility.DisplayDialog("创建主角预制件", "完成", "继续工作"); }
public override bool ProcessRetrievedFTPFile(SymmetryEntities dc_, string marketSnapCode_, DateTime valueDate_, string filePath_) { var loader = new CSVLoader<ExtractClass>(new Dictionary<string, string> { {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.RIC).FieldName, "RIC"}, {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.BidPrice).FieldName, "BidPrice"}, {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.AskPrice).FieldName, "AskPrice"}, {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.BidAskUpdateTime).FieldName,"BidAskDate"}, }); var list = loader.Load(filePath_); return saveResponses(list, dc_, QuoteHelpers.GetOrCreateMarketSnap(marketSnapCode_, valueDate_, dc_)); }
public override bool ProcessRetrievedFTPFile(SymmetryEntities dc_, string marketSnapCode_, DateTime valueDate_, string filePath_) { var loader = new CSVLoader<ExtractClass>(new Dictionary<string, string> { {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.RIC).FieldName, "RIC"}, {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.UniversalClosePrice).FieldName, "Value"}, {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.UniversalClosePriceDate).FieldName, "CloseDate"}, }); var extracted = loader.Load(filePath_); return saveValues(extracted, dc_, marketSnapCode_); }
private static void CreatePlotPrefab() { var loader = new CSVLoader(); var text = readAllText("Assets/Config/Prefab/juqing.csv"); if (!loader.Load(text)) { EditorUtility.DisplayDialog("错误", "加载预制件配置失败:Assets/Config/Prefab/juqing.csv ", "继续工作"); return; } if (plotData == null) { plotData = new Dictionary <string, Dictionary <string, string> >(); LoadPlotData(loader); } var selected = Selection.activeObject; if (selected == null) { EditorUtility.DisplayDialog("错误", "请选中对应预制件配置表", "继续工作"); return; } string path; path = AssetDatabase.GetAssetPath(selected); if (!path.EndsWith(".FBX")) { EditorUtility.DisplayDialog("拆分动画", "选中对象并非FBX", "继续工作"); return; } if (!path.Contains("PlotAnim")) { EditorUtility.DisplayDialog("拆分动画", "非剧情目录", "继续工作"); return; } string prefabPath = path.Replace("Art", "Prefabs").Replace(".FBX", ".prefab"); _doSplitSelectedAnim(path, prefabPath); var prefab = AssetDatabase.LoadAssetAtPath <GameObject>(prefabPath); string fileName = System.IO.Path.GetFileName(path); Dictionary <string, string> processMat; if (plotData.TryGetValue(fileName, out processMat)) { var dicIter = processMat.GetEnumerator(); while (dicIter.MoveNext()) { var objTf = prefab.transform.Find(dicIter.Current.Key); if (objTf != null) { var mat = AssetDatabase.LoadAssetAtPath <Material>(dicIter.Current.Value); if (mat != null) { var mesh = objTf.GetComponent <SkinnedMeshRenderer>(); if (mesh) { mesh.materials[0] = mat; } } } } } PrefabUtility.CreatePrefab(prefabPath, prefab); GameObject.DestroyImmediate(prefab, true); EditorUtility.DisplayDialog("创建剧情动画预制件", "完成", "继续工作"); }
public override bool ProcessRetrievedFTPFile(SymmetryEntities dc_, string marketSnapCode_, DateTime valueDate_, string filePath_) { var loader = new CSVLoader<ExtractClass>(new Dictionary<string, string> { {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.RIC).FieldName, "RIC"}, {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.OriginalIdentifier).FieldName, "Identifier"}, {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.BidPrice).FieldName, "BidPrice"}, {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.AskPrice).FieldName, "AskPrice"}, {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.BidYield).FieldName, "BidYield"}, {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.AskYield).FieldName, "AskYield"}, {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.AssetStatus).FieldName, "AssetStatus"}, {AttributeHelper.GetSingleAttribute<RSSFieldAttribute>(FieldsToReturn.Isin).FieldName, "ISIN"}, }); var list = loader.Load(filePath_); if (IdentifierFilter != null) list = list.Where(x => IdentifierFilter(x.ISIN)).ToList(); return saveResponses(list, dc_, QuoteHelpers.GetOrCreateMarketSnap(marketSnapCode_, valueDate_, dc_)); }
private static void SplitSelectedActorAnim() { var selected = Selection.activeObject; if (selected == null) { EditorUtility.DisplayDialog("错误", "请选中对应动画配置表", "继续工作"); return; } var path = AssetDatabase.GetAssetPath(selected); //Assets/Config/Animation/mengjiang.csv if (!path.StartsWith("Assets/Config/Animation") || !path.EndsWith(".csv")) { EditorUtility.DisplayDialog("错误", "请选中对应动画配置表", "继续工作"); return; } string animationName = Path.GetFileNameWithoutExtension(path); var loader = new CSVLoader(); var text = readAllText(path); if (!loader.Load(text)) { EditorUtility.DisplayDialog("错误", "加载动画表失败: " + path, "继续工作"); } var nameCol = loader.GetColumn("Name"); var fbxCol = loader.GetColumn("FBXPath"); var compCol = loader.GetColumn("Compression"); var defaultCol = loader.GetColumn("IsDefault"); string defaultAnimName = null; List <string> anims = new List <string>(); Dictionary <string, List <AnimSplit> > infos = new Dictionary <string, List <AnimSplit> >(); for (int row = 0; row < loader.RowCount(); row++) { var animInfo = new AnimSplit(); animInfo.Name = nameCol.GetString(row); animInfo.FBXPath = fbxCol.GetString(row); animInfo.Compression = compCol.GetInteger32(row); List <AnimSplit> subAnimInfos = null; if (!infos.TryGetValue(animInfo.FBXPath, out subAnimInfos)) { subAnimInfos = new List <AnimSplit>(); infos.Add(animInfo.FBXPath, subAnimInfos); } if (defaultAnimName == null || defaultCol.GetBoolean(row)) { defaultAnimName = animInfo.Name; } subAnimInfos.Add(animInfo); anims.Add(animInfo.Name); } bool result = true; foreach (var p in infos) { if (!_doSplitSelectedActorAnim(animationName, p.Key, p.Value)) { result = false; } } if (result && defaultAnimName != null) { EditorUtility.DisplayDialog("拆分主角动画", "已完成", "继续工作"); } else { EditorUtility.DisplayDialog("错误", "切分失败", "继续工作"); } return; }