public void OnLoad()
        {
            AnimationPlayer = new AnimationPlayer();
            CurveEditor     = new AnimationControl();

            CurveEditor.OnLoad();
            CurveEditor.BackColor           = System.Drawing.Color.FromArgb(40, 40, 40, 40);
            AnimationPlayer.OnFrameChanged += delegate
            {
                if (CurveEditor.CurrentFrame != (int)AnimationPlayer.CurrentFrame)
                {
                    CurveEditor.CurrentFrame = (int)AnimationPlayer.CurrentFrame;
                }
            };

            CurveEditor.OnFrameChanged += delegate {
                if (AnimationPlayer.CurrentFrame != CurveEditor.CurrentFrame)
                {
                    AnimationPlayer.SetFrame(CurveEditor.CurrentFrame);
                }
            };
            CurveEditor.OnFrameCountChanged += delegate {
                AnimationPlayer.FrameCount = CurveEditor.FrameCount;
            };
        }
Exemple #2
0
    protected void Awake()
    {
        if (m_OneGroupCard == null || m_ShuffleCardRoot == null)
        {
            Debug.LogError("Some ui element was null in ShuffleAnimation script, please check it!");
            return;
        }

        this.m_AnimationControl = GetComponent <AnimationControl>();
        this.m_AnimationControl.AnimationName = "ShuffleAnimation";
        //this.m_AnimationControl.speed = 1f;
        this.m_AnimationControl.AniPlayStyle = AnimationControl.PlayStyle.Once;

        // 第二段 飞牌动画的偏移时间
        // 第一段动画总共时间:动画间隔 + 动画时长 + 0.1
        float offsetTime = m_CardInterval * CardMax * 2 + shangDisPlayTime + zhongDisplayTime + 0.1f;

        for (int index = 0; index < CardMax; index++)
        {
            GameObject go = Instantiate(m_OneGroupCard);
            go.name = string.Format("CardGroup ({0})", index + 1);
            Utility.ReSetTransform(go.transform, m_ShuffleCardRoot);
            go.transform.localPosition = new Vector3(0, index * SpaceY, 0);
            go.SetActive(true);
            InitOneLeftAnimationPath(go.transform.Find("LeftItem"), index, offsetTime);
            InitRightAnimationPath(go.transform.Find("RightItem"), index, offsetTime);
        }

        this.m_AnimationControl.AnimationTime = offsetTime + 0.3f + 0.5f;
    }
    public override void onSkill()
    {
        List <GameObject> players = findRemainEnemys();

        FightScene.instance.audioController.SoundPlay(AudioEunm.fiveThunder);
        for (int i = 0; i < players.Count; ++i)
        {
            PlayerAttribute attr = players[i].GetComponent <PlayerAttribute>();
            // 减少当前生命值的50%(向上取整)
            attr.ChangeHp(-Mathf.Floor(attr.hp / 2));
            PlayerChildren children = players[i].GetComponent <PlayerChildren>();
            children.thunder.SetActive(true);
            if (attr.isDied)
            {
                AnimationControl anim = players[i].GetComponent <AnimationControl>();
                anim.Death();
                PlayerAction action = players[i].GetComponent <PlayerAction>();
                action.AfterDeath();
                if (RoomData.isMainRole(attr.seat))
                {
                    FightScene.instance.audioController.SoundPlay(AudioEunm.death);
                }
                FightScene.instance.AddDeath(attr.seat, attr.bounces);
            }
        }
    }
Exemple #4
0
	// Use this for initialization
	void Start () 
    {
        //动画控制器
        anictr = GetComponent<AnimationControl>();
        //导航控制器
        navctr = GetComponent<NavControlActor>();
        //弹药
        anictr.baseActor.info.m_GunList[anictr.baseActor.info.useGunIndex].info.curCount = anictr.baseActor.info.m_GunList[anictr.baseActor.info.useGunIndex].info.count;
        
        //ai配置
        deploy.USER_INFO userinfo = GameConfig.Instance.userInfoData.GetData((int)anictr.baseActor.info.guid);
        deploy.USER_AI aiinfo = GameConfig.Instance.userAIData.GetData(userinfo.ai_id);
        ai.id = aiinfo.id;
        ai.type = (AI.Type)Enum.Parse(typeof(AI.Type), aiinfo.type);//字符串转枚举
        ai.angle = aiinfo.angle;//观察半角
        ai.view_distance = aiinfo.view_distance;//观察距离
        ai.chase_distance = aiinfo.chase_distance;//追击距离
        ai.chase_stay_time = aiinfo.chase_stay_time;//追击停留时间
        ai.attack_distance = aiinfo.attack_distance;//攻击距离
        ai.stop_distance = aiinfo.stop_distance;//停止距离        
        ai.attack_type = (AI.Attack_Type)Enum.Parse(typeof(AI.Attack_Type), aiinfo.attack_type);//字符串转枚举
        ai.attack_delta_time = aiinfo.attack_delta_time;//进攻间隔时间
        ai.accurate = aiinfo.accurate;//精准

        //频率
        if (anictr.baseActor.info.m_GunList[anictr.baseActor.info.useGunIndex].info.frequency == 0)
            fireControl.delta = 10000;
        else
        {
            if (ai.attack_delta_time > 0.0001f)
                fireControl.delta = ai.attack_delta_time;
            else
                fireControl.delta = 1.0f / anictr.baseActor.info.m_GunList[anictr.baseActor.info.useGunIndex].info.frequency;
        }            
	}
 // Use this for initialization
 void Start()
 {
     myRB    = GetComponent <Rigidbody>();
     myAir   = GetComponent <PlayerAir>();
     PSBoost = transform.Find("Effects").Find("PSBoost").GetComponent <BoostPSScript>();
     myAC    = GetComponentInChildren <AnimationControl>();
 }
Exemple #6
0
 private void Start()
 {
     this.mAnimation = base.GetComponent <Animation>();
     if (this.mAnimation == null)
     {
         UnityEngine.Object.Destroy(this);
     }
     AnimationControl.AddAnimation(this);
 }
Exemple #7
0
    /// <summary>
    /// 设置动画播放时间进度
    /// </summary>
    /// <param name="animation"></param>
    /// <param name="normal"></param>
    /// <returns></returns>
    private static bool SetNormalized(Animation animation, float normal)
    {
        AnimationState aniaNamePlaying = AnimationControl.GetAniaNamePlaying(animation);

        if (aniaNamePlaying == null)
        {
            return(false);
        }
        aniaNamePlaying.normalizedTime = Mathf.Clamp01(normal);
        return(true);
    }
Exemple #8
0
 public static void AddAnimationControl()
 {
     try
     {
         leftarm  = GameObject.Find("SceneRoot").transform.Find("ModelRoot/CMJ1/CMJ/钻头机械臂001").gameObject.AddComponent <AnimationControl>();
         rightarm = GameObject.Find("SceneRoot").transform.Find("ModelRoot/CMJ1/CMJ/钻头机械臂002").gameObject.AddComponent <AnimationControl>();
     }
     catch
     {
         Debug.LogError("添加AnimationControl时报错");
     }
 }
Exemple #9
0
        public PanelDisplay(int width, int height)
        {
            Width  = width;
            Height = height;

            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint | ControlStyles.Opaque, true);

            //setup the progressbar
            progressBar.Location = new Point(m_LeftPad, Height - 60);
            progressBar.Size     = new Size(Width - m_LeftPad - m_RightPad, 20);
            progressBar.Maximum  = 100;
            progressBar.Value    = 0;
            progressBar.Visible  = false;
            Controls.Add(progressBar);

            //setup the messageBox
            messageBox.Location   = new Point(m_LeftPad, m_HeaderHeight + m_TopPad + 20);
            messageBox.Multiline  = true;
            messageBox.Size       = new Size(Width - m_LeftPad - m_RightPad, 0);
            messageBox.ReadOnly   = true;
            messageBox.ScrollBars = RichTextBoxScrollBars.Vertical;
            messageBox.BackColor  = SystemColors.Window; //white
            messageBox.Visible    = false;
            Controls.Add(messageBox);

            //setup the animation list
            for (int i = 0; i < UpdateItems.Length; i++)
            {
                UpdateItems[i] = new UpdateItem
                {
                    AnimationWidth = 16,
                    Visible        = false,
                    Left           = 45
                };
                Controls.Add(UpdateItems[i].Animation);
                Controls.Add(UpdateItems[i].Label);
            }

            // the single centered animation
            aniWorking = new AnimationControl
            {
                Columns           = 18,
                Rows              = 1,
                AnimationInterval = 46,
                Visible           = false,
                Location          = new Point((Width / 2) - 25, (Height / 2)),
                StaticImage       = false,
                BaseImage         = UpdateItem.ProgressImage
            };

            Controls.Add(aniWorking);
        }
 /// <summary>
 /// 删
 /// </summary>
 /// <param name="aniaml"></param>
 /// <returns></returns>
 public static bool DelAniation(AnimationControl aniaml)
 {
     if (aniaml == null)
     {
         return(false);
     }
     if (ListAnimation.Contains(aniaml))
     {
         ListAnimation.Remove(aniaml);
         return(true);
     }
     return(false);
 }
Exemple #11
0
    private IEnumerator Step3()
    {
        AnimationControl animCon = AnimCon.GetComponent <AnimationControl>();

        //target damage animation & health adjusted

        animCon.Damage(2);
        GiveDamage(movePwr);

        yield return(new WaitForSeconds(animCon.dmg));

        StartCoroutine(Step4());
    }
Exemple #12
0
    private void Awake()
    {
        damaged = 1;

        player_transform = player.GetComponent <Transform>();
        cc = canvas.GetComponent <ConversationControl>();
        rb = GetComponent <Rigidbody>();
        ac = GetComponent <AnimationControl>();

        trigger  = false;
        chu_zhao = false;
        reset    = false;
    }
 /// <summary>
 /// 增
 /// </summary>
 /// <param name="aniaml"></param>
 /// <returns></returns>
 public static bool AddAnimation(AnimationControl aniaml)
 {
     if (aniaml == null)
     {
         return(false);
     }
     if (ListAnimation.Contains(aniaml))
     {
         return(false);
     }
     aniaml.mAnimation.enabled = bEnabeld;
     ListAnimation.Add(aniaml);
     return(true);
 }
Exemple #14
0
    public void AnimationSelector(string name, int currentNumber, int maxNumber)
    {
        if (currentNumber > maxNumber)
        {
            currentSelection = 0;
        }
        if (currentNumber < 0)
        {
            currentSelection = maxSelection;
        }

        foreach (Animator AnimationControl in AnimationControllers)
        {
            AnimationControl.SetInteger(animationIntName, currentSelection);
        }
    }
    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        _tmProRef            = transform.GetChild(0).GetComponent <TextMeshProUGUI>();
        _animatorRef         = GetComponent <Animator>();
        _animatorRef.enabled = false;
        _firstTime           = true;
    }
Exemple #16
0
    public void EndGame()
    {
        Pokemon1         p1      = Poke1.GetComponent <Pokemon1>();
        Pokemon2         p2      = Poke2.GetComponent <Pokemon2>();
        AnimationControl AnimCon = animCon.GetComponent <AnimationControl>();

        if (p1.currentHP <= 0 && p2.currentHP > 0)
        {
            AnimCon.Faint(1);
            Lose();
        }
        if (p2.currentHP <= 0 && p1.currentHP > 0)
        {
            AnimCon.Faint(2);
            Win();
        }
    }
 /// <summary>
 /// 设置动画启用 暂停
 /// </summary>
 /// <param name="bValue"></param>
 public static void SetAniamtionEnabled(bool bValue)
 {
     bEnabeld = bValue;
     for (int i = 0, len = ListAnimation.Count; i < len; i++)
     {
         AnimationControl anima = ListAnimation[i];
         if (anima == null || anima.mAnimation == null)
         {
             continue;
         }
         if (!bValue)
         {
             SetNormalized(anima.mAnimation, 0.1f);
         }
         anima.mAnimation.enabled = bValue;
     }
 }
Exemple #18
0
    public override void onSkill()
    {
        AnimationControl anim = GetComponent <AnimationControl>();

        anim.Attack();
        if (RoomData.isMainRole(playerAttribute.seat))
        {
            FightScene.instance.audioController.SoundPlay(AudioEunm.attack);
        }
        GameObject   light    = Instantiate(ResourcesTools.getLight(1));
        LightManager lightMgr = light.GetComponent <LightManager>();

        float speed = ((RoomData.room.Speed + playerAttribute.bounces * speedCoeff) > lightMgr.speedRange[lightMgr.speedRange.Length - 1]) ?
                      lightMgr.speedRange[lightMgr.speedRange.Length - 1] : (RoomData.room.Speed + playerAttribute.bounces * speedCoeff);

        lightMgr.Init(speed, RoomData.room.Count, gameObject);
        FightScene.instance.Lights.Add(light);
    }
Exemple #19
0
    private void Start()
    {
        if (!animControl)
        {
            animControl = GameObject.Find("Player").GetComponent <AnimationControl>();
        }

        if (!moveVelocity)
        {
            moveVelocity = GameObject.Find("Player").GetComponent <MoveVelocity>();
        }

        if (!playerShoot)
        {
            playerShoot = GameObject.Find("Player").GetComponent <Shoot>();
        }

        playerShoot.OnShoot += PlayerShoot_OnShoot;
    }
Exemple #20
0
 public PanelDisplay(int width, int height)
 {
     base.Width  = width - 14;
     base.Height = height - 150;
     SetStyle(ControlStyles.UserPaint | ControlStyles.Opaque | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, value: true);
     progressBar.Location = new Point(14, base.Height - 60);
     progressBar.Size     = new Size(base.Width - 14 - 14, 20);
     progressBar.Maximum  = 100;
     progressBar.Value    = 0;
     progressBar.Visible  = false;
     base.Controls.Add(progressBar);
     messageBox.Location   = new Point(14, 134);
     messageBox.Multiline  = true;
     messageBox.Size       = new Size(base.Width - 14 - 14, 0);
     messageBox.ReadOnly   = true;
     messageBox.ScrollBars = RichTextBoxScrollBars.Vertical;
     messageBox.BackColor  = SystemColors.Window;
     messageBox.Visible    = false;
     base.Controls.Add(messageBox);
     for (int i = 0; i < UpdateItems.Length; i++)
     {
         UpdateItems[i] = new UpdateItem
         {
             AnimationWidth = 16,
             Visible        = false,
             Left           = 45
         };
         UpdateItems[i].Label.ForeColor = Color.White;
         base.Controls.Add(UpdateItems[i].Animation);
         base.Controls.Add(UpdateItems[i].Label);
     }
     aniWorking = new AnimationControl
     {
         Columns           = 18,
         Rows              = 1,
         AnimationInterval = 46,
         Visible           = false,
         Location          = new Point(base.Width / 2 - 25, base.Height / 2),
         StaticImage       = false,
         BaseImage         = UpdateItem.ProgressImage
     };
     base.Controls.Add(aniWorking);
 }
Exemple #21
0
    /// <summary>
    /// 启用动画或禁止
    /// </summary>
    /// <param name="bValue"></param>
    public static void SetAniamtionEnabled(bool bValue)
    {
        AnimationControl.bEnabeld = bValue;
        int i     = 0;
        int count = AnimationControl.ListAnimation.Count;

        while (i < count)
        {
            AnimationControl animationControl = AnimationControl.ListAnimation[i];
            if (!(animationControl == null) && !(animationControl.mAnimation == null))
            {
                if (!bValue)
                {
                    AnimationControl.SetNormalized(animationControl.mAnimation, 0.1f);
                }
                animationControl.mAnimation.enabled = bValue;
            }
            i++;
        }
    }
Exemple #22
0
    private void Awake()
    {
        animControl = GetComponent <AnimationControl>();

        if (!gunEndPointTransform)
        {
            gunEndPointTransform = transform.Find("aim/endPoint");
        }

        if (!bulletFX)
        {
            bulletFX = transform.Find("aim/gun/bulletFX").GetComponent <ParticleSystem>();
        }

        if (EnableCrosshair)
        {
            hotSpot = new Vector2(cursorTexture.width / 2f, cursorTexture.height / 2f);
            Cursor.SetCursor(cursorTexture, hotSpot, cursorMode);
        }
    }
    // Use this for initialization
    void Start()
    {
        Current = this;

        carterAudio = GetComponent <AudioSource>();


        //motherlastPo = Vector3.zero;
        motherAgent = mother.GetComponent <NavMeshAgent>();
        sisterAgent = sister.GetComponent <NavMeshAgent>();
        fatherAgent = father.GetComponent <NavMeshAgent>();
        patrolIndex = Random.Range(0, patrolPoints.Length);
        //motherAgent.destination = patrolPoints[patrolIndex].transform.position;
        //moving = true;
        m_Animator = mother.GetComponent <Animator>();
        f_Animator = father.GetComponent <Animator>();
        s_Animator = sister.GetComponent <Animator>();


        //sisTurn = true;
    }
Exemple #24
0
    private IEnumerator Step2()
    {
        AnimationControl animCon = AnimCon.GetComponent <AnimationControl>();

        //attack animation
        if (pokeMove == "Thunder Shock")
        {
            animCon.Thundershock();

            yield return(new WaitForSeconds(animCon.thunder));

            StartCoroutine(DmgGap());
        }

        if (pokeMove == "Tackle")
        {
            animCon.Tackle();
            yield return(new WaitForSeconds(animCon.tackle));

            StartCoroutine(DmgGap());
        }
    }
 public void Repulse(float deltaTime)
 {
     if (!attr.isRepulse || attr.isDied)
     {
         return;
     }
     else
     {
         if ((curRepulseDistance + repulseSpeed * deltaTime) < repulseDistance)
         {
             curRepulseDistance += repulseSpeed * deltaTime;
             transform.Translate(repulseDirection * repulseSpeed * deltaTime, Space.World);
         }
         else
         {
             if (isRepulseWall)
             {
                 if (RoomData.isMainRole(attr.seat))
                 {
                     FightScene.instance.audioController.SoundPlay(AudioEunm.repulse);
                 }
                 attr.ChangeHp(attr.damage_repel);
                 if (attr.isDied)
                 {
                     AnimationControl anim = GetComponent <AnimationControl>();
                     anim.Death();
                     AfterDeath();
                     if (RoomData.isMainRole(attr.seat))
                     {
                         FightScene.instance.audioController.SoundPlay(AudioEunm.death);
                     }
                     FightScene.instance.AddDeath(attr.seat, attr.bounces);
                 }
             }
             attr.isRepulse = false;
         }
     }
 }
Exemple #26
0
    private IEnumerator Step2()
    {
        AnimationControl animCon = AnimCon.GetComponent <AnimationControl>();

        //attack animation
        if (pokeMove == "Bite")
        {
            animCon.Bite();

            yield return(new WaitForSeconds(animCon.bite));

            StartCoroutine(DmgGap());
        }

        if (pokeMove == "Scratch")
        {
            animCon.Scratch();

            yield return(new WaitForSeconds(animCon.scratch));

            StartCoroutine(DmgGap());
        }
    }
    private void AnimationSetup()
    {
        //anim = GetComponent<Animation>();

        //// 把walk和run动画放到同一层,然后同步他们的速度。  
        //anim["Walk"].layer = 1;
        //anim["Run"].layer = 1;
        //anim.SyncLayer(1);

        ////设置“跳跃”,“爬楼梯”,“下楼梯”的动画模式和速度  
        //anim["RunJump"].wrapMode = WrapMode.ClampForever;
        //anim["RunJump"].speed = 2;
        //anim["Ladder Up"].wrapMode = WrapMode.ClampForever;
        //anim["Ladder Up"].speed = 2;
        //anim["Ladder Down"].wrapMode = WrapMode.ClampForever;
        //anim["Ladder Down"].speed = 2;

        //初始化动画状态为Idle  
        //anim.CrossFade("Idle", 0.1f, PlayMode.StopAll);
        anictr = GetComponent<AnimationControl>();
        anictr.Stop();
    }
 private void Awake()
 {
     animControl = GetComponent <AnimationControl>();
     rbody       = GetComponent <Rigidbody2D>();
 }
 public void Init()
 {
     tran = ActorManager.Instance.controlActor.info.obj.transform;
     animationControl = ActorManager.Instance.controlActor.info.obj.GetComponent<AnimationControl>();
 }
Exemple #30
0
 public AnimationBase(AnimationControl animControl, int id) : base(id)
 {
     mAnimControl = animControl;
 }
Exemple #31
0
    // Update is called once per frame
    void Update()
    {
        /*if (FlowStart) //监听流程是否开始
         * {
         *  FlowStart = false;
         *  curMode = 1;
         *  FlowManage.PlayTransitVoice(1, "下面进入沙勿略问我环节。");
         * }*/

        if (canPlay) //语音合成完毕并生成音频后播放
        {
            canPlay = false;
            FlowManage.waveOutDevice = new WaveOutEvent();
            //waveOutDevice.PlaybackStopped += waveOutDevice_PlaybackStopped;
            FlowManage.audioFileReader = new AudioFileReader(voice_path + "/" + FlowManage.voicename + ".wav");
            FlowManage.waveOutDevice.Init(FlowManage.audioFileReader);
            FlowManage.waveOutDevice.Play();
            FlowManage.PlayModeAnimation();
            if (curMode == 1 && UserStartAnswer)
            {
                FlowManage.ShowQuestionInfo();
            }
        }
        if (FlowManage.waveOutDevice != null) //音频播放完毕后开始答题
        {
            if (UserStartAnswer)              //用户开始回答问题
            {
                if (FlowManage.waveOutDevice.PlaybackState == PlaybackState.Stopped)
                {
                    FlowManage.animName = AnimationControl.GetAnimationClipName(CharacterAction.Looking);
                    FlowManage.PlayModeAnimation();
                    UserStartAnswer = false;
                    Debug.Log("开始答题");
                    isAnswer = true;
                    if (FlowManage.waveOutDevice != null)
                    {
                        FlowManage.waveOutDevice.Dispose();
                        FlowManage.waveOutDevice = null;
                    }
                    if (FlowManage.audioFileReader != null)
                    {
                        FlowManage.audioFileReader.Close();
                        FlowManage.audioFileReader = null;
                    }
                    singleNar.StartRec();
                }
            }
            if (AnswerAnalysis) //沙勿略问我模式答题后给出答案解析
            {
                if (FlowManage.waveOutDevice.PlaybackState == PlaybackState.Stopped)
                {
                    if (FlowManage.waveOutDevice != null)
                    {
                        FlowManage.waveOutDevice.Dispose();
                        FlowManage.waveOutDevice = null;
                    }
                    if (FlowManage.audioFileReader != null)
                    {
                        FlowManage.audioFileReader.Close();
                        FlowManage.audioFileReader = null;
                    }
                    Debug.Log("完成答案解析,进入下一题");
                    AnswerAnalysis = false;
                    int questionNo = FlowManage.curNo;
                    questionNo++;
                    if (questionNo <= 3)
                    {
                        FlowManage.M2PMode(questionNo);
                    }
                    else
                    {
                        curMode = 2;
                        FlowManage.PlayTransitVoice(2, "下面进入我问沙勿略环节。");
                    }
                }
            }
            if (isTransit) //流程过渡播放声音
            {
                if (FlowManage.waveOutDevice != null)
                {
                    if (FlowManage.waveOutDevice.PlaybackState == PlaybackState.Stopped)
                    {
                        FlowManage.animName = AnimationControl.GetAnimationClipName(CharacterAction.Looking);
                        FlowManage.PlayModeAnimation();
                        if (FlowManage.waveOutDevice != null)
                        {
                            FlowManage.waveOutDevice.Dispose();
                            FlowManage.waveOutDevice = null;
                        }
                        if (FlowManage.audioFileReader != null)
                        {
                            FlowManage.audioFileReader.Close();
                            FlowManage.audioFileReader = null;
                        }
                        isTransit = false;
                        Debug.Log("完成过渡");
                        flow_change = true;
                    }
                }
            }
            if (FinishedAnswer) //我问沙勿略环节回答完毕
            {
                if (FlowManage.waveOutDevice.PlaybackState == PlaybackState.Stopped)
                {
                    if (FlowManage.waveOutDevice != null)
                    {
                        FlowManage.waveOutDevice.Dispose();
                        FlowManage.waveOutDevice = null;
                    }
                    if (FlowManage.audioFileReader != null)
                    {
                        FlowManage.audioFileReader.Close();
                        FlowManage.audioFileReader = null;
                    }
                    FinishedAnswer            = false;
                    FlowManage.canDistinguish = true;
                }
            }
            if (isFinished) //我问沙勿略环节结束
            {
                if (FlowManage.waveOutDevice.PlaybackState == PlaybackState.Stopped)
                {
                    if (FlowManage.waveOutDevice != null)
                    {
                        FlowManage.waveOutDevice.Dispose();
                        FlowManage.waveOutDevice = null;
                    }
                    if (FlowManage.audioFileReader != null)
                    {
                        FlowManage.audioFileReader.Close();
                        FlowManage.audioFileReader = null;
                    }
                    isFinished = false;
                    FlowManage.canDistinguish = true;
                    FlowStart = false;
                    init();
                }
            }
        }
        if (Input.GetMouseButtonDown(1))
        {
            if (!FlowStart)
            {
                FlowStart = true;
                curMode   = 1;
                FlowManage.PlayTransitVoice(1, "下面进入沙勿略问我环节。");
            }
        }

        if (isAnswer) //答题计时
        {
            answer_time += Time.deltaTime;
            if (answer_time >= 10)
            {
                isAnswer    = false;
                answer_time = 0f;
                singleNar.StopRec();
            }
        }
        if (curMode == 1 && successDistinguish)
        {
            FlowManage.StopAnswer();
            successDistinguish = false;
        }
        if (flow_change) //切换流程
        {
            flow_change = false;
            if (curMode == 1)
            {
                FlowManage.M2PMode(1);
            }
            else if (curMode == 2)
            {
                //AskMode = true;
                u.HideM2PAnswerPanel();
                u.ShowP2MAskPanel();
                FlowManage.canDistinguish = true;
                VoiceManage vm = new VoiceManage();
                vm.VoiceDistinguish();
                //nar.StartRec();
            }
        }
    }
Exemple #32
0
        private void LoadRedactor(string path, string name)
        {
            try
            {
                foreach (TabPage tab in RedactorsTabControl.TabPages)
                {
                    if (tab.Controls.Count == 1)
                    {
                        var redactor = tab.Controls[0] as IResourceControl;
                        if (redactor != null)
                        {
                            if (redactor.ResourcePath == path)
                            {
                                RedactorsTabControl.SelectedTab = tab;
                                return;
                            }
                        }
                    }
                }

                var     type    = Resource.GetType(path);
                Control control = null;
                switch (type)
                {
                case ResourceType.Texture: control = new TextureControl(path); break;

                case ResourceType.Sprite: control = new SpriteControl(path); break;

                case ResourceType.Ragdoll: control = new RagdollControl(path); break;

                case ResourceType.Animation: control = new AnimationControl(path); break;

                case ResourceType.Tool: control = new ToolControl(path); break;

                case ResourceType.Entity: control = new EntityControl(path); break;

                case ResourceType.Tile: control = new TileControl(path); break;

                case ResourceType.Event: control = new EventControl(path); break;

                case ResourceType.Outfit: control = new OutfitControl(path); break;

                default:
                    MessageBox.Show(this, "Resource [" + Resource.TypeToString(type) +
                                    "] redactor does not implemented!", "Warning!",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning); break;
                }

                if (control == null)
                {
                    return;
                }
                control.Dock = DockStyle.Fill;

                var page = new TabPage(name);
                page.ImageIndex = Resource.TypeToIcon(type);
                bool refresh = RedactorsTabControl.TabPages.Count == 0;
                RedactorsTabControl.TabPages.Add(page);

                page.Controls.Add(control);

                var iresource = control as IResourceControl;
                iresource.StateChanged += Redactor_StateChanged;

                RedactorsTabControl.SelectedTab = page;
                if (RedactorsTabControl.TabPages.Count == 1)
                {
                    RedactorsTabControl.SelectedTab.Text = iresource.ResourceName + (iresource.Saved ? "" : "*");
                    UndoToolStripMenuItem.Enabled        = iresource.UndoEnabled;
                    RedoToolStripMenuItem.Enabled        = iresource.RedoEnabled;
                    CloseToolStripMenuItem.Enabled       = true;
                    SaveToolStripMenuItem.Enabled        = !iresource.Saved;
                    SaveAsToolStripMenuItem.Enabled      = true;
                    CloseOthersToolStripMenuItem.Enabled = true;
                    ResourceToolStripMenuItem.DropDownItems.Clear();
                    ResourceToolStripMenuItem.DropDownItems.AddRange(iresource.MenuTabs);
                    ResourceToolStripMenuItem.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.ToString(), "Error: Can not load resource redactor [" + name + "].",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #33
0
 void Start()
 {
     aniControl   = GameObject.FindObjectOfType <AnimationControl>();
     audioControl = GameObject.FindObjectOfType <AudioControl>();
     spawning     = GameObject.FindObjectOfType <Spawning>();
 }