示例#1
0
        //草地扰动
        public void SetGrassland()
        {
            bool       value  = ClientGlobal.Instance().gameOption.GetInt("SpecialEffects", "Grassland", 1) == 1;
            IMapSystem mapSys = ClientGlobal.Instance().GetMapSystem();

            mapSys.EnableGrassForce(value);
        }
示例#2
0
        public void SetSettingScreenPriority(uint priority)
        {
            SettingDataBase data = GameTableManager.Instance.GetTableItem <SettingDataBase>(priority);

            if (data != null)
            {
                //草地扰动
                bool       grassIsOpen = (data.GrassMoveGrade != 0) ? true : false;
                IMapSystem mapSys      = ClientGlobal.Instance().GetMapSystem();
                mapSys.EnableGrassForce(grassIsOpen);

                Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem();
                if (rs != null)
                {
                    //实时阴影
                    rs.SetShadowLevel((Engine.ShadowLevel)data.RealTime_Shadow);

                    //特效等级
                    rs.effectLevel = (int)data.ParticleGrade;
                }

                //同屏人数
                Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
                int value = (int)data.PlayerNum;
                if (es != null)
                {
                    if (value > MAX_PLAYER || value < MIN_PLAYER)
                    {
                        value = MIN_PLAYER;
                    }
                    es.MaxPlayer = value;
                }
            }
        }
示例#3
0
        //-------------------------------------------------------------------------------------------------------
        // 查找最近的目标点
        private bool FindLastTarget(Vector3 curPos, float fAngle, out Vector3 target)
        {
            target = new Vector3();
            IMapSystem mapSys = m_ClientGlobal.GetMapSystem();

            if (mapSys != null)
            {
                Vector3    tar    = new Vector3();
                Quaternion rotate = new Quaternion();
                rotate.eulerAngles = new Vector3(0, fAngle, 0);
                Matrix4x4 mat = new Matrix4x4();
                mat.SetTRS(Vector3.zero, rotate, Vector3.one);

                // 获取矩阵中的轴向量
                //Quaternion rot = new Quaternion();
                Vector4 dir = mat.GetColumn(2);    // Z
                Vector3 dd  = new Vector3(dir.x, dir.y, dir.z);

                for (int i = FORWARD_MAXDIS; i >= 1; --i)
                {
                    tar = curPos + dd * i;
                    if (mapSys.CanWalk(tar))
                    {
                        target = tar;
                        return(true);
                    }
                }
            }

            return(false);
        }
示例#4
0
    // 进入场景
    public void Enter()
    {
        HomeSceneID = GameTableManager.Instance.GetGlobalConfig <uint>("HomeSceneID");
        IMapSystem mapSys = ClientGlobal.Instance().GetMapSystem();

        if (mapSys == null)
        {
            return;
        }

        mapSys.EnterMap(HomeSceneID, Vector3.zero);

        IControllerSystem cs = ClientGlobal.Instance().GetControllerSystem();

        if (cs == null)
        {
            return;
        }

        Client.IPlayer mainPlayer = ClientGlobal.Instance().MainPlayer;
        if (mainPlayer != null)
        {
            mainPlayer.SendMessage(EntityMessage.EntityCommand_SetVisible, false);
        }
        cs.GetActiveCtrl().SetClickSink(this);

        m_AnimalManager.Init();
    }
示例#5
0
        public void SetUp()
        {
            _systemContainer = Substitute.For <ISystemContainer>();

            _entityEngine = Substitute.For <IEntityEngine>();
            _systemContainer.EntityEngine.Returns(_entityEngine);
            _mutableEntities = new List <IEntity>();
            _entityEngine.MutableEntities.Returns(_mutableEntities);

            _mapSystem = Substitute.For <IMapSystem>();
            _systemContainer.MapSystem.Returns(_mapSystem);
            _mapCollection = new Atlas();
            _mapSystem.MapCollection.Returns(_mapCollection);

            _messageSystem = Substitute.For <IMessageSystem>();
            _systemContainer.MessageSystem.Returns(_messageSystem);
            _messages = new List <Message>();
            _messageSystem.AllMessages.Returns(_messages);

            _timeSystem = Substitute.For <ITimeSystem>();
            _systemContainer.TimeSystem.Returns(_timeSystem);
            _currentTime = 0;
            _timeSystem.CurrentTime.Returns(_currentTime);

            _worldGenerator = Substitute.For <IWorldGenerator>();

            _saveSystem = new SaveSystem(_systemContainer, _worldGenerator);
        }
 public MoveAwayFromPlayerBehaviour(ISystemContainer systemContainer)
 {
     _positionSystem  = systemContainer.PositionSystem;
     _eventRuleSystem = systemContainer.EventSystem;
     _playerSystem    = systemContainer.PlayerSystem;
     _mapSystem       = systemContainer.MapSystem;
     _random          = systemContainer.Random;
 }
示例#7
0
 public AttackClosestEnemyBehaviour(ISystemContainer systemContainer)
 {
     _positionSystem  = systemContainer.PositionSystem;
     _eventRuleSystem = systemContainer.EventSystem;
     _playerSystem    = systemContainer.PlayerSystem;
     _mapSystem       = systemContainer.MapSystem;
     _factionSystem   = systemContainer.FactionSystem;
 }
示例#8
0
        //-------------------------------------------------------------------------------------------------------
        public void StopMove()
        {
            if (m_Host == null)
            {
                return;
            }

            IMapSystem mapSys = m_ClientGlobal.GetMapSystem();

            if (mapSys == null)
            {
                return;
            }

            if (!m_bJoystick)
            {
                return;
            }

            m_bJoystick = false;

            Engine.Utility.TimerAxis.Instance().KillTimer(MoveController.MOVE_TIMER, this);
            m_bRotating    = false;
            m_fTargetAngle = 0.0f;
            if (m_Host.GetCurState() == CreatureState.Move)
            {
                m_Host.SendMessage(EntityMessage.EntityCommand_StopMove, (object)m_Host.GetPos());
            }

            //GameCmd.stUserMoveStopMoveUserCmd_CS stopmove = new GameCmd.stUserMoveStopMoveUserCmd_CS();
            //stopmove.mapid = mapSys.GetMapID();
            //stopmove.charid = (uint)m_Host.GetID();
            //Vector3 pos = m_Host.GetPos();
            //GameCmd.SmallPos pp = new GameCmd.SmallPos();
            //pp.x = (uint)(pos.x * 100);
            //pp.y = (uint)(-pos.z * 100);
            //stopmove.pos = pp;

            //if (ControllerSystem.m_ClientGlobal.IsMainPlayer(m_Host))
            //{
            //    // 同步移动消息
            //    m_ClientGlobal.netService.Send(stopmove);
            //}

            ////GameCmd.stUserStopMoveUserCmd_C cmd = new GameCmd.stUserStopMoveUserCmd_C()
            ////{
            ////    client_time = m_ClientGlobal.GetEntitySystem().serverTime
            ////};

            ////Engine.Utility.Log.LogGroup("XXF", "StopMove {0}", cmd.client_time);

            ////if (m_ClientGlobal.IsMainPlayer(m_Host)) // 只有主角才同步
            ////{
            ////    m_ClientGlobal.netService.Send(cmd); // 同步网络消息
            ////}
        }
示例#9
0
        void PreLoadEntity(uint mapID)
        {
            if (m_preLoadMapIDList.Count == 0)
            {
                return;
            }
            if (!m_preLoadMapIDList.Contains(mapID))
            {
                return;
            }
            //bSettingNotPreLoad = PlayerPrefs.GetInt("ePreLoad", 0) == 1 ? true : false;
            if (bSettingNotPreLoad)
            {
                return;
            }
            IMapSystem ms = EntitySystem.m_ClientGlobal.GetMapSystem();

            if (ms == null)
            {
                return;
            }

            preLoadMonsterList.Clear();
            preLoadNpcList.Clear();
            Dictionary <int, List <NPCInfo> > m_dic = ms.GetMapXmlInfo();
            var iter = m_dic.GetEnumerator();

            while (iter.MoveNext())
            {
                var dic = iter.Current;
                table.NpcDataBase npcData = GameTableManager.Instance.GetTableItem <table.NpcDataBase>((uint)dic.Key);
                if (npcData != null)
                {//只预载普通怪
                    if (npcData.dwMonsterType == 1 && npcData.dwType == 0)
                    {
                        if (!preLoadMonsterList.Contains(npcData.dwModelSet))
                        {
                            preLoadMonsterList.Add(npcData.dwModelSet);
                        }
                    }
                    else if (npcData.dwMonsterType == 0 && npcData.dwType == 2)
                    {//功能npc
                        if (!preLoadNpcList.Contains(npcData.dwModelSet))
                        {
                            preLoadNpcList.Add(npcData.dwModelSet);
                        }
                    }
                }
            }
            if (TimerAxis.Instance().IsExist(m_uTimerID, this))
            {
                TimerAxis.Instance().KillTimer(m_uTimerID, this);
            }
            TimerAxis.Instance().SetTimer(m_uTimerID, 100, this);
            LoadEntity();
        }
示例#10
0
 public FollowPathBehaviour(ISystemContainer systemContainer)
 {
     _positionSystem  = systemContainer.PositionSystem;
     _eventRuleSystem = systemContainer.EventSystem;
     _playerSystem    = systemContainer.PlayerSystem;
     _mapSystem       = systemContainer.MapSystem;
     _entityEngine    = systemContainer.EntityEngine;
     _messageSystem   = systemContainer.MessageSystem;
     _timeSystem      = systemContainer.TimeSystem;
 }
示例#11
0
        public void SetCameraDistance()
        {
            table.MapDataBase mapdb  = null;
            IMapSystem        mapSys = Client.ClientGlobal.Instance().GetMapSystem();

            if (mapSys != null)
            {
                mapdb = GameTableManager.Instance.GetTableItem <table.MapDataBase>(mapSys.GetMapID());
                CameraFollow.Instance.SetCameraDis(isFarDisCamera ? mapdb.farDistance : mapdb.CamDis);
            }
        }
示例#12
0
    public int GetCurMapID()
    {
        IMapSystem ms = Client.ClientGlobal.Instance().GetMapSystem();

        if (ms != null)
        {
            uint mapID = ms.GetMapID();
            return((int)mapID);
        }
        return(-1);
    }
示例#13
0
    void InitNpcDic()
    {
        allNpcList.Clear();

        IMapSystem ms = Client.ClientGlobal.Instance().GetMapSystem();

        if (ms != null)
        {
            ms.GetAllNpcInfo(out allNpcList);
        }
    }
示例#14
0
    void onClick_Btn_leavehome_Btn(GameObject caster)
    {
        HomeScene.Instance.Leave();
        IMapSystem mapSys = ClientGlobal.Instance().GetMapSystem();

        if (mapSys == null)
        {
            return;
        }

        mapSys.EnterMap(2, Vector3.zero);
    }
示例#15
0
        public void SetupMainCamera(IPlayer player)
        {
            float fRotateX = 38.0f;
            float fRotateY = 45.0f;

            table.MapDataBase mapdb  = null;
            IMapSystem        mapSys = Client.ClientGlobal.Instance().GetMapSystem();

            if (mapSys != null)
            {
                mapdb = GameTableManager.Instance.GetTableItem <table.MapDataBase>(mapSys.GetMapID());
                if (mapdb != null)
                {
                    fRotateX = mapdb.RotateX;
                    fRotateY = mapdb.RotateY;
                }
            }

            // 发送事件 CreateEntity
            string strCameraName = "MainCamera";

            Engine.ICamera cam = Engine.RareEngine.Instance().GetRenderSystem().GetCamera(ref strCameraName);
            if (cam != null)
            {
                CameraFollow.Instance.camera = cam;
                CameraFollow.Instance.target = player;
                CameraFollow.Instance.SetCameraOffset(fRotateX, fRotateY, isFarDisCamera ? mapdb.CamDis : mapdb.farDistance);
                cam.SetCameraCtrl(CameraFollow.Instance);
            }

            if (cam != null)
            {
                if (cam.GetNode().GetTransForm().gameObject.GetComponent <PostRenderOcclusionEffect>() == null)
                {
                    //PostRenderOcclusionEffect pEffect = cam.GetNode().GetTransForm().gameObject.AddComponent<PostRenderOcclusionEffect>();
                    //SeeThroughSystem pEffect = cam.GetNode().GetTransForm().gameObject.AddComponent<SeeThroughSystem>();
                }


                if (cam.GetNode().GetTransForm().gameObject.GetComponent <PostRenderOutlineEffect>() == null)
                {
                    //PostRenderOutlineEffect pEffect = cam.GetNode().GetTransForm().gameObject.AddComponent<PostRenderOutlineEffect>();
                    //SeeThroughSystem pEffect = cam.GetNode().GetTransForm().gameObject.AddComponent<SeeThroughSystem>();
                }
            }



            // 设置场景方向光参数 需要根据Camera来
            Shader.SetGlobalColor("g_LightColor", Color.white);
            // 设置方向
            Shader.SetGlobalVector("g_LightDirection", -GetMainCamDir());
        }
示例#16
0
        //-------------------------------------------------------------------------------------------------------

        /**
         * @brief 按一定方向移动
         * @param
         */
        public void MoveByDir(float fAngle, bool bSyncPath = true, bool bSync = true)
        {
            if (m_bSkillLongPress)
            {
                //点击摇杆 解除长按

                stSkillLongPress longPress = new stSkillLongPress();
                longPress.bLongPress = false;
                EventEngine.Instance().DispatchEvent((int)GameEventID.SKLL_LONGPRESS, longPress);
            }
            //不在禁用摇杆
            //if(bForbiddenJoystick)
            //{
            //    return;
            //}
            IMapSystem mapSys = m_ClientGlobal.GetMapSystem();

            if (mapSys != null)
            {
                if (m_Host == null)
                {
                    return;
                }
                // 发起移动投票,询问其它系统,是否可以移动
                stVoteEntityMove entitymove;
                entitymove.uid = m_Host.GetUID();
                if (!Engine.Utility.EventEngine.Instance().DispatchVote((int)GameVoteEventID.ENTITYSYSTEM_VOTE_ENTITYMOVE, entitymove))
                {
                    // 其它系统不允许移动
                    Engine.Utility.Log.LogGroup("ZDY", " *********************DispatchVote((int)GameVoteEventID.ENTITYSYSTEM_VOTE_ENTITYMOVE,  其它系统不允许移动");
                    return;
                }
                else
                {
                    Engine.Utility.Log.LogGroup("XXF", " *********************MoveByDir,  允许移动");
                }
                // 移动 向前预测一定距离,寻路
                Vector3 pos    = m_Host.GetPos();
                Vector3 target = new Vector3();
                if (!FindLastTarget(pos, fAngle, out target))
                {
                    //Engine.Utility.Log.Trace("摇杆方向有障碍,停止移动!");
                    m_bJoystick = false;
                    m_Host.SendMessage(EntityMessage.EntityCommand_SetRotateY, fAngle);
                    m_Host.SendMessage(EntityMessage.EntityCommand_StopMove, pos);
                    return;
                }

                // 移动 只同步当前位置
                MoveToTarget(target, null, bSyncPath, bSync);
            }
        }
示例#17
0
    public void Execute(GameCmd.stRefreshSceneIdDataUserCmd_S cmd)
    {
        // 更换地图
        IMapSystem mapSystem = ClientGlobal.Instance().GetMapSystem();

        if (mapSystem != null && UserData.IsMainRoleID(cmd.userid))
        {
            uint uid        = (cmd.sceneid & 0xff);
            uint uCountryid = (cmd.sceneid >> 8);

            mapSystem.EnterMap(uid, Vector3.zero);
        }
    }
示例#18
0
 public void SyncTracePos(stNpcTraceMoveUserCmd_S cmd)
 {
     if (Application.isEditor)
     {
         IMapSystem mapSys = ClientGlobal.Instance().GetMapSystem();;
         if (mapSys == null)
         {
             Engine.Utility.Log.Error("ExecuteCmd: mapSys is null");
             return;
         }
         mapSys.TraceServerPos(cmd.add, (int)cmd.x, (int)cmd.y);
     }
 }
        private static PositionSystem SetUpTestPositionSystemWithPathfindingAlgorithm(out IPathfindingAlgorithm pathfindingAlgorithm)
        {
            pathfindingAlgorithm = Substitute.For <IPathfindingAlgorithm>();
            IEntityEngine entityEngine = Substitute.For <IEntityEngine>();
            IMapSystem    mapSystem    = Substitute.For <IMapSystem>();

            mapSystem.MapCollection.Returns(new Atlas()
            {
                { new MapKey(TEST_MAP_NAME), Substitute.For <IMap>() }
            });
            var testPositionSystem = new PositionSystem(mapSystem, entityEngine, pathfindingAlgorithm);

            return(testPositionSystem);
        }
示例#20
0
 void MapData_ValueUpdateEvent(object sender, ValueUpdateEventArgs e)
 {
     if (e.key == MapDispatchEnum.RefreshLineNum.ToString())
     {
         IMapSystem mapsys = Client.ClientGlobal.Instance().GetMapSystem();
         if (mapsys != null)
         {
             if (m_label_MapName != null)
             {
                 m_label_MapName.text = string.Format("{0}({1}{2})", mapsys.GetMapName(), MapData.CurLineNum, CommonData.GetLocalString("线"));
             }
         }
     }
 }
示例#21
0
    public IEnumerator WaitForMainPlayer()
    {
        while (ClientGlobal.Instance().MainPlayer == null)
        {
            yield return(null);
        }
        IMapSystem ms = ClientGlobal.Instance().GetMapSystem();

        if (ms.Process >= 1.0f)
        {
            DoDie();
        }
        yield return(null);
    }
示例#22
0
        private void FindTargetList()
        {
            m_lstEntity.Clear();
            playerPos = ControllerSystem.m_ClientGlobal.MainPlayer.GetPos();
            uint          range   = GameTableManager.Instance.GetGlobalConfig <uint>("Switch_Target_Range");
            Camera        c       = camera;
            int           pkmodel = ControllerSystem.m_ClientGlobal.MainPlayer.GetProp((int)PlayerProp.PkMode);
            PLAYERPKMODEL model   = (PLAYERPKMODEL)pkmodel;
            IMapSystem    ms      = ControllerSystem.m_ClientGlobal.GetMapSystem();

            if (ms == null)
            {
                return;
            }
            MapAreaType areaType = ms.GetAreaTypeByPos(ControllerSystem.m_ClientGlobal.MainPlayer.GetPos());

            if (areaType == MapAreaType.Safe)
            {
                FindEntity <INPC>(new MonsterDistanceCondition(playerPos, range));
            }
            else
            {
                if (model == PLAYERPKMODEL.PKMODE_M_NORMAL)//和平 0默认和平
                {
                    FindEntity <INPC>(new MonsterDistanceCondition(playerPos, range));
                }
                else
                {
                    FindEntity <IPlayer>(new PlayerDistanceCondition(model, playerPos, range));
                }
            }


            //if (model == PLAYERPKMODEL.PKMODE_M_NORMAL)//和平 0默认和平
            //{
            //    FindEntity<INPC>(new MonsterDistanceCondition(playerPos, c));
            //}
            //else if (model == PLAYERPKMODEL.PKMODE_M_FREEDOM)//自由pk
            //{
            //    FindEntity<IPlayer>(new PlayerDistanceCondition(playerPos, c));
            //    FindEntity<INPC>(new MonsterDistanceCondition(playerPos, c));
            //}
            //else if (model == PLAYERPKMODEL.PKMODE_M_CAMP)//阵营战 不能攻击友方 demo 阶段只判断是不是一个阵营即可
            //{
            //    FindEntity<IPlayer>(new CountryDistanceCondition(playerPos, c, pkmodel));
            //    FindEntity<INPC>(new MonsterDistanceCondition(playerPos, c));
            //}
            m_lstEntity.Sort(Sort);
        }
示例#23
0
    /// <summary>
    /// 是否与玩家自己是同一张地图
    /// </summary>
    /// <param name="mapId"></param>
    /// <returns></returns>
    bool IsSameMap(uint leaderMapId)
    {
        IMapSystem ms = ClientGlobal.Instance().GetMapSystem();

        if (ms != null)
        {
            uint myMapId = ms.GetMapID();

            return(myMapId == leaderMapId);
        }
        else
        {
            Engine.Utility.Log.Error("IMapSystem 为 null !!!");
            return(false);
        }
    }
示例#24
0
    protected override void OnShow(object data)
    {
        base.OnShow(data);
        m_sliderPro.value = 0.0f;
        mapSystem         = ClientGlobal.Instance().GetMapSystem();
        if (mapSystem != null)
        {
            Progress = 0f;
            update   = true;
        }

        if (m_lstTips.Count <= 0)
        {
            List <table.LoadingTipsDatabase> lstTips = GameTableManager.Instance.GetTableList <table.LoadingTipsDatabase>();
            for (int i = 0; i < lstTips.Count; i++)
            {
                if (!string.IsNullOrEmpty(lstTips[i].strText))
                {
                    m_lstTips.Add(lstTips[i].strText);
                }
            }

            m_lstTexture.Add((uint)TextureID.Loadingbg);
            m_lstTexture.Add((uint)TextureID.Loadingbg2);
        }

        int tipRandom = UnityEngine.Random.Range(0, m_lstTips.Count);
        int texRandom = UnityEngine.Random.Range(0, m_lstTexture.Count);

        m_tipsLabel.text = m_lstTips[tipRandom];
        if (null != m__texture)
        {
            if (null != tex)
            {
                tex.ReleaseReference();
                tex = null;
            }
            tex = UIManager.GetTexture(m_lstTexture[texRandom]);
            if (tex != null)
            {
                m__texture.mainTexture = tex.GetTexture();
                m__texture.Update();
                m__texture.SetDirty();
                m__texture.MarkAsChanged();
            }
        }
    }
示例#25
0
    void GotoMap(int mapID)
    {
        if (mapID != 0)
        {
            IMapSystem mapSystem = Client.ClientGlobal.Instance().GetMapSystem();
            if (mapSystem.GetMapID() == mapID)
            {
                //你就在这个场景
                TipsManager.Instance.ShowTipsById(514);
                return;
            }
            Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem();
            if (cs != null)
            {
                cs.GetCombatRobot().Stop();// 停止挂机
            }
            TransferDatabase tdb = GameTableManager.Instance.GetTableItem <TransferDatabase>((uint)mapID);
            if (tdb != null)
            {
                if (!MainPlayerHelper.IsHasEnoughMoney(tdb.costType, tdb.costValue, true))
                {
                    return;
                }
            }
            //DataManager.Manager<SliderDataManager>().SetSliderDelagate(() =>
            //{

            if (!KHttpDown.Instance().SceneFileExists((uint)mapID))
            {
                //打开下载界面
                DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.DownloadPanel);
                HideSelf();
                return;
            }

            IMapSystem ms = ClientGlobal.Instance().GetMapSystem();
            if (ms != null)
            {
                ms.RequestEnterMap((uint)mapID, 1);
            }
            //}, null, 3f);

            HideSelf();
        }
        m_ctor_bgContent.SetVisible(false);
        m_btn_ColliderMask.gameObject.SetActive(false);
    }
示例#26
0
    /// <summary>
    /// 是否在钓鱼区域
    /// </summary>
    /// <returns></returns>
    public bool IsInFishingArea()
    {
        IMapSystem ms = Client.ClientGlobal.Instance().GetMapSystem();

        if (ms == null)
        {
            return(false);
        }

        IPlayer mainPlayer = Client.ClientGlobal.Instance().MainPlayer;

        if (mainPlayer == null)
        {
            return(false);
        }

        return(ms.GetAreaTypeByPos(mainPlayer.GetPos()) == MapAreaType.Fish);
    }
示例#27
0
 public void ShowInfo(ChangeLineInfo info)
 {
     LineNum = info.lineNum;
     if (m_labelPlayerNum != null)
     {
         m_labelPlayerNum.text = info.playerNum.ToString() + CommonData.GetLocalString("人");
     }
     if (m_labelLineNum != null)
     {
         IMapSystem ms = Client.ClientGlobal.Instance().GetMapSystem();
         if (ms != null)
         {
             string str = ms.GetMapName() + "(" + info.lineNum + CommonData.GetLocalString("线") + ")";
             m_labelLineNum.text = str;
         }
     }
     ShowSign(info.playerNum);
 }
示例#28
0
    /// <summary>
    /// 点击事件
    /// </summary>
    /// <param name="eventType"></param>
    /// <param name="data"></param>
    /// <param name="param"></param>
    private void OnReliveGridEventDlg(UIEventType eventType, object data, object param)
    {
        if (eventType == UIEventType.Click)
        {
            UIReliveGrid grid = data as UIReliveGrid;
            if (grid == null)
            {
                return;
            }

            if (grid.m_info.reliveId == 1)
            {
                IMapSystem mapSys = ClientGlobal.Instance().GetMapSystem();
                if (mapSys == null)
                {
                    return;
                }
                uint uCurMapID = mapSys.GetMapID();

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

                uint rebackMapID = mapDB.rebackMapID;

                if (!KHttpDown.Instance().SceneFileExists(rebackMapID))
                {
                    // 复活点复活
                    DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.DownloadPanel);
                    HideSelf();
                    return;
                }
            }


            GameCmd.stOKReliveUserCmd_C cmd = new GameCmd.stOKReliveUserCmd_C();
            cmd.byType       = grid.m_info.reliveId;
            cmd.dwUserTempID = ClientGlobal.Instance().MainPlayer.GetID();
            cmd.dwNpcID      = 0;
            NetService.Instance.Send(cmd);
        }
    }
示例#29
0
    private void CreateTextureEvent(ITexture obj, object param = null)
    {
        IMapSystem mapsys = Client.ClientGlobal.Instance().GetMapSystem();

        if (mapsys == null)
        {
            Engine.Utility.Log.Error("Mapsystem is null");
            return;
        }
        if (m_texture != null)
        {
            mapTex.mainTexture = m_texture.GetTexture();

            mapTex.MakePixelPerfect();
        }
        else
        {
            string texpath = (string)param;
            Log.Error("texture is null texpath is " + texpath);
        }
        m_mapid = mapsys.GetMapID();
        table.MapDataBase mdb = GameTableManager.Instance.GetTableItem <table.MapDataBase>(m_mapid);
        if (mdb != null)
        {
            string   pos = mdb.uioffset;
            string[] xy = pos.Split('_');
            float    x = 0, y = 0;
            if (xy.Length == 2)
            {
                if (float.TryParse(xy[0], out x))
                {
                    if (float.TryParse(xy[1], out y))
                    {
                        originPos = new Vector3(x, y, 0);
                    }
                }
            }
        }
        m_mapTextureWidth              = mdb.textureWidth;
        m_mapTextureHeight             = mdb.textureWidth;
        mapTex.width                   = (int)m_mapTextureWidth;
        mapTex.height                  = (int)m_mapTextureHeight;
        mapTex.transform.localPosition = originPos;
    }
示例#30
0
        //-------------------------------------------------------------------------------------------------------
        // 游戏退出时使用
        public void Release()
        {
            if (m_LuaSystem != null)              // Lua系统
            {
                m_LuaSystem.Release();
                m_LuaSystem = null;
            }

            if (m_SkillSys != null)
            {
                m_SkillSys.Release();
                m_SkillSys = null;
            }

            if (m_EntitySys != null)           // 实体系统
            {
                m_EntitySys.Release();
                m_EntitySys = null;
            }

            // 技能系统
            if (m_ControllerSys != null)   // 控制器系统
            {
                m_ControllerSys.Release();
                m_ControllerSys = null;
            }

            if (m_MapSystem != null)              // 地图系统
            {
                m_MapSystem.Release();
                m_MapSystem = null;
            }

            // 游戏设置
            if (m_GameOption != null)
            {
                GameOption op = m_GameOption as GameOption;
                if (op != null)
                {
                    op.Close();
                }
            }
        }