Exemplo n.º 1
0
        private void on_player_respawn(Variant msgData)
        {
            debug.Log("PPPPP" + msgData.dump());
            //RoleMgr._instance.onRespawn(msgData);
            if (msgData.ContainsKey("back_town_tm"))
            {
                uint ms  = msgData["back_town_tm"];
                long sec = ms - NetClient.instance.CurServerTimeStamp;
                if (sec < 0)
                {
                    sec = 0;
                }
                //int sec = (int)Math.Ceiling((float)ms / 1000);
                a3_relive.backtown_end_tm = (int)sec;
            }

            if (!msgData.ContainsKey("iid"))
            {
                return;
            }
            int  max_hp = msgData["battleAttrs"]["max_hp"];
            uint iid    = msgData["iid"]._uint;

            if (iid == SelfRole._inst.m_unIID)
            {
                SelfRole._inst.can_buff_move  = true;
                SelfRole._inst.can_buff_skill = true;
                SelfRole._inst.can_buff_ani   = true;
                SelfRole._inst.onRelive(max_hp);
                InterfaceMgr.getInstance().close(InterfaceMgr.A3_RELIVE);
            }
            else
            {
                ProfessionRole pr = OtherPlayerMgr._inst.GetOtherPlayer(iid);
                if (pr != null)
                {
                    //播放伤害
                    pr.onRelive(max_hp);
                }
            }

            if (msgData.ContainsKey("x") && msgData.ContainsKey("y"))
            {
                float   x   = msgData["x"]._float / GameConstant.PIXEL_TRANS_UNITYPOS;
                float   y   = msgData["y"]._float / GameConstant.PIXEL_TRANS_UNITYPOS;
                Vector3 pos = new Vector3(x, 0f, y);
                if (iid == SelfRole._inst.m_unIID)
                {
                    SelfRole._inst.setPos(pos);
                }
                else
                {
                    ProfessionRole pr = OtherPlayerMgr._inst.GetOtherPlayer(iid);
                    if (pr != null)
                    {
                        pr.setPos(pos);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void on_player_respawn(Variant msgData)
        {
            bool flag = msgData.ContainsKey("back_town_tm");

            if (flag)
            {
                uint num   = msgData["back_town_tm"];
                long num2  = (long)((ulong)num - (ulong)((long)NetClient.instance.CurServerTimeStamp));
                bool flag2 = num2 < 0L;
                if (flag2)
                {
                    num2 = 0L;
                }
                a3_relive.backtown_end_tm = (int)num2;
            }
            bool flag3 = !msgData.ContainsKey("iid");

            if (!flag3)
            {
                int  max_hp = msgData["battleAttrs"]["max_hp"];
                uint @uint  = msgData["iid"]._uint;
                bool flag4  = @uint == SelfRole._inst.m_unIID;
                if (flag4)
                {
                    SelfRole._inst.can_buff_move  = true;
                    SelfRole._inst.can_buff_skill = true;
                    SelfRole._inst.can_buff_ani   = true;
                    SelfRole._inst.onRelive(max_hp);
                    InterfaceMgr.getInstance().close(InterfaceMgr.A3_RELIVE);
                }
                else
                {
                    ProfessionRole otherPlayer = OtherPlayerMgr._inst.GetOtherPlayer(@uint);
                    bool           flag5       = otherPlayer != null;
                    if (flag5)
                    {
                        otherPlayer.onRelive(max_hp);
                    }
                }
            }
        }