Ejemplo n.º 1
0
Archivo: Unit.cs Proyecto: 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);
        }
Ejemplo n.º 2
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: "");
                }
            }
        }