Beispiel #1
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;

            if (GeneralLib.IsNumber(SRC.Expression.GetValueAsString(@params[1], is_term[1])))
            {
                str_result = "1";
                num_result = 1d;
            }
            else
            {
                str_result = "0";
                num_result = 0d;
            }

            if (etype == ValueType.StringType)
            {
                return(ValueType.StringType);
            }
            else
            {
                return(ValueType.NumericType);
            }
        }
Beispiel #2
0
Datei: XY.cs Projekt: 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);
            }
        }