コード例 #1
0
 private void UpdateText()
 {
     if (this.dis == null)
     {
         this.content = (LedDText)this.ledSub.SelectedContent;
         this.dis     = LedSubareaDisplayHolder.getMarqueeDisplayByContent(this.content);
         this.edgeDis = new EdgeDisplay(this.ledSub.SelectedContent.Edge, this.ledSub);
     }
     System.Drawing.Bitmap @new = this.dis.getNew();
     if (@new == null)
     {
         this.dis     = LedSubareaDisplayHolder.getMarqueeDisplayByContent(this.content);
         this.edgeDis = new EdgeDisplay(this.ledSub.SelectedContent.Edge, this.ledSub);
         @new         = this.dis.getNew();
     }
     lock (@new)
     {
         if (this.content.Edge.Enabled)
         {
             System.Drawing.Bitmap new2 = this.edgeDis.GetNew(@new);
             formMain.ReleasePicture(this.pictureBox1, LedSubareaDisplayHolder.Griding(new2, formDisplay.zoon));
         }
         else
         {
             formMain.ReleasePicture(this.pictureBox1, LedSubareaDisplayHolder.Griding(@new, formDisplay.zoon));
         }
     }
 }
コード例 #2
0
ファイル: formDisplay.cs プロジェクト: a532367171/LEDV6
 public void DisplayItem(LedItem pItem)
 {
     if (pItem == null)
     {
         return;
     }
     for (int i = 0; i < pItem.Subareas.Count; i++)
     {
         LedSubareaDisplayHolder ledSubareaDisplayHolder = new LedSubareaDisplayHolder(pItem.Subareas[i]);
         this.holderList.Add(ledSubareaDisplayHolder);
         this.Panel_Item.Controls.Add(ledSubareaDisplayHolder);
     }
     this.nowItem        = pItem;
     this.nowEdgeDisplay = new EdgeDisplay(pItem.Edge, pItem);
     if (this.nowItem.Edge.Enabled)
     {
         this.timer_ItemEdge.Start();
     }
     formDisplay.zoon = 1m;
 }
コード例 #3
0
 public LedSubareaDisplayHolder(LedSubarea pSubarea)
 {
     this.InitializeComponent();
     this.ledSub = pSubarea;
     this.ledSub.LoadFromFile();
     if (pSubarea.Type == LedSubareaType.Subtitle)
     {
         this.isMarquee = true;
         LedDText arg_39_0 = (LedDText)pSubarea.SelectedContent;
         this.timer_Text.Start();
     }
     else if (pSubarea.Type == LedSubareaType.PictureText)
     {
         this.isMarquee = true;
         this.timer_Marquee.Start();
     }
     else if (pSubarea.Type == LedSubareaType.Animation)
     {
         this.isMarquee    = true;
         this.isAnimation  = true;
         this.ledAnimation = (LedAnimation)pSubarea.SelectedContent;
         this.timer_Marquee.Start();
     }
     else
     {
         pSubarea.SelectedContent.LastDrawn = null;
         this.isMarquee           = false;
         this.timer_Draw.Interval = 1000;
         this.timer_Draw.Start();
     }
     if (pSubarea.SelectedContent != null && pSubarea.SelectedContent.Edge.Enabled && !this.isMarquee)
     {
         this.edgeDis = new EdgeDisplay(pSubarea.SelectedContent.Edge, pSubarea);
         this.timer_edge.Start();
     }
 }
コード例 #4
0
ファイル: FDGraph.cs プロジェクト: casrom/UnityPlayground
    // Update is called once per frame
    void Update()
    {
        if (prevPassageCount != passages.Count)
        {
            UpdateGraph();
        }

        //Repulsive Force
        foreach (Node v in nodes)
        {
            Vector3 fr = Vector3.zero;
            v.speed = Vector3.zero;
            foreach (Node u in nodes)
            {
                if (v != u)
                {
                    Vector3 v_pos = v.nodeObject.transform.localPosition;
                    Vector3 u_pos = u.nodeObject.transform.localPosition;
                    fr       = k * k / Vector3.Distance(v_pos, u_pos) * (v_pos - u_pos).normalized;
                    v.speed += fr;
                }
            }

            //Repulsive from curve controls
            foreach (EdgeDisplay eDisplay in edgeDisplays.Values)
            {
                Vector3 v_pos = v.nodeObject.transform.localPosition;
                Vector3 u_pos = eDisplay.control;
                fr = k * k / Vector3.Distance(v_pos, u_pos) * (v_pos - u_pos).normalized;
                if (float.IsNaN(fr.x))
                {
                    continue;
                }
                //Debug.Log(fr);
                v.speed += fr;
            }
        }

        //Attractive forces from connected nodes
        foreach (Edge e in edges)
        {
            Vector3 v_pos = e.v.nodeObject.transform.localPosition;
            Vector3 u_pos = e.u.nodeObject.transform.localPosition;
            Vector3 fa    = Vector3.SqrMagnitude(v_pos - u_pos) * (v_pos - u_pos).normalized / k * e.w;
            e.v.speed -= fa;
            e.u.speed += fa;
        }


        foreach (Node v in nodes)
        {
            //apply force assmue m = 1, a = f/m = f, dv = adt;
            v.speed -= v.nodeObject.transform.localPosition * centering;
            v.nodeObject.transform.localPosition += Mathf.Min(t, v.speed.magnitude * Time.deltaTime) * v.speed.normalized * .2f;

            v.nodeObject.transform.rotation = Quaternion.LookRotation(Vector3.forward);
        }

        if (cool)
        {
            t = Mathf.Max(0, t * .99f);
        }

        //For each passage draw a line


        foreach (RoomPassage p in edgeDisplays.Keys)
        {
            EdgeDisplay edgeDisplay = edgeDisplays[p];
            //edgeDisplay.srcPos =  roomNodes[p.src.room].nodeObject.transform.position + p.src.doorAnchor.direction / 80f;

            edgeDisplay.srcPos = roomNodes[p.src.room].doorAnchorObjects[p.src.doorAnchor].transform.position;

            edgeDisplay.srcHandle = edgeDisplay.srcPos + (edgeDisplay.srcPos - roomNodes[p.src.room].nodeObject.transform.position) * 3f;
            edgeDisplay.dstHandle = edgeDisplay.dstPos + (edgeDisplay.dstPos - roomNodes[p.dst.room].nodeObject.transform.position) * 3f;

            //edgeDisplay.dstPos =  roomNodes[p.dst.room].nodeObject.transform.position + p.dst.doorAnchor.direction / 80f;
            edgeDisplay.dstPos = roomNodes[p.dst.room].doorAnchorObjects[p.dst.doorAnchor].transform.position;
        }

        //for(int i = 0; i < edges.Count; i++) {
        //    LineRenderer l = lineList[i];
        //    l.startWidth = 0.002f;
        //    l.startWidth = 0.002f;
        //    l.SetPosition(0, edges[i].u.nodeObject.transform.position);
        //    l.SetPosition(1, edges[i].v.nodeObject.transform.position);
        //}



        if (focusMode)
        {
            RoomInfo activeRoomInfo = roomsManager.activeRoom.info;
            CenterRoomNode(activeRoomInfo);
        }


        //Interaction Logic
        if (!drag_mode)
        {
            foreach (Node n in roomNodes.Values)
            {
                n.display.Selected = false;
            }
            selectedNode = null;
        }

        RaycastHit hit;

        if (!m_rotateMode)
        {
            if (!drag_mode)
            {
                Ray ray = Camera.main.ScreenPointToRay(Mouse.current.position.ReadValue());
                if (Physics.Raycast(ray, out hit, 10.0f))
                {
                    if (hit.transform.GetComponent <NodeDisplay>() != null)
                    {
                        hit.transform.GetComponent <NodeDisplay>().Selected = true;
                        selectedNode = objNodeMap[hit.transform.gameObject];
                    }
                }
            }

            if (selectedNode != null && drag_mode)
            {
                Debug.Log(selectedNode);
                Vector2 mousePos  = Mouse.current.position.ReadValue();
                float   objZ      = Camera.main.WorldToScreenPoint(selectedNode.nodeObject.transform.position).z;
                Vector3 cursorPos = Camera.main.ScreenToWorldPoint(new Vector3(mousePos.x, mousePos.y, objZ));
                //Debug.Log(cursorPos);
                //cursorObjOffset = selectedNode.nodeObject.transform.position - cursorPos;
                if (cursorObjOffset != null)
                {
                    selectedNode.nodeObject.transform.position = cursorPos + cursorObjOffset;
                }
            }
        }

        if (m_rotateMode && !drag_mode)
        {
            transform.Rotate(Vector3.up, -Vector3.Dot(m_rotate, Vector3.right) * 0.2f, Space.World);
            transform.Rotate(Camera.main.transform.right, Vector3.Dot(m_rotate, Vector3.up) * 0.2f, Space.World);
        }
    }
コード例 #5
0
 private void timer_Marquee_Tick(object sender, EventArgs e)
 {
     if (!this.isAnimation && this.ledSub.Contents.Count == 0)
     {
         return;
     }
     if (this.dis == null)
     {
         this.nowMarqueeIndex = 0;
         if (this.isAnimation)
         {
             this.content = this.ledAnimation;
         }
         else
         {
             this.content = (LedPictureText)this.ledSub.Contents[0];
         }
         this.dis = LedSubareaDisplayHolder.getMarqueeDisplayByContent(this.content);
         if (this.ledSub != null && this.ledSub.Contents.Count > 1)
         {
             this.dis.NeedChangeContent = true;
         }
         this.edgeDis = new EdgeDisplay(this.content.Edge, this.ledSub);
     }
     System.Drawing.Bitmap @new = this.dis.getNew();
     if (@new == null)
     {
         if (this.isAnimation)
         {
             this.content = this.ledAnimation;
         }
         else
         {
             this.nowMarqueeIndex++;
             if (this.nowMarqueeIndex == this.ledSub.Contents.Count)
             {
                 this.nowMarqueeIndex = 0;
             }
             this.content = (LedPictureText)this.ledSub.Contents[this.nowMarqueeIndex];
         }
         this.dis = LedSubareaDisplayHolder.getMarqueeDisplayByContent(this.content);
         if (this.ledSub != null && this.ledSub.Contents.Count > 1)
         {
             this.dis.NeedChangeContent = true;
         }
         this.edgeDis = new EdgeDisplay(this.content.Edge, this.ledSub);
         @new         = this.dis.getNew();
     }
     if (@new != null)
     {
         lock (@new)
         {
             if (this.content.Edge.Enabled)
             {
                 System.Drawing.Bitmap new2 = this.edgeDis.GetNew(@new);
                 formMain.ReleasePicture(this.pictureBox1, LedSubareaDisplayHolder.Griding(new2, formDisplay.zoon));
             }
             else
             {
                 System.Drawing.Bitmap pBit = LedSubareaDisplayHolder.Griding(@new, formDisplay.zoon);
                 formMain.ReleasePicture(this.pictureBox1, pBit);
             }
         }
     }
 }