Exemplo n.º 1
0
Arquivo: Unit.cs Projeto: 7474/SRC
        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);
        }
Exemplo n.º 2
0
Arquivo: Unit.cs Projeto: 7474/SRC
        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);
        }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
Arquivo: Unit.cs Projeto: 7474/SRC
 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);
     }
 }
Exemplo n.º 5
0
        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: "");
                }
            }
        }
Exemplo n.º 6
0
Arquivo: Unit.cs Projeto: 7474/SRC
        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);
            }
        }
Exemplo n.º 7
0
Arquivo: Unit.cs Projeto: 7474/SRC
 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);
     }
 }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
        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);
                }
            }
        }
Exemplo n.º 10
0
Arquivo: Unit.cs Projeto: 7474/SRC
        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);
            }
        }
Exemplo n.º 11
0
        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));
        }
Exemplo n.º 12
0
Arquivo: Unit.cs Projeto: 7474/SRC
        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);
            }
        }
Exemplo n.º 13
0
 internal UnitEvent(Units.Unit unit)
 {
     Unit = unit;
 }
Exemplo n.º 14
0
 public UnsupportedUnit(Units.Unit unit)
     : base($"Unsupported unit {unit.ToString()}")
 {
 }
Exemplo n.º 15
0
Arquivo: Unit.cs Projeto: 7474/SRC
 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);
 }
Exemplo n.º 16
0
 public void Start()
 {
     unit = GetComponent <Units.Unit>();
     unit.onDamage.AddListener(() => Game.Ctx.AnimationOperator.PushAction(Shake(), false));
 }
Exemplo n.º 17
0
 internal NewUnitEvent(Units.Unit unit) : base(unit)
 {
 }
Exemplo n.º 18
0
 public IncompatibleConversionUnits(Units.Unit inUnit, Units.Unit outUnit)
     : base($"Incompatible units. Can't convert from {inUnit.ToString()} to {inUnit.ToString()}")
 {
 }
Exemplo n.º 19
0
 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)
 {
 }