コード例 #1
0
ファイル: LoginHandle.cs プロジェクト: moto2002/moba
    public bool BackCheckAccount(CReadPacket packet)
    {
        Debug.Log("Chech 成功");
        if (GameLibrary.Instance().isReconect)
        {
            ClientSendDataMgr.GetSingle().GetLoginSend().SendPlayerLogin(Globe.SelectedServer.playerId, Globe.SelectedServer.heroId, Globe.SelectedServer.areaId, 1);
            return(true);
        }
        Dictionary <string, object> data = packet.data;
        long   playerID = packet.GetLong("playerId"); //long.Parse( data [ "playerId" ].ToString() );
        long   heroId   = packet.GetLong("heroId");   //long.Parse( data [ "heroId" ].ToString() );
        string name     = packet.GetString("name");   //data [ "name" ].ToString();
        int    areaId   = packet.GetInt("areaId");    //int.Parse(data["areaId"].ToString());

        Globe.SelectedServer.playerId   = uint.Parse(playerID.ToString());
        Globe.SelectedServer.heroId     = int.Parse(heroId.ToString());
        Globe.SelectedServer.playerName = name;
        Globe.SelectedServer.areaId     = int.Parse(areaId.ToString());
        UISelectServer.Instance.ResetIsStart(false);
        if (playerID > 0)
        {
            // if ( myLogin != null )
            // {
            //   myLogin( playerID , heroId, name, areaId );
            // }
            UISelectServer.Instance.isLoading = 1;
            Debug.Log("登陆");
        }
        else
        {
            UISelectServer.Instance.isLoading = 2;
            Debug.Log("注册");

            if (String.IsNullOrEmpty(playerData.GetInstance().selfData.playeName))
            {
                CHandleMgr.GetSingle().msgDishandled.Clear();
            }
            else
            {
                UICreateName.instance.SendMeg();
            }

            //	Debug.Log("注册");
            // if ( myCreate != null )
            // {
            //     myCreate( playerID , heroId , name , areaId );
            // }
        }
        return(true);
    }
コード例 #2
0
ファイル: BattleHandle.cs プロジェクト: moto2002/moba
    private bool GuidInfoRet(CReadPacket packet)
    {
        // Debug.Log("GuidInfoRet");
        Dictionary <string, object> data = packet.data;

        GameLibrary.scripid = packet.GetLong("sd");
        GameLibrary.typeid  = packet.GetShort("td");
        GameLibrary.stepid  = packet.GetShort("sp");
        //--"sd"= scriptId;
        //--"td" = typeId;
        //--"sp"= stepId;
        //--wd =widgetId


        return(true);
    }
コード例 #3
0
ファイル: LoginHandle.cs プロジェクト: moto2002/moba
    void HandleLoginPacketData(CReadPacket packet)
    {
        playerData.GetInstance().selfData.playerId = packet.GetUint32("playerId");
        playerData.GetInstance().selfData.accountId = packet.GetUint32("account");
        playerData.GetInstance().selfData.playeName = packet.GetString("name");
        playerData.GetInstance().selfData.level = packet.GetInt("level");
        playerData.GetInstance().baginfo.strength = packet.GetInt("thew");           //体力
        playerData.GetInstance().baginfo.gold = packet.GetUint32("gold");            //金币
        playerData.GetInstance().baginfo.diamond = packet.GetUint32("diamond");      //钻石
        playerData.GetInstance().selfData.heroId = packet.GetUint32("heroId");
        playerData.GetInstance().selfData.changeCount = packet.GetInt("changeName"); //改名次数
        playerData.GetInstance().selfData.exprience = packet.GetInt("exps");
        playerData.GetInstance().selfData.maxExprience = packet.GetInt("maxExps");
        playerData.GetInstance().selfData.expPool = packet.GetLong("expsPool");//经验池经验值
        if (playerData.GetInstance().selfData.expPool < 0)
        {
            playerData.GetInstance().selfData.expPool = 0;
        }
        playerData.GetInstance().baginfo.areanCoin = packet.GetUint32("arenaCoin");        //竞技场币
        playerData.GetInstance().baginfo.pveCoin = packet.GetUint32("pveCoin");            //--龙鳞币
        playerData.GetInstance().baginfo.pvpCoin = packet.GetUint32("pvpCoin");            //角斗场币
        playerData.GetInstance().baginfo.rewardCoin = packet.GetUint32("rewardCoin");      //悬赏币
        playerData.GetInstance().baginfo.todayBuyStrengthCount = packet.GetInt("buyThew"); //购买体力次数
        playerData.GetInstance().actionData.energyBuyTimes = playerData.GetInstance().baginfo.todayBuyStrengthCount;
        playerData.GetInstance().selfData.vip = packet.GetInt("vip");
        playerData.GetInstance().selfData.keyId = packet.GetUint32("ky");
        playerData.GetInstance().actionData.energyRecoverEndTime = packet.GetLong("maxThewTime");
        playerData.GetInstance().InitActionData();
        Auxiliary.SetServerTime(packet.GetDouble("sysTime"));                              //同步系统时间

        long photoId = playerData.GetInstance().iconData.icon_id = packet.GetInt("photo"); //头像
        Dictionary <long, RoleIconAttrNode> pDict = FSDataNodeTable <RoleIconAttrNode> .GetSingleton().DataNodeList;

        if (pDict.ContainsKey(photoId))
        {
            playerData.GetInstance().iconData.icon_name = pDict[photoId].icon_name;
        }
        long photoFrameId = playerData.GetInstance().iconFrameData.iconFrame_id = packet.GetInt("photoFrame"); //头像框

        if (pDict.ContainsKey(photoFrameId))
        {
            playerData.GetInstance().iconFrameData.iconFrame_name = pDict[photoFrameId].icon_name;
        }

        SocietyManager.Single().mySocityID  = packet.GetLong("unionId");     //公会id
        SocietyManager.Single().societyName = packet.GetString("unionName"); //公会名称
        if (SocietyManager.Single().mySocityID != 0 && SocietyManager.Single().societyName != "")
        {
            SocietyManager.Single().isJoinSociety = true;
            Globe.isHaveSociety = true;
        }
        else
        {
            SocietyManager.Single().isJoinSociety = false;
            Globe.isHaveSociety = false;
        }
        if (packet.GetInt("unionPosition") == 1)
        {
            SocietyManager.Single().societyStatus = SocietyStatus.Member;
        }
        else if (packet.GetInt("unionPosition") == 5)
        {
            SocietyManager.Single().societyStatus = SocietyStatus.President;
        }
        else
        {
            SocietyManager.Single().societyStatus = SocietyStatus.Null;
        }

        MountAndPetNodeData.Instance().currentMountID = packet.GetLong("defMountsId"); //当前使用的坐骑id
        MountAndPetNodeData.Instance().currentPetID   = packet.GetLong("defPetId");    //当前使用的宠物id
        MountAndPetNodeData.Instance().goMountID      = packet.GetLong("mountsId");    //使用坐骑状态,0为没有骑乘坐骑
        MountAndPetNodeData.Instance().godefPetID     = packet.GetLong("petId");       //使用的宠物状态

        if (packet.data.ContainsKey("fightHero"))
        {
            LoadHeroList(packet.data["fightHero"], ref Globe.fightHero);
        }
        LoadHeroList(packet.data["adFightHero"], ref Globe.adFightHero);
        LoadHeroList(packet.data["ed1FightHero"], ref Globe.ed1FightHero);
        LoadHeroList(packet.data["ed2FightHero"], ref Globe.ed2FightHero);
        LoadHeroList(packet.data["ed3FightHero"], ref Globe.ed3FightHero);
        LoadHeroList(packet.data["ed4FightHero"], ref Globe.ed4FightHero);
        LoadHeroList(packet.data["ed5FightHero"], ref Globe.ed5FightHero);
        if (packet.data.ContainsKey("arenaFightHero"))
        {
            LoadHeroList(packet.data["arenaFightHero"], ref Globe.arenaFightHero);
        }

        //if (Globe.adFightHero[0] == 0)
        //    LoadHeroList(packet.data["fightHero"], ref Globe.adFightHero);

        serverMgr.GetInstance().saveData();
        // ClientSendDataMgr.GetSingle().GetWalkSend().ping = true;
    }
コード例 #4
0
    //if (SceneManager.GetActiveScene().name != GameLibrary.UI_Major
    //    && SceneManager.GetActiveScene().name != GameLibrary.LGhuangyuan
    //    && SceneManager.GetActiveScene().name != GameLibrary.PVP_1V1)
    //    return false;



    //其他玩家行走消息
    public bool OtherPlayerWalkHandle(CReadPacket packet)
    {
        //if (SceneManager.GetActiveScene().name != GameLibrary.UI_Major
        //    && SceneManager.GetActiveScene().name != GameLibrary.LGhuangyuan
        //    && SceneManager.GetActiveScene().name != GameLibrary.PVP_1V1)
        //    return false;
        Dictionary <string, object> data = packet.data;
        long     fg       = long.Parse(data["fg"].ToString());
        long     ky       = long.Parse(data["ky"].ToString());
        int      si       = int.Parse(data["si"].ToString());
        RoleInfo roleInfo = null;

        if (playerData.GetInstance().NearRIarr.ContainsKey(ky))//其他玩家
        {
            roleInfo = playerData.GetInstance().NearRIarr[ky];
        }


        if ((fg & (long)(UpdatePlayerInfoType.Position)) > 0)
        {
            if (roleInfo != null)
            {
                roleInfo.posX = float.Parse(data["px"].ToString());
                roleInfo.posY = float.Parse(data["py"].ToString());
                roleInfo.posZ = float.Parse(data["pz"].ToString());
                if (roleInfo.accID != 0)
                {
                    Debug.Log("其他玩家同步消息" + roleInfo);
                }


                if (FSDataNodeTable <MapInfoNode> .GetSingleton().DataNodeList.ContainsKey(si))
                {
                    MapInfoNode tempMN = FSDataNodeTable <MapInfoNode> .GetSingleton().DataNodeList[si];

                    if (tempMN != null)
                    {
                        roleInfo.posX = float.Parse(data["px"].ToString()) + tempMN.Xmin;
                        roleInfo.posZ = float.Parse(data["pz"].ToString()) + tempMN.Zmin;
                    }
                }
                if (ky != playerData.GetInstance().selfData.keyId)
                {
                    CreatePeople.GetInstance().MoveOtherObject(ky,
                                                               roleInfo.posX, roleInfo.posY, roleInfo.posZ,
                                                               // packet.GetInt("rc"));
                                                               int.Parse(data["tp"].ToString()));
                }
            }
        }
        //朝向
        if ((fg & (long)(UpdatePlayerInfoType.Orientation)) > 0)
        {
            if (data.ContainsKey("hp"))
            {
                //    //  MapInfoNode tempMN = FSDataNodeTable<MapInfoNode>.GetSingleton().DataNodeList[int.Parse(data["si"].ToString())];
                CreatePeople.GetInstance().ChangeOtherHp(ky, int.Parse(data["hp"].ToString()));
            }
            else
            {
                if (roleInfo != null)
                {
                    roleInfo.orientX = float.Parse(data["ox"].ToString());
                    roleInfo.orientY = float.Parse(data["oy"].ToString());
                    roleInfo.orientZ = float.Parse(data["oz"].ToString());
                    if (ky != playerData.GetInstance().selfData.keyId)
                    {
                        CreatePeople.GetInstance().SetOtherPlayerOrientation(ky,
                                                                             roleInfo.posX, roleInfo.posY, roleInfo.posZ
                                                                             );
                        int.Parse(data["tp"].ToString());
                    }
                }
            }
        }
        if ((fg & (long)(UpdatePlayerInfoType.heroId)) > 0)
        {
            if (roleInfo != null)//其他玩家
            {
                if (roleInfo.roleID != packet.GetUint32("ri"))
                {
                    roleInfo.roleID = packet.GetUint32("ri");
                    GameObject.Destroy(roleInfo.RoleObj);
                    // if(roleInfo)
                    CreatePeople.GetInstance().CreateOtherPlayer(ref roleInfo, false);
                }
            }
            else//玩家自己
            {
            }
        }
        if ((fg & (long)(UpdatePlayerInfoType.UnionId)) > 0)//公会id
        {
            if (playerData.GetInstance().NearRIarr.ContainsKey(ky))
            {
                playerData.GetInstance().NearRIarr[ky].unionId = packet.GetUint32("unId");
            }

            // playerData.GetInstance().NearRIarr[ky].unionName = packet.GetString("unNm");
            // playerData.GetInstance().NearRIarr[ky].RoleObj.
        }
        if ((fg & (long)(UpdatePlayerInfoType.UnionName)) > 0)//公会id
        {
            if (playerData.GetInstance().NearRIarr.ContainsKey(ky))
            {
                playerData.GetInstance().NearRIarr[ky].unionName = packet.GetString("unNm");
            }
            if (playerData.GetInstance().NearRIarr.ContainsKey(ky))
            {
                playerData.GetInstance().NearRIarr[ky].unionName = packet.GetString("unNm");

                if (playerData.GetInstance().NearRIarr.ContainsKey(ky))
                {
                    RoleInfo   ri      = playerData.GetInstance().NearRIarr[ky];
                    GameObject tempObj = ri.RoleObj;
                    if (ri.accID != 0)//刷新其他玩家的公会名称
                    {
                        OtherPlayer otherPlayer = tempObj.GetComponent <OtherPlayer>();
                        if (otherPlayer != null)
                        {
                            if (Singleton <SceneManage> .Instance.Current == EnumSceneID.UI_MajorCity01)
                            {
                                otherPlayer.RefreshSocietyName(packet.GetString("unNm"));
                            }
                        }
                    }
                    ri = null;
                }
            }
        }
        if ((fg & (long)(UpdatePlayerInfoType.Pet)) > 0)//宠物状态更新
        {
            if (playerData.GetInstance().NearRIarr.ContainsKey(ky))
            {
                playerData.GetInstance().NearRIarr[ky].petid = packet.GetLong("pt");
                CreatePeople.GetInstance().UpdateOtherPlayerInfo(ky, UpdatePlayerInfoType.Pet);
            }
        }
        if ((fg & (long)(UpdatePlayerInfoType.Mount)) > 0)//宠物状态更新
        {
            if (playerData.GetInstance().NearRIarr.ContainsKey(ky))
            {
                playerData.GetInstance().NearRIarr[ky].mount = packet.GetLong("mt");
                CreatePeople.GetInstance().UpdateOtherPlayerInfo(ky, UpdatePlayerInfoType.Mount);
            }
        }

        //血量更新
        if ((fg & (long)(UpdatePlayerInfoType.Hp)) > 0)
        {
            if (playerData.GetInstance().NearRIarr.ContainsKey(ky))
            {
                MapInfoNode tempMN = FSDataNodeTable <MapInfoNode> .GetSingleton().DataNodeList[int.Parse(data["si"].ToString())];

                CreatePeople.GetInstance().ChangeOtherHp(ky, packet.GetInt("hp"));
            }
            else
            {
                //自己的血量同步
                if (ky == playerData.GetInstance().selfData.keyId)
                {
                    int count = packet.GetInt("hp");
                    if (CharacterManager.playerCS != null)
                    {
                        CharacterManager.playerCS.ChangeHp(count);
                    }
                    if (playerData.GetInstance().selfData.hp < count)
                    {
                        playerData.GetInstance().selfData.hp = count;
                    }
                }
            }
        }

        if ((fg & (long)(UpdatePlayerInfoType.Title)) > 0) //称号更新
        {
            if (data.ContainsKey("tl"))                    //称号更新
            {
                //if(playerData.GetInstance().NearRIarr.ContainsKey(ky))
                //{
                //    playerData.GetInstance().NearRIarr[ky].title = int.Parse(data["tl"].ToString());

                //    if (playerData.GetInstance().NearRIarr.ContainsKey(ky))
                //    {
                //        RoleInfo ri = playerData.GetInstance().NearRIarr[ky];
                //        GameObject tempObj = ri.RoleObj;
                //        if (ri.accID != 0)//刷新其他玩家的称号
                //        {
                //            OtherPlayer otherPlayer = tempObj.GetComponent<OtherPlayer>();
                //            if (otherPlayer!=null)
                //            {
                //                if (FSDataNodeTable<TitleNode>.GetSingleton().DataNodeList.ContainsKey(int.Parse(data["tl"].ToString())))
                //                {
                //                    string playerTitleName = FSDataNodeTable<TitleNode>.GetSingleton().DataNodeList[int.Parse(data["tl"].ToString())].titlename;
                //                    if (Singleton<SceneManage>.Instance.Current == EnumSceneID.UI_MajorCity01)
                //                    {
                //                        otherPlayer.RefreshTitleName(playerTitleName);
                //                    }
                //                }
                //            }
                //        }
                //        ri = null;

                //    }

                //}
            }
        }
        if ((fg & (long)(UpdatePlayerInfoType.Vitality)) > 0)//体力更新
        {
            if (ky == playerData.GetInstance().selfData.keyId)
            {
                if (data.ContainsKey("vt"))//体力更新
                {
                    playerData.GetInstance().baginfo.strength = int.Parse(data["vt"].ToString());
                    if (data.ContainsKey("mtwt"))
                    {
                        playerData.GetInstance().actionData.energyRecoverEndTime = long.Parse(data["mtwt"].ToString());
                    }
                    playerData.GetInstance().InitActionData();
                    playerData.GetInstance().ActionPointHandler(ActionPointType.Energy, playerData.GetInstance().baginfo.strength);
                }
            }
        }
        if ((fg & (long)(UpdatePlayerInfoType.RedPoint)) > 0) //红点更新
        {
            if (data.ContainsKey("rd"))                       //红点更新
            {
                if (data.ContainsKey("rd"))
                {
                    Dictionary <string, object> redData = data["rd"] as Dictionary <string, object>;
                    if (redData != null)
                    {
                        foreach (KeyValuePair <string, object> keyValuePair in redData)
                        {
                            int[]      arr     = keyValuePair.Value as int[];
                            List <int> temList = null;
                            if (arr != null && arr.Length > 0)
                            {
                                temList = new List <int>();
                                temList.AddRange(arr);
                                //for (int i = 0; i < arr.Length; i++)
                                //{
                                //    temList.Add(arr[i]);
                                //}
                            }
                            Singleton <RedPointManager> .Instance.Add((EnumRedPoint)(int.Parse(keyValuePair.Key)), temList);
                        }
                        Singleton <RedPointManager> .Instance.NotifyChange();
                    }
                }
            }
        }
        if ((fg & (long)(UpdatePlayerInfoType.Gold)) > 0)//金币更新
        {
            if (ky == playerData.GetInstance().selfData.keyId)
            {
                if (data.ContainsKey("gd"))//金币更新
                {
                    long a = long.Parse(data["gd"].ToString());
                    playerData.GetInstance().RoleMoneyHadler(MoneyType.Gold, a);
                }
            }
        }
        if ((fg & (long)(UpdatePlayerInfoType.Diamond)) > 0)//钻石更新
        {
            if (ky == playerData.GetInstance().selfData.keyId)
            {
                if (data.ContainsKey("dd"))//钻石更新
                {
                    long a = long.Parse(data["dd"].ToString());
                    playerData.GetInstance().RoleMoneyHadler(MoneyType.Diamond, a);
                }
            }
        }
        if ((fg & (long)(UpdatePlayerInfoType.PvpCoin)) > 0)//角斗场币更新
        {
            if (ky == playerData.GetInstance().selfData.keyId)
            {
                if (data.ContainsKey("ppc"))//角斗场更新
                {
                    long a = long.Parse(data["ppc"].ToString());
                    playerData.GetInstance().RoleMoneyHadler(MoneyType.PVPcoin, a);
                }
            }
        }
        if ((fg & (long)(UpdatePlayerInfoType.ArenaCoin)) > 0)//竞技场币更新
        {
            if (ky == playerData.GetInstance().selfData.keyId)
            {
                if (data.ContainsKey("ac"))//竞技场币更新
                {
                    long a = long.Parse(data["ac"].ToString());
                    playerData.GetInstance().RoleMoneyHadler(MoneyType.AreanCoin, a);
                }
            }
        }
        if ((fg & (long)(UpdatePlayerInfoType.PveCoin)) > 0)//远征币更新
        {
            if (ky == playerData.GetInstance().selfData.keyId)
            {
                if (data.ContainsKey("pec"))//远征币更新
                {
                    long a = long.Parse(data["pec"].ToString());
                    playerData.GetInstance().RoleMoneyHadler(MoneyType.PVEcion, a);
                }
            }
        }
        if ((fg & (long)(UpdatePlayerInfoType.Exp)) > 0)//人物经验更新
        {
            if (ky == playerData.GetInstance().selfData.keyId)
            {
                long a = 0; long b = 0;
                if (data.ContainsKey("ep"))                 //战斗经验
                {
                    a = long.Parse(data["ep"].ToString());  //当前经验
                }
                if (data.ContainsKey("plv"))                //战队等级
                {
                    b = long.Parse(data["plv"].ToString()); //当前等级
                }
                playerData.GetInstance().RoleLvAndExpHandler((int)b, (int)a);
            }
        }
        if ((fg & (long)(UpdatePlayerInfoType.RewardCoin)) > 0)//悬赏币更新
        {
            if (ky == playerData.GetInstance().selfData.keyId)
            {
                if (data.ContainsKey("rc"))//悬赏币更新
                {
                    long a = long.Parse(data["rc"].ToString());
                    playerData.GetInstance().RoleMoneyHadler(MoneyType.RewardCoin, a);
                }
            }
        }
        return(true);
    }