Example #1
0
        public Pilot(SRC src, PilotData data)
        {
            SRC  = src;
            Data = data;

            Update();
        }
Example #2
0
        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;

            var pname  = SRC.Expression.GetValueAsString(@params[1], is_term[1]);
            var pname2 = SRC.Expression.GetValueAsString(@params[2], is_term[2]);
            var p1     = SRC.PList.Item(pname);
            var p2     = SRC.PList.Item(pname2);

            if (p1 != null && p2 != null)
            {
                num_result = SRC.Expression.GetValueAsLong("関係:" + p1.Name + ":" + p2.Name);
            }

            if (etype == ValueType.StringType)
            {
                str_result = GeneralLib.FormatNum(num_result);
                return(ValueType.StringType);
            }
            else
            {
                return(ValueType.NumericType);
            }
        }
Example #3
0
        public Unit(SRC src)
        {
            SRC = src;

            Status      = "待機";
            intBossRank = -1;
        }
Example #4
0
 public UnitDataList(SRC src)
 {
     SRC             = src;
     IDNum           = 0;
     colUnitDataList = new SrcCollection <UnitData>();
     AddDummyData();
 }
Example #5
0
File: Unit.cs Project: 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);
        }
Example #6
0
File: Unit.cs Project: 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);
        }
Example #7
0
        internal CellColumn Add(SRC src, string name)
        {
            if (this._coltype == CellColumnType.CellIndex)
            {
                throw new AutomationException("Can't add an SRC if Columns contains CellIndexes");
            }
            this._coltype = CellColumnType.SRC;

            name = this.fixup_name(name);

            if (this._dic_columns.ContainsKey(name))
            {
                throw new AutomationException("Duplicate Column Name");
            }

            if (this._src_set == null)
            {
                this._src_set = new HashSet <SRC>();
            }

            if (this._src_set.Contains(src))
            {
                string msg = "Duplicate SRC";
                throw new AutomationException(msg);
            }

            int ordinal = this._items.Count;
            var col     = new CellColumn(ordinal, src, name);

            this._items.Add(col);

            this._dic_columns[name] = col;
            this._src_set.Add(src);
            return(col);
        }
Example #8
0
        // 「ターン終了」コマンド
        private void EndTurnCommand()
        {
            // 行動していない味方ユニットの数を数える
            var stillActionUnits = SRC.UList.Items.Where(u => u.Party == "味方" && u.CanAction).ToList();

            // 行動していないユニットがいれば警告
            if (stillActionUnits.Any())
            {
                var ret = GUI.Confirm(
                    "行動していないユニットが" + SrcFormatter.Format(stillActionUnits.Count) + "体あります"
                    + Environment.NewLine
                    + "このターンを終了しますか?",
                    "終了",
                    GuiConfirmOption.OkCancel | GuiConfirmOption.Question
                    );
                if (ret == GuiDialogResult.Cancel)
                {
                    return;
                }
            }

            // 行動終了していないユニットに対して行動終了イベントを実施
            foreach (var currentSelectedUnit in stillActionUnits)
            {
                SelectedUnit = currentSelectedUnit;
                Event.HandleEvent("行動終了", currentSelectedUnit.MainPilot().ID);
                if (SRC.IsScenarioFinished)
                {
                    SRC.IsScenarioFinished = false;
                    return;
                }
            }

            // 各陣営のフェイズに移行
            SRC.StartTurn("敵");
            if (SRC.IsScenarioFinished)
            {
                SRC.IsScenarioFinished = false;
                return;
            }

            SRC.StartTurn("中立");
            if (SRC.IsScenarioFinished)
            {
                SRC.IsScenarioFinished = false;
                return;
            }

            SRC.StartTurn("NPC");
            if (SRC.IsScenarioFinished)
            {
                SRC.IsScenarioFinished = false;
                return;
            }

            // 味方フェイズに戻る
            SRC.StartTurn("味方");
            SRC.IsScenarioFinished = false;
        }
Example #9
0
 public void SetFormula(SRC src, FormulaLiteral formula)
 {
     if (formula.HasValue)
     {
         this.StreamItems.Add(src);
         this.ValueItems.Add(formula);
     }
 }
Example #10
0
File: Pilots.cs Project: 7474/SRC
 public void Restore(SRC src)
 {
     SRC = src;
     foreach (var p in Items)
     {
         p.Restore(src);
     }
 }
Example #11
0
 public void Restore(SRC src)
 {
     SRC = src;
     foreach (var i in List)
     {
         i.Restore(src);
     }
 }
Example #12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="asName"></param>
        /// <returns></returns>
        public override QView As(string asName)
        {
            this.AsName = asName;

            PKG.As(asName);
            SRC.As(asName);

            return(this);
        }
Example #13
0
        public void Restore(SRC src)
        {
            SRC = src;

            linkData.OtherFormIds.ForEach(x => colOtherForm.Add(SRC.UList.Item(x), x));
            linkData.PilotIds.ForEach(x => colPilot.Add(SRC.PList.Item(x), x));
            linkData.SupportIds.ForEach(x => colSupport.Add(SRC.PList.Item(x), x));
            linkData.ItemIds.ForEach(x => colItem.Add(SRC.IList.Item(x), x));
        }
Example #14
0
        protected override ValueType InvokeInternal(SRC SRC, ValueType etype, string[] @params, int pcount, bool[] is_term, out string str_result, out double num_result)
        {
            num_result = 0d;

            var buf = SRC.Expression.GetValueAsString(@params[1], is_term[1]);
            var i   = SRC.Expression.GetValueAsLong(@params[2], is_term[2]);

            str_result = GeneralLib.RightPaddedString(buf, i);
            return(ValueType.StringType);
        }
Example #15
0
File: List.cs Project: 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;

            str_result = string.Join(" ", Enumerable.Range(1, pcount)
                                     .Select(i => SRC.Expression.GetValueAsString(@params[i], is_term[i])));

            return(ValueType.StringType);
        }
Example #16
0
File: MoneyCmd.cs Project: 7474/SRC
        protected override int ExecInternal()
        {
            if (ArgNum != 2)
            {
                throw new EventErrorException(this, "Moneyコマンドの引数の数が間違っています");
            }

            SRC.IncrMoney(GetArgAsLong(2));
            return(EventData.NextID);
        }
Example #17
0
        protected override int ExecInternal()
        {
            if (ArgNum != 1)
            {
                throw new EventErrorException(this, "GameClearコマンドの引数の数が違います");
            }

            SRC.GameClear();
            return(-1);
        }
Example #18
0
        public PilotData(SRC src)
        {
            SRC = src;

            SpecialPowers  = new List <PilotDataSpecialPower>();
            colSkill       = new SrcCollection <SkillData>();
            colFeature     = new SrcCollection <FeatureData>();
            colWeaponData  = new SrcCollection <WeaponData>();
            colAbilityData = new SrcCollection <AbilityData>();
        }
Example #19
0
File: XY.cs Project: 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;

            switch (pcount)
            {
            case 1:
                var pname = SRC.Expression.GetValueAsString(@params[1], is_term[1]);
                if (GeneralLib.IsNumber(pname))
                {
                    num_result = GeneralLib.StrToLng(pname);
                }
                else if (pname == "目標地点")
                {
                    num_result = SRC.Commands.SelectedY;
                }
                else if (SRC.UList.IsDefined2(pname))
                {
                    num_result = SRC.UList.Item2(pname).y;
                }
                else if (SRC.PList.IsDefined(pname))
                {
                    {
                        var p = SRC.PList.Item(pname);
                        if (p.Unit is object)
                        {
                            num_result = p.Unit.y;
                        }
                    }
                }

                break;

            case 0:
                if (SRC.Event.SelectedUnitForEvent is object)
                {
                    num_result = SRC.Event.SelectedUnitForEvent.y;
                }

                break;
            }

            num_result = SRC.GUI.MapToPixelY((int)num_result);
            if (etype == ValueType.StringType)
            {
                str_result = GeneralLib.FormatNum(num_result);
                return(ValueType.StringType);
            }
            else
            {
                return(ValueType.NumericType);
            }
        }
Example #20
0
        public NonPilotDataList(SRC src)
        {
            SRC = src;
            // Talkコマンド用
            var npd = new NonPilotData();

            npd.Name     = "ナレーター";
            npd.Nickname = "ナレーター";
            npd.Bitmap   = ".bmp";
            colNonPilotDataList.Add(npd, npd.Name);
        }
Example #21
0
        protected override int ExecInternal()
        {
            if (ArgNum != 1)
            {
                throw new EventErrorException(this, "GameOverコマンドの引数の数が違います");
            }

            SRC.GameOver();
            SRC.IsScenarioFinished = true;
            return(-1);
        }
Example #22
0
        public CellColumn AddCell(SRC src, string name)
        {
            if (name == null)
            {
                throw new System.ArgumentException("name");
            }

            var col = this.CellColumns.Add(src, name);

            return(col);
        }
Example #23
0
        public ValueType Invoke(SRC SRC, ValueType etype, string[] @params, int pcount, bool[] is_term, out string str_result, out double num_result)
        {
            var res = InvokeInternal(SRC, etype, @params, pcount, is_term, out str_result, out num_result);

            SRC.LogTrace("Invoked",
                         res.ToString().Substring(0, 1),
                         GetType().Name + "(" + string.Join(",", Enumerable.Range(1, pcount).Select(x => @params[x])) + ")",
                         str_result,
                         num_result.ToString()
                         );
            return(res);
        }
Example #24
0
        protected override void _commit_to_surface(ShapeSheetSurface surface)
        {
            // Do nothing if there aren't any updates
            if (this.ValueItems.Count < 1)
            {
                return;
            }

            var stream   = SRC.ToStream(this.StreamItems);
            var formulas = WriterHelper.build_formulas_array(this.ValueItems);
            var flags    = this.ComputeGetFormulaFlags();
            int c        = surface.SetFormulas(stream, formulas, (short)flags);
        }
Example #25
0
File: DebugCmd.cs Project: 7474/SRC
        protected override int ExecInternal()
        {
            var message = string.Join(" ", Enumerable.Range(2, ArgNum - 1)
                                      .Select(x => GetArg(x))
                                      .Select(x =>
            {
                Expression.FormatMessage(ref x);
                return(Strings.Trim(x));
            }));

            SRC.LogInfo(message);
            return(EventData.NextID);
        }
Example #26
0
        private void check_deplicate_src(SRC src)
        {
            if (this._src_set == null)
            {
                this._src_set = new HashSet <ShapeSheet.SRC>();
            }

            if (this._src_set.Contains(src))
            {
                string msg = string.Format("Duplicate SRC({0},{1},{2})", src.Section, src.Row, src.Cell);
                throw new System.ArgumentException(msg);
            }
        }
Example #27
0
        private void ExtractValues(string elementName, XmlReader reader)
        {
            for (int i = 0; i < reader.AttributeCount; ++i)
            {
                reader.MoveToAttribute(i);

                string name  = reader.Name;
                string value = reader.Value;

                if (SRC.Equals(name))
                {
                    this.src = value;
                }
                else if (CAT.Equals(name))
                {
                    this.category = value;
                }
                else if (DISPLAY.Equals(name))
                {
                    this.display = Display.FromString(value);
                }
                else if (ID.Equals(name))
                {
                    this.id = value;
                }
                else if (PRIORITY.Equals(name))
                {
                    this.priority = int.Parse(value);
                }
                else if (SYMBOL_HEIGHT.Equals(name))
                {
                    this.height = XmlUtils.ParseNonNegativeInteger(name, value) * displayModel.ScaleFactor;
                }
                else if (SYMBOL_PERCENT.Equals(name))
                {
                    this.percent = XmlUtils.ParseNonNegativeInteger(name, value);
                }
                else if (SYMBOL_SCALING.Equals(name))
                {
                    this.scaling = FromValue(value);
                }
                else if (SYMBOL_WIDTH.Equals(name))
                {
                    this.width = XmlUtils.ParseNonNegativeInteger(name, value) * displayModel.ScaleFactor;
                }
                else
                {
                    throw XmlUtils.CreateXmlReaderException(elementName, name, value, i);
                }
            }
        }
Example #28
0
        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;

            switch (pcount)
            {
            case 1:
            {
                var buf = SRC.Expression.GetValueAsString(@params[1], is_term[1]);

                if (SRC.PList.IsDefined(buf))
                {
                    str_result = SRC.PList.Item(buf).get_Nickname(false);
                }
                else if (SRC.PDList.IsDefined(buf))
                {
                    str_result = SRC.PDList.Item(buf).Nickname;
                }
                else if (SRC.NPDList.IsDefined(buf))
                {
                    str_result = SRC.NPDList.Item(buf).Nickname;
                }
                else if (SRC.UList.IsDefined(buf))
                {
                    str_result = SRC.UList.Item(buf).Nickname0;
                }
                else if (SRC.UDList.IsDefined(buf))
                {
                    str_result = SRC.UDList.Item(buf).Nickname;
                }
                else if (SRC.IDList.IsDefined(buf))
                {
                    str_result = SRC.IDList.Item(buf).Nickname;
                }

                break;
            }

            case 0:
            {
                if (SRC.Event.SelectedUnitForEvent != null)
                {
                    str_result = SRC.Event.SelectedUnitForEvent.Nickname0;
                }

                break;
            }
            }
            return(ValueType.StringType);
        }
Example #29
0
        private void ExtractValues(string elementName, XmlReader reader)
        {
            for (int i = 0; i < reader.AttributeCount; ++i)
            {
                reader.MoveToAttribute(i);

                string name  = reader.Name;
                string value = reader.Value;

                if (SRC.Equals(name))
                {
                    this.src = value;
                }
                else if (CAT.Equals(name))
                {
                    this.category = value;
                }
                else if (FILL.Equals(name))
                {
                    this.fill.Color = XmlUtils.GetColor(value);
                }
                else if (STROKE.Equals(name))
                {
                    this.stroke.Color = XmlUtils.GetColor(value);
                }
                else if (SYMBOL_HEIGHT.Equals(name))
                {
                    this.height = XmlUtils.ParseNonNegativeInteger(name, value) * displayModel.ScaleFactor;
                }
                else if (SYMBOL_PERCENT.Equals(name))
                {
                    this.percent = XmlUtils.ParseNonNegativeInteger(name, value);
                }
                else if (SYMBOL_SCALING.Equals(name))
                {
                    this.scaling = FromValue(value);
                }
                else if (SYMBOL_WIDTH.Equals(name))
                {
                    this.width = XmlUtils.ParseNonNegativeInteger(name, value) * displayModel.ScaleFactor;
                }
                else if (STROKE_WIDTH.Equals(name))
                {
                    this.strokeWidth = XmlUtils.ParseNonNegativeFloat(name, value) * displayModel.ScaleFactor;
                }
                else
                {
                    throw XmlUtils.CreateXmlReaderException(elementName, name, value, i);
                }
            }
        }
Example #30
0
        public void Init(SRC src, ListBoxArgs args, int max_num)
        {
            SRC             = src;
            Text            = args.lb_caption;
            lblCaption.Text = " " + args.lb_info;
            cmdSort.Text    = "名称順に並べ替え";

            ListBoxItemSource = args.Items.Select(x => new MultiSelectListBoxItem(x)).ToList();
            ListBoxItems      = new BindingList <MultiSelectListBoxItem>(ListBoxItemSource);
            MaxListItem       = max_num;

            _lstItems.DataSource    = ListBoxItems;
            _lstItems.DisplayMember = "Text";
        }
 public CellColumn AddCell(SRC src, string name)
 {
     var col = this.CellColumns.Add(src, name);
     return col;
 }
Example #32
0
 public SRCValuePair(SRC src, FormulaLiteral f)
 {
     this.SRC = src;
     this.Formula = f;
 }
Example #33
0
 protected SRCValuePair srcvaluepair(SRC src, FormulaLiteral f)
 {
     return new SRCValuePair(src, f);
 }
 public SRCFormulaPair(SRC src, FormulaLiteral formula)
 {
     this.SRC = src;
     this.Formula = formula;
 }
 internal CellColumn(int ordinal, SRC src, string name) :
     this(ordinal, name)
 {
     this.SRC = src;
 }
 protected SRCFormulaPair newpair(SRC src, FormulaLiteral formula)
 {
     return new SRCFormulaPair(src, formula);
 }