Exemple #1
0
    //人物攻击表现
    public bool AttackHandle(CReadPacket packet)
    {
        Dictionary <string, object> data = packet.data;
        uint    attackKeyId = uint.Parse(data["sk"].ToString());
        uint    targetKeyId = uint.Parse(data["tk"].ToString()); //目标id
        int     skillIndex  = int.Parse(data["sd"].ToString());  //技能索引
        Vector3 pos         = new Vector3(                       //玩家位置
            packet.GetFloat("px"),
            packet.GetFloat("py"),
            packet.GetFloat("pz"));
        Vector3 Rot = new Vector3(//玩家朝向
            packet.GetFloat("ox"),
            packet.GetFloat("oy"),
            packet.GetFloat("oz"));
        Vector3 tpos = new Vector3(//目标位置
            packet.GetFloat("tx"),
            packet.GetFloat("ty"),
            packet.GetFloat("tz"));

        AttackType attackType = AttackType.action;

        if (CreatePeople.GetInstance().MonsterDic.ContainsKey(targetKeyId))
        {
            attackType = AttackType.Monster;
        }

        if (CreatePeople.GetInstance().OtherplayerDic.ContainsKey(targetKeyId) || targetKeyId == 0)
        {
            attackType = AttackType.OtherPlayer;
        }
        if (playerData.GetInstance().selfData.keyId == targetKeyId)
        {
            attackType = AttackType.Player;
        }
        CreatePeople.GetInstance().OtherPlayerAttack(attackKeyId, targetKeyId, attackType, skillIndex, pos, Rot, tpos);
        return(true);
    }
Exemple #2
0
    public bool EnterScene(CReadPacket packet)
    {
        //m_jv [ "si" ] = sceneId;
        //m_jv [ "px" ] = posX;
        //m_jv [ "py" ] = posY;
        //m_jv [ "pz" ] = posZ;
        Debug.Log("EnterScence");
        if (GameLibrary.Instance().isReconect)
        {
            GameLibrary.Instance().isReconect = false;
            return(true);
        }
        Dictionary <string, object> data = packet.data;
        int scenceid = packet.GetInt("si");// int.Parse( data [ "si" ].ToString() );

        playerData.GetInstance().selfData.SetPos(new Vector3(packet.GetFloat("px"), packet.GetFloat("py"), packet.GetFloat("pz")));
        playerData.GetInstance().selfData.mapID = scenceid;
        if (FSDataNodeTable <MapInfoNode> .GetSingleton().DataNodeList.ContainsKey(scenceid))
        {
            string scencename = FSDataNodeTable <MapInfoNode> .GetSingleton().DataNodeList[scenceid].MapName;

            if (Globe.isLoadOutCity)
            {
                //if (SceneManager.GetActiveScene().name== "Loding")
                //{
                //    UI_Loading.LoadScene(scencename, 3);
                //}
                //else
                //{
                //    SceneManager.LoadScene("Loding");
                //}
                GameLibrary.LastScene = SceneManager.GetActiveScene().name;//记录前一个场景名
                StartLandingShuJu.GetInstance().GetLoadingData(scencename, 3);
                SceneManager.LoadScene("Loding");
                Globe.isLoadOutCity = false;
            }
            else
            {
                if (Globe.isFightGuide)
                {
                    Globe.FightGuideSceneName = scencename;
                }
                else
                {
                    GameLibrary.LastScene = SceneManager.GetActiveScene().name;//记录前一个场景名
                    StartLandingShuJu.GetInstance().GetLoadingData(scencename, 3);
                    SceneManager.LoadScene("Loding");
                }
                //if (!Globe.isEnterScence) {
                //	Globe.isEnterScence = true;
                //}
            }
        }
        else
        {
            if (Globe.isFightGuide)
            {
                Globe.FightGuideSceneName = GameLibrary.UI_Major;
            }
            else
            {
                GameLibrary.LastScene = SceneManager.GetActiveScene().name;//记录前一个场景名
                StartLandingShuJu.GetInstance().GetLoadingData(GameLibrary.UI_Major, 3);
                SceneManager.LoadScene("Loding");
            }
        }

        //float posy = float.Parse(data[])
        return(true);
    }