Example #1
0
        public void AddRobot(t_MapNpcDataPos data, uint master_id)
        {
            if (data == null)
            {
                return;
            }

            Engine.Utility.Log.Trace("添加ROBOT:{0}", data.mapnpcdata.npcdata.dwBaseID);

            IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

            if (es == null)
            {
                Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
                return;
            }

            if (es.FindRobot(data.mapnpcdata.npcdata.dwTempID) != null)
            {
                CreateNPC(data, master_id); // 更新数据
                return;
            }

            if (m_dicNPCData.ContainsKey(data.mapnpcdata.npcdata.dwTempID))
            {
                return;
            }

            CreateNPC(data, master_id);
        }
Example #2
0
        //音效滑动条
        public void SetSoundEffectsslider()
        {
            float value = ClientGlobal.Instance().gameOption.GetInt("Sound", "SoundEffectsslider", 0) / 100.0f;

            Engine.IAudio au = Engine.RareEngine.Instance().GetAudio();
            au.SetEffectVolume(value);
        }
Example #3
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;
                }
            }
        }
Example #4
0
        public void SetBlockMonster()
        {
            bool value = ClientGlobal.Instance().gameOption.GetInt("SpecialEffects", "BlockMonster", 1) == 1;

            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.HIDEMONSTER, value);
            //            EntitySystem.EntityHelper.ShowMonster(!value);
        }
Example #5
0
        //草地扰动
        public void SetGrassland()
        {
            bool       value  = ClientGlobal.Instance().gameOption.GetInt("SpecialEffects", "Grassland", 1) == 1;
            IMapSystem mapSys = ClientGlobal.Instance().GetMapSystem();

            mapSys.EnableGrassForce(value);
        }
Example #6
0
        public void SetCheckSound()
        {
            bool value = ClientGlobal.Instance().gameOption.GetInt("Sound", "CheckSound", 1) == 1;

            Engine.IAudio au = Engine.RareEngine.Instance().GetAudio();
            au.Mute(value);
            cancelSound = value;
        }
Example #7
0
 //         //音效开关
 //         public void SetCheckSoundEffects()
 //         {
 //             int value = ClientGlobal.Instance().gameOption.GetInt("Sound", "CheckSoundEffects", 1);
 //         }
 //         //技能声音开关
 //         public void SetCheckVoice()
 //         {
 //             int value = ClientGlobal.Instance().gameOption.GetInt("Sound", "CheckVoice", 1);
 //         }
 //音量滑动条
 public void Setsoundslider()
 {
     if (!cancelSound)
     {
         float         value = ClientGlobal.Instance().gameOption.GetInt("Sound", "soundslider", 0) / 100.0f;
         Engine.IAudio au    = Engine.RareEngine.Instance().GetAudio();
         au.SetMusicVolume(value);
     }
 }
Example #8
0
        public static ClientGlobal Instance()
        {
            if (null == s_Inst)
            {
                s_Inst = new ClientGlobal();
            }

            return(s_Inst);
        }
Example #9
0
        public void AddNPC(t_MapNpcDataPos data, uint master_id)
        {
            Profiler.BeginSample("AddNpc");
            if (data == null)
            {
                return;
            }

            Engine.Utility.Log.Trace("添加NPC:{0}", data.mapnpcdata.npcdata.dwBaseID);

            IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

            if (es == null)
            {
                Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
                return;
            }

            table.NpcDataBase npctable = GameTableManager.Instance.GetTableItem <table.NpcDataBase>((uint)data.mapnpcdata.npcdata.dwBaseID);
            if (npctable == null)
            {
                Engine.Utility.Log.Error("严重错误:not fount npc baseid {0}", data.mapnpcdata.npcdata.dwBaseID);
                return;
            }

            if (npctable.dwType == (uint)GameCmd.enumNpcType.NPC_TYPE_ROBOT)
            {
                if (es.FindRobot(data.mapnpcdata.npcdata.dwTempID) != null)
                {
                    CreateRobot(data, npctable.job); // 更新数据
                    return;
                }

                if (m_dicNPCData.ContainsKey(data.mapnpcdata.npcdata.dwTempID))
                {
                    return;
                }

                CreateRobot(data, npctable.job);
            }
            else
            {
                if (es.FindNPC(data.mapnpcdata.npcdata.dwTempID) != null)
                {
                    CreateNPC(data, master_id); // 更新数据
                    return;
                }

                if (m_dicNPCData.ContainsKey(data.mapnpcdata.npcdata.dwTempID))
                {
                    return;
                }

                CreateNPC(data, master_id);
            }
            Profiler.EndSample();
        }
Example #10
0
        //攻击目标--无
        public void SetSettingNone()
        {
            bool value = ClientGlobal.Instance().gameOption.GetInt("AttackTarget", "SettingNone", 1) == 1;

            if (value)
            {
                this.AttackPriority = eAttackPriority.Creature;
            }
        }
Example #11
0
        //攻击目标--怪物优先
        public void SetSettingMonster()
        {
            bool value = ClientGlobal.Instance().gameOption.GetInt("AttackTarget", "SettingMonster", 1) == 1;

            if (value)
            {
                this.AttackPriority = eAttackPriority.Monster;
            }
        }
Example #12
0
        private void CreateRobot(GameCmd.t_MapNpcDataPos npcdata, uint job)
        {
            Profiler.BeginSample("CreateRobot");
            IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

            if (es == null)
            {
                Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
                return;
            }

            Vector3 pos = new Vector3(npcdata.cur_pos.x * 0.01f, 0, -npcdata.cur_pos.y * 0.01f); // 服务器到客户端坐标转换

            npcdata.mapnpcdata.npcdata.job = job;

            EntityCreateData data  = RoleUtil.BuildCreateEntityData(EntityType.EntityTYpe_Robot, npcdata, 0);
            IRobot           robot = es.FindRobot(npcdata.mapnpcdata.npcdata.dwTempID);

            if (robot != null)
            {
                robot.UpdateProp(data);
            }
            else
            {
                robot = es.CreateEntity(EntityType.EntityTYpe_Robot, data, !m_bDelayLoad) as IRobot;
                // 发送事件 CreateEntity
                if (robot != null)
                {
                    PlayAni anim_param = new PlayAni();
                    anim_param.strAcionName = EntityAction.Stand;
                    anim_param.fSpeed       = 1;
                    anim_param.nStartFrame  = 0;
                    anim_param.nLoop        = -1;
                    anim_param.fBlendTime   = 0.2f;
                    robot.SendMessage(EntityMessage.EntityCommand_PlayAni, anim_param);

                    if (!string.IsNullOrEmpty(npcdata.mapnpcdata.npcdata.name) && !Application.isEditor)
                    {
                        robot.SendMessage(EntityMessage.EntityCommond_SetName, npcdata.mapnpcdata.npcdata.name);
                    }
                    else
                    {
                        string strName = string.Format("{0}(AI)", npcdata.mapnpcdata.npcdata.name);
                        robot.SendMessage(EntityMessage.EntityCommond_SetName, npcdata.mapnpcdata.npcdata.name);
                    }
                }
            }

            Engine.Utility.Log.Info("创建机器人 {0} pos {1}", robot.GetID(), pos);

            robot.SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos);
            Vector3 rot = GameUtil.S2CDirection(npcdata.mapnpcdata.npcdata.byDirect);

            robot.SendMessage(EntityMessage.EntityCommand_SetRotate, (object)rot);
            Profiler.EndSample();
        }
Example #13
0
        public void SetRenderShadow()
        {
            int nShadowLevel = ClientGlobal.Instance().gameOption.GetInt("Render", "shadow", 0);

            Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem();
            if (rs != null)
            {
                rs.SetShadowLevel((Engine.ShadowLevel)nShadowLevel);
            }
        }
Example #14
0
        //同屏人数
        public void SetScreenNumberslider()
        {
            Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem();
            int value = ClientGlobal.Instance().gameOption.GetInt("OneScreen", "ScreenNumberslider", 0);

            if (es != null)
            {
                if (value > MAX_PLAYER || value < MIN_PLAYER)
                {
                    value = MIN_PLAYER;
                }
                es.MaxPlayer = value;
            }
        }
Example #15
0
        public void AddPet(PetData petdata)
        {
            if (petdata == null)
            {
                return;
            }

            IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

            if (es == null)
            {
                Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
                return;
            }

            if (es.FindPet(petdata.id) == null)
            {
                AddPetEntity(petdata);
                return;
            }
        }
Example #16
0
        public IBox AddBox(t_MapObjectData BoxData, uint nlefttime)
        {
            if (BoxData == null)
            {
                return(null);
            }
            //Engine.Utility.Log.Info("创建box{0}", BoxData.dwObjectID);
            IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

            if (es == null)
            {
                Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
                return(null);
            }

//            if (es.FindBox(BoxData.qwThisID) == null)
            {
                //AddPetEntity(petdata);
                // 创建box
                //MapVector2 mapPos = MapVector2.FromCoordinate(BoxData.x, BoxData.y);
                Vector3 pos = new Vector3(BoxData.cur_pos.x * 0.01f, 0, -BoxData.cur_pos.y * 0.01f); // 服务器到客户端坐标转换

                EntityCreateData data = RoleUtil.BuildCreateEntityData(EntityType.EntityType_Box, BoxData);
                IBox             box  = es.FindBox(BoxData.qwThisID);
                if (box != null)
                {
                    box.UpdateProp(data);
                }
                else
                {
                    box = es.CreateEntity(EntityType.EntityType_Box, data, true) as IBox;
                }

                box.SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos);
                box.AddTrigger(new BoxOnTrigger());
                return(box);
            }
            return(null);
        }
Example #17
0
        IPet AddPetEntity(PetData petdata)
        {
            IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

            if (es == null)
            {
                Engine.Utility.Log.Error("严重错误:EntitySystem is null!");
                return(null);
            }
            EntityCreateData entityData = new EntityCreateData();

            entityData.ID       = petdata.id;
            entityData.PropList = new EntityAttr[(int)PetProp.End - (int)EntityProp.Begin];
            RoleUtil.BuildPetPropListByPetData(petdata, ref entityData.PropList);
            IPet pet = es.CreateEntity(EntityType.EntityType_Pet, entityData) as IPet;

            if (pet != null)
            {
                pet.SetExtraData(petdata);
                return(pet);
            }

            return(null);
        }
Example #18
0
        public void SetBlockFashion()
        {
            bool value = ClientGlobal.Instance().gameOption.GetInt("SpecialEffects", "BlockFashion", 1) == 1;

            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.HIDEFASHION, value);
        }
Example #19
0
        public void SetotherEffect()
        {
            bool value = ClientGlobal.Instance().gameOption.GetInt("SpecialEffects", "otherEffect", 1) == 1;

            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.HIDETEXIAO_OTHER, value);
        }
Example #20
0
        public void SetHpDisplay()
        {
            bool value = ClientGlobal.Instance().gameOption.GetInt("ShowDetail", "HpDisplay", 1) == 1;

            RoleStateBarManager.SetHpSliderVisible(value);
        }
Example #21
0
 public void SetHurtDisplay()
 {
     bool value = ClientGlobal.Instance().gameOption.GetInt("ShowDetail", "HurtDisplay", 1) == 1;
     // FlyFontDataManager.Instance.m_bShowFlyFont = value;
 }
Example #22
0
        public void SetMonsterName()
        {
            bool value = ClientGlobal.Instance().gameOption.GetInt("ShowDetail", "MonsterName", 1) == 1;

            RoleStateBarManager.SetNpcNameVisible(value);
        }
Example #23
0
        void SetSettingFixedRocker()
        {
            bool value = ClientGlobal.Instance().gameOption.GetInt("Operate", "SettingFixedRocker", 1) == 1;

            Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.EJOYSTICKSTABLE, value);
        }
Example #24
0
        //自动组队
        public void SetSettingTeamInvite()
        {
            bool value = ClientGlobal.Instance().gameOption.GetInt("Social", "SettingTeamInvite", 1) == 1;

            DataManager.Manager <TeamDataManager>().SetAutoRefuseTeamInvite(value);
        }
Example #25
0
        //自动接收氏族邀请
        public void SetSettingClanInvite()
        {
            bool value = ClientGlobal.Instance().gameOption.GetInt("Social", "SettingClanInvite", 1) == 1;

            DataManager.Manager <ClanManger>().AutoRefuseInvite = value;
        }
Example #26
0
        //设置画质效果的等级   包括下面三个SetSettingScreenPriority +   SetPerformancePriority    +     SetSavingPriority
        void SetPriority()
        {
            int type = ClientGlobal.Instance().gameOption.GetInt("PictureEffect", "GriphicSlider", 1);

            SetSettingScreenPriority((uint)type);
        }
Example #27
0
        public void SetSkillShake()
        {
            bool value = ClientGlobal.Instance().gameOption.GetInt("SpecialEffects", "skillShake", 0) == 1;

            CameraFollow.Instance.BEnableShake = value;
        }
Example #28
0
        public void SetPlayerTitle()
        {
            bool value = ClientGlobal.Instance().gameOption.GetInt("ShowDetail", "PlayerTitle", 1) == 1;

            DataManager.Manager <TitleManager>().SetIsShowTitle(value);
        }
Example #29
0
        public void SetCameraDistance()
        {
            bool value = ClientGlobal.Instance().gameOption.GetInt("Camera", "close", 1) == 1;

            Client.EntityCreator.Instance().isFarDisCamera = value;
        }
Example #30
0
        public void SetClanName()
        {
            bool value = ClientGlobal.Instance().gameOption.GetInt("ShowDetail", "ClanName", 1) == 1;

            DataManager.Manager <ClanManger>().ShowClanName = value;
        }