Exemplo n.º 1
0
        public override void OnMessage(byte[] bytes)
        {
            //解包读取
            var person = DeSerialize <Person>(bytes);

            GLogger.Log(person.name);

            ///封包发送
            networkMgr.SendData <Person>("Person", person);
        }
Exemplo n.º 2
0
        public override void Enter()
        {
            base.Enter();
            mynpcId  = npcFsm.GetVar <long>("mynpcId");
            targetId = npcFsm.GetVar <long>("targetId");

            myNpcData          = npcDataMgr.GetNpcData(mynpcId.value);
            myNpcData.npcState = NpcState.Attack;

            GLogger.Log(mynpcId.value + " enter Attack...");
            NpcSkillAttack();
        }
Exemplo n.º 3
0
        public override void Enter()
        {
            base.Enter();

            mynpcId        = npcFsm.GetVar <long>("mynpcId");
            targetId       = npcFsm.GetVar <long>("targetId");
            targetId.value = 0;

            myNpcData          = npcDataMgr.GetNpcData(mynpcId.value);
            myNpcData.npcState = NpcState.Search;

            GLogger.Log(mynpcId.value + " enter Search...");
        }
Exemplo n.º 4
0
        /// <summary>
        /// 攻击完成
        /// </summary>
        /// <param name="eventId"></param>
        private void OnNpcSkillAttackOK(long eventId)
        {
            var gameEvent = evMappingMgr.Remove(eventId);

            if (gameEvent != null)
            {
                var attackEvent = gameEvent.evParam as NpcSkillAttackEvent;
                if (attackEvent != null)
                {
                    attackEvent.callback(attackEvent.defenderid);
                }
            }
            GLogger.Log("OnNpcSkillAttackOK:" + eventId);
        }
Exemplo n.º 5
0
        public override void OnMessage(byte[] bytes)
        {
            //解包读取
            var person = Person.Parser.ParseFrom(bytes);

            GLogger.Log(person.Name);

            ///封包发送
            using (MemoryStream stream = new MemoryStream())
            {
                // Save the person to a stream
                person.WriteTo(stream);
                bytes = stream.ToArray();
                networkMgr.SendData("Person", bytes);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 动作剪辑播放完成回调函数
        /// </summary>
        /// <param name="obj"></param>
        private void OnPlayingClipOK(string clip)
        {
            switch (clip)
            {
            case AnimNames.Attack:          //战斗完成
            case AnimNames.Skill:
                OnNpcSkillAttackOK();
                PlayRoleAnim(AnimNames.Idle, true);
                break;

            case AnimNames.BeAttacked:          //被击完成
                if (!bRunning)
                {
                    PlayRoleAnim(AnimNames.Idle, true);
                }
                break;
            }
            GLogger.Log("OnPlayingClipOK::>>" + gameObject.name + " " + clip);
        }