Esempio n. 1
0
    void InitPlayerSkillData(bool isPlayerSelf)
    {
        MatchPlayerProfile otherInfo = null;

        if (!isPlayerSelf)
        {
            otherInfo = MatchPlayerManager.Instance.GetMatchPlayerProfile(_owner._instanceID);
        }
        if (!isPlayerSelf && otherInfo == null)
        {
            Debug.LogError("otherInfo == null !");
            return;
        }

        string roleName = GameSettings.Instance.roleSettings[PlayerInfo.Instance.RoleID].battleLabel;

        foreach (FCPassiveSkill passiveSkill in passiveSkills)
        {
            string    skillName = passiveSkill.skillName;
            SkillData skillData = null;
            if (passiveSkill.needDataFromDatabase)
            {
                skillData = DataManager.Instance.GetSkillData(roleName, skillName, true);
                //if(!isPlayerSelf){
                //    skillData.CurLevel = otherInfo._playerInfo.GetSkillLevel(skillName);
                //}
            }

            passiveSkill.InitSkillData(skillData, _owner, _passiveSkillHandles);
        }
    }
Esempio n. 2
0
    [RPC]                                         // Called from the host
    void ReceiveProfilesFromHost(int playerIndex, // bool host,
                                 string userId,
                                 string userName,
                                 int classType,
                                 string allIds,
                                 string allSkillLvIds,
                                 int level,
                                 string attributes,
                                 string pvpTimestamp)
    {
        Debug.Log("[RPC] [receive] Players Profiles from Host");

        MatchPlayerProfile profile = new MatchPlayerProfile();

//		profile._host = host;

        //profile._playerInfo = new OLD_PlayerInfo();
        //profile._playerInfo._class = classType;
        //profile._playerInfo._id = userId;
        //profile._playerInfo.Nickname = userName;
        //profile._playerInfo.SetAllEquipmentIds(allIds);
        //profile._playerInfo.SetAllSkillState(allSkillLvIds);
        //profile._playerInfo._level = level;
        //profile._playerInfo.SetEquipmentAttribute(attributes);

        _playersProfile.Add(profile);

        //todo: sometimes player index will be wrong.
        if (PhotonNetwork.player.name == userId)
        {
            Debug.Log("my index is: " + playerIndex);
            _playerIndex = playerIndex;
        }
        MultiplayerDataManager.Instance.PvPTimestamp = pvpTimestamp;
    }
Esempio n. 3
0
    [RPC]    // Called on Host, receive from clients
    void CommitProfileToHost(string playerName,
                             string userId,
                             string userName,
                             int classType,
                             string allIds,
                             string allSkillLvIds,
                             int level,
                             string attributes)
    {
        Debug.Log("[RPC] [receive] message from " + playerName);

        MatchPlayerProfile profile = new MatchPlayerProfile();

        //profile._host = false;

        //profile._playerInfo = new OLD_PlayerInfo();
        //profile._playerInfo.RoleID = classType;
        //profile._playerInfo._id = userId;
        //profile._playerInfo.Nickname = userName;
        //profile._playerInfo.SetAllEquipmentIds(allIds);
        //profile._playerInfo.SetAllSkillState(allSkillLvIds);
        //profile._playerInfo._level = level;
        //profile._playerInfo.SetEquipmentAttribute(attributes);
        _playersProfile.Add(profile);

        if (PhotonNetwork.room.maxPlayers == _playersProfile.Count)
        {
            StartMutiPlayerGame();
        }
    }
Esempio n. 4
0
    void InitAIAgentSkillData(bool isPlayerSelf, AIAgent aiOwner)
    {
        MatchPlayerProfile otherInfo = null;

        if (!isPlayerSelf)
        {
            otherInfo = MatchPlayerManager.Instance.GetMatchPlayerProfile(_owner._instanceID);
        }
        if (!isPlayerSelf && otherInfo == null)
        {
            Debug.LogError("otherInfo == null !");
            return;
        }

        foreach (FCSkill eWSkill in _skills)
        {
            string skillName = eWSkill._skillName;

            if (IsSkill(skillName))
            {
                SkillData skillData = null;
                if (eWSkill._needDataFromDatabase)
                {
                    skillData = DataManager.Instance.GetSkillData(_owner.Data.id, skillName, true);
                    //if(!isPlayerSelf){
                    //    skillData.CurLevel = otherInfo._playerInfo.GetSkillLevel(skillName);
                    //}
                }
                eWSkill.InitSkillData(skillData, aiOwner);
            }
        }
    }
Esempio n. 5
0
    //return the root of the equipments
    public void EquipAllModule()
    {
        List <GameObject> equipmentInstanceList = new List <GameObject>();

        if (!_debugEquipment) //use data from server
        {
            if (_owner.Data.isPlayer)
            {
                if (_owner.IsPlayerSelf || (PhotonNetwork.room == null))
                {
                    PlayerInfo.Instance.GetSelfEquipmentInstance(equipmentInstanceList);
                }
                else
                {
                    //players from other clients
                    MatchPlayerProfile otherInfo = MatchPlayerManager.Instance.GetMatchPlayerProfile(_owner._instanceID);
                    if (otherInfo != null)
                    {
                        PlayerInfo.GetOtherEquipmentInstanceWithIds(equipmentInstanceList, otherInfo._playerInfo.equipIds);
                    }
                }
            }
            else
            {
                PlayerInfo.GetOtherEquipmentInstanceWithIds(equipmentInstanceList, _owner.EquipmentIds);
            }
        }
        else //use prefab equipment data
        {
            GameObject[] objs = _equipmentsAgent.GetComponent <EquipmentsList>()._equipList;

            foreach (GameObject obj in objs)
            {
                GameObject instanceObj = GameObject.Instantiate(obj) as GameObject;
                equipmentInstanceList.Add(instanceObj);
            }
        }

        foreach (GameObject go in equipmentInstanceList)
        {
            go.transform.parent = _equipmentsAgent.transform;
        }

        _owner.GetComponent <AvatarController>().RefreshEquipments(_equipmentsAgent.transform);
    }
Esempio n. 6
0
    //a player drop and remain multi-play
    private void DropClientAt(int playerIndex)
    {
        GetMatchPlayerProfile(playerIndex)._isDropped = true;
        int playerNetworkIndex = playerIndex + FCConst.k_network_id_hero_start;

        //search for the player and disable it
        for (int i = 0; i < FCConst.MAX_PLAYERS; i++)
        {
            OBJECT_ID object_ID = ObjectManager.Instance.GetObjectByNetworkID(i + FCConst.k_network_id_hero_start);
            if (object_ID != null)
            {
                if (object_ID.NetworkId == playerNetworkIndex)
                {
                    LevelManager.Singleton.DeactiveHero(i);

                    //remove sync objects
                    break;
                }
            }
        }

        bool needShowErrorMsg = true;

        if (GameManager.Instance.IsPVPMode &&
            PvPBattleSummary.Instance != null &&
            PvPBattleSummary.Instance.IsFinish
            )
        {
            needShowErrorMsg = false;
        }
        //show drop player message box in battle
        if (GameManager.Instance.GameState == EnumGameState.InBattle && needShowErrorMsg)
        {
            MatchPlayerProfile profile = GetMatchPlayerProfile(playerIndex);
            string             text    = string.Format("{0} has left from our matchmaking", profile._playerInfo.DisplayNickname);
            MessageController.Instance.AddMessage(2.0f, text);
//			UIMessageBoxManager.Instance.ShowMessageBox(text, "MessageBox", MB_TYPE.MB_OK, OnClickGoToTownCallback);
        }
    }