コード例 #1
0
ファイル: BuffPlugin.cs プロジェクト: daxingyou/AraleEngine
        public override void onSync(MessageBase message)
        {
            MsgBuff msg = message as MsgBuff;

            if (msg.buff != 0)
            {
                switch (msg.change)
                {
                case 0:
                    mUnit.sendEvent((int)UnitEvent.BuffClear, msg.buff);
                    break;

                case 1:
                    mUnit.sendEvent((int)UnitEvent.BuffAdd, msg.buff);
                    break;

                case 2:
                    mUnit.sendEvent((int)UnitEvent.BuffDec, msg.buff);
                    break;
                }
            }
            else
            {
                for (int i = 0, max = msg.flags.Count; i < max; ++i)
                {
                    mUnit.sendEvent((int)UnitEvent.BuffAdd, msg.flags [i]);
                }
            }
        }
コード例 #2
0
ファイル: BuffPlugin.cs プロジェクト: daxingyou/AraleEngine
        void decBuff(Buff buff)
        {
            if (buff.table.flag == null)
            {
                return;
            }
            MsgBuff msg = new MsgBuff();

            msg.guid   = mUnit.guid;
            msg.change = 2;            //dec
            msg.buff   = (short)buff.table.id;
            mUnit.sendMsg((short)MyMsgId.Buff, msg);
        }
コード例 #3
0
ファイル: BuffPlugin.cs プロジェクト: daxingyou/AraleEngine
        public void sync()
        {
            MsgBuff msg = new MsgBuff();

            msg.guid = mUnit.guid;
            for (int i = 0, max = mBuffs.Count; i < max; ++i)
            {
                Buff bf = mBuffs [i];
                if (bf.table.flag != null)
                {
                    msg.flags.Add((short)bf.table.id);
                }
            }
            mUnit.sendMsg((short)MyMsgId.Buff, msg);
        }
コード例 #4
0
    public virtual void onSync(NetworkMessage msg)
    {
        switch (msg.msgType)
        {
        case (short)MyMsgId.State:
        {
            MsgState m = msg.ReadMessage <MsgState> ();
            this.onSyncState(m);
            if (isServer)
            {
                sendMsg(msg.msgType, m);
            }
            break;
        }

        case (short)MyMsgId.Nav:
        {
            MsgNav m = msg.ReadMessage <MsgNav> ();
            move.onSync(m);
            if (isServer)
            {
                sendMsg(msg.msgType, m);
            }
            break;
        }

        case (short)MyMsgId.Anim:
        {
            MsgAnim m = msg.ReadMessage <MsgAnim> ();
            anim.onSync(m);
            if (isServer)
            {
                sendMsg(msg.msgType, m);
            }
            break;
        }

        case (short)MyMsgId.Skill:
        {
            MsgSkill m = msg.ReadMessage <MsgSkill> ();
            if (isServer)
            {
                skill.onSync(m);
            }
            if (isServer)
            {
                sendMsg(msg.msgType, m);
            }
            break;
        }

        case (short)MyMsgId.Attr:
        {
            MsgAttr m = msg.ReadMessage <MsgAttr> ();
            attr.onSync(m);
            if (isServer)
            {
                sendMsg(msg.msgType, m);
            }
            break;
        }

        case (short)MyMsgId.Buff:
        {
            MsgBuff m = msg.ReadMessage <MsgBuff> ();
            buff.onSync(m);
            if (isServer)
            {
                sendMsg(msg.msgType, m);
            }
            break;
        }

        case (short)MyMsgId.Move:
        {
            MsgMove m = msg.ReadMessage <MsgMove> ();
            move.onSyncMove(m);
            if (isServer)
            {
                sendMsg(msg.msgType, m);
            }
            break;
        }

        case (short)MyMsgId.Event:
        {
            MsgEvent m = msg.ReadMessage <MsgEvent> ();
            sendUnitEvent(m.evt, m.param);
            if (isServer)
            {
                sendMsg(msg.msgType, m);
            }
            break;
        }
        }
    }