示例#1
0
    /// <summary>
    /// 音量渐渐变大
    /// </summary>
    /// <param name="movieStates"></param>
    /// <param name="isCycle"></param>
    /// <returns></returns>
    public IEnumerator BoxVolumeAdd(MovieStates movieStates, bool isCycle)
    {
        if (movieStates.movie_ip == "192.168.2.69")
        {
            UDPServer.Instance.SocketSendIP(movieStates.movie_ip, movieStates.movie_ip + "VOL15END");
            yield return(new WaitForSeconds(0.1f));

            if (isCycle)
            {
                UDPServer.Instance.SocketSendIP(movieStates.movie_ip, movieStates.movie_ip + "B" + movieStates.movie_file + "END");
            }
            else
            {
                UDPServer.Instance.SocketSendIP(movieStates.movie_ip, movieStates.movie_ip + "K" + movieStates.movie_file + "END");
            }
        }
        else
        {
            UDPServer.Instance.SocketSendIP(movieStates.movie_ip, movieStates.movie_ip + "VOL00END");
            int num = 1;

            yield return(new WaitForSeconds(0.5f));

            if (isCycle)
            {
                UDPServer.Instance.SocketSendIP(movieStates.movie_ip, movieStates.movie_ip + "B" + movieStates.movie_file + "END");
            }
            else
            {
                UDPServer.Instance.SocketSendIP(movieStates.movie_ip, movieStates.movie_ip + "K" + movieStates.movie_file + "END");
            }


            while (num <= 15)
            {
                string str = "";
                if (num >= 10)
                {
                    str = num.ToString();
                }
                else
                {
                    str = "0" + num.ToString();
                }
                yield return(new WaitForSeconds(0.15f));

                UDPServer.Instance.SocketSendIP(movieStates.movie_ip, movieStates.movie_ip + "VOL" + str + "END");
                num++;
            }
        }
    }
示例#2
0
    /// <summary>
    /// 单场景演绎
    /// </summary>
    /// <param name="go"></param>
    /// <param name="sceneState1"></param>
    public void OneJudge(GameObject go, SceneState1 sceneState1)
    {
        int num = go.GetComponent <SceneDeduce>().num;

        if (num > (sceneState1.phases.Count - 1))
        {
            return;
        }

        for (int k = 0; k < sceneState1.phases[num].LightState.Count; k++)
        {
            LightStates lightStates = sceneState1.phases[num].LightState[k];
            StartCoroutine(Play0nClick(lightStates));
        }
        ///需要控制的播控盒列表
        for (int k = 0; k < sceneState1.phases[num].MovieStates.Count; k++)
        {
            MovieStates movieStates = sceneState1.phases[num].MovieStates[k];

            if (movieStates.movie_file == "0000")
            {
                StartCoroutine(BoxVolumeSub(movieStates, movieStates.isCycle));
            }
            else
            {
                StartCoroutine(BoxVolumeAdd(movieStates, movieStates.isCycle));
                if (movieStates.movie_ip == "192.168.2.234")
                {
                    StartCoroutine(Baozha(24));
                }
            }
        }
        float yizi = 0;

        ///需要控制的投影仪列表
        for (int k = 0; k < sceneState1.phases[num].projectStates.Count; k++)
        {
            ProjectStates projectStates = sceneState1.phases[num].projectStates[k];
            if (projectStates.project_name.Length > 3)
            {
                UDPServer.Instance.SocketSendIP3(projectStates.project_ip, 6581, strToToHexByte(projectStates.project_name));
                yizi = 4.5f;
            }
            else
            {
                if (projectStates.project_name == "000")
                {
                    UDPServer.Instance.SocketSendIP2(projectStates.project_ip, 3012, "PauseProject");
                }
                else
                {
                    UDPServer.Instance.SocketSendIP2(projectStates.project_ip, 3012, "PlayProject " + projectStates.project_name);
                }
            }
        }

        if (num < sceneState1.phases.Count - 1)
        {
            go.transform.Find("Next").GetComponent <Item>().name = sceneState1.phases[num + 1].introduce;
        }

        if (!sceneState1.phases[num].isStop)
        {
            go.GetComponent <SceneDeduce>().times = 0;
            if (yizi != 0)
            {
                go.GetComponent <SceneDeduce>().timer = yizi;
            }
            else
            {
                go.GetComponent <SceneDeduce>().timer = sceneState1.phases[num].time;
            }
            go.GetComponent <SceneDeduce>().isStop = true;
        }
        else
        {
            go.GetComponent <SceneDeduce>().times  = 0;
            go.GetComponent <SceneDeduce>().isStop = false;
        }
        num++;
        go.GetComponent <SceneDeduce>().num = num;
    }
示例#3
0
    /// <summary>
    /// 全场景演绎浏览
    /// </summary>
    /// <param name="go"></param>
    /// <param name="sceneState1s"></param>
    public void Judge(GameObject go, List <SceneState1> sceneState1s)
    {
        bool isFinnish = true;
        int  a         = 0;

        if (go.GetComponent <ModuleControl>().step_inf.text == "")
        {
            a = go.GetComponent <ModuleControl>().num;
        }
        else
        {
            a = int.Parse(go.GetComponent <ModuleControl>().step_inf.text);
        }
        if (a == 0)
        {
            UDPServer.Instance.SocketSendIP3("192.168.2.85", 6581, Dispose.strToToHexByte("EB BE 00 01 00 00 00 00 00 00 00"));
            UDPServer.Instance.SocketSendIP3("192.168.2.85", 6581, Dispose.strToToHexByte("EB BE 00 04 01 00 09 00 00 00 00"));
        }
        #region

        int b         = 0;
        int scene_num = 0;
        int step_num  = 0;

        for (int i = 0; i < sceneState1s.Count; i++)
        {
            for (int j = 0; j < sceneState1s[i].phases.Count; j++)
            {
                if (b == a)
                {
                    if (j == sceneState1s[i].phases.Count - 1 && i != sceneState1s.Count - 1)
                    {
                        scene_num = i + 1;
                        step_num  = 0;
                    }
                    else if (j == sceneState1s[i].phases.Count - 1 && i == sceneState1s.Count - 1)
                    {
                        scene_num = i;
                        step_num  = j;
                    }
                    else
                    {
                        scene_num = i;
                        step_num  = j + 1;
                    }

                    isFinnish = false;
                    for (int k = 0; k < sceneState1s[i].phases[j].LightState.Count; k++)
                    {
                        LightStates lightStates = sceneState1s[i].phases[j].LightState[k];
                        StartCoroutine(Play0nClick(lightStates));
                    }
                    ///需要控制的播控盒列表
                    for (int k = 0; k < sceneState1s[i].phases[j].MovieStates.Count; k++)
                    {
                        MovieStates movieStates = sceneState1s[i].phases[j].MovieStates[k];

                        if (movieStates.movie_file == "0000")
                        {
                            StartCoroutine(BoxVolumeSub(movieStates, movieStates.isCycle));
                        }
                        else
                        {
                            StartCoroutine(BoxVolumeAdd(movieStates, movieStates.isCycle));
                            if (movieStates.movie_ip == "192.168.2.234")
                            {
                                StartCoroutine(Baozha(24));
                            }
                        }
                    }
                    float yizi = 0;
                    ///需要控制的投影仪列表
                    for (int k = 0; k < sceneState1s[i].phases[j].projectStates.Count; k++)
                    {
                        ProjectStates projectStates = sceneState1s[i].phases[j].projectStates[k];
                        if (projectStates.project_name.Length > 3)
                        {
                            UDPServer.Instance.SocketSendIP3(projectStates.project_ip, 6581, strToToHexByte(projectStates.project_name));
                            yizi = 4.5f;
                        }
                        else
                        {
                            if (projectStates.project_name == "000")
                            {
                                UDPServer.Instance.SocketSendIP2(projectStates.project_ip, 3012, "PauseProject");
                            }
                            else
                            {
                                UDPServer.Instance.SocketSendIP2(projectStates.project_ip, 3012, "PlayProject " + projectStates.project_name);
                            }
                        }
                    }

                    if (!sceneState1s[i].phases[j].isStop)
                    {
                        go.GetComponent <ModuleControl>().times = 0;
                        if (yizi != 0)
                        {
                            go.GetComponent <ModuleControl>().timer = yizi;
                        }
                        else
                        {
                            go.GetComponent <ModuleControl>().timer = sceneState1s[i].phases[j].time;
                        }
                        go.GetComponent <ModuleControl>().isStop = true;
                    }
                    else
                    {
                        go.GetComponent <ModuleControl>().times  = 0;
                        go.GetComponent <ModuleControl>().isStop = false;
                    }

                    go.GetComponent <ModuleControl>().scene_name.text = sceneState1s[i].scene;
                }
                b++;
            }
        }
        #endregion
        go.GetComponent <ModuleControl>().next_btn.GetComponent <Item>().name = sceneState1s[scene_num].phases[step_num].introduce;
        a++;
        if (isFinnish)
        {
            go.GetComponent <ModuleControl>().num             = 0;
            go.GetComponent <ModuleControl>().scene_name.text = "已经结束";
        }
        else
        {
            go.GetComponent <ModuleControl>().step_inf.text = a.ToString();
            go.GetComponent <ModuleControl>().num           = a;
        }
    }