Exemplo n.º 1
0
        public void pos_correct(Variant msgData)
        {
            debug.Log("KKKKUUUUU" + msgData.dump());
            uint           @uint       = msgData["iid"]._uint;
            ProfessionRole otherPlayer = OtherPlayerMgr._inst.GetOtherPlayer(@uint);
            bool           flag        = otherPlayer != null;

            if (!flag)
            {
                float       x             = msgData["x"]._float / 53.333f;
                float       z             = msgData["y"]._float / 53.333f;
                MonsterRole serverMonster = MonsterMgr._inst.getServerMonster(@uint);
                bool        flag2         = serverMonster != null;
                if (flag2)
                {
                    Vector3 vector = new Vector3(x, serverMonster.m_curModel.position.y, z);
                    bool    flag3  = GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3342u];
                    if (flag3)
                    {
                        serverMonster.pos_correct(vector);
                    }
                    else
                    {
                        NavMeshHit navMeshHit;
                        NavMesh.SamplePosition(vector, out navMeshHit, 100f, serverMonster.m_layer);
                        serverMonster.pos_correct(navMeshHit.position);
                    }
                }
            }
        }
Exemplo n.º 2
0
    public void FrameMove(float fdt)
    {
        foreach (ProfessionRole current in this.m_mapOtherPlayer.Values)
        {
            current.FrameMove(fdt);
        }
        bool flag = this.VIEW_PLAYER_TYPE == 0;

        if (!flag)
        {
            bool loading = GRMap.loading;
            if (!loading)
            {
                using (Dictionary <uint, ProfessionRole> .ValueCollection.Enumerator enumerator2 = this.m_mapOtherPlayerUnsee.Values.GetEnumerator())
                {
                    if (enumerator2.MoveNext())
                    {
                        ProfessionRole current2 = enumerator2.Current;
                        this.m_mapOtherPlayerUnsee.Remove(current2.m_unIID);
                        this.m_mapOtherPlayerSee.Add(current2.m_unIID, current2);
                        BaseProxy <FriendProxy> .getInstance().addNearyByPeople(current2.m_unIID);

                        BaseProxy <PlayerInfoProxy> .getInstance().sendLoadPlayerDetailInfo(current2.m_unCID);
                    }
                }
            }
        }
    }
Exemplo n.º 3
0
        //public void sendmoveto(float frm_x, float frm_y, float to_x, float to_y, float start_tm,bool force=false)
        //{
        //    //Variant msg = Variant.alloc();
        //    //msg["frm_x"] = frm_x;
        //    //msg["frm_y"] = frm_y;
        //    //msg["to_x"] = to_x;
        //    //msg["to_y"] = to_y;
        //    //msg["start_tm"] = start_tm;
        //    //sendRPC(PKG_NAME.C2S_MOVE, msg);
        //    //Variant.free(msg);

        //    ReqChangeMoveMsg((uint)frm_x, (uint)frm_y, (uint)to_x, (uint)to_y, (uint)start_tm,-1f, force);
        //}

        //public void sendmoveRadian(float frm_x, float frm_y, float radian, float start_tm)
        //{
        //    //float ori = (radian * 180) / (float)(Math.PI * 100);
        //    LGMap lgm =  GRClient.instance.g_gameM.getObject(OBJECT_NAME.LG_MAP) as LGMap;
        //    Vec2 tp = lgm.getFarthestGPosByOri(frm_x, frm_y, radian * (float)Math.PI / 180);

        //    float to_x = (float)(tp.x ) + GameConstant.GEZI;
        //    float to_y = (float)(tp.y ) + GameConstant.GEZI;
        //    ReqChangeMoveMsg((uint)frm_x, (uint)frm_y, (uint)to_x, (uint)to_y, (uint)start_tm, radian);

        //    ////if (moveTick > 20)
        //    //{
        //    //    //    debug.Log("处理移动消息.9..");
        //    //    //    moveTick = 0;
        //    //    Variant msg = Variant.alloc();
        //    //    msg["frm_x"] = frm_x;
        //    //    msg["frm_y"] = frm_y;
        //    //    msg["iid"] = 0;
        //    //    msg["start_tm"] = start_tm;
        //    //    msg["radian"] = radian;
        //    //    sendRPC(PKG_NAME.C2S_MOVE, msg);
        //    //    Variant.free(msg);
        //    //}
        //}

        public void pos_correct(Variant msgData)
        {
            debug.Log("KKKKUUUUU" + msgData.dump());
            uint           iid = msgData["iid"]._uint;
            ProfessionRole pr  = OtherPlayerMgr._inst.GetOtherPlayer(iid);

            if (pr != null)
            {
            }
            else
            {
                float       to_x = msgData["x"]._float / GameConstant.PIXEL_TRANS_UNITYPOS;
                float       to_y = msgData["y"]._float / GameConstant.PIXEL_TRANS_UNITYPOS;
                MonsterRole role = MonsterMgr._inst.getServerMonster(iid);
                if (role != null)
                {
                    Vector3 vec = new Vector3(to_x, role.m_curModel.position.y, to_y);
                    if (GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3342] || GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3358])
                    {//解决多层阻挡点寻路的问题
                        role.pos_correct(vec);
                    }
                    else
                    {
                        NavMeshHit hit;
                        NavMesh.SamplePosition(vec, out hit, 100f, role.m_layer);
                        role.pos_correct(hit.position);
                    }
                }
            }
        }
Exemplo n.º 4
0
    public void RemoveOtherPlayer(uint iid)
    {
        bool flag = !this.m_mapOtherPlayer.ContainsKey(iid);

        if (!flag)
        {
            ProfessionRole professionRole = this.m_mapOtherPlayer[iid];
            bool           flag2          = this.m_mapOtherPlayerUnsee.ContainsKey(iid);
            if (flag2)
            {
                this.m_mapOtherPlayerUnsee.Remove(iid);
            }
            bool flag3 = this.m_mapOtherPlayerSee.ContainsKey(iid);
            if (flag3)
            {
                this.m_mapOtherPlayerSee.Remove(iid);
            }
            BaseProxy <FriendProxy> .getInstance().removeNearyByLeave(professionRole.m_unCID);

            this.m_mapOtherPlayer.Remove(iid);
            bool flag4 = a3_liteMinimap.instance != null;
            if (flag4)
            {
                a3_liteMinimap.instance.removeRoleInMiniMap(professionRole.strIID);
            }
            professionRole.dispose();
            bool flag5 = SelfRole._inst.m_LockRole != null && SelfRole._inst.m_LockRole.m_unIID == iid;
            if (flag5)
            {
                SelfRole._inst.m_LockRole = null;
            }
        }
    }
Exemplo n.º 5
0
 private bool EnemySelector(ProfessionRole p)
 {
     if (p == null)
     {
         return(true);
     }
     if (PlayerModel.getInstance().pk_state == PK_TYPE.PK_PKALL)
     {
         return(false); // 在全体攻击模式下,没有需要过滤的目标
     }
     else if (PlayerModel.getInstance().pk_state == PK_TYPE.PK_TEAM)
     {
         if (TeamProxy.getInstance().MyTeamData == null || TeamProxy.getInstance().MyTeamData.itemTeamDataList == null)
         {
             return(false); //在团队模式下,如果没有队伍,则没有需要过滤的目标
         }
         else if (TeamProxy.getInstance().MyTeamData.itemTeamDataList.Exists((m) => m.cid == p.m_unCID))
         {
             if (SelfRole._inst.m_LockRole == p) // 正在攻击我的角色成为了我的队员,清除锁定
             {
                 SelfRole._inst.m_LockRole = null;
             }
             return(true); //过滤队员
         }
         else
         {
             return(false);
         }
     }
     return(false);
 }
Exemplo n.º 6
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.º 7
0
    public void RemoveOtherPlayer(uint iid)
    {
        if (!m_mapOtherPlayer.ContainsKey(iid))
        {
            return;
        }

        ProfessionRole pr = m_mapOtherPlayer[iid];

        if (m_mapOtherPlayerUnsee.ContainsKey(iid))
        {
            m_mapOtherPlayerUnsee.Remove(iid);
        }
        if (m_mapOtherPlayerSee.ContainsKey(iid))
        {
            m_mapOtherPlayerSee.Remove(iid);
        }
        FriendProxy.getInstance().removeNearyByLeave(pr.m_unCID);

        m_mapOtherPlayer.Remove(iid);
        if (a3_liteMiniBaseMap.instance != null)
        {
            a3_liteMiniBaseMap.instance.removeRoleInMiniMap(pr.strIID);
        }
        pr.dispose();

        if (SelfRole._inst.m_LockRole != null && SelfRole._inst.m_LockRole.m_unIID == iid)
        {
            SelfRole._inst.m_LockRole = null;
        }

        //dispatchEvent(GameEvent.Create(MonsterMgr.EVENT_MONSTER_REMOVED, this, d));
    }
Exemplo n.º 8
0
        private void on_sprite_invisible(Variant msgData)
        {
            debug.Log("on_sprite_invisible::" + msgData.dump());
            uint @uint = msgData["iid"]._uint;
            bool flag  = msgData["invisible"] > 0;
            bool flag2 = @uint == SelfRole._inst.m_unIID;

            if (flag2)
            {
                SelfRole._inst.invisible = flag;
                bool flag3 = skillbar.instance != null;
                if (flag3)
                {
                    skillbar.instance.forSkill_5008(flag);
                }
                MapProxy.isyinsh = flag;
                SelfRole._inst.refreshmapCount((int)ModelBase <PlayerModel> .getInstance().treasure_num);
                SelfRole._inst.refreshVipLvl((uint)ModelBase <A3_VipModel> .getInstance().Level);
            }
            else
            {
                ProfessionRole otherPlayer = OtherPlayerMgr._inst.GetOtherPlayer(@uint);
                bool           flag4       = otherPlayer != null;
                if (flag4)
                {
                    otherPlayer.invisible = flag;
                    bool flag5 = flag && SelfRole._inst.m_LockRole == otherPlayer;
                    if (flag5)
                    {
                        SelfRole._inst.m_LockRole = null;
                    }
                }
            }
        }
Exemplo n.º 9
0
        private void onAddNearbyPeople(GameEvent e)
        {
            float num   = 60f;
            uint  @uint = e.data["iid"]._uint;
            Dictionary <uint, ProfessionRole> mapOtherPlayerSee = OtherPlayerMgr._inst.m_mapOtherPlayerSee;
            bool flag = mapOtherPlayerSee.ContainsKey(@uint);

            if (flag)
            {
                uint unCID = mapOtherPlayerSee[@uint].m_unCID;
            }
            ProfessionRole professionRole = mapOtherPlayerSee[@uint];
            itemFriendData itemFriendData = default(itemFriendData);

            itemFriendData.cid       = professionRole.m_unCID;
            itemFriendData.name      = professionRole.roleName;
            itemFriendData.carr      = (uint)professionRole.m_roleDta.carr;
            itemFriendData.lvl       = professionRole.lvl;
            itemFriendData.zhuan     = (uint)professionRole.zhuan;
            itemFriendData.clan_name = (string.IsNullOrEmpty(professionRole.clanName) ? "无" : professionRole.clanName);
            itemFriendData.combpt    = (uint)professionRole.combpt;
            itemFriendData.map_id    = (int)ModelBase <PlayerModel> .getInstance().mapid;

            bool flag2 = this.NearbyListDataDic.ContainsKey(professionRole.m_unCID);

            if (flag2)
            {
                itemFriendData itemFriendData2 = this.NearbyListDataDic[professionRole.m_unCID];
                itemFriendData2.itemNListPrefab.set(itemFriendData);
                bool flag3 = num == 0f;
                if (flag3)
                {
                    num = itemFriendData2.itemNListPrefab.root.transform.FindChild("Toggle/Background").GetComponent <RectTransform>().sizeDelta.y;
                }
            }
            else
            {
                itemFriendData itemFriendData3 = itemFriendData;
                itemFriendData3.itemNListPrefab = new itemNearbyListPrefab();
                itemFriendData3.itemNListPrefab.init();
                Transform root;
                itemFriendData3.itemNListPrefab.show(itemFriendData, out root);
                itemFriendData3.root = root;
                this.NearbyListDataDic[professionRole.m_unCID] = itemFriendData3;
                bool flag4 = num == 0f;
                if (flag4)
                {
                    num = itemFriendData3.itemNListPrefab.root.transform.FindChild("Toggle/Background").GetComponent <RectTransform>().sizeDelta.y;
                }
                neighborList._instance.nearbyListCount.text = OtherPlayerMgr._inst.m_mapOtherPlayerSee.Count.ToString() + "/" + (50u + 50u * ModelBase <PlayerModel> .getInstance().up_lvl);
                neighborList._instance.contains.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, num * (float)OtherPlayerMgr._inst.m_mapOtherPlayerSee.Count);
            }
        }
Exemplo n.º 10
0
    public void otherPlayPetAvatarChange(uint iid, int petid, int stage)
    {
        ProfessionRole professionRole = null;

        this.m_mapOtherPlayer.TryGetValue(iid, out professionRole);
        bool flag = professionRole == null;

        if (!flag)
        {
            professionRole.ChangePetAvatar(petid, 0);
        }
    }
Exemplo n.º 11
0
    public void otherserial_pk(uint iid, int count)
    {
        ProfessionRole role = null;

        m_mapOtherPlayer.TryGetValue(iid, out role);
        if (role == null)
        {
            return;
        }
        role.serial = count;
        role.refreshserialCount(count);
    }
Exemplo n.º 12
0
    public void otherserial_pk(uint iid, int count)
    {
        ProfessionRole professionRole = null;

        this.m_mapOtherPlayer.TryGetValue(iid, out professionRole);
        bool flag = professionRole == null;

        if (!flag)
        {
            professionRole.serial = count;
            professionRole.refreshserialCount(count);
        }
    }
Exemplo n.º 13
0
    public void playerMapCountChange(uint iid, int count)
    {
        ProfessionRole role = null;

        m_mapOtherPlayer.TryGetValue(iid, out role);
        if (role == null)
        {
            return;
        }
        role.mapCount = count;
        debug.Log("对方宝图" + count + "个");
        role.refreshmapCount(count);
    }
Exemplo n.º 14
0
        public override void Enter()
        {
            ProfessionRole expr_06 = SelfRole._inst;

            if (expr_06 != null)
            {
                NavMeshAgent expr_11 = expr_06.m_moveAgent;
                if (expr_11 != null)
                {
                    expr_11.Stop();
                }
            }
        }
Exemplo n.º 15
0
        private void CheckPK()
        {
            ProfessionRole castRole = SelfRole.LastAttackPlayer;

            if (castRole == null)
            {
                return;
            }
            switch (SelfRole._inst.m_ePK_Type)
            {
            case PK_TYPE.PK_PKALL:
                SelfRole._inst.m_LockRole = castRole;
                SelfRole.LastAttackPlayer = castRole;
                break;

            case PK_TYPE.PK_TEAM:
                if (castRole.m_unTeamID != SelfRole._inst.m_unTeamID || !PlayerModel.getInstance().IsInATeam)
                {
                    SelfRole._inst.m_LockRole = castRole;
                    SelfRole.LastAttackPlayer = castRole;
                }
                else
                {
                    SelfRole.UnderPlayerAttack = false;
                    SelfRole._inst.m_LockRole  = null;
                    SelfRole.LastAttackPlayer  = null;
                }
                break;

            case PK_TYPE.PK_PEACE:
            case PK_TYPE.Pk_SPOET:
                if (castRole.lvlsideid != PlayerModel.getInstance().lvlsideid)
                {
                    SelfRole._inst.m_LockRole = castRole;
                    SelfRole.LastAttackPlayer = castRole;
                }
                else
                {
                    SelfRole.UnderPlayerAttack = false;
                    SelfRole._inst.m_LockRole  = null;
                    SelfRole.LastAttackPlayer  = null;
                }
                break;

            default:
                SelfRole.UnderPlayerAttack = false;
                SelfRole._inst.m_LockRole  = null;
                SelfRole.LastAttackPlayer  = null;
                break;
            }
        }
Exemplo n.º 16
0
    public void playerMapCountChange(uint iid, int count)
    {
        ProfessionRole professionRole = null;

        this.m_mapOtherPlayer.TryGetValue(iid, out professionRole);
        bool flag = professionRole == null;

        if (!flag)
        {
            professionRole.mapCount = count;
            debug.Log("对方宝图" + count + "个");
            professionRole.refreshmapCount(count);
        }
    }
Exemplo n.º 17
0
        public void move(Variant msgData)
        {
            uint           @uint       = msgData["iid"]._uint;
            ProfessionRole otherPlayer = OtherPlayerMgr._inst.GetOtherPlayer(@uint);
            bool           flag        = otherPlayer != null;

            if (flag)
            {
                float   x      = msgData["to_x"]._float / 53.333f;
                float   z      = msgData["to_y"]._float / 53.333f;
                Vector3 vector = new Vector3(x, otherPlayer.m_curModel.position.y, z);
                bool    flag2  = GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3342u];
                if (flag2)
                {
                    otherPlayer.SetDestPos(vector);
                }
                else
                {
                    NavMeshHit navMeshHit;
                    NavMesh.SamplePosition(vector, out navMeshHit, 100f, otherPlayer.m_layer);
                    otherPlayer.SetDestPos(navMeshHit.position);
                }
            }
            else
            {
                float       x2            = msgData["to_x"]._float / 53.333f;
                float       z2            = msgData["to_y"]._float / 53.333f;
                MonsterRole serverMonster = MonsterMgr._inst.getServerMonster(@uint);
                bool        flag3         = serverMonster != null;
                if (flag3)
                {
                    Vector3 vector2 = new Vector3(x2, serverMonster.m_curModel.position.y, z2);
                    bool    flag4   = GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3342u];
                    if (flag4)
                    {
                        serverMonster.SetDestPos(vector2);
                    }
                    else
                    {
                        NavMeshHit navMeshHit2;
                        NavMesh.SamplePosition(vector2, out navMeshHit2, 100f, serverMonster.m_layer);
                        serverMonster.SetDestPos(navMeshHit2.position);
                    }
                }
            }
        }
Exemplo n.º 18
0
        public override void Enter()
        {
            bool flag = this.line == null;

            if (flag)
            {
                SelfRole.fsm.ChangeState(StateIdle.Instance);
            }
            else
            {
                ProfessionRole expr_26 = SelfRole._inst;
                bool           flag2   = ((expr_26 != null) ? expr_26.m_moveAgent : null) == null;
                if (!flag2)
                {
                    SelfRole._inst.m_moveAgent.ResetPath();
                    this.refredshPos();
                }
            }
        }
Exemplo n.º 19
0
        public override void Exit()
        {
            bool flag = SelfRole._inst.m_moveAgent != null;

            if (flag)
            {
                SelfRole._inst.m_moveAgent.avoidancePriority = this.priority;
            }
            bool flag2 = SelfRole.fsm.previousState != this;

            if (flag2)
            {
                this.pos = Vector3.zero;
            }
            this.handle = null;
            try
            {
                ProfessionRole expr_59 = SelfRole._inst;
                if (expr_59 != null)
                {
                    NavMeshAgent expr_64 = expr_59.m_moveAgent;
                    if (expr_64 != null)
                    {
                        expr_64.Stop();
                    }
                }
                ProfessionRole expr_75 = SelfRole._inst;
                if (expr_75 != null)
                {
                    Animator expr_80 = expr_75.m_curAni;
                    if (expr_80 != null)
                    {
                        expr_80.SetBool(EnumAni.ANI_RUN, false);
                    }
                }
                this.lastStay = SelfRole._inst.m_curModel.transform.position.ConvertToGamePosition();
            }
            catch (Exception)
            {
                this.lastStay = Vector3.zero;
            }
            this.stopdistance = 0.3f;
        }
Exemplo n.º 20
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);
                    }
                }
            }
        }
Exemplo n.º 21
0
        public override void Exit()
        {
            bool flag = SelfRole.fsm.previousState != this;

            if (flag)
            {
                this.handle = null;
                this.line   = null;
                this.pos    = Vector3.zero;
            }
            this.curtargetPos = Vector3.zero;
            ProfessionRole expr_40 = SelfRole._inst;
            bool           flag2   = ((expr_40 != null) ? expr_40.m_moveAgent : null) == null;

            if (!flag2)
            {
                SelfRole._inst.m_moveAgent.ResetPath();
                SelfRole._inst.m_moveAgent.Stop();
                SelfRole._inst.m_curAni.SetBool(EnumAni.ANI_RUN, false);
            }
        }
Exemplo n.º 22
0
    public static void SetGameLight(int lv)
    {
        bool bopen = true;

        if (lv > 1)
        {
            bopen = false;
        }

        Transform SL_scene = m_curGameObj.transform.FindChild("SL_scene");

        if (SL_scene != null)
        {
            SL_scene.gameObject.SetActive(bopen);
        }

        Transform SL_monster = m_curGameObj.transform.FindChild("SL_monster");

        if (SL_monster != null)
        {
            SL_monster.gameObject.SetActive(bopen);
        }

        //Transform DL_self = m_curGameObj.transform.FindChild("DL_self");
        //if (DL_self != null) DL_self.gameObject.SetActive(bopen);

        Transform DL_other = m_curGameObj.transform.FindChild("DL_other");

        if (DL_other != null)
        {
            DL_other.gameObject.SetActive(bopen);
        }

        ProfessionRole.isShowyingzi = bopen;

        if (ProfessionRole.systemCallBack != null)
        {
            ProfessionRole.systemCallBack(SelfRole._inst);
        }
    }
Exemplo n.º 23
0
        public override void Enter()
        {
            ProfessionRole expr_06 = SelfRole._inst;

            if (expr_06 != null)
            {
                NavMeshAgent expr_11 = expr_06.m_moveAgent;
                if (expr_11 != null)
                {
                    expr_11.ResetPath();
                }
            }
            this.priority = SelfRole._inst.m_moveAgent.avoidancePriority;
            bool flag = this.pos == Vector3.zero || Vector3.Distance(SelfRole._inst.m_curModel.position.ConvertToGamePosition(), this.pos.ConvertToGamePosition()) < this.stopdistance;

            if (flag)
            {
                NavMeshAgent expr_82 = SelfRole._inst.m_moveAgent;
                if (expr_82 != null)
                {
                    expr_82.Stop();
                }
                Action expr_94 = this.handle;
                if (expr_94 != null)
                {
                    expr_94();
                }
                SelfRole.fsm.ChangeState(StateIdle.Instance);
            }
            else
            {
                NavMeshHit navMeshHit;
                NavMesh.SamplePosition(this.pos, out navMeshHit, StateInit.Instance.Distance, NavmeshUtils.allARE);
                this.pos = navMeshHit.position;
                SelfRole._inst.SetDestPos(this.pos);
                SelfRole._inst.m_curAni.SetBool(EnumAni.ANI_RUN, true);
                this.waitTick = 3;
            }
        }
Exemplo n.º 24
0
    public void otherPlayPetAvatarChange(uint iid, int petid, int stage)
    {
        ProfessionRole role = null;

        m_mapOtherPlayer.TryGetValue(iid, out role);
        if (role == null)
        {
            return;
        }
        role.ChangePetAvatar(petid, 0);

        if (SceneCamera.m_nModelDetail_Level != 1)
        {
            if (role.m_myPetBird != null)
            {
                foreach (Transform tran in role.m_myPetBird.GetComponentsInChildren <Transform>())
                {
                    //debug.Log("改变了layer " + tran.name);
                    tran.gameObject.layer = EnumLayer.LM_DEFAULT;// 更改物体的Layer层
                }
            }
        }
    }
Exemplo n.º 25
0
    static public void Init() //玩家使用的职业的初始化
    {
        //锁定的脚底光圈
        GameObject obj_prefab = GAMEAPI.ABFight_LoadPrefab("common_lock_fx");
        GameObject obj_inst   = GameObject.Instantiate(obj_prefab) as GameObject;

        s_LockFX = obj_inst.transform;

        GameObject obj_boss_prefab = GAMEAPI.ABFight_LoadPrefab("common_lock_fx_boss");
        GameObject obj_boss_inst   = GameObject.Instantiate(obj_boss_prefab) as GameObject;

        s_LockFX_boss = obj_boss_inst.transform;


        int p = PlayerModel.getInstance().profession;

        if (p == 2)
        {
            FightText.userText = FightText.WARRIOR_TEXT;
        }
        else if (p == 3)
        {
            FightText.userText = FightText.MAGE_TEXT;
        }
        else if (p == 5)
        {
            FightText.userText = FightText.ASSI_TEXT;
        }


        //P1Warrior warrior = new P1Warrior();
        //warrior.Init();
        //_inst = warrior;

        //debug.Log("进入游戏的角色是 ................ " + PlayerModel.getInstance().profession+" "+PlayerModel.getInstance().iid);


        GameObject mainborn = GameObject.Find("mainbronpt");

        if (mainborn != null)
        {
            PlayerModel.getInstance().mapBeginX       = mainborn.transform.position.x;
            PlayerModel.getInstance().mapBeginY       = mainborn.transform.position.z;
            PlayerModel.getInstance().mapBeginroatate = mainborn.transform.eulerAngles.y;
        }

        ProfessionRole me    = null;
        A3_PROFESSION  a3_pf = (A3_PROFESSION)PlayerModel.getInstance().profession;

        if (A3_PROFESSION.Warrior == a3_pf)
        {
            P2Warrior p2 = new P2Warrior();
            p2.m_bUserSelf = true;
            p2.Init(PlayerModel.getInstance().name, EnumLayer.LM_SELFROLE, Vector3.zero, true);
            me = p2;
        }
        else if (A3_PROFESSION.Mage == a3_pf)
        {
            P3Mage p3 = new P3Mage();
            p3.m_bUserSelf = true;
            p3.Init(PlayerModel.getInstance().name, EnumLayer.LM_SELFROLE, Vector3.zero, true);
            me = p3;
        }
        else if (A3_PROFESSION.Assassin == a3_pf)
        {
            P5Assassin p5 = new P5Assassin();
            p5.m_bUserSelf = true;
            p5.Init(PlayerModel.getInstance().name, EnumLayer.LM_SELFROLE, Vector3.zero, true);
            me = p5;
        }
        else
        {
            P3Mage p3 = new P3Mage();
            p3.m_bUserSelf = true;
            p3.Init(PlayerModel.getInstance().name, EnumLayer.LM_SELFROLE, Vector3.zero, true);
            me = p3;
        }

        //P3Mage me = new P3Mage();
        me.m_ePK_Type   = PlayerModel.getInstance().up_lvl < 1 ? PK_TYPE.PK_PEACE : PK_TYPE.PK_PKALL;
        me.m_unIID      = PlayerModel.getInstance().iid;
        me.m_unPK_Param = PlayerModel.getInstance().cid;
        me.refreshmapCount((int)PlayerModel.getInstance().treasure_num);
        me.refreshserialCount(PlayerModel.getInstance().serial);
        me.serial = PlayerModel.getInstance().serial;
        me.refreshVipLvl((uint)A3_VipModel.getInstance().Level);
        me.m_curPhy.gameObject.layer = EnumLayer.LM_BT_SELF;
        _inst       = me;
        _inst.speed = PlayerModel.getInstance().speed;

        var rideInfo = A3_RideModel.getInstance().GetRideInfo();

        if (GRMap.curSvrConf.ContainsKey("maptype") && GRMap.curSvrConf["maptype"]._int > 0)
        {
            if (rideInfo != null && rideInfo.mount == (uint)RIDESTATE.UP)
            {
                A3_RideModel.getInstance().GetRideInfo().mount = 0;
                A3_RideProxy.getInstance().SendC2S(4, "mount", 0, true);
            }

            //副本中不携带坐骑
        }
        else
        {
            if (rideInfo != null && rideInfo.mount == ( uint )RIDESTATE.UP)
            {
                _inst.set_Ride(( int )rideInfo.dress, true);
            }
        }


        //Transform one = U3DAPI.DEF_TRANSFORM;
        //one.position = me.m_curModel.position;
        //OtherPlayerMgr._inst.AddOtherPlayer(one, 1);
        //OtherPlayerMgr._inst.AddOtherPlayer(one, 2);
        //OtherPlayerMgr._inst.AddOtherPlayer(one, 1);
        //OtherPlayerMgr._inst.AddOtherPlayer(one, 1);
        //OtherPlayerMgr._inst.AddOtherPlayer(one, 1);
        //OtherPlayerMgr._inst.AddOtherPlayer(one, 1);


        //临时存放在这里
        //GameObject raffle_group = GameObject.Find("a3_scene/raffle");
        GameObject raffle_group = GameObject.Find("game_scene/lv3/raffle");

        if (raffle_group != null)
        {
            //debug.Log("找到了木桶组");
            for (int i = 0; i < raffle_group.transform.childCount; i++)
            {
                Transform cur_tf = raffle_group.transform.GetChild(i);

                Transform cur_whole = cur_tf.Find("whole");
                Transform cur_boom  = cur_tf.Find("boom");

                if (cur_whole != null && cur_boom != null)
                {
                    RaffleHurtPoint rht = cur_tf.gameObject.AddComponent <RaffleHurtPoint>();
                    rht.m_Raffle   = cur_tf.gameObject;
                    rht.m_RafWhole = cur_whole.gameObject;
                    rht.m_RafBoom  = cur_boom.gameObject;

                    cur_tf.gameObject.layer = EnumLayer.LM_BT_FIGHT;
                }
                else
                {
                    GameObject.Destroy(cur_tf.gameObject);
                }
            }
        }

        //子弹墙
        //GameObject btwall_group = GameObject.Find("a3_scene/btwall");
        GameObject btwall_group = GameObject.Find("game_scene/lv3/btwall");

        if (btwall_group != null)
        {
            for (int i = 0; i < btwall_group.transform.childCount; i++)
            {
                Transform cur_tf = btwall_group.transform.GetChild(i);
                cur_tf.gameObject.AddComponent <BtWallHurtPoint>();

                cur_tf.gameObject.layer = EnumLayer.LM_BT_FIGHT;
            }
        }

        ////初始化装备模型
        //foreach (a3_BagItemData equip in a3_EquipModel.getInstance().getEquips().Values)
        //{
        //    a3_EquipModel.getInstance().equipModel_on(equip);
        //}
        //初始化装备模型
        if (a3_EquipModel.getInstance().getEquips() != null && a3_EquipModel.getInstance().getEquips().Count > 0)
        {
            foreach (a3_BagItemData equip in a3_EquipModel.getInstance().getEquips().Values)
            {
                a3_EquipModel.getInstance().equipModel_on(equip);
            }
        }
        else
        {
            a3_EquipModel.getInstance().equipModel_on(null);
        }


        //初始化翅膀模型
        A3_WingModel.getInstance().OnEquipModelChange();

        //初始化宠物模型和注册宠物avatar改变
        if (PlayerModel.getInstance().last_time != 0)
        {
            OnPetAvatarChange();
        }

        //A3_PetModel.getInstance().OnStageChange += OnPetAvatarChange;
        MonsterMgr._inst.dispatchEvent(GameEvent.Create(MonsterMgr.EVENT_ROLE_BORN, MonsterMgr._inst, SelfRole._inst));


        //用于设置第一次创建模型时不发移动协议,解决刚进副本激活怪物ai的bug
        MoveProxy.getInstance().resetFirstMove();

        _inst.m_LockDis = XMLMgr.instance.GetSXML("comm.lockdis").getFloat("dis");
    }
Exemplo n.º 26
0
        public override void Execute(float delta_time)
        {
            try
            {
                bool flag = SelfRole._inst.m_curAni.GetBool(EnumAni.ANI_RUN) && Vector3.Distance(SelfRole._inst.m_curModel.transform.position.ConvertToGamePosition(), this.lastStay) < 0.2f;
                if (flag)
                {
                    this.stayTime += delta_time;
                    bool flag2 = this.stayTime > 2f;
                    if (flag2)
                    {
                        this.stayTime = 0f;
                        bool autofighting = SelfRole.fsm.Autofighting;
                        if (autofighting)
                        {
                            SelfRole.fsm.RestartState(StateSearch.Instance);
                            return;
                        }
                    }
                }
            }
            catch (Exception var_5_A1)
            {
                SelfRole.fsm.Stop();
            }
            bool flag3 = SelfRole._inst.m_moveAgent != null;

            if (flag3)
            {
                SelfRole._inst.m_moveAgent.avoidancePriority = 1;
            }
            bool flag4 = SelfRole._inst.m_curAni != null;

            if (flag4)
            {
                SelfRole._inst.m_curAni.SetBool(EnumAni.ANI_RUN, true);
            }
            bool flag5 = this.waitTick > 0;

            if (flag5)
            {
                this.waitTick--;
            }
            else
            {
                bool flag6 = SelfRole._inst.m_moveAgent == null;
                if (!flag6)
                {
                    Vector3 position = SelfRole._inst.m_curModel.position;
                    SelfRole._inst.m_moveAgent.SetDestination(this.pos);
                    float num   = Vector3.Distance(this.pos.ConvertToGamePosition(), position.ConvertToGamePosition());
                    bool  flag7 = num <= this.stopdistance;
                    if (flag7)
                    {
                        ProfessionRole expr_198 = SelfRole._inst;
                        if (expr_198 != null)
                        {
                            NavMeshAgent expr_1A3 = expr_198.m_moveAgent;
                            if (expr_1A3 != null)
                            {
                                expr_1A3.Stop();
                            }
                        }
                        Action expr_1B5 = this.handle;
                        if (expr_1B5 != null)
                        {
                            expr_1B5();
                        }
                        bool flag8 = !SelfRole.fsm.Autofighting;
                        if (flag8)
                        {
                            SelfRole.fsm.ChangeState(StateIdle.Instance);
                        }
                        else
                        {
                            SelfRole.fsm.ChangeState(StateAttack.Instance);
                        }
                    }
                    else
                    {
                        this.thinktime += delta_time;
                        bool flag9 = this.thinktime > 1f;
                        if (flag9)
                        {
                            this.thinktime = 0f;
                            bool flag10 = num < 5f;
                            if (flag10)
                            {
                                bool flag11 = Quaternion.LookRotation(SelfRole._inst.m_curModel.forward - this.pos.normalized).eulerAngles.y > 10f;
                                if (flag11)
                                {
                                    SelfRole._inst.TurnToPos(this.pos);
                                }
                            }
                        }
                        this.lastStay = SelfRole._inst.m_curModel.transform.position.ConvertToGamePosition();
                    }
                }
            }
        }
Exemplo n.º 27
0
    public void onHurt(HitData hd)
    {
        bool isDead = this.isDead;

        if (!isDead)
        {
            bool flag = hd.m_nDamage == 0;
            if (!flag)
            {
                base.curhp -= hd.m_nDamage;
                bool flag2 = base.curhp < 0;
                if (flag2)
                {
                    base.curhp = 0;
                }
                bool flag3 = hd.m_nDamage >= 100;
                if (flag3)
                {
                }
                bool flag4 = base.curhp == 0;
                if (flag4)
                {
                }
                PlayerNameUIMgr.getInstance().refreshHp(this, base.curhp, base.maxHp);
                bool flag5 = this == SelfRole._inst || SelfRole._inst.m_unIID == hd.m_CastRole.m_unIID;
                if (flag5)
                {
                    FightText.play(FightText.ENEMY_TEXT, this.lastHeadPos, hd.m_nDamage, false, -1);
                }
                bool autofighting = SelfRole.fsm.Autofighting;
                if (autofighting)
                {
                    bool flag6 = hd.m_CastRole is ProfessionRole;
                    if (flag6)
                    {
                        ProfessionRole professionRole = (ProfessionRole)hd.m_CastRole;
                        switch (ModelBase <PlayerModel> .getInstance().pk_state)
                        {
                        case PK_TYPE.PK_PKALL:
                            SelfRole.UnderPlayerAttack = true;
                            SelfRole._inst.m_LockRole  = hd.m_CastRole;
                            SelfRole.LastAttackPlayer  = professionRole;
                            goto IL_1B1;

                        case PK_TYPE.PK_TEAM:
                        {
                            bool flag7 = professionRole.m_unTeamID != ModelBase <PlayerModel> .getInstance().teamid || !ModelBase <PlayerModel> .getInstance().IsInATeam;

                            if (flag7)
                            {
                                SelfRole.UnderPlayerAttack = true;
                                SelfRole._inst.m_LockRole  = hd.m_CastRole;
                                SelfRole.LastAttackPlayer  = professionRole;
                            }
                            else
                            {
                                SelfRole.LastAttackPlayer  = null;
                                SelfRole.UnderPlayerAttack = false;
                            }
                            goto IL_1B1;
                        }
                        }
                        SelfRole.UnderPlayerAttack = false;
                        SelfRole.LastAttackPlayer  = null;
                        IL_1B1 :;
                    }
                }
            }
        }
    }
Exemplo n.º 28
0
    public override void onServerHurt(int damage, int hp, bool dead, BaseRole frm = null, int isCrit = -1, bool miss = false, bool stagger = false)
    {
        bool isDead = this.isDead;

        if (!isDead)
        {
            base.curhp = hp;
            if (stagger)
            {
                this.PlayHurt();
            }
            if (dead)
            {
                this.onDead(false, frm);
            }
            bool flag = damage > 0;
            if (flag)
            {
                bool flag2 = !miss;
                if (flag2)
                {
                    PlayerNameUIMgr.getInstance().refreshHp(this, base.curhp, base.maxHp);
                }
                bool flag3 = frm != null;
                if (flag3)
                {
                    FightText.CurrentCauseRole = frm;
                    bool flag4 = this == SelfRole._inst && frm != null;
                    if (flag4)
                    {
                        FightText.play(FightText.ENEMY_TEXT, base.getHeadPos(), damage, false, -1);
                    }
                    else
                    {
                        bool flag5 = SelfRole._inst.m_unIID == frm.m_unIID;
                        if (flag5)
                        {
                            switch (isCrit)
                            {
                            case -1:
                                FightText.play(FightText.userText, base.getHeadPos(), damage, false, -1);
                                break;

                            case 0:
                                break;

                            case 1:
                                FightText.play(FightText.userText, base.getHeadPos(), damage, false, -1);
                                break;

                            case 2:
                                FightText.play(FightText.IMG_TEXT, base.getHeadPos(), damage, false, isCrit);
                                break;

                            case 3:
                                FightText.play(FightText.userText, base.getHeadPos(), damage, false, -1);
                                break;

                            case 4:
                                FightText.play(FightText.userText, base.getHeadPos(), damage, false, -1);
                                break;

                            case 5:
                                FightText.play(FightText.userText, base.getHeadPos(), damage, false, -1);
                                break;

                            default:
                                FightText.play(FightText.IMG_TEXT, base.getHeadPos(), damage, false, isCrit);
                                break;
                            }
                        }
                    }
                }
            }
            bool flag6 = frm != null;
            if (flag6)
            {
                bool flag7 = frm is ProfessionRole;
                if (flag7)
                {
                    ProfessionRole professionRole = frm as ProfessionRole;
                    bool           invisible      = professionRole.invisible;
                    if (invisible)
                    {
                        professionRole.invisible = false;
                    }
                }
            }
        }
    }
Exemplo n.º 29
0
        public override void Execute(float delta_time)
        {
            bool flag = this.waitTick > 0;

            if (flag)
            {
                this.waitTick--;
            }
            else
            {
                bool changingMap = BaseProxy <MapProxy> .getInstance().changingMap;

                if (!changingMap)
                {
                    ProfessionRole expr_3A = SelfRole._inst;
                    bool           flag2   = ((expr_3A != null) ? expr_3A.m_moveAgent : null) == null;
                    if (!flag2)
                    {
                        this.refredshPos();
                        bool flag3 = this.waitTick > 0;
                        if (flag3)
                        {
                            this.waitTick--;
                        }
                        else
                        {
                            Animator expr_87 = SelfRole._inst.m_curAni;
                            if (expr_87 != null)
                            {
                                expr_87.SetBool(EnumAni.ANI_RUN, true);
                            }
                            bool flag4 = this.line.Count == 0;
                            if (flag4)
                            {
                                Vector3 destination       = SelfRole._inst.m_moveAgent.destination;
                                float   remainingDistance = SelfRole._inst.m_moveAgent.remainingDistance;
                                bool    flag5             = remainingDistance <= 0.3f;
                                if (flag5)
                                {
                                    ProfessionRole expr_EB = SelfRole._inst;
                                    if (expr_EB != null)
                                    {
                                        NavMeshAgent expr_F6 = expr_EB.m_moveAgent;
                                        if (expr_F6 != null)
                                        {
                                            expr_F6.ResetPath();
                                        }
                                    }
                                    ProfessionRole expr_107 = SelfRole._inst;
                                    if (expr_107 != null)
                                    {
                                        NavMeshAgent expr_112 = expr_107.m_moveAgent;
                                        if (expr_112 != null)
                                        {
                                            expr_112.Stop();
                                        }
                                    }
                                    bool flag6 = this.handle != null;
                                    if (flag6)
                                    {
                                        this.handle();
                                    }
                                    SelfRole.fsm.ChangeState(StateIdle.Instance);
                                }
                                else
                                {
                                    this.thinktime += delta_time;
                                    bool flag7 = this.thinktime > 1f;
                                    if (flag7)
                                    {
                                        this.thinktime = 0f;
                                        bool flag8 = remainingDistance < 5f;
                                        if (flag8)
                                        {
                                            bool flag9 = Quaternion.LookRotation(SelfRole._inst.m_curModel.forward - this.pos.normalized).eulerAngles.y > 10f;
                                            if (flag9)
                                            {
                                                ProfessionRole expr_1D0 = SelfRole._inst;
                                                if (expr_1D0 != null)
                                                {
                                                    expr_1D0.TurnToPos(this.pos);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 30
0
        void onViewAvatar_Change(Variant v)
        {
            //debug.Log("有人在我旁边换装了!!!~~~~~~~~~~~~~~~~~~~~~~~~");
            //debug.Log("有人在我旁边换装了!!!~~~~~~~~~~~~~~~~~~~~~~~~");
            //debug.Log("有人在我旁边换装了!!!~~~~~~~~~~~~~~~~~~~~~~~~");

            debug.Log("周围人状态变化:" + v.dump());
            uint iid = v["iid"];

            if (v.ContainsKey("serial_kp"))
            {
                if (v["iid"] == PlayerModel.getInstance().iid)
                {
                    if (SelfRole._inst != null)
                    {
                        PlayerModel.getInstance().serial = v["serial_kp"];
                        SelfRole._inst.serial = v["serial_kp"];
                        PlayerNameUIMgr.getInstance().refreserialCount(SelfRole._inst, v["serial_kp"]);
                    }
                }
            }
            if (v.ContainsKey("strike_back_tm"))
            {
                //反击buff时间戳玩家自己
                if (v["iid"] == PlayerModel.getInstance().iid)
                {
                    if (v.ContainsKey("strike_back_tm"))
                    {
                        if (SelfRole._inst != null)
                        {
                            SelfRole._inst.hidbacktime = v["strike_back_tm"];
                            if (v["strike_back_tm"] == 0)
                            {
                                PlayerModel.getInstance().hitBack = 0;
                                PlayerNameUIMgr.getInstance().refresHitback(SelfRole._inst, 0, true);
                            }
                            else
                            {
                                PlayerModel.getInstance().hitBack = SelfRole._inst.hidbacktime - (uint)NetClient.instance.CurServerTimeStamp;
                                PlayerNameUIMgr.getInstance().refresHitback(SelfRole._inst, (int)(SelfRole._inst.hidbacktime - (uint)NetClient.instance.CurServerTimeStamp), true);
                            }
                            //debug.Log("时间1:" + SelfRole._inst.hidbacktime + "时间2:" + (uint)NetClient.instance.CurServerTimeStamp);
                            //debug.Log("玩家自己受到时间:" + (int)(SelfRole._inst.hidbacktime - (uint)NetClient.instance.CurServerTimeStamp));
                        }
                    }
                }
                else
                {
                    OtherPlayerMgr._inst.refreshPlayerInfo(v);
                }
            }
            else
            {
                OtherPlayerMgr._inst.refreshPlayerInfo(v, false);
            }


            if (v.ContainsKey("title_sign"))
            {
                if (v["iid"] != PlayerModel.getInstance().iid)
                {
                    int  title_sign = v["title_sign"]._int;
                    uint cid        = v["cid"]._uint;
                    bool ishow      = false;
                    if (v.ContainsKey("title_sign_display"))
                    {
                        ishow = v["title_sign_display"];
                    }

                    PlayerNameUIMgr.getInstance().SetOtherTitle(cid, title_sign, ishow);
                }
            }

            //人物修改名字

            if (v.ContainsKey("name"))
            {
                if (v["iid"] == PlayerModel.getInstance().iid)
                {
                    PlayerModel.getInstance().name = v["name"];

                    if (SelfRole._inst != null)
                    {
                        SelfRole._inst.roleName = v["name"];

                        PlayerNameUIMgr.getInstance().refresName(SelfRole._inst);

                        InterfaceMgr.getInstance().close(InterfaceMgr.A3_CHANGE_NAME);
                    }
                }
                else
                {
                    ProfessionRole otherRole = OtherPlayerMgr._inst.GetOtherPlayer(v["iid"]);

                    otherRole.roleName = v["name"];

                    PlayerNameUIMgr.getInstance().refresName(otherRole);
                }
            }
        }