Ejemplo n.º 1
0
    private void CreateTextureEvent(ITexture obj, object param = null)
    {
        if (m_texture != null && m_maskTextrue != null && null != mapMat && null != quadTrans)
        {
            mapMat.mainTexture = m_texture.GetTexture();
            mapTex             = mapMat.mainTexture;
            if (mapTex == null)
            {
                return;
            }
            MapData.MapTexture = mapTex;
            table.MapDataBase mdb = GameTableManager.Instance.GetTableItem <table.MapDataBase>(m_mapid);
            if (mdb != null)
            {
                int texWidth = (int)mdb.textureWidth;
                mapMat.SetTexture("_Mask", m_maskTextrue.GetTexture());
                MapData.MapTextureSize = new Vector2(texWidth, texWidth);//new Vector2(  MapData.MapTextureSize.x , (float) MapData.MapTextureSize.y );
                Vector3 scale = new Vector3(texWidth, texWidth, 1);
                if (bTopView)
                {
                    scale = new Vector3(1, 1, 1);
                }
                quadTrans.localScale = scale;
            }

            mapSize         = Client.ClientGlobal.Instance().GetMapSystem().GetMapSize();
            MapData.MapSize = mapSize;
        }
    }
Ejemplo n.º 2
0
 string GetMapName(uint mapId)
 {
     table.MapDataBase mapdb = GameTableManager.Instance.GetTableItem <table.MapDataBase>(mapId);
     if (mapdb != null)
     {
         return(mapdb.strName);
     }
     return("");
 }
Ejemplo n.º 3
0
    //自己
    private void OnSceneLoadCompelete(int nEventId, object param)
    {
        Client.stLoadSceneComplete loadScene = (Client.stLoadSceneComplete)param;
        uint nMapID = (uint)loadScene.nMapID;

        m_nCurMapID = nMapID;
        table.MapDataBase mapDB = GameTableManager.Instance.GetTableItem <table.MapDataBase>(nMapID);
        if (mapDB == null)
        {
            return;
        }

        if (mapDB.dwMaterial == 0)
        {
            // 使用默认材质
            Client.IPlayer pPlayer = Client.ClientGlobal.Instance().MainPlayer;
            if (pPlayer != null)
            {
                // 时装id
                uint uSuit = 0;

                List <GameCmd.SuitData> lstSuit = null;
                pPlayer.GetSuit(out lstSuit);

                if (lstSuit.Count > 0)
                {
                    uSuit = lstSuit[0].baseid;
                    ApplyMaterial(pPlayer, uSuit);
                }
            }
        }
        else
        {
            table.ResourceDataBase res = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(mapDB.dwMaterial);
            if (res == null)
            {
                return;
            }

            if (res.strPath == "")
            {
                return;
            }

            Engine.IRenderObj renderObj = Client.ClientGlobal.Instance().MainPlayer.renderObj;
            if (renderObj != null)
            {
                renderObj.ApplyMaterial(res.strPath);
            }
        }
    }
Ejemplo n.º 4
0
    public bool SceneFileExists(uint mapid)
    {
        if (KDownloadInstance.Instance().IsSmallPackage() == false)
        {
            return(true);
        }

        table.MapDataBase mapDB = GameTableManager.Instance.GetTableItem <table.MapDataBase>(mapid);
        if (mapDB == null)
        {
            Engine.Utility.Log.Error("MapSystem:找不到地图配置数据{0}", mapid);
            return(false);
        }

        table.ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(mapDB.dwResPath);
        if (resDB == null)
        {
            Engine.Utility.Log.Error("MapSystem:找不到地图资源路径配置{0}", mapDB.dwResPath);
            return(false);
        }

        string strMapName = resDB.strPath.ToLower();

        if (Application.platform == RuntimePlatform.Android)
        {
            string strPath = System.IO.Path.Combine(Application.persistentDataPath + "/assets/", strMapName);
            bool   exists  = System.IO.File.Exists(strPath);
            if (exists == false)
            {
                strPath = System.IO.Path.Combine(Application.streamingAssetsPath, strMapName);
                exists  = System.IO.File.Exists(strPath);
            }
            return(exists);
        }
        else if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            string strPath = Application.persistentDataPath + "/" + strMapName;
            bool   exists  = System.IO.File.Exists(strPath);
            if (exists == false)
            {
                strPath = System.IO.Path.Combine(Application.streamingAssetsPath, strMapName);
                exists  = System.IO.File.Exists(strPath);
            }
            return(exists);
        }

        return(true);
    }
Ejemplo n.º 5
0
    //全局事件处理
    public void GlobalEventHandler(int eventid, object data)
    {
        switch (eventid)
        {
        case (int)Client.GameEventID.UIEVENTADDDISPLAYEFFECT:
        {
            uint mapId = (uint)((int)data);
            table.MapDataBase mapDb = GameTableManager.Instance.GetTableItem <table.MapDataBase>(mapId);
            if (null != mapDb)
            {
                AddMapDisplayEffect(mapDb.strName);
            }
        }
        break;

        case (int)Client.GameEventID.ENTITYSYSTEM_LEVELUP:
        {
            Client.stEntityLevelUp lvUp = (Client.stEntityLevelUp)data;
            if (lvUp.uid == DataManager.Instance.UId)
            {
                AddLevelUpEffect();
            }
        }
        break;

        case (int)Client.GameEventID.TASK_DONE:
        {
            AddTaskCompelteEffect();
        }
        break;

        case (int)Client.GameEventID.UIEVENTDISPLAYEFFECTCOMPLETE:
        {
            m_isDoingDisplayEffect = false;
            DoNextParticalDisplayEffect();
        }
        break;

        case (int)Client.GameEventID.UIEVENTCLEARDISPLAYCACHE:
        {
            m_cacheDisplayDatas.Clear();
            m_isDoingDisplayEffect = false;
            //清空tips
            ClearTips();
        }
        break;
        }
    }
Ejemplo n.º 6
0
        public override void FireEvent()
        {
            if (!AffectedObject)
            {
                return;
            }

            if (!Application.isPlaying && Application.isEditor)
            {
            }
            else
            {
                table.MapDataBase data = GameTableManager.Instance.GetTableItem <table.MapDataBase>(sceneID);
                if (data == null)
                {
                    return;
                }
                table.ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(data.dwResPath);
                if (resDB == null)
                {
                    return;
                }

                Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem();
                if (rs != null)
                {
                    string        str   = resDB.strPath;
                    Engine.IScene scene = rs.EnterScene(ref str, SequencerManager.Instance());
                    if (scene != null)
                    {
                        ///¼ÓÔس¡¾°
                        SequencerManager.Instance().Pause();

                        scene.StartLoad(Vector3.one);

                        //±£´æÏÂmapid
                        Client.IMapSystem map = Client.ClientGlobal.Instance().GetMapSystem();
                        SequencerManager.Instance().m_MapID = map.GetMapID();
                    }
                }
            }
        }
Ejemplo n.º 7
0
    void OnBtnTopClick(GameObject go)
    {
        // m_goSelect.transform.parent = m_trans_pkmodel.transform;
        m_transBtnBg.gameObject.SetActive(true);
        m_transBtnBg.transform.DestroyChildren();

        Client.IMapSystem ms = Client.ClientGlobal.Instance().GetMapSystem();
        if (ms == null)
        {
            return;
        }
        table.MapDataBase mapdata = GameTableManager.Instance.GetTableItem <table.MapDataBase>(ms.GetMapID());
        if (mapdata == null)
        {
            return;
        }

        GameObject curBtn = null;

        if (ClientGlobal.Instance().MainPlayer != null)
        {
            int nmodel = ClientGlobal.Instance().MainPlayer.GetProp((int)PlayerProp.PkMode);
            int index  = 0;
            for (int i = (int)PLAYERPKMODEL.PKMODE_M_NONE + 1; i <= (int)PLAYERPKMODEL.PKMODE_M_JUSTICE; i++, index++)
            {
                PLAYERPKMODEL model = (PLAYERPKMODEL)i;
                GameObject    btn   = NGUITools.AddChild(m_transBtnBg.gameObject, m_btnPrefab);
                btn.transform.localPosition = new UnityEngine.Vector3(174, -28 - index * 52, 0);
                btn.gameObject.SetActive(true);
                btn.GetComponentInChildren <UILabel>().text = GetDesByPkModel(model);
                btn.name = i.ToString();
                Transform flagTrans = btn.transform.Find("flag");
                if (flagTrans != null)
                {
                    UISprite sp = flagTrans.GetComponent <UISprite>();
                    if (sp != null)
                    {
                        sp.spriteName = GetFlagByPkModel(model);
                    }
                }
                SetSelect(btn, false);
                SetMask(btn, true);
                if ((int)model == nmodel)
                {
                    curBtn = btn;
                }
                if (mapdata.supportModel == "0")
                {
                    UIEventListener.Get(btn).onClick = OnClickBtn;
                    SetMask(btn, false);
                }
                else
                {
                    string[] param = mapdata.supportModel.Split('_');
                    for (int m = 0; m < param.Length; m++)
                    {
                        int value = int.Parse(param[m]);
                        if (i == value)
                        {
                            UIEventListener.Get(btn).onClick = OnClickBtn;
                            SetMask(btn, false);
                        }
                        else
                        {
                            UIEventListener.Get(btn).onClick = onClickUnenble;
                        }
                    }
                }
            }
            if (curBtn != null)
            {
                SetSelect(curBtn, true);
                SetMask(curBtn, false);
            }
        }
    }
Ejemplo n.º 8
0
    //正常播放完成
    public void PlaybackFinished(WellFired.USSequencer sequencer)
    {
        m_IsPlay = false;

        if (m_SequencerCamera != null)
        {
            GameObject obj    = GameObject.Find("MainCamera");
            Camera     camera = obj.GetComponent <Camera>();
            if (camera != m_SequencerCamera)
            {
                camera.enabled = true;
            }
        }
        m_SequencerCamera = null;
        m_SequencerData   = null;


        // 取消回调
        if (sequencer != null)
        {
            sequencer.PlaybackFinished -= this.PlaybackFinished;
            sequencer.BeforeUpdate     -= this.BeforeUpdate;
        }

        try
        {
            //显示npc
            Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
            if (es != null)
            {
                es.ShowEntity(true);
            }

            //删除剧情gameobject
            if (m_SequencerGameObject != null)
            {
                GameObject.Destroy(m_SequencerGameObject);
                m_SequencerGameObject = null;
            }
            Debug.Log("清理剧情对象");

            //清理剧情对象
            ClearSequencerTempObject();

            //打开声音
            Client.ClientGlobal.Instance().MuteGameSound(false);
        }
        catch
        {
            goto Exit0;
        }
Exit0:
        //隐藏提示
        TipsManager.Instance.EnableTips(true);

        //DataManager.Manager<UIPanelManager>().ShowStoryCachePanel();
        Debug.Log("剧情结束显示UI");
        RoleStateBarManager.ShowHeadStatus();
        //剧情结束隐藏黑边
        DataManager.Manager <UIPanelManager>().HideStory();
        Debug.Log("剧情结束隐藏黑边");
        Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.STORY_PLAY_OVER, null);

        //却换到原场景
        Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem();
        if (m_MapID != 0)
        {
            // 剧情播放完毕加载原场景
            table.MapDataBase data = GameTableManager.Instance.GetTableItem <table.MapDataBase>(m_MapID);
            if (data == null)
            {
                return;
            }
            table.ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(data.dwResPath);
            if (resDB == null)
            {
                return;
            }

            if (rs != null)
            {
                string        str   = resDB.strPath;
                Engine.IScene scene = rs.EnterScene(ref str, SequencerManager.Instance());
                if (scene != null)
                {
                    ///加载场景
                    SequencerManager.Instance().Pause();

                    scene.StartLoad(Vector3.one);
                }
            }
            m_MapID = 0;
        }
    }