示例#1
0
    void UpdateStatusBar()
    {
        SystemGlobal sg = SystemGlobal.Instance;

        PlugFastenGlobal pfg = PlugFastenGlobal.Instance;

        bool nf = pfg.m_PlugCorrect;

        if (nf != m_OldFastenStatus)
        {
            if (nf)
            {
                sg.m_OpRecord.Add("线路连接正确");
            }
            else
            {
                sg.m_OpRecord.Add("线路连接错误");
            }
        }
        if (nf)
        {
            m_StatusBar.text = "线路连接正确";
        }
        else
        {
            m_StatusBar.text = "线路连接错误";
        }
        m_OldFastenStatus = nf;
    }
示例#2
0
    void UpdateFastener()
    {
        PlugFastenGlobal pfg = PlugFastenGlobal.Instance;


        for (int i = 0; i < 36; i++)
        {
            string str = i.ToString().PadLeft(2, '0');
            str = "Fastener" + str;
            Image go = GameObject.Find(str).GetComponent <Image>();

            go.sprite = m_Fastener_NC;
        }

        for (int i = 0; i < pfg.m_PlugStatus.Length; i++)
        {
            if (pfg.m_PlugStatus[i] == -1)
            {
                continue;
            }
            string str = pfg.m_PlugStatus[i].ToString().PadLeft(2, '0');
            str = "Fastener" + str;

            Image go = GameObject.Find(str).GetComponent <Image>();
            go.sprite = m_Fastener_C;
        }
    }
示例#3
0
    static private void Init(PlugFastenGlobal sg)
    {
        sg.m_FastenerPos = new Vector3[36];
        String fname;

        for (int i = 0; i < sg.m_FastenerPos.Length; i++)
        {
            fname = i.ToString().PadLeft(2, '0');
            fname = "Fastener" + fname;
            GameObject go = GameObject.Find(fname);
            sg.m_FastenerPos[i] = go.transform.position;

            Debug.Log("@" + sg.m_FastenerPos[i].x + "&" + sg.m_FastenerPos[i].y);
        }



        sg.m_PlugPos       = new Vector3[22];
        sg.m_Inited        = new bool[22];
        sg.m_PlugStatus    = new int[22];
        sg.m_PlugFastenNum = new int[8];
        for (int i = 0; i < sg.m_Inited.Length; i++)
        {
            sg.m_Inited[i] = false;
        }
        for (int i = 0; i < sg.m_PlugStatus.Length; i++)
        {
            sg.m_PlugStatus[i] = -1;
        }
    }
示例#4
0
    bool FastenCorrectly()
    {
        PlugFastenGlobal pfg = PlugFastenGlobal.Instance;

        pfg.m_PlugCorrect = pfg.CheckPlug();
        return(pfg.m_PlugCorrect);
    }
示例#5
0
    public void OnMouseUp()
    {
        m_MouseDown = false;
        PlugFastenGlobal pfg = PlugFastenGlobal.Instance;

        pfg.m_PlugCorrect = pfg.CheckPlug();
    }
示例#6
0
    void FixedUpdate()
    {
        if (m_MouseDown == true)
        {
            float x = 0, y = 0;
            x = Input.mousePosition.x;
            y = Input.mousePosition.y;
            Vector2 v;
            v.x = x - m_MouseOldX;
            v.y = y - m_MouseOldY;

            m_Pos = m_OldPos + v;



            PlugFastenGlobal pfg = PlugFastenGlobal.Instance;

            m_Pos.x += 6.5f;
            m_Pos    = pfg.Dock(Index, m_Pos);
            m_Pos.x -= 6.5f;

            pfg.m_PlugPos[Index] = m_Pos;

            transform.position = m_Pos;
        }



        Fasten();
    }
示例#7
0
    // Use this for initialization
    void Start()
    {
        SystemGlobal sg = SystemGlobal.Instance;

        PlugFastenGlobal pfg = PlugFastenGlobal.Instance;

        if (pfg.m_Inited[Index] == false)
        {
            pfg.m_PlugPos[Index] = transform.position;
            m_OriginalPos        = transform.position;
            //m_OriginalPos = transform.position;
            m_OldPos = transform.position;


            //transform.position = new Vector3(m_OriginalPos.x + m_Offset.x, m_OriginalPos.y + m_Offset.y, 0);
            pfg.m_Inited[Index] = true;
        }
        else
        {
            m_OriginalPos = pfg.m_PlugPos[Index];
            m_OldPos      = pfg.m_PlugPos[Index];
        }

        m_Pos = m_OldPos;

        transform.position = m_Pos;
    }
示例#8
0
    void UpDateLED(int i)
    {
        SystemGlobal sg = SystemGlobal.Instance;

        int port = 0;

        port = 6 * sg.m_DataPanelPage + i;

        PlugFastenGlobal pfg = PlugFastenGlobal.Instance;

        int plugnum = -1;

        for (int pn = 0; pn < pfg.m_PlugFastenNum.Length; pn++)
        {
            if (pfg.m_PlugFastenNum[pn] == port)
            {
                plugnum = pn;
                break;
            }
        }



        string str = (i + 1).ToString().PadLeft(2, '0');

        str = "LED" + str;
        GameObject go = GameObject.Find(str);


        if (go != null)
        {
            Text tx = go.GetComponent <Text>();

            if (plugnum != -1)
            {
                tx.text = GetLEDValue(plugnum, sg.m_ForceValue, sg.m_Type).ToString("F0");
                //tx.text = GetLEDValue(PortRemap(port), sg.m_ForceValue, sg.m_Type).ToString("F2");
            }
            else
            {
                tx.text = "0.00";
            }
        }
        str = (i + 1).ToString().PadLeft(2, '0');
        str = "LABEL" + str;
        go  = GameObject.Find(str);
        if (go != null)
        {
            Text tx = go.GetComponent <Text>();

            tx.text = (port + 1).ToString("F0");
        }
    }
    private void Record(int score)
    {
        SystemGlobal sg = SystemGlobal.Instance;

        System.DateTime Time = System.DateTime.Now;
        sg.m_SubmitDateTime = Time;
        sg.m_OpRecord.Add("\t" + Time.ToLongDateString() + "/" + Time.ToLongTimeString() + "\t 提交数据" + "数据得分:" + score);
        PlugFastenGlobal pg = PlugFastenGlobal.Instance;

        System.TimeSpan span = new System.TimeSpan();
        span = sg.m_SubmitDateTime - sg.m_StartDateTime;

        sg.m_OpRecord.Add("\t" + Time.ToLongDateString() + "/" + Time.ToLongTimeString() + "\t 提交数据" + "用时:" + span.TotalMinutes + "分钟");

        if (pg.m_PlugCorrect)
        {
        }
    }