// CSV文字列からデータ型に変換 bool stringToHipData(string _hipStr, out HipData data) { bool ret = true; data = new HipData(); // カンマ区切りのデータを文字列の配列に変換 string[] dataArr = _hipStr.Split(','); try { // 文字列をint,floatに変換する int hipId = int.Parse(dataArr[0]); float hlH = float.Parse(dataArr[1]); float hlM = float.Parse(dataArr[2]); float hlS = float.Parse(dataArr[3]); int hsSgn = int.Parse(dataArr[4]); float hsH = float.Parse(dataArr[5]); float hsM = float.Parse(dataArr[6]); float hsS = float.Parse(dataArr[7]); float mag = float.Parse(dataArr[8]); Color col = Color.gray; float hDeg = (360f / 24f) * (hlH + hlM / 60f + hlS / 3600f); float sDeg = (hsH + hsM / 60f + hsS / 3600f) * (hsSgn == 0 ? -1f : 1f); Quaternion rotL = Quaternion.AngleAxis(hDeg, Vector3.up); Quaternion rotS = Quaternion.AngleAxis(sDeg, Vector3.right); Vector3 pos = rotL * rotS * Vector3.forward; data = new HipData(hipId, pos, Color.white, mag); } catch { ret = false; Debug.Log("data err"); } return(ret); }
public HipData(HipData _data) { hipId = _data.hipId; pos = _data.pos; color = _data.color; magnitude = _data.magnitude; }
public string ReductoHips(HipData oldHips, bool nothingHappened) { StringBuilder sb = new StringBuilder(); sb.Append("You smear the foul-smelling paste onto your " + oldHips.ShortDescription() + ". It feels cool at first but rapidly warms to an uncomfortable level of heat." + GlobalStrings.NewParagraph()); if (nothingHappened) { sb.Append("Strangely, nothing seems to happen. What a waste!"); } if (oldHips.size >= 15) { sb.Append("Within seconds you feel noticeably lighter, and a quick glance at your hips shows they've gotten significantly narrower."); } else if (oldHips.size >= 10) { sb.Append("You feel much lighter as your " + ShortDescription() + " shift slightly, adjusting to their smaller size."); } else { sb.Append("After a few seconds your " + ShortDescription() + " have shrunk to a much smaller size!"); } return(sb.ToString()); }
public HipData(HipData _data) { hipId = _data.hipId; direction = _data.direction; color = _data.color; magnitude = _data.magnitude; parallax = _data.parallax; }
protected override string HipChangeText(Creature target, HipData oldHips) { string verb = target.hips.size - oldHips.size > 0 ? "enlarge" : "shrink"; return("You wiggle around in your gown, the pleasant feeling of flower petals rubbing against your skin washes over you." + " The feeling settles on your " + oldHips.ShortDescription() + "." + Environment.NewLine + "You feel them slowly " + verb + ". <b>You now have " + target.build.HipsShortDescription() + "</b>." + Environment.NewLine); ; }
/// <summary> /// Gets the hip data by identifier. /// </summary> /// <returns><c>true</c>, if hip data by identifier was gotten, <c>false</c> otherwise.</returns> /// <param name="_hipList">Hip list.</param> /// <param name="_hipId">Hip identifier.</param> /// <param name="_data">Data.</param> static public bool GetHipDataByID(List <HipData> _hipList, int _hipId, out HipData _data) { bool ret = false; _data = new HipData(); HipData retData = _hipList.FirstOrDefault(d => (d.hipId == _hipId)); if (retData.hipId == _hipId) { ret = true; _data = retData; } return(ret); }
/// <summary> 12星座を除く星座線データを取得 </summary> static public List <HipData> GetHipListWithoutZodiac(List <HipData> _baseHipList, List <HipLine> _lineList) { List <HipData> retHipList = new List <HipData>(); List <HipLine> onlyZodiacLineList = getLineListWithoutOrOnlyZodiac(_lineList, true); List <HipData> onlyZodiacHipList = GetHipListFromLineList(onlyZodiacLineList); foreach (HipData baseData in _baseHipList) { HipData findData = onlyZodiacHipList.FirstOrDefault(d => (d.hipId == baseData.hipId)); if (findData.hipId != baseData.hipId) { retHipList.Add(baseData); } } return(retHipList); }
bool stringToHipData(string _hipStr, out HipData data) { bool ret = true; data = new HipData(); string[] dataArr = _hipStr.Split(','); try{ int hipId = int.Parse(dataArr[0]); float hlH = float.Parse(dataArr[1]); float hlM = float.Parse(dataArr[2]); float hlS = float.Parse(dataArr[3]); int hsSgn = int.Parse(dataArr[4]); float hsH = float.Parse(dataArr[5]); float hsM = float.Parse(dataArr[6]); float hsS = float.Parse(dataArr[7]); float mag = float.Parse(dataArr[8]); float parallax = 0f; if (dataArr.Length > 9) { // parallax float.TryParse(dataArr[9], out parallax); } Color col = Color.gray; if (dataArr.Length > 12) // B-V色指数 { float bv = 0f; if (float.TryParse(dataArr[12], out bv)) { col = BV2Col(bv); } } float hDeg = (360f / 24f) * (hlH + hlM / 60f + hlS / 3600f); float sDeg = (hsH + hsM / 60f + hsS / 3600f) * (hsSgn == 0?-1f:1f); Quaternion rotL = Quaternion.AngleAxis(hDeg, Vector3.up); Quaternion rotS = Quaternion.AngleAxis(sDeg, Vector3.right); Vector3 pos = rotL * rotS * Vector3.forward; data = new HipData(hipId, pos, col, mag, parallax); }catch { ret = false; Debug.Log("dataerr"); } return(ret); }
bool stringToHipLine(string _hipLineStr, List <HipData> _hipList, out HipLine data) { bool ret = true; data = new HipLine(); string[] dataArr = _hipLineStr.Split(','); string shortName = dataArr[0]; try{ int sttId = int.Parse(dataArr[1]); int endId = int.Parse(dataArr[2]); HipData sttData = _hipList.First(d => (d.hipId == sttId)); HipData endData = _hipList.First(d => (d.hipId == endId)); data = new HipLine(shortName, sttData, endData); }catch { ret = false; Debug.Log("linedataerr:" + shortName); } return(ret); }
List <HipData> appendHipList(List <HipData> _hipAppendList, List <HipData> _hipList) { List <HipData> list = _hipAppendList; for (int i = 0; i < _hipList.Count; ++i) { HipData data = _hipList[i]; bool isFound = false; for (int j = 0; j < list.Count; ++j) { if (list[j].hipId == data.hipId) { isFound = true; list[j] = data; break; } } if (!isFound) { list.Add(data); } } return(list); }
protected bool ChangeHips(Creature target, StringBuilder content) { HipData hipData = target.hips.AsReadOnlyData(); bool changed = false; if (target.hips.size < 5) { changed = target.hips.GrowHips(1) != 0; } else if (target.hips.size > 5) { changed = target.hips.ShrinkHips(1) != 0; } if (changed) { content.Append(HipChangeText(target, hipData)); return(true); } else { return(false); } }
protected override string WidenedHipsText(Creature target, HipData oldHips) { return(GlobalStrings.NewParagraph() + "You stumble as you feel the bones in your hips grinding, expanding your hips noticeably."); }
protected abstract string WidenedHipsText(Creature target, HipData oldHips);
public HipLine(string _name, HipData _sttData, HipData _endData) { constellationNameShort = _name; sttData = _sttData; endData = _endData; }
protected abstract string HipChangeText(Creature target, HipData oldHips);