예제 #1
0
 public void SyncState(Serializer ser)
 {
     ser.BeginSection(nameof(Port1));
     Port1.SyncState(ser);
     Port2.SyncState(ser);
     ser.EndSection();
 }
 public byte ReadPort2(IController c, bool left_mode, bool update_wheel)
 {
     if (update_wheel)
     {
         wheel2 = Port2.Update_Wheel(c, wheel2);
     }
     return(Port2.Read(c, left_mode, wheel2));
 }
예제 #3
0
        public void SyncState(Serializer ser)
        {
            ser.BeginSection("Port1");
            Port1.SyncState(ser);
            ser.EndSection();

            ser.BeginSection("Port2");
            Port2.SyncState(ser);
            ser.EndSection();
        }
        public void SyncState(Serializer ser)
        {
            ser.BeginSection("Port1");
            ser.Sync("Wheel 1", ref wheel1);
            Port1.SyncState(ser);
            ser.EndSection();

            ser.BeginSection("Port2");
            ser.Sync("Wheel 2", ref wheel2);
            Port2.SyncState(ser);
            ser.EndSection();
        }
예제 #5
0
        public void SyncState(Serializer ser)
        {
            ser.BeginSection(nameof(Port1));
            Port1.SyncState(ser);
            ser.Sync(nameof(temp_wheel1), ref temp_wheel1);
            ser.EndSection();

            ser.BeginSection(nameof(Port2));
            ser.Sync(nameof(temp_wheel2), ref temp_wheel2);
            Port2.SyncState(ser);
            ser.EndSection();
        }
예제 #6
0
        public void Render(RenderContext context)
        {
            if (!PortPainter2Guid.Equals(Guid.Empty))
            {
                Point startPoint = Port1.GetConnectionPoint();
                Point endPoint   = Port2.GetConnectionPoint();

                if (IsSelected())
                {
                    lines.LinesColor = Colors.Red;
                }
                else
                {
                    lines.LinesColor = Colors.Black;
                }

                lines.Render(context);

                if (IsSelected())
                {
                    RectanglePainter rectangle = new RectanglePainter();
                    rectangle.Width           = 10;
                    rectangle.Height          = 10;
                    rectangle.Left            = startPoint.X - rectangle.Width / 2;
                    rectangle.Top             = startPoint.Y - rectangle.Height / 2;
                    rectangle.BackgroundColor = Colors.Blue;
                    rectangle.Render(context);

                    rectangle.Width           = 10;
                    rectangle.Height          = 10;
                    rectangle.Left            = endPoint.X - rectangle.Width / 2;
                    rectangle.Top             = endPoint.Y - rectangle.Height / 2;
                    rectangle.BackgroundColor = Colors.Blue;
                    rectangle.Render(context);
                    foreach (AnchorPoint point in anchors)
                    {
                        point.Render(context);
                    }
                }
            }
            else
            {
                Point startPoint = Port1.GetConnectionPoint();
                Point endPoint   = SecondPoint;

                context.DrawLine(startPoint.X, startPoint.Y, endPoint.X, endPoint.Y, LineColor);
            }
        }
 public int ReadPot2(IController c, int pot)
 {
     return(Port2.Read_Pot(c, pot));
 }
 private void clear(Port2 key)
 {
     ports[2] &= (Byte)key;
 }
 public byte ReadPort2(IController c)
 {
     return(Port2.Read(c));
 }
예제 #10
0
파일: Connection.cs 프로젝트: ZHJEE/OpenTAP
 /// <summary>
 /// Returns a string representation of this connection which names the ports in each end.
 /// </summary>
 public override string ToString()
 {
     if (String.IsNullOrWhiteSpace(Name))
     {
         return(String.Format("{0} <-> {1}", Port1 != null ? Port1.ToString() : "N/A", Port2 != null ? Port2.ToString() : "N/A"));
     }
     else
     {
         return(Name);
     }
 }
예제 #11
0
        public byte ReadPort2(IController c, bool leftMode, bool updateWheel)
        {
            wheel2 = Port2.UpdateWheel(c);

            return(Port2.Read(c, leftMode, updateWheel, temp_wheel2));
        }
 public byte ReadFire2_2x(IController c)
 {
     return(Port2.ReadFire2x(c));
 }
예제 #13
0
 public byte ReadPort2(IController c, bool left_mode)
 {
     return(Port2.Read(c, left_mode));
 }
예제 #14
0
 public bool GetPin_c2(IController c)
 {
     return(Port2.PinStateGet(c));
 }
예제 #15
0
        public override void Draw()
        {
            if (!activated)
            {
                return;
            }
            Color GUIBackground = GUI.backgroundColor;

            GUI.backgroundColor = Style.Color;
            GUILayout.BeginArea(Rect, Skin.box);
            GUILayout.Label("Root");
            GUILayout.EndArea();
            GUI.backgroundColor = GUIBackground;
            //mandatory
            if (Port0 != null)
            {
                Port0.rect.y = Rect.y + (Rect.height * 0.5f) - Port0.rect.height * 0.5f;
                Port0.rect.y = Rect.y + Rect.height / 3f;
                Port0.rect.x = Rect.x - Port0.rect.width + 16f;
                Port0.Draw();
                GUI.Label(new Rect(Port0.rect.xMax, Port0.rect.y, 100, 15), "Mandatory");
            }
            // quality
            if (Port1 != null)
            {
                Port1.rect.y = Rect.y + (Rect.height * 0.5f) - Port1.rect.height * 0.5f;
                Port1.rect.y = Rect.y + (Rect.height / 3f) * 2;
                Port1.rect.x = Rect.x - Port1.rect.width + 16f;
                Port1.Draw();
                GUI.Label(new Rect(Port1.rect.xMax, Port1.rect.y, 100, 15), "Quality");
            }
            //action
            if (Port2 != null)
            {
                Port2.rect.y = Rect.y + (Rect.height * 0.66f) - Port2.rect.height * 0.5f;
                Port2.rect.y = Rect.y + Rect.height / 2f;
                Port2.rect.x = Rect.x + Rect.width - 16f;
                Port2.Draw();
                GUI.Label(new Rect(Port2.rect.xMax - 55, Port2.rect.y, 50, 15), "Action");
            }

            // update
            if (Port0 != null)
            {
                if (Port0.Connections.Count > 0)
                {
                    MandatoryID = Port0.Connections[0].outputPort.MyNode.Id;
                }
                else
                {
                    MandatoryID = -1;
                }
            }
            if (Port1 != null)
            {
                if (Port1.Connections.Count > 0)
                {
                    QualityID = Port1.Connections[0].outputPort.MyNode.Id;
                }
                else
                {
                    QualityID = -1;
                }
            }
            if (Port2 != null)
            {
                if (Port2.Connections.Count > 0)
                {
                    Action = (Port2.Connections[0].outputPort.MyNode as ActionShell).Action;
                }
            }

            // sent
            OnUpdateRoot(MandatoryID, QualityID, Rect.position);
        }
 private void set(Port2 key)
 {
     ports[2] |= (Byte)key;
 }
예제 #17
0
 public byte ReadPort2_c2(IController c)
 {
     return(Port2.Read_p2_c2(c));
 }
예제 #18
0
 public void SetRegion(IController c, bool val)
 {
     Port1.RegionSet(c, val);
     Port2.RegionSet(c, val);
 }
예제 #19
0
 public void SetCounter_c2(IController c, int val)
 {
     Port2.CounterSet(c, val);
 }
예제 #20
0
 public void SetPin_c2(IController c, bool val)
 {
     Port2.PinStateSet(c, val);
 }
 public bool Is_LightGun2(IController c, out float lightgun_x, out float lightgun_y)
 {
     return(Port2.Is_LightGun(c, out lightgun_x, out lightgun_y));
 }
 public bool Is_2_button2(IController c)
 {
     return(Port2.Is_2_button(c));
 }