public void LoadChara(string path, float posX = 0f, float posY = 4000f, float cPosY = 0f, float cPosZ = 0f, bool useCamCont = true)
    {
        GameObject original = AssetDataMng.Instance().LoadObject(path, null, true) as GameObject;

        this.goChara  = UnityEngine.Object.Instantiate <GameObject>(original);
        this.cpParams = this.goChara.GetComponent <CharacterParams>();
        if (null != this.cpParams)
        {
            this.cpParams.SetBillBoardCamera(this.cam);
            this.cpParams.PlayAnimation(CharacterAnimationType.idle, SkillType.Attack, 0, null, null);
        }
        this.goChara.name = path;
        this.goChara.transform.SetParent(base.gameObject.transform);
        if (useCamCont)
        {
            if (null != this.cpParams)
            {
                this.cpParams.SetPreviewCamera(this.cam);
            }
        }
        else
        {
            this.goChara.transform.localPosition = new Vector3(0f, cPosY, cPosZ);
        }
        Quaternion localRotation = Quaternion.Euler(0f, -10f, 0f);

        this.goChara.transform.localRotation    = localRotation;
        base.gameObject.transform.localPosition = new Vector3(posX, posY, 0f);
        this.smrList = CommonRender3DRT.GetCompoSMR(this.goChara);
        if (this.smrList != null)
        {
            this.SetSMRUpdateFlag(this.smrList);
        }
    }
    public static List <SkinnedMeshRenderer> GetCompoSMR(GameObject go)
    {
        List <SkinnedMeshRenderer> list = new List <SkinnedMeshRenderer>();

        CommonRender3DRT.SearchCompoSMR(go, list);
        return(list);
    }
Exemplo n.º 3
0
    private void SetRender3Dcamera(bool isEgg, CommonRender3DRT render3DRT, bool isStroke)
    {
        Camera componentInChildren = render3DRT.GetComponentInChildren <Camera>();

        componentInChildren.fieldOfView = 30f;
        Transform transform = componentInChildren.transform;

        if (isStroke)
        {
            render3DRT.transform.localPosition = new Vector3(0f, 10000f);
            transform.localPosition           += new Vector3(0f, 0.75f, transform.localPosition.z);
        }
        else
        {
            componentInChildren.useOcclusionCulling = true;
            Transform transform2 = this.backgroundCamera.transform;
            if (!isEgg)
            {
                transform.localPosition    = this.digiCameraPos;
                transform.localEulerAngles = new Vector3(transform2.localEulerAngles.x, -155f);
            }
            else
            {
                transform.localPosition    = new Vector3(transform.localPosition.x, transform2.localPosition.y, transform.localPosition.z * 2f);
                transform.localEulerAngles = new Vector3(transform2.localEulerAngles.x, 0f);
            }
        }
    }
Exemplo n.º 4
0
    private CommonRender3DRT CreateRender3DRT(bool isEgg, string modelId, UITexture displayUiTex)
    {
        GameObject gameObject = GUIManager.LoadCommonGUI("Render3D/Render3DRT", null);

        gameObject.name = "DigiGarden3dStudio_" + this.charaActList.Count.ToString();
        CommonRender3DRT component = gameObject.GetComponent <CommonRender3DRT>();
        string           filePath  = MonsterObject.GetFilePath(modelId);

        if (!isEgg)
        {
            component.LoadChara(filePath, 0f, 4000f, 0f, 0f, true);
        }
        else
        {
            component.LoadEgg(filePath, 0f, 4000f, 0f);
        }
        gameObject = UnityEngine.Object.Instantiate <GameObject>(this.digiShadow.gameObject);
        GardenShadow component2 = gameObject.GetComponent <GardenShadow>();

        component2.Initialize(component.gameObject);
        RenderTexture mainTexture = component.SetRenderTarget(displayUiTex.width, displayUiTex.height, 16);

        displayUiTex.mainTexture = mainTexture;
        return(component);
    }
    private static void SearchCompoSMR(GameObject go, List <SkinnedMeshRenderer> smrL)
    {
        IEnumerator enumerator = go.transform.GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                object              obj       = enumerator.Current;
                Transform           transform = (Transform)obj;
                SkinnedMeshRenderer component = transform.gameObject.GetComponent <SkinnedMeshRenderer>();
                if (component != null)
                {
                    smrL.Add(component);
                }
                else
                {
                    CommonRender3DRT.SearchCompoSMR(transform.gameObject, smrL);
                }
            }
        }
        finally
        {
            IDisposable disposable;
            if ((disposable = (enumerator as IDisposable)) != null)
            {
                disposable.Dispose();
            }
        }
    }
Exemplo n.º 6
0
    private void InitOutline()
    {
        List <SkinnedMeshRenderer> compoSMR = CommonRender3DRT.GetCompoSMR(base.gameObject);

        this.matList    = CommonRender3DRT.GetAllMaterialsInSMRS(compoSMR);
        this.valueList  = CommonRender3DRT.GetOutlineWidth(this.matList);
        this.farmCamera = FarmRoot.Instance.Camera;
    }
Exemplo n.º 7
0
        public void SetCameraProjectionMatrix(CommonRender3DRT renderTextureCamera, float screenPositionOffsetY, float viewPositionOffsetX)
        {
            this.cameraPositionOffset    = Camera.main.ScreenToViewportPoint(new Vector3(0f, screenPositionOffsetY, 0f));
            this.cameraPositionOffset.x  = viewPositionOffsetX;
            this.defaultProjectionMatrix = renderTextureCamera.projectionMatrix;
            Matrix4x4 lhs = Matrix4x4.TRS(this.cameraPositionOffset, Quaternion.identity, Vector3.one);

            renderTextureCamera.projectionMatrix = lhs * this.defaultProjectionMatrix;
        }
 public void ReleaseCharacter()
 {
     if (this.csRender3DRT != null)
     {
         UnityEngine.Object.DestroyImmediate(this.csRender3DRT.gameObject);
         this.csRender3DRT            = null;
         this.renderTex               = null;
         this.ngTargetTex.mainTexture = null;
     }
 }
        public virtual void Initialize(Vector3 renderCameraPosition, int width, int height)
        {
            GameObject gameObject = GUIManager.LoadCommonGUI("Render3D/Render3DRT", null);

            this.renderTextureCamera = gameObject.GetComponent <CommonRender3DRT>();
            this.renderTextureCamera.transform.localPosition = renderCameraPosition;
            this.renderTextureCamera.SetRenderTarget(width, height, 16);
            this.storeUITexture.mainTexture = this.renderTextureCamera.GetRenderTarget();
            gameObject = this.renderTextureCamera.GetCameraGameObject();
            gameObject.transform.localPosition = Vector3.zero;
        }
Exemplo n.º 10
0
    private IEnumerator StrokingEgg(string userMonsterId, string eggModelId, Action <MonsterData> OnStroked)
    {
        PartsMenu.instance.gameObject.SetActive(false);
        foreach (PicturebookDetailController picturebookDetailController in this.eggControllerList)
        {
            picturebookDetailController.gameObject.SetActive(false);
        }
        this.MoveTo(this.modelUiTex.gameObject, this.fullScreenModelTexPos, 0.18f, iTween.EaseType.linear, null);
        this.ChangeDisplayModeToFullScreen();
        this.displayModeButtonLabel.transform.parent.gameObject.SetActive(false);
        this.strokeUiTex.gameObject.SetActive(true);
        this.isStrokeEnd = false;
        CommonRender3DRT render3DRT = this.CreateRender3DRT(true, eggModelId, this.strokeUiTex);

        this.SetRender3Dcamera(true, render3DRT, true);
        DigimonActionInGarden digimonAct = this.AttachActionScript(render3DRT.gameObject, true);

        digimonAct.transform.localPosition = Vector3.zero;
        digimonAct.transform.localScale    = new Vector3(2f, 2f, 2f);
        while (!this.isStrokeEnd)
        {
            yield return(null);
        }
        this.particle.SetActive(true);
        digimonAct.gameObject.SetActive(false);
        yield return(new WaitForSeconds(1.2f));

        UnityEngine.Object.Destroy(digimonAct.transform.parent.gameObject);
        MonsterData afterMonsterData = ClassSingleton <MonsterUserDataMng> .Instance.GetUserMonster(userMonsterId);

        render3DRT = this.CreateRender3DRT(false, afterMonsterData.GetMonsterMaster().Group.modelId, this.strokeUiTex);
        this.SetRender3Dcamera(false, render3DRT, true);
        DigimonActionInGarden newDigimonAct = this.AttachActionScript(render3DRT.gameObject, false);

        newDigimonAct.transform.localPosition = Vector3.zero;
        newDigimonAct.transform.localScale    = new Vector3(2f, 2f, 2f);
        yield return(new WaitForSeconds(2f));

        this.strokeUiTex.gameObject.SetActive(false);
        newDigimonAct.transform.parent.gameObject.SetActive(false);
        UnityEngine.Object.Destroy(newDigimonAct.transform.parent.gameObject);
        this.ChangeDisplayModeToList();
        this.MoveTo(this.modelUiTex.gameObject, this.listScreenModelTexPos, 0.18f, iTween.EaseType.linear, null);
        this.displayModeButtonLabel.transform.parent.gameObject.SetActive(true);
        this.isStrokeEnd = false;
        this.particle.SetActive(false);
        OnStroked(afterMonsterData);
        foreach (PicturebookDetailController picturebookDetailController2 in this.eggControllerList)
        {
            picturebookDetailController2.gameObject.SetActive(true);
        }
        PartsMenu.instance.gameObject.SetActive(true);
        yield break;
    }
 public virtual void SetRenderPos()
 {
     if (this.csRender3DRT != null)
     {
         UnityEngine.Object.DestroyImmediate(this.csRender3DRT.gameObject);
         this.csRender3DRT = null;
     }
     else
     {
         this.v3Chara = CMD_PartyEdit.instance.Get3DPos();
     }
 }
Exemplo n.º 12
0
        public static void ChangeMaterial(GameObject modelObject, List <Material[]> materialsList)
        {
            List <SkinnedMeshRenderer> compoSMR = CommonRender3DRT.GetCompoSMR(modelObject);

            if (compoSMR != null && compoSMR.Count == materialsList.Count)
            {
                for (int i = 0; i < compoSMR.Count; i++)
                {
                    compoSMR[i].materials = materialsList[i];
                }
            }
        }
Exemplo n.º 13
0
        public static void ResetRendering(GameObject modelObject)
        {
            List <SkinnedMeshRenderer> compoSMR = CommonRender3DRT.GetCompoSMR(modelObject);

            if (compoSMR != null)
            {
                for (int i = 0; i < compoSMR.Count; i++)
                {
                    CutsceneCommon.SetSubMeshRendering(compoSMR[i], MeshTopology.Triangles);
                }
            }
        }
 public void DestroyRenderTexture()
 {
     if (null != this.storeUITexture)
     {
         this.storeUITexture.enabled = false;
     }
     if (null != this.renderTextureCamera)
     {
         UnityEngine.Object.Destroy(this.renderTextureCamera.gameObject);
         this.renderTextureCamera = null;
     }
 }
Exemplo n.º 15
0
        public static void SetWireFrameRendering(GameObject modelObject)
        {
            List <SkinnedMeshRenderer> compoSMR = CommonRender3DRT.GetCompoSMR(modelObject);

            if (compoSMR != null)
            {
                foreach (SkinnedMeshRenderer skinMesh in compoSMR)
                {
                    CutsceneCommon.SetSubMeshRendering(skinMesh, MeshTopology.Lines);
                }
            }
        }
Exemplo n.º 16
0
    private void ShowCharacter()
    {
        this.ngTargetTex = this.goTargetTex.GetComponent <UITexture>();
        GameObject gameObject = GUIManager.LoadCommonGUI("Render3D/Render3DRT", null);

        this.csRender3DRT = gameObject.GetComponent <CommonRender3DRT>();
        string filePath = MonsterObject.GetFilePath(CMD_MealExecution.DataChg.GetMonsterMaster().Group.modelId);

        this.csRender3DRT.LoadChara(filePath, 0f, 4000f, -0.65f, 1.1f, true);
        this.renderTex = this.csRender3DRT.SetRenderTarget(1136, 820, 16);
        this.ngTargetTex.mainTexture = this.renderTex;
        this.charaParams             = this.csRender3DRT.transform.GetComponentInChildren <CharacterParams>();
    }
Exemplo n.º 17
0
        public static List <Material[]> GetMaterial(GameObject modelObject)
        {
            List <Material[]>          list     = new List <Material[]>();
            List <SkinnedMeshRenderer> compoSMR = CommonRender3DRT.GetCompoSMR(modelObject);

            if (compoSMR != null)
            {
                foreach (SkinnedMeshRenderer skinnedMeshRenderer in compoSMR)
                {
                    list.Add(skinnedMeshRenderer.materials);
                }
            }
            return(list);
        }
Exemplo n.º 18
0
 public void UpdateAnimation(float deltaTime, CommonRender3DRT reanderTextureCamera)
 {
     if (this.isAnimation)
     {
         this.animationCurrentTime += deltaTime;
         if (this.animationCurrentTime > this.animationMaxTime)
         {
             this.animationCurrentTime = this.animationMaxTime;
             this.isAnimation          = false;
         }
         Vector3 pos = Vector3.Lerp(this.animationStartPosition, this.animationEndPosition, this.animationCurrentTime / this.animationMaxTime);
         this.animationTempTranslation.SetTRS(pos, Quaternion.identity, Vector3.one);
         reanderTextureCamera.projectionMatrix = this.animationTempTranslation * this.defaultProjectionMatrix;
     }
 }
Exemplo n.º 19
0
        public static void ChangeMaterial(GameObject modelObject, Material changeMaterial)
        {
            List <SkinnedMeshRenderer> compoSMR = CommonRender3DRT.GetCompoSMR(modelObject);

            if (compoSMR != null)
            {
                foreach (SkinnedMeshRenderer skinnedMeshRenderer in compoSMR)
                {
                    Material[] materials = skinnedMeshRenderer.materials;
                    for (int i = 0; i < materials.Length; i++)
                    {
                        materials[i] = changeMaterial;
                    }
                    skinnedMeshRenderer.materials = materials;
                }
            }
        }
    public void ShowCharacter()
    {
        if (this.Data == null)
        {
            this.ngTargetTex.gameObject.SetActive(false);
            this.ShowDet();
            return;
        }
        this.SetRenderPos();
        GameObject gameObject = GUIManager.LoadCommonGUI("Render3D/Render3DRT", null);

        this.csRender3DRT = gameObject.GetComponent <CommonRender3DRT>();
        string filePath = MonsterObject.GetFilePath(this.Data.GetMonsterMaster().Group.modelId);

        this.csRender3DRT.LoadChara(filePath, this.v3Chara.x, this.v3Chara.y, 0.1f, 0f, false);
        this.renderTex = this.csRender3DRT.SetRenderTarget(320, 378, 16);
        this.ngTargetTex.gameObject.SetActive(true);
        this.ngTargetTex.mainTexture = this.renderTex;
        GameWebAPI.RespDataMA_GetMonsterMG.MonsterM monsterMG = this.Data.monsterMG;
        float partyCharaPosX = 0f;
        float partyCharaPosY = 0f;
        float partyCharaPosZ = 0f;
        float partyCharaRotY = 0f;

        if (!string.IsNullOrEmpty(monsterMG.partyCharaPosX))
        {
            partyCharaPosX = (float)double.Parse(monsterMG.partyCharaPosX);
        }
        if (!string.IsNullOrEmpty(monsterMG.partyCharaPosY))
        {
            partyCharaPosY = (float)double.Parse(monsterMG.partyCharaPosY);
        }
        if (!string.IsNullOrEmpty(monsterMG.partyCharaPosZ))
        {
            partyCharaPosZ = (float)double.Parse(monsterMG.partyCharaPosZ);
        }
        if (!string.IsNullOrEmpty(monsterMG.partyCharaRotY))
        {
            partyCharaRotY = (float)double.Parse(monsterMG.partyCharaRotY);
        }
        this.csRender3DRT.SetCharacterPositionForParty(partyCharaPosX, partyCharaPosY, partyCharaPosZ, partyCharaRotY);
        this.updateCharaCT = 2;
        this.ShowDet();
    }
Exemplo n.º 21
0
        public static List <Material[]> SetWireFrameRendering(GameObject modelObject, Material wireFrameMaterial)
        {
            List <Material[]>          list     = new List <Material[]>();
            List <SkinnedMeshRenderer> compoSMR = CommonRender3DRT.GetCompoSMR(modelObject);

            if (compoSMR != null)
            {
                foreach (SkinnedMeshRenderer skinnedMeshRenderer in compoSMR)
                {
                    list.Add(skinnedMeshRenderer.materials);
                    Material[] array = new Material[skinnedMeshRenderer.materials.Length];
                    for (int i = 0; i < array.Length; i++)
                    {
                        array[i] = wireFrameMaterial;
                    }
                    skinnedMeshRenderer.materials = array;
                    CutsceneCommon.SetSubMeshRendering(skinnedMeshRenderer, MeshTopology.Lines);
                }
            }
            return(list);
        }
Exemplo n.º 22
0
    public void LoadMonsterModel(string path, Vector3 characterLocalPosition, float characterLocalEulerAngleY)
    {
        GameObject original = AssetDataMng.Instance().LoadObject(path, null, true) as GameObject;

        this.goChara      = UnityEngine.Object.Instantiate <GameObject>(original);
        this.goChara.name = path;
        this.goChara.transform.SetParent(base.gameObject.transform);
        this.goChara.transform.localPosition = characterLocalPosition;
        Quaternion localRotation = Quaternion.Euler(0f, characterLocalEulerAngleY, 0f);

        this.goChara.transform.localRotation = localRotation;
        this.rotY    = characterLocalEulerAngleY;
        this.smrList = CommonRender3DRT.GetCompoSMR(this.goChara);
        if (this.smrList != null)
        {
            this.SetSMRUpdateFlag(this.smrList);
        }
        this.cpParams = this.goChara.GetComponent <CharacterParams>();
        if (null != this.cpParams)
        {
            this.cpParams.PlayAnimation(CharacterAnimationType.idle, SkillType.Attack, 0, null, null);
        }
        this.SetBillBoardCamera();
    }
        public override void OnDrag(Vector2 deltaMove, CommonRender3DRT reanderTextureCamera)
        {
            float addRotationEulerY = -(deltaMove.x / 3f);

            reanderTextureCamera.AddCharacterRotationY(addRotationEulerY);
        }
Exemplo n.º 24
0
    public void InitMonsterList()
    {
        List <MonsterData> list = MonsterDataMng.Instance().GetMonsterDataList();

        list = MonsterFilter.Filter(list, MonsterFilterType.GROWING_IN_GARDEN);
        MonsterDataMng.Instance().SortMDList(list);
        PushNotice.Instance.SyncGardenPushNoticeData(list);
        if (list.Count == 0)
        {
            this.cautionTextLabel.gameObject.SetActive(true);
            this.cautionTextLabel.text = StringMaster.GetString("Garden-01");
        }
        else if (this.cautionTextLabel.gameObject.activeSelf)
        {
            this.cautionTextLabel.gameObject.SetActive(false);
        }
        if (null != FarmObject_DigiGarden.Instance)
        {
            FarmObject_DigiGarden.Instance.SetAutoActiveCanEvolveParticle();
        }
        this.csSelectPanel.initLocation = true;
        this.goMN_LIST[0].SetActive(true);
        this.csSelectPanel.AllBuild(list, new Action <CMD, string, string>(this.OnBornExec), new Action <MonsterData>(this.OnPushEvolutionButton));
        this.goMN_LIST[0].SetActive(false);
        this.modelUiTex.gameObject.SetActive(list.Count != 0);
        int num = 0;

        foreach (MonsterData monsterData in list)
        {
            if (monsterData.userMonster.eggFlg == "1")
            {
                num++;
            }
        }
        foreach (PicturebookDetailController picturebookDetailController in this.eggControllerList)
        {
            picturebookDetailController.CallMethodOnClick = "OnClickEgg_Dummy";
        }
        int num2 = 0;
        int num3 = 0;

        foreach (MonsterData monsterData2 in list)
        {
            if (monsterData2.userMonster.IsEgg())
            {
                string           eggModelId       = MonsterObject.GetEggModelId(monsterData2.userMonster.monsterEvolutionRouteId);
                CommonRender3DRT commonRender3DRT = this.CreateRender3DRT(true, eggModelId, this.modelUiTex);
                this.SetRender3Dcamera(true, commonRender3DRT, false);
                DigimonActionInGarden digimonActionInGarden = this.AttachActionScript(commonRender3DRT.gameObject, true);
                this.charaActList.Add(digimonActionInGarden);
                this.eggControllerList[num2].CallMethodOnClick = this.callMeyhodsOnEggClick[num3];
                if (num != 1)
                {
                    if (num != 2)
                    {
                        if (num == 3)
                        {
                            num2++;
                            if (num2 != 1)
                            {
                                if (num2 != 2)
                                {
                                    if (num2 == 3)
                                    {
                                        digimonActionInGarden.SetPosition(this.eggPos_3);
                                    }
                                }
                                else
                                {
                                    digimonActionInGarden.SetPosition(this.eggPos_2);
                                }
                            }
                            else
                            {
                                digimonActionInGarden.SetPosition(this.eggPos_1);
                            }
                        }
                    }
                    else
                    {
                        num2++;
                        if (num2 != 1)
                        {
                            if (num2 == 2)
                            {
                                digimonActionInGarden.SetPosition(this.eggPos_2);
                            }
                        }
                        else
                        {
                            digimonActionInGarden.SetPosition(this.eggPos_1);
                        }
                    }
                }
                else
                {
                    digimonActionInGarden.SetPosition(this.eggPos_1);
                }
                digimonActionInGarden.SetDefaultAnimation(this.eggLoopAnimClipList[num3]);
            }
            else
            {
                CommonRender3DRT commonRender3DRT2 = this.CreateRender3DRT(false, monsterData2.GetMonsterMaster().Group.modelId, this.modelUiTex);
                this.SetRender3Dcamera(false, commonRender3DRT2, false);
                DigimonActionInGarden digimonActionInGarden2 = this.AttachActionScript(commonRender3DRT2.gameObject, false);
                this.charaActList.Add(digimonActionInGarden2);
                digimonActionInGarden2.RandomPosition();
                digimonActionInGarden2.WalkAction();
            }
            num3++;
        }
    }
Exemplo n.º 25
0
 public abstract void OnDrag(Vector2 deltaMove, CommonRender3DRT reanderTextureCamera);