Esempio n. 1
0
 void RefreshTexture(PetDataBase db)
 {
     InitControls();
     m_pdb = db;
     OnPlayAudio(null);
     if (db != null)
     {
         if (null != m__CharacterRenderTexture)
         {
             if (characterRenderobj != null)
             {
                 characterRenderobj.Release();
             }
             characterRenderobj = DataManager.Manager <RenderTextureManager>().CreateRenderTextureObj((int)db.viewModelID, 512);
             if (characterRenderobj == null)
             {
                 Engine.Utility.Log.Error("宠物模型id{0}创建贴图失败!", db.viewModelID);
                 return;
             }
             DataManager.Manager <PetDataManager>().AddRenderObj(db.viewModelID, characterRenderobj);
             ModeDiplayDataBase modelDisp = GameTableManager.Instance.GetTableItem <ModeDiplayDataBase>(db.viewModelID);
             if (modelDisp == null)
             {
                 Engine.Utility.Log.Error("宠物模型ID为{0}的模型展示数据为空", db.viewModelID);
                 return;
             }
             characterRenderobj.SetDisplayCamera(modelDisp.pos512, modelDisp.rotate512, modelDisp.Modelrotation);
             characterRenderobj.PlayModelAni(Client.EntityAction.Stand);
             UIRenderTexture rt = m__CharacterRenderTexture.GetComponent <UIRenderTexture>();
             if (null == rt)
             {
                 rt = m__CharacterRenderTexture.gameObject.AddComponent <UIRenderTexture>();
             }
             if (null != rt)
             {
                 rt.SetDepth(0);
                 rt.Initialize(characterRenderobj, characterRenderobj.YAngle, new Vector2(512, 512));
             }
         }
     }
 }
 public void Clear()
 {
     if (uiRenderTexture != null)
     {
         uiRenderTexture.Release();
         Object.Destroy(uiRenderTexture);
         uiRenderTexture = null;
     }
     DeleteModel();
     playerLoadInfo    = null;
     npcData           = null;
     equipItemID       = -1;
     skillItemID       = -1;
     skillSymbolItemID = -1;
     itemID            = -1;
     enemyID           = -1;
     foundationName    = null;
     uiTexture         = null;
     referenceSexID    = -1;
     referenceFaceID   = -1;
 }
Esempio n. 3
0
    void ShowModel(HuntingDataBase data)
    {
        string[] monID     = data.monsterID.Split('_');
        uint     monsterid = uint.Parse(monID[0]);

        table.NpcDataBase npcData = GameTableManager.Instance.GetTableItem <NpcDataBase>(monsterid);
        if (npcData != null)
        {
            uint modelID = npcData.dwViewModelSet;  // 使用观察模型
            if (m_RTObj != null)
            {
                m_RTObj.Release();
                m_RTObj = null;
            }

            m_RTObj = DataManager.Manager <RenderTextureManager>().CreateRenderTextureObj((int)modelID, 800);
            if (m_RTObj == null)
            {
                return;
            }
            ModeDiplayDataBase modelDisp = GameTableManager.Instance.GetTableItem <ModeDiplayDataBase>(modelID);
            if (modelDisp == null)
            {
                Engine.Utility.Log.Error("BOSS模型ID为{0}的模型展示数据为空", modelID);
                return;
            }
            m_RTObj.SetDisplayCamera(modelDisp.pos800, modelDisp.rotate800, modelDisp.Modelrotation);
            m_RTObj.PlayModelAni(Client.EntityAction.Stand);
            UIRenderTexture rt = m__Model.GetComponent <UIRenderTexture>();
            if (null == rt)
            {
                rt = m__Model.gameObject.AddComponent <UIRenderTexture>();
            }
            if (null != rt)
            {
                rt.SetDepth(3);
                rt.Initialize(m_RTObj, m_RTObj.YAngle, new UnityEngine.Vector2(800, 800));
            }
        }
    }
Esempio n. 4
0
    public void SetModel(List <SuitData> suitData, int job, uint faceId)
    {
        int sex = 0;

        sex = (int)GameUtil.FaceToSex(faceId);

        rtGo.SetActive(true);

        if (suitData == null)//机器人无时装数据
        {
            suitData = new List <SuitData>();
            SuitData sd = new SuitData {
                baseid = 0, suit_type = EquipSuitType.Unknow_Type
            };
            suitData.Add(sd);
        }

        if (rtObj != null)
        {
            rtObj.Release();
        }
        rtObj = DataManager.Manager <RenderTextureManager>().CreateRenderTextureObj(suitData, job, sex, 700);
        if (rtObj == null)
        {
            return;
        }

        UIRenderTexture rt = rtGo.GetComponent <UIRenderTexture>();

        if (rt == null)
        {
            rt = rtGo.AddComponent <UIRenderTexture>();
        }
        rtObj.SetModelRotateY(180);
        rtObj.SetModelScale(1f);
        rtObj.SetCamera(new Vector3(0, 1f, 0f), new Vector3(15, 0, 0), 4f);
        rt.SetDepth(3);
        rt.Initialize(rtObj, 180f, new UnityEngine.Vector2(600f, 600f));
        rtObj.PlayModelAni(Client.EntityAction.Stand);
    }
 public void LoadModel(int index, CharaInfo user_info)
 {
     //IL_00c9: Unknown result type (might be due to invalid IL or missing references)
     //IL_00e8: Unknown result type (might be due to invalid IL or missing references)
     //IL_00f9: Unknown result type (might be due to invalid IL or missing references)
     if (user_info == null)
     {
         if (index <= 3 && index >= 0)
         {
             userIndex = index;
         }
         DeleteModel();
         userIndex = -1;
         userInfo  = null;
     }
     else
     {
         userIndex = index;
         userInfo  = user_info;
         if (index <= 3)
         {
             UITexture componentInChildren = this.GetComponentInChildren <UITexture>();
             if (MonoBehaviourSingleton <OutGameSettingsManager> .I.questSelect.isRightDepthForward)
             {
                 componentInChildren.depth = index;
             }
             else
             {
                 componentInChildren.depth = 3 - index;
             }
             renderTexture = UIRenderTexture.Get(componentInChildren, -1f, false, -1);
             renderTexture.nearClipPlane = 4f;
             model = Utility.CreateGameObject("PlayerModel", renderTexture.modelTransform, -1);
             model.set_localPosition(new Vector3(0f, -1.1f, 8f));
             model.set_eulerAngles(new Vector3(0f, 180f, 0f));
             this.StartCoroutine(Loading());
         }
     }
 }
Esempio n. 6
0
 void ShowPetRenderTex(bool bShow)
 {
     if (m_petRTObj == null)
     {
         // Engine.Utility.Log.Error("pet rt obj is null");
         return;
     }
     if (m_petRTObj != null)
     {
         m_petRTObj.Enable(bShow);
         if (!bShow)
         {
             return;
         }
     }
     if (null != m__modelTexture)
     {
         UIRenderTexture rt = m__modelTexture.GetComponent <UIRenderTexture>();
         if (null == rt)
         {
             rt = m__modelTexture.gameObject.AddComponent <UIRenderTexture>();
         }
         if (null != rt)
         {
             rt.SetDepth(0);
             rt.Initialize(m_petRTObj, m_petRTObj.YAngle, new Vector2(750, 750), () =>
             {
                 DataManager.Manager <UIPanelManager>().HidePanel(PanelID.FashionTips);
             });
         }
         SetRenderTexPos(m_petRTObj);
     }
     else
     {
         m_petRTObj.Release();
         m_petRTObj = null;
     }
 }
    private IEnumerator RunScript()
    {
        Transform camera_t = MonoBehaviourSingleton <AppMain> .I.mainCameraTransform;

        for (int cmd_row = 0; cmd_row < scriptCommands.Count; cmd_row++)
        {
            string cmd = scriptCommands[cmd_row].cmd;
            string p0  = scriptCommands[cmd_row].p0;
            string p   = scriptCommands[cmd_row].p1;
            string p2  = scriptCommands[cmd_row].p2;
            string p3  = scriptCommands[cmd_row].p3;
            string msg = scriptCommands[cmd_row].msg;
            switch (cmd)
            {
            case "WAIT":
            {
                float time = (!string.IsNullOrEmpty(p0)) ? float.Parse(p0) : 0f;
                while (true)
                {
                    yield return((object)null);

                    if (time > 0f)
                    {
                        time -= Time.get_deltaTime();
                    }
                    else if (!MonoBehaviourSingleton <ResourceManager> .I.isLoading && !InstantiateManager.isBusy && !MonoBehaviourSingleton <TransitionManager> .I.isTransing && !(charas.Find((StoryCharacter o) => o.isMoving) != null) && !cameraPosAnim.IsPlaying())
                    {
                        break;
                    }
                }
                break;
            }

            case "FADE_IN":
                eventReceiver.FadeIn();
                break;

            case "FADE_OUT":
            {
                Color c = Color.get_black();
                switch (p0)
                {
                case "BLUE":
                    c = Color.get_blue();
                    break;

                case "WHITE":
                    c = Color.get_white();
                    break;

                case "RED":
                    c = Color.get_red();
                    break;

                case "YELLOW":
                    c = Color.get_yellow();
                    break;
                }
                eventReceiver.FadeOut(c);
                break;
            }

            case "CHR_EASE":
            {
                StoryCharacter.EaseDir type = (!(p == "L")) ? StoryCharacter.EaseDir.RIGHT : StoryCharacter.EaseDir.LEFT;
                bool           forward      = (!(p2 == "IN")) ? true : false;
                StoryCharacter chara        = FindChara(p0);
                if (chara != null)
                {
                    while (chara.isLoading)
                    {
                        yield return((object)null);
                    }
                    chara.PlayTween(type, forward, null);
                }
                break;
            }

            case "EFF_SHOW":
            {
                LoadObject load_obj = effectPrefabs.Get(p0);
                if (load_obj != null)
                {
                    while (load_obj.isLoading)
                    {
                        yield return((object)null);
                    }
                    Transform      effect = ResourceUtility.Realizes(load_obj.loadedObject, effectRenderTex.modelTransform, 1);
                    Vector3        pos    = Vector3.get_zero();
                    StoryCharacter chara2 = FindChara(p);
                    if (chara2 != null)
                    {
                        pos = chara2.model.get_position();
                    }
                    Vector3 position = camera_t.get_position();
                    pos.y = position.y;
                    effect.set_position(pos);
                    if (float.TryParse(p2, out float scale))
                    {
                        effect.set_localScale(new Vector3(scale, scale, scale));
                    }
                }
                break;
            }

            case "SE_PLAY":
            {
                int se_id = int.Parse(p0);
                SoundManager.PlayOneShotUISE(se_id);
                break;
            }

            case "BGM_CHANGE":
            {
                int bgm_id = int.Parse(p0);
                MonoBehaviourSingleton <SoundManager> .I.requestBGMID = bgm_id;
                break;
            }

            case "CHR_SHOW":
            {
                StoryCharacter chara5 = FindChara(p0);
                if (chara5 != null)
                {
                    while (chara5.isLoading)
                    {
                        yield return((object)null);
                    }
                    FadeCharacter(true, chara5);
                    yield return((object)new WaitForSeconds(MonoBehaviourSingleton <OutGameSettingsManager> .I.storyScene.charaFadeTime));
                }
                break;
            }

            case "CHR_HIDE":
            {
                StoryCharacter chara7 = FindChara(p0);
                if (chara7 != null)
                {
                    while (chara7.isLoading)
                    {
                        yield return((object)null);
                    }
                    FadeCharacter(false, chara7);
                    yield return((object)new WaitForSeconds(MonoBehaviourSingleton <OutGameSettingsManager> .I.storyScene.charaFadeTime));
                }
                break;
            }

            case "CHR_ROT":
            {
                StoryCharacter chara8 = FindChara(p0);
                if (chara8 != null)
                {
                    float angle;
                    if (string.IsNullOrEmpty(p))
                    {
                        chara8.RotateDefault();
                    }
                    else if (p == "F")
                    {
                        chara8.RotateFront();
                    }
                    else if (float.TryParse(p, out angle))
                    {
                        chara8.RotateAngle(angle);
                    }
                }
                break;
            }

            case "CHR_POSE":
            {
                StoryCharacter chara9 = FindChara(p0);
                if (chara9 != null)
                {
                    chara9.RequestPose(p);
                }
                break;
            }

            case "CHR_STAND":
            {
                StoryCharacter chara10 = FindChara(p0);
                if (chara10 != null)
                {
                    chara10.SetStandPosition(p, true);
                }
                break;
            }

            case "CHR_SCALE":
            {
                StoryCharacter chara11 = FindChara(p0);
                if (chara11 != null)
                {
                    Vector3 scale2 = new Vector3
                    {
                        x = float.Parse(p),
                        y = float.Parse(p),
                        z = float.Parse(p)
                    };
                    chara11.SetModelScale(scale2);
                }
                break;
            }

            case "CHR_FACE":
            {
                StoryCharacter chara12 = FindChara(p0);
                if (chara12 != null)
                {
                    chara12.RequestFace(p, p2);
                }
                break;
            }

            case "CAM_SET":
            {
                int camIndex2 = int.Parse(p0);
                if (0 <= camIndex2 && cameraPositions.Length > camIndex2)
                {
                    float x = float.Parse(p);
                    float y = float.Parse(p2);
                    float z = float.Parse(p3);
                    cameraPositions[camIndex2] = new Vector3(x, y, z);
                }
                break;
            }

            case "CAM_MOV":
            {
                int camIndex = int.Parse(p0);
                if (0 <= camIndex && cameraPositions.Length > camIndex)
                {
                    ((InterpolatorBase <Vector3>)cameraPosAnim).Set(0.3f, cameraPositions[camIndex], null, default(Vector3), null);
                    cameraPosAnim.Play();
                }
                break;
            }

            case "CAM_PAN":
            {
                StoryCharacter chara6 = FindChara(p0);
                if (chara6 != null)
                {
                    int charaShowCount = GetCharaShowCount();
                    switch (charaShowCount)
                    {
                    case 1:
                    {
                        Vector3 position2 = chara6.model.get_position();
                        Vector3 pos3;
                        pos3.x = position2.x;
                        Transform chara_neck = (!(p == "F")) ? Utility.Find(chara6.model, "Neck") : Utility.Find(chara6.model, "Spine01");
                        if (chara_neck != null)
                        {
                            Vector3 position3 = chara_neck.get_position();
                            pos3.y = position3.y;
                        }
                        else
                        {
                            pos3.y = initCameraPos.y;
                        }
                        if (p == "N")
                        {
                            pos3.z = MonoBehaviourSingleton <OutGameSettingsManager> .I.storyScene.cameraPanNearZ;
                        }
                        else if (p == "F")
                        {
                            pos3.z = MonoBehaviourSingleton <OutGameSettingsManager> .I.storyScene.cameraPanFarZ;
                        }
                        else
                        {
                            pos3.z = MonoBehaviourSingleton <OutGameSettingsManager> .I.storyScene.cameraPanNormalZ;
                        }
                        ((InterpolatorBase <Vector3>)cameraPosAnim).Set(0.3f, pos3, null, default(Vector3), null);
                        cameraPosAnim.Play();
                        break;
                    }

                    case 2:
                        ((InterpolatorBase <Vector3>)cameraPosAnim).Set(0.3f, MonoBehaviourSingleton <OutGameSettingsManager> .I.storyScene.duoCameraPos, null, default(Vector3), null);
                        cameraPosAnim.Play();
                        break;

                    default:
                        if (3 <= charaShowCount)
                        {
                            ((InterpolatorBase <Vector3>)cameraPosAnim).Set(0.3f, MonoBehaviourSingleton <OutGameSettingsManager> .I.storyScene.trioCameraPos, null, default(Vector3), null);
                            cameraPosAnim.Play();
                        }
                        break;
                    }
                }
                else
                {
                    Vector3 pos2;
                    pos2.x = 0f;
                    pos2.y = initCameraPos.y;
                    pos2.z = 0f;
                    ((InterpolatorBase <Vector3>)cameraPosAnim).Set(0.3f, pos2, null, default(Vector3), null);
                    cameraPosAnim.Play();
                }
                break;
            }

            case "CHR_ALIAS":
            {
                StoryCharacter chara4 = FindChara(p0);
                if (chara4 != null)
                {
                    chara4.SetAliasName(p);
                }
                break;
            }

            case "MSG":
            {
                MSG_TYPE msg_type = MSG_TYPE.NORMAL;
                if (p == "M" || p == "MONOLOGUE")
                {
                    msg_type = MSG_TYPE.MONOLOGUE;
                }
                waitMessage = true;
                StoryCharacter chara3 = FindChara(p0);
                msg = GetReplacedText(msg);
                eventReceiver.AddMessage((!(chara3 != null)) ? p0 : chara3.displayName, msg, (chara3 != null) ? chara3.dir : POS.NONE, msg_type);
                if (!string.IsNullOrEmpty(p2))
                {
                    int voice_id = int.Parse(p2);
                    SoundManager.PlayVoice(voice_id, 1f, 0u, null, null);
                }
                break;
            }

            case "BG":
            {
                bool         isFirstLoad = false;
                LoadingQueue load_queue  = new LoadingQueue(this);
                if (locationRednerTex != null)
                {
                    locationRednerTex.Release();
                }
                else
                {
                    isFirstLoad = true;
                }
                int loc_image_id = int.Parse(p0);
                int loc_sky_id   = int.Parse(p);
                ResourceManager.enableCache = false;
                LoadObject lo_loc_image = (loc_image_id <= 0) ? null : load_queue.Load(RESOURCE_CATEGORY.STORY_LOCATION_IMAGE, ResourceName.GetStoryLocationImage(loc_image_id), false);
                LoadObject lo_loc_sky   = (loc_sky_id <= 0) ? null : load_queue.Load(RESOURCE_CATEGORY.STORY_LOCATION_SKY, ResourceName.GetStoryLocationSky(loc_sky_id), false);
                yield return((object)load_queue.Wait());

                ResourceManager.enableCache = true;
                locationRednerTex           = UIRenderTexture.Get(locationTex, -1f, false, 0);
                locationRednerTex.Disable();
                locationRednerTex.orthographicSize = (float)locationTex.height * 0.5f * 0.01f;
                locationRednerTex.modelTransform.set_position(new Vector3(0f, 0f, 10f));
                locationRoot = Utility.CreateGameObject("LocationRoot", locationRednerTex.modelTransform, locationRednerTex.renderLayer);
                locationRoot.set_localPosition(new Vector3(0f, 0f, 3f));
                locationRoot.set_localScale(new Vector3(0.01f, 0.01f, 1f));
                if (lo_loc_image != null)
                {
                    locationImageRoot = Utility.CreateGameObject("LocationImageRoot", locationRoot, locationRednerTex.renderLayer);
                    locationImage     = ResourceUtility.Realizes(lo_loc_image.loadedObject, locationImageRoot, locationRednerTex.renderLayer);
                }
                if (lo_loc_sky != null)
                {
                    locationSky = ResourceUtility.Realizes(lo_loc_sky.loadedObject, locationRoot, locationRednerTex.renderLayer);
                    locationSky.set_localPosition(new Vector3(0f, 0f, 1f));
                }
                locationRednerTex.Enable(0.25f);
                if (isFirstLoad)
                {
                    eventReceiver.EndLoadFirstBG();
                }
                break;
            }
            }
            while (waitMessage)
            {
                yield return((object)null);
            }
        }
        isRunning = false;
        FocusChara(null);
        eventReceiver.EndStory();
    }
    private IEnumerator LoadScriptResources()
    {
        Transform camera_t = MonoBehaviourSingleton <AppMain> .I.mainCameraTransform;

        initCameraPos = camera_t.get_position();
        cameraPosAnim.Set(initCameraPos);
        LoadingQueue load_queue = new LoadingQueue(this);

        for (int cmd_row = 0; cmd_row < scriptCommands.Count; cmd_row++)
        {
            string cmd = scriptCommands[cmd_row].cmd;
            string p4  = scriptCommands[cmd_row].p0;
            string p3  = scriptCommands[cmd_row].p1;
            string p2  = scriptCommands[cmd_row].p2;
            switch (cmd)
            {
            case "EFF_SHOW":
            {
                LoadObject load_obj = load_queue.LoadEffect(RESOURCE_CATEGORY.EFFECT_ACTION, p4, false);
                effectPrefabs.Add(p4, load_obj);
                if (effectRenderTex == null)
                {
                    effectRenderTex = UIRenderTexture.Get(effectTex, -1f, true, 1);
                    effectRenderTex.Enable(0.25f);
                }
                break;
            }

            case "SE_PLAY":
                try
                {
                    int se_id = int.Parse(p4);
                    load_queue.CacheSE(se_id, null);
                }
                catch
                {
                    Log.Error(LOG.EXCEPTION, "{0}コマンドのSEIDに整数ではない値が指定されています。", cmd);
                }
                break;

            case "MSG":
                if (!string.IsNullOrEmpty(p2))
                {
                    try
                    {
                        int voice_id = int.Parse(p2);
                        load_queue.CacheVoice(voice_id, null);
                    }
                    catch
                    {
                        Log.Error(LOG.EXCEPTION, "{0}コマンドのボイスIDに整数ではない値が指定されています。", cmd);
                    }
                }
                break;

            case "CHR_LOAD":
            {
                int id = -1;
                for (int i = 0; (float)i < 4f; i++)
                {
                    if (charas.Find((StoryCharacter o) => o.id == ((_003CLoadScriptResources_003Ec__IteratorC1) /*Error near IL_02d5: stateMachine*/)._003Ci_003E__11) == null)
                    {
                        id = i;
                        break;
                    }
                }
                if (id != -1)
                {
                    UITexture ui_tex = eventReceiver.GetModelUITexture(id);
                    if (ui_tex != null)
                    {
                        StoryCharacter chara = StoryCharacter.Initialize(id, ui_tex, p4, p3, p2);
                        if (chara != null)
                        {
                            charas.Add(chara);
                        }
                    }
                }
                break;
            }
            }
        }
        while (MonoBehaviourSingleton <ResourceManager> .I.isLoading || InstantiateManager.isBusy)
        {
            yield return((object)null);
        }
        isLoading = false;
    }
Esempio n. 9
0
    private void InitPropetyUI(RideData data)
    {
        m_rideid = 0;
        if (data != null)
        {
            m_rideid = data.id;

            UpdateFightState();

            if (m_label_Ride_Name != null)
            {
                m_label_Ride_Name.text = data.name;
            }

            if (m_label_level != null)
            {
                m_label_level.text = data.level.ToString();
            }

            if (m_label_RideSpeedLabel != null)
            {
                m_label_RideSpeedLabel.text = "速度+" + data.GetSpeed().ToString() + "%";
            }

            if (m_label_life != null)
            {
                m_label_life.text = data.life.ToString();
            }

            //m_btn_btn_diuqi.gameObject.SetActive(data.life <= 0);
            //m_btn_btn_seal.gameObject.SetActive(data.life > 0);
            if (m_label_Repletion != null)
            {
                m_label_Repletion.text = data.repletion.ToString() + "/" + data.maxRepletion;
            }


            table.RideFeedData maxFeedata = GameTableManager.Instance.GetTableItem <table.RideFeedData>(data.baseid, data.level + 1);
            if (maxFeedata != null)
            {
                table.RideFeedData feedata = GameTableManager.Instance.GetTableItem <table.RideFeedData>(data.baseid, data.level);
                if (feedata != null)
                {
                    m_label_maxLevel.enabled = false;

                    // m_btn_btn_addExp.gameObject.SetActive(true);
                    // m_label_expLabel.gameObject.SetActive(true);
                    //// m_slider_ExpSlider.gameObject.SetActive(true);
                    // m_label_expLabel.text = string.Format("{0}/{1}", data.exp, feedata.upExp);
                    // m_slider_ExpSlider.value = data.exp * 1.0f / feedata.upExp;
                }
            }
            else
            {
                m_label_maxLevel.enabled = true;
                m_btn_btn_addExp.gameObject.SetActive(false);
                m_label_expLabel.gameObject.SetActive(false);
                m_slider_ExpSlider.gameObject.SetActive(false);
            }

            if (baseRideId != data.modelid)
            {
                baseRideId = data.modelid;
                if (m_RTObj != null)
                {
                    m_RTObj.Release();
                }
                m__rideModel.gameObject.SetActive(true);
                m_RTObj = DataManager.Manager <RenderTextureManager>().CreateRenderTextureObj((int)baseRideId, 750);
                if (m_RTObj == null)
                {
                    return;
                }
                ModeDiplayDataBase modelDisp = GameTableManager.Instance.GetTableItem <ModeDiplayDataBase>(baseRideId);
                if (modelDisp == null)
                {
                    Engine.Utility.Log.Error("BOSS模型ID为{0}的模型展示数据为空", baseRideId);
                    return;
                }

                m_RTObj.SetDisplayCamera(modelDisp.pos750, modelDisp.rotate750, modelDisp.Modelrotation);
                m_RTObj.PlayModelAni(Client.EntityAction.Stand);
                UIRenderTexture rt = m__rideModel.GetComponent <UIRenderTexture>();
                if (null == rt)
                {
                    rt = m__rideModel.gameObject.AddComponent <UIRenderTexture>();
                }
                if (null != rt)
                {
                    rt.SetDepth(0);
                    rt.Initialize(m_RTObj, m_RTObj.YAngle, new UnityEngine.Vector2(750, 750));
                }
            }
        }
    }
Esempio n. 10
0
    private IEnumerator DoInitialize()
    {
        uint         regionId              = MonoBehaviourSingleton <FieldManager> .I.currentMapData.regionId;
        LoadingQueue loadQueue             = new LoadingQueue(this);
        LoadObject   loadedExploreMapFrame = loadQueue.Load(RESOURCE_CATEGORY.WORLDMAP, "ExploreMapFrame", false);
        LoadObject   loadedExploreMap      = loadQueue.Load(RESOURCE_CATEGORY.WORLDMAP, "ExploreMap_" + regionId.ToString("D3"), false);
        LoadObject   loadedPlayerMarker    = loadQueue.Load(RESOURCE_CATEGORY.WORLDMAP, "ExplorePlayerMarker", false);
        LoadObject   loadedCircle          = loadQueue.Load(RESOURCE_CATEGORY.WORLDMAP, "ExploreCircle", false);
        LoadObject   loadedBattleIcon      = loadQueue.Load(RESOURCE_CATEGORY.WORLDMAP, "ExploreBattleMarker", false);
        LoadObject   loadedFootprint       = loadQueue.Load(RESOURCE_CATEGORY.WORLDMAP, "ExploreTraceMarker", false);
        LoadObject   loadedFindIcon        = null;
        LoadObject   loadedDirSonar        = null;
        LoadObject   loadedSonarTexture    = null;

        if (openType == OPEN_MAP_TYPE.SONAR)
        {
            loadedFindIcon     = loadQueue.Load(RESOURCE_CATEGORY.WORLDMAP, "ExploreExclametionMarker", false);
            loadedDirSonar     = loadQueue.Load(RESOURCE_CATEGORY.EFFECT_UI, "ef_ui_sonar_02", false);
            loadedSonarTexture = loadQueue.Load(RESOURCE_CATEGORY.WORLDMAP, "ExploreSonarTexture", false);
            CacheAudio(loadQueue);
        }
        if (loadQueue.IsLoading())
        {
            yield return((object)loadQueue.Wait());
        }
        Transform exploreMapFrame = ResourceUtility.Realizes(loadedExploreMapFrame.loadedObject, base._transform, -1);
        Transform exploreMap      = ResourceUtility.Realizes(loadedExploreMap.loadedObject, exploreMapFrame, -1);
        Transform map             = exploreMap.FindChild("Map");

        map.get_gameObject().SetActive(true);
        mapRoot_ = exploreMap.GetComponent <ExploreMapRoot>();
        ExploreMapLocation[] locations = mapRoot_.locations;
        for (int k = 0; k < locations.Length; k++)
        {
            Transform active   = locations[k].get_transform().FindChild("ExploreSpotActive");
            Transform inactive = locations[k].get_transform().FindChild("ExploreSpotInactive");
            Transform sonar    = locations[k].get_transform().FindChild("ExploreSpotSonar");
            active.get_gameObject().SetActive(true);
            inactive.get_gameObject().SetActive(false);
            List <FieldMapTable.FieldGimmickPointTableData> gimmicks = Singleton <FieldMapTable> .I.GetFieldGimmickPointListByMapID((uint)locations[k].mapId);

            if (gimmicks != null && sonar != null)
            {
                for (int i = 0; i < gimmicks.Count; i++)
                {
                    if (gimmicks[i].gimmickType == FieldMapTable.FieldGimmickPointTableData.GIMMICK_TYPE.SONAR)
                    {
                        active.get_gameObject().SetActive(false);
                        inactive.get_gameObject().SetActive(false);
                        sonar.get_gameObject().SetActive(true);
                    }
                }
            }
        }
        mapRoot_.UpdatePortals(false);
        ExploreMapFrame frame = exploreMapFrame.GetComponent <ExploreMapFrame>();

        frame.SetMap(mapRoot_);
        RegionTable.Data regionData = Singleton <RegionTable> .I.GetData(regionId);

        if (regionData != null)
        {
            frame.SetCaption(regionData.regionName);
        }
        for (int j = 0; j < playerMarkers_.Length; j++)
        {
            playerMarkers_[j] = ResourceUtility.Realizes(loadedPlayerMarker.loadedObject, exploreMapFrame, -1);
            ExplorePlayerMarker marker = playerMarkers_[j].GetComponent <ExplorePlayerMarker>();
            if (null != marker)
            {
                marker.SetIndex(j);
            }
            marker.get_gameObject().SetActive(false);
        }
        mapRoot_.SetMarkers(playerMarkers_, false);
        ExploreStatus.TraceInfo[] traceHistory = MonoBehaviourSingleton <QuestManager> .I.GetBossTraceHistory();

        if (traceHistory != null && traceHistory.Length > 0)
        {
            Transform lastFootprint          = ResourceUtility.Realizes(loadedFootprint.loadedObject, exploreMap, -1);
            ExploreStatus.TraceInfo lastInfo = traceHistory[traceHistory.Length - 1];
            Vector3 lastPos = mapRoot_.GetPositionOnMap(lastInfo.mapId);
            lastFootprint.set_localPosition(new Vector3(lastPos.x + 22f, lastPos.y + 33f, lastPos.z));
            lastFootprint.get_gameObject().SetActive(true);
            if (traceHistory.Length > 1)
            {
                Transform lastSecondFootprint          = ResourceUtility.Realizes(loadedFootprint.loadedObject, exploreMap, -1);
                ExploreStatus.TraceInfo lastSecondInfo = traceHistory[traceHistory.Length - 2];
                Vector3 lastSecondPos = mapRoot_.GetPositionOnMap(lastSecondInfo.mapId);
                lastSecondFootprint.set_localPosition(new Vector3(lastSecondPos.x + 22f, lastSecondPos.y + 33f, lastSecondPos.z));
                lastSecondFootprint.get_gameObject().SetActive(true);
            }
        }
        redCircle = ResourceUtility.Realizes(loadedCircle.loadedObject, exploreMap, -1);
        redCircle.set_localScale(new Vector3(0.6f, 0.6f, 0.6f));
        battleIcon = ResourceUtility.Realizes(loadedBattleIcon.loadedObject, exploreMap, -1);
        if (mapRoot_.showBattleMarker && openType != OPEN_MAP_TYPE.SONAR)
        {
            int bossMapId = MonoBehaviourSingleton <QuestManager> .I.GetExploreBossAppearMapId();

            Vector3 pos = mapRoot_.GetPositionOnMap(bossMapId);
            redCircle.set_localPosition(pos);
            battleIcon.set_localPosition(new Vector3(pos.x + 22f, pos.y + 33f, pos.z));
            TweenAlpha tweenAlpha = redCircle.GetComponent <TweenAlpha>();
            if (null != tweenAlpha)
            {
                tweenAlpha.from = tweenAlpha.to;
            }
            redCircle.get_gameObject().SetActive(true);
            battleIcon.get_gameObject().SetActive(true);
        }
        else
        {
            redCircle.get_gameObject().SetActive(false);
            battleIcon.get_gameObject().SetActive(false);
        }
        if (openType == OPEN_MAP_TYPE.SONAR)
        {
            tapToSkip = Utility.FindChild(exploreMapFrame, "TaptoSkip");
            Transform backGround = Utility.FindChild(exploreMapFrame, "BG");
            backGround.get_gameObject().SetActive(true);
            bgEventListener = UIEventListener.Get(backGround.get_gameObject());
            Transform close = Utility.FindChild(exploreMapFrame, "CaptionRoot/Close");
            if (close != null)
            {
                close.get_gameObject().SetActive(false);
            }
            findIcon = ResourceUtility.Realizes(loadedFindIcon.loadedObject, exploreMap, -1);
            findIcon.get_gameObject().SetActive(false);
            sonarTexture = ResourceUtility.Realizes(loadedSonarTexture.loadedObject, exploreMap, -1);
            UITexture       uiTex         = sonarTexture.get_gameObject().GetComponentInChildren <UITexture>();
            UIRenderTexture renderTexture = UIRenderTexture.Get(uiTex, mapRoot_.GetSonarFov(), false, -1);
            renderTexture.modelTransform.set_localPosition(new Vector3(0f, 0f, 150f));
            sonarDirEffect = ResourceUtility.Realizes(loadedDirSonar.loadedObject, renderTexture.modelTransform, renderTexture.renderLayer);
            sonarDirEffect.set_localScale(Vector2.op_Implicit(mapRoot_.GetSonarScale()));
            sonarDirEffect.get_gameObject().SetActive(false);
            renderTexture.Enable(0.25f);
            renderTexture.renderCamera.set_backgroundColor(mapRoot_.sonarBackGroundColor);
            mapRoot_.SetDirectionSonar(sonarDirEffect.get_gameObject());
        }
        base.Initialize();
    }