//就寝日を文字列で返す。ここでどのようなスタイルで表示するか決定する String GetSleepDateForText(DateTime startTime, DateTime endTime, int dateIndex, int crossSunCount, int sameDateNum, int crossSunNum) { //就寝時 string start_year = startTime.Year.ToString(); string start_month = startTime.Month.ToString("00"); string start_day = startTime.Day.ToString("00"); string start_dayOfWeek = startTime.ToString("ddd", new System.Globalization.CultureInfo("ja-JP")); //曜日 //起床時 string end_year = endTime.Year.ToString(); string end_month = endTime.Month.ToString("00"); string end_day = endTime.Day.ToString("00"); string end_dayOfWeek = endTime.ToString("ddd", new System.Globalization.CultureInfo("ja-JP")); //曜日 if (CSVManager.isCrossTheSun(startTime, endTime)) { //就寝時と起床時の日付が異なっていたら「就寝日~起床日」を返す bool isNecessaryIndex = crossSunNum > 1; int indexCount = crossSunCount; return(start_year + "/" + start_month + "/" + start_day + "(" + start_dayOfWeek + ")" + "\n" + "▼" + "\n" + end_year + "/" + end_month + "/" + end_day + "(" + end_dayOfWeek + ")" + (isNecessaryIndex ? " (" + indexCount.ToString() + ")" : "")); } else { //就寝時と起床時の日付が同じであれば「就寝日」を返す bool isNecessaryIndex = (sameDateNum - crossSunNum) > 1; int indexCount = dateIndex + 1; return(start_year + "/" + start_month + "/" + start_day + "(" + start_dayOfWeek + ")" + (isNecessaryIndex ? " (" + indexCount.ToString() + ")" : "")); } }
private void timer1_Tick(object sender, EventArgs e) { DateTime nowTime = DateTime.Now; cr = CSVManager.GetActiveJobs(); if (cr.Count == 0) { return; } runTime = new DateTime(nowTime.Year, nowTime.Month, nowTime.Day, cr[0].hours, cr[0].minutes, 0); if (DateTime.Now.Hour == runTime.Hour && DateTime.Now.Minute == runTime.Minute) { RegistrationManager RegMan = new RegistrationManager(api.getClubOpenRegistrations(cr[0].matchID.ToString()), CommonFunctions, cr[0].matchID.ToString()); RegMan.PrepareData(); CSVManager.UpdateOrInsertCSV(cr[0].matchID.ToString()); // start on different thread Task mytask = Task.Run(() => { StatusPoruka.Text = RegMan.ExportToExcel(); }); ShowDgvData(); } }
public virtual void Reset(int BuffID, Entity owner, Entity caster) { buffInfo = CSVManager.GetBuffCfg(BuffID); this.buffOwner = owner; this.buffCaster = caster; leftTime = 0; }
/// <summary> /// Add the chlid tile to a list and check if its positiion is lower in all directions than the current lowest. /// This is to find out where the min position is. /// </summary> public void Init() { csvManager = FindObjectOfType <CSVManager>(); if (!csvManager) { Debug.Log("ERROR: CSVManager object is not active in Scene"); return; } if (!level) { Debug.Log("ERROR: Level object has not been set."); return; } int idx = 0; foreach (var renderer in level.GetComponentsInChildren <Renderer>()) { var child = renderer.gameObject; tiles.Add(child); if (child.transform.position.x < startPosition.x && child.transform.position.y < startPosition.y && child.transform.position.z < startPosition.z) { startPosition = child.transform.position; startIdx = idx; } idx++; } }
private void SetOneBlock() { //혹시모르니 세팅시작할때 한번 비워주고 새로 nearRandomValue.Clear(); farRandomValue.Clear(); rotationRandomValue.Clear(); instructionPanel.SetActive(false); for (int i = 0; i < expRandomValue.NearPositionOffsetValues.Count; i++) { //랜덤한 index를 pop하는 식으로 랜덤값을 쓸거기때문에 한블럭을 시작할때마다 새로 복사해서 시작해야함, 원본을 지워버리면 이후에 못하기때문 nearRandomValue.Add(expRandomValue.NearPositionOffsetValues[i]); farRandomValue.Add(expRandomValue.FarPositionOffsetValues[i]); rotationRandomValue.Add(expRandomValue.RotationOffsetValues[i]); } //한블럭 시작 초기화 curExpCase = curExpFlow[ExperimentState.curBlockNum - 1]; ExperimentState.curBlockDistance = curExpCase.distance; ExperimentState.curBlockTechnique = curExpCase.technique; CSVManager.AppendToReport(CSVManager.GetReportLine("Block Start")); practiceCounter = 0; isPractice = true; SetOnePractice(); }
public void initInfoForChartEverage() { string[] unreadFileList = CSVManager.getUnreadCsvFileList(this.fileList, this.chartPref.savedLastFileName); foreach (var filePath in unreadFileList) { List <SleepData> sleepData = CSVManager.readSleepDataFromCsvFile(filePath); ChartInfo chartInfo = CSVManager.convertSleepDataToChartInfo(sleepData); if (chartInfo != null) { CSVManager.convertSleepHeaderToChartInfo(chartInfo, filePath); if (chartInfo.sleepMode == (int)SleepMode.Monitor) { this.chartsOfMonitor.Add(chartInfo); } else { this.chartsOfSuppress.Add(chartInfo); } } } this.showChartEverage(chartsOfMonitor, SleepMode.Monitor); this.showChartEverage(chartsOfSuppress, SleepMode.Suppress); int fileNum = unreadFileList.Length; if (fileNum > 0) { this.chartPref.saveLastFileName(Kaimin.Common.Utility.TransFilePathToDate(unreadFileList[fileNum - 1]).ToString()); } }
// Start is called before the first frame update void Start() { csvManager = CSVManager.instance; List <BlockPiece> blockPieces = csvManager.blockPieces; for (int i = 0; i < blockPieces.Count; i++) { if (blockPieces[i].blockName.Contains("아이스크림")) { blockPieces[i].transform.SetParent(contents[0]); } else if (blockPieces[i].blockName.Contains("파르페")) { blockPieces[i].transform.SetParent(contents[1]); } else if (blockPieces[i].blockName.Contains("크래커")) { blockPieces[i].transform.SetParent(contents[2]); } else if (blockPieces[i].blockName.Contains("솜사탕")) { blockPieces[i].transform.SetParent(contents[3]); } blockPieces[i].transform.localPosition = default; blockPieces[i].transform.localScale = new Vector3(1, 1, 1); } }
//リストビューの内容をcurrentDispDateの内容で更新する void UpdateListView() { //リストビューの初期化 Adapter.ClearAllElement(); //表示できるデータが一件もなければ if (currentDispDate == DateTime.MinValue) { YearText.text = "-"; MonthText.text = "-"; } //表示できるデータがあれば else { //一か月分のデータを表示する SetDataToList(new DateTime(currentDispDate.Year, currentDispDate.Month, 1, 0, 0, 0), new DateTime(currentDispDate.Year, currentDispDate.Month, DateTime.DaysInMonth(currentDispDate.Year, currentDispDate.Month), 23, 59, 59)); //画面の日付表示も更新 if (CSVManager.isInvalidDate(currentDispDate)) { YearText.text = "-"; MonthText.text = "-"; } else { YearText.text = currentDispDate.Year.ToString(); MonthText.text = currentDispDate.Month.ToString() + "月"; } //表示した日付を記録 UserDataManager.Scene.SaveHistoryDate(currentDispDate); } }
private void ReportPointerDown() { // 스마트폰에 가림막을 누르는 터치에대해서는 파일에 기록하지않기위해 if 문을 추가했음 if (ExperimentState.curTrialPhase != TrialPhase.Null && guideChair.activeSelf) { CSVManager.AppendToReport(CSVManager.GetReportLine("press")); } }
public void showChartWeekByPage(int page) { this.chartsOfWeek = new List <ChartInfo>(); BarChart[] barChartWeeks = { barChartWeek1, barChartWeek2, barChartWeek3, barChartWeek4, barChartWeek5, barChartWeek6, barChartWeek7 }; BarPercentWeek[] barPercentWeeks = { barPercentWeek1, barPercentWeek2, barPercentWeek3, barPercentWeek4, barPercentWeek5, barPercentWeek6, barPercentWeek7 }; if (page > 0) { string[] pageFileList = CSVManager.getCsvFileListByPage(this.fileList, page); foreach (var filePath in pageFileList) { List <SleepData> sleepData = CSVManager.readSleepDataFromCsvFile(filePath); ChartInfo chartInfo = CSVManager.convertSleepDataToChartInfo(sleepData); if (chartInfo != null) { chartInfo.endSleepTime = sleepData.Select(data => data.GetDateTime()).Last(); CSVManager.convertSleepHeaderToChartInfo(chartInfo, filePath); this.chartsOfWeek.Add(chartInfo); } } } int chartCount = this.chartsOfWeek.Count; if (chartCount > 0) { this.lbChartTitle.text = MSG_RECENT_PART; if (chartCount > 1) { this.lbChartTitle.text += "(" + this.chartsOfWeek[0].date + "~" + this.chartsOfWeek[chartCount - 1].date + ")"; } for (int i = 0; i < chartCount; i++) { ChartInfo chartInfo = this.chartsOfWeek[i]; barChartWeeks[i].drawBarChart(chartInfo.pKaiMin, chartInfo.pIbiki, chartInfo.pMukokyu); barPercentWeeks[i].drawChartInfoWeek(chartInfo.pKaiMin, chartInfo.pIbiki, chartInfo.pMukokyu, chartInfo.date, chartInfo.sleepTime, chartInfo.sleepMode, chartInfo.vibrationStrength); } for (int i = chartCount; i < barChartWeeks.Length; i++) { barChartWeeks[i].drawBarChartWhenEmpty(); barPercentWeeks[i].drawChartInfoWeekWhenEmpty(); } } else { //Show no chart week this.txtNoDataWeek.text = MSG_NO_DATA; this.lbChartTitle.text = MSG_RECENT_PART; for (int i = 0; i < barChartWeeks.Length; i++) { barChartWeeks[i].drawBarChartWhenEmpty(); barPercentWeeks[i].drawChartInfoWeekWhenEmpty(); } } }
void PlayAction(uint skillID, List <Entity> targets = null) { CSVSkill skillInfo = CSVManager.GetSkillCfg(skillID); if (!string.IsNullOrEmpty(skillInfo.castAction)) { m_entity.Anim.SyncAction(skillInfo.castAction); } }
private void LoadMod(string path) { Debug.Log(string.Format("*****************Start Load mod {0}********************", path)); CSVManager.Load(path); CSGenerator.csharpLoader = csharpLoader; CSGenerator.path = path; List <string> sourceCodes = new List <string>(); sourceCodes.Add(CSGenerator.MakeOffices()); sourceCodes.Add(CSGenerator.MakeFactions()); sourceCodes.AddRange(ReadAllCSInPath(path + "/name")); sourceCodes.AddRange(ReadAllCSInPath(path + "/flag")); sourceCodes.AddRange(ReadAllCSInPath(path + "/decision")); sourceCodes.Add(CSGenerator.MakeFlags()); sourceCodes.Add(CSGenerator.MakeDecisions(sourceCodes.ToArray())); sourceCodes.AddRange(ReadAllCSInPath(path + "/event")); CSharpCompiler.ScriptBundleLoader.IScriptBundle bd = csharpLoader.LoadAndWatchSourceBundle(sourceCodes.ToArray()); Type[] Types = bd.assembly.GetTypes(); DynastyName.Load(Types); YearName.Load(Types); PersonName.Load(Types); EventManager.Load(Types); var qurey = (from x in Types where x.Name == "CountryFlags" select x).Single(); System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(qurey.TypeHandle); qurey = (from x in Types where x.Name == "Decisions" select x).Single(); System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(qurey.TypeHandle); qurey = (from x in Types where x.Name == "Offices" select x).Single(); System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(qurey.TypeHandle); qurey = (from x in Types where x.Name == "Factions" select x).Single(); System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(qurey.TypeHandle); Debug.Log(string.Format("******************End Load mod {0}********************", path)); }
public void ShouldParseCSVWhenOnlyOneColumn(string element, object expectedElement) { //Arrange const string fileName = "file"; var fileManager = new Mock<IFileManager>(); fileManager.Setup(f => f.ReadFile(fileName)).Returns(new List<string> {element}); var csvManager = new CSVManager(fileManager.Object); //Act var result = csvManager.Load<string>(fileName); //Assert Assert.That(result.Count(), Is.EqualTo(1)); Assert.That(result.First().Count(), Is.EqualTo(1)); Assert.That(result.First().First(), Is.EqualTo(expectedElement)); }
public void ShouldParseCSV(string line, string s1, string s2) { //Arrange const string fileName = "file"; var fileManager = new Mock<IFileManager>(); fileManager.Setup(f => f.ReadFile(fileName)).Returns(new List<string> {line}); var csvManager = new CSVManager(fileManager.Object); //Act var result = csvManager.Load<string>(fileName); //Assert Assert.That(result.Count(), Is.EqualTo(1)); Assert.That(result.First().Count(), Is.EqualTo(2)); Assert.That(result.First().First(), Is.EqualTo(s1)); Assert.That(result.First().Skip(1).First(), Is.EqualTo(s2)); }
public void ShouldParseCSVWithCharOnly() { //Arrange const string fileName = "file"; var fileManager = new Mock<IFileManager>(); fileManager.Setup(f => f.ReadFile(fileName)).Returns(new List<string> {"a,b,c"}); var csvManager = new CSVManager(fileManager.Object); //Act var result = csvManager.Load<char>(fileName); //Assert Assert.That(result.Count(), Is.EqualTo(1)); Assert.That(result.First().Count(), Is.EqualTo(3)); Assert.That(result.First().First(), Is.EqualTo('a')); Assert.That(result.First().Skip(1).First(), Is.EqualTo('b')); Assert.That(result.First().Skip(2).First(), Is.EqualTo('c')); }
public void ShouldParseCSVWithDateTimeOnly() { //Arrange const string fileName = "file"; var fileManager = new Mock<IFileManager>(); fileManager.Setup(f => f.ReadFile(fileName)).Returns(new List<string> {"14/09/2013"}); var csvManager = new CSVManager(fileManager.Object); //Act var result = csvManager.Load<DateTime>(fileName); //Assert Assert.That(result.Count(), Is.EqualTo(1)); Assert.That(result.First().Count(), Is.EqualTo(1)); Assert.That(result.First().First(), Is.EqualTo(new DateTime(2013, 09, 14))); }
public void ShouldUseFileManager() { //Arrange const string fileName = "FileName"; var fileManager = new Mock<IFileManager>(); var csvManager = new CSVManager(fileManager.Object); //Act csvManager.Load<string>(fileName); //Assert fileManager.Verify(f => f.ReadFile(fileName)); }
public void ShouldThrowColumnMismatchException() { //Arrange const string fileName = "file"; var fileManager = new Mock<IFileManager>(); fileManager.Setup(f => f.ReadFile(fileName)).Returns(new List<string> {"a,b,c", "a,b"}); var csvManager = new CSVManager(fileManager.Object); //Act && Assert Assert.Throws<ColumnMismatchException>(() => csvManager.Load<string>(fileName)); }
public void ShouldReturnNullWhenFileIsEmpty() { //Arrange const string fileName = "file"; var fileManager = new Mock<IFileManager>(); fileManager.Setup(f => f.ReadFile(fileName)).Returns(new List<string> {}); var csvManager = new CSVManager(fileManager.Object); //Act var result = csvManager.Load<string>(fileName); //Assert //Assert Assert.That(result.Count(), Is.EqualTo(0)); }
public void ShouldParseCSVWithDoubleOnly() { //Arrange const string fileName = "file"; var fileManager = new Mock<IFileManager>(); fileManager.Setup(f => f.ReadFile(fileName)).Returns(new List<string> {"1.8,2.2,3.5"}); var csvManager = new CSVManager(fileManager.Object); //Act var result = csvManager.Load<double>(fileName); //Assert Assert.That(result.Count(), Is.EqualTo(1)); Assert.That(result.First().Count(), Is.EqualTo(3)); Assert.That(result.First().First(), Is.EqualTo(1.8)); Assert.That(result.First().Skip(1).First(), Is.EqualTo(2.2)); Assert.That(result.First().Skip(2).First(), Is.EqualTo(3.5)); }
public void WhenILoadTheCSVFile() { var csvManager = new CSVManager(new FileManager()); var csv = csvManager.Load<string>("file.csv"); ScenarioContext.Current.Add(KeyCsv, csv); }