Example #1
0
    void OnMethodCallbackParams(TweenEvent dat)
    {
        if(audioSource) {
            float elapsed = dat.tween.elapsed;
            float frameRate = (float)dat.parms[0];
            float curFrame = frameRate * elapsed;
            float endFrame = frame + getNumberOfFrames(Mathf.RoundToInt(frameRate));

            //Debug.Log("audio t: "+elapsed+" play: " + curFrame + " end: " + endFrame);

            if(!loop && curFrame > endFrame) return;
            if(loop && audioSource.isPlaying && audioSource.clip == audioClip) return;

            audioSource.loop = loop;

            if(!dat.tween.isReversed)
                audioSource.time = (curFrame - ((float)frame)) / frameRate;
            else //TODO: not possible when we are playing the sequence in reverse, so whatever
                audioSource.time = 0.0f;

            audioSource.clip = audioClip;
            audioSource.pitch = 1.0f;

            audioSource.Play();
        }
    }
Example #2
0
    void OnMethodCallbackParams(TweenEvent dat)
    {
        //TODO: figure out a way to play the animation backwards...
        if(!dat.tween.isLoopingBack) {
            Animation anim = dat.parms[0] as Animation;
            if(anim != null && amClip != null) {
                float elapsed = dat.tween.elapsed;
                float frameRate = (float)dat.parms[1];
                float curFrame = frameRate * elapsed;
                float numFrames = getNumberOfFrames(Mathf.RoundToInt(frameRate));

                if(numFrames > 0.0f && curFrame > frame + numFrames) return;

                if(wrapMode != WrapMode.Default)
                    anim.wrapMode = wrapMode;

                if(crossfade) {
                    anim.CrossFade(amClip.name, crossfadeTime);
                }
                else {
                    anim.Play(amClip.name);
                }
            }
        }
    }
    void RevealChildren(TweenEvent tEvent)
    {
        float duration = tEvent.tween.duration;
        float elapsed = tEvent.tween.elapsed;
        GameObject screen = (GameObject)tEvent.parms[0];
        float newAlpha = elapsed / duration;

        SetAllChildrenAlpha(screen, newAlpha);
    }
Example #4
0
    private void OnMoveComplete(TweenEvent e)
    {
        Vector3 from = (Vector3)e.parms[0];
        Vector3 to = (Vector3)e.parms[1];

        OnMoveEnd(from, to);

        Moving = false;
    }
 private void OnNumAnimStart(TweenEvent e)
 {
     if (e.parms != null)
     {
         int num = (int)e.parms[0];
         this.mCDNumSprite.spriteName = string.Format("num{0}", num);
         this.mCDNumSprite.MakePixelPerfect();
     }
 }
 private void OnTweenFinished(TweenEvent callbackData)
 {
     if (callbackData.parms.Length > 0)
     {
         GUILongLinRewardItem gUILongLinRewardItem = (GUILongLinRewardItem)callbackData.parms[0];
         if (gUILongLinRewardItem != null)
         {
             gUILongLinRewardItem.Refresh();
         }
     }
     base.repositionNow = true;
 }
 public void doneMusicFade(TweenEvent tweenEvent)
 {
     AudioSource fadedTargetAudioSource = ((AudioSource)tweenEvent.parms[0]);
     if(fadedTargetAudioSource.volume < .1f && fadedTargetAudioSource != (musicFadeInTweener.target as AudioSource))
     {
         if(fadedTargetAudioSource.clip != null)
         {
             debugMusic("done music fade stoping music: " + fadedTargetAudioSource.clip.name);
             fadedTargetAudioSource.Stop();
         }
     }
     else
     {
         debugMusic("music Fade is done, but volume is above .1(" + fadedTargetAudioSource.volume + "} so wasnt killed.");
     }
 }
Example #8
0
    void OnMethodCallbackParams(TweenEvent dat)
    {
        if (dat.tween.isLoopingBack) return;
        AudioSource src = dat.parms[0] as AudioSource;
        if (src == null) return;

        Sequence seq = dat.tween as Sequence;
        if(seq != null)
            src.pitch = seq.timeScale;
        else
            src.pitch = 1f;

        if (oneShot) {
            src.PlayOneShot(audioClip);
        } else {
            if ((src.isPlaying && src.clip == audioClip)) return;
            src.loop = loop;
            src.clip = audioClip;
            src.Play();
        }
    }
Example #9
0
 private static void OnSliderCompl2(TweenEvent e)
 {
     if (e.parms != null)
     {
         UISlider uISlider = (UISlider)e.parms[0];
         UILabel uILabel = (UILabel)e.parms[1];
         float num = (float)e.parms[2];
         float p_duration = (float)e.parms[3];
         int num2 = (int)e.parms[4];
         uISlider.value = 0f;
         if (num2 != 0)
         {
             uILabel.text = GameUITools.mSb.Remove(0, GameUITools.mSb.Length).Append(0).Append("/").Append(num2).ToString();
         }
         else
         {
             uILabel.text = GameUITools.mSb.Remove(0, GameUITools.mSb.Length).Append("0%").ToString();
         }
         HOTween.To(uISlider, p_duration, new TweenParms().Prop("value", num).SpeedBased(false).OnUpdate(new TweenDelegate.TweenCallbackWParms(GameUITools.OnSliderUpdate), new object[]
         {
             uISlider,
             uILabel,
             num2
         }));
     }
 }
Example #10
0
 private static void OnSliderCompl(TweenEvent e)
 {
     if (e.parms != null)
     {
         UISlider uISlider = (UISlider)e.parms[0];
         UILabel uILabel = (UILabel)e.parms[1];
         uint num = (uint)e.parms[2];
         float num2 = (float)e.parms[3];
         float num3 = (float)e.parms[4];
         int num4 = (int)e.parms[5];
         uISlider.value = 0f;
         if (num4 != 0)
         {
             uILabel.text = GameUITools.mSb.Remove(0, GameUITools.mSb.Length).Append(0).Append("/").Append(num4).ToString();
         }
         else
         {
             uILabel.text = GameUITools.mSb.Remove(0, GameUITools.mSb.Length).Append("0%").ToString();
         }
         HOTween.To(uISlider, num3, new TweenParms().Prop("value", 1f).SpeedBased(false).OnUpdate(new TweenDelegate.TweenCallbackWParms(GameUITools.OnSliderUpdate), new object[]
         {
             uISlider,
             uILabel,
             num4
         }).Loops((int)(num - 1u), LoopType.Restart).OnComplete(new TweenDelegate.TweenCallbackWParms(GameUITools.OnSliderCompl2), new object[]
         {
             uISlider,
             uILabel,
             num2,
             num3,
             num4
         }));
     }
 }
Example #11
0
 void OnTrigger(TweenEvent dat)
 {
     mTarget.SequenceTrigger(this, (AMKey)dat.parms[0], (AMTriggerData)dat.parms[1]);
 }
Example #12
0
    void OnMethodCallbackParams(TweenEvent dat)
    {
        if(obj != null && obj.animation != null && amClip != null) {
            float elapsed = dat.tween.elapsed;
            float frameRate = (float)dat.parms[0];
            float curFrame = frameRate * elapsed;
            float numFrames = getNumberOfFrames(Mathf.RoundToInt(frameRate));

            if(numFrames > 0.0f && curFrame > frame + numFrames) return;

            Animation anm = obj.animation;

            if(wrapMode != WrapMode.Default)
                anm.wrapMode = wrapMode;

            if(crossfade) {
                anm.CrossFade(amClip.name, crossfadeTime);
            }
            else {
                anm.Play(amClip.name);
            }
        }
    }
 private void OnDealOneEndThenShowName(TweenEvent data)
 {
     UILabel uILabel = GameUITools.FindUILabel("Info", this.rewardsList[this.rewardsList.Count - 1]);
     UISprite uISprite = GameUITools.FindUISprite("rollRewardMask", this.rewardsList[this.rewardsList.Count - 1]);
     uILabel.color = this.itemNameColor;
     uILabel.gameObject.SetActive(true);
     uISprite.gameObject.SetActive(false);
     this.pv = false;
     if (data != null && data.parms != null)
     {
         if (this.baseSoulReliquaryLayer != null)
         {
             if ((int)data.parms[0] == this.count - 1)
             {
                 this.OnDealAnimEnd();
             }
         }
         else if (this.baseRewardLuckyDrawInfo != null && (int)data.parms[0] == this.count - 1)
         {
             this.OnDealAnimEnd();
         }
     }
 }
Example #14
0
 //allows the beam to appear and dissapear with hotween
 private void BeamAppDissapear(TweenEvent data) {
     LineRenderer beam = (LineRenderer)data.parms[0];
     beam.SetWidth(shotTempWidth, shotTempWidth);
 }
Example #15
0
 public void onUndoCompleteEvt(TweenEvent evt)
 {
     onUndoComplete();
 }
Example #16
0
    void OnMethodCallbackParams(TweenEvent dat)
    {
        Component comp = dat.parms[0] as Component;
        object[] parms = dat.parms[1] as object[];

        if(comp == null) return;

        cachedMethodInfo.Invoke(comp, parms);
    }
 private void musicCrossFadeComplete(TweenEvent tweenEvent)
 {
     debugMusic("Done with crossfade current music is now: " + currentMusicAudioSource.clip.name + " ,vol:" + currentMusicAudioSource.volume);//((AudioSource)tweenEvent.parms[0]).clip.name );
     /*if ( musicFadeOutTweener.isComplete && musicFadeInTweener.isComplete )
     {
     currentMusicAudioSource = ((AudioSource)tweenEvent.parms[0]);
     }*/
 }
Example #18
0
    void OnSequenceComplete(TweenEvent dat)
    {
        stopAudio();
        stopAnimations();

        if(dat.tween.autoKillOnComplete)
            mSequence = null;
        else if(loopBackToFrame >= 0 && dat.tween.loops == 1 && dat.tween.loopType == LoopType.Restart) {
            mSequence.GoTo(((float)loopBackToFrame) / ((float)frameRate));
            mSequence.Play();
            return;
        }

        if(sequenceCompleteCallback != null) {
            sequenceCompleteCallback(this);
        }
    }
 void SwitchSounds( TweenEvent tEvent )
 {
     PlaySound((AudioClip)tEvent.parms[0]);
 }
Example #20
0
    //only call method if elapse is within frame
    void OnMethodCallbackLimitFrame(TweenEvent dat)
    {
        if(component == null) return;

        float elapsed = dat.tween.elapsed;
        float frameRate = (float)dat.parms[0];
        float curFrame = frameRate * elapsed;

        if(curFrame > frame + getNumberOfFrames()) return;

        object[] parms = dat.parms.Length > 1 ? (object[])dat.parms[1] : null;

        if(useSendMessage) {
            if(parms == null || parms.Length == 0)
                component.gameObject.SendMessage(methodName, null, SendMessageOptions.DontRequireReceiver);
            else
                component.gameObject.SendMessage(methodName, parms[0], SendMessageOptions.DontRequireReceiver);
        }
        else {
            methodInfo.Invoke(component, parms);
        }
    }
Example #21
0
 private static void OnSliderUpdate(TweenEvent e)
 {
     if (e.parms != null)
     {
         UISlider uISlider = (UISlider)e.parms[0];
         UILabel uILabel = (UILabel)e.parms[1];
         int num = (int)e.parms[2];
         if (num == 0)
         {
             GameUITools.mSb.Remove(0, GameUITools.mSb.Length).Append(Mathf.Round(uISlider.value * 100f)).Append("%");
         }
         else
         {
             GameUITools.mSb.Remove(0, GameUITools.mSb.Length).Append(Mathf.Round(uISlider.value * (float)num)).Append("/").Append(num);
         }
         uILabel.text = GameUITools.mSb.ToString();
     }
 }
 private void DanceMoveEnd(TweenEvent e)
 {
     if (e.parms != null)
     {
         GUICostumePartyPlayerItem gUICostumePartyPlayerItem = (GUICostumePartyPlayerItem)e.parms[0];
         gUICostumePartyPlayerItem.Dance();
     }
 }
Example #23
0
 public void onExecuteCompleteEvt(TweenEvent evt)
 {
     onExecuteComplete();
 }
Example #24
0
 public void onTweenComplete(TweenEvent evt)
 {
     if (waitForEndOfTween)
     {
         myPlayer.callBackFromCommand();
     }
 }
 private void OnDanceEnd(TweenEvent e)
 {
     if (e.parms != null)
     {
         GUICostumePartyPlayerItem gUICostumePartyPlayerItem = (GUICostumePartyPlayerItem)e.parms[0];
         gUICostumePartyPlayerItem.DanceOver();
         if (!this.danceEnd)
         {
             this.danceEnd = true;
         }
         else
         {
             this.danceEnd = false;
             this.isDancing = false;
             this.DequeueDance();
         }
     }
 }
Example #26
0
 public void onUndoComplete(TweenEvent evt)
 {
     Transform target = sequencerData.targets [sequencerData.getIndexOfTarget(lastSelectedWho)].target.transform;
     target.gameObject.SetActive(wasActiveAtStart);
     if (waitForEndOfTween)
     {
         myPlayer.callBackFromCommand();
     }
 }
Example #27
0
 private void endTransfer(TweenEvent data)
 {
     current = current.Next;
     moving = false;
 }
Example #28
0
    void OnMethodCallbackParams(TweenEvent dat)
    {
        if(component == null) return;

        methodInfo.Invoke(component, dat.parms);
    }
    void LoadLevel(TweenEvent tEvent)
    {
        string level = tEvent.parms[0] as string;

        Application.LoadLevel(level);
    }
Example #30
0
 private void endTransfer(TweenEvent data)
 {
     moving = false;
 }