/// <summary> /// 右辺値の文字列表現を求めます。 /// </summary> public string RightOperandToString() { if (LeftOperand == ".MasterID") { var ship = KCDatabase.Instance.Ships[(int)RightOperand]; if (ship != null) { return(string.Format("{0} ({1})", ship.MasterID, ship.NameWithLevel)); } else { return(string.Format("{0} (未在籍)", (int)RightOperand)); } } else if (LeftOperand == ".ShipID") { var ship = KCDatabase.Instance.MasterShips[(int)RightOperand]; if (ship != null) { return(string.Format("{0} ({1})", ship.ShipID, ship.NameWithClass)); } else { return(string.Format("{0} (存在せず)", (int)RightOperand)); } } else if (LeftOperand == ".MasterShip.ShipType") { var shiptype = KCDatabase.Instance.ShipTypes[(int)RightOperand]; if (shiptype != null) { return(shiptype.Name); } else { return(string.Format("{0} (未定義)", (int)RightOperand)); } } else if (LeftOperand.Contains("SlotMaster")) { if ((int)RightOperand == -1) { return("(なし)"); } else { var eq = KCDatabase.Instance.MasterEquipments[(int)RightOperand]; if (eq != null) { return(eq.Name); } else { return(string.Format("{0} (未定義)", (int)RightOperand)); } } } else if (LeftOperand.Contains("Rate") && RightOperand is double) { return(((double)RightOperand).ToString("P0")); } else if (LeftOperand == ".RepairTime") { return(DateTimeHelper.ToTimeRemainString(DateTimeHelper.FromAPITimeSpan((int)RightOperand))); } else if (LeftOperand == ".Range") { return(Constants.GetRange((int)RightOperand)); } else if (LeftOperand == ".Speed" || LeftOperand == ".MasterShip.Speed") { return(Constants.GetSpeed((int)RightOperand)); } else if (LeftOperand == ".MasterShip.Rarity") { return(Constants.GetShipRarity((int)RightOperand)); } else if (LeftOperand == ".MasterShip.AlbumNo") { var ship = KCDatabase.Instance.MasterShips.Values.FirstOrDefault(s => s.AlbumNo == (int)RightOperand); if (ship != null) { return(string.Format("{0} ({1})", (int)RightOperand, ship.NameWithClass)); } else { return(string.Format("{0} (存在せず)", (int)RightOperand)); } } else if (LeftOperand == ".MasterShip.RemodelAfterShipID") { if (((int)RightOperand) == 0) { return("最終改装"); } var ship = KCDatabase.Instance.MasterShips[(int)RightOperand]; if (ship != null) { return(string.Format("{0} ({1})", ship.ShipID, ship.NameWithClass)); } else { return(string.Format("{0} (存在せず)", (int)RightOperand)); } } else if (LeftOperand == ".MasterShip.RemodelBeforeShipID") { if (((int)RightOperand) == 0) { return("未改装"); } var ship = KCDatabase.Instance.MasterShips[(int)RightOperand]; if (ship != null) { return(string.Format("{0} ({1})", ship.ShipID, ship.NameWithClass)); } else { return(string.Format("{0} (存在せず)", (int)RightOperand)); } } else if (RightOperand is bool) { return(((bool)RightOperand) ? "○" : "×"); } else { return(RightOperand.ToString()); } }
/// <summary> /// 右辺値の文字列表現を求めます。 /// </summary> public string RightOperandToString() { if (LeftOperand == ".MasterID") { var ship = KCDatabase.Instance.Ships[(int)RightOperand]; if (ship != null) { return(string.Format("{0} ({1})", ship.MasterID, ship.NameWithLevel)); } else { return(string.Format("{0} {1}", (int)RightOperand, GeneralRes.NotEnrolled)); } } else if (LeftOperand == ".ShipID") { var ship = KCDatabase.Instance.MasterShips[(int)RightOperand]; if (ship != null) { return(string.Format("{0} ({1})", ship.ShipID, ship.NameWithClass)); } else { return(string.Format("{0} {1}", (int)RightOperand, GeneralRes.DoesNotExist)); } } else if (LeftOperand == ".MasterShip.ShipType") { var shiptype = KCDatabase.Instance.ShipTypes[(int)RightOperand]; if (shiptype != null) { return(FormMain.Instance.Translator.GetTranslation(shiptype.Name, Utility.TranslationType.ShipTypes)); } else { return(string.Format("{0} {1}", (int)RightOperand, GeneralRes.Undefined)); } } else if (LeftOperand.Contains("SlotMaster")) { if ((int)RightOperand == -1) { return(GeneralRes.None); } else { var eq = KCDatabase.Instance.MasterEquipments[(int)RightOperand]; if (eq != null) { return(eq.Name); } else { return(string.Format("{0} {1}", (int)RightOperand, GeneralRes.Undefined)); } } } else if (LeftOperand.Contains("Rate") && RightOperand is double) { return(((double)RightOperand).ToString("P0")); } else if (LeftOperand == ".RepairTime") { return(DateTimeHelper.ToTimeRemainString(DateTimeHelper.FromAPITimeSpan((int)RightOperand))); } else if (LeftOperand == ".Range") { return(Constants.GetRange((int)RightOperand)); } else if (LeftOperand == ".MasterShip.Speed") { return(Constants.GetSpeed((int)RightOperand)); } else if (LeftOperand == ".MasterShip.Rarity") { return(Constants.GetShipRarity((int)RightOperand)); } else if (LeftOperand == ".MasterShip.AlbumNo") { var ship = KCDatabase.Instance.MasterShips.Values.FirstOrDefault(s => s.AlbumNo == (int)RightOperand); if (ship != null) { return(string.Format("{0} ({1})", (int)RightOperand, ship.NameWithClass)); } else { return(string.Format("{0} {1}", (int)RightOperand, GeneralRes.DoesNotExist)); } } else if (LeftOperand == ".MasterShip.RemodelAfterShipID") { if (((int)RightOperand) == 0) { return(GeneralRes.FinalRemodel); } var ship = KCDatabase.Instance.MasterShips[(int)RightOperand]; if (ship != null) { return(string.Format("{0} ({1})", ship.ShipID, ship.NameWithClass)); } else { return(string.Format("{0} {1}", (int)RightOperand, GeneralRes.DoesNotExist)); } } else if (LeftOperand == ".MasterShip.RemodelBeforeShipID") { if (((int)RightOperand) == 0) { return(GeneralRes.Unremodelled); } var ship = KCDatabase.Instance.MasterShips[(int)RightOperand]; if (ship != null) { return(string.Format("{0} ({1})", ship.ShipID, ship.NameWithClass)); } else { return(string.Format("{0} {1}", (int)RightOperand, GeneralRes.DoesNotExist)); } } else if (RightOperand is bool) { return(((bool)RightOperand) ? "○" : "×"); } else { return(RightOperand.ToString()); } }