Exemplo n.º 1
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.º 2
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.º 3
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");
    }