コード例 #1
0
    public void Setup(Character character, Inventory inventory, Equipment equipment, bool isLocalPlayer)
    {
        _statsManager        = GetComponent <StatsManager>();
        _progress            = GetComponent <PlayerProgress>();
        _character           = character;
        _inventory           = inventory;
        _equipment           = equipment;
        _character.Player    = this;
        _inventory.Player    = this;
        _equipment.Player    = this;
        _statsManager.Player = this;

        if (GetComponent <NetworkIdentity>().isServer)
        {
            UserAccount account = AccountManager.GetAccount(GetComponent <NetworkIdentity>().connectionToClient);
            _character.Stats.Load(account.Data);
            _character.UnitSkills.Load(account.Data);
            _progress.Load(account.Data);
            _inventory.Load(account.Data);
            _equipment.Load(account.Data);
            _character.Stats.Manager = _statsManager;
            _progress.Manager        = _statsManager;
        }

        if (isLocalPlayer)
        {
            InventoryUI.Instance.SetInventory(_inventory);
            EquipmentUI.Instance.SetEquipment(_equipment);
            StatsUI.Instance.SetManager(_statsManager);
            SkillsPanel.Instance.SetSkills(character.UnitSkills);
            SkillTree.Instance.SetCharacter(character);
            SkillTree.Instance.SetManager(_statsManager);

            PlayerChat playerChat = GetComponent <PlayerChat>();
            if (playerChat != null)
            {
                if (GlobalChatChannel.Instance != null)
                {
                    playerChat.RegisterChannel(GlobalChatChannel.Instance);
                }
                ChatChannel localChannel = _character.GetComponent <ChatChannel>();
                if (localChannel != null)
                {
                    playerChat.RegisterChannel(localChannel);
                }

                ChatUI.Instance.SetPlayerChat(playerChat);
            }
        }
    }
コード例 #2
0
ファイル: ChatUI.cs プロジェクト: stayseek/Multiplayer_P2
 public void SetPrivateMessage(ChatMessage message)
 {
     _privateChannel.SetReciverMessage(message);
     if (_playerChat.Channels.Contains(_privateChannel))
     {
         RefreshChanels();
     }
     else
     {
         _playerChat.RegisterChannel(_privateChannel);
     }
     _channelsDropdown.value = _channelsDropdown.options.Count - 1;
 }