Exemplo n.º 1
0
        public void ProcessConnections()
        {
            if (Connections.Length == 0)
            {
                return;
            }
            byte[] buff = GetArrayContent(Connections);
            List <PropertyReader.Property> pp = PropertyReader.ReadProp(pcc, buff, 0);
            int f = -1;

            toIdx = -1;
            foreach (PropertyReader.Property p in pp)
            {
                if (pcc.getNameEntry(p.Name) == "ConnectTo")
                {
                    f = p.Value.IntValue - 1;
                }
            }
            if (pcc.isExport(f) && pcc.Exports[f].ClassName == "SplineActor")
            {
                to    = SplineActor.GetLocation(pcc, f);
                toIdx = f;
            }
            from    = new List <Vector3>();
            fromIdx = new List <int>();
            buff    = new byte[0];
            foreach (PropertyReader.Property p in Props)
            {
                if (pcc.getNameEntry(p.Name) == "LinksFrom")
                {
                    buff = GetArrayContent(p.raw);
                }
            }

            for (int i = 0; i < buff.Length / 4; i++)
            {
                int Idx = BitConverter.ToInt32(buff, i * 4) - 1;
                fromIdx.Add(Idx);
                from.Add(SplineActor.GetLocation(pcc, Idx));
            }
        }
Exemplo n.º 2
0
        public void ProcessConnections()
        {
            List <CustomVertex.PositionColored> list = new List <CustomVertex.PositionColored>();

            if (Connections.Length == 0)
            {
                return;
            }
            byte[] buff = GetArrayContent(Connections);
            List <PropertyReader.Property> pp = PropertyReader.ReadProp(pcc, buff, 0);
            int f = -1;

            toIdx = -1;
            foreach (PropertyReader.Property p in pp)
            {
                if (pcc.getNameEntry(p.Name) == "ConnectTo")
                {
                    f = p.Value.IntValue - 1;
                }
            }
            if (pcc.isExport(f) && pcc.Exports[f].ClassName == "SplineActor")
            {
                to    = SplineActor.GetLocation(pcc, f);
                toIdx = f;
            }
            from    = new List <Vector3>();
            fromIdx = new List <int>();
            buff    = new byte[0];
            foreach (PropertyReader.Property p in Props)
            {
                if (pcc.getNameEntry(p.Name) == "LinksFrom")
                {
                    buff = GetArrayContent(p.raw);
                }
            }

            for (int i = 0; i < buff.Length / 4; i++)
            {
                int Idx = BitConverter.ToInt32(buff, i * 4) - 1;
                fromIdx.Add(Idx);
                from.Add(SplineActor.GetLocation(pcc, Idx));
            }
            list.Add(new CustomVertex.PositionColored(location, Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(to, Color.GreenYellow.ToArgb()));
            foreach (Vector3 v in from)
            {
                list.Add(new CustomVertex.PositionColored(location, Color.GreenYellow.ToArgb()));
                list.Add(new CustomVertex.PositionColored(v, Color.GreenYellow.ToArgb()));
            }

            float w = 20;

            list.Add(new CustomVertex.PositionColored(location, Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(location + new Vector3(-w, -w, 100), Color.GreenYellow.ToArgb()));

            list.Add(new CustomVertex.PositionColored(location, Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(location + new Vector3(w, -w, 100), Color.GreenYellow.ToArgb()));

            list.Add(new CustomVertex.PositionColored(location, Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(location + new Vector3(w, w, 100), Color.GreenYellow.ToArgb()));

            list.Add(new CustomVertex.PositionColored(location, Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(location + new Vector3(-w, w, 100), Color.GreenYellow.ToArgb()));

            list.Add(new CustomVertex.PositionColored(location + new Vector3(-w, -w, 100), Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(location + new Vector3(w, -w, 100), Color.GreenYellow.ToArgb()));

            list.Add(new CustomVertex.PositionColored(location + new Vector3(w, -w, 100), Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(location + new Vector3(w, w, 100), Color.GreenYellow.ToArgb()));

            list.Add(new CustomVertex.PositionColored(location + new Vector3(w, w, 100), Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(location + new Vector3(-w, w, 100), Color.GreenYellow.ToArgb()));

            list.Add(new CustomVertex.PositionColored(location + new Vector3(-w, w, 100), Color.GreenYellow.ToArgb()));
            list.Add(new CustomVertex.PositionColored(location + new Vector3(-w, -w, 100), Color.GreenYellow.ToArgb()));
            points     = list.ToArray();
            points_sel = list.ToArray();
            for (int i = 0; i < points_sel.Length; i++)
            {
                points_sel[i].Color = Color.Red.ToArgb();
            }
        }