Exemplo n.º 1
0
        public void Setup(Character character, Inventory inventory, Equipment equipment, bool isLocalPlayer)
        {
            Debug.Log("setup");
            _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)
            {
                Debug.Log("local");
                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);
                }
            }
        }
Exemplo n.º 2
0
 public void SetPrivateMessage(ChatMessage message)
 {
     privateChannel.SetReciverMessage(message);
     if (playerChat.channels.Contains(privateChannel))
     {
         RefreshChanels();
     }
     else
     {
         playerChat.RegisterChannel(privateChannel);
     }
     channelsDropdown.value = channelsDropdown.options.Count - 1;
 }