Esempio n. 1
0
        public static string ToString_DIRRANGE(DIRRANGE range)
        {
            string formatstr = "";

            switch (range.type)
            {
            case DIRRANGE.DIRRANGETYPE.Anydirection:
                return(range.inverse ? "0" : "-1");

            case DIRRANGE.DIRRANGETYPE.Cone:
                if (range.inverse)
                {
                    formatstr = "C':{0},{1},{2}:{3}";
                }
                else
                {
                    formatstr = "C:{0},{1},{2}:{3}";
                }
                return(string.Format(formatstr, range.directrix.x, range.directrix.y, range.directrix.z, range.error.x));

            case DIRRANGE.DIRRANGETYPE.Fan:
                if (range.inverse)
                {
                    formatstr = "F':{0},{1},{2}:{3},{4}";
                }
                else
                {
                    formatstr = "F:{0},{1},{2}:{3},{4}";
                }
                return(string.Format(formatstr, range.directrix.x, range.directrix.y, range.directrix.z, range.error.x, range.error.y));
            }
            return("0");
        }
Esempio n. 2
0
 public static void ReadDirRange(BinaryReader _reader, out PeCustom.DIRRANGE obj)
 {
     ReadVector3(_reader, out obj.directrix);
     ReadVector2(_reader, out obj.error);
     obj.type    = (PeCustom.DIRRANGE.DIRRANGETYPE)_reader.ReadByte();
     obj.inverse = _reader.ReadBoolean();
 }
Esempio n. 3
0
 public static void Serialize(BinaryWriter writer, PeCustom.DIRRANGE obj)
 {
     Serialize(writer, obj.directrix);
     Serialize(writer, obj.error);
     Serialize(writer, (byte)obj.type);
     Serialize(writer, obj.inverse);
 }
 // 在此初始化参数
 protected override void OnCreate()
 {
     axis  = (EAxis)Utility.ToEnumInt(parameters["axis"]);
     obj   = Utility.ToObject(parameters["object"]);
     range = Utility.ToDirRange(missionVars, parameters["range"]);
 }
Esempio n. 5
0
        public static bool TryParse_DIRRANGE(string s, out DIRRANGE range)
        {
            if (s == "0")
            {
                range = DIRRANGE.nodir;
                return(true);
            }
            else if (s == "-1")
            {
                range = DIRRANGE.anydir;
                return(true);
            }
            else
            {
                range = DIRRANGE.anydir;
                string[] ss = s.Split(new string[1] {
                    ":"
                }, StringSplitOptions.None);
                if (ss.Length != 3)
                {
                    return(false);
                }
                ss[0] = ss[0];
                if (ss[0] == "C" || ss[0] == "C'")
                {
                    range.type = DIRRANGE.DIRRANGETYPE.Cone;
                    if (ss[0].Length == 1)
                    {
                        range.inverse = false;
                    }
                    else
                    {
                        range.inverse = true;
                    }

                    Vector3 error = Vector3.zero;
                    if (!TryParse_VECTOR(ss[1], out range.directrix))
                    {
                        return(false);
                    }
                    if (!TryParse_VECTOR(ss[2], out error))
                    {
                        return(false);
                    }
                    range.error.x = error.x;
                    range.error.y = error.y;

                    return(true);
                }
                else if (ss[0] == "F" || ss[0] == "F'")
                {
                    range.type = DIRRANGE.DIRRANGETYPE.Fan;
                    if (ss[0].Length == 1)
                    {
                        range.inverse = false;
                    }
                    else
                    {
                        range.inverse = true;
                    }

                    Vector3 error = Vector3.zero;
                    if (!TryParse_VECTOR(ss[1], out range.directrix))
                    {
                        return(false);
                    }
                    if (!TryParse_VECTOR(ss[2], out error))
                    {
                        return(false);
                    }
                    range.error.x = error.x;
                    range.error.y = error.y;

                    return(true);
                }
                return(false);
            }
        }