Exemple #1
0
        //存储私聊对象
        public void PushChat(LogicSimpleData logicSimple)
        {
            if (mDbData.NearChats == null)
            {
                mDbData.NearChats = new PlayerHeadInfoMsgList();
            }
            var index = 0;

            foreach (var msg in mDbData.NearChats.Characters)
            {
                if (msg.CharacterId == logicSimple.Id)
                {
                    //var temp = msg;
                    mDbData.NearChats.Characters.RemoveAt(index);
                    //mDbData.NearChats.Characters.Add(msg);
                    MarkDbDirty();
                    //return;
                    break;
                }
                index++;
            }
            var t = new PlayerHeadInfoMsg();

            t.CharacterId = logicSimple.Id;
            t.Name        = logicSimple.Name;
            t.RoleId      = logicSimple.TypeId;
            t.Level       = logicSimple.Level;
            t.Ladder      = logicSimple.Ladder;
            mDbData.NearChats.Characters.Add(t);
            if (mDbData.NearChats.Characters.Count > 20)
            {
                mDbData.NearChats.Characters.RemoveAt(0);
            }
            MarkDbDirty();
            //uint64		 CharacterId	= 1;
            //string		 Name			= 2;
            //int32		 RoleId			= 3;
            //int32		 Level			= 4;
            //int32          Ladder			= 5;
            //int32          FightValue		= 6;
        }
Exemple #2
0
        public AutoPlayer CreateAutoPlayer(Scene _this,
                                           LogicSimpleData logic,
                                           SceneSimpleData scene,
                                           Vector2 pos,
                                           Vector2 dir)
        {
            var autoPlayer = new AutoPlayer();

            autoPlayer.Init(_this.GenerateNextId(), logic, scene);

            if (!_this.ValidPosition(pos))
            {
                Logger.Error("CreateAutoPlayer postion is invalid. PlayerId={2},name={0}, pos={1}", autoPlayer.GetName(),
                             pos, logic.Id);
            }

            autoPlayer.SetPosition(pos.X, pos.Y);
            autoPlayer.SetDirection(dir);

            _this.EnterScene(autoPlayer);
            return(autoPlayer);
        }
Exemple #3
0
 /// <summary>
 ///     初始化
 /// </summary>
 /// <param name="_this"></param>
 /// <param name="npcId"></param>
 /// <param name="logic"></param>
 /// <param name="scene"></param>
 public void Init(AutoPlayer _this, ulong npcId, LogicSimpleData logic, SceneSimpleData scene)
 {
     _this.mLogicData = logic;
     _this.mSceneData = scene;
     _this.mObjId     = npcId;
     _this.mTypeId    = logic.TypeId;
     _this.mDirection = new Vector2(1, 0);
     _this.mName      = _this.mSceneData.Name;
     _this.BuffList   = new BuffList();
     _this.BuffList.InitByBase(_this);
     _this.Attr  = new FightAttr(_this);
     _this.Skill = new SkillManager(_this);
     _this.SetLevel(_this.mLogicData.Level);
     _this.InitTableData(_this.mLogicData.Level);
     _this.InitEquip(_this.mLogicData.Level);
     _this.InitSkill(_this.mLogicData.Level);
     _this.InitBuff(_this.mLogicData.Level);
     _this.Attr.RobotPlayer = true;
     _this.InitAttr(_this.mLogicData.Level);
     _this.mCamp     = 2;
     _this.TableCamp = Table.GetCamp(_this.mCamp);
     _this.InitAI(_this.mLogicData.Level);
 }
Exemple #4
0
 public AutoPlayer CreateAutoPlayer(LogicSimpleData logic, SceneSimpleData scene, Vector2 pos, Vector2 dir)
 {
     return(mImpl.CreateAutoPlayer(this, logic, scene, pos, dir));
 }
Exemple #5
0
 /// <summary>
 ///     初始化
 /// </summary>
 /// <param name="npcId"></param>
 /// <param name="logic"></param>
 /// <param name="scene"></param>
 public void Init(ulong npcId, LogicSimpleData logic, SceneSimpleData scene)
 {
     mImpl.Init(this, npcId, logic, scene);
 }