123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- using System;
- using System.Collections.Generic;
- using MaidStatus;
- public static class YotogiOldPropensity
- {
- public static void Create()
- {
- if (YotogiOldPropensity.propensityDatas != null)
- {
- return;
- }
- YotogiOldPropensity.propensityDatas = new Dictionary<int, YotogiOldPropensity.RequestData>();
- using (AFileBase afileBase = GameUty.FileSystemOld.FileOpen("propensity_learn.nei"))
- {
- using (CsvParser csvParser = new CsvParser())
- {
- bool condition = csvParser.Open(afileBase);
- NDebug.Assert(condition, "propensity_learn.nei\nopen failed.");
- int num = 2;
- while (csvParser.IsCellToExistData(1, num))
- {
- int cell_x = 1;
- string cellAsString = csvParser.GetCellAsString(cell_x++, num);
- if (!Propensity.IsEnabled(cellAsString))
- {
- num++;
- }
- else
- {
- YotogiOldPropensity.RequestData requestData = new YotogiOldPropensity.RequestData();
- requestData.seikeikens = new HashSet<Seikeiken>();
- requestData.parametersPack = new ParametersPack();
- Propensity.Data data = Propensity.GetData(cellAsString);
- cellAsString = csvParser.GetCellAsString(cell_x++, num);
- if (!string.IsNullOrEmpty(cellAsString))
- {
- string[] array = cellAsString.Split(new char[]
- {
- ','
- });
- foreach (string text in array)
- {
- string value = "NO_NO";
- if (text != null)
- {
- if (!(text == "指定なし"))
- {
- if (!(text == "前穴"))
- {
- if (!(text == "後穴"))
- {
- if (text == "両穴")
- {
- value = "Yes_Yes";
- }
- }
- else
- {
- value = "No_Yes";
- }
- }
- else
- {
- value = "Yes_No";
- }
- }
- else
- {
- value = "No_No";
- }
- }
- requestData.seikeikens.Add((Seikeiken)Enum.Parse(typeof(Seikeiken), value));
- }
- }
- while (csvParser.IsCellToExistData(cell_x, num))
- {
- string cellAsString2 = csvParser.GetCellAsString(cell_x++, num);
- int cellAsInteger = csvParser.GetCellAsInteger(cell_x++, num);
- ParametersPack.StatusType targetStatus = ParametersPack.NameToStatusType(cellAsString2);
- requestData.parametersPack.Set(targetStatus, cellAsInteger);
- }
- YotogiOldPropensity.propensityDatas.Add(data.id, requestData);
- num++;
- }
- }
- }
- }
- }
- public static bool IsGetPossiblePropensity(Propensity.Data data, Status status)
- {
- YotogiOldPropensity.Create();
- return Propensity.IsEnabled(data.id) && YotogiOldPropensity.propensityDatas.ContainsKey(data.id) && YotogiOldPropensity.propensityDatas[data.id].Check(status);
- }
- public static Dictionary<int, YotogiOldPropensity.RequestData> propensityDatas;
- public class RequestData
- {
- public bool Check(Status status)
- {
- return this.seikeikens.Contains(status.seikeiken) && this.parametersPack.GreaterThanOrEqualToStatus(status);
- }
- public HashSet<Seikeiken> seikeikens;
- public ParametersPack parametersPack;
- }
- }
|