protected override ValueType InvokeInternal(SRC SRC, ValueType etype, string[] @params, int pcount, bool[] is_term, out string str_result, out double num_result) { str_result = ""; num_result = 0d; Units.Unit unit = null; var pname = SRC.Expression.GetValueAsString(@params[1], is_term[1]); if (SRC.UList.IsDefined(pname)) { unit = SRC.UList.Item(pname); } var index = pcount == 1 ? 0 : SRC.Expression.GetValueAsLong(@params[2], is_term[2]); if (unit != null && unit.CountPilot() > 0) { if (index > 0) { var pilots = unit.AllRawPilots.ToList(); str_result = pilots.Count > index - 1 ? pilots[index - 1].ID : ""; } else { str_result = unit.MainPilot().ID; } } return(ValueType.StringType); }
protected override ValueType InvokeInternal(SRC SRC, Units.Unit unit, ValueType etype, string[] @params, int pcount, bool[] is_term, out string str_result, out double num_result) { str_result = ""; num_result = 0d; var index = pcount == 1 ? SRC.Expression.GetValueAsLong(@params[1], is_term[1]) : SRC.Expression.GetValueAsLong(@params[2], is_term[2]); if (index <= 0) { return(ValueType.StringType); } if (pcount == 2) { var pname = SRC.Expression.GetValueAsString(@params[1], is_term[1]); if (pname == "未装備") { var items = SRC.IList.List.Where(itm => itm.Unit == null && itm.Exist).ToList(); str_result = items.Count > index - 1 ? items[index - 1].ID : ""; return(ValueType.StringType); } } if (unit != null) { str_result = unit.ItemList.Count > index - 1 ? unit.ItemList[index - 1].ID : ""; } return(ValueType.StringType); }
public static void Update() { KeyboardState currentState = Keyboard.GetState(); MouseState mouseState = Mouse.GetState(); /* End current player's turn after Space is pressed. */ if (currentState.IsKeyDown(Keys.Space) && previousState.IsKeyUp(Keys.Space)) { TurnManager.ChangeTurn(); } /* Move current unit */ if (currentState.IsKeyDown(Keys.M) && previousState.IsKeyUp(Keys.M)) { Units.Unit currentUnit = UnitManager.GetCurrentUnit(); if (currentUnit.State != Units.Unit.States.Moving) { MoveManager.StartMove(currentUnit); } else if (currentUnit.State == Units.Unit.States.Moving) { MoveManager.EndMove(currentUnit); } } previousState = currentState; }
protected override ValueType InvokeInternal(SRC SRC, Units.Unit unit, ValueType etype, string[] @params, int pcount, bool[] is_term, out string str_result, out double num_result) { str_result = ""; num_result = unit?.Rank ?? 0d; if (etype == ValueType.StringType) { str_result = GeneralLib.FormatNum(num_result); return(ValueType.StringType); } else { return(ValueType.NumericType); } }
private void AddAdditionalPilotIfNotExist(string uname, Units.Unit u) { var ud = SRC.UDList.Item(uname); if (ud.IsFeatureAvailable("追加パイロット")) { var fd = ud.Feature("追加パイロット"); if (!SRC.PList.IsDefined(fd.Data)) { if (!SRC.PDList.IsDefined(fd.Data)) { GUI.ErrorMessage(uname + "の追加パイロット「" + fd.Data + "」のデータが見つかりません"); SRC.TerminateSRC(); } SRC.PList.Add(fd.Data, u.MainPilot().Level, u.Party0, gid: ""); } } }
protected override ValueType InvokeInternal(SRC SRC, Units.Unit unit, ValueType etype, string[] @params, int pcount, bool[] is_term, out string str_result, out double num_result) { str_result = ""; num_result = 0d; var name = pcount == 1 ? SRC.Expression.GetValueAsString(@params[1], is_term[1]) : SRC.Expression.GetValueAsString(@params[2], is_term[2]); num_result = unit?.IsEquiped(name) ?? false ? 1d : 0d; if (etype == ValueType.StringType) { str_result = GeneralLib.FormatNum(num_result); return(ValueType.StringType); } else { return(ValueType.NumericType); } }
protected override ValueType InvokeInternal(SRC SRC, Units.Unit unit, ValueType etype, string[] @params, int pcount, bool[] is_term, out string str_result, out double num_result) { str_result = ""; num_result = 0d; if (unit != null) { if (unit.Status == "出撃" || unit.Status == "格納") { num_result = unit.Action; } } if (etype == ValueType.StringType) { str_result = GeneralLib.FormatNum(num_result); return(ValueType.StringType); } else { return(ValueType.NumericType); } }
private bool ConfirmMoveFinish(Units.Unit u) { if (Map.MapDataForUnit[SelectedX, SelectedY] != null) { GuiDialogResult res; if (Map.MapDataForUnit[SelectedX, SelectedY].IsFeatureAvailable("母艦") && !u.IsFeatureAvailable("母艦")) { res = GUI.Confirm("着艦しますか?", "着艦", GuiConfirmOption.OkCancel | GuiConfirmOption.Question); } else { res = GUI.Confirm("合体しますか?", "合体", GuiConfirmOption.OkCancel | GuiConfirmOption.Question); } if (res == GuiDialogResult.Cancel) { CancelCommand(); GUI.UnlockGUI(); return(false); } } return(true); }
private void RemoveForUnit(Units.Unit u) { if (u == null) { return; } foreach (var itm in u.ItemList.CloneList()) { if (u.Party0 != "味方") { itm.Exist = false; } u.DeleteItem(itm); } if (u.Status == "出撃") { if (!GUI.IsPictureVisible && !Map.IsStatusView) { GUI.PaintUnitBitmap(Event.SelectedUnitForEvent); } } }
protected override ValueType InvokeInternal(SRC SRC, Units.Unit unit, ValueType etype, string[] @params, int pcount, bool[] is_term, out string str_result, out double num_result) { str_result = ""; num_result = 0d; var name = pcount == 1 ? SRC.Expression.GetValueAsString(@params[1], is_term[1]) : SRC.Expression.GetValueAsString(@params[2], is_term[2]); // エリアスが定義されている? if (SRC.ALDList.IsDefined(name)) { name = SRC.ALDList.Item(name).ReplaceTypeName(name); } num_result = unit?.IsFeatureAvailable(name) ?? false ? 1d : 0d; if (etype == ValueType.StringType) { str_result = GeneralLib.FormatNum(num_result); return(ValueType.StringType); } else { return(ValueType.NumericType); } }
protected override ValueType InvokeInternal(SRC SRC, ValueType etype, string[] @params, int pcount, bool[] is_term, out string str_result, out double num_result) { Units.Unit unit = null; if (OptionArgCount >= pcount) { unit = SRC.Event.SelectedUnitForEvent; } else { var pname = SRC.Expression.GetValueAsString(@params[1], is_term[1]); if (SRC.UList.IsDefined2(pname)) { unit = SRC.UList.Item2(pname); } else if (SRC.PList.IsDefined(pname)) { var p = SRC.PList.Item(pname); unit = p.Unit; } } return(InvokeInternal(SRC, unit, etype, @params, pcount, is_term, out str_result, out num_result)); }
protected override ValueType InvokeInternal(SRC SRC, Units.Unit unit, ValueType etype, string[] @params, int pcount, bool[] is_term, out string str_result, out double num_result) { str_result = ""; num_result = 0d; num_result = unit?.CountItem() ?? 0d; if (pcount == 1) { var pname = SRC.Expression.GetValueAsString(@params[1], is_term[1]); if (pname == "未装備") { num_result = SRC.IList.List.Count(itm => itm.Unit == null && itm.Exist); } } if (etype == ValueType.StringType) { str_result = GeneralLib.FormatNum(num_result); return(ValueType.StringType); } else { return(ValueType.NumericType); } }
internal UnitEvent(Units.Unit unit) { Unit = unit; }
public UnsupportedUnit(Units.Unit unit) : base($"Unsupported unit {unit.ToString()}") { }
protected override ValueType InvokeInternal(SRC SRC, Units.Unit unit, ValueType etype, string[] @params, int pcount, bool[] is_term, out string str_result, out double num_result) { str_result = unit?.ID ?? ""; num_result = 0d; return(ValueType.StringType); }
public void Start() { unit = GetComponent <Units.Unit>(); unit.onDamage.AddListener(() => Game.Ctx.AnimationOperator.PushAction(Shake(), false)); }
internal NewUnitEvent(Units.Unit unit) : base(unit) { }
public IncompatibleConversionUnits(Units.Unit inUnit, Units.Unit outUnit) : base($"Incompatible units. Can't convert from {inUnit.ToString()} to {inUnit.ToString()}") { }
protected abstract ValueType InvokeInternal(SRC SRC, Units.Unit unit, ValueType etype, string[] @params, int pcount, bool[] is_term, out string str_result, out double num_result);
internal UpdatedUnitEvent(Units.Unit unit) : base(unit) { }