Ejemplo n.º 1
0
 public void OnLeaveCenter()
 {
     if (!isCenter)
     {
         return;
     }
     //Debuger.LogWarning (string.Format("OnLeaveCenter{0}", chapterID));
     isCenter = false;
     if (sndIns != null)
     {
         KHAudioManager.RemoveSound(sndIns);
         sndIns = null;
     }
     HideAllJuanzhou();
     NGUITools.SetActive(goNeedDownload, false);
 }
Ejemplo n.º 2
0
    public void OnMoveToCenter()
    {
        if (isCenter)
        {
            return;
        }
        //Debuger.LogWarning (string.Format("OnMoveToCenter{0}", chapterID));
        isCenter = true;
        HideAllJuanzhou();
        KHAudioManager.PlaySound(9906);
        sndIns = KHAudioManager.PlaySound(40000 + _resourceChapterId);
        NGUITools.SetActive(juanzhou, true);
        UIPlayAnimation pa = AdapterHost.GetComponent <UIPlayAnimation>();

        pa.clipName      = string.Format("ChapterItemOnCenterAni{0}Enter", _resourceChapterId);
        pa.playDirection = AnimationOrTween.Direction.Forward;
        pa.Play(true, false);

        DuplicateModel model = KHPluginManager.Instance.GetPluginByName(DuplicatePlugin.pluginName).Model as DuplicateModel;

        model.CurChapterID = _chapterID;

        if (ExpandPackManager.isValid(1, _resourceChapterId))
        {
            NGUITools.SetActive(goNeedDownload, false);
        }
        else
        {
            NGUITools.SetActive(goNeedDownload, true);
            if (ExpandPackManager.isNeedUpdate(1, _resourceChapterId))
            {
                lblNeedDonwload.text = "需更新扩展包";
            }
            else
            {
                lblNeedDonwload.text = "需下载扩展包";
            }
        }

        if (_isShowScrollEx)
        {
            scrollExComp.PlayEnterAnim();
        }
    }
Ejemplo n.º 3
0
        void UpdateActorPrefabSet(int actorId, NinjaData aInfo, Transform targetPos)
        {
            if (aInfo == null)
            {
                Debuger.LogWarning("ActorInfo is null, actorId:" + actorId);
                return;
            }
            if (curActorObj != null && targetPos != null)
            {
                curActorObj.transform.parent        = targetPos;
                curActorObj.transform.localPosition = Vector3.zero;
                curActorObj.transform.localScale    = Vector3.one;
                curActorObj.transform.localRotation = Quaternion.identity;
                curActorObj.layer = 5;
                SpriteRenderer sprRender = curActorObj.GetComponent <SpriteRenderer>();
                if (sprRender != null && sprRender.sprite != null)
                {
                    if (this.CurActorSandAni != null)
                    {
                        // 将喇叭定位到idle帧的高度位置
                        this.CurActorSandAni.transform.localPosition = new Vector3(-sprRender.sprite.rect.width / 2, sprRender.sprite.rect.height - 25, 0);
                    }
                }

                SpriteRenderer[] sprRenders = curActorObj.GetComponentsInChildren <SpriteRenderer>(true);
                if (sprRenders != null)
                {
                    for (int i = 0; i < sprRenders.Length; ++i)
                    { // 根据白天/黑夜修改角色颜色
                        if (sprRenders[i] != null)
                        {
                            sprRenders[i].color = this.ActorColorMask;
                        }
                    }
                }
                UIEventListener.Get(targetPos.gameObject).onClick = (GameObject go) =>
                {
                    Debuger.Log("点击忍者");

                    if (aInfo.audioId == null || aInfo.audioId == "0.0")
                    {
                        aInfo.audioId = "9003";
                    }
                    bool canPlay = true;
                    if (curActorSnd != null && curActorSnd.EventInst != null)
                    {
                        FMOD.Studio.PLAYBACK_STATE stat;
                        if (FMOD.RESULT.OK == curActorSnd.EventInst.getPlaybackState(out stat) && stat != FMOD.Studio.PLAYBACK_STATE.STOPPED)
                        {
                            canPlay = false;
                        }
                    }

                    if (canPlay)
                    {
                        int audioId;
                        if (int.TryParse(aInfo.audioId, out audioId))
                        {
                            curActorSnd = KHAudioManager.PlaySound(audioId);
                        }
                        if (this.CurActorSandAni != null)
                        {
//                             curActorSndAni.gameObject.SetActive(true);
//                             curActorSndAni.ResetTrigger("beginTalk");
//                             curActorSndAni.SetTrigger("beginTalk");
                        }
                    }
                };
            }
        }