public bool SetNpoEntity(PeEntity entity)
    {
        if (!_initialized)
        {
            return(false);
        }

        PeScenarioEntity pse = entity.gameObject.GetComponent <PeScenarioEntity>();

        if (pse != null)
        {
            npoId     = pse.spawnPoint.ID;
            npoEntity = entity;

            npcSpeechBox.SetNpcInfo(npoEntity.ExtGetName(), npoEntity.ExtGetFaceIconBig());
            return(true);
        }
        else
        {
            if (entity == CreatureMgr.Instance.mainPlayer)
            {
                npoId     = -1;
                npoEntity = entity;
                BiologyViewCmpt viewCmpt = npoEntity.biologyViewCmpt;
                Texture2D       big_head = PeViewStudio.TakePhoto(viewCmpt, 150, 150, PeViewStudio.s_HeadPhotoPos, PeViewStudio.s_HeadPhotoRot);
                npcSpeechBox.SetNpcInfo(npoEntity.ExtGetName(), big_head);
            }
        }

        return(false);
    }
    public bool SetObject(OBJECT obj)
    {
        if (!_initialized)
        {
            return(false);
        }

        npoEntity = PeScenarioUtility.GetEntity(obj);

        if (npoEntity != null)
        {
            npoId = obj.Id;

            if (npoEntity == CreatureMgr.Instance.mainPlayer)
            {
                BiologyViewCmpt viewCmpt = npoEntity.biologyViewCmpt;
                Texture2D       big_head = PeViewStudio.TakePhoto(viewCmpt, 150, 150, PeViewStudio.s_HeadPhotoPos, PeViewStudio.s_HeadPhotoRot);
                npcSpeechBox.SetNpcInfo(npoEntity.ExtGetName(), big_head);
            }
            else
            {
                npcSpeechBox.SetNpcInfo(npoEntity.ExtGetName(), npoEntity.ExtGetFaceIconBig());
            }

            return(true);
        }
        else
        {
            npoId = -1;
            npcSpeechBox.SetNpcInfo("", "Null");
        }

        return(false);
    }
예제 #3
0
    public void TakeRoleHerderTexture()
    {
        if (selectedIndex != -1 && selectedIndex < Roles.Length && modeInfoList[selectedIndex].mMode != null)
        {
//			RoleHerderTexture.SetTexture( PhotoStudio.Instance.TakePhoto(modeInfoList[selectedIndex].mMode, modeInfoList[selectedIndex].mRoleInfo.sex ) );
            PeViewStudio.TakePhoto(modeInfoList[selectedIndex].mMode, 64, 64, PeViewStudio.s_HeadPhotoPos, PeViewStudio.s_HeadPhotoRot);
        }
    }
예제 #4
0
 void Awake()
 {
     if (_self != null)
     {
         throw new Exception("Only one viewStudio is exist");
     }
     _self = this;
     _photoController.gameObject.SetActive(false);
 }
예제 #5
0
 public override void OnCreate()
 {
     base.OnCreate();
     _viewController = PeViewStudio.CreateViewController(ViewControllerParam.DefaultCharacter);
     _viewController.SetLocalPos(PeViewStudio.s_ViewPos);
     _viewController.name = "ViewController_Servant";
     _viewController.gameObject.SetActive(false);
     InitGrid();
 }
예제 #6
0
    void InitBodyCamera()
    {
        //mTakeEqPhotho = new TakeEquipmentPhoto();
        //mTakeEqPhotho.Init(new Vector3(-300, -1000, -2000));

        _viewController = PeViewStudio.CreateViewController(ViewControllerParam.DefaultCharacter);
        _viewController.SetLocalPos(PeViewStudio.s_ViewPos);
        _viewController.name = "ViewController_NPCEquip";
        //_viewController.gameObject.SetActive(false); // this is invoked in Start, _viewController should be active.
        UpdateBodyCamera();
    }
예제 #7
0
 private CustomCharactor.CustomData CreateCustomData()
 {
     CustomCharactor.CustomData customData = new CustomCharactor.CustomData();
     customData.headIcon = PeViewStudio.TakePhoto(mCurrent.gameObject, 64, 64, PeViewStudio.s_HeadPhotoPos, PeViewStudio.s_HeadPhotoRot);
     byte[] buf = mCurrent.mAppearData.Serialize();
     customData.appearData = new AppearData();
     customData.appearData.Deserialize(buf);
     customData.sex            = (Sex == ESex.Male) ? CustomCharactor.ESex.Male : CustomCharactor.ESex.Female;
     customData.nudeAvatarData = new CustomCharactor.AvatarData(mCurrent.mNude);
     return(customData);
 }
예제 #8
0
    public override void OnCreate()
    {
        base.OnCreate();
        _viewController = PeViewStudio.CreateViewController(ViewControllerParam.DefaultCharacter);
        _viewController.SetLocalPos(PeViewStudio.s_ViewPos);
        _viewController.name = "ViewController_Player";
        _viewController.gameObject.SetActive(false);
        InitGrid();

        if (MainPlayerCmpt.gMainPlayer != null)
        {
            MainPlayerCmpt.gMainPlayer.onDurabilityDeficiency += DurabilityDeficiencyTip;
        }
    }
예제 #9
0
    IEnumerator UpdateModelIterator()
    {
        waitingToCloneModel = true;
        if (null != viewCmpt)
        {
            _meshControllers = viewCmpt.GetComponentsInChildren <WhiteCat.CreationController>();

            if (null != _meshControllers)
            {
                for (int i = 0; i < _meshControllers.Length; i++)
                {
                    if (_meshControllers[i] != null && !_meshControllers[i].isBuildFinished)
                    {
                        //lz-2016.09.07 如果有ISO,并且每创建完成,就等待创建完成
                        yield return(null);

                        i--;
                    }
                }
            }
            _meshControllers = null;
            //lz-2016.09.14 克隆前需要等一帧,克隆后不需要等了
            yield return(null);

            //lz-2016.09.07 克隆新模型,刷新SkinnedMeshRenderer
            _newViewModel = PeViewStudio.CloneCharacterViewModel(viewCmpt);
            if (_newViewModel)
            {
                _newViewModel.transform.position = new Vector3(0, -1000, 0);
                var renderer = _newViewModel.GetComponent <SkinnedMeshRenderer>();
                renderer.updateWhenOffscreen = true;
            }
        }
        if (_newViewModel)
        {
            if (_viewModel != null)
            {
                Destroy(_viewModel);
            }
            _viewModel = _newViewModel;
            _viewController.SetTarget(_viewModel.transform);
            mEqTex.GetComponent <WhiteCat.UIViewController>().Init(_viewController);
            mEqTex.mainTexture = _viewController.RenderTex;
            mEqTex.enabled     = true;
            _newViewModel      = null;
        }
        waitingToCloneModel = false;
    }
예제 #10
0
        Texture TakePhoto()
        {
            BiologyViewCmpt v = Entity.biologyViewCmpt;

            if (v == null /*|| v.modelTrans == null*/) //lz-2016.07.23 PeViewStudio.TakePhoto 里面处理了没有模型的情况,这里不用返回
            {
                return(null);
            }

            CommonCmpt c = Entity.commonCmpt;

            if (c == null)
            {
                return(null);
            }

            return(PeViewStudio.TakePhoto(v, 64, 64, PeViewStudio.s_HeadPhotoPos, PeViewStudio.s_HeadPhotoRot));//PhotoStudio.Instance.TakePhoto(v.modelTrans.gameObject, (int)c.sex);
        }
예제 #11
0
    void UpdateBodyCamera()
    {
        if (m_RefNpc == null || NpcEquipment == null || m_NpcCmpt == null)
        {
            m_NpcTex.enabled = false;
            return;
        }

        if (_viewModel != null)
        {
            Destroy(_viewModel);
        }
        _viewModel = PeViewStudio.CloneCharacterViewModel(m_ViewCmpt);
        if (_viewModel != null)
        {
            _viewController.SetTarget(_viewModel.transform);
        }

        m_NpcTex.mainTexture = _viewController.RenderTex;
        m_NpcTex.GetComponent <WhiteCat.UIViewController>().Init(_viewController);

        m_NpcTex.enabled = true;
    }
예제 #12
0
    /// <summary>
    /// 在 update 中调用.
    /// 检查到需要更新时, 先判断角色装备是否创建完整, 在创建完成后复制模型, 然后延迟一帧应用模型
    /// </summary>
    void UpdateModel()
    {
        if (waitingToCloneModel)
        {
            if (!_newViewModel)
            {
                if (_meshControllers != null)
                {
                    for (int i = 0; i < _meshControllers.Length; i++)
                    {
                        if (_meshControllers[i] != null && !_meshControllers[i].isBuildFinished)
                        {
                            return;
                        }
                    }
                    _meshControllers = null;
                }

                if (_delay == 0)
                {
                    _newViewModel = PeViewStudio.CloneCharacterViewModel(viewCmpt);
                    //lz-2016.10.11 有可能为空【错误 #3973】
                    if (null != _newViewModel)
                    {
                        _newViewModel.transform.position = new Vector3(0, -1000, 0);
                        var renderer = _newViewModel.GetComponent <SkinnedMeshRenderer>();
                        renderer.updateWhenOffscreen = true;
                        _delay = 0;
                    }
                }
                else
                {
                    _delay--;
                    return;
                }
            }

            if (_newViewModel)
            {
                if (_delay == 0)
                {
                    if (_viewModel != null)
                    {
                        Destroy(_viewModel);
                    }
                    _viewModel = _newViewModel;
                    _viewController.SetTarget(_viewModel.transform);

                    mEqTex.GetComponent <WhiteCat.UIViewController>().Init(_viewController);
                    bone2DObjects.Init(_viewController, _viewModel, playerArmorCmpt);

                    mEqTex.mainTexture = _viewController.RenderTex;

                    _newViewModel = null;
                    StopRefreshEquipment();
                }
                else
                {
                    _delay--;
                    return;
                }
            }
        }
    }